Code base obscuration (for images) 1.0
It implements different obscuration methods on portable images (.pgm and .ppm)
|
This class implements the AES encryption and decryption algorithms as specified in the FIPS 197 standard. More...
#include <AES.hpp>
Public Member Functions | |
AES (const AESKeyLength keyLength=AESKeyLength::AES_256) | |
Construct an AES object with a specified key length. | |
unsigned char * | EncryptECB (const unsigned char in[], unsigned int inLen, const unsigned char key[]) |
Encrypt data using the ECB mode of operation. | |
unsigned char * | DecryptECB (const unsigned char in[], unsigned int inLen, const unsigned char key[]) |
Decrypt data using the ECB mode of operation. | |
unsigned char * | EncryptCBC (const unsigned char in[], unsigned int inLen, const unsigned char key[], const unsigned char *iv) |
Encrypt data using the CBC mode of operation. | |
unsigned char * | DecryptCBC (const unsigned char in[], unsigned int inLen, const unsigned char key[], const unsigned char *iv) |
Decrypt data using the CBC mode of operation. | |
unsigned char * | EncryptCFB (const unsigned char in[], unsigned int inLen, const unsigned char key[], const unsigned char *iv) |
Encrypt data using the CFB mode of operation. | |
unsigned char * | DecryptCFB (const unsigned char in[], unsigned int inLen, const unsigned char key[], const unsigned char *iv) |
Decrypt data using the CFB mode of operation. | |
unsigned char * | EncryptOFB (const unsigned char in[], unsigned int inLen, const unsigned char key[], const unsigned char *iv) |
Encrypt data using the OFB mode of operation. | |
unsigned char * | DecryptOFB (const unsigned char in[], unsigned int inLen, const unsigned char key[], const unsigned char *iv) |
Decrypt data using the OFB mode of operation. | |
void | IncrementCounter (unsigned char counter[blockBytesLen]) |
Increment a counter used in the CTR mode of operation. | |
unsigned char * | EncryptCTR (const unsigned char in[], unsigned int inLen, const unsigned char key[], const unsigned char *iv) |
Encrypt data using the CTR mode of operation. | |
unsigned char * | DecryptCTR (const unsigned char in[], unsigned int inLen, const unsigned char key[], const unsigned char *iv) |
Decrypt data using the CTR mode of operation. | |
std::vector< unsigned char > | EncryptECB (std::vector< unsigned char > in, std::vector< unsigned char > key) |
Encrypt data using the ECB mode of operation and store the result in a vector of bytes. | |
std::vector< unsigned char > | DecryptECB (std::vector< unsigned char > in, std::vector< unsigned char > key) |
Decrypt data using the ECB mode of operation and store the result in a vector of bytes. | |
std::vector< unsigned char > | EncryptCBC (std::vector< unsigned char > in, std::vector< unsigned char > key, std::vector< unsigned char > iv) |
Encrypt data using the CBC mode of operation and store the result in a vector of bytes. | |
std::vector< unsigned char > | DecryptCBC (std::vector< unsigned char > in, std::vector< unsigned char > key, std::vector< unsigned char > iv) |
Decrypt data using the CBC mode of operation and store the result in a vector of bytes. | |
std::vector< unsigned char > | EncryptCFB (std::vector< unsigned char > in, std::vector< unsigned char > key, std::vector< unsigned char > iv) |
Encrypt data using the CFB mode of operation and store the result in a vector of bytes. | |
std::vector< unsigned char > | DecryptCFB (std::vector< unsigned char > in, std::vector< unsigned char > key, std::vector< unsigned char > iv) |
Decrypt data using the CFB mode of operation and store the result in a vector of bytes. | |
void | printHexArray (unsigned char a[], unsigned int n) |
Print an array of bytes in hexadecimal format. | |
void | printHexVector (std::vector< unsigned char > a) |
Print a vector of bytes in hexadecimal format. | |
This class implements the AES encryption and decryption algorithms as specified in the FIPS 197 standard.
It provides methods for encrypting and decrypting data using various modes of operation, including ECB, CBC, CFB, OFB, and CTR. It also provides methods for key expansion, sub byte substitution, shift rows, mix columns, and other internal operations required by the AES algorithm.
|
explicit |
Construct an AES object with a specified key length.
keyLength | The key length to be used. |
unsigned char * AES::DecryptCBC | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[], | ||
const unsigned char * | iv ) |
Decrypt data using the CBC mode of operation.
in | The input data to be decrypted. |
inLen | The length of the input data. |
key | The key to be used for decryption. |
iv | The initialization vector to be used for decryption. |
std::vector< unsigned char > AES::DecryptCBC | ( | std::vector< unsigned char > | in, |
std::vector< unsigned char > | key, | ||
std::vector< unsigned char > | iv ) |
Decrypt data using the CBC mode of operation and store the result in a vector of bytes.
in | The input data to be decrypted. |
key | The key to be used for decryption. |
iv | The initialization vector to be used for decryption. |
unsigned char * AES::DecryptCFB | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[], | ||
const unsigned char * | iv ) |
Decrypt data using the CFB mode of operation.
in | The input data to be decrypted. |
inLen | The length of the input data. |
key | The key to be used for decryption. |
iv | The initialization vector to be used for decryption. |
std::vector< unsigned char > AES::DecryptCFB | ( | std::vector< unsigned char > | in, |
std::vector< unsigned char > | key, | ||
std::vector< unsigned char > | iv ) |
Decrypt data using the CFB mode of operation and store the result in a vector of bytes.
in | The input data to be decrypted. |
key | The key to be used for decryption. |
iv | The initialization vector to be used for decryption. |
unsigned char * AES::DecryptCTR | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[], | ||
const unsigned char * | iv ) |
Decrypt data using the CTR mode of operation.
in | The input data to be decrypted. |
inLen | The length of the input data. |
key | The key to be used for decryption. |
iv | The initialization vector to be used for decryption. |
unsigned char * AES::DecryptECB | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[] ) |
Decrypt data using the ECB mode of operation.
in | The input data to be decrypted. |
inLen | The length of the input data. |
key | The key to be used for decryption. |
std::vector< unsigned char > AES::DecryptECB | ( | std::vector< unsigned char > | in, |
std::vector< unsigned char > | key ) |
Decrypt data using the ECB mode of operation and store the result in a vector of bytes.
in | The input data to be decrypted. |
key | The key to be used for decryption. |
unsigned char * AES::DecryptOFB | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[], | ||
const unsigned char * | iv ) |
Decrypt data using the OFB mode of operation.
in | The input data to be decrypted. |
inLen | The length of the input data. |
key | The key to be used for decryption. |
iv | The initialization vector to be used for decryption. |
unsigned char * AES::EncryptCBC | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[], | ||
const unsigned char * | iv ) |
Encrypt data using the CBC mode of operation.
in | The input data to be encrypted. |
inLen | The length of the input data. |
key | The key to be used for encryption. |
iv | The initialization vector to be used for encryption. |
std::vector< unsigned char > AES::EncryptCBC | ( | std::vector< unsigned char > | in, |
std::vector< unsigned char > | key, | ||
std::vector< unsigned char > | iv ) |
Encrypt data using the CBC mode of operation and store the result in a vector of bytes.
in | The input data to be encrypted. |
key | The key to be used for encryption. |
iv | The initialization vector to be used for encryption. |
unsigned char * AES::EncryptCFB | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[], | ||
const unsigned char * | iv ) |
Encrypt data using the CFB mode of operation.
in | The input data to be encrypted. |
inLen | The length of the input data. |
key | The key to be used for encryption. |
iv | The initialization vector to be used for encryption. |
std::vector< unsigned char > AES::EncryptCFB | ( | std::vector< unsigned char > | in, |
std::vector< unsigned char > | key, | ||
std::vector< unsigned char > | iv ) |
Encrypt data using the CFB mode of operation and store the result in a vector of bytes.
in | The input data to be encrypted. |
key | The key to be used for encryption. |
iv | The initialization vector to be used for encryption. |
unsigned char * AES::EncryptCTR | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[], | ||
const unsigned char * | iv ) |
Encrypt data using the CTR mode of operation.
in | The input data to be encrypted. |
inLen | The length of the input data. |
key | The key to be used for encryption. |
iv | The initialization vector to be used for encryption. |
unsigned char * AES::EncryptECB | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[] ) |
Encrypt data using the ECB mode of operation.
in | The input data to be encrypted. |
inLen | The length of the input data. |
key | The key to be used for encryption. |
std::vector< unsigned char > AES::EncryptECB | ( | std::vector< unsigned char > | in, |
std::vector< unsigned char > | key ) |
Encrypt data using the ECB mode of operation and store the result in a vector of bytes.
in | The input data to be encrypted. |
key | The key to be used for encryption. |
unsigned char * AES::EncryptOFB | ( | const unsigned char | in[], |
unsigned int | inLen, | ||
const unsigned char | key[], | ||
const unsigned char * | iv ) |
Encrypt data using the OFB mode of operation.
in | The input data to be encrypted. |
inLen | The length of the input data. |
key | The key to be used for encryption. |
iv | The initialization vector to be used for encryption. |
void AES::IncrementCounter | ( | unsigned char | counter[blockBytesLen] | ) |
Increment a counter used in the CTR mode of operation.
counter | The counter to be incremented. |
void AES::printHexArray | ( | unsigned char | a[], |
unsigned int | n ) |
Print an array of bytes in hexadecimal format.
a | The array of bytes to be printed. |
n | The length of the array. |
void AES::printHexVector | ( | std::vector< unsigned char > | a | ) |
Print a vector of bytes in hexadecimal format.
a | The vector of bytes to be printed. |