From: | Marko Kreen <markokr(at)gmail(dot)com> |
---|---|
To: | Christian Petzold <C(dot)Petzold(at)gmx(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: pgp encryption functions |
Date: | 2009-11-09 08:31:43 |
Message-ID: | e51f66da0911090031x2dd189a6hfe94838023b4c380@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 11/7/09, Christian Petzold <C(dot)Petzold(at)gmx(dot)net> wrote:
> 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?
- if this is the SQL you test with, make sure the table is empty...
- this message may also appear if the passphrase for secret key is wrong.
[this needs fixing]
- make sure the secret key really corresponds to public key
If none of these fix your problem, please send repeatable test-case
(with temp key).
--
marko
From | Date | Subject | |
---|---|---|---|
Next Message | Alexandra Roy | 2009-11-09 08:35:18 | PostgreSQL 8.3.8 on AIX5.3 : compilation failed |
Previous Message | Tim Uckun | 2009-11-09 08:26:24 | Re: I can't seem to put the right combination of magic into the pg_hba and pg_ident files. |