How to connect to an ssl server using the sntp protocol on ESP8266?

Wootenhuber361
Posts: 1
Joined: Sat Jan 16, 2021 9:21 pm

How to connect to an ssl server using the sntp protocol on ESP8266?

Postby Wootenhuber361 » Sat Jan 16, 2021 9:28 pm

I use an ESP8266 with a C-language esp-open-sdk.
In order to get the timestamp, I have tried to use this code, but it always fails – I only get 0:
the timezone(2);
Name(0, 'fr.pool.ntp.org') of sntp- setserver();
sntp datum();
timer = sntp get time timetranscription();
os printf("time : percent d and percent s\n"timestyle, sntp get real time(timestyle));
I try to connect to a Server to make a https request, as you might have understand, (I'm using the functions espconn secure_***) but it's not working every time.
It may be due to the time (the certificate cannot be genuine.

Post BY: Assignment Help

Her Mary
Posts: 513
Joined: Mon Oct 27, 2014 11:09 am

Re: How to connect to an ssl server using the sntp protocol on ESP8266?

Postby Her Mary » Tue Jan 19, 2021 10:16 am


ChrisGreenwalty
Posts: 1
Joined: Fri Feb 12, 2021 2:26 pm
Contact:

Re: How to connect to an ssl server using the sntp protocol on ESP8266?

Postby ChrisGreenwalty » Fri Feb 12, 2021 2:30 pm

You need to mlaunch openssl then you need to enter the following command

Code: Select all

genrsa -out key.txt 1024
rsa -in key.txt -out key.txt
req -sha256 -new -nodes -key key.txt -out cert.csr -subj '/C=RO/ST=B/L=Bucharest/O=OneTransistor [RO]/OU=OneTransistor/CN=esp8266.local' -addext subjectAltName=DNS:esp8266.local
x509 -req -sha256 -days 365 -in cert.csr -signkey key.txt -out cert.txt


I hope that this will resolve your problem.

By: assignment help

milesstone
Posts: 22
Joined: Mon Apr 26, 2021 4:50 pm

Re: How to connect to an ssl server using the sntp protocol on ESP8266?

Postby milesstone » Tue Jul 06, 2021 10:59 pm

I have finally found what was happening.
You almost have to do exactly what Espressif is doing in their example,
the SNTP function needs some time given through the os_timer_...
Then you just have to wait for the sntp to get the time and
you can use the ssl function as much as you want.


By........ GBWhatsApp Apk

Nielson
Posts: 18
Joined: Wed Dec 09, 2020 4:15 pm

Re: How to connect to an ssl server using the sntp protocol on ESP8266?

Postby Nielson » Wed Jul 14, 2021 8:09 pm

milesstone wrote:I have finally found what was happening.
You almost have to do exactly what Espressif is doing in their example,
the SNTP function needs some time given through the os_timer_...
Then you just have to wait for the sntp to get the time and
you can use the ssl function as much as you want.


By........ GBWhatsApp Apk

Oh really that is great can you please share more detail about this thanks.

Who is online

Users browsing this forum: No registered users and 2 guests