Previous: Deleting Keys, Up: Key Management


7.4.9 Advanced Key Editing

— Data type: gpgme_error_t (*gpgme_edit_cb_t) (void *handle, gpgme_status_code_t status, const char *args, int fd)

The gpgme_edit_cb_t type is the type of functions which GPGME calls if it a key edit operation is on-going. The status code status and the argument line args are passed through by GPGME from the crypto engine. The file descriptor fd is -1 for normal status messages. If status indicates a command rather than a status message, the response to the command should be written to fd. The handle is provided by the user at start of operation.

The function should return GPG_ERR_NO_ERROR or an error value.

— Function: gpgme_error_t gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key, gpgme_edit_cb_t fnc, void *handle, gpgme_data_t out)

The function gpgme_op_edit processes the key KEY interactively, using the edit callback function FNC with the handle HANDLE. The callback is invoked for every status and command request from the crypto engine. The output of the crypto engine is written to the data object out.

Note that the protocol between the callback function and the crypto engine is specific to the crypto engine and no further support in implementing this protocol correctly is provided by GPGME.

The function returns the error code GPG_ERR_NO_ERROR if the edit operation completes successfully, GPG_ERR_INV_VALUE if ctx or key is not a valid pointer, and any error returned by the crypto engine or the edit callback handler.

— Function: gpgme_error_t gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, gpgme_edit_cb_t fnc, void *handle, gpgme_data_t out)

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

The function returns the error code GPG_ERR_NO_ERROR if the operation was started successfully, and GPG_ERR_INV_VALUE if ctx or key is not a valid pointer.

— Function: gpgme_error_t gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key, gpgme_edit_cb_t fnc, void *handle, gpgme_data_t out)

The function gpgme_op_card_edit is analogous to gpgme_op_edit, but should be used to process the smart card corresponding to the key key.

— Function: gpgme_error_t gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, gpgme_edit_cb_t fnc, void *handle, gpgme_data_t out)

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

The function returns the error code GPG_ERR_NO_ERROR if the operation was started successfully, and GPG_ERR_INV_VALUE if ctx or key is not a valid pointer.