Is it possible to check for which keys a certain file is encrypted?

Harald E Brandt's Avatar

Harald E Brandt

15 Sep, 2015 05:13 PM

GPGServices > OpenGPG: Encrypt file

Mac OS X 10.10.5 (14F27)
Libmacgpg 0.6 747
GPGMail 2.5.1 1044
GPG Keychain 1.2.1 1147
GPGServices 1.10.1 871
MacGPG2 2.0.28 855
GPGPreferences 1.5 846

After having used GPGServices to encrypt a file to one or more keys, I may by uncertain as to which keys I used.
Is there a way by which I can inspect the file or test which keys were used to encrypt the file?

A recent practical real-world example is:
I encrypted a file by using GPGServices, then I sent that to a person, which however could not decrypt it. The error I probably did was that in GPGServices I selected the correct key, but did not put a checkmark for the key, which resulted in zero keys being used. But the file was reported as encrypted because by default my own key is always used. So probably, it was only encrypted to me, but I am not certain since I don't see a method by which I can check that.

I would have liked a method where I can check if I really did encrypt to the key I intended.

  1. 1 Posted by Mento on 18 Sep, 2015 09:22 AM

    Mento's Avatar

    Hi Harald,

    you can achieve this by using the terminal. Enter the following command:

    gpg2 --batch --list-packets /Path/to/your/file.gpg
    

    Regards, Mento

  2. 2 Posted by Harald E Brandt on 18 Sep, 2015 09:52 AM

    Harald E Brandt's Avatar

    @Mento: Great! I had already checked the terminal commands by using gpg2 -h, but that does not list the command --list-packets! Now I found it only by doing man gpg2 which only says the somewhat (for me) cryptic: "List only the sequence of packets. This is mainly useful for debugging".

    It turns out that my suspicion was correct: I had encrypted the troublesome file to only me and not to the recipient, despite I had selected the correct key but forgotten to put a checkmark next to it.

    Wouldn't the command --list-packets be a great one to add as a command under Services as a simple means to check a file for which keys/persons this file is encrypted to?
    I think so.

  3. 3 Posted by Mento on 18 Sep, 2015 10:02 AM

    Mento's Avatar

    Hi Harald,

    i've created a ticket for your suggestion: https://gpgtools.lighthouseapp.com/projects/67607-gpgservices/ticke...
    I think it's a good feature.

    Regards, Mento

  4. 4 Posted by Harald E Brandt on 18 Sep, 2015 02:16 PM

    Harald E Brandt's Avatar

    Hi Mento,

    Good, and thank you for having created a ticket that adds this as a very useful feature request.
    (The name of the command in the GUI must of course be something more sensible than "list-packets", and with output that doesn't look as if it is copied directly form the command line.)

  5. Support Staff 5 Posted by Steve on 18 Sep, 2015 02:28 PM

    Steve's Avatar

    Agreed. This will likely take a while since there's a few higher priority items on the to-do. But it's in the system and we'll hopefully get around to it eventually.

    I'm closing this discussion. If you need further assistance or have questions you can re-open this discussion here or open a new one any time.

    Best, steve

  6. Steve closed this discussion on 18 Sep, 2015 02:28 PM.

  7. Steve closed this discussion on 24 May, 2017 03:17 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac