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

7.5.11 Changing TOFU Data

The OpenPGP engine features a Trust-On-First-Use (TOFU) key validation model. For resolving conflicts it is necessary to declare the policy for a key. See the GnuPG manual for details on the TOFU implementation.

Data type: enum gpgme_tofu_policy_t

The gpgme_tofu_policy_t type specifies the set of possible policy values that are supported by GPGME:


Set the policy to “auto”.


Set the policy to “good”.


Set the policy to “bad”.


Set the policy to “ask”.


Set the policy to “unknown”.

To change the policy for a key the following functions can be used:

Function: gpgme_error_t gpgme_op_tofu_policy (gpgme_ctx_t ctx, const gpgme_key_t key, gpgme_tofu_policy_t policy)

The function gpgme_op_tofu_policy changes the TOFU policy of key. The valid values for policy are listed above. As of now this function does only work for OpenPGP and requires at least version 2.1.10 of GnuPG.

The function returns zero on success, GPG_ERR_NOT_SUPPORTED if the engine does not support the command, or a bunch of other error codes.

Function: gpgme_error_t gpgme_op_tofu_policy_start (gpgme_ctx_t ctx, const gpgme_key_t key, gpgme_tofu_policy_t policy)

The function gpgme_op_tofu_policy_start initiates a gpgme_op_tofu_policy operation. It can be completed by calling gpgme_wait on the context. See Waiting For Completion.

The function returns 0 if the operation was started successfully, and an error code if one of the arguments is not valid or the oepration could not be started.

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