pubsubclient icon indicating copy to clipboard operation
pubsubclient copied to clipboard

Added TLS secured MQTT example for ESP32 and Mosquitto communication.

Open norbertg1 opened this issue 3 years ago • 6 comments

I spent long hours to make working TLS encrypted communication with ESP32 <----> Mosquitto broker (MQTT) also opened for that an issue where others too suffered from a similar problem: arduino-esp32/#5021

I decided to make a useful example, I hope it can be useful in the future, please include it.

The mqtt_ESP32_TLS.ino source file also contains a short manual. The certificates/certificate_generator.sh is an easy tool for generating certificates.

norbertg1 avatar Apr 27 '21 14:04 norbertg1

Thanks for your help to integrate it with wifi! Can you also give us an example of use with tinyGsm library when using with some network module? Thanks

roysG avatar Oct 31 '21 19:10 roysG

Thanks for your help to integrate it with wifi! Can you also give us an example of use with tinyGsm library when using with some network module? Thanks

I dont know tinyGsm library, I cannot help. You must do it on your own.

norbertg1 avatar Oct 31 '21 20:10 norbertg1

i'm using your example and an issue occured... error:Unknown error code (0050) state: -2 And i test the mosquitto broker, it work.

googidaddy avatar Nov 23 '21 07:11 googidaddy

i'm using your example and an issue occured... error:Unknown error code (0050) state: -2 And i test the mosquitto broker, it work.

oh sorry, it is server error, port 1883 has been attacked.

googidaddy avatar Nov 23 '21 08:11 googidaddy

hi

I used your script and played arround for quite some time also with PROGMEM etc. I seem to have a problem with the certs and keys.

Following error: X509 - Certificate verification failed, e.g. CRL, CA or signature check failed

I used the exact same ca.crt esp.crt and esp.key with testing tool MQTT.fx where it works, also working on Raspberry pi.

Maybe you can give me a hint!

BR

treponix-jp avatar Jul 05 '22 20:07 treponix-jp

Please consider merging to to the main branch. That example could be very usefull for people looking for TLS encryption in MQTT communication.

norbertg1 avatar Mar 18 '24 13:03 norbertg1