# SSL/TLS

YuDash IoT gateways supports SSL/TLS secure communication for MQTT and HTTP protocol.

Following are typical steps to enable SSL/TLS security layer

1. Enable TLS/SSL within the cloud protocol settings.
2. Change the server port for TLS/SSL communication.
3. Upload server CA certificate in the IoT device.

{% hint style="info" %}
This documentation explains the TLS for CA signed server, which require a single pem file. For self signed TLS (involving pem, crt  and key), refer to this [documentation](https://docs.yudash.com/device-to-cloud-api/cloud-protocols/ssl-tls/selfsigned).
{% endhint %}

### **SSL/TLS for MQTT**

1\) Enable "SSL/TLS" radio button in **MQTT Secure Layer**. Change the **MQTT port** pertaining to secure layer of server. This is typically 8883 for MQTT.

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2F1I9cfAGzT8i0ZDG099dy%2Fmqtt_30.jpg?alt=media&#x26;token=1366f074-bb51-401a-b4f8-e0873a9459b1" alt=""><figcaption></figcaption></figure>

2\) Upload server CA certificate to IoT device. First, **Choose File** and select the .pem file from local computer. Then, click on **Load SSL/TLS File** which will load the file in the browser. Finally, click on **Write SSL/TLS file**, which will write the the file into the IoT device.

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2F2GhsCAkXenL5vugyegLI%2Fmqtt_31.jpg?alt=media&#x26;token=13f0bd39-59bb-43d4-bf2b-3ac5e61559c5" alt=""><figcaption></figcaption></figure>

3\) Following message is shown when CA certificate file is written successfully.

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2Feqsmc8ntVp7p20tua9eJ%2Fmqtt_32.jpg?alt=media&#x26;token=744c6e6b-7133-4932-9554-506fed2c7e57" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
By default, the CA certificate for MQTT protocol is stored as file name /assets/mqtt\_cacert.pem within the YuDash IoT device.&#x20;
{% endhint %}

### **SSL/TLS for HTTP**

1\) Enable "SSL/TLS" radio button in **HTTP Secure Layer**. Change the **HTTP port** pertaining to secure layer of server. This is typically 443 for HTTP

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2F7qs5c6MtlC19J2oU3pBx%2Fhttp_33.jpg?alt=media&#x26;token=129e19d4-057a-4704-b164-8295f0a9d075" alt=""><figcaption></figcaption></figure>

2\) Upload server CA certificate to IoT device. First, **Choose File** and select the .pem file from local computer. Then, click on **Load SSL/TLS File** which will load the file in the browser. Finally, click on **Write SSL/TLS file**, which will write the the file into the IoT device.

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2Fo3TQAbInDYDsmlHCQYnF%2Fhttp_34.jpg?alt=media&#x26;token=d85d53b9-b8dd-4251-a7ff-49c8f2979dc1" alt=""><figcaption></figcaption></figure>

3\) Following message is shown when CA certificate is written successfully.

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2FiJKDtEj7GcxHGC7U0gYh%2Fhttp_35.jpg?alt=media&#x26;token=d48bbc35-bf86-4134-8380-d9114db41245" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
By default, the CA certificate for HTTP protocol is stored as file name /assets/http\_cacert.pem within the YuDash IoT device.&#x20;
{% endhint %}
