An employee will be leaving our company, and we have a directory tree containing a number of files, each holding a password for a specific service, and each file is encrypted to those who require it.

I'd like to try and list all the files which include a particular recipient, however I can't seem to find a way to ask gpg to list the keys for an encrypted file. The only way I know currently how to list the keys is to attempt a decryption of a file, but this would be useless for a search as it would require my passphrase about a billion times.

1 Answer 1


It's been a while since I used GPG, but the --list-packets option might be of some use; otherwise, I'd suggest the following (assuming you can mount the remote directory on your local machine):

  1. Backup your local secret keyring
  2. Remove the passphrase from your secret key
  3. Mount the remote directory on your local machine
  4. Enumerate the locally mounted copy of your remote directory
  5. Reset the passphrase on (or restore the backup of) your secret keyring

Alternately, create a special copy of your secret keyring that you remove the passphrase from, and use --secret-keyring to specify it during the traversal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.