Επεξεργασία

Κοινή χρήση μέσω


PaddingMode Enum

Definition

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.

public enum class PaddingMode
public enum PaddingMode
[System.Serializable]
public enum PaddingMode
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum PaddingMode
type PaddingMode = 
[<System.Serializable>]
type PaddingMode = 
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PaddingMode = 
Public Enum PaddingMode
Inheritance
PaddingMode
Attributes

Fields

Name Value Description
None 1

No padding is done.

PKCS7 2

The PKCS #7 padding string consists of a sequence of bytes, each of which is equal to the total number of padding bytes added.

Zeros 3

The padding string consists of bytes set to zero.

ANSIX923 4

The ANSIX923 padding string consists of a sequence of bytes filled with zeros before the length.

ISO10126 5

The ISO10126 padding string consists of random data before the length.

Remarks

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. The following example shows how these modes work. Given a blocklength of 8, a data length of 9, the number of padding octets equal to 7, and the data equal to FF FF FF FF FF FF FF FF FF:

Data: FF FF FF FF FF FF FF FF FF
X923 padding: FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 07
PKCS7 padding: FF FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07
ISO10126 padding: FF FF FF FF FF FF FF FF FF 7D 2A 75 EF F8 EF 07

Applies to

See also