SymmetricAlgorithm.TryEncryptEcb 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
嘗試將資料加密到指定的緩衝區,使用 ECB 模式並搭配指定的填充模式。
public:
bool TryEncryptEcb(ReadOnlySpan<System::Byte> plaintext, Span<System::Byte> destination, System::Security::Cryptography::PaddingMode paddingMode, [Runtime::InteropServices::Out] int % bytesWritten);
public bool TryEncryptEcb(ReadOnlySpan<byte> plaintext, Span<byte> destination, System.Security.Cryptography.PaddingMode paddingMode, out int bytesWritten);
member this.TryEncryptEcb : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.PaddingMode * int -> bool
Public Function TryEncryptEcb (plaintext As ReadOnlySpan(Of Byte), destination As Span(Of Byte), paddingMode As PaddingMode, ByRef bytesWritten As Integer) As Boolean
參數
- plaintext
- ReadOnlySpan<Byte>
要加密的資料。
- paddingMode
- PaddingMode
填充模式用於產生密文並在解密時移除。
- bytesWritten
- Int32
當此方法回傳時,包含寫入 destination的總位元組數。
傳回
true 如果 destination 足夠大以接收加密資料;否則, false。
例外狀況
paddingMode 不是一個有效的填充模式。
明文無法成功加密。
備註
此方法的行為定義為 TryEncryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)。