ssh-add -l like command in gpg
mailinglisten at hauke-laging.de
Wed Sep 10 14:36:24 CEST 2014
Am Mi 10.09.2014, 13:20:01 schrieb Sudhir Khanger:
> Is there a way to tell if a GPG key's passphrase is cached or not?
> Just like ssh-add -l prints all the keys that are in current keychain
> ready to be used.
I am working on a Python script which does that as preparation for its
main task. You could probably easily adapt it to your needs. Of course,
it does not (cannot) solve the race condition Werner mentioned).
The general approach is to read the fingerprints of all available secret
mainkeys and subkeys
gpg --with-colons --fingerprint --fingerprint --list-secret-keys
and check for each entry whether gpg-agent knows the fingerprint:
gpg-connect-agent "GET_PASSPHRASE --data --no-ask "\
"4F7E9F723D197D667842AE115F048E6F0E4B4494 t1 t2 t3" /bye
Crypto für alle: http://www.openpgp-schulungen.de/fuer/unterstuetzer/
OpenPGP: 7D82 FB9F D25A 2CE4 5241 6C37 BF4B 8EEF 1A57 1DF5
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 490 bytes
Desc: This is a digitally signed message part.
More information about the Gnupg-users