From 1398e595744bcd0668da51913beccbff8bca3898 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Nov 2023 10:09:16 +0700 Subject: [PATCH] Fix SSL verification time issue. --- library.json | 2 +- library.properties | 2 +- src/ESP_Google_Sheet_Client.cpp | 4 ++-- src/ESP_Google_Sheet_Client.h | 6 +++--- src/auth/GAuthManager.cpp | 8 ++++++-- src/auth/GAuthManager.h | 4 ++-- src/client/GS_TCP_Client.h | 12 +++++++++++- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/library.json b/library.json index e59133a..c167b83 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ESP-Google-Sheet-Client", - "version": "1.4.2", + "version": "1.4.3", "keywords": "communication, REST, esp32, esp8266, raspberrypi, arduino", "description": "Arduino Google Sheet REST client library for Arduino devices. This library allows devices to communicate with Google Sheet API to read, edit and delete the spreadsheets", "repository": { diff --git a/library.properties b/library.properties index e7c46fd..f19fecf 100644 --- a/library.properties +++ b/library.properties @@ -1,6 +1,6 @@ name=ESP-Google-Sheet-Client -version=1.4.2 +version=1.4.3 author=Mobizt diff --git a/src/ESP_Google_Sheet_Client.cpp b/src/ESP_Google_Sheet_Client.cpp index b95bc62..b34c50c 100644 --- a/src/ESP_Google_Sheet_Client.cpp +++ b/src/ESP_Google_Sheet_Client.cpp @@ -1,9 +1,9 @@ /** - * Google Sheet Client, ESP_GOOGLE_SHEET_CLIENT_Google_Sheet_Client.cpp v1.4.2 + * Google Sheet Client, ESP_GOOGLE_SHEET_CLIENT_Google_Sheet_Client.cpp v1.4.3 * * This library supports Espressif ESP8266 and ESP32 MCUs * - * Created November 9, 2023 + * Created November 10, 2023 * * The MIT License (MIT) * Copyright (c) 2022 K. Suwatchai (Mobizt) diff --git a/src/ESP_Google_Sheet_Client.h b/src/ESP_Google_Sheet_Client.h index 351b2d6..a88970e 100644 --- a/src/ESP_Google_Sheet_Client.h +++ b/src/ESP_Google_Sheet_Client.h @@ -1,13 +1,13 @@ #ifndef ESP_GOOGLE_SHEET_CLIENT_VERSION -#define ESP_GOOGLE_SHEET_CLIENT_VERSION "1.4.2" +#define ESP_GOOGLE_SHEET_CLIENT_VERSION "1.4.3" #endif /** - * Google Sheet Client, ESP_Google_Sheet_Client.h v1.4.2 + * Google Sheet Client, ESP_Google_Sheet_Client.h v1.4.3 * * This library supports Espressif ESP8266 and ESP32 MCUs * - * Created November 9, 2023 + * Created November 10, 2023 * * The MIT License (MIT) * Copyright (c) 2023 K. Suwatchai (Mobizt) diff --git a/src/auth/GAuthManager.cpp b/src/auth/GAuthManager.cpp index 3ff8338..77851b2 100644 --- a/src/auth/GAuthManager.cpp +++ b/src/auth/GAuthManager.cpp @@ -1,9 +1,9 @@ /** - * Google Sheet Client, GAuthManager v1.0.4 + * Google Sheet Client, GAuthManager v1.0.5 * * This library supports Espressif ESP8266, ESP32 and Raspberry Pi Pico MCUs. * - * Created August 21, 2023 + * Created November 10, 2023 * * The MIT License (MIT) * Copyright (c) 2022 K. Suwatchai (Mobizt) @@ -990,6 +990,10 @@ bool GAuthManager::initClient(PGM_P subDomain, gauth_auth_token_status status) Utils::idle(); tcpClient->begin(host.c_str(), 443, &response_code); + time_t now = getTime(); + + tcpClient->setX509Time(now); + return true; } diff --git a/src/auth/GAuthManager.h b/src/auth/GAuthManager.h index 1526133..c3672d2 100644 --- a/src/auth/GAuthManager.h +++ b/src/auth/GAuthManager.h @@ -1,9 +1,9 @@ /** - * Google Sheet Client, GAuthManager v1.0.4 + * Google Sheet Client, GAuthManager v1.0.5 * * This library supports Espressif ESP8266, ESP32 and Raspberry Pi Pico MCUs. * - * Created August 21, 2023 + * Created November 10, 2023 * * The MIT License (MIT) * Copyright (c) 2022 K. Suwatchai (Mobizt) diff --git a/src/client/GS_TCP_Client.h b/src/client/GS_TCP_Client.h index 6b8250a..e982cb2 100644 --- a/src/client/GS_TCP_Client.h +++ b/src/client/GS_TCP_Client.h @@ -116,6 +116,16 @@ class GS_TCP_Client : public Client #endif } + void setX509Time(time_t now) + { + if (_tcp_client) + { + _tcp_client->setX509Time(now); + if (now > ESP_SSLCLIENT_VALID_TIMESTAMP) + _clock_ready = true; + } + } + /** * Set Root CA certificate to verify. * @param caCert The certificate. @@ -933,7 +943,7 @@ class GS_TCP_Client : public Client { if (gsmModem->getNetworkTime(&year3, &month3, &day3, &hour3, &min3, &sec3, &timezone)) { - //We have to subtract the local GSM network timezone to get GMT time + // We have to subtract the local GSM network timezone to get GMT time return TimeHelper::getTimestamp(year3, month3, day3, hour3, min3, sec3) - timezone * 3600; } }