Hi,
I have pgcrypto working fine with gpg keys that do *not* have a passphrase. But,
if I try the exact same gpg -a --export commands and application code with gpg
keys that are generated *with* a passphrase, then I get the following
pgp_pub_decrypt() error within psql:
\set pubkey '''' `sed -e "s/'/''/g" -e 's/\\n/\\r\\n/g' -e 's/\\/\\\\/g' <
test-public.key` ''''
\set prvkey '''' `sed -e "s/'/''/g" -e 's/\\n/\\r\\n/g' -e 's/\\/\\\\/g' <
test-secret.key` ''''
SELECT pgp_pub_decrypt( dearmor( (SELECT armor((SELECT pgp_pub_encrypt('mypass',
dearmor(:pubkey))))) ), dearmor(:prvkey), 'test' );
ERROR: Corrupt data
Here are my versions:
PostgreSQL version: 8.4.4
GPG version: 1.4.10
(both were built with OpenSSL support)
I've verified my SQL code via psql and I feel pretty confident it's OK, since I
have it narrowed down to where the only difference is whether the gpg exported
keys were originally assigned with a passphrase, or not assigned a passphrase
(just press enter when prompted), when running "gpg --gen-key".
Any troubleshooting help or suggestions would be greatly appreciated!
Thanks, -Eric