You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* WiFiServerSecure: Cache the SSL sessions
* Add SSL session caching to HTTPS server examples
* Document server SSL session caching
* Fix an incomplete sentence in the documentation
* Document BearSSL::Session
* Use the number of sessions instead of the buffer size in ServerSessions' constructors
Copy file name to clipboardExpand all lines: doc/esp8266wifi/bearssl-server-secure-class.rst
+21-1
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Implements a TLS encrypted server with optional client certificate validation.
8
8
setBufferSizes(int recv, int xmit)
9
9
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
10
11
-
Similar to the `BearSSL::WiFiClientSecure` method, sets the receive and transmit buffer sizes. Note that servers cannot request a buffer size from the client, so if these are shrunk and the client tries to send a chunk larger than the receive buffer, it will always fail. This must be called before the server is
11
+
Similar to the `BearSSL::WiFiClientSecure` method, sets the receive and transmit buffer sizes. Note that servers cannot request a buffer size from the client, so if these are shrunk and the client tries to send a chunk larger than the receive buffer, it will always fail. Needs to be called before `begin()`
Sets an elliptic curve certificate and key for the server. Needs to be called before `begin()`.
35
35
36
+
Client sessions (Resuming connections fast)
37
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
+
39
+
The TLS handshake process takes a long time because of all the back and forth between the client and the server. You can shorten it by caching the clients' sessions which will skip a few steps in the TLS handshake. In order for this to work, your client also needs to cache the session. `BearSSL::WiFiClientSecure <bearssl-client-secure-class.rst#sessions-resuming-connections-fast>`__ can do that as well as modern web browers.
40
+
41
+
Here are the kind of performance improvements that you'll be able to see for TLS handshakes with an ESP8266 with it's clock set at 160MHz on a network with fairly low latency:
42
+
43
+
* With an EC key of 256 bits, a request taking ~360ms without caching takes ~60ms with caching.
44
+
* With an RSA key of 2048 bits, a request taking ~1850ms without caching takes ~70ms with caching.
45
+
46
+
setCache(BearSSL::ServerSessions \*cache)
47
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48
+
49
+
Sets the cache for the server's sessions. When choosing the size of the cache, remember that each client session takes 100 bytes. If you setup a cache for 10 sessions, it will take 1000 bytes. Needs to be called before `begin()`
50
+
51
+
When creating the cache, you can use any of the 2 available constructors:
52
+
53
+
* `BearSSL::ServerSessions(ServerSession *sessions, uint32_t size)`: Creates a cache with the given buffer and number of sessions.
54
+
* `BearSSL::ServerSessions(uint32_t size)`: Dynamically allocates a cache for the given number of sessions.
0 commit comments