Azure IoT Hub Certificate

Internet of Things IoT Frameworks 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_x000D_ _x000D_ I'm trying to publish some data on the Azure IoT hub using Mqtt. I've succesfully published some data, using a SAS token. But my customer wants a x509 self generated & self signed certificate. Azure is supporting this, but doesn't give much information about it. (https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-security#supported-x509-certificates) A self-generated and self-signed X-509 certificate. A device manufacturer or in-house deployer can generate these certificates and store the corresponding private key (and certificate) on the device. You can use tools such as OpenSSL and Windows SelfSignedCertificate utility for this purpose. Note IoT Hub does not require or store the entire X.509 certificate, only the thumbprint. What I've done is created a CA certificate and key. $openssl req -newkey rsa:2048 -x509 -nodes -sha256 -days 365 -extensions v3_ca -keyout ca.key -out ca.crt Created a client key and signing request $openssl genrsa -out client.key 2048 $openssl req -new -sha256 -out client.csr -key client.key Signed the request and created the certificate $openssl x509 -req -sha256 -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -CAserial ca.srl -out client.crt -days 365 I've uploaded the client key and certificate to the modem. And inserted the thumbprint of the client certificate. My modem can succesfully connect to myhub.azure-devices.net/deviceId (port 8883) But when new data arrives it can't decode it. I'm kinda stuck from this point on. I've tried to use MqttFx, but with no luck. Can someone push me into the right direction here?

Posted on 16 Aug 2022, this text provides information on IoT Frameworks related to Internet of Things. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago
_x000D_ For those of you wanting to use the Azure IoT C# SDK, I've created a C#-based code sample that shows you how to associate OpenSSL self-signed and self-generated X509 certs with a device registered in Azure IoT Hub, and then use the certs (primary or secondary) in subsequent runtime operations - specifically sending a telemetry message. You can choose to use either MQTT or HTTPS as your transport layer. https://github.com/tamhinsf/SimpleAzureIoTCerts/

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Important Internet of Things Links