0

esp32 and Adafruit MQTT Library
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

esp32 and Adafruit MQTT Library

by uzer123 on Sun Feb 07, 2021 8:19 pm

Although ESP8266 is supported (https://github.com/adafruit/Adafruit_MQTT_Library), i dont see any examples available for ESP32 boards.
I managed to make esp8266 example (https://github.com/adafruit/Adafruit_MQTT_Library/blob/master/examples/adafruitio_secure_esp8266/adafruitio_secure_esp8266.ino) to work by changing esp8266 wifi library and now my esp32 board is publishing correctly.
BUT i cannot understand how esp32 is publishing without any TLS credentials. ESP8266 is using fingerprint (line 47), but esp32 AND airlift example doesnt use any CA certification.
So, how is this encrypted?
Moreover, why esp32 examples arent already available? (i see there is https://github.com/adafruit/Adafruit_IO_Arduino if its relevant)

edit: i see Adafruit_IO_Arduino is working "as is" to esp32 (i guess is the updated version for interaction with adafruit io..But again, i searched almost all the files, and i dont see any CA cert

uzer123
 
Posts: 13
Joined: Thu Jan 09, 2020 9:05 pm

Re: esp32 and Adafruit MQTT Library

by brubell on Mon Feb 08, 2021 11:37 am

We don't have any ESP32-specific examples on Adafruit MQTT since it's an older library, you may add an "issue" to the repository and we can take a look at adding an example. We advise ESP32 users to use the Adafruit IO Arduino library instead.

BUT i cannot understand how esp32 is publishing without any TLS credentials. ESP8266 is using fingerprint (line 47), but esp32 AND airlift example doesnt use any CA certification.
So, how is this encrypted?


The AirLift boards have the certificate for Adafruit IO "burned" into the firmware.

Communication between your ESP32 and Adafruit IO is encrypted, ESP32 uses a different WiFi client framework than the ESP8266 which lets it obtain the certificate from the authority rather than pre-configuring the certificate's fingerprint.

https://github.com/espressif/arduino-es ... ority-cert
https://github.com/adafruit/Adafruit_IO ... 32.cpp#L23

brubell
 
Posts: 1377
Joined: Fri Jul 17, 2015 10:33 pm

Re: esp32 and Adafruit MQTT Library

by uzer123 on Mon Feb 08, 2021 2:30 pm

i dont see a point to add esp32 code in Adafruit MQTT, but it could be a valueable thing to put a note in the main page that this library is deprecated. I was searching a lot until i found there is Adafruit IO which covers esp32 and its even simpler.

Communication between your ESP32 and Adafruit IO is encrypted, ESP32 uses a different WiFi client framework than the ESP8266 which lets it obtain the certificate from the authority rather than pre-configuring the certificate's fingerprint.

https://github.com/espressif/arduino-es ... ority-cert
https://github.com/adafruit/Adafruit_IO ... 32.cpp#L23


In ESP8266 the library uses fingerprint, which must be updated ofter.
ESP32, i understand that it uses "WiFiClientSecure" instead of unsecured "WiFiClient". But, i dont see anywhere the long root_ca as it is here https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino (line 20).

This is my problem, in esp8266 that it uses fingerrpint, you can find it in the code. But Esp32 wihch uses root_ca i dont see a cert nowhere.

uzer123
 
Posts: 13
Joined: Thu Jan 09, 2020 9:05 pm

Re: esp32 and Adafruit MQTT Library

by uzer123 on Mon Feb 15, 2021 7:32 pm

.

uzer123
 
Posts: 13
Joined: Thu Jan 09, 2020 9:05 pm

Please be positive and constructive with your questions and comments.