From f65e8d9062875ccf7fff8cda79325a4f1af0cd5c Mon Sep 17 00:00:00 2001 From: lucalas Date: Thu, 1 Oct 2020 01:12:54 +0200 Subject: [PATCH 1/3] call setFingerPrint for ssl object in client with fingerprint received in beginSSL or no connection will start; --- src/WebSocketsClient.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WebSocketsClient.cpp b/src/WebSocketsClient.cpp index 64b3f64..ebd83b6 100644 --- a/src/WebSocketsClient.cpp +++ b/src/WebSocketsClient.cpp @@ -170,6 +170,7 @@ void WebSocketsClient::loop(void) { _client.tcp = NULL; } _client.ssl = new WEBSOCKETS_NETWORK_SSL_CLASS(); + _client.ssl->setFingerprint(_fingerprint.c_str()); _client.tcp = _client.ssl; if(_CA_cert) { DEBUG_WEBSOCKETS("[WS-Client] setting CA certificate"); From e1ddbfe1a5e6e32e1c6d9615f6391e14ed9de408 Mon Sep 17 00:00:00 2001 From: lucalas Date: Thu, 1 Oct 2020 01:14:01 +0200 Subject: [PATCH 2/3] Format Code; --- src/WebSocketsClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebSocketsClient.cpp b/src/WebSocketsClient.cpp index ebd83b6..b291056 100644 --- a/src/WebSocketsClient.cpp +++ b/src/WebSocketsClient.cpp @@ -170,7 +170,7 @@ void WebSocketsClient::loop(void) { _client.tcp = NULL; } _client.ssl = new WEBSOCKETS_NETWORK_SSL_CLASS(); - _client.ssl->setFingerprint(_fingerprint.c_str()); + _client.ssl->setFingerprint(_fingerprint.c_str()); _client.tcp = _client.ssl; if(_CA_cert) { DEBUG_WEBSOCKETS("[WS-Client] setting CA certificate"); From c73c77e9882765bbcd8ba7a32e6692ee35c94922 Mon Sep 17 00:00:00 2001 From: lucalas Date: Fri, 2 Oct 2020 09:29:55 +0200 Subject: [PATCH 3/3] Add check to set fingerprint; --- src/WebSocketsClient.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/WebSocketsClient.cpp b/src/WebSocketsClient.cpp index b291056..17cae29 100644 --- a/src/WebSocketsClient.cpp +++ b/src/WebSocketsClient.cpp @@ -170,7 +170,6 @@ void WebSocketsClient::loop(void) { _client.tcp = NULL; } _client.ssl = new WEBSOCKETS_NETWORK_SSL_CLASS(); - _client.ssl->setFingerprint(_fingerprint.c_str()); _client.tcp = _client.ssl; if(_CA_cert) { DEBUG_WEBSOCKETS("[WS-Client] setting CA certificate"); @@ -180,6 +179,10 @@ void WebSocketsClient::loop(void) { _client.ssl->setCACert((const uint8_t *)_CA_cert, strlen(_CA_cert) + 1); #else #error setCACert not implemented +#endif + } else if(_fingerprint.length()) { +#if defined(wificlientbearssl_h) && !defined(USING_AXTLS) && !defined(wificlientsecure_h) + _client.ssl->setFingerprint(_fingerprint.c_str()); #endif } } else {