For a UI it can be useful to check which key gnupg would select for a given mailbox.
And this would ideally be the "best" key to use for this mailbox.
e.g. an API to check which key: gpg -er firstname.lastname@example.org
Locate the keys given as arguments. This command basically uses the same
algorithm as used when locating keys for encryption or signing and may thus be
used to see what keys gpg2 might use. In particular external methods as
defined by --auto-key-locate may be used to locate a key. Only public keys are
Also provides expired keys or keys with unknown validity. Even if a fully valid
key is available.
The result should be a single key or no key.