This topic provides sample signature code to help you develop your device. This way, your device can communicate with IoT Platform over MQTT without the need to use the device SDK provided by IoT Platform.

Usage notes

We recommend that you use the device SDK provided by IoT Platform. Alibaba Cloud IoT Platform provides device SDKs for multiple programming languages. If you use a device SDK, you do not need to configure your own signature mechanism. For more information, see What is Link SDK?

If you use a different method to connect your devices to IoT Platform, take note of the following items:

  • You must ensure connection stability and maintain the keepalive and reconnection mechanisms for MQTT connections.
  • If you do not use the device SDK provided by IoT Platform, Alibaba Cloud cannot provide technical support for connection issues.
  • If you want to use IoT Platform features, such as over-the-air (OTA) updates, Thing Specification Language (TSL) models, and unique-certificate-per-product authentication, you must compile your own code to implement these features. In this case, you have to spend a long time on development and troubleshooting.

Sample code for signature calculation

If you do not use the device SDK provided by IoT Platform, you can connect your device to IoT Platform by using an open source Paho MQTT library. The following table describes the sample code and signature algorithm files for different programming languages.

For information about how to use the sample code and parameters, see the related documentation.

Programming language Sample code Signature algorithm file
Java aiot-java-demo MqttSign.java
C# aiot-csharp-demo MqttSign.cs
C aiot_c_demo aiot_mqtt_sign.c
Go aiot-go-demo MqttSign.go
Android aiot-android-demo AiotMqttOption.java
Python aiot-python-demo MqttSign.py