I have an ESP32 and want to connect it to the WLAN at my office. Based on my current knowledge of the Arduino, we use the WiFiClass
to connect to a WLAN and then use a WiFiClient
to use the WiFi for data transfer.
In order to connect to the WLAN at my office, a certificate is needed. I have asked the network guys to issue a x.509 certificate and plan to use the WiFiSecureClient
class.
The problem is that my WiFi.begin(ssid)
method never leaves the following while
loop:
Wifi.begin(ssid); // my office needs a certificate to connect to the wifi at the first place
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Note that to connect to my office network, no password is needed. The x.509 certificate is enough for the connection to establish.
Only after a WiFi connection is established, I can set the WiFiSecureClient
parameters of the CA. But to connect to the WiFi, I need the certificate.
This is very confusing. Could someone please clarify a way our for me in this situation.
1 Answer 1
The Arduino API for ESP32 does not support your desired configuration.
The ESP32 is capable, but there is no easy "Arduino" interface to configure it.
Instead you will have to directly interface with the ESP32 SDK and configure things manually. That won't be easy.
This example code shows you how it can be done - however that code is not designed to run in the Arduino environment, so you will first need to understand exactly what it is doing and then adapt it to suit.
WiFiClientSecure
is for the latter (such ashttps://
) not the former. You only want to useWiFiClientSecure
if the remote server you are connecting to uses SSL or TLS. You haven't got that far, so removeWiFiClientSecure
from your mind completely.