Next: , Previous: Generating Keys, Up: Key Management


7.4.6 Exporting Keys

— Function: gpgme_error_t gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, unsigned int reserved, gpgme_data_t keydata)

The function gpgme_op_export extracts public keys and returns them in the data buffer keydata. The output format of the key data returned is determined by the ASCII armor attribute set for the context ctx.

If pattern is NULL, all available keys are returned. Otherwise, pattern contains an engine specific expression that is used to limit the list to all keys matching the pattern.

reserved is reserved for future use and must be 0.

The function returns the error code GPG_ERR_NO_ERROR if the operation completed successfully, GPG_ERR_INV_VALUE if keydata is not a valid empty data buffer, and passes through any errors that are reported by the crypto engine support routines.

— Function: gpgme_error_t gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern, unsigned int reserved, gpgme_data_t keydata)

The function gpgme_op_export_start initiates a gpgme_op_export 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 could be started successfully, and GPG_ERR_INV_VALUE if keydata is not a valid empty data buffer.

— Function: gpgme_error_t gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], unsigned int reserved, gpgme_data_t keydata)

The function gpgme_op_export extracts public keys and returns them in the data buffer keydata. The output format of the key data returned is determined by the ASCII armor attribute set for the context ctx.

If pattern or *pattern is NULL, all available keys are returned. Otherwise, pattern is a NULL terminated array of strings that are used to limit the list to all keys matching at least one of the patterns verbatim.

reserved is reserved for future use and must be 0.

The function returns the error code GPG_ERR_NO_ERROR if the operation completed successfully, GPG_ERR_INV_VALUE if keydata is not a valid empty data buffer, and passes through any errors that are reported by the crypto engine support routines.

— Function: gpgme_error_t gpgme_op_export_ext_start (gpgme_ctx_t ctx, const char *pattern[], unsigned int reserved, gpgme_data_t keydata)

The function gpgme_op_export_ext_start initiates a gpgme_op_export_ext 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 could be started successfully, and GPG_ERR_INV_VALUE if keydata is not a valid empty data buffer.