Re: How to encrypt data in Postgresql

From: "Reuben D(dot) Budiardja" <techlist(at)voyager(dot)phys(dot)utk(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to encrypt data in Postgresql
Date: 2003-07-25 13:33:30
Message-ID: 200307250933.30322.techlist@voyager.phys.utk.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 24 July 2003 02:59 pm, Franco Bruno Borghesi wrote:
> You must install pgcrypto (its in your contrib/pgcrypto directory).
>
> Then, the functions crypt and gen_salt will become available.
>
> As an example, to insert a new user (peter) with an encrypted password
> (1234) you can do:
> INSERT INTO myUsers(name, pass) VALUES ('peter', crypt('1234',
> gen_salt('md5'));
>
> To verify that <anypassword> is OK:
> SELECT (<anypassword>=crypt(<anypassword>, pass)) WHERE name='peter';

I think if you encrypt MD5 before storing it into the table, then there is no
way to retrieve the corresponding clear text right? since MD5 is one-way
encryption..

RDB

> The package includes many other functions, listed in README.pgcrypto.
>
> On Thu, 2003-07-24 at 15:18, Terence Chang wrote:
> > Hi there:
> >
> > I know this might be an easy answer, but I was unable to figure out
> > the solution.
> >
> > I would like to encrypt a password field in the table. I could not
> > figure out how phpPGAdmin did.
> >
> > Should I use PHP's MD5 to encrypt the password? Is there a function in
> > PostgreSQL that can encrypt the data with MD5?
> >
> > I would like to encrypt the data in PostgreSQL, so other program can
> > use the same function. Can anyone give me some hints? What key word
> > should I search in the document?
> >
> > Thansk!

--
Reuben D. Budiardja
Department of Physics and Astronomy
The University of Tennessee, Knoxville, TN
-------------------------------------------------
/"\ ASCII Ribbon Campaign against HTML
\ / email and proprietary format
X attachments.
/ \
-------------------------------------------------
Have you been used by Microsoft today?
Choose your life. Choose freedom.
Choose LINUX.
-------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Errol Neal 2003-07-25 13:34:59 Solaris, Postgresql and Problems
Previous Message Reuben D. Budiardja 2003-07-25 13:31:37 Re: Can I turn the case sensitive off