Is gpg-agent passphrase status query possible?

Hauke Laging mailinglisten at
Fri Oct 31 00:33:13 CET 2014

Am Do 30.10.2014, 23:14:12 schrieb Cpp:

> Is there a way to "query" gpg-agent to
> see whether a correct passphrase has been recently entered for a
> particular secret key, and has not yet been forgotten?

Yes and no.

There is an easy way to find out whether a certain passphrase (make sure 
to distinguish between mainkey and subkeys!) is currently known to gpg-

: gpg-connect-agent "GET_PASSPHRASE --data --no-ask 
4F7E9F723D197D667842AE115F048E6F0E4B4494 t1 t2 t3" /bye
D fubar

But that doesn't tell you for how long gpg-agent will cache it yet. It 
may be that the passphrase has just been deleted from the cache even if 
you use the key immediately afterwards.

If you know for sure for how long the entries are cached then you may 
write a small "daemon" which checks for the passphrases every few 
seconds. Then it knows with reasonable precision when a passphrase was 
added to the cache and can calculate when it will be dropped.

Crypto für alle:
OpenPGP: 7D82 FB9F D25A 2CE4 5241 6C37 BF4B 8EEF 1A57 1DF5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: </pipermail/attachments/20141031/4f885c94/attachment.sig>

More information about the Gnupg-users mailing list