Our application uses GPGME to encrypt files with a public key, and decrypt them with
a private key, from the user's keyring. Because the private key is protected with a
password, GPGME invokes the gpg-agent (which in turn invokes the pinentry program) to
retrieve it. (Please correct me if I am wrong.)
Ever since gpg-agent switched to sockets from pipes for its communication, we started
seeing issues with password caching. Specifically, a new gpg-agent daemon process
would start and stay for every different $GNUPGHOME value, and, what is more
concerning, the password returned by the pinentry program would remain cached
forever, making it effectively impossible to "forget" it.
Initially, we were able to work around those issues by specifying no-use-standard-
socket in gpg-agent.conf. However, in our latest deployment (and according to your
documentation) that no longer has any effect.
Since we do not want to cache passwords, we tried including max-cache-ttl, default-
cache-ttl, and no-allow-external-cache options in gpg-agent.conf, with values varying
from -1 to 0 to bigger positive integers for the first two of these options. The only
change in behavior we observed was when the value of -1 was used, in which case the
pinentry program (and gpg-agent as far as we can tell) was not invoked at all.
So, please help us understand how we can prevent gpg-agent from caching passwords,
and whether it is possible to avoid multiple long-lived gpg-agent processes when
$GNUPGHOME changes. If you are willing to consider software patches from us, perhaps,
we can implement the necessary changes to make the agent honor the max-cache-ttl and
default-cache-ttl options.
Ivan