SymmetricAlgorithm: PaddingMode |
A defined set of padding modes used to fill the end of non-blocksize length data blocks. For example if an algorithm has a blocksize of 8 bytes and the data is 3 bytes in length, then 5 bytes of padding must be applied.
Public Enum PaddingMode
Most plain text messages do not have an length that is a multiple of the block size to be processed by the cipher. There is usually not enough bytes to completely fill the last block to be processed. In these cases, additional bytes need to be appended to make the final block the same size as the block size being processed.
The reverse is done when decrypting ciphered data back to plain text. The padded bytes are removed.
If a plain text message is 9 bytes long and the block size to be processed is 8 bytes, then two blocks will need to be processed. However, the second block will only have 1 byte, so 7 additional bytes are added for padding.
Data: FF FF FF FF FF FF FF FF FF
None: FF FF FF FF FF FF FF FF FF
PKCS7: FF FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07
ANSIX923: FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 07
ISO10126: FF FF FF FF FF FF FF FF FF 7D 2A 75 EF F8 EF 07
Zeros: FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00