SymmetricAlgorithm.TryEncryptEcbCore 方法

定义

在派生类中重写时,尝试使用具有指定填充模式的 ECB 模式将数据加密到指定的缓冲区中。

C#
protected virtual bool TryEncryptEcbCore(ReadOnlySpan<byte> plaintext, Span<byte> destination, System.Security.Cryptography.PaddingMode paddingMode, out int bytesWritten);

参数

plaintext
ReadOnlySpan<Byte>

要加密的数据。

destination
Span<Byte>

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

paddingMode
PaddingMode

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

bytesWritten
Int32

此方法返回时,包含写入到 destination的字节总数。

返回

true 如果 destination 大到足以接收加密数据,则为 ;否则为 false

例外

派生类未提供实现。

注解

派生类必须重写此值并提供实现。

此方法的实现必须准确地 GetCiphertextLengthEcb(plaintext.Length, paddingMode)destination 字节写入并通过 进行报告 bytesWritten

适用于

产品 版本
.NET 6, 7, 8, 9