gpgme list secret keys

Werner Koch wk at gnupg.org
Mon Apr 25 15:01:23 CEST 2005


On Sun, 24 Apr 2005 22:11:01 +0200, Matthijs Mohlmann said:

>     err = gpgme_op_keylist_start(ctx, NULL, 0);

Replace the 0 by a 1 to list only keys where a secret key is
available.

>     while (!err) {
>       uid = key->uids;
>       subkey = key->subkeys;
>       printf("%s: %s <%s>\n", subkey->keyid, uid->name, uid->email);
>       err = gpgme_op_keylist_next(ctx, &key);
>     }

That should be:

     while (!err && !(err = gpgme_op_keylist_next(ctx, &key)))
       {      
         uid = key->uids;
         subkey = key->subkeys;
         printf("%s: %s <%s>\n", subkey->keyid, uid->name, uid->email);
         gpgme_key_unref (key);
       }


Salam-Shalom,

   Werner




More information about the Gnupg-users mailing list