I use GPG symmetric, to encrypt text file.

Is it possible to use GPG symmetric, to encrypt a text file, and at the same time, add additional setting to the encrypted file, to give us 2 conditions:

  • correct password will decrypt it.

  • incorrect password will give fake decryption result, instead of indicator "decryption failed, bad session key"

  • This kind of question has multiple markers of being off-topic: asking for product recommendations and asking for opinions. Apart from that it looks like an XY problem, i.e. you want products for your specific approach Y of solving the problem X (securing private key) and basically only ask as an afterthought if this kind of approach is even a good one. Mar 13, 2021 at 11:38
  • I don't think that the edit actually addressed the mentioned problems - it is still a XY problem and it is still asking for product recommendations which solve Y, no matter if Y is actually a useful approach for X. Mar 13, 2021 at 21:45
  • @leon: Many encryption algorithms like AES, ThreeFish, ChaCha just apply transformation to the given data and password. There is no indicator if the password is correct or not. After decryption you get a stream of bytes. In some cases, e.g. if these data represent a PDF file, you can suppose the password was correct. But if the decrypted data look random it does not mean anything, there is no way to determine if the password was correct or not.
    – mentallurg
    Mar 13, 2021 at 23:06
  • @mentallurg I tried gpg symmetric, given incorrect password to decrypt, but it gives indicator "decryption failed bad session key", how to do it with gpg ?
    – leon
    Mar 14, 2021 at 21:49
  • @SteffenUllrich okay, edited, please advise
    – leon
    Mar 14, 2021 at 21:50


Browse other questions tagged .