CryptoSys API Library Manual

AES128_InitError

Returns the error code after an unsuccessful call to AES128_Init or AES128_InitHex.

VBA/VB6 Syntax

Public Declare Function AES128_InitError Lib "diCryptoSys.dll" () As Long

nRet = AES128_InitError()

C/C++ Syntax

long __stdcall AES128_InitError(void);

Parameters

None

Returns (VBA/C)

Returns the error code from the last call to AES128_Init or AES128_InitHex.

.NET Equivalent

Aes128.ErrCode Property

Remarks

Example

    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)

See Also

API_ErrorLookup

[Contents] [Index]

[PREV: AES128_Init...]   [Contents]   [Index]   
   [NEXT: AES128_InitHex...]

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