SymmetricAlgorithm.EncryptEcb Method

Definition

Overloads

EncryptEcb(Byte[], PaddingMode)

Encrypts data using ECB mode with the specified padding mode.

EncryptEcb(ReadOnlySpan<Byte>, PaddingMode)

Encrypts data using ECB mode with the specified padding mode.

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

Encrypts data into the specified buffer, using ECB mode with the specified padding mode.

EncryptEcb(Byte[], PaddingMode)

Encrypts data using ECB mode with the specified padding mode.

public:
 cli::array <System::Byte> ^ EncryptEcb(cli::array <System::Byte> ^ plaintext, System::Security::Cryptography::PaddingMode paddingMode);
public byte[] EncryptEcb (byte[] plaintext, System.Security.Cryptography.PaddingMode paddingMode);
member this.EncryptEcb : byte[] * System.Security.Cryptography.PaddingMode -> byte[]
Public Function EncryptEcb (plaintext As Byte(), paddingMode As PaddingMode) As Byte()

Parameters

plaintext
Byte[]

The data to encrypt.

paddingMode
PaddingMode

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

Returns

Byte[]

The encrypted ciphertext data.

Exceptions

plaintext is null.

paddingMode is not a valid padding mode.

The plaintext could not be encrypted successfully.

Remarks

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

Applies to

EncryptEcb(ReadOnlySpan<Byte>, PaddingMode)

Encrypts data using ECB mode with the specified padding mode.

public:
 cli::array <System::Byte> ^ EncryptEcb(ReadOnlySpan<System::Byte> plaintext, System::Security::Cryptography::PaddingMode paddingMode);
public byte[] EncryptEcb (ReadOnlySpan<byte> plaintext, System.Security.Cryptography.PaddingMode paddingMode);
member this.EncryptEcb : ReadOnlySpan<byte> * System.Security.Cryptography.PaddingMode -> byte[]
Public Function EncryptEcb (plaintext As ReadOnlySpan(Of Byte), paddingMode As PaddingMode) As Byte()

Parameters

plaintext
ReadOnlySpan<Byte>

The data to encrypt.

paddingMode
PaddingMode

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

Returns

Byte[]

The encrypted ciphertext data.

Exceptions

paddingMode is not a valid padding mode.

The plaintext could not be encrypted successfully.

Remarks

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

Applies to

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

Encrypts data into the specified buffer, using ECB mode with the specified padding mode.

public:
 int EncryptEcb(ReadOnlySpan<System::Byte> plaintext, Span<System::Byte> destination, System::Security::Cryptography::PaddingMode paddingMode);
public int EncryptEcb (ReadOnlySpan<byte> plaintext, Span<byte> destination, System.Security.Cryptography.PaddingMode paddingMode);
member this.EncryptEcb : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.PaddingMode -> int
Public Function EncryptEcb (plaintext As ReadOnlySpan(Of Byte), destination As Span(Of Byte), paddingMode As PaddingMode) As Integer

Parameters

plaintext
ReadOnlySpan<Byte>

The data to encrypt.

destination
Span<Byte>

The buffer to receive the ciphertext 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.

The plaintext could not be encrypted successfully.

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

Remarks

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

Applies to