[gpgme]Bug when getting signatures !?

jbar jeanjacquesbrucker at gmail.com
Wed Oct 3 17:42:12 CEST 2012


I first did met the same problem as described here : http://lists.gnupg.org/pipermail/gnupg-devel/2005-May/022055.html

Then I have had such call: gpgme_set_keylist_mode(...|GPGME_KEYLIST_MODE_SIGS);

But mykey->uids->signatures was still NULL !!

I finnaly try to get from public key instead of private (gpgme_get_key(...,0) instead of gpgme_get_key(...,1)) ... and... It works !

That's seems like a little bug, and the workaround is a bit tricky (ie: call 2 times gpgme_get_key...).
(NB: still using libgpgme 1.3.1).


    /* create context */
    gpgerr = gpgme_new(&main_gpgctx);
    if ( gpgerr != GPG_ERR_NO_ERROR )
        DIE(1,"gpgme_new - %s",gpgme_strerror(gpgerr));

    /* add GPGME_KEYLIST_MODE_SIGS to the keylist mode */
    gpgerr = gpgme_set_keylist_mode(main_gpgctx,gpgme_get_keylist_mode(main_gpgctx)|GPGME_KEYLIST_MODE_LOCAL|GPGME_KEYLIST_MODE_SIGS|GPGME_KEYLIST_MODE_SIG_NOTATIONS);
    if ( gpgerr != GPG_ERR_NO_ERROR )
        DIE(1,gpgme_strerror(gpgerr));

    /* get the bot  key */
    gpgerr = gpgme_get_key (main_gpgctx,myself.fpr,&mygpgkey,1);
    if ( gpgerr != GPG_ERR_NO_ERROR ) {
        DIE(1,"gpgme_get_key(%s) - %s",myself.fpr,gpgme_strerror(gpgerr));
    }
    sigs=mygpgkey->uids->signatures;
    while (sigs) {
        warnx("sig: %s",sigs->uid);
    (...)
    }

-- 
jbar <jeanjacquesbrucker at gmail.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: </pipermail/attachments/20121003/9b94d792/attachment-0001.pgp>


More information about the Gnupg-devel mailing list