CryptoSys PKI Pro Manual

cipherEncryptAEAD_2

Encrypt data using Authenticated Encryption with Associated Data (AEAD) with parameters arranged for ease of use.

Syntax

[VBA]
Public Function cipherEncryptAEAD_2 ( _
    lpInput() As Byte, _
    lpKey() As Byte, _
    lpIV() As Byte, _
    nOptions As Long, _
    Optional ByRef lpAAD As Variant _
) As Byte()

Parameters

lpInput
Byte array containing the input data.
lpKey
Key of exact length for algorithm (16, 24 or 32 bytes).
lpIV
Initialization Vector (IV) (aka nonce) exactly 12 bytes long.
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
and optionally add PKI_IV_PREFIX to prepend the IV (nonce) before the ciphertext in the output.
lpAAD
Additional authenticated data (optional). If present, expected to be an array of bytes.

Return Value

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

Remarks

The output will either be exactly 16 bytes longer than the input, or exactly 28 bytes longer if PKI_IV_PREFIX is used. Note the change in argument order from cipherEncryptAEAD. New in v23.1.0a.
[PREV: cipherEncryptAEAD...]   [Contents]   [Index]   
   [NEXT: cipherEncryptBytes...]

Copyright © 2004-26 D.I. Management Services Pty Ltd. All rights reserved. Generated 2026-05-09T05:51:34Z.