From: | "Ivan" <perseus(at)444(dot)net> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: encrypt/decrypt problem |
Date: | 2003-04-29 19:23:52 |
Message-ID: | 24778.200.60.214.125.1051644232.squirrel@webmail.444.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
thanx Dennis G. for ur patience hehehe, i made the encryption/decryption,
this are the 2 sentences
for encrypt some field:
UPDATE tabla2 SET lastname = encrypt(lastname, 'pass', 'bf') where
apellido = 'noriega';
and for retrieve the decrypt info:
SELECT decrypt(lastname, 'pass', 'bf') as "LastName" from tabla2 where
apellido = 'noriega';
thanx all!!!!
ivan
> You should try something like this:
>
> This assumes your source to be encrypted is the last name:
>
> lastname = encrypt( table.lastname::bytea, 'pass'::bytea,
> 'bf'::text)::bytea
> (make sure your field is a bytea field!!)
> decrypt(table.lastname::bytea, 'pass'::bytea, 'bf'::text)::bytea
>
> I haven't done this before myself, but this looks like what the
> documentation is trying to say.
>
>
> Ivan wrote:
>> thanx for the link!! it have cool info, well i learn how to use the
>> encrypt function:
>>
>> UPDATE tabla2 SET lastname = encrypt('pass', 'pass', 'bf') where
>> apellido = 'noriega';
>>
>> with that i change the fields i need to be encrypted... but there is
>> another problem... how i can obtain the decrypted data??, i suppose
>> that i need to use the "decrypt" function, i was trying to use it in
>> that way:
>>
>> SELECT decrypt('lastname', 'pass', 'bf') as "worked" from tabla2 where
>> apellido = 'noriega';
>>
>> but i only obtain an encrypted value (different that the i already had
>> in the db)... anyone knows how to obtain the decrypted data???
>>
>> ivan
>>
>>
>>
>>
>>>If the encrypt function is from the contribs, it CAN do reversible
>>> encryption, you just have to choose which encryption type you want to
>>> use. Please look in the archives at:
>>>
>>>http://marc.theaimsgroup.com/?l=postgresql-general&w=2&r=1&s=encrypt+contrib&q=b
>>>
>>>Ivan wrote:
>>>
>>>>>Ivan wrote:
>>>>>
>>>>>
>>>>>>hi
>>>>>>
>>>>>>i need to encrypt some fields in a table of my postgre db, my table
>>>>>> is named clients and the fields are "id", "name" and "password", i
>>>>>> was looking and i find the pgcrypto utility, i read something about
>>>>>> the pgcrypto functions and i see the "crypto" function and use it,
>>>>>> well the fields change and i supose that was encrypted... but how i
>>>>>> could obtain the decrypt info??? (i don't know it), well next i
>>>>>> read about the "encrypt-decrypt" function, maybe it is what i need
>>>>>> i try to use the encrypt function from the EMS PostgreSQL Manager
>>>>>> (SQL editor) in that form
>>>>>>
>>>>>>UPDATE tabla2 SET pass = encrypt(pass, 'iv', 'bf');
>>>>>>
>>>>>>next i try:
>>>>>>
>>>>>>encrypt(pass,'fooz','bf')
>>>>>>
>>>>>>but either work... i don't find much examples about it, pls does
>>>>>> anyone have an idea of how i can implement the "encrypt-decrypt on
>>>>>> my table???
>>>>>
>>>>>You may be running into a "one-way-hash" encryption system - in
>>>>> which when you use the crypto function, the data is stored in
>>>>> encrypted format, with the idea that you take your input supplied,
>>>>> encrypt it, and
>>>>>compare it to the field (containing the previously encrypted data) -
>>>>> if it matches, then the "password" or whatever was entered
>>>>> correctly.
>>>>>
>>>>>It typically isn't possible to reverse this one-way hash back to
>>>>> plaintext easily.
>>>>>
>>>>>Andrew Ayers
>>>>
>>>>
>>>>
>>>>thanks Andrew. well now i know that the crypt function is not what i
>>>> need, i need to encrypt all the fields of some tables not only the
>>>> passwords, if someone knows how to use the encrypt/decrypt function
>>>> and could tell me something, i will be grateful
>>>>
>>>>ivan
>>>>
>>>>
>>>>--------------------------------------------
>>>>Free Webmail courtesy of http://www.444.net/
>>>>
>>>>
>>>>---------------------------(end of
>>>>broadcast)--------------------------- TIP 3: if posting/reading
>>>> through Usenet, please send an appropriate subscribe-nomail command
>>>> to majordomo(at)postgresql(dot)org so that your message can get through to
>>>> the mailing list cleanly
>>>>
>>>
>>>
>>>---------------------------(end of
>>> broadcast)--------------------------- TIP 5: Have you checked our
>>> extensive FAQ?
>>>
>>>http://www.postgresql.org/docs/faqs/FAQ.html
>>
>>
>>
>>
>> --------------------------------------------
>> Free Webmail courtesy of http://www.444.net/
>>
>>
>> ---------------------------(end of
>> broadcast)--------------------------- TIP 4: Don't 'kill -9' the
>> postmaster
>>
--------------------------------------------
Free Webmail courtesy of http://www.444.net/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-04-29 19:24:31 | Re: qsort (was Re: Solaris) |
Previous Message | Nigel J. Andrews | 2003-04-29 19:18:40 | Re: Bad timestamp external representation |