How to use pgcrypto?

From: "Dylan Milks" <DMilks(at)greenridge(dot)ca>
To: "PostgreSQL" <pgsql-admin(at)postgresql(dot)org>
Subject: How to use pgcrypto?
Date: 2003-09-09 16:11:50
Message-ID: 84D4D76946AC2F43AA9BDCD860DC667518C18C@voyager.greenridge-int.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 that same 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 concrete example to follow. All the examples in the documentation are not very clear.

Thanks,
Dylan

Attachment Content-Type Size
winmail.dat application/ms-tnef 2.4 KB

Browse pgsql-admin by date

  From Date Subject
Next Message Marvin 2003-09-09 16:15:33 Export to file
Previous Message Gaetano Mendola 2003-09-09 14:39:41 Re: Duplicate key ( reindex and vacuum full logs )