In what format are you supposed to supply the certificates (and keys) in the WifiClientSecure module? NO examples exist, or documentation of it's usage.
I am following the Arduino (ESP32) WiFiClientSecure example code - and trying to connect while specifying a CA Certificate, such as:
client.connect(server, 443, test_ca_cert, test_client_cert, test_client_key)
(test_client_cert
and test_client_key
are NULL pointers). If test_ca_cert
is a NULL pointer, the SSL connection is fine.
If I try to specify my own test_ca_cert
, I always get:
CA cert: mbedtls_x509_crt_parse returned -0x2180
(which is an error code for "invalid format")
I have tried a multitude of things for the test_ca_cert
such as a string with the PEM formatted (cleartext) base64 encoded certificate, and a byte array of the DER formatted certificates. Nothing seems to work.
What is the format in which this certificate should be specified?