How to use pgcrypto? - Mailing list pgsql-admin

From Dylan Milks
Subject How to use pgcrypto?
Date
Msg-id 84D4D76946AC2F43AA9BDCD860DC667518C18C@voyager.greenridge-int.ca
Whole thread Raw
List pgsql-admin
Hi. I've read some of the documentation on how to use use pgcrypto, but I still can't seem to get it working properly.

All I want to do is encrypt a field (using the AES algorithm) before inserting into the table, and consequently decrypt
thatsame field when I pull it out. 

Example (my table is called "encode_test" and it has one field "username"):

INSERT INTO encode_test(username) values(encrypt('testpassword','key','aes-cbc/pad:none'));

SELECT decrypt(username,'key','aes-cbc/pad:none') FROM encode_test;

But when I insert and select it out, all I see are question marks (?). What am I doing wrong? Can anyone give me a
concreteexample to follow. All the examples in the documentation are not very clear. 

Thanks,
Dylan

Attachment

pgsql-admin by date:

Previous
From: "Gaetano Mendola"
Date:
Subject: Re: Duplicate key ( reindex and vacuum full logs )
Next
From: "Marvin"
Date:
Subject: Export to file