@@ -50,6 +50,9 @@ void WebSocketsClient::begin(const char * host, uint16_t port, const char * url,
5050 _CA_cert = NULL ;
5151#ifdef ESP32
5252 _CA_bundle = NULL ;
53+ #if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 4)
54+ _CA_bundle_size = 0 ;
55+ #endif
5356#endif
5457#endif
5558
@@ -124,13 +127,25 @@ void WebSocketsClient::beginSslWithCA(const char * host, uint16_t port, const ch
124127 _CA_cert = CA_cert;
125128 _CA_bundle = NULL ;
126129}
130+
131+ #if defined(ESP32) && ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 4)
132+ void WebSocketsClient::beginSslWithBundle (const char * host, uint16_t port, const char * url, const uint8_t * CA_bundle, size_t CA_bundle_size, const char * protocol) {
133+ begin (host, port, url, protocol);
134+ _client.isSSL = true ;
135+ _fingerprint = SSL_FINGERPRINT_NULL;
136+ _CA_cert = NULL ;
137+ _CA_bundle = CA_bundle;
138+ _CA_bundle_size = CA_bundle_size;
139+ }
140+ #else
127141void WebSocketsClient::beginSslWithBundle (const char * host, uint16_t port, const char * url, const uint8_t * CA_bundle, const char * protocol) {
128142 begin (host, port, url, protocol);
129143 _client.isSSL = true ;
130144 _fingerprint = SSL_FINGERPRINT_NULL;
131145 _CA_cert = NULL ;
132146 _CA_bundle = CA_bundle;
133147}
148+ #endif
134149
135150#else
136151void WebSocketsClient::beginSSL (const char * host, uint16_t port, const char * url, const uint8_t * fingerprint, const char * protocol) {
@@ -247,9 +262,11 @@ void WebSocketsClient::loop(void) {
247262#if defined(ESP32)
248263 } else if (_CA_bundle) {
249264 DEBUG_WEBSOCKETS (" [WS-Client] setting CA bundle" );
265+ #if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 4)
266+ _client.ssl ->setCACertBundle (_CA_bundle, _CA_bundle_size);
267+ #else
250268 _client.ssl ->setCACertBundle (_CA_bundle);
251269#endif
252- #if defined(ESP32)
253270 } else if (!SSL_FINGERPRINT_IS_SET) {
254271 _client.ssl ->setInsecure ();
255272#elif defined(SSL_BARESSL)
0 commit comments