Creating the Baltimore Root Certificate File

This page describes how to obtain the DigiCert Baltimore Root certificate required for secure communication with Azure IoT Hub via the Cloud Sink object.

Right-click the following link and select 'Save link as' to download certs.c from the Azure IoT SDK for C.

This file contains hardcoded certificate data used for application development. To create a valid certificate, we need to extract certificate data and create a certificate file in a correct way.

Automatic Certificate Creation

Since the instruction given by Microsoft on how to obtain a DigiCert Baltimore Root certificate is very convoluted, there is a help script available as a part of esi-cloud-interface-initializer.lua library, which is available as a part of the system. In order to get the necessary certificate:

  1. Open a new Console tab in WebStudio.

  2. Run the following lua command:

    local path_to_c_file = "C:\\Jumpstart\\certs.c" -- path to certs.c file
    return require("esi-cloud-interface-initializer"):CERT(path_to_c_file)

An output like File [C:\Jumpstart\certs.cer] created indicates successful certificacte generation.

Manual Certificate Creation

As an alternative to the Automatic Certificate Creation addressed above, this certificate file can also be created manually. To do so:

  • use the certs.c file as the starting point.

  • remove all C-related code

  • add the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- lines

  • remove the " marks at the beginning and end of every line

  • remove the \r\n characters at the end of every line

  • change the file extension from .c to .cer