Bewerken

Share via


SymmetricAlgorithm.DecryptCbc Method

Definition

Overloads

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

Decrypts data using CBC mode with the specified padding mode.

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

Decrypts data using CBC mode with the specified padding mode.

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

Decrypts data into the specified buffer, using CBC mode with the specified padding mode.

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

Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs

Decrypts data using CBC mode with the specified padding mode.

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

Parameters

ciphertext
Byte[]

The data to decrypt.

iv
Byte[]

The initialization vector.

paddingMode
PaddingMode

The padding mode used to produce the ciphertext and remove during decryption.

Returns

Byte[]

The decrypted plaintext data.

Exceptions

ciphertext or iv is null.

paddingMode is not a valid padding mode.

iv is the incorrect length. Callers are expected to pass an initialization vector that is exactly BlockSize in length, converted to bytes (BlockSize / 8).

The ciphertext could not be decrypted successfully.

Remarks

This method's behavior is defined by TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32).

Applies to

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

Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs

Decrypts data using CBC mode with the specified padding mode.

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

Parameters

ciphertext
ReadOnlySpan<Byte>

The data to decrypt.

iv
ReadOnlySpan<Byte>

The initialization vector.

paddingMode
PaddingMode

The padding mode used to produce the ciphertext and remove during decryption.

Returns

Byte[]

The decrypted plaintext data.

Exceptions

paddingMode is not a valid padding mode.

iv is the incorrect length. Callers are expected to pass an initialization vector that is exactly BlockSize in length, converted to bytes (BlockSize / 8).

The ciphertext could not be decrypted successfully.

Remarks

This method's behavior is defined by TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32).

Applies to

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

Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs

Decrypts data into the specified buffer, using CBC mode with the specified padding mode.

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

Parameters

ciphertext
ReadOnlySpan<Byte>

The data to decrypt.

iv
ReadOnlySpan<Byte>

The initialization vector.

destination
Span<Byte>

The buffer to receive the plaintext data.

paddingMode
PaddingMode

The padding mode used to produce the ciphertext and remove during decryption.

Returns

The total number of bytes written to destination

Exceptions

paddingMode is not a valid padding mode.

iv is the incorrect length. Callers are expected to pass an initialization vector that is exactly BlockSize in length, converted to bytes (BlockSize / 8).

The ciphertext could not be decrypted successfully.

The buffer in destination is too small to hold the plaintext data.

Remarks

This method's behavior is defined by TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32).

Applies to