How to use pgcrypto?

Поиск
Список
Период
Сортировка
Искать

How to use pgcrypto?

От:
"Dylan Milks" <DMilks@greenridge.ca>
Дата:
Вложения:
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
FAQ