looking for keys on a keyserver with gpgme

Lisa Vitolo syn.shainer at gmail.com
Sun May 5 17:11:29 CEST 2013


Hello,

I have an issue looking for keys on a keyserver. Specifically the
listing returned is always empty. This is my code, written with the
help of Werner Koch, useless parts removed:

        gpgme_keylist_mode_t mode = gpgme_get_keylist_mode(ctx);
        mode &= ~GPGME_KEYLIST_MODE_LOCAL;
        mode |= GPGME_KEYLIST_MODE_EXTERN;
        err = gpgme_set_keylist_mode(ctx, mode);

        err = gpgme_op_keylist_start(ctx, id, 0); /* id is a string */

        while (!err) {
            err = gpgme_op_keylist_next(ctx, &key);

            if (err) {
                break;
            }

            /* if the KEY has the same ID as the one I'm looking for,
proceed... */
        }

I believe the error is in the second argument of
gpgme_op_keylist_start, where I'm asked to provide a search pattern.
I'm not sure how patterns work, so I first tried an empty one (which
works when I'm listing keys from the local keyring with the same
procedure), and then the ID with or without a leading "0x". In both
cases the listing stop at the first call to keylist_next with "EOF".
The keyserver should be correctly configured: it's in both the global
gpg.conf of my user, and in another gpg.conf in the keyring used
within this application. What am I doing wrong? :)

Thanks everybody,
Lisa Vitolo

--
'Listen, Peaches, trickery is what humans are all about,' said the
voice of Maurice. 'They're so keen on tricking one another all the
time that they elect governments to do it for them.' -- Terry
Pratchett



More information about the Gnupg-devel mailing list