Returns the error code after an unsuccessful call to
AES128_Init or AES128_InitHex.
Public Declare Function AES128_InitError Lib "diCryptoSys.dll"
() As Long
nRet = AES128_InitError()
long __stdcall AES128_InitError(void);
None
Returns the error code from the last call to
AES128_Init or AES128_InitHex.
Dim hContext As Long
Dim nRet As Long
' Try to initialise with an invalid key
hContext = AES128_InitHex("THIS IS NOT HEX!", ENCRYPT, _
"CBC", "0123456789abcdef0123456789abcdef")
If hContext = 0 Then
nRet = AES128_InitError()
Debug.Print "AES128_InitHex failed (" & apiErrorLookup(nRet) & ")"
End If
' Try with an invalid mode
hContext = AES128_InitHex("8A05FC5E095AF4848A08D328D3688E3D", _
ENCRYPT, "XXX", "0123456789abcdef0123456789abcdef")
If hContext = 0 Then
nRet = AES128_InitError()
Debug.Print "AES128_InitHex failed (" & apiErrorLookup(nRet) & ")"
End If
This should produce the output
AES128_InitHex failed (Invalid key) AES128_InitHex failed (Invalid mode)