This is very similar question to: If someone breaks encryption, how do they know they're successful?

Basically, the answers to that question is that an attacker doesn't know when decryption was successful.

So then how do encryption programs(e.g. gpg) know when you have decrypted something successfully? Do they have a magic value that is encrypted during encryption and makes sure that it decrypts to that value? If so, does that expose a vulnerability?


Generally speaking, the encryption is deemed successful if the result "makes sense". In the case of an encrypted disk, one can expect to find a properly structured filesystem after decryption, and a filesystem has a lot of recognizable features.

Also, many disk encryption softwares, which protect disks with a password, include an explicit "magic value" in order to promptly inform the user when he typed his password wrong. This is much better than trying to work with an improperly decrypted disk, which may result in data loss.

  • If you use a magic value, does that make it easier for an attacker to decrypt? They could just keep trying keys and see if the magic value decrypts properly rather than having to figure out if it decrypted properly. (Doing this for the magic value may still take a lot of time though) – Kyle Oct 12 '11 at 22:05
  • 4
    @Kyle: a filesystem begins with a header which is full of equally magic values, so I would say that the encryption-specific magic value does not substantially help the attacker. – Thomas Pornin Oct 12 '11 at 22:19

That is not a problem for the encrypting system itself. There are none of the variables related to a decryption attack by an outsider present in the functioning of a system decrypting the files it encrypted. Rather it is just following a specific set of procedures.

The program does not need to test ("know") when it succeeds any more than a key need check to see if it pushed the tumblers correctly in a door lock. Instead it is just reporduces a specific set of procedures.

  • While the programs didn't have to take care of it, these programs seem to. – Kyle Oct 12 '11 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.