Reputation: 11
is there any pair of encrypt and respective decrypt function? Functions In PGCRYPTO library uses hash algorithms so they don't have decryption functions. Also when I am using pgp_sym_encrypt() and pgp_sym_decrypt() functions, pgp_sym_decrypt() function gives the above error for encrypted value of pgp_sym_encrypt(). I am using Postgres Plus Advanced Server 8.4. Do I have to put \ before every escape sequence character or what?
Please provide the solution how to access bytea data and also put encrypted value in table column and decrypt the same value. Thanks Tushar
Upvotes: 1
Views: 1423
Reputation: 23920
If you encrypt/decrypt binary data you should use pgp_sym_encrypt_bytea
and pgp_sym_decrypt_bytea
functions.
The functions pgp_sym_encrypt
and pgp_sym_decrypt
are for textual data which has to be encoded in client encoding and possible to convert to database encoding. So you can not use them for example to encrypt images, PDFs etc.
Upvotes: 2