Re: Problems with pgcrypto and special characters - Mailing list pgsql-general

From Ragnar Hafstað
Subject Re: Problems with pgcrypto and special characters
Date
Msg-id 1109619413.16688.65.camel@localhost.localdomain
Whole thread Raw
In response to Problems with pgcrypto and special characters  ("Markus Wollny" <Markus.Wollny@computec.de>)
List 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




pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Unicode support on Win32
Next
From: "DEV"
Date:
Subject: indexing date_part