/***** Define the key for DES-EDE2 encryption algorithm *****/
char key[SLC_DES_EDE2_DEFAULTKEYSIZE] =
{
'v','e','r','y','l','o','n','g','p','a','s','s','w','o','r','d'
};
/***** Define the block for DES-EDE2 encryption algorithm ***/
unsigned char block[SLC_DES_EDE2_BLOCKSIZE] =
{
0x8C, 0x5B, 0x3C, 0x42, 0xDE, 0xB1, 0x11, 0xA0
};
/***** Initialize context ******************************/
unsigned char context[SLC_DES_EDE2_CONTEXTSIZE];
SL_DES_EDE2_Init( context, SLC_ENCRYPT, key, SLC_DES_EDE2_DEFAULTKEYSIZE );
/***** Encrypt the block *******************************/
SL_DES_EDE2_ProcessBlock( context, block, block ); /* in-place encryption */
/***** Change context direction to perform decryption **/
SL_DES_EDE2_Init( context, SLC_DECRYPT, key, SLC_DES_EDE2_DEFAULTKEYSIZE );
/***** Decrypt the block *******************************/
SL_DES_EDE2_ProcessBlock( context, block, block ); /* in-place decryption */
|