1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

90 Commits

Author SHA1 Message Date
Earle F. Philhower, III
e3c970210f
Add BearSSL client and server, support true bidir, lower memory, modern SSL (#4273)
BearSSL (https://www.bearssl.org) is a TLS(SSL) library written by
Thomas Pornin that is optimized for lower-memory embedded systems
like the ESP8266. It supports a wide variety of modern ciphers and
is unique in that it doesn't perform any memory allocations during
operation (which is the unfortunate bane of the current axTLS).

BearSSL is also absolutely focused on security and by default performs
all its security checks on x.509 certificates during the connection
phase (but if you want to be insecure and dangerous, that's possible
too).

While it does support unidirectional SSL buffers, like axTLS,
as implemented the ESP8266 wrappers only support bidirectional
buffers. These bidirectional buffers avoid deadlocks in protocols
which don't have well separated receive and transmit periods.

This patch adds several classes which allow connecting to TLS servers
using this library in almost the same way as axTLS:
BearSSL::WiFiClientSecure - WiFiClient that supports TLS
BearSSL::WiFiServerSecure - WiFiServer supporting TLS and client certs

It also introduces objects for PEM/DER encoded keys and certificates:
BearSSLX509List - x.509 Certificate (list) for general use
BearSSLPrivateKey - RSA or EC private key
BearSSLPublicKey - RSA or EC public key (i.e. from a public website)

Finally, it adds a Certificate Authority store object which lets
BearSSL access a set of trusted CA certificates on SPIFFS to allow it
to verify the identity of any remote site on the Internet, without
requiring RAM except for the single matching certificate.
CertStoreSPIFFSBearSSL - Certificate store utility

Client certificates are supported for the BearSSL::WiFiClientSecure, and
what's more the BearSSL::WiFiServerSecure can also *require* remote clients
to have a trusted certificate signed by a specific CA (or yourself with
self-signing CAs).

Maximum Fragment Length Negotiation probing and usage are supported, but
be aware that most sites on the Internet don't support it yet.  When
available, you can reduce the memory footprint of the SSL client or server
dramatically (i.e. down to 2-8KB vs. the ~22KB required for a full 16K
receive fragment and 512b send fragment).  You can also manually set a
smaller fragment size and guarantee at your protocol level all data will
fit within it.

Examples are included to show the usage of these new features.

axTLS has been moved to its own namespace, "axtls".  A default "using"
clause allows existing apps to run using axTLS without any changes.

The BearSSL::WiFi{client,server}Secure implements the axTLS
client/server API which lets many end user applications take advantage
of BearSSL with few or no changes.

The BearSSL static library used presently is stored at
https://github.com/earlephilhower/bearssl-esp8266 and can be built
using the standard ESP8266 toolchain.
2018-05-14 20:46:47 -07:00
Ivan Grokhotkov
61cd8d8385 examples: format all .ino files
This formats all the example source files using Arduino style rules.
2018-03-08 14:32:06 +08:00
Earle F. Philhower, III
f9ac524b13
Add -Werror to acceptance builds for C and CPP (#4369)
Use platform.local.txt to add -Werror to GCC for the build of all
code.  Any warnings on a submitted patch will cause an error.

Several examples and libraries had warnings/errors (missing returns
on functions, types, etc.).  Clean those up with this commit as well.
2018-02-17 18:47:10 -08:00
Earle F. Philhower, III
c8dbfb160b Refrech api.github.com x509 certificate (#4306)
The certificate fingerprint included with the HTTPSRequest example seems
to be for an expired api.github.com certificate.  Replace with the current
one to avoid reporting "certificate mismatch" errors when running.
2018-02-06 11:06:05 -03:00
NameOfTheRose
84228b1c73 Nameoftherose patch for Issue #2435 (#4256)
* WiFiTelnetToSerial Example - Minor Issues #2435

* WiFiTelnetToSerial Example - Minor Issues #2435

Patch to rectify issue #2435
2018-01-29 13:28:28 -03:00
Earle F. Philhower, III
bd1c7ce1dc Add SSL enabled WiFiServer, Updater, WebServer
Adds SSL server mode for WiFiServerSecure, for plain SSL connections,
ESP8266WebServerSecure, for HTTPS web serving, and SecureHTTPSUpdater for
encrypted OTA updates.

Example code is provided for all new options, as well as a BASH script for
generating their own, self-signed certificates.

Both ESP8266WebServerSecure and SecureHTTPSUpdater are important for secure
password-based authentication.  HTTP Basic Authentication, the only supported
model presently, sends the username and password in *cleartext* and therefore
should *never* be used in any un-SSL encrypted channel unless you don't mind
sharing your login and password with anyone else on the internet.  Even if the
ESP8266 is not safety critical, this cleartext broadcast could expose you should
you reuse this password elsewhere on your network or the internet.
2018-01-10 11:56:32 +08:00
Hans Winzell
7dd50360b9 Fix bug in WiFiClientBasic.ino (#3902) 2017-12-28 09:47:10 -03:00
david gauchard
d5bb4a99f6 in example properly wait for NTP to be set (#4000)
fix #3905
2017-12-21 16:27:58 -03:00
Develo
7df2858285
Fix comment misnomer (#3939) 2017-12-08 15:58:46 -03:00
Rotzbua
31abb6e5e1 [doc] update HTTPSRequest.ino (#3925)
add limitations of https connections
2017-12-08 03:38:19 -03:00
James Stanley
2abbc36da4 Put WiFi into station mode in examples (#3731) 2017-10-22 13:53:01 +08:00
Ivan Grokhotkov
84b046f98c WiFiClientSecure: add support for keys and certificates in PROGMEM 2017-10-08 05:04:04 +08:00
Ivan Grokhotkov
a8e8ecb687 WiFiClientSecure: add example of setCACert/verifyCertChain
Ref #1851
2017-05-21 22:00:33 -05:00
Ivan Grokhotkov
808bf50ff2 wifi: add SoftAPModeProbeRequestReceived event handler (#2917)
- add probe request event handler (#2910)
- update WiFi events handling example to use new handler

Pro tip: replace blinking LED with ‘analogWrite’ and connect the pin to
a loudspeaker (or use a servo to hit a bell). Get notified when someone
with a smartphone wanders around your country house.
2017-02-06 13:24:34 +03:00
WereCatf
d46d742db1 Use WIFI_STA in WiFiClient-examples
Many people have problems with using ESP8266 as WiFi-client due to
none of the examples mentioning that you should use WIFI_STA if you
only want the ESP8266 to act as a WiFi-client. Many WiFi-devices
will randomly try to connect to the ESP8266 if used as STA+AP and
complain about not being able to access the Internet or other devices
on the network.
2016-10-29 12:40:06 +03:00
Hemal Chevli
e4e182a966 Rectified mistake in if condition
thanks to @chaeplin for finding the mistake
2016-04-05 13:12:22 +05:30
Hemal Chevli
81859c5df6 Changed timeout logic
Changed timeout to unsigned long. Using addition with millis() is not recommended. 
Source: http://www.gammon.com.au/millis
2016-04-05 10:53:15 +05:30
Markus Sattler
0ed104f028 add WiFi Event example 2015-12-29 14:38:13 +01:00
Martin Ayotte
e166e85f73 oupps ! I forgot to set the timout value 2015-12-06 09:47:00 -05:00
Martin Ayotte
6fa70bda01 replace delay with while loop in WiFiClient.ino 2015-12-06 09:42:51 -05:00
Markus Sattler
cedce24bf3 rename to WiFiClientBasic 2015-12-04 19:07:51 +01:00
Markus Sattler
34571a0e9d typo 2015-12-04 18:20:40 +01:00
Markus Sattler
2ebc7c9dc1 Merge remote-tracking branch 'remotes/esp8266/master' 2015-12-04 18:18:57 +01:00
Markus Sattler
8cec66b23b add a simple TCP example 2015-12-04 18:18:23 +01:00
Ivan Grokhotkov
14b70e9328 Allow setting client side TLS key and certificate 2015-12-04 19:02:46 +03:00
Ivan Grokhotkov
f73d414f38 WiFiClientSecure: add certificate fingerprint verification (#43) 2015-09-14 10:22:54 +03:00
Ivan Grokhotkov
c970dec6a7 Add HTTPS request sample (#43) 2015-09-13 22:50:14 +03:00
Bertus Kruger
ef9b324ffd Changed Telnet Port to port 23
Best to stick to standard port numbers
https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
2015-07-14 09:04:12 +12:00
Peter Newman
b7451114fd Don't wait for a connection to an AP when we're supposed to be the AP. 2015-06-19 20:57:19 +03:00
Wietse van Buitenen
5c1ee1f7ad Use correct variable for sendNTPpacket 2015-05-31 13:04:11 +02:00
moeur
72ab7cd41c Update NTPClient.ino
Instead of hardwiring the IP address of one server into the program, look-up an IP address from the host name.  This way you get a random server from the pool each time.
2015-05-26 07:55:56 -07:00
Ivan Grokhotkov
85ebee75b4 Fix case in WiFiMulti example 2015-05-19 09:23:47 +03:00
Ivan Grokhotkov
6971cec922 Merge pull request #260 from UECIDE/esp8266
Two new examples
2015-05-18 14:29:24 +03:00
Matt Jenkins
af533d6c5c Added missing include needed for Arduino IDE 2015-05-17 20:01:42 +01:00
Matt Jenkins
0ac29dcd09 Added access point example 2015-05-17 19:59:25 +01:00
Markus Sattler
508f0802d5 add examples/WiFiMulti/WiFiMulti.ino 2015-05-16 22:47:29 +02:00
ficeto
7512339b0c remove qsort dependency and add TelnetToSerial example 2015-05-12 20:41:31 +03:00
Ivan Grokhotkov
b026daf43b Fix UdpClient semantics, add NTPClient example
UdpClient used to create a new socket for each begin/beginPacket call. This made bidirectional communication impossible.
Fix #64, fix #53.
2015-04-12 01:09:45 +08:00
Ivan Grokhotkov
af99a3e388 Remove unused rx_buffer_size argument from WebServer constructor 2015-01-08 00:39:46 +03:00
Ivan Grokhotkov
d849f2298f Add samples for the ESP8266WiFi library 2014-12-23 15:39:48 +03:00