You do not need to generate certificate yourself. Already generated and signegned certificate is stored in your device. Certficaite is signed by Azure Sphere Tenant CA. For using this certificate as authentication method to IoT Hub call iothub_security_init from azure_prov_client/iothub_security_factory.h and then IoTHubDeviceClient_LL_CreateWithAzureSphereFromDeviceAuth for creating IoT Hub client. In IoT Hub you must register your device with device name set to DeviceId. You must also add certificate of your Azure Sphere tenant to IoT Hub for allowing IoT Hub to trust your devices. How to do that is described in https://learn.microsoft.com/en-us/azure-sphere/app-development/setup-iot-hub . DeviceId, device name in IoT Hub and CN of authentication certificate must match.
Azure Sphere Authentication Certificate CN == Deice ID?
@Imran Bhadelia and I have a question about the Azure Sphere Authentication Certificate. This would be the short lived (client certificate that can be presented to any online service )X.509 certificate pushed to the device once it passes the DAA step. The documentation here, specifies that the certificate CN is set to the device's device ID. However CN is limited to 64 characters and the Azure Sphere device ID is >128 characters long.
What is CN set to for the Azure Sphere Authentication x.509 Certificate?
Thanks!
Azure Sphere
5 answers
Sort by: Most helpful
-
Michal Žůrek 136 Reputation points
2021-05-20T20:05:59.253+00:00 -
Imran Bhadelia 21 Reputation points
2021-05-24T14:08:36.873+00:00 Hello @Michal Žůrek
CN of authentication certificate have limitation of 64 char, now Sphere device is is 128 char long. Means Deviceid and CN name are going to be differ, so how authentication will work?
Imran
-
matsujirushi 636 Reputation points MVP2021-05-30T05:37:41.917+00:00 You can look client certificate using Wireshark.
Which did you want to look the field?
-
Imran Bhadelia 21 Reputation points
2021-06-01T10:27:15.22+00:00 Subject field. This have CN
-
Imran Bhadelia 21 Reputation points
2021-06-03T20:19:07.227+00:00 As per this link CN name only allow s64 char long and with case of Sphere its 128, wondering as we asked CA Authority to generate device leave certificate having deivceid of 100 char. but due to CN name validation it was failed during leaf certificate generation