PGP::FindKey - Perl interface to finding PGP keyids from e-mail addresses.
use PGP::FindKey; $obj = new PGP::FindKey ( 'keyserver' => 'keyserver.pgp.com', 'address' => 'remote_user@their.address' ); 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 <chris@cpan.org>
perl(1).
To install PGP::FindKey, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PGP::FindKey
CPAN shell
perl -MCPAN -e shell install PGP::FindKey
For more information on module installation, please visit the detailed CPAN module installation guide.