SSL certificate error while connecting to AWS IoT core

If you are asking a question, please follow this template:

  1. My goal is: I want to connect esp32 to aws iot core through MQTT api, without using AWS IoT setup
  2. My actions are: I dowloaded certicate and paste into fs folder also created conf1.json where I initialize parameters of MQTT as -
"mqtt" : {
        "enable" : true,
        "server" : "xxxxxxxx.iot.us-west-2.amazonaws.com",
        "ssl_cert": "certificate.pem",
        "ssl_key": "private.pem.key",
        "ssl_ca_cert" : "AmazonRootCA1.pem"
}
  1. The result I see is:

mgos_mqtt_conn.c:479 Error: Invalid SSL cert

  1. My expectation & question is: I have downloaded certicate properly them what went wrong?

Try to use those with mosquitto_sub so you can be sure.
https://mosquitto.org/download/

It is working with mosquitto in local system.

interesting.
raise debug.level to 3 and get more info from the log
One thing I’m not sure about is the double dot in one of the names… try to keep it to file.ext

config_schema:

  • [“aws.thing_name”, “”]

  • [“mqtt.enable”, true]

  • [“mqtt.server”, “xxxxxxxxxxx-xxx.iot.xx-xxxx-x.amazonaws.com:8883”]

  • [“mqtt.ssl_ca_cert”, “ca.pem”]

  • [“mqtt.ssl_cert”, “certname.crt.pem”]

  • [“mqtt.ssl_key”, “keyname.key.pem”]

try to add this in your mos.yml

worked like a charm for me.

@ameya-shahu did you manage to get it working? Struggling with same issue. Works with mosquitto client as well.