Next: Deleting Keys, Previous: Exporting Keys, Up: Key Management
The function
gpgme_op_import
adds the keys in the data buffer keydata to the key ring of the crypto engine used by ctx. The format of keydata can be ASCII armored, for example, but the details are specific to the crypto engine.After the operation completed successfully, the result can be retrieved with
gpgme_op_import_result
.The function returns the error code
GPG_ERR_NO_ERROR
if the import was completed successfully,GPG_ERR_INV_VALUE
if keydata if ctx or keydata is not a valid pointer, andGPG_ERR_NO_DATA
if keydata is an empty data buffer.
The function
gpgme_op_import_start
initiates agpgme_op_import
operation. It can be completed by callinggpgme_wait
on the context. See Waiting For Completion.The function returns the error code
GPG_ERR_NO_ERROR
if the import could be started successfully,GPG_ERR_INV_VALUE
if keydata if ctx or keydata is not a valid pointer, andGPG_ERR_NO_DATA
if keydata is an empty data buffer.
This is a pointer to a structure used to store a part of the result of a
gpgme_op_import
operation. For each considered key one status is added that contains information about the result of the import. The structure contains the following members:
gpgme_import_status_t next
- This is a pointer to the next status structure in the linked list, or
NULL
if this is the last element.char *fpr
- This is the fingerprint of the key that was considered.
gpgme_error_t result
- If the import was not successful, this is the error value that caused the import to fail. Otherwise the error code is
GPG_ERR_NO_ERROR
.unsigned int status
- This is a bit-wise OR of the following flags that give more information about what part of the key was imported. If the key was already known, this might be 0.
GPGME_IMPORT_NEW
- The key was new.
GPGME_IMPORT_UID
- The key contained new user IDs.
GPGME_IMPORT_SIG
- The key contained new signatures.
GPGME_IMPORT_SUBKEY
- The key contained new sub keys.
GPGME_IMPORT_SECRET
- The key contained a secret key.
This is a pointer to a structure used to store the result of a
gpgme_op_import
operation. After a successful import operation, you can retrieve the pointer to the result withgpgme_op_import_result
. The structure contains the following members:
int considered
- The total number of considered keys.
int no_user_id
- The number of keys without user ID.
int imported
- The total number of imported keys.
imported_rsa
- The number of imported RSA keys.
unchanged
- The number of unchanged keys.
new_user_ids
- The number of new user IDs.
new_sub_keys
- The number of new sub keys.
new_signatures
- The number of new signatures.
new_revocations
- The number of new revocations.
secret_read
- The total number of secret keys read.
secret_imported
- The number of imported secret keys.
secret_unchanged
- The number of unchanged secret keys.
not_imported
- The number of keys not imported.
gpgme_import_status_t imports
- A list of gpgme_import_status_t objects which contain more information about the keys for which an import was attempted.
The function
gpgme_op_import_result
returns agpgme_import_result_t
pointer to a structure holding the result of agpgme_op_import
operation. The pointer is only valid if the last operation on the context was agpgme_op_import
orgpgme_op_import_start
operation, and if this operation finished successfully. The returned pointer is only valid until the next operation is started on the context.
The following interface is deprecated and only provided for backward compatibility. Don't use it. It will be removed in a future version of GPGME.