Initialises the context with the key, direction and mode ready for repeated operations of the AES function. The key and IV data are in byte arrays.
Public Declare Function AES128_Init Lib "diCryptoSys.dll"
(ByRef lpKey As Byte,
ByVal bEncrypt As Boolean, ByVal strMode As String, ByRef lpInitV As Byte) As Long
hContext = AES128_Init(abKey(0), bEncrypt, strMode, abInitV(0))
long __stdcall AES128_Init(const unsigned char *lpKey, int fEncrypt, const char *szMode, const unsigned char *lpIV);
Non-zero handle of the context hContext
to be used in subsequent calls to the functions
AES128_Update
, AES128_UpdateHex
or AES128_Final
.
Returns zero if an error occurs.
Aes128.InitEncrypt Method (Byte[], Mode, Byte[])
Aes128.InitDecrypt Method (Byte[], Mode, Byte[])
The key array abKey()
must be exactly 16 bytes long.
The initialization vector abInitV()
must be exactly the block size of 16 bytes long, except for ECB mode, where it is ignored (use 0
).
Unlike most other functions in this API, AES128_Init
returns zero if an error occurs.
It is important to check that the value of hContext returned is
not equal to zero before calling the AES Update function.
See AES128_Update
.
AES128_InitHex
AES128_UpdateHex
AES128_Update
AES128_Final