Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 74e02d1

Browse filesBrowse files
authored
basichttpsclient example: fingerprint handled by update scripts (esp8266#8311)
* basichttpsclient example: fingerprint handled by update scripts
1 parent be02af0 commit 74e02d1
Copy full SHA for 74e02d1

File tree

Expand file treeCollapse file tree

3 files changed

+71
-13
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+71
-13
lines changed

‎libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino

Copy file name to clipboardExpand all lines: libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino
+11-13Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99

1010
#include <ESP8266WiFi.h>
1111
#include <ESP8266WiFiMulti.h>
12-
1312
#include <ESP8266HTTPClient.h>
14-
1513
#include <WiFiClientSecureBearSSL.h>
16-
// Fingerprint for demo URL, expires on June 2, 2021, needs to be updated well before this date
17-
const uint8_t fingerprint[20] = { 0x40, 0xaf, 0x00, 0x6b, 0xec, 0x90, 0x22, 0x41, 0x8e, 0xa3, 0xad, 0xfa, 0x1a, 0xe8, 0x25, 0x41, 0x1d, 0x1a, 0x54, 0xb3 };
14+
15+
#include "certs.h"
16+
17+
#ifndef STASSID
18+
#define STASSID "your-ssid"
19+
#define STAPSK "your-password"
20+
#endif
1821

1922
ESP8266WiFiMulti WiFiMulti;
2023

@@ -27,14 +30,9 @@ void setup() {
2730
Serial.println();
2831
Serial.println();
2932

30-
for (uint8_t t = 4; t > 0; t--) {
31-
Serial.printf("[SETUP] WAIT %d...\n", t);
32-
Serial.flush();
33-
delay(1000);
34-
}
35-
3633
WiFi.mode(WIFI_STA);
37-
WiFiMulti.addAP("SSID", "PASSWORD");
34+
WiFiMulti.addAP(STASSID, STAPSK);
35+
Serial.println("setup() done connecting to ssid '" STASSID "'");
3836
}
3937

4038
void loop() {
@@ -43,14 +41,14 @@ void loop() {
4341

4442
std::unique_ptr<BearSSL::WiFiClientSecure> client(new BearSSL::WiFiClientSecure);
4543

46-
client->setFingerprint(fingerprint);
44+
client->setFingerprint(fingerprint_sni_cloudflaressl_com);
4745
// Or, if you happy to ignore the SSL certificate, then use the following line instead:
4846
// client->setInsecure();
4947

5048
HTTPClient https;
5149

5250
Serial.print("[HTTPS] begin...\n");
53-
if (https.begin(*client, "https://jigsaw.w3.org/HTTP/connection.html")) { // HTTPS
51+
if (https.begin(*client, jigsaw_host, jigsaw_port)) { // HTTPS
5452

5553
Serial.print("[HTTPS] GET...\n");
5654
// start connection and send HTTP header
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cd ${0%/*} 2>/dev/null
2+
python3 ../../../../tools/cert.py -s jigsaw.w3.org -n jigsaw > certs.h
+58Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
// this file is autogenerated - any modification will be overwritten
3+
// unused symbols will not be linked in the final binary
4+
// generated on 2023-02-08 22:18:50
5+
// by ['../../../../tools/cert.py', '-s', 'jigsaw.w3.org', '-n', 'jigsaw']
6+
7+
#pragma once
8+
9+
////////////////////////////////////////////////////////////
10+
// certificate chain for jigsaw.w3.org:443
11+
12+
const char* jigsaw_host = "jigsaw.w3.org";
13+
const uint16_t jigsaw_port = 443;
14+
15+
// CN: sni.cloudflaressl.com => name: sni_cloudflaressl_com
16+
// not valid before: 2022-03-17 00:00:00
17+
// not valid after: 2023-03-16 23:59:59
18+
const char fingerprint_sni_cloudflaressl_com [] PROGMEM = "29:c7:3d:b3:50:36:83:0b:90:c1:9c:e0:ef:71:72:b1:3f:c7:31:e1";
19+
const char pubkey_sni_cloudflaressl_com [] PROGMEM = R"PUBKEY(
20+
-----BEGIN PUBLIC KEY-----
21+
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEYnkGDyrIltjRnxoVdy/xgndo+WGM
22+
OASzs2hHeCjbJ1KplKJc/ciKXCWq/4+pTzSiVgTFhRmCdLcU1Fa05YFNQQ==
23+
-----END PUBLIC KEY-----
24+
)PUBKEY";
25+
26+
// http://cacerts.digicert.com/CloudflareIncECCCA-3.crt
27+
// CN: Cloudflare Inc ECC CA-3 => name: Cloudflare_Inc_ECC_CA_3
28+
// not valid before: 2020-01-27 12:48:08
29+
// not valid after: 2024-12-31 23:59:59
30+
const char cert_Cloudflare_Inc_ECC_CA_3 [] PROGMEM = R"CERT(
31+
-----BEGIN CERTIFICATE-----
32+
MIIDzTCCArWgAwIBAgIQCjeHZF5ftIwiTv0b7RQMPDANBgkqhkiG9w0BAQsFADBa
33+
MQswCQYDVQQGEwJJRTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJl
34+
clRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTIw
35+
MDEyNzEyNDgwOFoXDTI0MTIzMTIzNTk1OVowSjELMAkGA1UEBhMCVVMxGTAXBgNV
36+
BAoTEENsb3VkZmxhcmUsIEluYy4xIDAeBgNVBAMTF0Nsb3VkZmxhcmUgSW5jIEVD
37+
QyBDQS0zMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEua1NZpkUC0bsH4HRKlAe
38+
nQMVLzQSfS2WuIg4m4Vfj7+7Te9hRsTJc9QkT+DuHM5ss1FxL2ruTAUJd9NyYqSb
39+
16OCAWgwggFkMB0GA1UdDgQWBBSlzjfq67B1DpRniLRF+tkkEIeWHzAfBgNVHSME
40+
GDAWgBTlnVkwgkdYzKz6CFQ2hns6tQRN8DAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0l
41+
BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMBIGA1UdEwEB/wQIMAYBAf8CAQAwNAYI
42+
KwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2VydC5j
43+
b20wOgYDVR0fBDMwMTAvoC2gK4YpaHR0cDovL2NybDMuZGlnaWNlcnQuY29tL09t
44+
bmlyb290MjAyNS5jcmwwbQYDVR0gBGYwZDA3BglghkgBhv1sAQEwKjAoBggrBgEF
45+
BQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzALBglghkgBhv1sAQIw
46+
CAYGZ4EMAQIBMAgGBmeBDAECAjAIBgZngQwBAgMwDQYJKoZIhvcNAQELBQADggEB
47+
AAUkHd0bsCrrmNaF4zlNXmtXnYJX/OvoMaJXkGUFvhZEOFp3ArnPEELG4ZKk40Un
48+
+ABHLGioVplTVI+tnkDB0A+21w0LOEhsUCxJkAZbZB2LzEgwLt4I4ptJIsCSDBFe
49+
lpKU1fwg3FZs5ZKTv3ocwDfjhUkV+ivhdDkYD7fa86JXWGBPzI6UAPxGezQxPk1H
50+
goE6y/SJXQ7vTQ1unBuCJN0yJV0ReFEQPaA1IwQvZW+cwdFD19Ae8zFnWSfda9J1
51+
CZMRJCQUzym+5iPDuI9yP+kHyCREU3qzuWFloUwOxkgAyXVjBYdwRVKD05WdRerw
52+
6DEdfgkfCv4+3ao8XnTSrLE=
53+
-----END CERTIFICATE-----
54+
)CERT";
55+
56+
// end of certificate chain for jigsaw.w3.org:443
57+
////////////////////////////////////////////////////////////
58+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.