Hi, I am trying to implement the AES-128 encryption/decryption of a string in an ESP32 and for this I am using the AESLib library, but when I compile it I get this error:
'AES128_CBC_encrypt_buffer' was not declared in this scope
Someone can tell me how to correct this?
Here is my code:
#include <AESLib.h>
// key and IV should be 16 bytes long
const byte key[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
const byte iv[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
String plaintext = "My message to be encrypted";
String ciphertext;
String decryptedtext;
void setup() {
Serial.begin(115200);
//encrypt the plaintext
Serial.println("Encrypting...");
AES128_CBC_encrypt_buffer(key, iv, (byte*)&plaintext[0], plaintext.length());
ciphertext = plaintext;
Serial.println("Ciphertext is: " + ciphertext);
//decrypt the ciphertext
Serial.println("Decrypting...");
AES128_CBC_decrypt_buffer(key, iv, (byte*)&ciphertext[0], ciphertext.length());
decryptedtext = ciphertext;
Serial.println("Decrypted text is: " + decryptedtext);
}
void loop() {
}