AES Class Reference Library » AES

#include <lib_aes.h>

详细描述

An Advanced Encryption Standard (also known as Rijndael) class to encrypt/decrypt data.

注意
Has to be created with Alloc() and destroyed with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

私有成员函数

  AES ()
  ~AES ()

Alloc/Free

static AES Alloc ()
static void  Free ( AES *&pAES)

Init

Bool   Init ( Int32 lBlockLength, Int32 lKeyLength)

Calculate Data Size

static Int   CalcEncryptedDataSize ( Int32 lBlockLength, Int lDataLength)

Encrypt/Decrypt

Bool   Encrypt (void *pData, Int lDataLength, const void *pKey)
Bool   Decrypt (void *pData, Int lDataLength, const void *pKey)

Progress Callback

void  SetProgressCallback ( PFNRIJINDAEL_CIPHER_PROGRESS fn, void *pData)

构造函数 & 析构函数文档编制

◆  AES()

AES () private

◆  ~AES()

~ AES () private

成员函数文档编制

◆  Alloc()

static AES * Alloc ( )
static

Allocates an AES cipher. Destroy the allocated AES cipher with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

返回
The allocated AES cipher, or nullptr if the allocation failed.

◆  Free()

static void Free ( AES *&  pAES )
static

Destructs AES ciphers allocated with Alloc() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

参数
[in,out] pAES The AES cipher to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆  Init()

Bool Init ( Int32   lBlockLength ,
Int32   lKeyLength  
)

Initializes the AES cipher to the given block length and key length.

参数
[in] lBlockLength The block length. Must be 128 , 192 or 256 (bit).
[in] lKeyLength The key length. Must be 128 , 192 or 256 (bit).
返回
true if initialization was successful, otherwise false .

◆  CalcEncryptedDataSize()

static Int CalcEncryptedDataSize ( Int32   lBlockLength ,
Int   lDataLength  
)
static

Calculates the size of the data block (data size + encryption overhead).

参数
[in] lBlockLength The block length in bits.
[in] lDataLength The size of the data in bytes.
返回
The size of the data block in bytes.

◆  Encrypt()

Bool Encrypt ( void *  pData ,
Int   lDataLength ,
const void *  pKey  
)

Encrypts a data block.

参数
[in,out] pData The data block to encrypt.
[in] lDataLength The size of the data block. Usually retrieved with CalcEncryptedDataSize() .
[in] pKey The encryption key.
返回
true if encryption was successful, otherwise false .

◆  Decrypt()

Bool Decrypt ( void *  pData ,
Int   lDataLength ,
const void *  pKey  
)

Decrypts a data block.

参数
[in,out] pData The encrypted data block.
[in] lDataLength The size of the data block.
[in] pKey The decryption key.
返回
true if decryption was successful, otherwise false .

◆  SetProgressCallback()

void SetProgressCallback ( PFNRIJINDAEL_CIPHER_PROGRESS   fn ,
void *  pData  
)

Sets the encryption/decryption progress hook.

注意
For future use, does nothing, currently.
参数
[in] fn The progress hook.
[in] pData The data pointer passed to the hook.