PGP::FindKey - Perl interface to finding PGP keyids from e-mail addresses.
use PGP::FindKey; $obj = new PGP::FindKey ( 'keyserver' => 'keyserver.pgp.com', 'address' => 'email@example.com' ); die( "The key could not be found, or there was one than one match.\n" ) unless defined($obj); print $obj->result; # the keyid found. print $obj->name; # the name associated with the key. # We could call `gpg --recv-key $obj->result` here.
Perl interface to finding PGP keyids from e-mail addresses.
new - Creates a new PGP::FindKey object. Parameters:
address: (mandatory) E-mail address to be translated. keyserver: Default to 'keyserver.pgp.com'. path: Default to '/pks/lookup?'. command: Default to '?op=index&search='.
The module will return undef if more than one key is present for an address. This is because that we - or indeed, the user - have no way of knowing which key they're after in this case, and it would be a bad idea to encourage them to encrypt to a random public key. This limitation will be addressed when a $want_array param is implemented, and the choice can be given to the user if required.
Plenty of things: \- More information about the key found. \- More meaningful error reporting. \- Other mechanisms. $want_array param, more OO.
Chris Ball <firstname.lastname@example.org>