Attempt to connect to webserver via HTTPS
Posted: Wed Feb 25, 2015 8:26 pm
I'm adapting the sample code at http://www.electrodragon.com/w/ESP8266_IoT to establish an HTTPS connection. My first stab at it is as follows:
This was in the CLIENT_SSL_ENABLE #ifdef in the original sample code. I assume that these variables are to store the certificates/public keys from the server? (but the variable name says *private_key*, I guess I'll dig a little deeper)
And then I replaced all the espconn* calls with the secure versions (my ESP8266 can connect to basic HTTP servers):
Unfortunately, I seem to be hitting a crash:
So I guess I had a few questions:
1. How is everyone else connecting to HTTPS servers? Any samples? What is the problem with my approach?
2. How do folks here debug crashes? printf debugging?
This was in the CLIENT_SSL_ENABLE #ifdef in the original sample code. I assume that these variables are to store the certificates/public keys from the server? (but the variable name says *private_key*, I guess I'll dig a little deeper)
Code: Select all
#ifdef ENABLE_SSL_SUPPORT
unsigned char *default_certificate;
unsigned int default_certificate_len = 0;
unsigned char *default_private_key;
unsigned int default_private_key_len = 0;
#endif
And then I replaced all the espconn* calls with the secure versions (my ESP8266 can connect to basic HTTP servers):
Code: Select all
#ifdef ENABLE_SSL_SUPPORT
espconn_secure_connect(pCon);
#else
espconn_connect(pCon);
#endif
...
#ifdef ENABLE_SSL_SUPPORT
espconn_secure_sent(pespconn, payload, strlen(payload));
#else
espconn_sent(pespconn, payload, strlen(payload));
#endif
...
#ifdef ENABLE_SSL_SUPPORT
espconn_secure_disconnect(conn);
#else
espconn_disconnect(conn);
#endif
Unfortunately, I seem to be hitting a crash:
Code: Select all
Start espconn_connect to <HTTPS server IP> 443
ets Jan 8 2013,rst cause:4, boot mode:(3,0)
wdt reset
load 0x40100000, len 24872, room 16
tail 8
chksum 0x5b
load 0x3ffe8000, len 2652, room 0
tail 12
chksum 0x8d
ho 0 tail 12 room 4
load 0x3ffe8a60, len 7220, room 12
tail 8
chksum 0x5a
csum 0x5a
So I guess I had a few questions:
1. How is everyone else connecting to HTTPS servers? Any samples? What is the problem with my approach?
2. How do folks here debug crashes? printf debugging?