語言

ISpanAuthenticatedEncryptor.Decrypt<TWriter> 方法

定義

驗證認證標籤並解密一組加密資料,將結果寫入緩衝區寫入器。

public void Decrypt<TWriter>(ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> additionalAuthenticatedData, ref TWriter destination) where TWriter : System.Buffers.IBufferWriter<byte>, allows ref struct;
abstract member Decrypt : ReadOnlySpan<byte> * ReadOnlySpan<byte> * 'Writer -> unit (requires 'Writer :> System.Buffers.IBufferWriter<byte>)
Public Sub Decrypt(Of TWriter As IBufferWriter(Of Byte)) (ciphertext As ReadOnlySpan(Of Byte), additionalAuthenticatedData As ReadOnlySpan(Of Byte), ByRef destination As TWriter)

類型參數

TWriter

用來寫明文的緩衝區寫入器類型。

參數

ciphertext
ReadOnlySpan<Byte>

密文(包括認證標籤)用於解密。

additionalAuthenticatedData
ReadOnlySpan<Byte>

任何在驗證標籤計算過程中使用的輔助資料。 在對應的呼叫 Encrypt<TWriter>(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, TWriter)中必須指定相同的 AAD。

destination
TWriter

解密明文將寫入的緩衝區寫入器。

備註

此方法提供了優化的串流替代方案。Decrypt(ArraySegment<Byte>, ArraySegment<Byte>) 與其分配中間緩衝區,明文會直接寫入所提供的緩衝區寫入器,這能提升效能並降低記憶體配置壓力。 緩衝區寫入器會依照寫入的位元組總數來前進。

適用於