72 if (!data || !size || !out) {
94 for (
int i = 0; i !=
padsize; i++) {
113 if (!data || !size || !out) {
123 dec.Decrypt(out, data +
written);
154 : enc(key), pad(
padIn) {
170 : dec(key), pad(
padIn) {
186 : enc(key), pad(
padIn) {
202 : dec(key), pad(
padIn) {
static int CBCDecrypt(const T &dec, const uint8_t iv[AES_BLOCKSIZE], const uint8_t *data, int size, bool pad, uint8_t *out)
static int CBCEncrypt(const T &enc, const uint8_t iv[AES_BLOCKSIZE], const uint8_t *data, int size, bool pad, uint8_t *out)
static const int AES128_KEYSIZE
static const int AES256_KEYSIZE
static const int AES_BLOCKSIZE
uint8_t iv[AES_BLOCKSIZE]
int Decrypt(const uint8_t *data, int size, uint8_t *out) const
AES128CBCDecrypt(const uint8_t key[AES128_KEYSIZE], const uint8_t ivIn[AES_BLOCKSIZE], bool padIn)
int Encrypt(const uint8_t *data, int size, uint8_t *out) const
AES128CBCEncrypt(const uint8_t key[AES128_KEYSIZE], const uint8_t ivIn[AES_BLOCKSIZE], bool padIn)
uint8_t iv[AES_BLOCKSIZE]
AES128Decrypt(const uint8_t key[16])
void Decrypt(uint8_t plaintext[16], const uint8_t ciphertext[16]) const
AES128Encrypt(const uint8_t key[16])
void Encrypt(uint8_t ciphertext[16], const uint8_t plaintext[16]) const
AES256CBCDecrypt(const uint8_t key[AES256_KEYSIZE], const uint8_t ivIn[AES_BLOCKSIZE], bool padIn)
uint8_t iv[AES_BLOCKSIZE]
int Decrypt(const uint8_t *data, int size, uint8_t *out) const
uint8_t iv[AES_BLOCKSIZE]
AES256CBCEncrypt(const uint8_t key[AES256_KEYSIZE], const uint8_t ivIn[AES_BLOCKSIZE], bool padIn)
int Encrypt(const uint8_t *data, int size, uint8_t *out) const
AES256Decrypt(const uint8_t key[32])
void Decrypt(uint8_t plaintext[16], const uint8_t ciphertext[16]) const
void Encrypt(uint8_t ciphertext[16], const uint8_t plaintext[16]) const
AES256Encrypt(const uint8_t key[32])
void AES128_decrypt(const AES128_ctx *ctx, size_t blocks, uint8_t *plain16, const uint8_t *cipher16)
void AES256_decrypt(const AES256_ctx *ctx, size_t blocks, uint8_t *plain16, const uint8_t *cipher16)
void AES128_init(AES128_ctx *ctx, const uint8_t *key16)
void AES256_encrypt(const AES256_ctx *ctx, size_t blocks, uint8_t *cipher16, const uint8_t *plain16)
void AES256_init(AES256_ctx *ctx, const uint8_t *key32)
void AES128_encrypt(const AES128_ctx *ctx, size_t blocks, uint8_t *cipher16, const uint8_t *plain16)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...