load root CA from SPIFFS and pass to WiFiClientSecure
Posted: Mon Oct 01, 2018 8:20 am
Hi all,
Im still a newbie and Im trying no move working code I wrote for the ESP8266 to the ESP32 but its not working.
I have a root certificate that I have stored in SPIFFS and I want to pass it to WifiClientSecure. On the ESP8266 I do it this way (which works):
My first problem was that loadCACert() isnt supported by WiFiClientSecure on the ESP32 so I changed it to setCACert(). The problem I have now is that when I pass the file into this method ( wifiClient.setCACert(ca);) i get the following error:
no suitable conversion function from "fs::File" to "const char *" exists
So my question is , how do I convert a File to a const char ??
Thanks
Kev
Im still a newbie and Im trying no move working code I wrote for the ESP8266 to the ESP32 but its not working.
I have a root certificate that I have stored in SPIFFS and I want to pass it to WifiClientSecure. On the ESP8266 I do it this way (which works):
Code: Select all
// Load CA file from SPIFFS
File ca = SPIFFS.open("/site.cer", "r");
if (!ca) {
Serial.println("Failed to open ca ");
}
else
Serial.println("Success to open ca");
delay(1000);
// Set server CA file
if (wifiClient.loadCACert(ca))
Serial.println("ca loaded");
else
Serial.println("ca failed");
}
no suitable conversion function from "fs::File" to "const char *" exists
So my question is , how do I convert a File to a const char ??
Thanks
Kev