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


7.5.4 Manipulating Keys

Function: void gpgme_key_ref (gpgme_key_t key)

The function gpgme_key_ref acquires an additional reference for the key key.

Function: void gpgme_key_unref (gpgme_key_t key)

The function gpgme_key_unref releases a reference for the key key. If this was the last reference, the key will be destroyed and all resources associated to it will be released.

Function: gpgme_error_t gpgme_op_setexpire (gpgme_ctx_t ctx, gpgme_key_t key, unsigned long expires, const char *subfprs, unsigned int reserved);

SINCE: 1.14.1

The function gpgme_op_setexpire sets the expiration time of the key key or of the specified subkeys. This function requires at least version 2.1.22 of GnuPG.

key specifies the key to operate on.

expires specifies the expiration time in seconds from now. To be similar to other usages where expiration times are provided in unsigned long this is similar to the key creation date and so it is in seconds from NOW.

The common case is to use 0 to not set an expiration time. Note that this parameter takes an unsigned long value and not a time_t to avoid problems on systems which use a signed 32 bit time_t. Note further that the OpenPGP protocol uses 32 bit values for timestamps and thus can only encode dates up to the year 2106.

subfprs selects the subkey(s) for which the expiration time should be set. If subfprs is set to NULL, then the expiration time of the primary key is set. If subfprs is an asterisk (*), then the expiration times of all non-revoked and not yet expired subkeys are set. To select more than one subkey put all subkey fingerprints into one string separated by linefeeds characters (\n).

reserved is reserved for later use and must be 0.

Function: gpgme_error_t gpgme_op_setexpire_start (gpgme_ctx_t ctx, gpgme_key_t key, unsigned long expires, const char *subfprs, unsigned int flags);

SINCE: 1.14.1

The function gpgme_op_setexpire_start initiates a gpgme_op_setexpire operation; see there for details. It must be completed by calling gpgme_wait on the context. See Waiting For Completion.

Function: gpgme_error_t gpgme_op_setownertrust (gpgme_ctx_t ctx, gpgme_key_t key, const char *value);

SINCE: 1.24.0

The function gpgme_op_setownertrust sets the owner trust of the key key or it sets the disable flag of the key key. This function only works for OpenPGP and requires at least version 2.4.6 of GnuPG.

key specifies the key to operate on.

value specifies the owner trust value to set. Valid values are "undefined", "never", "marginal", "full", "ultimate". If value is the string "disable" then the key key is disabled. If value is the string "enable" then the key key is re-enabled.

The function returns the error code GPG_ERR_NO_ERROR if the operation was completed successfully, GPG_ERR_NOT_SUPPORTED if the engine does not support the command, and GPG_ERR_INV_VALUE if key is not a valid pointer or not a valid key or if value is not a valid pointer or the empty string.

Function: gpgme_error_t gpgme_op_setownertrust_start (gpgme_ctx_t ctx, gpgme_key_t key, const char *value);

SINCE: 1.24.0

The function gpgme_op_setownertrust_start initiates a gpgme_op_setownertrust operation; see there for details. It must be completed by calling gpgme_wait on the context. See Waiting For Completion.

The function returns the same error codes as gpgme_op_setownertrust.


Next: Generating Keys, Previous: Information About Keys, Up: Key Management   [Contents][Index]