CryptoSys API Library Manual

TDEA_Init

Initialises the context with the key, direction and mode ready for repeated operations of the TDEA function. The key and IV data are provided in byte arrays.

VB6/VBA Syntax

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

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

Parameters

strHexKey
[in] String containing the key in hexadecimal representation.
bEncrypt
[in] Boolean direction flag: set as True to encrypt or False to decrypt.
strMode
[in] String specifying the confidentiality mode:
"ECB" for Electronic Codebook mode,
"CBC" for Cipher Block Chaining mode,
"CFB" for 64-bit Cipher Feedback mode,
"OFB" for Output Feedback mode, or
"CTR" for Counter mode.
strHexIV
[in] String containing the initialization vector in hexadecimal. Set as zero (0) for ECB mode.

C/C++ Syntax

long _stdcall TDEA_Init(const unsigned char *key, int bEncrypt, const char *lpszMode, const unsigned char *iv);

Returns (VB6/C)

Long: non-zero handle of the context hContext to be used in subsequent calls to the functions TDEA_Update, TDEA_UpdateHex or TDEA_Final. Returns zero if an error occurs.

.NET Equivalent

Tdea.InitEncrypt Method (Byte[], Mode, Byte[])
Tdea.InitDecrypt Method (Byte[], Mode, Byte[])

Remarks

The key abKey must be exactly 24 bytes long and the IV, if required, exactly 8 bytes long. Unlike most other functions in this API, TDEA_Init returns zero if an error occurs. It is important to check that the value of hContext returned is not equal to zero before calling a TDEA function.

Example

See TDEA_Update.

See Also

TDEA_InitHex TDEA_UpdateHex TDEA_Update TDEA_Final

[Contents] [Index]

[HOME]   [NEXT: TDEA_InitError...]

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