Re: hi i need to encrypt one field in a table - Mailing list pgsql-sql

From Mario Splivalo
Subject Re: hi i need to encrypt one field in a table
Date
Msg-id 1149001795.18422.35.camel@localhost.localdomain
Whole thread Raw
In response to hi i need to encrypt one field in a table  ("Penchalaiah P." <penchalaiahp@infics.com>)
List pgsql-sql
On Tue, 2006-05-30 at 15:42 +0530, Penchalaiah P. wrote:
> Hello,
> I want to create a table with an encrypted field for a password entry, so
> that you can see only ********.
> And can I encrypt fields which datatype is an integer or a timestamp?

No can do. I mean, you can't do something like that. You can either give
(actually, revoke) that particular user/role permisions to read the
table with the passwords, or you could store hashed values to the
database. 

Later is prefered, I'd say. You could use md5() function to create
hashes, store those in the database, and when checking for the
credentials compare the hases. You'd compare user input flushed trough
md5() function with the hash you have in the database. That way you
don't know what user passwords are, and you could only set a new
password if user forgets his/hers password.

You don't need encrypted passwords. 
Mario
-- 
Mario Splivalo
Mob-Art
mario.splivalo@mobart.hr

"I can do it quick, I can do it cheap, I can do it well. Pick any two."




pgsql-sql by date:

Previous
From: Juris
Date:
Subject: Re: hi i need to encrypt one field in a table
Next
From: Miroslav Šulc
Date:
Subject: DELETE ... USING ... - 8.0 and 8.1 compatibility problem