Skip to content

Commit

Permalink
Fix SSL verification time issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Nov 10, 2023
1 parent 3c99bae commit 1398e59
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=ESP-Google-Sheet-Client

version=1.4.2
version=1.4.3

author=Mobizt

Expand Down
4 changes: 2 additions & 2 deletions src/ESP_Google_Sheet_Client.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/ESP_Google_Sheet_Client.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
8 changes: 6 additions & 2 deletions src/auth/GAuthManager.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/auth/GAuthManager.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
12 changes: 11 additions & 1 deletion src/client/GS_TCP_Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 1398e59

Please sign in to comment.