DEV Community

Discussion on: How to encrypt the NVS volume on the ESP32

Collapse
 
achrafboussaada profile image
Achraf Boussaada

So I tried to create a custom nvs partition and write data to it and flash it to the chip and then programmatically initialize it and read data from it. That worked fine.
Now with the esptool.py I tried to encrypt the partition generate its keys and flash it to the chip. Following the documentation (docs.espressif.com/projects/esp-id...) and your post I tried to read data from the encrypted partition. The problem I'm having is that the data I flashed seems not be found. I used nvs_get_stats() to get Infos about the entries of the new partition but I always get entries count is 1. This didn't happen before when I tried it with the unencrypted partition. Also, intialilizing and openening the encrypted partition without nvs_flash_secure_init_partition() gives me the same result and doesn't through an error about encryption keys needed or something.

Collapse
 
achrafboussaada profile image
Achraf Boussaada

After further inverstigation nvs_flash_read_security_cfg() is giving me ESP_ERR_NVS_CORRUPT_KEY_PART