CryptoSys PKI Pro Manual

Cipher.DecryptAEAD Method (Byte[], Byte[], Byte[], Byte[], AeadAlgorithm, Cipher.Opts)

Decrypt data using the AES-GCM authenticated encryption algorithm with AAD and options.

Syntax

[C#]
public static byte[] DecryptAEAD(
	byte[] input,
	byte[] key,
	byte[] iv,
	byte[] aad,
	AeadAlgorithm aeadAlg,
	Cipher.Opts opts
)
[VB.NET]
Public Shared Function DecryptAEAD ( _
	input As Byte(), _
	key As Byte(), _
	iv As Byte(), _
	aad As Byte(), _
	aeadAlg As AeadAlgorithm, _
	opts As Cipher.Opts _
) As Byte()

Parameters

input
Input data to be decrypted.
key
Key of exact length for algorithm (16, 24 or 32 bytes).
iv
Initialization Vector (IV) (aka nonce) exactly 12 bytes long, if not provided in input.
aad
Additional authenticated data (optional) - set as null to ignore.
aeadAlg
Type: AeadAlgorithm
Authenticated encryption algorithm.
opts
Type: Cipher.Opts
Advanced options. Use Cipher.Opts.PrefixIV to expect the IV to be prepended at the start of the input.

Return Value

Plaintext in a byte array, or empty array on error (an empty array may also be the correct result - check General.ErrorCode for details).

Remarks

The input must include the 16-byte tag appended to the ciphertext and may include a 12-byte prefixed IV. The output will either be exactly 16 bytes shorter than the input, or exactly 28 bytes shorter if the Cipher.Opts.PrefixIV option is used. In all cases the IV must be exactly 12 bytes (96 bits) and the tag must be exactly 16 bytes (128 bits). If additional authentication data (AAD) was provided during encryption then the exact same AAD data must be provided here.

See Also

VB6/C equivalent: CIPHER_DecryptAEAD

[Contents] [Index]

[PREV: Cipher.DecryptAEAD Method (Byte, Byte, Byte, AeadAlgorithm)...]   [Contents]   [Index]   
   [NEXT: Cipher.Encrypt Method (Byte, Byte, Byte, CipherAlgorithm, Mode)...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.