How can padding be disambiguated from data, when encrypting using a block cipher?
I'm by no means an expert in cryptography, but rather a programmer with a keen interest.
Suppose, I've X
bytes of data, message M
, that I want to encrypt using an N
-byte block cipher, where N >> X
.
How can M
be padded using N-X
bytes of padding O
, such that there would be no ambiguity between decrypting the padded message M´
and the (concatenated) message M|O
?
How is this done in practice? Normally, when encrypting using a block cipher, I don't see a header being output describing the original length of the message M
?