ClanLib
2.3.7
|
AES-256 decryption class (running in Cipher Block Chaining mode) More...
#include <aes256_decrypt.h>
Public Member Functions | |
Construction | |
CL_AES256_Decrypt () | |
Constructs a AES-256 generator (running in Cipher Block Chaining mode) More... | |
Attributes | |
CL_DataBuffer | get_data () const |
Get decrypted data. More... | |
Operations | |
static const int | iv_size = 16 |
static const int | key_size = 32 |
void | reset () |
Resets the decryption. More... | |
void | set_iv (const unsigned char iv[iv_size]) |
Sets the initialisation vector. More... | |
void | set_key (const unsigned char key[key_size]) |
Sets the cipher key. More... | |
void | set_padding (bool value=true, bool use_pkcs7=true) |
Enable AES Padding. More... | |
void | add (const void *data, int size) |
Adds data to be decrypted. More... | |
void | add (const CL_DataBuffer &data) |
Add data to be decrypted. More... | |
bool | calculate () |
Finalize decryption. More... | |
AES-256 decryption class (running in Cipher Block Chaining mode)
CL_AES256_Decrypt::CL_AES256_Decrypt | ( | ) |
Constructs a AES-256 generator (running in Cipher Block Chaining mode)
void CL_AES256_Decrypt::add | ( | const void * | data, |
int | size | ||
) |
Adds data to be decrypted.
void CL_AES256_Decrypt::add | ( | const CL_DataBuffer & | data) |
Add data to be decrypted.
data | = Data Buffer |
bool CL_AES256_Decrypt::calculate | ( | ) |
Finalize decryption.
IMPORTANT, to avoid timing attacks, if this function fails, you should still validate the data (via a hash or otherwise), then throw an error
CL_DataBuffer CL_AES256_Decrypt::get_data | ( | ) | const |
Get decrypted data.
This is the databuffer used internally to store the decrypted data. You may call "set_size()" to clear the buffer, inbetween calls to "add()" You may call "set_capacity()" to optimise storage requirements before the add() call
void CL_AES256_Decrypt::reset | ( | ) |
Resets the decryption.
void CL_AES256_Decrypt::set_iv | ( | const unsigned char | iv[iv_size]) |
Sets the initialisation vector.
This should be a random number
This must be called before the initial add()
void CL_AES256_Decrypt::set_key | ( | const unsigned char | key[key_size]) |
Sets the cipher key.
This must be called before the initial add()
void CL_AES256_Decrypt::set_padding | ( | bool | value = true , |
bool | use_pkcs7 = true |
||
) |
Enable AES Padding.
Example (use_pkcs7==true) : ... 0x03 0x03 0x03 (3 octets of padding) Example (use_pkcs7==false) : ... 0x02 0x02 0x02 (3 octets of padding, the last octet is the length)
value | = true = Enable padding (default) |
use_pkcs7 | = true = This uses the PKCS#7/RFC3369 method (Enabled by default). false = use the TLS method (rfc2246) |
|
static |
|
static |