Next: , Up: Key Management   [Contents][Index]


7.5.1 Key objects

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.

Data type: gpgme_key_t

The gpgme_key_t type is a pointer to a key object. It has the following members:

gpgme_keylist_mode_t keylist_mode

The keylist mode that was active when the key was retrieved.

unsigned int revoked : 1

This is true if the key is revoked.

unsigned int expired : 1

This is true if the key is expired.

unsigned int disabled : 1

This is true if the key is disabled.

unsigned int invalid : 1

This 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 : 1

This is true if the key (ie one of its subkeys) can be used for encryption.

unsigned int can_sign : 1

This is true if the key (ie one of its subkeys) can be used to create data signatures.

unsigned int can_certify : 1

This is true if the key (ie one of its subkeys) can be used to create key certificates.

unsigned int can_authenticate : 1

This is true if the key (ie one of its subkeys) can be used for authentication.

unsigned int is_qualified : 1

This is true if the key can be used for qualified signatures according to local government regulations.

unsigned int secret : 1

This 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 : 5

Reserved for the origin of this key.

gpgme_protocol_t protocol

This is the protocol supported by this key.

char *issuer_serial

If protocol is GPGME_PROTOCOL_CMS, then this is the issuer serial.

char *issuer_name

If protocol is GPGME_PROTOCOL_CMS, then this is the issuer name.

char *chain_id

If protocol is GPGME_PROTOCOL_CMS, then this is the chain ID, which can be used to built the certificate chain.

gpgme_validity_t owner_trust

If protocol is GPGME_PROTOCOL_OpenPGP, then this is the owner trust.

gpgme_subkey_t subkeys

This 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 uids

This 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 *fpr

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_update

Reserved for the time of the last update of this key.

Data type: gpgme_subkey_t

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 next

This is a pointer to the next subkey structure in the linked list, or NULL if this is the last element.

unsigned int revoked : 1

This is true if the subkey is revoked.

unsigned int expired : 1

This is true if the subkey is expired.

unsigned int disabled : 1

This is true if the subkey is disabled.

unsigned int invalid : 1

This is true if the subkey is invalid.

unsigned int can_encrypt : 1

This is true if the subkey can be used for encryption.

unsigned int can_sign : 1

This is true if the subkey can be used to create data signatures.

unsigned int can_certify : 1

This is true if the subkey can be used to create key certificates.

unsigned int can_authenticate : 1

This is true if the subkey can be used for authentication.

unsigned int is_qualified : 1

This is true if the subkey can be used for qualified signatures according to local government regulations.

unsigned int is_de_vs : 1

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 : 1

This 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_algo

This is the public key algorithm supported by this subkey.

unsigned int length

This is the length of the subkey (in bits).

char *keyid

This is the key ID of the subkey in hexadecimal digits.

char *fpr

This is the fingerprint of the subkey in hexadecimal digits, if available.

char *keygrip

The keygrip of the subkey in hex digit form or NULL if not availabale.

long int timestamp

This is the creation timestamp of the subkey. This is -1 if the timestamp is invalid, and 0 if it is not available.

long int expires

This is the expiration timestamp of the subkey, or 0 if the subkey does not expire.

unsigned int is_cardkey : 1

True if the secret key is stored on a smart card.

char *card_number

The serial number of a smart card holding this key or NULL.

char *curve

For ECC algorithms the name of the curve.

Data type: gpgme_user_id_t

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 next

This is a pointer to the next user ID structure in the linked list, or NULL if this is the last element.

unsigned int revoked : 1

This is true if the user ID is revoked.

unsigned int invalid : 1

This is true if the user ID is invalid.

gpgme_validity_t validity

This specifies the validity of the user ID.

char *uid

This is the user ID string.

char *name

This is the name component of uid, if available.

char *comment

This is the comment component of uid, if available.

char *email

This 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 tofu

If not NULL information from the TOFU database pertaining to this user id.

gpgme_key_sig_t signatures

This is a linked list with the signatures on this user ID.

unsigned int origin : 5

Reserved for the origin of this user ID.

unsigned long last_update

Reserved for the time of the last update of this user ID.

Data type: gpgme_key_sig_t

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 next

This is a pointer to the next key signature structure in the linked list, or NULL if this is the last element.

unsigned int revoked : 1

This is true if the key signature is a revocation signature.

unsigned int expired : 1

This is true if the key signature is expired.

unsigned int invalid : 1

This is true if the key signature is invalid.

unsigned int exportable : 1

This is true if the key signature is exportable.

gpgme_pubkey_algo_t pubkey_algo

This is the public key algorithm used to create the signature.

char *keyid

This is the key ID of the key (in hexadecimal digits) used to create the signature.

long int timestamp

This 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 expires

This is the expiration timestamp of the key signature, or 0 if the key signature does not expire.

gpgme_error_t status

This 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_class

This specifies the signature class of the key signature. The meaning is specific to the crypto engine.

char *uid

This is the main user ID of the key used to create the signature.

char *name

This is the name component of uid, if available.

char *comment

This is the comment component of uid, if available.

char *email

This is the email component of uid, if available.

gpgme_sig_notation_t notations

This is a linked list with the notation data and policy URLs.


Next: , Up: Key Management   [Contents][Index]