Skip to content

Commit bb45036

Browse files
Earle F. Philhower, IIIEarle F. Philhower, III
Earle F. Philhower, III
authored and
Earle F. Philhower, III
committed
Update documentation too
1 parent 4f72323 commit bb45036

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

doc/esp8266wifi/bearssl-client-secure-class.rst

+9-11
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ There are many configuration options that require passing in a pointer to an obj
3434
BearSSL::WiFiClientSecure client;
3535
const char x509CA PROGMEM = ".......";
3636
void setup() {
37-
BearSSLX509List x509(x509CA);
37+
BearSSL::X509List x509(x509CA);
3838
client.setTrustAnchor(&x509);
3939
}
4040
void loop() {
@@ -73,7 +73,7 @@ TLS Sessions
7373

7474
TLS supports the notion of a session (completely independent and different from HTTP sessions) which allow clients to reconnect to a server without having to renegotiate encryption settings or validate X509 certificates. This can save significant time (3-4 seconds in the case of EC keys) and can help save power by allowing the ESP8266 to sleep for a long time, reconnect and transmit some samples using the SSL session, and then jump back to sleep quicker.
7575

76-
`BearSSLSession` is an opaque class. Use the `BearSSL::WiFiClientSecure.setSession(&BearSSLSession)` method to apply it before the first `BearSSL::WiFiClientSecure.connect()` and it will be updated with session parameters during the operation of the connection. After the connection has had `.close()` called on it, serialize the `BearSSLSession` object to stable storage (EEPROM, RTC RAM, etc.) and restore it before trying to reconnect. See the `BearSSL_Sessions` example for a detailed example.
76+
`BearSSL::Session` is an opaque class. Use the `BearSSL::WiFiClientSecure.setSession(&BearSSLSession)` method to apply it before the first `BearSSL::WiFiClientSecure.connect()` and it will be updated with session parameters during the operation of the connection. After the connection has had `.close()` called on it, serialize the `BearSSL::Session` object to stable storage (EEPROM, RTC RAM, etc.) and restore it before trying to reconnect. See the `BearSSL_Sessions` example for a detailed example.
7777

7878
`Sessions <#sessions-resuming-connections-fast>`__ contains additional information on the sessions API.
7979

@@ -82,15 +82,15 @@ X.509 Certificate(s)
8282

8383
X509 certificates are used to identify peers in TLS connections. Normally only the server identifies itself, but the client can also supply an X509 certificate if desired (this is often done in MQTT applications). The certificate contains many fields, but the most interesting in our applications are the name, the public key, and potentially a chain of signing that leads back to a trusted authority (like a global internet CA or a company-wide private certificate authority).
8484

85-
Any call that takes an X509 certificate can also take a list of X509 certificates, so there is no special `X509` class, simply `BearSSLX509List` (which may only contain a single certificate).
85+
Any call that takes an X509 certificate can also take a list of X509 certificates, so there is no special `X509` class, simply `BearSSL::X509List` (which may only contain a single certificate).
8686

8787
Generating a certificate to be used to validate using the constructor
8888

8989
.. code:: cpp
9090
91-
BearSSLX509List(const char *pemX509);
91+
BearSSL::X509List(const char *pemX509);
9292
...or...
93-
BearSSLX509List(const uint8_t *derCert, size_t derLen);
93+
BearSSL::X509List(const uint8_t *derCert, size_t derLen);
9494
9595
If you need to add additional certificates (unlikely in normal operation), the `::append()` operation can be used.
9696

@@ -100,7 +100,7 @@ Certificate Stores
100100

101101
The web browser you're using to read this document keeps a list of 100s of certification authorities (CAs) worldwide that it trusts to attest to the identity of websites.
102102

103-
In many cases your application will know the specific CA it needs to validate web or MQTT servers against (often just a single, self-signing CA private to your institution). Simply load your private CA in a `BearSSLX509List` and use that as your trust anchor.
103+
In many cases your application will know the specific CA it needs to validate web or MQTT servers against (often just a single, self-signing CA private to your institution). Simply load your private CA in a `BearSSL::X509List` and use that as your trust anchor.
104104

105105
However, there are cases where you will not know beforehand which CA you will need (i.e. a user enters a website through a keypad), and you need to keep the list of CAs just like your web browser. In those cases, you need to generate a certificate bundle on the PC while compiling your application, upload the `certs.ar` bundle to SPIFFS or SD when uploading your application binary, and pass it to a `BearSSL::CertStore()` in order to validate TLS peers.
106106

@@ -129,7 +129,7 @@ setInsecure()
129129

130130
Don't verify any X509 certificates. There is no guarantee that the server connected to is the one you think it is in this case, but this call will mimic the behavior of the deprecated axTLS code.
131131

132-
setKnownKey(const BearSSLPublicKey *pk)
132+
setKnownKey(const BearSSL::PublicKey *pk)
133133
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134134
135135
Assume the server is using the specific public key. This does not verify the identity of the server or the X509 certificate it sends, it simply assumes that its public key is the one given. If the server updates its public key at a later point then connections will fail.
@@ -139,7 +139,7 @@ setFingerprint(const uint8_t fp[20]) / setFingerprint(const char *fpStr)
139139
140140
Verify the SHA1 fingerprint of the certificate returned matches this one. If the server certificate changes, it will fail. If an array of 20 bytes are sent in, it is assumed they are the binary SHA1 values. If a `char*` string is passed in, it is parsed as a series of human-readable hex values separated by spaces or colons (e.g. `setFingerprint("00:01:02:03:...:1f");`)
141141

142-
setTrustAnchors(BearSSLX509List *ta)
142+
setTrustAnchors(BearSSL::X509List *ta)
143143
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144144
145145
Use the passed-in certificate(s) as a trust anchor, accepting remote certificates signed by any of these. If you have many trust anchors it may make sense to use a `BearSSL::CertStore` because it will only require RAM for a single trust anchor (while the `setTrustAnchors` call requires memory for all certificates in the list).
@@ -183,7 +183,7 @@ In certain applications where the TLS server does not support MFLN (not many do
183183
Sessions (Resuming connections fast)
184184
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185185

186-
setSession(BearSSLSession &sess)
186+
setSession(BearSSL::Session &sess)
187187
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
188188

189189
If you are connecting to a server repeatedly in a fixed time period (usually 30 or 60 minutes, but normally configurable at the server), a TLS session can be used to cache crypto settings and speed up connections significantly.
@@ -212,5 +212,3 @@ setCiphersLessSecure()
212212
^^^^^^^^^^^^^^^^^^^^^^
213213

214214
Helper function which essentially limits BearSSL to ciphers that were supported by the deprecated axTLS. These may be less secure than the ones BearSSL would natively choose, but they may be helpful and faster if your server depended on specific axTLS crypto options.
215-
216-

doc/esp8266wifi/bearssl-server-secure-class.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ This example command will generate a RSA 2048-bit key and certificate:
2323
2424
Again, it is up to the application author to generate this certificate and key and keep the private key safe and **private.**
2525

26-
setRSACert(const BearSSLX509List *chain, const BearSSLPrivateKey *sk)
26+
setRSACert(const BearSSL::X509List *chain, const BearSSL::PrivateKey *sk)
2727
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2828
2929
Sets a RSA certificate and key to be used by the server when connections are received. Needs to be called before `begin()`
3030

31-
setECCert(const BearSSLX509List *chain, unsigned cert_issuer_key_type, const BearSSLPrivateKey *sk)
31+
setECCert(const BearSSL::X509List *chain, unsigned cert_issuer_key_type, const BearSSL::PrivateKey *sk)
3232
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3333
3434
Sets an elliptic curve certificate and key for the server. Needs to be called before `begin()`.
@@ -38,7 +38,7 @@ Requiring Client Certificates
3838

3939
TLS servers can request the client to identify itself by transmitting a certificate during handshake. If the client cannot transmit the certificate, the connection will be dropped by the server.
4040

41-
setClientTrustAnchor(const BearSSLX509List *client_CA_ta)
41+
setClientTrustAnchor(const BearSSL::X509List *client_CA_ta)
4242
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4343
4444
Sets the trust anchor (normally a self-signing CA) that all received certificates will be verified against. Needs to be called before `begin()`.

libraries/ESP8266WiFi/src/BearSSLHelpers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class X509List {
125125
// significantly faster. Completely optional.
126126
class WiFiClientSecure;
127127

128-
class SSLSession {
128+
class Session {
129129
friend class WiFiClientSecure;
130130

131131
public:

0 commit comments

Comments
 (0)