CryptoSys API Library Manual

Empty byte arrays

' To pass a "null" (empty) byte array, assign `vbNullString` to the variable.
Dim lpIV() As Byte
lpIV = vbNullString   ' Set to empty array
lpCipher = cipherEncryptBytes(lpPlain, lpKey, lpIV, "Aes128/ECB", 0)

Note: you must use a proper variable to pass an empty array with a wrapper function. And if you need to pass two empty arrays, you must use two independent variables. For example:

' Separate independent empty arrays
lpPT = vbNullString  
lpAAD = vbNullString
lpCT = aeadEncryptWithTag(lpPT, lpKey, lpNonce, lpAAD, API_AEAD_ASCON_128A)

To pass an empty String variable you can simply use either the empty string "" or vbNullString.

' To pass a "null" IV in hex, just use the empty string
strCipherHex = cipherEncryptHex(strPlainHex, strKeyHex, "", "Aes128/ECB", 0)
' Or pass vbNullString directly
strCipherHex = cipherEncryptHex(strPlainHex, strKeyHex, vbNullString, "Aes128/ECB", 0)

[Contents] [Index]

[PREV: Notes on VBA wrapper functions...]   [Contents]   [Index]   
   [NEXT: Using with ANSI C...]

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