SymmetricAlgorithm.TryEncryptCbcCore 方法

定義

當在派生類別中覆寫時,會嘗試將資料加密到指定的緩衝區,使用 CBC 模式並搭配指定的填充模式。

protected:
 virtual bool TryEncryptCbcCore(ReadOnlySpan<System::Byte> plaintext, ReadOnlySpan<System::Byte> iv, Span<System::Byte> destination, System::Security::Cryptography::PaddingMode paddingMode, [Runtime::InteropServices::Out] int % bytesWritten);
protected virtual bool TryEncryptCbcCore(ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> iv, Span<byte> destination, System.Security.Cryptography.PaddingMode paddingMode, out int bytesWritten);
abstract member TryEncryptCbcCore : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.PaddingMode * int -> bool
override this.TryEncryptCbcCore : ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.PaddingMode * int -> bool
Protected Overridable Function TryEncryptCbcCore (plaintext As ReadOnlySpan(Of Byte), iv As ReadOnlySpan(Of Byte), destination As Span(Of Byte), paddingMode As PaddingMode, ByRef bytesWritten As Integer) As Boolean

參數

plaintext
ReadOnlySpan<Byte>

要加密的資料。

iv
ReadOnlySpan<Byte>

初始化向量。

destination
Span<Byte>

緩衝區用來接收密文資料。

paddingMode
PaddingMode

填充模式用於產生密文並在解密時移除。

bytesWritten
Int32

當此方法回傳時,包含寫入 destination的總位元組數。

傳回

true 如果 destination 足夠大以接收加密資料;否則, false

例外狀況

派生類別尚未提供實作。

備註

衍生類別必須覆蓋此限制並提供實作。

此方法的實作必須精確GetCiphertextLengthCbc(plaintext.Length, paddingMode)地寫入位destination元組,並透過 來報告。bytesWritten

適用於