1

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.

4
  • You're confusing WiFi access and a secure connection to a remote server. WiFiClientSecure is for the latter (such as https://) not the former. You only want to use WiFiClientSecure if the remote server you are connecting to uses SSL or TLS. You haven't got that far, so remove WiFiClientSecure from your mind completely.
    – Majenko
    Apr 17, 2019 at 12:30
  • @Majenko thank you for the tip. My goal is to connect to get WiFi access. But the WiFi access needs a certificate. There is no username or password. I only know the SSID of the WLAN and have a x.509 certificate. Apr 17, 2019 at 12:35
  • @Roboticsnerd, you could publish here as answer the solution based on Majenko's answer, if it works?
    – Juraj
    Apr 17, 2019 at 13:20
  • @Juraj I am working on it. Will publish if it works for me. Apr 17, 2019 at 14:59

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.