Subject: libgnupg-perl: Can't use unprotected private keys Package: libgnupg-perl Version: 0.9-9 Severity: normal Tags: patch
*** Please type your report below this line ***
When trying to use an unprotected private key (without passphrase) it fails
and exits with error:
Protocol error: expected NEED_PASSPHRASE.* got GOOD_PASSPHRASE
An example of code that can trigger the error :
#!perl
use GnuPG;
my $gpg = new GnuPG();
$gpg->encrypt(
plaintext => 'plain.txt',
output => 'encryptsigned.dat',
recipient => 'me',
sign => 1,
);
This fails when the private key is passprotected (this is right), but fails
it too when the private
key has no password.
Equivalent commandline gpg works without problem ( gpg -ser me < plain.txt>
encryptsigned.dat )
Enabling trace and digging the code shows the error meessage originates at
the 'send_passphrase' function.
I propose a simple patch that simply returns from send_passphrase when the
password is not present:
--- /usr/share/perl5/GnuPG.pm 2007-08-06 16:19:44.000000000 +0200
+++ GnuPG.pm 2007-08-06 16:19:10.000000000 +0200
@@ -325,8 +325,6 @@
sub send_passphrase($$) {
my ($self,$passwd) = @_;
-
- return unless $passwd;
# GnuPG should now tell us that it needs a passphrase
my $cmd = $self->read_from_status;
Not fully tested but it works for me.
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-686
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Versions of packages libgnupg-perl depends on:
ii gnupg 1.4.6-2 GNU privacy guard - a free PGP
rep
libgnupg-perl recommends no packages.
-- no debconf information
nullpass.patch
Description: Binary data

