How to use pgcrypto?

Поиск
Список
Период
Сортировка
От Dylan Milks
Тема How to use pgcrypto?
Дата
Msg-id 84D4D76946AC2F43AA9BDCD860DC667518C18C@voyager.greenridge-int.ca
обсуждение исходный текст
Список 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

Вложения

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Gaetano Mendola"
Дата:
Сообщение: Re: Duplicate key ( reindex and vacuum full logs )
Следующее
От: "Marvin"
Дата:
Сообщение: Export to file