How do I generate a validation certificate from a purchased certificate (proof of possession)

Michael Giger 26 Reputation points
2020-11-16T06:40:35.937+00:00

Hi

I was able to successfully create a self-signed certificate (using https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-security-x509-get-started).
Now I have bought a certificate from a root certificate authority (CA).
How must I sign the verification code from Azure IoT Hub with the private key associate with my purchased X.509 CA certificate?

Thanks for the clarification!
Michael

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,272 questions
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. Michael Giger 26 Reputation points
    2020-11-28T08:18:45.87+00:00

    With the following steps I was able to create and validate a self-signed certificate.

    Step 1. Generate 3 year X509 CA certificate with private key, see also: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-security-x509-get-started#register-x509-ca-certificates-to-your-iot-hub

    openssl req -x509 -newkey rsa:4096 -days 1095 -keyout ca-key.pem -nodes -out ca-cert.pem

    Country Name (2 letter code) [AU]:<your country>
    State or Province Name (full name) [Some-State]:<your state>
    Locality Name (eg, city) []:<your city>
    Organization Name (eg, company) [Internet Widgits Pty Ltd]:<your organisation name>
    Organizational Unit Name (eg, section) []:
    Common Name (e.g. server FQDN or YOUR name) []:<e.g.Root CA>
    Email Address []:<your e-mail address>

    Step 2. Upload ca-cert.pem to Azure (IoT Hub)
    Step 3. Generate verification code in Azure
    Step 4. Generate verification key

    openssl genrsa -out verification.key 2048

    Step 5. Generate verification certificate request

    openssl req -new -key verification.key -out verification.csr

    The same information as above, except the common name must be the verification code from Azure IoT Hub!

    Step 6. Generate proof of possession certificate

    openssl x509 -req -in verification.csr -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out verificationCert.pem -days 1095 -sha256

    Step 7. Upload verificationCert.pem to Azure (IoT Hub) and validate

    Step 8. Generate device key

    openssl genrsa -out <deviceID>-private.pem 2048

    Replace <deviceID> with the device name from Azure IoT Hub, see also: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-security-x509-get-started#create-an-x509-device-for-your-iot-hub

    Step 9. Generate device certificate request

    openssl req -new -key <deviceID>-private.pem -out <deviceID>.csr

    The same information as above, except the common name must be the device name from Azure IoT Hub!

    Step 10. Generate public certificate

    openssl pkcs12 -export -in <deviceID>-public.pem -inkey <deviceID>-private.pem -out <deviceID>.pfx

    I hope it helps others...
    Michael

    2 people found this answer helpful.

  2. António Sérgio Azevedo 7,671 Reputation points Microsoft Employee Moderator
    2020-11-16T16:15:48.243+00:00

    Welcome to Microsoft Q&A @Michael Giger ,

    The fact that you bought a certificate from root certificate authoriy doesn't mean that you won't be able to sign it. You would upload the intermediate certificate (sold to you by the CA) and verify that. In your IoTHub, devices' x509 certs will be generated by the indermediate certificate and able to connect to IoTHub.

    See: Sign Devices into a Certificate Chain of Trust

    • You will possess and be able to verify the intermediate Cert. If you trusted the CA, any device belonging to the CA could connect to your IoTHub, which I believe is not what you are trying to achieve?
      39996-image.png

    See also: Purchasing an X.509 CA certificate

    40083-image.png

    Hope I could answer your great question :).

    Remember:

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.

  3. Daniel Maxwell 11 Reputation points
    2021-01-13T02:49:48.917+00:00

    I have the same question and can see that it is NOT being answered in several forums.

    The typical answer does not address how to prove possession of a purchase certificate, not a self-signed CA Root certificate from Comodo or Sectigo etc.

    Do we need to purchase a new X.509 certificate using a custom CSR to go through the proof of possession process?

    Where in the world is there a step by step process or example or video on how to provide proof of possession for a certificate that I did not self sign, that I purchased from a trusted root CA? Where?

    The section titled: "GET X-509 CA Certificates" in particular is severely lacking in detail: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-security-x509-get-started#get-x509-ca-certificates


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.