Edit

Share via


SymmetricAlgorithm.EncryptCfb Method

Definition

Overloads

EncryptCfb(Byte[], Byte[], PaddingMode, Int32)

Encrypts data using CFB mode with the specified padding mode and feedback size.

EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32)

Encrypts data using CFB mode with the specified padding mode and feedback size.

EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

Encrypts data into the specified buffer, using CFB mode with the specified padding mode and feedback size.

EncryptCfb(Byte[], Byte[], PaddingMode, Int32)

Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs

Encrypts data using CFB mode with the specified padding mode and feedback size.

public byte[] EncryptCfb (byte[] plaintext, byte[] iv, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.None, int feedbackSizeInBits = 8);
member this.EncryptCfb : byte[] * byte[] * System.Security.Cryptography.PaddingMode * int -> byte[]
Public Function EncryptCfb (plaintext As Byte(), iv As Byte(), Optional paddingMode As PaddingMode = System.Security.Cryptography.PaddingMode.None, Optional feedbackSizeInBits As Integer = 8) As Byte()

Parameters

plaintext
Byte[]

The data to encrypt.

iv
Byte[]

The initialization vector.

paddingMode
PaddingMode

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

feedbackSizeInBits
Int32

The feedback size, specified in bits.

Returns

Byte[]

The encrypted ciphertext data.

Exceptions

plaintext or iv is null.

paddingMode is not a valid padding mode.

-or-

feedbackSizeInBits is not positive or represent a whole number of bytes.

iv is the incorrect length. Callers are expected to pass an initialization vector that is exactly BlockSize in length, converted to bytes (BlockSize / 8).

The plaintext could not be encrypted successfully.

-or-

The feedback size is not valid for the algorithm.

Remarks

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

Applies to

EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32)

Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs

Encrypts data using CFB mode with the specified padding mode and feedback size.

public byte[] EncryptCfb (ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> iv, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.None, int feedbackSizeInBits = 8);
member this.EncryptCfb : ReadOnlySpan<byte> * ReadOnlySpan<byte> * System.Security.Cryptography.PaddingMode * int -> byte[]
Public Function EncryptCfb (plaintext As ReadOnlySpan(Of Byte), iv As ReadOnlySpan(Of Byte), Optional paddingMode As PaddingMode = System.Security.Cryptography.PaddingMode.None, Optional feedbackSizeInBits As Integer = 8) As Byte()

Parameters

plaintext
ReadOnlySpan<Byte>

The data to encrypt.

iv
ReadOnlySpan<Byte>

The initialization vector.

paddingMode
PaddingMode

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

feedbackSizeInBits
Int32

The feedback size, specified in bits.

Returns

Byte[]

The encrypted ciphertext data.

Exceptions

paddingMode is not a valid padding mode.

-or-

feedbackSizeInBits is not positive or represent a whole number of bytes.

iv is the incorrect length. Callers are expected to pass an initialization vector that is exactly BlockSize in length, converted to bytes (BlockSize / 8).

The plaintext could not be encrypted successfully.

-or-

The feedback size is not valid for the algorithm.

Remarks

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

Applies to

EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)

Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs
Source:
SymmetricAlgorithm.cs

Encrypts data into the specified buffer, using CFB mode with the specified padding mode and feedback size.

public int EncryptCfb (ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> iv, Span<byte> destination, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.None, int feedbackSizeInBits = 8);
member this.EncryptCfb : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.PaddingMode * int -> int
Public Function EncryptCfb (plaintext As ReadOnlySpan(Of Byte), iv As ReadOnlySpan(Of Byte), destination As Span(Of Byte), Optional paddingMode As PaddingMode = System.Security.Cryptography.PaddingMode.None, Optional feedbackSizeInBits As Integer = 8) As Integer

Parameters

plaintext
ReadOnlySpan<Byte>

The data to encrypt.

iv
ReadOnlySpan<Byte>

The initialization vector.

destination
Span<Byte>

The buffer to receive the ciphertext data.

paddingMode
PaddingMode

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

feedbackSizeInBits
Int32

The feedback size, specified in bits.

Returns

The total number of bytes written to destination.

Exceptions

paddingMode is not a valid padding mode.

-or-

feedbackSizeInBits is not positive or represent a whole number of bytes.

iv is the incorrect length. Callers are expected to pass an initialization vector that is exactly BlockSize in length, converted to bytes (BlockSize / 8).

The plaintext could not be encrypted successfully.

-or-

The feedback size is not valid for the algorithm.

Remarks

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

Applies to