AWS IoT SDK-主要的L#206错误订阅:-28(C代码) [英] AWS IoT SDK - main L#206 Error subscribing : -28 (C code)
问题描述
我正在尝试在本教程来自AWS IoT(AWS IoT嵌入式C SDK).
I am trying to run the example in this tutorial from AWS IoT (AWS IoT Embedded C SDK).
我的aws_iot_config.h
文件具有以下配置:
My aws_iot_config.h
file has the following configuration:
#define AWS_IOT_MQTT_HOST "XXXXXXX.iot.us-east-2.amazonaws.com" ///< Customer specific MQTT HOST. The same will be used for Thing Shadow
#define AWS_IOT_MQTT_PORT 8883 ///< default port for MQTT/S
#define AWS_IOT_MQTT_CLIENT_ID "c-sdk-client-id" ///< MQTT client ID should be unique for every device
#define AWS_IOT_MY_THING_NAME "SM1" ///< Thing Name of the Shadow this device is associated with
#define AWS_IOT_ROOT_CA_FILENAME "iotRootCA.pem" ///< Root CA file name
#define AWS_IOT_CERTIFICATE_FILENAME "deviceCert.crt" ///< device signed certificate file name
#define AWS_IOT_PRIVATE_KEY_FILENAME "deviceCert.key" ///< Device private key filename
这是我的政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iot:Publish",
"Resource": "arn:aws:iot:us-east-2:338639570104:topic/sm1"
},
{
"Effect": "Allow",
"Action": "iot:Subscribe",
"Resource": "arn:aws:iot:us-east-2:338639570104:topic/sm1"
}
]
}
运行subscribe_publish_sample
示例时,出现以下错误:
When I run the subscribe_publish_sample
example, I am getting the following error:
调试:iot_tls_connect L#236正常
[协议是TLSv1.2]
[密码套件是TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384]
DEBUG: iot_tls_connect L#236 ok
[ Protocol is TLSv1.2 ]
[ Ciphersuite is TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384 ]
调试:iot_tls_connect L#238 [记录扩展为29]
DEBUG: iot_tls_connect L#238 [ Record expansion is 29 ]
调试:iot_tls_connect L#243.正在验证对等X.509证书...
调试:iot_tls_connect L#252好
DEBUG: iot_tls_connect L#243 . Verifying peer X.509 certificate...
DEBUG: iot_tls_connect L#252 ok
调试:iot_tls_connect L#262.对等证书信息...
DEBUG: iot_tls_connect L#262 . Peer certificate information ...
调试:iot_tls_connect L#264证书.版本:3
序列号:3C:75:FE:30:01:DD:A3:B9:EF:72:DC:F6:7A:5C:A2:54
发行者名称:C = US,O = Symantec Corporation,OU = Symantec Trust Network,CN = Symantec Class 3 ECC 256位SSL CA-G2
主题名称:C = US,ST =华盛顿,L =西雅图,O = Amazon.com,Inc.,CN = *.iot.us-east-2.amazonaws.com
发表于:2017-10-12 00:00:00
到期日期:2018-10-13 23:59:59
使用的:带有SHA256的ECDSA签名
EC密钥大小:256位
基本约束:CA = false
主题替代名称:iot.us-east-2.amazonaws.com,* .iot.us-east-2.amazonaws.com
密钥用法:数字签名
扩展密钥用法:TLS Web服务器身份验证,TLS Web客户端身份验证
DEBUG: iot_tls_connect L#264 cert. version : 3
serial number : 3C:75:FE:30:01:DD:A3:B9:EF:72:DC:F6:7A:5C:A2:54
issuer name : C=US, O=Symantec Corporation, OU=Symantec Trust Network, CN=Symantec Class 3 ECC 256 bit SSL CA - G2
subject name : C=US, ST=Washington, L=Seattle, O=Amazon.com, Inc., CN=*.iot.us-east-2.amazonaws.com
issued on : 2017-10-12 00:00:00
expires on : 2018-10-13 23:59:59
signed using : ECDSA with SHA256
EC key size : 256 bits
basic constraints : CA=false
subject alt name : iot.us-east-2.amazonaws.com, *.iot.us-east-2.amazonaws.com
key usage : Digital Signature
ext key usage : TLS Web Server Authentication, TLS Web Client Authentication
正在订阅...
错误:主要L#206订阅错误:-28
Subscribing...
ERROR: main L#206 Error subscribing : -28
任何人都可以告诉我发生了什么事吗?我想念什么吗?
Can anyone show me what is happening? Am I missing something?
推荐答案
由于我没有找到与将数据从设备发送到AWS IoT的过程相关的良好且完整的教程,包括所有必要步骤,因此我尝试更改我以前用来执行的政策:
As I did not find out a good and complete tutorial related to process of sending data from a device to AWS IoT, including all the steps needed, I tried changing the policy I was using to:
{
"Effect": "Allow",
"Action": "iot:*",
"Resource": "*"
}
尽管Resource
上的通配符显然不是很好,但这是我使用的方式,因为其他策略均无效.
Though this wildcard on Resource
apparently is not so good, it was the way I used, since the other policies were not working.
这篇关于AWS IoT SDK-主要的L#206错误订阅:-28(C代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!