SymmetricAlgorithm.EncryptCfb 方法

定义

重载

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

使用 CFB 模式加密具有指定填充模式和反馈大小的数据。

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

使用 CFB 模式加密具有指定填充模式和反馈大小的数据。

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

使用具有指定填充模式和反馈大小的 CFB 模式将数据加密到指定的缓冲区。

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

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

使用 CFB 模式加密具有指定填充模式和反馈大小的数据。

C#
public byte[] EncryptCfb(byte[] plaintext, byte[] iv, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.None, int feedbackSizeInBits = 8);

参数

plaintext
Byte[]

要加密的数据。

iv
Byte[]

初始化向量。

paddingMode
PaddingMode

用于生成密码文本并在解密期间删除的填充模式。

feedbackSizeInBits
Int32

反馈大小(以位为单位)。

返回

Byte[]

加密的密码文本数据。

例外

plaintextivnull

paddingMode 不是有效的填充模式。

-或-

feedbackSizeInBits 不为正或表示整数字节。

iv 长度不正确。 调用方应传递长度完全相同 BlockSize 的初始化向量,该向量转换为字节 (BlockSize / 8) 。

无法成功加密纯文本。

-或-

反馈大小对算法无效。

注解

此方法的行为由 TryEncryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)定义。

适用于

.NET 10 和其他版本
产品 版本
.NET 6, 7, 8, 9, 10

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

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

使用 CFB 模式加密具有指定填充模式和反馈大小的数据。

C#
public byte[] EncryptCfb(ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> iv, System.Security.Cryptography.PaddingMode paddingMode = System.Security.Cryptography.PaddingMode.None, int feedbackSizeInBits = 8);

参数

plaintext
ReadOnlySpan<Byte>

要加密的数据。

iv
ReadOnlySpan<Byte>

初始化向量。

paddingMode
PaddingMode

用于生成密码文本并在解密期间删除的填充模式。

feedbackSizeInBits
Int32

反馈大小(以位为单位)。

返回

Byte[]

加密的密码文本数据。

例外

paddingMode 不是有效的填充模式。

-或-

feedbackSizeInBits 不为正或表示整数字节。

iv 长度不正确。 调用方应传递长度完全相同 BlockSize 的初始化向量,该向量转换为字节 (BlockSize / 8) 。

无法成功加密纯文本。

-或-

反馈大小对算法无效。

注解

此方法的行为由 TryEncryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)定义。

适用于

.NET 10 和其他版本
产品 版本
.NET 6, 7, 8, 9, 10

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

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

使用具有指定填充模式和反馈大小的 CFB 模式将数据加密到指定的缓冲区。

C#
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);

参数

plaintext
ReadOnlySpan<Byte>

要加密的数据。

iv
ReadOnlySpan<Byte>

初始化向量。

destination
Span<Byte>

用于接收密码文本数据的缓冲区。

paddingMode
PaddingMode

用于生成密码文本并在解密期间删除的填充模式。

feedbackSizeInBits
Int32

反馈大小(以位为单位)。

返回

写入 destination 的总字节数。

例外

paddingMode 不是有效的填充模式。

-或-

feedbackSizeInBits 不为正或表示整数字节。

iv 长度不正确。 调用方应传递长度完全相同 BlockSize 的初始化向量,该向量转换为字节 (BlockSize / 8) 。

无法成功加密纯文本。

-或-

反馈大小对算法无效。

注解

此方法的行为由 TryEncryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)定义。

适用于

.NET 10 和其他版本
产品 版本
.NET 6, 7, 8, 9, 10