GnuPG::Key(3) GnuPG Key Object


# assumes a GnuPG::Interface object in $gnupg
my @keys = $gnupg->get_public_keys( 'ftobin' );
# now GnuPG::PublicKey objects are in @keys


GnuPG::Key objects are generally not instantiated on their own, but rather used as a superclass of GnuPG::PublicKey, GnuPG::SecretKey, or GnuPG::SubKey objects.


Initialization Methods

new( %initialization_args )
This methods creates a new object. The optional arguments are initialization of data members.
hash_init( %args ).
This returns the commonly-used short, 8 character short hex id of the key.
compare( $other, $deep )
Returns non-zero only when this Key is identical to the other GnuPG::Key. If $deep is present and non-zero, the key's associated signatures, revocations, and revokers will also be compared.


Number of bits in the key.
They algorithm number that the Key is used for.
The Key Usage flags associated with this key, represented as a string of lower-case letters. Possible values include: (a) authenticate, (c) certify, (e) encrypt, and (s) sign.

A key may have any combination of them in any order. In addition to these letters, the primary key has uppercase versions of the letters to denote the _usable_ capabilities of the entire key, and a potential letter 'D' to indicate a disabled key.

See ``key capabilities'' DETAILS from the GnuPG sources for more details.

The data of the key. WARNING: this seems to have never been instantiated, and should always be undef.
A list of Math::BigInt objects that correspond to the public key material for the given key (this member is empty on secret keys).

For DSA keys, the values are: prime (p), group order (q), group generator (g), y

For RSA keys, the values are: modulus (n), exponent (e)

For El Gamal keys, the values are: prime (p), group generator (g), y

For more details, see:

The long hex id of the key. This is not the fingerprint nor the short hex id, which is 8 hex characters.
Formatted date of the key's creation and expiration. If the key has no expiration, expiration_date_string will return undef.
Date of the key's creation and expiration, stored as the number of seconds since midnight 1970-01-01 UTC. If the key has no expiration, expiration_date will return undef.
A GnuPG::Fingerprint object.
A list of GnuPG::Signature objects embodying the signatures on this key. For subkeys, the signatures are usually subkey-binding signatures. For primary keys, the signatures are statements about the key itself.
A list of revocations associated with this key, stored as GnuPG::Signature objects (since revocations are a type of certification as well). Note that a revocation of a primary key has a different semantic meaning than a revocation associated with a subkey.
A list of GnuPG::Revoker objects associated with this key, indicating other keys which are allowed to revoke certifications made by this key.