Rebuild flash encryption/decryption in software
Posted: Wed Dec 14, 2022 7:54 pm
hello,
is it possible to build the flash encryption in software with the given aes-library?
Background:
I would like to send a file encrypted with the existing function and decrypt it on the ESP32.
What have I configure to achieve that?
Following my testcode:
is it possible to build the flash encryption in software with the given aes-library?
Background:
I would like to send a file encrypted with the existing
Code: Select all
espsecure.py encrypt_flash_data
What have I configure to achieve that?
Following my testcode:
Code: Select all
#include <Arduino.h>
#include "mbedtls/aes.h"
mbedtls_aes_context aes;
unsigned char key[32] ={
0x12, 0xA1, 0x38, 0xEB, 0xF5, 0x01, 0xD7, 0x89, 0x4C, 0x98, 0x12, 0x4E, 0x47, 0x88, 0xE9, 0xB5,
0x79, 0x16, 0xF7, 0x7C, 0x82, 0x95, 0xBB, 0xD2, 0x14, 0x84, 0xE4, 0x38, 0xF4, 0x6C, 0x82, 0x9E
};
unsigned char iv[16]={0};
size_t iv_off=0;
unsigned char input [16]={"this is my test"};
unsigned char output[16];
size_t input_len = sizeof(input);
size_t output_len = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
esp_aes_init(&aes);
esp_aes_setkey( &aes, key, 256 );
esp_aes_crypt_ecb( &aes, ESP_AES_ENCRYPT, input, output );
Serial.println(String(output, 16));
}
void loop() {
}