Search Postgresql Archives

pgp encryption functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I'm trying to use the pgp_pub_encrypt and pgp_pub_decrypt_bytea functions to store some data in my db.

This is how I encrypt:

INSERT INTO "Test"(
           "test")
VALUES (pgp_pub_encrypt('test', dearmor('-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.12 (MingW32)

mQENBErk2KkBCAC.... (public key block) ...
-----END PGP PUBLIC KEY BLOCK-----
')));

And this is how I try to decrypt:

SELECT pgp_pub_decrypt_bytea(bytea ("test"), dearmor('-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: GnuPG v2.0.12 (MingW32)

lQO+BErk2KkBC... (private key block) ...
-----END PGP PRIVATE KEY BLOCK-----
'), 'ktulu3437')  --> this is the passphrase
 FROM "Test";

Encryptions works fine, but the decrypting returns "Corrupt data".
What am I doing wrong?

Christian Petzold.



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux