2

Suppose Bob got a message from Alice encrypted with his public key and signed with her private key. Now he wants to prove to Charlie that he got a message from her with this exact content. The message was created via gpg --sign --encrypt.

My idea was that he could decrypt the message and save it with its signature somewhere but I could find no way to achieve this. But since GPG signs the message and then encrypts it afterwards this should at least theoretically be possible.

Now how can he do this or do you have any other ideas how Bob can proof the message authenticity to Charlie?

Restrictions:

  • Giving Charlie Bobs private key is (obviously) not an option.
  • Communication is only possible via email.
  • Alice cannot be contacted any more so resending the message or Charlie and Alice communicating with each other is not possible. Bob has to work with what he already has.
8
  • If Bob has the public Key of Alice, then he should be able to forward to mail (or make a copy of it) to Charlie and even encrypt it with his own private key if Charlie has Bob's public key.
    – admstg
    Commented Aug 29, 2023 at 16:18
  • "Suppose Bob got a message from Alice encrypted with his public key and signed with her private key." Was the message signed before encryption (i.e., the plaintext was signed by Alice) or was it signed after encryption (i.e., the ciphertext was signed by Alice)? Commented Aug 29, 2023 at 16:19
  • If you would write how alice generated the files (echo A short message> file; gpgencryppp file....), I would learn something and you might get a better answer. But generally, either 1. decrypted file is the message+signature (and this is what is to be shown Charlie) or 2. Bob has to show the message+ Alice's public key+the encrypted message+signature and explain how to produce again the identical encrypted message.
    – minorChaos
    Commented Aug 29, 2023 at 16:31
  • correction ... own public key
    – minorChaos
    Commented Aug 29, 2023 at 16:43
  • 2
    @MarcusMüller Like I said, GPG signs the message before encryption according to StackOverflow Commented Aug 29, 2023 at 19:16

1 Answer 1

1

This was pretty hard to find. It is not in local man gpg.

The command:

gpg -vi    --unwrap  msg1.gpg 

(-v means verbose, -i is interactive, does not overwrite files.)

Caveat: You might(?) need to decompress the output sometimes.

Documentation: https://gnupg.org/documentation/manuals/gnupg.pdf

--unwrap This command is similar to ‘--decrypt’ with the difference that the output
is not the usual plaintext but the original message with the encryption layer
removed. Thus the output will be an OpenPGP data structure which often
means a signed OpenPGP message. Note that this option may or may not
remove a compression layer which is often found beneath the encryption layer.

Testing (on Ubuntu, fresh in August 2023).

### Alice(=testS) signed a message and encrypted it
### using Bobs(=test) public key. -r means --recipient

[0] $ echo A message to be signed a sent > message
[0] $ gpg  -u testS  -r test    --sign --encrypt  message 

 ## Alice sent  message.gpg  to Bob

[0] $ gpg -vi    --unwrap  message.gpg    # --output ...
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: public key is 3DF37C69945F312D
gpg: using subkey 3DF37C69945F312D instead of primary key 96B43A891E43F2F4
gpg: using subkey 3DF37C69945F312D instead of primary key 96B43A891E43F2F4
gpg: encrypted with 3072-bit RSA key, ID 3DF37C69945F312D, created 2023-08-29
      "TEST TE <[email protected]>"
gpg: AES256 encrypted data
File 'message' exists. Overwrite? (y/N) n
Enter new filename: message-only-singed.gpg

## Bob sends "unwrapped" (=deciphered) file   message-only-signed.php
## to Charlie
 
[0] $ gpg -d  message-only-singed.gpg      
A message to be signed a sent               <---- The message
gpg: Signature made Tue 29 Aug 2023 22:55:11 CEST
gpg:                using RSA key 6646102A06EC96A49AE8828FCDF0F02D337492DD
gpg:                issuer "[email protected]"
gpg: Good signature from "tests <[email protected]>" [ultimate]   <---- the sig

### Charlie sees that  Alice=testS    signed the message
 

(The last command can be used with --output file.)

2
  • 1
    Thank you so much this is exactly what I was looking for! Also had a look at the manpage and also could not find this option. Commented Aug 29, 2023 at 21:59
  • I need 15 reputation until my vote is counted. You can try voting my question up to make it count. Commented Aug 29, 2023 at 22:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .