AES128ESP32 Library
Loading...
Searching...
No Matches
cryptoAES128.h
Go to the documentation of this file.
1#pragma once
2
3#include "AES128ESP32.h"
4// #include <Arduino.h>
5// #include <cstring>
6
7class pass2Key;
8// #include "psa/crypto_values.h"
9
10// #define DEBUGLEVEL 2
11// #include "delays.h"
12// #include "psaerr2str.h"
13// #include "pbkdf2.h"
14
15
16// #include "psa/crypto.h"
17// AES128
18
55
56
57
59
60 unsigned char iv[AES128IVSIZE] = { 0x00 };
61 size_t givlen = 0; // generated IV
62 psa_key_id_t key; // this is the PSA key
63 size_t key_bits = AES128BYTES * 8;
64 psa_aead_operation_t op;
65public:
67 bool setKeyaccess(pass2Key *keyholder) { return setKeyaccess(*keyholder); }
68 bool setKeyaccess(pass2Key &keyholder);
69 bool getIVbytes(ivData &ivdata);
70 bool setIVbytes(ivData &ivdata);
71 void clearIV();
72 bool Decrypt(encryptedData &encdata, String &rtn);
73 inline bool Decrypt(encryptedData *encdata, String &rtn) {return Decrypt(*encdata,rtn);}
74 bool Encrypt(String datatoEncrypt,encryptedData **);
75private:
76 bool buildKeyForAESEncryptOrDecrypt(bool shouldEncrypt = true);
77};
78
bool setKeyaccess(pass2Key *keyholder)
bool Encrypt(String datatoEncrypt, encryptedData **)
bool Decrypt(encryptedData &encdata, String &rtn)
bool Decrypt(encryptedData *encdata, String &rtn)
bool setIVbytes(ivData &ivdata)
bool getIVbytes(ivData &ivdata)
Create suitable keys for key generation (the masterkey) and encryption/decryption (newkey).
Definition pbkdf2.h:31
#define AES128IVSIZE
#define AES128BYTES
variable size encrypted data
IV data for AES128 is 12 bytes.