Mqtts instead of mqtt on PubSubClient library

Hello Guys,
i am afraid mybe its not completely relevant for this forum but i am posting it here, as its the most helpful forum.

I was sending data from my raspberry pi (client) to my remote server via mqtts (8883). On the server side I have installed TLS to secure the mqtt. On the client side node-red is installed, and i am using the server adress (mqtts://example.server.de) and port 8883. One of my friend helped me to check the encryption, he told me now your data is encryped.

Now I want to use esp32 and i will have to use library PubSubClient to send the data directly to my server (example.server.de). In this library if i give only IP of the server only instead of mqtts://IP

IPAddress server(172, 16, 0, 2); // just is an example

Then perhaps my data from esp32 to server would not be encryped and man in the middle would be able to sniff the credentials (as I have set user and password on server side, only who have these can send the data to the server via mqtts). Once the man in the middle has credentials , then i am afraid , he can damage my server.

Please help me. How can i secure this using this esp32. Previously i was usig raspi zero W, but i want to replace raspi zero with esp32 because of high power consumption of raspi.

Thank you

Trying to do TLS encryption on an MPU is very hard. In theory though, an ESP32 should be able to do it.
To do so, you should probably use Expresif's library though:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/protocols/mqtt.html

It does support MQTTS.

As an alternative, implement a local broker and get the ESP32 to talk to that. Have the local broker sync appropriate topics with the remote broker over TLS.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.