SymmetricAlgorithm.DecryptCbc 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| 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)。