SymmetricAlgorithm.GetCiphertextLengthCfb(Int32, PaddingMode, Int32) Method

Definition

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

public int GetCiphertextLengthCfb (int plaintextLength, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.None, int feedbackSizeInBits = 8);

Parameters

plaintextLength
Int32

The plaintext length, in bytes.

paddingMode
PaddingMode

The padding mode used to pad the plaintext to the feedback size.

feedbackSizeInBits
Int32

The feedback size, in bits.

Returns

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

Exceptions

feedbackSizeInBits is not a positive number.

-or-

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.

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

-or-

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

Remarks

feedbackSizeInBits accepts any value that is a valid feedback size, regardless if the algorithm supports the specified feedback size.

Applies to

Product Versions
.NET 6, 7, 8, 9