I have this text:

Would you mind stopping by the local store and buy some baking soda for tomorrow, Betty-Sue?

Betty-Sue has given me her public PGP key, which I have imported and now use to encrypt the text to a PGP message block.

Alright. Now I have a "PGP MESSAGE BLOCK" with incomprehensible random-looking characters, which allegedly is my text in encrypted form, for that specific key.

How do I know that the text, when decrypted by Betty-Sue, won't say:

haxXed by cooldude92!!! his ip address hostname customers.myisp.com username John Doe his sekurity suxxx duuude lol

? That is, whatever malware installed on my computer has replaced the text I intended to encrypt with that message full of personal information and/or taunting message from the attacker.

I can't verify that my text is inside there because I don't have Betty-Sue's private key -- only her public key! The whole point is that only Betty-Sue (or whoever else has a copy of the private key) can read the message!

Is there some sort of way to verify cryptographically that my plaintext actually is what the encrypted blob will turn into once decrypted by the private key owner?

It always freaks me out when I have encrypted a message and send away that blob, which I cannot read myself but the person on the other end can... I can't know what actually was encrypted. I don't trust my OS, GPG, my hardware or the network...

  • 1
    If you don't trust your OS, how could you possibly trust any method of reversing the encryption, even if there were one? At this point, I don't see anything you can do besides comparing the ciphertext to ciphertext generated by a known good computer. Except how could you even know that the ciphertext on your screen is even what is being sent? Malware could replace it in the background and always show you something fake. If you don't trust the OS, that opens up a HUGE number of problems. Commented Mar 3, 2020 at 3:53

1 Answer 1


If you can not trust the machine you have PGP/GnuPG on and you think you might have malware on your system that has access to your Keys and Passphrase (if you signed the message) it's game over. There is no way to recover from that.

What you can do, however, is use PGP/GnuPGs method of adding multiple recipients.

gpg --encrypt --recipient [email protected] \
--recipient [email protected] doc.txt

and use your own identity as one of the recipients. This is popular with many email clients with PGP/GnuPG support, because it allows you to view your sent mail.

Since the same message is now encrypted for both recipients, you can veriy what you send before you send it.

  • I don't think this actually works. In particular, the malware that switched the plaintext as you tried to encrypt it could just switch it back when you go to decrypt, so you'd still have no idea. Commented Apr 27, 2020 at 20:49
  • That's what I meant with "if you can not trust the machine ... it's game over"
    – phisch
    Commented May 20, 2020 at 7:53
  • For gnupg in particular, you can also use or preconfigure --encrypt-to which is added only when other recipient(s) are explicitly given; see gnupg.org/documentation/manuals/gnupg/… Commented Jan 22, 2021 at 3:17

You must log in to answer this question.

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