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


7.5.12 Advanced Key Editing

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

The gpgme_interact_cb_t type is the type of functions which GPGME calls if it a key interact operation is on-going. The status keyword status and the argument line args are passed through by GPGME from the crypto engine. An empty string represents EOF. 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_FALSE if it did not handle the status code, 0 for success, or any other error value.

Function: gpgme_error_t gpgme_op_interact (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags, gpgme_interact_cb_t fnc, void *handle, gpgme_data_t out)

The function gpgme_op_interact processes the key KEY interactively, using the interact 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.

flags modifies the behaviour of the function; the only defined bit value is:

GPGME_INTERACT_CARD

This is used for smartcard based keys and uses gpg’s --card-edit command.

The function returns 0 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_interact_start (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags, gpgme_interact_cb_t fnc, void *handle, gpgme_data_t out)

The function gpgme_op_interact_start initiates a gpgme_op_interact 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 GPG_ERR_INV_VALUE if ctx or key is not a valid pointer.


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