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) 。