Обсуждение: How to convert BYTEA (from decrypt) to TEXT?

Поиск
Список
Период
Сортировка

How to convert BYTEA (from decrypt) to TEXT?

От
Vincenzo Romano
Дата:
Hi all.
I know that the output of a decrypt() call (from pgcrypto module) can
be safely converted to TEXT.
CAST( decrypt( data,key,'bf' ) as TEXT ) (and other variants) just doesn't work.
How can I (possibly easily) do it?
Thanks.

Re: How to convert BYTEA (from decrypt) to TEXT?

От
Vincenzo Romano
Дата:
2012/4/23 Vincenzo Romano <vincenzo.romano@notorand.it>:
> Hi all.
> I know that the output of a decrypt() call (from pgcrypto module) can
> be safely converted to TEXT.
> CAST( decrypt( data,key,'bf' ) as TEXT ) (and other variants) just doesn't work.
> How can I (possibly easily) do it?
> Thanks.

Found!
It is on chapter 9.4

select
  *
  from convert_from( decrypt(
'\x864b9b7e89f7beda7030b3918811299f3489315f7818f594a16fb17461a12db5','fooz','aes'
),'UTF8' );

(sorry for bothering).