Skip Menu |

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

Report information
The Basics
Id: 59212
Status: resolved
Priority: 0/
Queue: Crypt-OpenPGP

People
Owner: Nobody in particular
Requestors: mutant.nz [...] gmail.com
Cc:
AdminCc:

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



Subject: Crypt::OpenPGP::Key should die if algorithm unsupported
If Crypt::OpenPGP::Key is asked to find a key with an algorithm that doesn't have a corresponding package installed, it will return an error (i.e. these lines from new()): eval "use $pkg;"; return $class->error("Unsupported algorithm '$alg': $@") if $@; I had a system that didn't have Crypt::RSA installed (my mistake), but it took me a long time to track down the problem. I had some code like this: $sec_ring->find_keyblock_by_keyid( pack("H*", $key_id) ) or croak "Error:" . $sec_ring->error; find_keyblock_by_keyid() was returning false, and the code croaked (with nothing in the sec ring error), but it wasn't obvious what caused the problem. I thought it was to do with it not being able to find the key rings, etc. It would've been much more obvious what the problem was if Crypt::OpenPGP::Key had died.
What was the error you were getting back from $sec_ring->errstr? Was the underlying "Unsupported algorithm" error string not being propagated back up through the call chain? On Thu Jul 08 23:10:43 2010, Mutant wrote: Show quoted text
> If Crypt::OpenPGP::Key is asked to find a key with an algorithm that > doesn't have a corresponding package installed, it will return an error > (i.e. these lines from new()): > > eval "use $pkg;"; > return $class->error("Unsupported algorithm '$alg': $@") if $@; > > I had a system that didn't have Crypt::RSA installed (my mistake), but > it took me a long time to track down the problem. I had some code like this: > > $sec_ring->find_keyblock_by_keyid( pack("H*", $key_id) ) or croak > "Error:" . $sec_ring->error; > > find_keyblock_by_keyid() was returning false, and the code croaked (with > nothing in the sec ring error), but it wasn't obvious what caused the > problem. I thought it was to do with it not being able to find the key > rings, etc. It would've been much more obvious what the problem was if > Crypt::OpenPGP::Key had died.
From: mutant.nz [...] gmail.com
On Tue Dec 07 14:28:58 2010, BTROTT wrote: Show quoted text
> What was the error you were getting back from $sec_ring->errstr? Was > the underlying > "Unsupported algorithm" error string not being propagated back up > through the call chain? >
I think I was getting an empty string, but looking at the code above, I was using $sec_ring->error, when I think it should be $sec_ring->errstr ... so possibly, it was actually my mistake.