Skip Menu |

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

Report information
The Basics
Id: 69849
Status: resolved
Priority: 0/
Queue: Mail-GPG

People
Owner: Nobody in particular
Requestors: hlein [...] korelogic.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.0.6
Fixed in: (no value)



Subject: Small patch to make Mail::GPG support passphraseless keys
Mail::GPG will refuse to work with a key with no passphrase. Of course, this is usually a bad idea, but if you choose to do so, it should be possible. I was generating a series of messages using a variety of test keys, zero interest in putting passphrases on them. Mail::GPG dies with "No passphrase set" if the passphrase is set to '' (an empty string). By simply changing those checks to see if $passphrase is defined, I get the desired behavior when a passphrase is defined as '': using a passphraseless key works, but the error-checking still functions if the user forgets to specify a passphrase at all. Simple patch attached.
Subject: Mail_GPG_blankpassphrase.diff
--- Mail-GPG-1.0.6/lib/Mail/GPG.pm.orig 2006-11-18 03:49:05.000000000 -0500 +++ Mail-GPG-1.0.6/lib/Mail/GPG.pm 2011-07-27 18:00:39.000000000 -0400 @@ -446,7 +446,7 @@ #-- check parameters die "No key_id set" if $key_id eq ''; - die "No passphrase set" if $passphrase eq ''; + die "No passphrase set" if not defined $passphrase; #-- build entity for signed version #-- (only the 2nd part with the signature data @@ -564,7 +564,7 @@ #-- check parameters die "No key_id set" if not $_no_sign and $key_id eq ''; - die "No passphrase set" if not $_no_sign and $passphrase eq ''; + die "No passphrase set" if not $_no_sign and not defined $passphrase; #-- build entity for encrypted version #-- (only the 2nd part with the encrypted data @@ -687,7 +687,7 @@ #-- check parameters die "No key_id set" if $key_id eq ''; - die "No passphrase set" if $passphrase eq ''; + die "No passphrase set" if not defined $passphrase; die "Entity has no body" if not $entity->bodyhandle; #-- check, if body content-transfer-encoding is 7bit safe @@ -804,7 +804,7 @@ #-- check parameters die "No key_id set" if $key_id eq ''; - die "No passphrase set" if $passphrase eq ''; + die "No passphrase set" if not defined $passphrase; } #-- check parameters
Thanks for this request & patch. I will apply your patch and push a new release next week.
From: hlein [...] korelogic.com
On Thu Jul 28 02:55:00 2011, JRED wrote: Show quoted text
> Thanks for this request & patch. > > I will apply your patch and push a new release next week.
That's great, thank you! And thanks for Mail::GPG, it's been very helpful, a huge improvement over trying to use GPG::Interface and MIME::Parser / ::Entity directly.
I just applied the patch and uploaded a new release 1.0.7 to PAUSE. Should arrive soon in CPAN.