8

I'm still working with GPG, as in this post:

How do I encrypt plaintext with GnuPG?

What I need now is to be able to list various info (e.g. all recipients) of an encrypted message without necessarily decrypting it. I've seen links to different commands like "--list-only", but nothing seems to work. Does anyone have an authoritative reference (or any input really) on this?

Best.

EDIT #1: Clarification. --list-only will display all keys but your own (if it was encrypted to you). Basically I need to be able to determine if the item was encrypted to me so as to "file" it or take other action.

Community
  • 1
  • 1
humble_coder
  • 2,777
  • 7
  • 34
  • 46

1 Answers1

8

In order to see all keys (that are not hidden) that a block of encrypted data was encrypted to - including your own - you could simply make your secret-keyring unavailable, via something like this:

gpg --no-default-keyring --secret-keyring /dev/null -a --list-only

That tells gpg to not use any default keyrings (--no-default-keyring) if an invalid/missing keyring is specified, and then goes on to specify an invalid/missing secret-keyring (--secret-keyring /dev/null)

kylehuff
  • 5,177
  • 2
  • 34
  • 35
  • Thanks. Is that a one-shot call or does it permanently hide mine so that I must later unhide it? – humble_coder Oct 06 '11 at 20:41
  • It is just a per-invocation call, it does not modify your overall preferences. If you want it to be permanent, you can add those to the gnupg configuration file. – kylehuff Oct 11 '11 at 17:37