An X.509 certificate is a digital certificate that is used to authenticate a communication entity. For devices that use the MQTT protocol, you can configure Link SDK for C and use X.509 certificates to connect the devices with IoT Platform.
Prerequisites
-
When you customize an SDK, set Device authentication scheme to X.509 certificate on the SDK customization page.
- A development environment is prepared.
Process
The process of establishing an X.509 certificate-based MQTT connection is the same as the process of establishing an MQTT connection. You only need to additionally specify the certificate information. The application program calls the API operations of Link SDK for C to connect with IoT Platform over MQTT.
The following figure shows the process. In this example, the ./demos/mqtt_x509_auth_demo.c application program is used.
For more information about MQTT connection-specific API operations, see aiot_mqtt_api.h.
Usage notes
- X.509 certificates are only applicable to devices that are directly connected to IoT Platform based on the MQTT protocol.
- X.509 certificates are supported only in the China (Shanghai) region.
- X.509 certificates are not applicable to products that use LoRaWAN as the network connection mode.
- After you specify an authentication mode for a device, you cannot modify the mode.
Examples
- For more information about examples, see Example.
- For more information about error codes, see Common error codes.