Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 1.65 KB

tls.md

File metadata and controls

53 lines (34 loc) · 1.65 KB

plainhdr

Using TLS

TLS support is available for ESP8266 targets only.

Prerequisites

Unfortunately the standard ESPAsyncTCP at version 1.2.2 contains bugs in its SSL implementation which prevent a successful compile.

You must replace that library with this bugfixed version

Compiling with SSL

SSL Features are NOT available by default. This is because they add about 64k to the binary, even if you don't use them!

In order to use TLS, you first need to enable SSL in both the bugfixed library: Edit async_config.h and PangolinMQTT itself: Edit config.h

In both files, find the line which says: #define ASYNC_TCP_SSL_ENABLED 0

and change it to: #define ASYNC_TCP_SSL_ENABLED 1

before compiling.

Your Code

You must provide a 20-byte SHA1 fingerprint to confirm the server identity, and call serverFingerprint before connection, e.g.

...
const uint8_t cert[20] = { 0x9a, 0xf1, 0x39, 0x79,0x95,0x26,0x78,0x61,0xad,0x1d,0xb1,0xa5,0x97,0xba,0x65,0x8c,0x20,0x5a,0x9c,0xfa };
...
  mqttClient.serverFingerprint(cert);
  ...
  mqttClient.connect(...
...

Find me daily in these FB groups

I am always grateful for any $upport on Patreon :)

(C) 2020 Phil Bowles