Редагувати

Поділитися через


SymmetricAlgorithm.GetCiphertextLengthCbc(Int32, PaddingMode) Method

Definition

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

public int GetCiphertextLengthCbc (int plaintextLength, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.PKCS7);
member this.GetCiphertextLengthCbc : int * System.Security.Cryptography.PaddingMode -> int
Public Function GetCiphertextLengthCbc (plaintextLength As Integer, Optional paddingMode As PaddingMode = System.Security.Cryptography.PaddingMode.PKCS7) 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