I am able to successfully connect with a python example to my created IoT Edge. However, the same configuration does not work for my actual downstream device (ESP8266).
Downstream device (ESP8266) Configuration
I am using the following example for the ESP8266: https://github.com/Azure/azure-iot-arduino/tree/master/examples/esp8266/iothub_ll_telemetry_sample
Added the certificate and connection string in the code:
// DEVICE_CONNECTION_STRING
HostName=iot-edge.leister;DeviceId=wemosd1mini;SharedAccessKey=XXXXXXXXX=
// CERTIFICATE
// same certificate as in python example (content of file azure-iot-test-only.root.ca.cert.pem)
static const char edgeCert [] =
"-----BEGIN CERTIFICATE-----\r\n"
...
"-----END CERTIFICATE-----\r\n";
IoTHubDeviceClient_LL_SetOption(device_ll_handle, OPTION_TRUSTED_CERT, edgeCert);
Edge Device Configuration
I configured a raspberry pi according to the documentation on (with demo certificates as mentioned in the article) https://docs.microsoft.com/en-us/azure/iot-edge/how-to-create-transparent-gateway?view=iotedge-2018-06
I can successfully verify the certificate with the command openssl s_client -connect iot-edge.leister:8883 -CAfile "C:\Users\micha\Desktop\azure-iot-test-only.root.ca.cert.pem" -showcerts
Results in: Verify return code: 0 (ok)
ESP8266 Logs
Creating IoTHub Device handle...
Sending message 1 to IoTHub...
dowork TLSIO_STATE_OPENING_WAITING_SOCKET
dowork TLSIO_STATE_OPENING_WAITING_SSL
Error opening socket 0
Calling error callback
The device client has been disconnected
Error: failure opening connection to endpoint
I am not able to connect with the same configuration to my IoT Edge with the ESP8266 as downstream device.
More details can be found here: https://github.com/Azure/azure-iot-sdk-c/issues/1902