We have been building an IoT device using ESP32 (ESP-IDF v 4.4) and the AWS IoT Core for Embedded port (esp-aws-iot) from here: https://github.com/espressif/esp-aws-iot
We were using version 202012.04-LTS and it was working OK. However, I would like to update to a newer version.
I have changed to version 202210.01-LTS and made some minor changes to get the build to work. However, the TLS connect won't load the AWS certificates anymore.
When the MQTT agent attempts to connect with TLS, I get:
Code: Select all
E (22409) esp-tls-mbedtls: mbedtls_x509_crt_parse returned -0x2180
E (22409) esp-tls-mbedtls: Failed to set client configurations, returned [0x8015] (ESP_ERR_MBEDTLS_X509_CRT_PARSE_FAILED)
E (22419) esp-tls: create_ssl_handle failed
E (22419) esp-tls: Failed to open new connection
I note that the NetworkContext_t struct has changed ("pem" removed from the names, and a size added for each certificate).
I am using the same certificate data as before. I just changed the name of the struct members, and added the sizes (as follows):
Code: Select all
l_network_context.pcClientKeySize = strlen(l_network_context.pcClientKey);
l_network_context.pcClientCertSize = strlen(l_network_context.pcClientCert);
l_network_context.pcServerRootCASize = strlen(l_network_context.pcServerRootCA);
Does the TLS connect function no longer support PEM format certificates? What else could cause this error?