CryptoSys API Library Manual

AES256_InitHex

Initialises the context with the key, direction and mode ready for repeated operations of the AES function. The key and IV data are passed in hexadecimal format.

VBA/VB6 Syntax

Public Declare Function AES256_InitHex Lib "diCryptoSys.dll" (ByVal strHexKey As String, ByVal bEncrypt As Boolean, ByVal strMode As String, ByVal strHexIV As String) As Long

hContext = AES256_InitHex(strHexKey, bEncrypt, strMode, strHexIV)

C/C++ Syntax

long __stdcall AES256_InitHex(const char *szKey, int fEncrypt, const char *szMode, const char *szIV);

Parameters

szKey
[in] containing the key in hexadecimal representation.
fEncrypt
[in] direction flag: set as ENCRYPT (True) to encrypt or DECRYPT (False) to decrypt.
szMode
[in] specifying the confidentiality mode:
"ECB" for Electronic Codebook mode,
"CBC" for Cipher Block Chaining mode,
"CFB" for 128-bit Cipher Feedback mode,
"OFB" for Output Feedback mode, or
"CTR" for Counter mode.
szIV
[in] containing the initialization vector in hexadecimal.

Returns (VBA/C)

Non-zero handle of the context hContext to be used in subsequent calls to the functions AES256_Update, AES256_UpdateHex or AES256_Final. Returns zero if an error occurs.

.NET Equivalent

Aes256.InitEncrypt Method (String, Mode, String)
Aes256.InitDecrypt Method (String, Mode, String)

Remarks

The key string szHexKey must be exactly 64 hexadecimal characters long (i.e. representing exactly 32 bytes/256 bits). The initialization vector szHexIV must be exactly 32 hexadecimal characters long (i.e. representing exactly the block size of 16 bytes), except for ECB mode, where it is ignored (use ""). Valid hexadecimal characters are [0-9A-Fa-f]. Unlike most other functions in this API, AES256_InitHex 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.

Example

See AES256_UpdateHex.

See Also

AES256_Init AES256_UpdateHex AES256_Update AES256_Final

[Contents] [Index]

[PREV: AES256_InitError...]   [Contents]   [Index]   
   [NEXT: AES256_Update...]

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