Source Code:

CRYPT_CONTEXT cryptContext;

cryptCreateContext( &cryptContext,

cryptUser,CRYPT_ALGO_DES );

cryptEncrypt( cryptContext, data, dataLength );

cryptDestroyContext( cryptContext );

Function Prototype:

C_RET cryptCreateContext( C_OUT CRYPT_CONTEXT C_PTR cryptContext, C_IN CRYPT_USER cryptUser, C_IN CRYPT_ALGO_TYPE cryptAlgo );

C_RET cryptEncrypt( C_IN CRYPT_CONTEXT cryptContext, C_INOUT void C_PTR buffer, C_IN int length );

C_RET cryptDestroyContext( C_IN CRYPT_CONTEXT cryptContext );

The mapping function of each function is as follows:

cryptCreateContext

{(SYSTEM.output cryptContext): (SYSTEM.startParam,

SYSTEM.mainLink, SYSTEM.pointer1);

(cryptAlgo): ( SYSTEM.cryptAlgo); }

SYSTEM.cryptAlgo(id)

{(id==1): (algorithm_layer.symmetric_algorithm.DES);

(id==2): (algorithm_layer.symmetric_algorithm.3DES); …}

cryptEncrypt

{( cryptContext): (SYSTEM.mainLink, SYSTEM.pointer1);

(SYSTEM.input data):

(algorithm_layer.symmetric_algorithm.attribute.input _data);

(SYSTEM.output data):

(algorithm_layer.symmetric_algorithm.attribute.enc_data);

(SYSTEM.functionName):

(algorithm_layer.symmetric_algorithm.attribute.encFlag.enc); }

cryptDestroyContext

{ cryptContext:

(SYSTEM.endParam, SYSTEM.mainLink, SYSTEM.pointer1); }