Parse LISTKEYS output
Werner Koch
wk at gnupg.org
Fri Jun 5 12:05:52 CEST 2015
On Fri, 5 Jun 2015 11:39, dfalko at digiflak.com said:
> Sorry, I read gpgme manual one more time, and find all i need.
For reference: The following GPGME fucntion can be used:
-- Function: gpgme_error_t gpgme_op_import_keys (gpgme_ctx_t CTX,
gpgme_key_t *KEYS)
The function ‘gpgme_op_import_keys’ adds the keys described by the
‘NULL’ terminated array KEYS to the key ring of the crypto engine
used by CTX. This function is the general interface to move a key
from one crypto engine to another as long as they are compatible.
In particular it is used to actually import and make keys permanent
which have been retrieved from an external source (i.e. using
‘GPGME_KEYLIST_MODE_EXTERN’). (1)
Only keys of the the currently selected protocol of CTX are
considered for import. Other keys specified by the KEYS are
ignored. As of now all considered keys must have been retrieved
using the same method, that is the used key listing mode must be
identical.
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, ‘GPG_ERR_CONFLICT’ if the
key listing mode does not match, and ‘GPG_ERR_NO_DATA’ if no keys
are considered for export.
Note that this works only for GPGSM (GPGME_PROTOCOL_CMS) because there
is no need for this with GPG (GPGME_PROTOCOL_OPENPGP).
Shalom-Salam,
Werner
--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gnupg-users
mailing list