I'm having some trouble with mqtt ssl example on esp-idf ESP32.
If I test it with the default broker "mqtts://mqtt.eclipse.org:8883" and default certificate "mqtt_eclipse_org.pem" It works correctly.
If I change the broker with mqtts://test.mosquitto.org:8883 ( https://test.mosquitto.org/ ) and change the certificate using (mosquitto.org.crt (PEM format), it fails and gave me TLS errors:
mbedtls:ssl_tls.c:5757 x509_verify_cert() returned -9984 (-0x2700) esp-tls: mbedtls_ssl_handshake returned .0x2700 esp-tls: Failed to verify peer certificate! failed to verify peer certificate verification info: ! the certificate is not correctly signed by the trusted CA
What am I doing wrong?