PaddingMode 枚举

定义

指定在消息数据块比加密操作所需的全部字节数短时应用的填充类型。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
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum PaddingMode
type PaddingMode = 
Public Enum PaddingMode
继承
PaddingMode
属性

字段

ANSIX923 4

ANSIX923 填充字符串由一个字节序列组成,此字节序列的最后一个字节填充字节序列的长度,其余字节均填充数字零。The ANSIX923 padding string consists of a sequence of bytes filled with zeros before the length.

ISO10126 5

ISO10126 填充字符串由一个字节序列组成,此字节序列的最后一个字节填充字节序列的长度,其余字节填充随机数据。The ISO10126 padding string consists of random data before the length.

None 1

不填充。No padding is done.

PKCS7 2

PKCS #7 填充字符串由一个字节序列组成,每个字节填充该字节序列的长度。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.

注解

大多数纯文本消息不包含完全填充块的多个字节。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. 例如, 如果块长度为64位, 而最后一个块只包含40位, 则会添加24位填充。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. 给定的 blocklength 为 8, 数据长度为 9, 长度为9的八位字节数等于 7, 数据等于 FF FF FF ff ff ff ff ff: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 FFFF FF FF FF FF FF FF FF FF
X923 填充:X923 padding: FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 07FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 07
PKCS7 填充:PKCS7 padding: FF FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07FF FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07
ISO10126 填充:ISO10126 padding: FF FF FF FF FF FF FF FF FF 7D 2A 75 EF F8 EF 2007FF FF FF FF FF FF FF FF FF 7D 2A 75 EF F8 EF 07

适用于

另请参阅