Re: Parse LISTKEYS output
On Fri, 5 Jun 2015 11:39, dfa...@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. ___ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users
Re: Parse LISTKEYS output
Thanks to all who responded! 05.06.2015 13:05, Werner Koch wrote: On Fri, 5 Jun 2015 11:39, dfa...@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 -- Best Regards! ___ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users
Re: Parse LISTKEYS output
Hi, At Thu, 04 Jun 2015 12:06:42 +0300, Dmitry Falko wrote: Is there a common way to parse data returned from LISTKEYS command. Callback function receives buffer with colon-separated information about certificate, i need fingerprint to use it with IMPORT --re-import command. Are you running: gpg --list-keys --with-colons or doing something else? If you are doing this from C then you should use gpgme rather than try and parse the output yourself. (If you aren't using C, then look to see if there are any bindings to gpgme.) If this isn't helpful, please try to describe your problem more thoroughly. :) Neal ___ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users
Parse LISTKEYS output
Hi! Is there a common way to parse data returned from LISTKEYS command. Callback function receives buffer with colon-separated information about certificate, i need fingerprint to use it with IMPORT --re-import command. -- Best Regards! ___ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users