cipherDecryptAEAD
Decrypt data using Authenticated Encryption with Associated Data (AEAD).
The authentication tag is expected to be appended to the input ciphertext.
Syntax
[VBA]
Public Function cipherDecryptAEAD ( _
lpInput() As Byte, _
lpKey() As Byte, _
lpIV() As Byte, _
lpAAD() As Byte, _
nOptions As Long _
) As Byte()
Parameters
- lpInput
- Input data to be decrypted.
- lpKey
- Key of exact length for algorithm (16, 24 or 32 bytes).
- lpIV
- Initialization Vector (IV, aka nonce (optional)).
Required if IV is not prepended to the input. If present, must be an array of bytes exactly 12 bytes long. Pass an empty array to ignore.
- lpAAD
- Additional authenticated data (optional). If present, expected to be an array of bytes exactly equal to the AAD used for encryption,
else pass an empty array to ignore.
- nOptions
- Algorithm to be used. Select one from
PKI_AEAD_AES_128_GCM
PKI_AEAD_AES_192_GCM
PKI_AEAD_AES_256_GCM
PKI_AEAD_CHACHA20_POLY1305
Add PKI_IV_PREFIX to expect the IV to be prepended at the start of the input.
Return Value
Byte(): Plaintext in a byte array, or empty array on error (an empty array may also trivially be the correct result).
Remarks
The input must include the 16-byte tag appended to the ciphertext.