Re: does encrypt function support higher than basic ascii?

From: "Naoko Reeves" <naoko(at)lawlogix(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: does encrypt function support higher than basic ascii?
Date: 2009-11-17 21:10:41
Message-ID: 076DC33A3D38CE4BBC64D35DDD9DE70C098DA5BE@mse4be2.mse4.exchange.ms
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I see that's how you cast...Yes that worked PERFECTLY. I am always learning something new from the list. Thank you VERY much!

-----Original Message-----
From: Richard Huxton [mailto:dev(at)archonet(dot)com]
Sent: Tuesday, November 17, 2009 2:07 PM
To: Naoko Reeves
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] does encrypt function support higher than basic ascii?

Naoko Reeves wrote:
> Sorry, as Richard said the issue was me not converting bytea to text. The blow did it . thank you!
>
> SELECT convert_from((select decrypt(encrypt((select convert('aéiou','LATIN1', 'LATIN1')),'foo','aes'),'foo','aes')),'UNICODE')

I'm surprised you can't just do:

SELECT convert_from(
decrypt(
encrypt( 'aéiou'::bytea, 'foo', 'aes' )
, 'foo', 'aes'
)
, 'unicode'
)

You should be able to cast to bytea simply enough. Coming back the other
way, you do need to tell it what encoding you have through convert_from().

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nick 2009-11-17 22:29:20 Re: Can anyone help setting up pgbouncer?
Previous Message Richard Huxton 2009-11-17 21:07:25 Re: does encrypt function support higher than basic ascii?