Next: Listing Keys, Up: Key Management [Contents][Index]
The keys are represented in GPGME by structures which may only be read by the application but never be allocated or changed. They are valid as long as the key object itself is valid.
The gpgme_key_t type is a pointer to a key object.  It has the
following members:
gpgme_keylist_mode_t keylist_modeSINCE: 0.9.0
The keylist mode that was active when the key was retrieved.
unsigned int revoked : 1This is true if the key is revoked.
unsigned int expired : 1This is true if the key is expired.
unsigned int disabled : 1This is true if the key is disabled.
unsigned int invalid : 1This is true if the key is invalid. This might have several reasons, for a example for the S/MIME backend, it will be set during key listings if the key could not be validated due to missing certificates or unmatched policies.
unsigned int can_encrypt : 1This is true if the key (ie one of its subkeys) can be used for encryption.
unsigned int can_sign : 1This is true if the key (ie one of its subkeys) can be used to create data signatures.
unsigned int can_certify : 1This is true if the key (ie one of its subkeys) can be used to create key certificates.
unsigned int can_authenticate : 1SINCE: 0.4.5
This is true if the key (ie one of its subkeys) can be used for authentication.
unsigned int is_qualified : 1SINCE: 1.1.0
This is true if the key can be used for qualified signatures according to local government regulations.
unsigned int secret : 1This is true if the key is a secret key.  Note, that this will always
be true even if the corresponding subkey flag may be false
(offline/stub keys).  This is only set if a listing of secret keys has
been requested or if GPGME_KEYLIST_MODE_WITH_SECRET is active.
unsigned int origin : 5SINCE: 1.8.0
Reserved for the origin of this key.
gpgme_protocol_t protocolThis is the protocol supported by this key.
char *issuer_serialIf protocol is GPGME_PROTOCOL_CMS, then this is the
issuer serial.
char *issuer_nameIf protocol is GPGME_PROTOCOL_CMS, then this is the
issuer name.
char *chain_idIf protocol is GPGME_PROTOCOL_CMS, then this is the
chain ID, which can be used to built the certificate chain.
gpgme_validity_t owner_trustIf protocol is GPGME_PROTOCOL_OpenPGP, then this is the
owner trust.
gpgme_subkey_t subkeysThis is a linked list with the subkeys of the key. The first subkey in the list is the primary key and usually available.
gpgme_user_id_t uidsThis is a linked list with the user IDs of the key. The first user ID in the list is the main (or primary) user ID.
char *fprSINCE: 1.7.0
This field gives the fingerprint of the primary key. Note that this is a copy of the fingerprint of the first subkey. For an incomplete key (for example from a verification result) a subkey may be missing but this field may be set nevertheless.
unsigned long last_updateSINCE: 1.8.0
Reserved for the time of the last update of this key.
SINCE: 1.5.0
The gpgme_subkey_t type is a pointer to a subkey structure.
Subkeys are one component of a gpgme_key_t object.  In fact,
subkeys are those parts that contains the real information about the
individual cryptographic keys that belong to the same key object.  One
gpgme_key_t can contain several subkeys.  The first subkey in
the linked list is also called the primary key.
The subkey structure has the following members:
gpgme_subkey_t nextThis is a pointer to the next subkey structure in the linked list, or
NULL if this is the last element.
unsigned int revoked : 1This is true if the subkey is revoked.
unsigned int expired : 1This is true if the subkey is expired.
unsigned int disabled : 1This is true if the subkey is disabled.
unsigned int invalid : 1This is true if the subkey is invalid.
unsigned int can_encrypt : 1This is true if the subkey can be used for encryption.
unsigned int can_sign : 1This is true if the subkey can be used to create data signatures.
unsigned int can_certify : 1This is true if the subkey can be used to create key certificates.
unsigned int can_authenticate : 1SINCE: 0.4.5
This is true if the subkey can be used for authentication.
unsigned int is_qualified : 1SINCE: 1.1.0
This is true if the subkey can be used for qualified signatures according to local government regulations.
unsigned int is_de_vs : 1SINCE: 1.8.0
This is true if the subkey complies with the rules for classified information in Germany at the restricted level (VS-NfD). This are currently RSA keys of at least 2048 bits or ECDH/ECDSA keys using a Brainpool curve.
unsigned int secret : 1This is true if the subkey is a secret key.  Note that it will be
false if the key is actually a stub key; i.e. a secret key operation
is currently not possible (offline-key).  This is only set if a
listing of secret keys has been requested or if
GPGME_KEYLIST_MODE_WITH_SECRET is active.
gpgme_pubkey_algo_t pubkey_algoThis is the public key algorithm supported by this subkey.
unsigned int lengthThis is the length of the subkey (in bits).
char *keyidThis is the key ID of the subkey in hexadecimal digits.
char *fprThis is the fingerprint of the subkey in hexadecimal digits, if available.
char *keygripSINCE: 1.7.0
The keygrip of the subkey in hex digit form or NULL if not
available.
long int timestampThis is the creation timestamp of the subkey. This is -1 if the timestamp is invalid, and 0 if it is not available.
long int expiresThis is the expiration timestamp of the subkey, or 0 if the subkey does not expire.
unsigned int is_cardkey : 1SINCE: 1.2.0
True if the secret key is stored on a smart card.
char *card_numberSINCE: 1.2.0
The serial number of a smart card holding this key or NULL.
char *curveFor ECC algorithms the name of the curve.
A user ID is a component of a gpgme_key_t object.  One key can
have many user IDs.  The first one in the list is the main (or
primary) user ID.
The user ID structure has the following members.
gpgme_user_id_t nextThis is a pointer to the next user ID structure in the linked list, or
NULL if this is the last element.
unsigned int revoked : 1This is true if the user ID is revoked.
unsigned int invalid : 1This is true if the user ID is invalid.
gpgme_validity_t validityThis specifies the validity of the user ID.
char *uidThis is the user ID string.
char *nameThis is the name component of uid, if available.
char *commentThis is the comment component of uid, if available.
char *emailThis is the email component of uid, if available.
char *address;The mail address (addr-spec from RFC-5322) of the user ID string.
This is general the same as the email part of this structure
but might be slightly different.  If no mail address is available
NULL is stored.
gpgme_tofu_info_t tofuSINCE: 1.7.0
If not NULL information from the TOFU database pertaining to
this user id.
gpgme_key_sig_t signaturesThis is a linked list with the signatures on this user ID.
unsigned int origin : 5SINCE: 1.8.0
Reserved for the origin of this user ID.
unsigned long last_updateSINCE: 1.8.0
Reserved for the time of the last update of this user ID.
char *uidhash;A string used by gpg to identify a user ID.  This string can be used
at certain prompts of gpgme_op_edit to select a user ID.  Users
must be prepared to see a NULL value here.  The format of the
value is not specified and may depend on the GPGME or GnuPG version.
SINCE: 1.7.0
The gpgme_tofu_info_t type is a pointer to a tofu info
structure.  Tofu info structures are one component of a
gpgme_user_id_t object, and provide information from the TOFU
database pertaining to the user ID.
The tofu info structure has the following members:
gpgme_tofu_info_t nextThis is a pointer to the next tofu info structure in the linked
list, or NULL if this is the last element.
unsigned int validity : 3This is the TOFU validity. It can have the following values:
0The value 0 indicates a conflict.
1The value 1 indicates a key without history.
2The value 2 indicates a key with too little history.
3The value 3 indicates a key with enough history for basic trust.
4The value 4 indicates a key with a lot of history.
unsigned int policy : 4This is the TOFU policy, see gpgme_tofu_policy_t.
unsigned short signcountThis is the number of signatures seen for this binding (or
USHRT_MAX if there are more than that).
unsigned short encrcountThis is the number of encryptions done with this binding (or
USHRT_MAX if there are more than that).
unsigned long signfirstNumber of seconds since Epoch when the first signature was seen with this binding.
unsigned long signlastNumber of seconds since Epoch when the last signature was seen with this binding.
unsigned long encrfirstNumber of seconds since Epoch when the first encryption was done with this binding.
unsigned long encrlastNumber of seconds since Epoch when the last encryption was done with this binding.
char *descriptionA human-readable string summarizing the TOFU data (or NULL).
The gpgme_key_sig_t type is a pointer to a key signature structure.
Key signatures are one component of a gpgme_key_t object, and
validate user IDs on the key in the OpenPGP protocol.
The signatures on a key are only available if the key was retrieved
via a listing operation with the GPGME_KEYLIST_MODE_SIGS mode
enabled, because it can be expensive to retrieve all signatures of a
key.
The signature notations on a key signature are only available if the
key was retrieved via a listing operation with the
GPGME_KEYLIST_MODE_SIG_NOTATIONS mode enabled, because it can
be expensive to retrieve all signature notations.
The key signature structure has the following members:
gpgme_key_sig_t nextThis is a pointer to the next key signature structure in the linked
list, or NULL if this is the last element.
unsigned int revoked : 1This is true if the key signature is a revocation signature.
unsigned int expired : 1This is true if the key signature is expired.
unsigned int invalid : 1This is true if the key signature is invalid.
unsigned int exportable : 1This is true if the key signature is exportable.
unsigned int trust_depth : 8This is the depth of a trust signature, or 0 if the key signature is not a trust signature.
unsigned int trust_value : 8This is the trust amount of a trust signature.
gpgme_pubkey_algo_t pubkey_algoThis is the public key algorithm used to create the signature.
char *keyidThis is the key ID of the key (in hexadecimal digits) used to create the signature.
long int timestampThis is the creation timestamp of the key signature. This is -1 if the timestamp is invalid, and 0 if it is not available.
long int expiresThis is the expiration timestamp of the key signature, or 0 if the key signature does not expire.
char *trust_scopeThis is a regular expression that limits the scope of a trust signature.
Users must be prepared to see a NULL value here.
gpgme_error_t statusThis is the status of the signature and has the same meaning as the
member of the same name in a gpgme_signature_t object.
unsigned int sig_classThis specifies the signature class of the key signature. The meaning is specific to the crypto engine.
char *uidThis is the main user ID of the key used to create the signature.
char *nameThis is the name component of uid, if available.
char *commentThis is the comment component of uid, if available.
char *emailThis is the email component of uid, if available.
gpgme_sig_notation_t notationsThis is a linked list with the notation data and policy URLs.
Next: Listing Keys, Up: Key Management [Contents][Index]