0

I'm using esp-idf 4.4 on esp32, and I'm having problems connecting to an mqtts server. In this project we used to connect to an mqtt server, but now there is a requirement to switch to mqtts.

my config is as follows:

    m_mqttConfig.host = mqttHost;
    m_mqttConfig.client_id = clientID;
    m_mqttConfig.username = clientID;
    m_mqttConfig.password = apiKey;
    m_mqttConfig.port = 8883;
    m_mqttConfig.lwt_topic = lwtBuffer;
    m_mqttConfig.lwt_qos = 0;
    m_mqttConfig.lwt_retain = true;
    m_mqttConfig.lwt_msg_len = 0;
    m_mqttConfig.keepalive = KEEP_ALIVE_DURATION_IN_SEC;
    m_mqttConfig.reconnect_timeout_ms = getBackoffInitNumber();
    m_mqttConfig.buffer_size = MQTT_INTERNAL_BUFF_SIZE;
    m_mqttConfig.transport = MQTT_TRANSPORT_OVER_SSL;

in the sdkconfig I've added

CONFIG_ESP_TLS_INSECURE=y
CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY=y

I'm getting the following errors:

E (85785) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x7280
E (85785) esp-tls: Failed to open new connection

On a desktop app with the same credentials, without certificate the connection to the server is successful.

Any idea how to connect properly?

prophet-five
  • 509
  • 3
  • 14
  • 1
    -0x7280 is "SSL - The connection indicated an EOF". The next step is to understand why. Can you get logs from the client, the server or wireshark? One possibility is that the mbedtls configuration doesn't support any cipher suite in common with the server. – Gilles 'SO- stop being evil' Jul 12 '23 at 17:38

0 Answers0