GPGme operations with subkeys

Robert J. Hansen rjh at
Wed Aug 2 03:05:04 CEST 2017

> I would like to select specific subkeys (gpgme_subkey_t) in GPGme to
> perform operations (eg. gpgme_op_encrypt(...)

This isn't really well-supported, and for good reason: which subkey to
choose is normally viewed as a decision of the OpenPGP engine, not so
much of the user.  If you have a set of keys, all of which provide the
correct capability, GnuPG will use the most recent one under the logic
that the most recently added subkey is the one the user prefers.

At the command line a subkey can be specifically selected by appending
an exclamation mark to the *subkey* key ID, but I don't believe GPGME
supports this behavior.

More information about the Gnupg-users mailing list