AesGcm.Decrypt 方法

定義

多載

名稱 Description
Decrypt(Byte[], Byte[], Byte[], Byte[], Byte[])

若能驗證認證標籤,則會將密文解密至目的緩衝區。

Decrypt(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, ReadOnlySpan<Byte>)

若能驗證認證標籤,則會將密文解密至目的緩衝區。

Decrypt(Byte[], Byte[], Byte[], Byte[], Byte[])

來源:
AesGcm.cs
來源:
AesGcm.cs
來源:
AesGcm.cs
來源:
AesGcm.cs
來源:
AesGcm.cs

若能驗證認證標籤,則會將密文解密至目的緩衝區。

public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[]? associatedData = default);
public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[] associatedData = default);
member this.Decrypt : byte[] * byte[] * byte[] * byte[] * byte[] -> unit
Public Sub Decrypt (nonce As Byte(), ciphertext As Byte(), tag As Byte(), plaintext As Byte(), Optional associatedData As Byte() = Nothing)

參數

nonce
Byte[]

與此訊息相關的 nonx,必須與加密時提供的值相符。

ciphertext
Byte[]

要解密的加密內容。

tag
Byte[]

加密時為此訊息產生的認證標籤。

plaintext
Byte[]

位元組陣列用來接收解密內容。

associatedData
Byte[]

與此訊息相關的額外資料,必須與加密時提供的值相符。

例外狀況

plaintext參數 和 ciphertext 的長度並不相同。

-或-

nonce參數長度不被允許。NonceByteSizes

-或-

tag參數長度不被允許。TagByteSizes

參數 nonceciphertexttag, 或 plaintextnull

解密行動失敗。 在 .NET 8 之前,表示標籤值無法驗證。

.NET 8 及以後版本:標籤值無法驗證。

備註

tag 無法驗證(使用鍵、 nonceciphertextassociatedData 值),則 plaintext 清除。

適用於

Decrypt(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, ReadOnlySpan<Byte>)

來源:
AesGcm.cs
來源:
AesGcm.cs
來源:
AesGcm.cs
來源:
AesGcm.cs
來源:
AesGcm.cs

若能驗證認證標籤,則會將密文解密至目的緩衝區。

public void Decrypt(ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> tag, Span<byte> plaintext, ReadOnlySpan<byte> associatedData = default);
member this.Decrypt : ReadOnlySpan<byte> * ReadOnlySpan<byte> * ReadOnlySpan<byte> * Span<byte> * ReadOnlySpan<byte> -> unit
Public Sub Decrypt (nonce As ReadOnlySpan(Of Byte), ciphertext As ReadOnlySpan(Of Byte), tag As ReadOnlySpan(Of Byte), plaintext As Span(Of Byte), Optional associatedData As ReadOnlySpan(Of Byte) = Nothing)

參數

nonce
ReadOnlySpan<Byte>

與此訊息相關的 nonx,必須與加密時提供的值相符。

ciphertext
ReadOnlySpan<Byte>

要解密的加密內容。

tag
ReadOnlySpan<Byte>

加密時為此訊息產生的認證標籤。

plaintext
Span<Byte>

該位元組長度用於接收解密內容。

associatedData
ReadOnlySpan<Byte>

與此訊息相關的額外資料,必須與加密時提供的值相符。

例外狀況

plaintext參數 和 ciphertext 的長度並不相同。

-或-

nonce參數長度不被允許。NonceByteSizes

-或-

tag參數長度不被允許。TagByteSizes

解密行動失敗。 在 .NET 8 之前,表示標籤值無法驗證。

.NET 8 及以後版本:標籤值無法驗證。

備註

tag 無法驗證(使用鍵、 nonceciphertextassociatedData 值),則 plaintext 清除。

適用於