corrupted NVS key partition

jettyjett
Posts: 4
Joined: Fri Aug 14, 2020 1:23 pm

corrupted NVS key partition

Postby jettyjett » Mon Aug 17, 2020 1:19 pm

I created a custom encrypted NVS partition and I tried programmatically to access it and read its data, but I got the following error

Code: Select all

ESP_ERR_NVS_CORRUPT_KEY_PART
when executing the following code snippet:

Code: Select all

    // find partition with nvs_keys
    const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
                                                                ESP_PARTITION_SUBTYPE_DATA_NVS_KEYS,
                                                                KEYS_PARTITION_LABEL);

    if (partition == NULL)
    {
        printf("Could not locate nvs_key partition. Aborting.");
    }

    // read nvs_keys from key partition
    nvs_sec_cfg_t cfg;
    esp_err_t err = nvs_flash_read_security_cfg(partition, &cfg);
    if (err != ESP_OK)
    {
        printf("Failed to read nvs keys. Error: %s", esp_err_to_name(err));
    }
the

Code: Select all

nvs_flash_read_security_cfg()
is the function in question that throws the error.
here's how my partition table looks like:

Code: Select all

# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0xa000,24K,
nvs_private,data,nvs,0x10000,12K,
private_keys,data,nvs_keys,0x13000,4K,
phy_init,data,phy,0x14000,4K,
factory,app,factory,0x20000,1M,
I can't seem to find the problem or how my partition is corrupted. Any information is much appreciated

Who is online

Users browsing this forum: Baldhead and 85 guests