pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron Peterson <rpeterso@mtholyoke.edu>
To: pgsql-admin@postgresql.org
Subject: pgcrypto pgp_pub_decrypt with passphrase broken
Date: Fri, 29 Apr 2011 16:30:26 -0400
Message-ID: <20110429203026.GG11013@mtholyoke.edu> (raw)

AFAIKT, pgp_pub_decrypt is broken if you protect your private key with a
passphrase.  e.g.

works:
pgp_pub_decrypt( pgp_pub_encrypt( 'secret', dearmor(pubkey) ),
                 dearmor(privkey) )

fails:
pgp_pub_decrypt( pgp_pub_encrypt( 'secret', dearmor(pubkey) ),
                 dearmor(privkey),
                 'passphrase' )
                 
The error maps to PXE_MBUF_SHORT_READ, which is only thrown by mbuf.c,
in the pullf_read_fixed function.  This function is called from various
places; tracing the problem back, I believe the problem arises in
process_secret_key from pgp-pubkey.c, on this call to pgp_mpi_read:

        case PGP_PUB_RSA_ENCRYPT_SIGN:
            res = pgp_mpi_read(pkt, &pk->sec.rsa.d);
            if (res < 0)
                break;

That's as far back as I went (just throwing in fprintf statements to
trace things).

PostgreSQL 9.0.3
Keys created by GPG 1.4.10

Any ideas how to fix this?

-Ron-



Message-ID: <20110429203026.GG11013@mtholyoke.edu>
Permalink:  ../20110429203026.GG11013@mtholyoke.edu/
Also on:    postgresql.org/message-id/20110429203026.GG11013@mtholyoke.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: rpeterso@mtholyoke.edu
  Subject: Re: pgcrypto pgp_pub_decrypt with passphrase broken
  In-Reply-To: <20110429203026.GG11013@mtholyoke.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox