@@ -50,6 +50,9 @@ void WebSocketsClient::begin(const char * host, uint16_t port, const char * url,
50
50
_CA_cert = NULL ;
51
51
#ifdef ESP32
52
52
_CA_bundle = NULL ;
53
+ #if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 4)
54
+ _CA_bundle_size = 0 ;
55
+ #endif
53
56
#endif
54
57
#endif
55
58
@@ -124,13 +127,25 @@ void WebSocketsClient::beginSslWithCA(const char * host, uint16_t port, const ch
124
127
_CA_cert = CA_cert;
125
128
_CA_bundle = NULL ;
126
129
}
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
127
141
void WebSocketsClient::beginSslWithBundle (const char * host, uint16_t port, const char * url, const uint8_t * CA_bundle, const char * protocol) {
128
142
begin (host, port, url, protocol);
129
143
_client.isSSL = true ;
130
144
_fingerprint = SSL_FINGERPRINT_NULL;
131
145
_CA_cert = NULL ;
132
146
_CA_bundle = CA_bundle;
133
147
}
148
+ #endif
134
149
135
150
#else
136
151
void 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) {
247
262
#if defined(ESP32)
248
263
} else if (_CA_bundle) {
249
264
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
250
268
_client.ssl ->setCACertBundle (_CA_bundle);
251
269
#endif
252
- #if defined(ESP32)
253
270
} else if (!SSL_FINGERPRINT_IS_SET) {
254
271
_client.ssl ->setInsecure ();
255
272
#elif defined(SSL_BARESSL)
0 commit comments