Skip Menu |

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

Report information
The Basics
Id: 14033
Status: patched
Priority: 0/
Queue: Crypt-OpenPGP

People
Owner: Nobody in particular
Requestors: MARKSTOS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.03
Fixed in: 1.11



Subject: wish: better error handling in ::SessionKey
I'm getting this cryptic error with 1.03: Can't call method "keysize" on an undefined value at /usr/local/lib/perl5/site_perl/5.6.1/Crypt/OpenPGP/SessionKey.pm line 27. Here's the line: my $keysize = Crypt::OpenPGP::Cipher->new($alg)->keysize; It would be nice if the code checked to see whether this call to new() producted a valid object. If not, it could die with a nice error message telling me something about $alg, which would give me a hint of where to look next. Thanks!
Subject: wish: better error handling in ::SessionKey (PATCH)
From: markstos [...] cpan.org
Here's patch for this: --- /usr/local/lib/perl5/site_perl/5.8.3/Crypt/OpenPGP/SessionKey.pm Mon Jul 15 02:07:30 2002 +++ Crypt/OpenPGP/SessionKey.pm Fri Aug 5 14:05:44 2005 @@ -24,7 +24,9 @@ $key->{version} = 3; if ((my $cert = $param{Key}) && (my $sym_key = $param{SymKey})) { my $alg = $param{Cipher} || DEFAULT_CIPHER; - my $keysize = Crypt::OpenPGP::Cipher->new($alg)->keysize; + my $cipher = Crypt::OpenPGP::Cipher->new($alg) + or return (ref $key)->error("Creating new Cipher failed: ". Crypt::OpenPGP::Cipher->errstr); + my $keysize = $cipher->keysize; $sym_key = substr $sym_key, 0, $keysize; my $pk = $cert->key->public_key; my $enc = $key->_encode($sym_key, $alg, $pk->bytesize) or After the patch, I get a much more helpful error: Creating new Cipher failed: Error loading cipher implementation for 'Rijndael': no implementations installed.
RT-Send-CC: MARKSTOS [...] cpan.org