Enum PaddingMode
- Namespace
- CryptoHives.Foundation.Security.Cryptography.Cipher
- Assembly
- CryptoHives.Foundation.Security.Cryptography.dll
Specifies the padding mode for block cipher operations.
[SuppressMessage("Design", "CA1008:Enums should have zero value", Justification = "Mirror runtime implementation")]
public enum PaddingMode
Fields
ANSIX923 = 4ANSI X.923 padding. Pads with zeros, with the last byte indicating padding length.
ISO10126 = 5ISO 10126 padding. Pads with random bytes, with the last byte indicating padding length.
None = 1No padding. The plaintext must be an exact multiple of the block size.
PKCS7 = 2PKCS#7 padding. Each padding byte contains the number of padding bytes added.
This is the most common padding mode and is compatible with PKCS#5. For a block size of 16 bytes, valid padding values are 0x01 through 0x10.
Zeros = 3Zero padding. Pads with zero bytes.
Warning: Zero padding is ambiguous if the plaintext can end with zero bytes. Use PKCS#7 for unambiguous padding.
Remarks
Padding is required when the plaintext length is not a multiple of the block size. AEAD modes (GCM, CCM) and stream modes (CTR, Stream) do not require padding.
Values match PaddingMode for compatibility.