Mono Class Library: System.Security.Cryptography Namespace

System.Security.Cryptography.PaddingMode Enumeration

Padding Modes for Symmetric Block Ciphers. How to pad the message processed by block ciphers when they don't come out to the being the size of the block. [Edit]
[System.Runtime.InteropServices.ComVisible(true)]
public enum PaddingMode

Remarks

Block ciphers requires complete block to encrypt. Any block smaller than the cipher block size must be padded.

Cipher padding modes are only applicable to block ciphers. Stream ciphers, like RC4(tm), do not use them.

[Edit]

Members

Member NameDescription
ANSIX923Documentation for this section has not yet been entered. [Edit]
ISO10126Documentation for this section has not yet been entered. [Edit]
NoneNo padding is added. This may be the case when an application use a custom padding or when data packets are always a multiple of the cipher block size. A System.Security.Cryptography.CryptographicException is thrown if the last block size is different from the cipher block size. [Edit]
PKCS7Default padding. This padding adds the byte "padding length" as the padding material. That is a padding of 4 bytes will be 0x04 0x04 0x04 0x04. In case the last block size is equal to the cipher block size a new block is added containing only the padding (e.g. 8 times 0x08). Despite it's name the padding is detailled in PKCS #5 (tp://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/index.html). [Edit]
ZerosThe last block is padded with 0x00. This makes it difficult when decrypting to know if the last bytes are real 0x00 or padding material. In the .NET framework the application decrypting the block must unpad the zero itself. [Edit]

Requirements

Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0