Re: Problems with pgcrypto and special characters

From: Ragnar Hafstað <gnari(at)simnet(dot)is>
To: Markus Wollny <Markus(dot)Wollny(at)computec(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problems with pgcrypto and special characters
Date: 2005-02-28 19:36:53
Message-ID: 1109619413.16688.65.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2005-02-28 at 18:32 +0100, Markus Wollny wrote:
> 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:

are you sure your problem is with pg_crypto ?
what does this produce:
select bytea2text('Tübingen'::bytea) as foo;
?

have you tried to use encode()/decode() instead ?
untested:
select
decode(
decrypt(
encrypt(
encode('Tübingen','escape') ,
'mypassphrase'::bytea,
'bf'::text
),
'mypassphrase'::bytea,
'bf'::text
)
) as foo;

(sorry for the obsessive indentation)

gnari

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-02-28 19:36:59 Fast major-version upgrade (was: [GENERAL] postgresql 8.0 advantages)
Previous Message DEV 2005-02-28 19:35:05 indexing date_part