Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 4A9A31337BEF for ; Fri, 29 Apr 2011 17:39:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 87957-03 for ; Fri, 29 Apr 2011 20:39:13 +0000 (UTC) X-Greylist: delayed 00:08:45.66028 by SQLgrey-1.7.6 Received: from depot.mtholyoke.edu (mgate.mtholyoke.edu [138.110.1.180]) by mail.postgresql.org (Postfix) with ESMTP id 6A1741337BB7 for ; Fri, 29 Apr 2011 17:39:13 -0300 (ADT) Received: from smtp.mtholyoke.edu (smtp.mtholyoke.edu [138.110.1.184]) by depot.mtholyoke.edu (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p3TKUQcV023829 for ; Fri, 29 Apr 2011 16:30:27 -0400 Received: from chip.mtholyoke.edu (chip.mtholyoke.edu [138.110.1.70]) by smtp.mtholyoke.edu (Postfix) with ESMTPS id E340657DC7 for ; Fri, 29 Apr 2011 16:30:26 -0400 (EDT) Received: from chip.mtholyoke.edu (rpeterso@localhost [127.0.0.1]) by chip.mtholyoke.edu (8.13.8/8.13.8/Debian-3) with ESMTP id p3TKUQrJ029880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 29 Apr 2011 16:30:26 -0400 Received: (from rpeterso@localhost) by chip.mtholyoke.edu (8.13.8/8.13.8/Submit) id p3TKUQxN029874 for pgsql-admin@postgresql.org; Fri, 29 Apr 2011 16:30:26 -0400 Date: Fri, 29 Apr 2011 16:30:26 -0400 From: Ron Peterson To: pgsql-admin@postgresql.org Subject: pgcrypto pgp_pub_decrypt with passphrase broken Message-ID: <20110429203026.GG11013@mtholyoke.edu> Mail-Followup-To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: Mount Holyoke College X-Operating-System: Debian GNU/Linux User-Agent: Mutt/1.5.13 (2006-08-11) X-Scanned-By: MIMEDefang 2.67 on 138.110.1.180 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/255 X-Sequence-Number: 37436 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-