Closed Mikolaj-AND closed 4 months ago
We don't officially support firmware encryption in Arduino. Everything you see is community developed and supported. As a way to move forward, I'll suggest you look into IDF's examples and replace Update
with that.
Thanks. Current workaround is to just use example from Update
library https://github.com/espressif/arduino-esp32/tree/master/libraries/Update/examples/HTTP_Server_AES_OTA_Update
and set const uint32_t OTA_MODE = U_AES_DECRYPT_ON;
Of course the example does not make use of the ESP's encryption key and uses it's own predefined key instead.
Board
ESP32-WROOM-32
Device Description
ESP32-WROOM-32 DevkitC
Hardware Configuration
Bare board powered by USB cable
Version
latest master (checkout manually)
IDE Name
Arduino IDE 2.3.2
Operating System
Windows 10
Flash frequency
80MHz
PSRAM enabled
no
Upload speed
115200
Description
I've generated flash encryption key: _espefuse.py generate_flash_encryption_key flash_encryptionkey.bin
Then burned it with required efuses.
Flashed pre-encrypted bootloader and partition table
Then generated binary with OTA capability. Uploaded the .bin file at address 0x10000 with esptool.py.
OTA works fine with not-encrypted .bin from Arduino IDE. But after encrypting the file with _espsecure.py encrypt_flashdata, I'm getting multiple "Decryption error" messages on COM port during OTA process. The encrypted file is correct, as I've decrypted it back to a regular .bin file using _espsecure.py decrypt_flashdata and it's the same as original .bin file.
Encryption is enabled, as I'm getting "Serial.println("Encryption Enabled");" printed on setup.
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide