Parse LISTKEYS output

Dmitry Falko dfalko at
Fri Jun 5 11:29:45 CEST 2015

I can't use gpgme, because it doesn't have(or I couldn't find) specific 
I need IMPORT key function with --re-import flag.  I do it from C and 
use libassuan.
I do something like this:
gpgsm --server
OPTION list-mode=3
LISTKEYS test at <-- this command return colon-separated 
information about certificate
IMPORT --re-import <fingerprint from previous command >

04.06.2015 19:06, Neal H. Walfield wrote:
> 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

Best Regards!

More information about the Gnupg-users mailing list