distinguishing public from secret keys with gpgme

Hans-Christoph Steiner hans at guardianproject.info
Fri May 24 18:04:52 CEST 2013


Hey all,

Using gpgme 1.4.1, I'm trying to pick out which keys in the keyring have the
secret component, and can be used for signing and decryption.  I've tried:

    return key->secret

and

    jboolean hasSecretKey = 0;
    gpgme_subkey_t subkey;
    for(subkey = key->subkeys; subkey; subkey = subkey->next)
        if (subkey->secret)
            return 1;
    return 0;

Both of these always turn up false for every key in the keyring.  `gpg2
--list-secret-keys` shows that I have one secret key.  What am I missing?

.hc



More information about the Gnupg-devel mailing list