SymmetricAlgorithm.DecryptCbc 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
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
用來產生加密文字並在解密期間移除的填補模式。
傳回
解密的純文字資料。
例外狀況
ciphertext
或 iv
為 null
。
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
用來產生加密文字並在解密期間移除的填補模式。
傳回
解密的純文字資料。
例外狀況
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>
初始化向量。
- paddingMode
- PaddingMode
用來產生加密文字並在解密期間移除的填補模式。
傳回
寫入的位元組總數 destination
例外狀況
paddingMode
不是有效的填補模式。
iv
是不正確的長度。 呼叫端預期會傳遞完全 BlockSize 長度的初始化向量,並轉換成位元組 (BlockSize / 8
) 。
無法成功解密加密文字。
中的 destination
緩衝區太小,無法保存純文字資料。
備註
這個方法的行為是由 TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32) 定義。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應