Hi Anwar,
You cannot implement your own security algorithm in MQTT Protocol in MATLAB. From R2022a, MATLAB introduced Industrial Communication Toolbox to facilitate exchange of data over OPC UA, Modbus, MQTT, and other industrial protocols.
The Industrial Communication Toolbox provides support for various industrial protocols, including MQTT, and includes built-in security features such as SSL and TLS encryption.
By utilizing the Industrial Communication Toolbox in MATLAB, you can implement SSL and TLS security for MQTT communication without the need for extensive customization or external libraries. The toolbox provides a convenient and integrated solution for securing MQTT-based IoT applications.
With Industrial Communication Toolbox, you can establish secure MQTT connections by configuring SSL/TLS certificates, keys, and encryption protocols. This toolbox simplifies the implementation of security measures in the MQTT protocol, ensuring the confidentiality and integrity of data exchanged between MQTT clients and brokers.
Read more here: