DEV Community

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

Collapse
 
achrafboussaada profile image
Achraf Boussaada

when you're flashing the nvs_keys.bin you gave 0x320000 as a location address. How did you determine that?

Collapse
 
kkentzo profile image
Kyriakos Kentzoglanakis

The address of a particular partition can be discovered either by inspecting the esp32 serial output (where the partitions are printed out) or by applying the esp-idf's gen_esp32part.py utility on the project's partition image (e.g. gen_esp32part.py build/partition_table/partition-table.bin)

Collapse
 
achrafboussaada profile image
Achraf Boussaada

Thanks for the reply. I just realised that you need to create another partition to store the keys, and the partition should be flaged as encrypted. I'm sorry if this seems obvious, but I'm new to this, is there no security risk doing this?

Thread Thread
 
kkentzo profile image
Kyriakos Kentzoglanakis

The partition that stores the encryption keys for the nvs partition is itself encrypted by the device (handled by the bootloader -- more info here. The reason for the existence of the keys partition is that the esp32 does not (yet?) handle the encryption of an nvs partition transparently, so we have to do it ourselves.

Thread Thread
 
achrafboussaada profile image
Achraf Boussaada

Thanks. Final question about the keys partition. According to the documentation the partition needs to have a encrypted flag. Did you add it manually when creating the partition from the CSV file?