AesCcm.Decrypt 方法

定義

多載

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

如果可對驗證標記進行驗證,則將加密文字解密至提供的目的地緩衝區。Decrypts the ciphertext into the provided destination buffer if the authentication tag can be validated.

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

如果可對驗證標記進行驗證,則將加密文字解密至提供的目的地緩衝區。Decrypts the ciphertext into the provided destination buffer if the authentication tag can be validated.

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

如果可對驗證標記進行驗證,則將加密文字解密至提供的目的地緩衝區。Decrypts the ciphertext into the provided destination buffer if the authentication tag can be validated.

public void Decrypt (byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[] associatedData = null);
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() = null)

參數

nonce
Byte[]

與這個訊息建立關聯的 nonce,必須符合加密期間所提供的值。The nonce associated with this message, which must match the value provided during encryption.

ciphertext
Byte[]

要解密的加密內容。The encrypted content to decrypt.

tag
Byte[]

在加密期間為了這個訊息所產生的驗證標記。The authentication tag produced for this message during encryption.

plaintext
Byte[]

要接收解密內容的位元組陣列。The byte array to receive the decrypted contents.

associatedData
Byte[]

與這個訊息建立關聯的額外資料,必須符合加密期間所提供的值。Extra data associated with this message, which must match the value provided during encryption.

例外狀況

plaintext 參數與 ciphertext 的長度不同。The plaintext parameter and the ciphertext do not have the same length.

-或--or-

NonceByteSizes 不允許 nonce 參數長度。The nonce parameter length is not permitted by NonceByteSizes.

-或--or-

TagByteSizes 不允許 tag 參數長度。The tag parameter length is not permitted by TagByteSizes.

nonceciphertexttagplaintext 參數是 nullThe nonce, ciphertext, tag, or plaintext parameter is null.

無法驗證標記值,或解密作業失敗。The tag value could not be verified, or the decryption operation otherwise failed.

備註

如果tag無法驗證 (使用ciphertext索引鍵、 nonce、和associatedData值), plaintext則會清除。If tag cannot be validated (using the key, nonce, ciphertext, and associatedData values), then plaintext is cleared.

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

如果可對驗證標記進行驗證,則將加密文字解密至提供的目的地緩衝區。Decrypts the ciphertext into the provided destination buffer if the authentication tag can be validated.

public void Decrypt (ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> tag, Span<byte> plaintext, ReadOnlySpan<byte> associatedData = null);
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) = null)

參數

nonce
ReadOnlySpan<Byte>

與這個訊息建立關聯的 nonce,必須符合加密期間所提供的值。The nonce associated with this message, which must match the value provided during encryption.

ciphertext
ReadOnlySpan<Byte>

要解密的加密內容。The encrypted content to decrypt.

tag
ReadOnlySpan<Byte>

在加密期間為了這個訊息所產生的驗證標記。The authentication tag produced for this message during encryption.

plaintext
Span<Byte>

要接收解密內容的位元組範圍。The byte span to receive the decrypted contents.

associatedData
ReadOnlySpan<Byte>

與這個訊息建立關聯的額外資料,必須符合加密期間所提供的值。Extra data associated with this message, which must match the value provided during encryption.

例外狀況

plaintext 參數與 ciphertext 的長度不同。The plaintext parameter and the ciphertext do not have the same length.

-或--or-

NonceByteSizes 不允許 nonce 參數長度。The nonce parameter length is not permitted by NonceByteSizes.

-或--or-

TagByteSizes 不允許 tag 參數長度。The tag parameter length is not permitted by TagByteSizes.

無法驗證標記值,或解密作業失敗。The tag value could not be verified, or the decryption operation otherwise failed.

備註

如果tag無法驗證 (使用ciphertext索引鍵、 nonce、和associatedData值), plaintext則會清除。If tag cannot be validated (using the key, nonce, ciphertext, and associatedData values), then plaintext is cleared.

適用於