ubidots / ubidots-esp8266

Library for uploading ESP8266 devices to Ubidots
39 stars 28 forks source link

Add HTTPS support through WiFiClientSecure #24

Closed Oneirag closed 5 years ago

Oneirag commented 7 years ago

Adds support for HTTPS in Ubidots class. Member _client has been changed from WiFiClient type to WiFiSecure*, two new functions _connect and setSSL have been added to able to activate https and to validate server identity against root certificate

Oneirag commented 7 years ago

See example UbidotsGetValueHTTPS for info on how to use SSL

jotathebest commented 7 years ago

Thanks for your support @Oneirag to improve our libraries, we will review all your changes for testing and once we finish the review we will include your changes

mariacarlinahernandez commented 7 years ago

Hello @Oneirag, thanks so much for improve the library!

I was checking the library, and at the first compile I get the error below:

/home/mariahernandez/Arduino/libraries/ubidots-esp8266-5483ee6d84977ff512030e3e66f2bd3d88bdb090/UbidotsMicroESP8266.cpp: In member function 'void Ubidots::setSSL(bool, int)':
/home/mariahernandez/Arduino/libraries/ubidots-esp8266-5483ee6d84977ff512030e3e66f2bd3d88bdb090/UbidotsMicroESP8266.cpp:60:22: error: 'class WiFiClientSecure' has no member named 'setCACert'
   success = _client->setCACert(caCert, caCertLen);
                      ^
/home/mariahernandez/Arduino/libraries/ubidots-esp8266-5483ee6d84977ff512030e3e66f2bd3d88bdb090/UbidotsMicroESP8266.cpp: In member function 'bool Ubidots::_connect(char*, int)':
/home/mariahernandez/Arduino/libraries/ubidots-esp8266-5483ee6d84977ff512030e3e66f2bd3d88bdb090/UbidotsMicroESP8266.cpp:118:19: error: 'class WiFiClientSecure' has no member named 'verifyCertChain'
      if (_client->verifyCertChain(host)) {

As I can see is an import issue, following this I made a sample test with the ESP8266WiFi library and it is working properly. Probably, you are based in other library, ins't you? if not, do you have any idea where can be the issue?

I hope we can solve this issue as soon as we can to include your changes :D

All the best, Maria C.

jotathebest commented 7 years ago

Hello @Oneirag , thank you very much for your hard work, we appreciate your help to improve our library.

I have made some debug and tests and it seems that your PR depends on the version 2.4 of the ESP8266 library wrapper for Arduino. As ver 2.4 is still now in rc, we cannot add it to our actual library, but we believe that your PR is a nice feature and once ver 2.4 can be available as current version we will add your PR with some changes:

Thanks again for your hard work, and once the new release for the ESP8266 is available we will update our library with your changes.

Regards

Oneirag commented 7 years ago

HelloI'm glad you liked my PR, and I understand that the features needed are not still in the official version of the ESP8266 library. Regarding the fingerprint it was just a workaround to make it work. I assumed that your let's encrypt certificated lasted for 90 days, but if they are renewed in shorter periods, of course it makes no sense to use that validations. I will remove it also from my fork. Thanks!Hope version 2.4 of ESP8266 is released soon!

El Martes 15 de agosto de 2017 0:03, Jose Reyes Garcia Delgado <notifications@github.com> escribió:

Hello @Oneirag , thank you very much for your hard work, we appreciate your help to improve our library.I have made some debug and tests and it seems that your PR depends on the version 2.4 of the ESP8266 library wrapper for Arduino. As ver 2.4 is still now in rc, we cannot add it to our actual library, but we believe that your PR is a nice feature and once ver 2.4 can be available as current version we will add your PR with some changes:

csaraivarocha commented 6 years ago

Does it work on ESP32?

jotathebest commented 5 years ago

Hi there @Oneirag , we will be updating the library to support TLS using CaCert instead instead of the server's fingerprint due to an easier maintenance of the first one for huge deployments. As this PR will be outdated with the incoming library version I will clos the PR, I just wanted to thank you for your contribution!!

Have a nice rest of your day