Closed LioRei closed 3 years ago
Hi
Thanks for your PR. I prefer you change the PR as follows to not using an extra variable _use_insecure
(similar to ESP8266 solution) and setInsecure is only optional whenever we don't need, don't have or don't use CA Certs
bool _use_insecure;
Don't need this:
this->_use_insecure = true;
and change to
if ( this->_optional_ssl_ca_cert || this->_optional_ssl_client_ca || this->_optional_ssl_private_key )
{
if (this->_optional_ssl_ca_cert)
{
client->setCACert(this->_optional_ssl_ca_cert);
}
if (this->_optional_ssl_client_ca)
{
client->setCertificate(this->_optional_ssl_client_ca);
}
if (this->_optional_ssl_private_key)
{
client->setPrivateKey(this->_optional_ssl_private_key);
}
}
else
{
client->setInsecure();
}
Usage:
Just keep these CA Certs as nullptr
, and the client->setInsecure()
will be called automatically
const char* _optional_ssl_ca_cert = nullptr;
const char* _optional_ssl_client_ca = nullptr;
const char* _optional_ssl_private_key = nullptr;
Thanks Lionel,
The PR has been merged and I'll add some more mods before publishing a new Release.
Regards,
Hi Lionel,
Just added 2 new InSecure-mode examples. Please retest to be sure everything is OK. Thanks.
I have tested the example with an ESP32-PICO-KIT (esp32-pico-d4) and an ESP32-S2 SAOLA, it's working for the 2 boards ;)
I don't own an ESP8266 so I can't test it
Thanks. I'll published new release soon.
HI Lionel,
Just published the new WebSockets2_Generic releases v1.2.4 with a note about your contribution in Contributions and Thanks.
Hoping to get more from you.
Regards,
I update from Arduino ide to Release v1.2.4 and produce a error D:\DC100\FW\arduino-1.8.13\portable\sketchbook\libraries\WebSockets2_Generic\src/Tiny_Websockets_Generic/network/esp32/esp32_tcp.hpp:71:24: error: 'class WiFiClientSecure' has no member named 'setInsecure' this->client.setInsecure();
In the board manager, wich version of esp32 do you use ? Personnaly, I use 2.0.0-alpha1 because I'm using an ESP32S2 board.
@emanavas
You have to install ESP32 core, at least the version v1.0.5.
The setInsecure()
has been defined in WiFiClientSecure.h#L66
Next time, it's better to create a new issue, not post in the closed PR like this.
I've added the setInsecure fonction to be able to work with self signed certificate, it's really usefull in dev ;)
Usage example in Secured ESP32 Websockets Client: replace client.setCACert(echo_org_ssl_ca_cert); by client.setInsecure(); and voila, it's working