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.

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