Subject: | decrypt method fails because of secret key handling |
I have been unable to decrypt and I haven't found anything on the web explaining usage (other than the man page, in which the usage is unclear).
I finally diagnosed the problem. It turns out that another user (dmorel) reported this as part of 13563. I wanted to call it out a bit and offer a slightly different fix.
Line 176 of GPG.pm contains:
if ($2 eq $self->{SECRETKEY}->{ID}) {
This should be changed to
$my seckey = ref($self->{SECRETKEY}) ? $self->{SECRETKEY}->{ID} : $self->{SECRETKEY};
if ($2 eq $seckey)) {
This will allow the routine to function in the previous mode (assuming it is still valid), while supporting the usage that I am employing. An example of my usage follows:
my $gpg = new Crypt::GPG;
$gpg->secretkey('462992BD1262EC19');
$gpg->passphrase('abc');
my $plaintext = $gpg->gpg->decrypt(\@lines);
The @lines array contains the encrypted message (i.e., '-----BEGIN PGP MESSAGE-----' ...).
It doesn't look like this module has seen any changes lately. I hope Mr. Gulhati has some time to look at these bugs. If I'm misusing the interface, I'd like to know. In the meantime, perhaps this workaround can help someone else.
I'm using gpg version 1.4.1.