espconn_secure_connect: how does it work?
-
- Posts: 26
- Joined: Fri Oct 24, 2014 7:58 pm
espconn_secure_connect: how does it work?
Postby ESP_Sprite » Thu Nov 27, 2014 7:24 am
I'm developing an application that needs to connect to a SSL server (specifically, an XMPP server), but I'm running into trouble with espconn_secure_connect and friends. When I use espconn_connect, everything works, but with espconn_secure_connect, I either get
"client handshake start."
on the console and then nothing, or an exception:
"Fatal exception (29):
epc1=0x4000df3a, epc2=0x00000000, epc3=0x00000000, excvaddr=0x181869fe, depc=0x00000000"
What I get is dependent on the server I connect to.
Just to check: do I need something valid in cert.h and/or private_key.h? At the moment, I have what I think is a self-signed certificate in those files, but I couldn't really find any documentation on those. I also don't quite know if they're needed for a client-side connection. Could you shed some light on those things?
-
- Posts: 26
- Joined: Fri Oct 24, 2014 7:58 pm
Re: espconn_secure_connect: how does it work?
Postby ESP_Sprite » Fri Nov 28, 2014 6:20 am
That's all somewhat unfortunate: it makes it pretty much impossible to use SSL for anything but services that are specifically meant for the ESP. Ah well, for three bucks, I still can't complain.
-
- Posts: 26
- Joined: Fri Oct 24, 2014 7:58 pm
Re: espconn_secure_connect: how does it work?
Postby ESP_Sprite » Fri Nov 28, 2014 4:29 pm
jackon wrote:hi, Sprite_tm
Could you provide your SSL server's ip and port?
We will have a test.
Sure. I've tried it on two servers, both my HTTPS as well as a SSL Jabber server I don't manage myself. Connecting to the https server makes the esp reboot, connecting to the Jabber server stalls the connection. Both connect fine using for example openssl s_client -connect spritesmods.com:443
The https server is at
https://spritesmods.com/ (port 443, as usual)
The jabber server I tried is at
jabber.hot-chilli.net:5223
-
- Posts: 26
- Joined: Fri Oct 24, 2014 7:58 pm
Re: espconn_secure_connect: how does it work?
Postby ESP_Sprite » Fri Nov 28, 2014 7:44 pm
I'd really like a patch for 0.9.3 to try! Thanks for looking into the problem.
Re: espconn_secure_connect: how does it work?
Postby jackon » Fri Nov 28, 2014 9:36 pm
Just extra the libssl.a to SDK's lib folder.
Or you can modify ssl_tls1.h, line 80.
Code: Select all
#define RT_MAX_PLAIN_LENGTH 4096
Give me feedback after your test.
Thx
- Attachments
-
- libssl.zip
- (55.05 KiB) Downloaded 830 times
-
- Posts: 26
- Joined: Fri Oct 24, 2014 7:58 pm
Re: espconn_secure_connect: how does it work?
Postby ESP_Sprite » Sat Nov 29, 2014 4:29 pm
Ah, while I'm asking questions about SSL etc, does the SDK already have a method to do opportunistic TLS? That basically involves setting up a plaintext connection, asking the server if you can continue using encryption and then doing the SSL handshake over the same socket you previously did plaintext over. If not, I may implement it myself.
Re: espconn_secure_connect: how does it work?
Postby mathijs » Wed Dec 03, 2014 5:49 pm
I had the same problem when connecting to 'official signed' HTTPS servers. After changing the buffersize to 4096 instead of 1024, the HTTPS connection works fine now!
Thanks!
Re: espconn_secure_connect: how does it work?
Postby younger » Fri Jan 02, 2015 3:51 pm
jackon wrote:Here is the patch, we test to connect your server, it works OK, you can check by yourself.
Just extra the libssl.a to SDK's lib folder.
Or you can modify ssl_tls1.h, line 80.Code: Select all
#define RT_MAX_PLAIN_LENGTH 4096
Give me feedback after your test.
Thx
Hi jackon,
I use the patch and in SDK 0.9.5_b1 to connect ssl server(111.206.227.37:2001), still find some problems:
Code: Select all
connected with LU, channel 6
dhcp client start...
ip:192.168.2.114,mask:255.255.255.0,gw:192.168.2.1
user_esp_platform_dns_found 111.206.227.37
user_esp_platform_connect
espconn_ssl_connect 0x3fff5a30 0x3fff59d0 25352
client handshake start.
espconn_ssl_client ssl_ctx 0x3fff5d20
send_raw_packet pkt_size 56
send_raw_packet Length 56
espconn_ssl_csent 0x3fff5a30 0x3fff5dec 56
espconn_ssl_crecv 409 0x3fff5dc0 0x3fff59a8
basic_read 1366 16 0x00000000
do_clnt_handshake: 107 2
do_clnt_handshake: 107 11
Error: Invalid X509 ASN.1 file (X509 not ok)
[D],process_certificate,x509_new
send_raw_packet pkt_size 7
send_raw_packet Length 7
client handshake failed
espconn_ssl_cclose 0
espconn_ssl_cclose_cb 10 0
send_raw_packet pkt_size 7
send_raw_packet Length 7
user_esp_platform_discon_cb
Could you help me to slove the problems ? This is very important to me.
Thanks!
Who is online
Users browsing this forum: No registered users and 91 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.