diff --git a/examples/HttpsClient/HttpsClient.ino b/examples/HttpsClient/HttpsClient.ino index 1d4f512..d9e0ecb 100644 --- a/examples/HttpsClient/HttpsClient.ino +++ b/examples/HttpsClient/HttpsClient.ino @@ -71,6 +71,9 @@ // set GSM PIN, if any #define GSM_PIN "" +// flag to force SSL client authentication, if needed +// #define TINY_GSM_SSL_CLIENT_AUTHENTICATION + // Your GPRS credentials, if any const char apn[] = "YourAPN"; const char gprsUser[] = ""; @@ -81,9 +84,9 @@ const char wifiSSID[] = "YourSSID"; const char wifiPass[] = "YourWiFiPass"; // Server details -const char server[] = "vsh.pp.ua"; +const char server[] = "vsh.pp.ua"; const char resource[] = "/TinyGSM/logo.txt"; -const int port = 443; +const int port = 443; #include #include @@ -103,15 +106,15 @@ const int port = 443; #endif #ifdef DUMP_AT_COMMANDS - #include - StreamDebugger debugger(SerialAT, SerialMon); - TinyGsm modem(debugger); +#include +StreamDebugger debugger(SerialAT, SerialMon); +TinyGsm modem(debugger); #else - TinyGsm modem(SerialAT); +TinyGsm modem(SerialAT); #endif TinyGsmClientSecure client(modem); -HttpClient http(client, server, port); +HttpClient http(client, server, port); void setup() { // Set console baud rate diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index ebf6bc9..88e1429 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -506,6 +506,18 @@ class TinyGsmSim800 : public TinyGsmModem, sendAT(GF("+CIPSSL="), ssl); rsp = waitResponse(); if (ssl && rsp != 1) { return false; } +#ifdef TINY_GSM_SSL_CLIENT_AUTHENTICATION + // set SSL options + // +SSLOPT=, + // + // 0 (default) ignore invalid certificate + // 1 client authentication + // + // 0 (default) close + // 1 open + sendAT(GF("+CIPSSL=1,1")); + if (waitResponse() != 1) return false; +#endif #endif sendAT(GF("+CIPSTART="), mux, ',', GF("\"TCP"), GF("\",\""), host, GF("\","), port);