Skip to content

Commit 636e2ab

Browse files
authored
Working (#4)
* Update instructions and example * Update mqtt_x509_DEM.ino * Update README.md * Update README.md * Update README.md
1 parent 5478621 commit 636e2ab

File tree

3 files changed

+11
-35
lines changed

3 files changed

+11
-35
lines changed

README.md

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,21 @@
1-
## Working example for ESP32: https://github.com/copercini/esp32-iot-examples/
2-
--------------------------------------------------------------------------------------------
3-
4-
51
# Some examples using x.509 certificates and TLSv1.2 under Arduino IDE to communicate with AWS iot
62

73
After AxTLS update to v2.0.0, the ESP8266 can work with TLS v1.2, the major restriction for this small device communicates with AWS iot natively. You can follow the port here: https://github.com/igrr/axtls-8266
84

9-
Due heap limitation, the ESP8266 is rebooting before complete handshake, I am hopeful it can be fixed with some optimization.
105

11-
## How I can get TLS v1.2 working in my ESP8266 with arduino IDE?
12-
13-
#### First: Update libaxtls.a to last version (b20140f)
14-
You can compile it as you own: add xtensa toolchain to your path, and run make. <br />
15-
Or download a compiled one in the folder axtls of this git and replace it on Arduino\hardware\esp8266com\esp8266\tools\sdk\lib of your Arduino git installation (https://github.com/esp8266/Arduino#using-git-version)
6+
## How I can get AWS IoT working in my ESP8266 with arduino IDE?
167

8+
#### First: Update ESP8266 Arduino core to last git version, [Here are the instructions](https://github.com/esp8266/Arduino#using-git-version)
179

1810
#### Second: Creating a thing, Downloading and converting AWS iot certificates to DER format
1911
http://docs.aws.amazon.com/iot/latest/developerguide/create-device-certificate.html
2012

2113
Converting PEM to DER format: <br />
22-
$ wget https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem > ca.crt <br />
23-
$ openssl x509 -in ca.crt -out certificates/ca.der -outform DER <br />
24-
$ openssl x509 -in aaaaaaaaa-certificate.pem.crt -out certificates/cert.der -outform DER <br />
25-
$ openssl rsa -in aaaaaaaaaa-private.pem.key -out certificates/private.der -outform DER <br />
14+
$ openssl x509 -in aaaaaaaaa-certificate.pem.crt.txt -out cert.der -outform DER <br />
15+
$ openssl rsa -in aaaaaaaaaa-private.pem.key -out private.der -outform DER <br />
2616

17+
copy cert.der and private.der to data folder
2718

2819
#### Third: Uploading a arduino sketch
2920
Some sketch examples are available in examples folder of this git.
3021

31-
32-
## Why it doesn't work yet?
33-
Because AxTLS doens't support the AWS ioT required cipher suites.
34-
35-
State: receiving Server Hello (2) <br />
36-
State: receiving Certificate (11) <br />
37-
State: receiving Certificate Request (13) <br />
38-
State: receiving Server Hello Done (14) <br />
39-
State: sending Certificate (11) <br />
40-
State: sending Client Key Exchange (16)<br />
41-
State: sending Finished (16)<br />
42-
Alert: handshake failure<br />
43-
Error: SSL error 40<br />
44-
<br />
45-
Based on Issue: https://github.com/esp8266/Arduino/issues/2771 <br />
46-
Means: AxTLS library doesn't support needed cipher suites <br />
47-
<br />

examples/mqtt_x509_DEM/mqtt_x509_DEM.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ if(espClient.loadPrivateKey(private_key))
114114
else
115115
Serial.println("private key not loaded");
116116

117+
118+
/*
117119
// Load CA file
118120
File ca = SPIFFS.open("/ca.der", "r"); //replace ca eith your uploaded file name
119121
if (!ca) {
@@ -128,7 +130,7 @@ if(espClient.loadCACert(ca))
128130
Serial.println("ca loaded");
129131
else
130132
Serial.println("ca failed");
131-
133+
*/
132134
Serial.print("Heap: "); Serial.println(ESP.getFreeHeap());
133135

134136
// client.setServer(mqtt_server, 8883);

0 commit comments

Comments
 (0)