How To Install Using Arduino Library Manager
Why do we need this EthernetWebServer_SSL_STM32 Library
This EthernetWebServer_SSL_STM32 Library is a simple yet complete TLS/SSL WebClient and non-TLS/SSL WebServer library for STM32F/L/H/G/WB/MP1 boards using Ethernet shields. The functions are similar and compatible to those of ESP32 WebServer and ESP8266WebServer libraries to make life much easier to port sketches from ESP8266/ESP32.
This EthernetWebServer_SSL_STM32 Library adds TLS 1.2 functionality to EthernetClient, using BearSSL as an underlying TLS engine.
Releases v1.1.0
1. Initial coding for STM32F/L/H/G/WB/MP1 boards (with 32+K Flash) running LAN8742A, W5x00 or ENC28J60 shields using SSL.
2. Supporting Built-in LAN8742A using STM32Ethernet library.
3. Supporting W5x00 using Ethernet, EthernetLarge, Ethernet2 and Ethernet3 libraries
4. Supporting ENC28J60 using EthernetENC and UIPEthernet libraries
Currently Supported Boards
1. STM32 boards with built-in Ethernet LAN8742A such as :
- Nucleo-144 (F429ZI, F767ZI)
- Discovery (STM32F746G-DISCOVERY)
- All STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet
2. STM32F/L/H/G/WB/MP1 boards (with 32+K Flash) running W5x00 or ENC28J60 shields)
- Nucleo-144
- Nucleo-64
- Discovery
- Generic STM32F0, STM32F1, STM32F2, STM32F3, STM32F4, STM32F7 (with 64+K Flash): x8 and up
- STM32L0, STM32L1, STM32L4
- STM32G0, STM32G4
- STM32H7
- STM32WB
- STM32MP1
- LoRa boards
- 3-D printer boards
- Generic Flight Controllers
- Midatronics boards
Examples:
1. AdvancedWebServer
2. HelloServer
3. HelloServer2
4. HttpBasicAuth
5. MQTTClient_Auth
6. MQTTClient_Basic
7. MQTTClient_SSL
8. MQTTClient_SSL_Auth
9. PostServer
10. SimpleAuthentication
11. UdpNTPClient
12. UdpSendReceive
13. WebClient
14. WebClientMulti_SSL
15. WebClientRepeating
16. WebClient_SSL
17. WebServer
Debug Termimal Output Samples
1. The following is the sample terminal output when running example WebClient_SSL on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Code: Select all
Start WebClient_SSL on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Default SPI pinout:
[ETHERNET_WEBSERVER] MOSI: 11
[ETHERNET_WEBSERVER] MISO: 12
[ETHERNET_WEBSERVER] SCK: 13
[ETHERNET_WEBSERVER] SS: 10
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Board : NUCLEO_F767ZI , setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:11
MISO:12
SCK:13
SS:10
=========================
Using mac index = 10
Connected! IP address: 192.168.2.139
Connecting to : www.arduino.cc, port : 443
Connected to www.arduino.cc
Took: 480
Using micros()
2A 5C A7 84 DC 48 AB 3E C6 80 4E E D8 88 4C FE
Using analogRead()
3E 76 9B B8 CD E9 F4 FE 8 D 12 14 C 1B 20 1D
HTTP/1.1 200 OK
Date: Tue, 10 Nov 2020 08:33:53 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Connection: close
Set-Cookie: __cfduid=de77338a7e6c914c4dd309cecf5dcdb3b1604997233; expires=Thu, 10-Dec-20 08:33:53 GMT; path=/; domain=.arduino.cc; HttpOnly; SameSite=Lax
Last-Modified: Wed, 02 Oct 2013 13:46:47 GMT
Vary: Accept-Encoding
Access-Control-Allow-Origin: https://www.arduino.cc
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With
Strict-Transport-Security: max-age=500; includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
CF-Cache-Status: DYNAMIC
cf-request-id: 0652e352a40000b683be849000000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-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; ,;, ;;;,`;, ;; ;;
;; ;: ;; ;; ;; ;; .;; ;; ,;, ;;;;`;, ;; ;;.
;: ;; ;;;;;: ;; ;; .;; ;; ,;, ;;`;;;, ;; ;;`
,;;;;; ;;`;; ;; ;; .;; ;; ,;, ;; ;;;, ;; ;;
;; ,;, ;; .;; ;;;;;: ;;;;;: ,;;;;;: ;; ;;, ;;;;;;
;; ;; ;; ;;` ;;;;. `;;;: ,;;;;;, ;; ;;, ;;;;
0
(EthernetSSLClient)(SSL_WARN)(connected): Socket was dropped unexpectedly (this can be an alternative to closing the connection)
Disconnecting.
Received 3324 bytes in 0.5398 s, rate = 6.16 kbytes/second
Code: Select all
Start WebClientMulti_SSL on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Default SPI pinout:
[ETHERNET_WEBSERVER] MOSI: 11
[ETHERNET_WEBSERVER] MISO: 12
[ETHERNET_WEBSERVER] SCK: 13
[ETHERNET_WEBSERVER] SS: 10
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Board : NUCLEO_F767ZI , setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:11
MISO:12
SCK:13
SS:10
=========================
Using mac index = 10
Connected! IP address: 192.168.2.139
Connecting to www.arduino.cc...
Took: 2261
HTTP/1.1 200 OK
Date: Tue, 10 Nov 2020 09:24:02 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Connection: close
Set-Cookie: __cfduid=d588a3b3b35b8e56eb1b7031f46c283b91605000242; expires=Thu, 10-Dec-20 09:24:02 GMT; path=/; domain=.arduino.cc; HttpOnly; SameSite=Lax
Last-Modified: Wed, 02 Oct 2013 13:46:47 GMT
Vary: Accept-Encoding
Access-Control-Allow-Origin: https://www.arduino.cc
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With
Strict-Transport-Security: max-age=500; includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
CF-Cache-Status: DYNAMIC
cf-request-id: 0653113b580000b65f28017000000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5efeb7d88c03b65f-YWG
8d7
`:;;;,` .:;;:.
.;;;;;;;;;;;` :;;;;;;;;;;: TM
`;;;;;;;;;;;;;;;` :;;;;;;;;;;;;;;;
:;;;;;;;;;;;;;;;;;; `;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;; .;;;;;;;;;;;;;;;;;;;;
;;;;;;;;:` `;;;;;;;;; ,;;;;;;;;.` .;;;;;;;;
.;;;;;;, :;;;;;;; .;;;;;;; ;;;;;;;
;;;;;; ;;;;;;; ;;;;;;, ;;;;;;.
,;;;;; ;;;;;;.;;;;;;` ;;;;;;
;;;;;. ;;;;;;;;;;;` ``` ;;;;;`
;;;;; ;;;;;;;;;, ;;; .;;;;;
`;;;;: `;;;;;;;; ;;; ;;;;;
,;;;;` `,,,,,,,, ;;;;;;; .,,;;;,,, ;;;;;
:;;;;` .;;;;;;;; ;;;;;, :;;;;;;;; ;;;;;
:;;;;` .;;;;;;;; `;;;;;; :;;;;;;;; ;;;;;
.;;;;. ;;;;;;;. ;;; ;;;;;
;;;;; ;;;;;;;;; ;;; ;;;;;
;;;;; .;;;;;;;;;; ;;; ;;;;;,
;;;;;; `;;;;;;;;;;;; ;;;;;
`;;;;;, .;;;;;; ;;;;;;; ;;;;;;
;;;;;;: :;;;;;;. ;;;;;;; ;;;;;;
;;;;;;;` .;;;;;;;, ;;;;;;;; ;;;;;;;:
;;;;;;;;;:,:;;;;;;;;;: ;;;;;;;;;;:,;;;;;;;;;;
`;;;;;;;;;;;;;;;;;;;. ;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;; :;;;;;;;;;;;;;;;;:
,;;;;;;;;;;;;;, ;;;;;;;;;;;;;;
.;;;;;;;;;` ,;;;;;;;;:
;;; ;;;;;` ;;;;: .;; ;; ,;;;;;, ;;. `;, ;;;;
;;; ;;:;;; ;;;;;; .;; ;; ,;;;;;: ;;; `;, ;;;:;;
,;:; ;; ;; ;; ;; .;; ;; ,;, ;;;,`;, ;; ;;
;; ;: ;; ;; ;; ;; .;; ;; ,;, ;;;;`;, ;; ;;.
;: ;; ;;;;;: ;; ;; .;; ;; ,;, ;;`;;;, ;; ;;`
,;;;;; ;;`;; ;; ;; .;; ;; ,;, ;; ;;;, ;; ;;
;; ,;, ;; .;; ;;;;;: ;;;;;: ,;;;;;: ;; ;;, ;;;;;;
;; ;; ;; ;;` ;;;;. `;;;: ,;;;;;, ;; ;;, ;;;;
0
(EthernetSSLClient)(SSL_WARN)(connected): Socket was dropped unexpectedly (this can be an alternative to closing the connection)
Disconnecting.
Received 3324 bytes in 0.3587 s, rate = 9.27 kbytes/second
Connecting to www.cloudflare.com...
Took: 1683
HTTP/1.1 200 OK
Date: Tue, 10 Nov 2020 09:24:09 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Connection: close
Set-Cookie: __cfduid=d14958859d5dad28f89ca90056c3547b91605000249; expires=Thu, 10-Dec-20 09:24:09 GMT; path=/; domain=.www.cloudflare.com; HttpOnly; SameSite=Lax; Secure
Access-Control-Allow-Origin: *
Server: cloudflare
CF-RAY: 5efeb8061b0eb65f-YWG
X-Frame-Options: SAMEORIGIN
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Cache-Control: no-cache
bb
fl=168f4
h=www.cloudflare.com
ip=76.10.180.220
ts=1605000249.298
visit_scheme=https
uag=SSLClientOverEthernet
colo=YWG
http=http/1.1
loc=CA
tls=TLSv1.2
sni=plaintext
warp=off
gateway=off
0
(EthernetSSLClient)(SSL_WARN)(connected): Socket was dropped unexpectedly (this can be an alternative to closing the connection)
Disconnecting.
Received 3998 bytes in 0.0656 s, rate = 60.98 kbytes/second
3. The following is the sample terminal output when running example WebClient_SSL on NUCLEO_F767ZI with W5x00 & Ethernet3 Library
Code: Select all
Start WebClient_SSL on NUCLEO_F767ZI with W5x00 & Ethernet3 Library
[ETHERNET_WEBSERVER] =========== USE_ETHERNET3 ===========
[ETHERNET_WEBSERVER] Default SPI pinout:
[ETHERNET_WEBSERVER] MOSI: 11
[ETHERNET_WEBSERVER] MISO: 12
[ETHERNET_WEBSERVER] SCK: 13
[ETHERNET_WEBSERVER] SS: 10
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Board : NUCLEO_F767ZI , setCsPin: 10
Ethernet3 W5500 init, using SPI_CS = 10, number of sockets = 4
=========================
Currently Used SPI pinout:
MOSI:11
MISO:12
SCK:13
SS:10
SPI_CS:10
=========================
Using mac index = 10
Connected! IP address: 192.168.2.139
Connecting to : www.arduino.cc, port : 443
Connected to www.arduino.cc
Took: 421
HTTP/1.1 200 OK
Date: Tue, 10 Nov 2020 08:42:12 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Connection: close
Set-Cookie: __cfduid=dc0d46f4fc488c76630a1c7327c64d5861604997732; expires=Thu, 10-Dec-20 08:42:12 GMT; path=/; domain=.arduino.cc; HttpOnly; SameSite=Lax
Last-Modified: Wed, 02 Oct 2013 13:46:47 GMT
Vary: Accept-Encoding
Access-Control-Allow-Origin: https://www.arduino.cc
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With
Strict-Transport-Security: max-age=500; includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
CF-Cache-Status: DYNAMIC
cf-request-id: 0652eaf1aa0000cabc368f8000000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5efe7a95dacecabc-YYZ
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
8d7
`:;;;,` .:;;:.
.;;;;;;;;;;;` :;;;;;;;;;;: TM
`;;;;;;;;;;;;;;;` :;;;;;;;;;;;;;;;
:;;;;;;;;;;;;;;;;;; `;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;; .;;;;;;;;;;;;;;;;;;;;
;;;;;;;;:` `;;;;;;;;; ,;;;;;;;;.` .;;;;;;;;
.;;;;;;, :;;;;;;; .;;;;;;; ;;;;;;;
;;;;;; ;;;;;;; ;;;;;;, ;;;;;;.
,;;;;; ;;;;;;.;;;;;;` ;;;;;;
;;;;;. ;;;;;;;;;;;` ``` ;;;;;`
;;;;; ;;;;;;;;;, ;;; .;;;;;
`;;;;: `;;;;;;;; ;;; ;;;;;
,;;;;` `,,,,,,,, ;;;;;;; .,,;;;,,, ;;;;;
:;;;;` .;;;;;;;; ;;;;;, :;;;;;;;; ;;;;;
:;;;;` .;;;;;;;; `;;;;;; :;;;;;;;; ;;;;;
.;;;;. ;;;;;;;. ;;; ;;;;;
;;;;; ;;;;;;;;; ;;; ;;;;;
;;;;; .;;;;;;;;;; ;;; ;;;;;,
;;;;;; `;;;;;;;;;;;; ;;;;;
`;;;;;, .;;;;;; ;;;;;;; ;;;;;;
;;;;;;: :;;;;;;. ;;;;;;; ;;;;;;
;;;;;;;` .;;;;;;;, ;;;;;;;; ;;;;;;;:
;;;;;;;;;:,:;;;;;;;;;: ;;;;;;;;;;:,;;;;;;;;;;
`;;;;;;;;;;;;;;;;;;;. ;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;; :;;;;;;;;;;;;;;;;:
,;;;;;;;;;;;;;, ;;;;;;;;;;;;;;
.;;;;;;;;;` ,;;;;;;;;:
;;; ;;;;;` ;;;;: .;; ;; ,;;;;;, ;;. `;, ;;;;
;;; ;;:;;; ;;;;;; .;; ;; ,;;;;;: ;;; `;, ;;;:;;
,;:; ;; ;; ;; ;; .;; ;; ,;, ;;;,`;, ;; ;;
;; ;: ;; ;; ;; ;; .;; ;; ,;, ;;;;`;, ;; ;;.
;: ;; ;;;;;: ;; ;; .;; ;; ,;, ;;`;;;, ;; ;;`
,;;;;; ;;`;; ;; ;; .;; ;; ,;, ;; ;;;, ;; ;;
;; ,;, ;; .;; ;;;;;: ;;;;;: ,;;;;;: ;; ;;, ;;;;;;
;; ;; ;; ;;` ;;;;. `;;;: ,;;;;;, ;; ;;, ;;;;
0
(EthernetSSLClient)(SSL_WARN)(connected): Socket was dropped unexpectedly (this can be an alternative to closing the connection)
Disconnecting.
Received 3405 bytes in 0.4360 s, rate = 7.81 kbytes/second