Can get root CA
This commit is contained in:
		@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user