CryptoSys API Library Manual

AES128_InitError

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

VB6/VBA Syntax

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

nRet = AES128_InitError()

Parameters

None

C/C++ Syntax

long _stdcall AES128_InitError(void);

Returns (VB6/C)

Long: 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]

[HOME]   [NEXT: AES128_InitHex...]

Copyright © 2001-9 D.I. Management Services Pty Ltd. All rights reserved.