CryptoSys API Library Manual

aeadEncryptWithTag

Encrypt data using specified AEAD algorithm in one-off operation. The authentication tag is appended to the output.

Syntax

[VBA]
Public Function aeadEncryptWithTag ( _
    lpData() As Byte, _
    lpKey() As Byte, _
    lpNonce() As Byte, _
    lpAAD() As Byte, _
    nOptions As Long _
) As Byte()

Parameters

lpData
Input data to be encrypted.
lpKey
Key of exact length for algorithm (16 or 32 bytes).
lpNonce
Initialization Vector (IV) (aka nonce) exactly 16 bytes for ASCON else exactly 12 bytes long.
lpAAD
Additional authenticated data (optional) - set variable as vbNullString to ignore.
nOptions
Algorithm to be used. Select one from
API_AEAD_AES_128_GCM
API_AEAD_AES_256_GCM
API_AEAD_CHACHA20_POLY1305
API_AEAD_ASCON_128
API_AEAD_ASCON_128A
Add API_IV_PREFIX to prepend the IV (nonce) before the ciphertext in the output (use the Or operator).

Return Value

Byte(): Ciphertext with tag appended in a byte array, or empty array on error.

Remarks

The output will either be exactly taglen (16) bytes longer than the input, or exactly taglen + ivlen (28/32) bytes longer if API_IV_PREFIX is used.
[PREV: aeadDestroy...]   [Contents]   [Index]   
   [NEXT: aeadFinishDecrypt...]

Copyright © 2001-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-01-07T07:42:00Z.