PaddingMode PaddingMode PaddingMode PaddingMode Enum

定义

指定在消息数据块比加密操作所需的全部字节数短时应用的填充类型。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
继承
属性

字段

ANSIX923 ANSIX923 ANSIX923 ANSIX923 4

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

ISO10126 ISO10126 ISO10126 ISO10126 5

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

None None None None 1

不填充。No padding is done.

PKCS7 PKCS7 PKCS7 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 Zeros Zeros 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. 在给定的 8 blocklength、 数据长度为 9 和等于 7 和等于 FF 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:

数据: FF FF FF FF FF FF FF FF FFData: FF FF FF FF FF FF FF FF FF

X923 填充: FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 07X923 padding: FF FF FF FF FF FF FF FF FF 00 00 00 00 00 00 07

PKCS7 填充: FF FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07PKCS7 padding: FF FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07

ISO10126 填充: FF FF FF FF FF FF FF FF FF 7D 2A 75 EF F8 EF 07ISO10126 padding: FF FF FF FF FF FF FF FF FF 7D 2A 75 EF F8 EF 07

适用于

另请参阅