title: How to authenticate a device (R-Pi say to be connected to Azure IoT Hub) using X.509 certificate
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>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 
  <a href="https://stackoverflow.com/questions/50337042/openssl-how-to-generate-a-proof-of-possesion-for-a-x509-certificate">OPENSSL - How to generate a proof of possesion for a X509 certificate?</a></p>
  
  <p>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</p>
  
  <p>i don't understand how to authorize/authenticate a device with the certificate.</p>
  
  <p>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) </p>
  
  <p>i don't know how to do this...can somebody please help me out....i want to do this using python</p>