This documentation is archived and is not being maintained.

PaddingMode Enumeration

Specifies the type of padding to apply when the message data block is shorter than the full number of bytes needed for a cryptographic operation.

[Visual Basic]
Public Enum PaddingMode
public enum PaddingMode
__value public enum PaddingMode
enum PaddingMode


Most plain text messages do not consist of a number of bytes that completely fill blocks. Often, there are not enough bytes to fill the last block. When this happens, a padding string is added to the text. For example, if the block length is 64 bits and the last block contains only 40 bits, 24 bits of padding are added.

Some encryption standards specify a particular padding scheme.


Member name Description
None No padding is done.
PKCS7 The PKCS #7 padding string consists of a sequence of bytes, each of which is equal to the total number of padding bytes added. For example, if 24 bits (3 bytes) of padding need to be added, the padding string is "03 03 03".
Zeros The padding string consists of bytes set to zero.


Namespace: System.Security.Cryptography

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

System.Security.Cryptography Namespace | Cryptographic Services