0
votes

So, in the first place I have connected a DHT11 (temperature sensor) to my RPi (Raspberry Pi) then, in my azure portal I have created an IOT Hub and registered a Virtual device identity in the hub, while creating this (for the first time) I have selected the symmetric keys option as mentioned in the Azure IoT Hub tutorial documentation and then i have written a python script to be executed on my RPI which captures the temp reading and sends it to my iot hub.

Now to understand the security aspects of iot hub, i am trying to exactly replicate the above functionality (sending temp reading to iot hub) but this time using X.509 authentication method.

as of now i have followed this link and generated a certificate and uploaded it to the azure iot hub and verified it as well OPENSSL - How to generate a proof of possesion for a X509 certificate?

now when i am trying to send the sensor data (DHT11) to the iot device registered in my iot hub it shows device not authorized

i don't understand how to authorize/authenticate a device with the certificate.

i feel i should copy over the certificate onto my raspberry pi and somehow make changes in the code that i am using to send temp data to the iot hub to intimate the iot hub that this device has already got a certificate (valid one)

i don't know how to do this...can somebody please help me out....i want to do this using python

1

1 Answers

0
votes

There is a Python X.509 authentication sample here https://github.com/Azure/azure-iot-sdk-python-preview/blob/master/azure-iot-device/samples/advanced-hub-scenarios/send_message_x509.py

This is using the replacement Python SDK which is still in preview but it should still work.

You will need to create a certificate and private key and sign it with the certificate that you have verified on your IoT hub. This process is explained here: https://github.com/Azure/azure-iot-sdk-c/blob/master/tools/CACertificates/CACertificateOverview.md.