Skip to content

Commit

Permalink
Update sll cert #297
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Jan 13, 2025
1 parent 803ea3c commit 7581703
Showing 1 changed file with 76 additions and 27 deletions.
103 changes: 76 additions & 27 deletions examples/factory/factory.ino
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,80 @@
// The factory program uses the Chinese time zone by default.
// Commenting this line will automatically get the time zone, provided that the SSL certificate is valid.
// Please pay attention to check the validity of the certificate.
// The current configuration certificate is valid until April 16, 2024
#define CUSTOM_TIMEZONE "CST-8"
// The current configuration certificate is valid until Mar 29 22:40:08 2025 GMT

// #define CUSTOM_TIMEZONE "CST-8"


#ifndef CUSTOM_TIMEZONE
// Use command get server ca
// openssl s_client -connect ipapi.co:443 -showcerts </dev/null 2> /dev/null | sed -n '/BEGIN/,/END/p' > server.pem

// Check the validity period of the certificate
// openssl s_client -connect ipapi.co:443 -servername ipapi.co 2>/dev/null | openssl x509 -noout -dates
static const char *rootCACertificate PROGMEM = R"EOF(
-----BEGIN CERTIFICATE-----
MIIDmjCCA0GgAwIBAgIQKNsg9z6tYmQOV0wv+VFSyTAKBggqhkjOPQQDAjA7MQsw
CQYDVQQGEwJVUzEeMBwGA1UEChMVR29vZ2xlIFRydXN0IFNlcnZpY2VzMQwwCgYD
VQQDEwNXRTEwHhcNMjQxMjI5MjE0MDEwWhcNMjUwMzI5MjI0MDA4WjATMREwDwYD
VQQDEwhpcGFwaS5jbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABEfuWuJphWh5
CzoKqMJvfBA4v977Vu79l4P5aCtOPVPVBvNTxzdLwMvMp2XVas46AVCm/B4PODlw
PxeL6BzYYMSjggJNMIICSTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYB
BQUHAwEwDAYDVR0TAQH/BAIwADAdBgNVHQ4EFgQU/2QCuuN/r4UoC67WpNau15Ex
i4YwHwYDVR0jBBgwFoAUkHeSNWfE/6jMqeZ72YB5e8yT+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1r1WEYNa5A3XP3iZEwWus87oV8okB2O6nGuEfYKueSkWpz6bFyOZ8pn6KY019e
WIZlD6GEZQbR3IvJx3PIjGov5cSr0R2Ko4H/MIH8MA4GA1UdDwEB/wQEAwIBhjAd
BgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDwYDVR0TAQH/BAUwAwEB/zAd
BgNVHQ4EFgQUgEzW63T/STaj1dj8tT7FavCUHYwwHwYDVR0jBBgwFoAUYHtmGkUN
l8qJUC99BM00qP/8/UswNgYIKwYBBQUHAQEEKjAoMCYGCCsGAQUFBzAChhpodHRw
Oi8vaS5wa2kuZ29vZy9nc3IxLmNydDAtBgNVHR8EJjAkMCKgIKAehhxodHRwOi8v
Yy5wa2kuZ29vZy9yL2dzcjEuY3JsMBMGA1UdIAQMMAowCAYGZ4EMAQIBMA0GCSqG
SIb3DQEBCwUAA4IBAQAYQrsPBtYDh5bjP2OBDwmkoWhIDDkic574y04tfzHpn+cJ
odI2D4SseesQ6bDrarZ7C30ddLibZatoKiws3UL9xnELz4ct92vID24FfVbiI1hY
+SW6FoVHkNeWIP0GCbaM4C6uVdF5dTUsMVs/ZbzNnIdCp5Gxmx5ejvEau8otR/Cs
kGN+hr/W5GvT1tMBjgWKZ1i4//emhA1JG1BbPzoLJQvyEotc03lXjTaCzv8mEbep
8RqZ7a2CPsgRbuvTPBwcOMBBmuFeU88+FSBX6+7iP0il8b4Z0QFqIwwMHfs/L6K1
vepuoxtGzi4CZ68zJpiq1UvSqTbFJjtbD4seiMHl
-----END CERTIFICATE-----
)EOF";
#endif


esp_lcd_panel_io_handle_t io_handle = NULL;
Expand Down Expand Up @@ -477,36 +549,13 @@ void timeavailable(struct timeval *t)
WiFi.disconnect();
}



void setTimezone()
{
#ifdef CUSTOM_TIMEZONE
String timezone = CUSTOM_TIMEZONE;
#else
const char *rootCACertificate =
"-----BEGIN CERTIFICATE-----\r\n"\
"MIIDzTCCArWgAwIBAgIQCjeHZF5ftIwiTv0b7RQMP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YJX/OvoMaJXkGUFvhZEOFp3ArnPEELG4ZKk40Un\r\n"\
"+ABHLGioVplTVI+tnkDB0A+21w0LOEhsUCxJkAZbZB2LzEgwLt4I4ptJIsCSDBFe\r\n"\
"lpKU1fwg3FZs5ZKTv3ocwDfjhUkV+ivhdDkYD7fa86JXWGBPzI6UAPxGezQxPk1H\r\n"\
"goE6y/SJXQ7vTQ1unBuCJN0yJV0ReFEQPaA1IwQvZW+cwdFD19Ae8zFnWSfda9J1\r\n"\
"CZMRJCQUzym+5iPDuI9yP+kHyCREU3qzuWFloUwOxkgAyXVjBYdwRVKD05WdRerw\r\n"\
"6DEdfgkfCv4+3ao8XnTSrLE=\r\n"\
"-----END CERTIFICATE-----\r\n";

WiFiClientSecure *client = new WiFiClientSecure;
String timezone;
if (client) {
Expand Down

0 comments on commit 7581703

Please sign in to comment.