As the title states, I'm having difficulties connecting my Mosquitto MQTT client (written in C) to my Azure IoT-hub. I've managed to connect to many different platforms before (e.g. Amazon EC2, ThingsBoard, TheThings.io, SierraWireless, ...), so I know my client is pretty solid.
The difficulty here is the fact that I need some sort of certificate to be allowed to connect, and I'm not sure what I need to do this.
I have added the following configuration in order to get this working:
mosquitto_opts_set(client, MOSQ_OPT_PROTOCOL_VERSION, "MQTT_PROTOCOL_V311");
mosquitto_tls_set(client, "/home/ca-certificates.crt", NULL, NULL, NULL, NULL);
mosquitto_tls_insecure_set(client, 1);
mosquitto_tls_opts_set(client, 0, "tlsv1", NULL);
mosquitto_username_pw_set(client, "hubname.azure-devices.net/deviceName", "SharedAccessSignature=SharedAccessSignature sr=hubname.azure-devices.net%2Fdevices%2FdeviceName&sig=sigValue&se=1553087157");
In the code above, "hubname", "deviceName" and "sigValue" are of course replaced with real values in my code.
Can any of you point me to what I'm doing wrong, or what other configuration steps I need to take?