SymmetricAlgorithm.TryDecryptCbc 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
尝试使用具有指定填充模式的 CBC 模式将数据解密到指定的缓冲区。
public bool TryDecryptCbc (ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> iv, Span<byte> destination, out int bytesWritten, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.PKCS7);
member this.TryDecryptCbc : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * int * System.Security.Cryptography.PaddingMode -> bool
Public Function TryDecryptCbc (ciphertext As ReadOnlySpan(Of Byte), iv As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional paddingMode As PaddingMode = System.Security.Cryptography.PaddingMode.PKCS7) As Boolean
参数
- ciphertext
- ReadOnlySpan<Byte>
要解密的数据。
- iv
- ReadOnlySpan<Byte>
初始化向量。
- bytesWritten
- Int32
此方法返回时,包含写入的总字节数 destination
。
- paddingMode
- PaddingMode
用于生成密码文本和在解密过程中删除的填充模式。
返回
true
如果 destination
足够大,无法接收已解密的数据,则为; 否则为 false
。
例外
paddingMode
不是有效的填充模式。
iv
的长度不正确。 调用方应传递长度完全相同的初始化向量,并将 BlockSize 其转换为字节 (区块/8
) 。
无法成功解密密码文本。
注解
此方法的行为由定义 TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) 。