Hey guys...
I am using ESP32 S2 and I am trying to connect to an MQTT broker which runs in my local inside a Docker in the port 8883 in TLS i can able to connect the ESP with the broker when the broker is modified to run in the 1883 but when it comes to TLS it is giving me some issues .
getting the error :
E (84613) esp-tls-mbedtls: mbedtls_x509_crt_parse of CA cert returned -0x2180
E (84613) esp-tls-mbedtls: Failed to set client configurations, returned [0x8015] (ESP_ERR_MBEDTLS_X509_CRT_PARSE_FAILED)
E (84623) esp-tls: create_ssl_handle failed
E (84623) esp-tls: Failed to open new connection
E (84633) transport_base: Failed to open a new connection
E (84643) mqtt_client: Error transport connect
I am wondering how to fix this error
The cert files are uploaded most of the formats and still i couldn't run it properly
but when i try it with the MQTT explorer as a client even in different devices with the same CA it is working properly
the mosquitto cnf i am using is
const esp_mqtt_client_config_t mqtt_cfg = {
.broker = {
.address = {
.uri = brokerAddress //"mqtts://192.168.1XX.XX:8883",
//.port = mqttPort,
},
.verification = {
.certificate = ca_cert_file,
.certificate_len = strlen(ca_cert_file),
.skip_cert_common_name_check = false, // Change to true if needed
.common_name = NULL
//.common_name = "MyCA"
},
},
.credentials = {
.username = "yyyyy", // Set your MQTT broker username
.client_id = "client_1001001",
.authentication = {
.password = "XXXXX",
}
}
and my mosquitto cnf file is
# listener for MQTT
listener 8883
# MQTT over TLS
cafile /mosquitto/config/ca.crt
certfile /mosquitto/config/server.crt
keyfile /mosquitto/config/server.key
require_certificate false
#use_identity_as_username true
# Use basic authentication with the password file
allow_anonymous false
password_file /mosquitto/config/mosquitto_passwd
# Log settings
#log_dest file /mosquitto/log/mosquitto.log
log_type all
log_timestamp true
log_timestamp_format %Y-%m-%d %H:%M:%S
# Persistence settings
persistence true
persistence_location /mosquitto/data/
# Other settings
autosave_interval 1800
# Enable protocol version 3.1.1
protocol mqtt
ESP32 - TLS - MQTT - ESPIDF
-
- Posts: 1
- Joined: Thu May 16, 2024 12:34 pm
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: Bing [Bot] and 78 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.