You can chat about native SDK questions and issues here.

User avatar
By maverickchongo
#81506 Hi,

I am trying to use the ESP8266 as a mqtt client sending messages over ssl, but I get the folowing error:

TCP: Connect to ip 192.168.0.18:8883
Connecting with 2 way authentication
MQTT: HEAP size: 16696
MQTT: espconn_secure_set_size: 1
please start sntp first !
MQTT: espconn_secure_connect: 0
mprivate_key 260
certificate 2af
client handshake start.
client handshake failed
Error: invalid protocol message
TCP: Reconnect to 192.168.0.18:8883
pm open,type:2 0

From the server I can see that the I get:

Hanshake failure (40)

I looks like the key and certificate are picked, the espconn_secure_connect returns 0 (success), but then the handshake fails, it looks like the server and client are not agreeing on the cypher to use.

Also, I wanted to know whether espconn_secure API is based on SSL or mbedtls library? How can I find out? Can I select which one it uses?

Thanks in advance for your help
User avatar
By davydnorris
#81518 SSL relies on correct time in order to check certificates etc.

You need to set up and start an SNTP server first before trying to do anything with SSL.

Have a look at my code snippet in the Advanced section for how I start up my wifi, and SNTP. After this you should be able to connect via SSL (working well for me on both HTTPS and MQTTS)
User avatar
By maverickchongo
#82096
davydnorris wrote:SSL relies on correct time in order to check certificates etc.

You need to set up and start an SNTP server first before trying to do anything with SSL.

Have a look at my code snippet in the Advanced section for how I start up my wifi, and SNTP. After this you should be able to connect via SSL (working well for me on both HTTPS and MQTTS)


Thanks for your response.

Sorry, where is your code snippet?