Skip Menu |

This queue is for tickets about the Crypt-GPG CPAN distribution.

Report information
The Basics
Id: 2257
Status: resolved
Priority: 0/
Queue: Crypt-GPG

People
Owner: AGUL [...] cpan.org
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: passphrase shouldn't be required
It shouldn't be necessary to supply a passphrase when signing, as the secret key might not have a passphrase.
From: robertojimenoca [...] terra.es
I am using the attached patch to make Crypt::GPG work when there is no passphrase.
--- GPG.pm +++ GPG.pm @@ -60,9 +58,6 @@ sub sign { my $self = shift; - return unless $self->{SECRETKEY} =~ /$self->{VKEYID}/ - and $self->{PASSPHRASE} =~ /$self->{VPASSPHRASE}/; - my $detach = '-b' if $self->detach; my $armor = '-a' if $self->armor; my @extras = grep { $_ } ($detach, $armor); @@ -132,9 +125,6 @@ my $self = shift; my ($tmpfh3, $tmpnam3); - return unless $self->{SECRETKEY} || $_[1]; - return unless $self->{PASSPHRASE} =~ /$self->{VPASSPHRASE}/; - my ($tf, $ts, $td) = ($self->{TMPFILES}, $self->{TMPSUFFIX}, $self->{TMPDIR}); my ($tmpfh, $tmpnam) = tempfile ($tf, DIR => $td, SUFFIX => $ts, UNLINK => 0); my ($tmpfh2, $tmpnam2) = tempfile ($tf, DIR => $td, SUFFIX => $ts, UNLINK => 1); @@ -184,8 +172,7 @@ last; } elsif ($2) { - if ($2 eq $seckey) { - $in .= "$self->{PASSPHRASE}\n"; + $in .= $self->{PASSPHRASE} . "\n"; pump $h until $out =~ /(GOOD|BAD)_PASSPHRASE/g; if ($1 eq 'GOOD') { $success = 1; @@ -193,10 +180,6 @@ finish $h; $x = $out; last; } next; - } - else { - $out = ''; $in .= "\n"; - } } elsif ($1) { $success = 1; @@ -265,11 +247,6 @@ my $sign = $_[2] && $_[2] eq '-sign' ? '--sign' : ''; my $armor = $self->{ARMOR} ? '-a' : ''; - if ($sign) { - return unless $self->{SECRETKEY} =~ /$self->{VKEYID}/ - and $self->{PASSPHRASE} =~ /$self->{VPASSPHRASE}/; - } - my @rcpts; if (ref($rcpts) eq 'ARRAY') { @rcpts = map {
Passphrase hasn't been required for a while. The test scripts check everything with a blank passphrase too. The patch posted by Roberto additionally allows for signing without specifying a secret key (the default key is used if no secret key is specified). This is now supported in 1.63.