SymmetricAlgorithm.TryEncryptEcbCore Method

Definition

When overridden in a derived class, attempts to encrypt data into the specified buffer, using ECB mode with the specified padding mode.

protected virtual bool TryEncryptEcbCore (ReadOnlySpan<byte> plaintext, Span<byte> destination, System.Security.Cryptography.PaddingMode paddingMode, out int bytesWritten);

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.

bytesWritten
Int32

When this method returns, contains the total number of bytes written to destination.

Returns

true if destination was large enough to receive the encrypted data; otherwise, false.

Exceptions

A derived class has not provided an implementation.

Remarks

Derived classes must override this and provide an implementation.

Implementations of this method must write precisely GetCiphertextLengthEcb(plaintext.Length, paddingMode) bytes to destination and report that via bytesWritten.

Applies to

Product Versions
.NET 6, 7, 8, 9