SymmetricAlgorithm.GetCiphertextLengthEcb(Int32, PaddingMode) Method

Definition

Gets the length of a ciphertext with a given padding mode and plaintext length in ECB mode.

public:
 int GetCiphertextLengthEcb(int plaintextLength, System::Security::Cryptography::PaddingMode paddingMode);
public int GetCiphertextLengthEcb (int plaintextLength, System.Security.Cryptography.PaddingMode paddingMode);
member this.GetCiphertextLengthEcb : int * System.Security.Cryptography.PaddingMode -> int
Public Function GetCiphertextLengthEcb (plaintextLength As Integer, paddingMode As PaddingMode) As Integer

Parameters

plaintextLength
Int32

The plaintext length, in bytes.

paddingMode
PaddingMode

The padding mode used to pad the plaintext to the algorithm's block size.

Returns

The length, in bytes, of the ciphertext with padding.

Exceptions

plaintextLength is a negative number.

-or-

plaintextLength when padded is too large to represent as a signed 32-bit integer.

-or-

paddingMode is not a valid padding mode.

BlockSize is not a positive integer.

-or-

BlockSize is not a whole number of bytes. It must be divisible by 8.

The padding mode None was used, but plaintextLength is not a whole number of blocks.

Applies to