Can get root CA

This commit is contained in:
2024-08-18 19:42:40 +02:00
parent 3b6e79e5e4
commit a6b283d023
6 changed files with 66 additions and 3 deletions

View File

@ -67,6 +67,25 @@ void app_main(void)
ESP_LOGI(TAG, "Current secure origin: %s", sec_ori);
free(sec_ori);
ESP_LOGI(TAG, "Check root CA");
if (storage_get_root_ca(NULL) == 0)
{
char *root_ca = unsecure_api_get_root_ca();
if (!root_ca)
{
ESP_LOGE(TAG, "Failed to fetch root CA!");
reboot();
}
storage_set_root_ca(root_ca);
free(root_ca);
}
ESP_LOGI(TAG, "Get root CA");
char *root_ca = calloc(ROOT_CA_MAX_BYTES, 1);
assert(storage_get_root_ca(root_ca) > 0);
ESP_LOGI(TAG, "Current root CA:\n%s", root_ca);
free(root_ca);
system_sleep(120);
reboot();