本文讲解如何使用ID²安全芯片对设备进行认证的方式完成软件的开发。
前提条件
设备的硬件,需要继承ID²安全芯片。- 登录物联网平台控制台。
- 左侧导航选择
- 配置SDK,详情请参见SDK获取及使用说明链接。 其中,设备认证方案必须选择ID²。详情请参见下图:
说明 IoT设备身份认证ID²(Internet Device ID):是一种物联网设备的可信身份标识,具备不可篡改、不可伪造、全球唯一的安全属性。
SE驱动适配
设备厂商选择某款SE芯片之后,需要适配该芯片的驱动接口:
函数 | 说明 |
---|---|
irot_result_tse_open_session(void**handle) | 该函数用于对SE进行初始化,打开SE芯片电源。 |
irot_result_tse_transmit(void*handle,constuint8_t*cmd_apdu,constuint32_tcmd_len,uint8_t*rsp_buf,uint32_t*rsp_len) | 该函数用于发送apdu指令,并获取response。 |
irot_result_tse_close_session(void*handle) | 关闭SE芯片电源。 |
注意 设备厂商在购买ID²安全芯片时,请联系IoT安全团队提供相应安全芯片的驱动适配代码。
ID²的使用
设备仍然使用MQTT连接物联网平台,连接云端的代码参见MQTT接入与数据通信,在连接平台时如果失败,会输出如下所示的告警信息:
<LS_LOG> mbedtls_ssl_handle_message_type 4194: got an alert message, type: [2:172]
其中上面的 172 是 消息警告类型,iTLS常见的消息警告类型如下:
说明 轻量安全连接协议(iTLS):基于ID²进行双向身份认证,提供与标准TLS相同的安全能力,同时减少协议对设备和网络的依赖,满足物联网(IoT)对连接安全的需求。
状态码 | 消息警告类型 |
---|---|
0 | Peer close notify |
10 | Unexpected message |
20 | Bad record mac |
50 | Decode error |
51 | Decryption error |
110 | Unsupported extension |
160 | ID 2 generic error |
161 | ID 2 no quota |
162 | ID 2 is not exist |
163 | ID 2 authcode is invalid |
164 | ID 2 has not been activated |
165 | The timestamp used in authcode is expired |
166 | ID 2 challenge is invalid |
167 | Not support this operation |
168 | ID 2 has been suspended |
169 | ID 2 has been discarded |
170 | Permission denied, id2 has been blinded to other product key |
171 | Product key is invalid |
172 | Product key is not exist |
173 | ID 2 server is busy |
174 | The device fingerprint is invalid |
175 | The device fingerprint is duplicated |
176 | ID 2 server random is invalid |
177 | Hash type used in authcode generated is invalid |
178 | ID 2 key type is invalid |
在文档使用中是否遇到以下问题
更多建议
匿名提交