MQTT TLS: The certificate Common Name (CN) does not match with the expected CN

m.lettieri
Posts: 2
Joined: Fri Aug 31, 2018 1:20 pm

MQTT TLS: The certificate Common Name (CN) does not match with the expected CN

Postby m.lettieri » Tue May 21, 2019 10:21 am

Using release 3.2, when i try to connect to any ssl mqtt broker i receive this error.

Code: Select all

E (6128) esp-tls: mbedtls_ssl_handshake returned -0x2700
I (6128) esp-tls: Failed to verify peer certificate!
I (6128) esp-tls: verification info:   ! The certificate Common Name (CN) does not match with the expected CN
  ! The certificate is not
E (6148) esp-tls: Failed to open new connection
E (6148) TRANS_SSL: Failed to open a new connection
E (6158) MQTT_CLIENT: Error transport connect
E (6168) WIFI: MQTT_EVENT_DISCONNECTED
I'm using this command to get the pem file
openssl s_client -showcerts -connect myhost.com:8883 </dev/null 2>/dev/null|openssl x509 -outform PEM >myhost.pem

Without the pem file it works but after random times mqtt disconnects giving tls error and the only way to reconnect is disconnect/reconnect to wifi or reboot esp32

In the same moments are active WiFi, BLE, sntp client

Who is online

Users browsing this forum: Bing [Bot] and 109 guests