NAME
Crypt::OpenPGP::KeyRing - Key ring object
SYNOPSIS
use Crypt::OpenPGP::KeyRing;
my $ring = Crypt::OpenPGP::KeyRing->new( Filename => 'foo.ring' );
my $kb = $ring->find_keyblock_by_keyid($key_id);
DESCRIPTION
Crypt::OpenPGP::KeyRing provides keyring management and key lookup for Crypt::OpenPGP. A KeyRing, in this case, does not necessarily have to be a keyring file; a KeyRing object is just a collection of key blocks, where each key block contains exactly one master key, zero or more subkeys, some user ID packets, some signatures, etc.
USAGE
Crypt::OpenPGP::KeyRing->new( %arg )
Constructs a new Crypt::OpenPGP::KeyRing object and returns that object. This has the effect os hooking the object to a particular keyring, so that all subsequent methods called on the KeyRing object will use the data specified in the arguments to new.
%arg can contain:
Data
A block of data specifying the serialized keyring, presumably as read in from a file on disk. This data can be either in binary form or in ASCII-armoured form; if the latter it will be unarmoured automatically.
This argument is optional.
Filename
The path to a keyring file, or at least, a file containing a key (and perhaps other associated keyblock data). The data in this file can be either in binary form or in ASCII-armoured form; if the latter it will be unarmoured automatically.
This argument is optional.
$ring->find_keyblock_by_keyid($key_id)
Looks up the key ID $key_id in the keyring $ring. $key_id should be an 8-octet string--it should not be a string of hexadecimal digits. If that is what you have, use pack to convert it to an 8-octet string:
pack 'H*', $hex_key_id
If a keyblock is found where the key ID of either the master key or subkey matches $key_id, that keyblock will be returned. In scalar context, only the Crypt::OpenPGP::KeyBlock object is returned; in list context, both the Crypt::OpenPGP::KeyBlock object and the Crypt::OpenPGP::Certificate object whose key ID matches will be returned. This can be useful in determining exactly which master key/subkey matched in the block.
Returns false on failure.
$ring->find_keyblock_by_uid($uid)
Given a string $uid, looks up all keyblocks with User ID packets matching the string $uid, including partial matches.
In scalar context, returns only the first keyblock with a matching user ID; in list context, returns all matching keyblocks.
Returns false on failure.
AUTHOR & COPYRIGHTS
Please see the Crypt::OpenPGP manpage for author, copyright, and license information.