Hello!
To get straight to the point, here's my problem:
mypgdb=# select bytea2text(decrypt(encrypt('Tübingen'::bytea,
'mypassphrase'::bytea,'bf'::text),'mypassphrase'::bytea,'bf'::text))as foo;
foo
-----------------
T\303\274bingen
(1 row)
I have compiled and installed pg_crypto and I'am using the following function as workaround for a bytea-to-text-cast:
create or replace function bytea2text(bytea) returns text as '
begin
return $1;
end;
' language plpgsql;
The cluster was initialized with locale de_DE.UTF-8, pg_controldata confirms:
LC_COLLATE: de_DE.UTF-8
LC_CTYPE: de_DE.UTF-8
Database version is PostgreSQL 8.0.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2
I think I'm missing something very obvious here, so please give me a hint: How can I use pgcrypto to encrypt and
decrypttext which contains UTF-8 special characters like german umlauts? I think that this simple bytea2text-function
probablyneeds a replacement, but I haven't got the faintest clue about how to actually retrieve the original input
afterencryption. Any help would be tremendously appreciated :)
Thanks in advance!
Kind regards
Markus