mobizt / ESP_SSLClient

The upgradable Secure Layer Networking (SSL/TLS) TCP Client for Arduino devices that support external networking interfaces e.g., WiFiClient, EthernetClient, and GSMClient.
MIT License
18 stars 2 forks source link

TelegramUniversalBot & TimeClient #11

Closed BlackWolfDEsign closed 1 month ago

BlackWolfDEsign commented 1 month ago

hi i dont get it... i want to use TelegramUniversalBot. For that I probably need SSL, so I included your library.

First, now i cant get a valid time from NTP servers. Before there was no problem.

with the telegram bot I get the following error from your lib: 11:02:21.792 -> > ERROR.mRunUntil: SSL internals timed out! 11:02:21.856 -> > ERROR.mConnectSSL: Failed to initlalize the SSL layer. 11:02:21.921 -> > ERROR.mConnectSSL: Unknown error code. ###################################################### 11:03:04.366 -> > ERROR.mUpdateEngine: Error writing to basic client. 11:03:04.430 -> > ERROR.mConnectSSL: Failed to initlalize the SSL layer. 11:03:04.494 -> > ERROR.mConnectSSL: Unknown error code.

my Ethernet works and I get an IP with DHCP i included telegram root certificate i use sslClient.setX509Time(timeClient->getEpochTime()); but it is not working (see above)

my minimalized code

#include <UniversalTelegramBot.h>
#include <EthernetENC.h>
#include <EthernetUdp.h>
#include <ESP_SSLClient.h>
ESP_SSLClient sslClient;
EthernetClient ethClient;
EthernetUDP ethUDP;
UniversalTelegramBot *bot;

const char rootCA[] PROGMEM = "-----BEGIN CERTIFICATE-----\n" ...

void setup() {
  Ethernet.begin(macAddr);

  sslClient.setInsecure();
  sslClient.setBufferSizes(1024 /* rx */, 512 /* tx */);
  sslClient.setDebugLevel(1);
  sslClient.setSessionTimeout(150); 
  sslClient.setX509Time(timeClient->getEpochTime());
  sslClient.setCACert(rootCA);
  sslClient.setClient(&ethClient);

  bot = new UniversalTelegramBot(tele_token, sslClient);
}

void loop() {
  bot->sendMessage(tele_id, tele_message, "");
}

how can i get TimeClient work again? How can i get your lib to work :D

BlackWolfDEsign commented 1 month ago

SORRY, i changed the certificate again and now its working as sexpected

nTP works also very well again