Azure / azure-iot-arduino

Azure IoT library for the Arduino
Other
168 stars 95 forks source link

Trusted certs option not supported #91

Closed PavelVe closed 4 years ago

PavelVe commented 5 years ago

Device: ESP8266 Arduino example: simplesample_mqtt

In this example is: `#ifdef SET_TRUSTED_CERT_IN_SAMPLES // For mbed add the certificate information if (IoTHubClient_LL_SetOption(iotHubClientHandle, OPTION_TRUSTED_CERT, certificates) != IOTHUB_CLIENT_OK) { (void)printf("failure to set option \"TrustedCerts\"\r\n"); }

endif // SET_TRUSTED_CERT_IN_SAMPLES`

I add #define SET_TRUSTED_CERT_IN_SAMPLES The code is compiled and uploaded. But the response from ESP is:

Trusted certs option not supported

Is it bug or reality?

I would like to use x.509 certificates to connect to Azure, but I am not successful in the Arduino environment. Azure simulator with C code works.

ripenko commented 5 years ago

I have the same issue.

Fetched NTP epoch time is: Tue Jul 30 08:55:12 2019
.
failure to set option "tlsVersionResult": 1
failure to set option "TrustedCerts": 1
28°C / 62%
Sending message: {"temperature":28,"humidity":62}.
IoTHubClient accepted the message for delivery.
Connection Status: NOT_AUTHENTICATED [NO_NETWORK]
Connection Status: NOT_AUTHENTICATED [NO_NETWORK]
27°C / 61%
Sending message: {"temperature":27,"humidity":61}.
IoTHubClient accepted the message for delivery.
Connection Status: NOT_AUTHENTICATED [NO_NETWORK]
Connection Status: NOT_AUTHENTICATED [NO_NETWORK]
Failed tlsio_options_set
unable to IoTHubTransport_SetOption
failure to set option "tls_version": 1
Trusted certs option not supported
Failed tlsio_options_set
unable to IoTHubTransport_SetOption
failure to set option "TrustedCerts": 1
28°C / 50%
Sending message: {"temperature":28,"humidity":50}.
IoTHubClient accepted the message for delivery.
Error opening socket
Connection Status: NOT_AUTHENTICATED [NO_NETWORK]
Connection Status: NOT_AUTHENTICATED [NO_NETWORK]
jbobotek commented 4 years ago

Have you tried with the new sample?

PavelVe commented 4 years ago

I updated all libraries to the last version, but still not work. I got error and than Core 1 panic'ed (StoreProhibited)

Error: Time:Thu Feb 20 09:02:34 2020 File:/Users/pavelve/Documents/ArduinoESP32/libraries/ESP32_AzureIoT/src/az_iot/iothub_client/src/iothubtransport_mqtt_common.c Func:mqtt_operation_complete_callback Line:1234 Connection Not Accepted: 0x5: Not Authorized

jbobotek commented 4 years ago

Looks like we do not have a x509 implementation for the ESP32/mbedtls. We also have no current plans to add one. If you would like to spin one up yourself, this openssl implementation may help.