0
votes

I can't find any instructions on how to connect an IoT device to IoT Hub using X.509 CA cert with C SDK. There is a sample for C# SDK at https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-security-x509-get-started#register-x509-ca-certificates-to-your-iot-hub. The closest I can get for C-SDK is this API https://docs.microsoft.com/en-us/azure/iot-hub/iot-c-sdk-ref/iothub-device-client-h/iothubdeviceclient-createfromdeviceauth, but it didn't provide any doc on how to use it.

There is a sample code in https://github.com/Azure/azure-iot-sdk-c/tree/a698fa3fe9379b7a51a466e0a6b1fe5042db29c5/provisioning_client/samples/iothub_client_sample_hsm which seems imply on how to use this. But function call to IoTHubDeviceClient_CreateFromDeviceAuth() been comments out.

My goal is the to be able to connect downstream device to IoT Hub using X.509, with Edge been configured as transparent gateway. Since DPS provision to downstream device is not currently supported. downstream device can only connect to IoT Hub either using symmetric key, X.509 self-signed or X5.09 CA signed cert. Symmetric key or X.509 self signed is not an option as it require per device connection string which we are not able to provide in our IoT Device binary. X.509 CA signed cert approach seems works as all our device can preload with the cert, but I can't find any document how to archive this.

1

1 Answers

0
votes

From the IoT hub side the language your device is using is irrelevant. Set it up as it suggests and then refer to this sample: https://github.com/Azure/azure-iot-sdk-c/blob/master/iothub_client/samples/iothub_ll_client_x509_sample/iothub_ll_client_x509_sample.c for an X.509 C client.