Page 1 of 1

mqtt+ssl单向认证(sdk3.2.2/3.3.1)

Posted: Tue Mar 10, 2020 1:50 am
by shenyong-iot01
您好,使用sdk内ssl单向验证demo进行验证,显示证书验证失败(但此证书使用MQTTfx工具可以正常连接。android客户端也可以正常连接)代码如附件app_main.c,设备log如附件Failed to verify peer certificate.txt,请帮忙查看下原因。
和连接贵司服务器(使用sdk3.3.1内证书和域名,可正常连接)相比源码只更改证书,域名端口号。

component.mk
COMPONENT_EMBED_TXTFILES := iot_eclipse_org.pem cert.pem //方便编译切换证书

错误信息:
E (6641) esp-tls: mbedtls_ssl_handshake returned -0x2700
I (6651) esp-tls: Failed to verify peer certificate!
I (6651) esp-tls: verification info: ! The certificate Common Name (CN) does not match with the expected CN
! The certificate is not
E (6671) esp-tls: Failed to open new connection
E (6671) TRANS_SSL: Failed to open a new connection
E (6671) MQTT_CLIENT: Error transport connect
D (6681) MQTT_CLIENT: Reconnect after 10000 ms
I (6681) MQTTS_EXAMPLE: MQTT_EVENT_DISCONNECTED