MQTT链接阿里云

MQTT链接阿里云

1.创建产品及设备,

image-20210319144840789

产生三元组

三元组

{ "ProductKey": 标示产品
  "DeviceName": 标识设备
  "DeviceSecret":密钥
  
  "ProductKey": "a1pC3rpU4xF",
  "DeviceName": "Lock_1",
  "DeviceSecret": "cba236e94094a0399060a9fe355bef88"
}

访问远程主机的域名格式

   ${YourProductKey}.iot-as-mqtt.${YourRegionId}.aliyuncs.com:1883


即 IP地址

​    a1pC3rpU4xF.iot-as-mqtt.cn-shanghai.aliyuncs.com

mqttClientId 格式:

clientId(DeviceName)+"|securemode=3,signmethod=hmacsha1,timestamp=132323232|"
		securemode=3,TCP直连
Lock_1|securemode=3,signmethod=hmacsha1|

mqttUsername 格式: deviceName(DeviceName)+"&"+productKey

	Lock_1&a1pC3rpU4xF

mqttPassword 格式: sign_hmac(deviceSecret,content)

哈希算法(A,B)
A  要加密的字符串  content
	clientId*deviceName*productKey#
	*->DeviceName
	#->ProductKey
	  
	  clientIdLock_1deviceNameLock_1productKeya1pC3rpU4xF
	  
B  密钥  DeviceSecret
     
cba236e94094a0399060a9fe355bef88
bc5f3a9e47c628ed91c74054bc33a1bd9ff25a7c
/Topic 报文/

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值