SymmetricAlgorithm.DecryptCbc 方法

定义

重载

DecryptCbc(Byte[], Byte[], PaddingMode)

使用具有指定填充模式的 CBC 模式解密数据。

DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode)

使用具有指定填充模式的 CBC 模式解密数据。

DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)

使用具有指定填充模式的 CBC 模式将数据解密到指定的缓冲区中。

DecryptCbc(Byte[], Byte[], PaddingMode)

使用具有指定填充模式的 CBC 模式解密数据。

public byte[] DecryptCbc (byte[] ciphertext, byte[] iv, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.PKCS7);
member this.DecryptCbc : byte[] * byte[] * System.Security.Cryptography.PaddingMode -> byte[]
Public Function DecryptCbc (ciphertext As Byte(), iv As Byte(), Optional paddingMode As PaddingMode = System.Security.Cryptography.PaddingMode.PKCS7) As Byte()

参数

ciphertext
Byte[]

要解密的数据。

iv
Byte[]

初始化向量。

paddingMode
PaddingMode

用于在解密期间生成已加密文本和删除的填充模式。

返回

Byte[]

解密的纯文本数据。

例外

ciphertextivnull

paddingMode 不是有效的填充模式。

iv 是不正确的长度。 调用方应传递完全长度的初始化向量,该向量转换为 BlockSize BlockSize /8 (字节) 。

无法成功解密已加密文本。

注解

此方法的行为由 定义 TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

适用于

DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode)

使用具有指定填充模式的 CBC 模式解密数据。

public byte[] DecryptCbc (ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> iv, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.PKCS7);
member this.DecryptCbc : ReadOnlySpan<byte> * ReadOnlySpan<byte> * System.Security.Cryptography.PaddingMode -> byte[]
Public Function DecryptCbc (ciphertext As ReadOnlySpan(Of Byte), iv As ReadOnlySpan(Of Byte), Optional paddingMode As PaddingMode = System.Security.Cryptography.PaddingMode.PKCS7) As Byte()

参数

ciphertext
ReadOnlySpan<Byte>

要解密的数据。

iv
ReadOnlySpan<Byte>

初始化向量。

paddingMode
PaddingMode

用于在解密期间生成已加密文本和删除的填充模式。

返回

Byte[]

解密的纯文本数据。

例外

paddingMode 不是有效的填充模式。

iv 是不正确的长度。 调用方应传递完全长度的初始化向量,该向量转换为 BlockSize BlockSize /8 (字节) 。

无法成功解密已加密文本。

注解

此方法的行为由 定义 TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

适用于

DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)

使用具有指定填充模式的 CBC 模式将数据解密到指定的缓冲区中。

public int DecryptCbc (ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> iv, Span<byte> destination, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.PKCS7);
member this.DecryptCbc : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.PaddingMode -> int
Public Function DecryptCbc (ciphertext As ReadOnlySpan(Of Byte), iv As ReadOnlySpan(Of Byte), destination As Span(Of Byte), Optional paddingMode As PaddingMode = System.Security.Cryptography.PaddingMode.PKCS7) As Integer

参数

ciphertext
ReadOnlySpan<Byte>

要解密的数据。

iv
ReadOnlySpan<Byte>

初始化向量。

destination
Span<Byte>

用于接收纯文本数据的缓冲区。

paddingMode
PaddingMode

用于在解密期间生成已加密文本和删除的填充模式。

返回

Int32

写入的字节总数 destination

例外

paddingMode 不是有效的填充模式。

iv 是不正确的长度。 调用方应传递完全长度的初始化向量,该向量转换为 BlockSize BlockSize /8 (字节) 。

无法成功解密已加密文本。

中的缓冲区 destination 太小,容纳不下纯文本数据。

注解

此方法的行为由 定义 TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

适用于