With Trust Onboard you will be able to use X.509 certificates that are on the SIM to authenticate your devices. In this guide, we will demonstrate how to use Trust Onboard features for your IoT solutions. Use this guide along with examples published to learn how to implement Trust Onboard.
The Twilio IoT Breakout SDK for Trust Onboard offers tools and examples on how to utilize the
Signing X.509 certificate available on Twilio IoT's Trust Onboard (ToB) enabled SIM cards. The SDK can be built as a static or dynamic library and linked to your executable. Trust Onboard SDK currently has only C bindings, which means you can use it with C and C++ applications, or in other languages using C FFI. The SDK can be built and installed with CMake. Follow the instructions published on the repository.
Get the SDK from Github.
Trust Onboard makes SIM certificates available to you so you can add them to your backend service in order to authenticate connections from your devices. There are couple of ways you can get SIM certificates as shown below.
If you have a home grown backend system, then you can download the SIM Certificates and add them to your backend system.
With Trust Onboard you can sync your SIM certificates directly with a cloud backend service like Microsoft Azure.
To begin using certificates on your IoT device, you need the Breakout SDK for Trust Onboard. If you haven't already done so, take a look at the Prerequisites section to download and set up the SDK on your IoT device.
Available Key certificates and the associated private key will be on the SIM card and can be read using the Breakout SDK. Your code will have access to the full text of the public and private keys and certificate. This is intended to be used with hardware that requires you to hand over this data for HTTPS communication. These live in a simple global platform applet that holds files with only read operations.
Signing Key certificates will be inside the SIM card with no way to export the text contents. You will utilize TLS libraries such as mBed that can request the SIM card to sign requests using the keys and perform request encryption. This is intended for use cases where your hardware allows you to offload the TLS communication to the SIM card. These live in a global platform applet called mIAS that implements a full security suite (similar to OpenSSL).
Most frequently you will want to use Trust Onboard to establish a TLS connection. With low-level API you can implement the bindings for your own TLS library. We at Twilio have already implemented OpenSSL, mbedTLS and wolfSSL bindings for you to use.
Please refer to the samples in Trust Onboard SDK for the detail of how to use these bindings. Below you can find short code excerpts demonstrating all the three use-cases. Error checking is omitted for brevity. On how to use OpenSSL, CURL, mbedTLS and WolfSSL, refer to the documentation of these specific libraries.
If all you want is to extract the TLS credentials and feed it to your application, you might not want to use the Trust Onboard library. For this use-case Trust Onboard SDK contains a command line tool called, unsurprisingly,
After building and installing the SDK, it can be used as
trust_onboard_tool --device /dev/ttyACM0 --baudrate 115200 --pin 0000 --available-cert ~/available.cert.pem --available-key ~/available.key.pem
Refer to the tool's help for more options.
Twilio Certificate bundle Twilio certificate bundles below contain the CA certificates used to sign the certificates on a Twilio SIM card. Use this bundle to upload to your backend services as needed.
Generation Two Trust Onboard SIMs (August 2019 onwards)
- Twilio Trust Onboard CA
- Twilio Trust Onboard Available key Intermediate certificate
- Twilio Trust Onboard Signing Intermediate certificate
Generation One Trust Onboard SIMs (Prior to August 2019) If your SIM has a label on it with the text "Certificates on this SIM are valid until December 2020".
Connecting to Azure IoT Hub involves two steps:
- Registering your device on Device Provisioning Service
- Sending and receiving messages to the IoT Hub itself.
You can refer to the temperature measurement sample in the Trust Onboard SDK for a comprehensive example of both, below you can find the short excerpts.
Note: at the time of writing Trust Onboard requires you to use Twilio's fork of Azure IoT SDK.
Registering to DPS is basically establishing a TLS connection to a globally know end-point. Based on what certificate you use, DPS will return you the IoT Hub URL to connect to, and your registered device ID.
The output of the registration process is a connection sting, that will be use to connect to the IoT Hub.
Note: your certificate should be pre-registered on the DPS. See the Broadband Kit documentation for detailed instructions.
The connection string retrieved during the DPS registration can then be used to talk to the IoT hub. Some set up still needs to be done though to use Trust Onboard for IoT Hub communication as well.
Note: refer to Azure IoT Hub documentation for how to send and receive messages. The sample will only show the set-up process.