How know who is a file encrypted for ?

Dirk Traulsen dirk.traulsen at
Tue Feb 26 08:48:57 CET 2008

The two wishes I listed for gpg were:

1. If there are several recipients, test the given passphrase 
automatically for all secret keys in your keyring, so that you don't 
have to give for example 9 times a wrong one if you are recipient 
number four, which you even don't know beforehand.

2. A command which lists the recipients of an encrypted file.

The first proposal is much more interesting as it would remedy a 
nuisance if you regularly work with files with several recipients.

I really don't see a possible security problem here. 
Passphrases are to decrypt symmetrically the secret keys, nothing else. 
So we are only talking about secret keys in the keyring where
a. all keys belong to me or
b. some keys do not belong to me in a common keyring.

In case a. there is no problem, I just give the first asked passphrase. 
But in case b, where it is the nuisance I described, you could only be 
unsure whether someone could guess your password. This is a completely 
different problem but has nothing to do with my proposal as now gpg 
also asks you three times to give a passphrase for these keys. You see, 
nothing changes securitywise.

What I would like:
gpg encrypted_file.gpg
-> output nice list of the recipients with UIDs (ideally with
    indication, which one is in the secret keyring)
-> ask for passphrase if at least one is in the secret keyring,
    otherwise tell that you can't decrypt the file
-> test each secret key in the secret keyring with the passphrase
-> if there was a hit, tell so and decrypt
-> if not, give two more chances

For the second wish Tracy D. Bossong mentioned
> gpg --list-packets --list-only
as a solution, which goes at least a bit in the right direction as it 
lists all the keyids. Interestingly it lists nicely the keys for which 
there is no secret key in our keyring, like David Shaws in this 
C:\>gpg --list-packets --list-only file.gpg
:pubkey enc packet: version 3, algo 16, keyid 79F51929AC2E2384
        data: [4096 bits]
        data: [4096 bits]
:pubkey enc packet: version 3, algo 16, keyid E3B52841743DD3E2
        data: [4096 bits]
        data: [4093 bits]
:pubkey enc packet: version 3, algo 16, keyid AE2827D11643B926
        data: [2047 bits]
        data: [2046 bits]
:pubkey enc packet: version 3, algo 16, keyid 9166EB1E0B9DCED2
        data: [4095 bits]
        data: [4096 bits]
:encrypted data packet:
        length: 81
        mdc_method: 2
gpg: verschlüsselt mit 2048-Bit ELG-E Schlüssel, ID 1643B926, erzeugt 
      "David M. Shaw <dshaw at>"

What I proposed with --recipient-keys is an output of a nice list of 
all the recipient keys like the last one here. 
And why not by the way even highlight for which one you have the secret 
key in the keyring?


PS: Tracy, you seem to have a serious problem with your citing of other 
mails. You are citing them
To be sure that it is no artefact on my side, I checked the archives.
and compare to below. There is definitely something wrong on your side.

> ----- Original Message ----
> From: Dirk Traulsen <dirk.traulsen at>
> To: 
> Cc: GnuPG mailing list <gnupg-users at>
> Sent: Monday, February 25, 2008 12:27:56 PM
> Subject: Re: How know who is a file encrypted for ?
> Am 
> 25 
> Feb 
> 2008 
> um 
> 8:01 
> hat 
> Tracy 
> D. 
> Bossong 
> geschrieben:
> > 
> gpg 
> --list-packets 
> should 
> give 
> you 
> a 
> clue....
> No, 
> it 
> does 
> not!
> <gpg 
> --list-packets 
> file.gpg>  
> does 
> the 
> same 
> as  
> <gpg 
> file.gpg>.
> The 
> only 
> difference 
> is 
> that 
> gpg 
> gives 
> additional 
> packet 
> information 
> before 
> asking 
> the 
> passphrases 
> three 
> times 
> for 
> each 
> recipient. 
I stop copying here. This should be enough to show the problem.

More information about the Gnupg-users mailing list