QuickCrypt Library C++ Interface

CRijndael::CRijndael

CRijndael( SL_CIPHER_DIR dir, const unsigned char* pKey );

CRijndael( SL_CIPHER_DIR dir, const unsigned char* pKey, unsigned int nKeyLen );

Note

Instead of CRijndael you can use CAES which is an alias for CRijndael.

Parameters

dir

    [in] Cipher direction. It can be SLC_ENCRYPT or SLC_DECRYPT.

 pKey

    [in] Pointer to the secret key.

 nKeyLen

    [in] Length in bytes of the key. It can be 16, 24 or 32 bytes.

Remarks

Both constructors create a new CRijndael object and initialize it with the secret key pointed by pKey. Note that if nKeyLen it is not indicated, the first CRijndael::DEFAULTKEYSIZE bytes of the memory buffer pointed by pKey are used as the secret key.

The CRijndael object is initialized for encryption if dir is SLC_ENCRYPT, or it is initialized for decryption if dir is SLC_DECRYPT.

Example

 

//Define the key for Rijndael (AES) encryption algorithm
char key[24] = 
{
    'v','e','r','y','l','o','n','g',
    'p','a','s','s','w','o','r','d',
    'a','a','d','e','t','u','g','t'
};
//Declare a local CRijndael object
CRijndael cipher( SLC_ENCRYPT, (const unsigned char*)key );

//Declare a dynamic CRijndael object
CRijndael* pCipher = new CRijndael( SLC_DECRYPT, (const unsigned char*)key, 24 );

 

 

CRijndael Overview   |   Class Members   |   Useful Links

 

See Also    CRijndael::ProcessBlock


 

 

Send Feedback to SlavaSoft Inc. Tell a friend about QuickCrypt Library