CryptoSys API Library Manual

AES256_InitError

Returns the error code after an unsuccessful call to AES256_Init or AES256_InitHex.

VBA/VB6 Syntax

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

nRet = AES256_InitError()

C/C++ Syntax

long __stdcall AES256_InitError(void);

Parameters

None

Returns (VBA/C)

Returns the error code from the last call to AES256_Init or AES256_InitHex.

.NET Equivalent

Aes256.ErrCode Property

Remarks

Example

    Dim hContext As Long
    Dim nRet As Long
    
    ' Try to initialise with an invalid key
    hContext = AES256_InitHex("THIS IS NOT HEX!", ENCRYPT, _
        "CBC", "0123456789abcdef0123456789abcdef")
    If hContext = 0 Then
        nRet = AES192_InitError()
        Debug.Print "AES192_InitHex failed (" & apiErrorLookup(nRet) & ")"
    End If
    
    ' Try with an invalid mode
    hContext = AES256_InitHex("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", _
        ENCRYPT, "XXX", "0123456789abcdef0123456789abcdef")
    If hContext = 0 Then
        nRet = AES192_InitError()
        Debug.Print "AES192_InitHex failed (" & apiErrorLookup(nRet) & ")"
    End If

This should produce the output

AES256_InitHex failed (Invalid key)
AES256_InitHex failed (Invalid mode)

See Also

API_ErrorLookup

[Contents] [Index]

[PREV: AES256_Init...]   [Contents]   [Index]   
   [NEXT: AES256_InitHex...]

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