How to create cacert.h for ESP8266 secure TLS example
How is the following root CA file created?
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/HTTPSRequestCACert/CACert.ino
Here is one way to do it by hand. If you need to do this a lot, a Python script could probably do all of it.
In FireFox connect to "https:://api.github.com".
In the address bar, to the left of the URL, click on the circled 'i' icon for more information.
Click on the '>' icon.
Click on "More Information" button at the bottom of the window.
In the new window titled "Page Info - https://api.github.com", click on the "View Certificate" button.
In the "Certificate Viewer" window, click on the "Details" tab.
In the "Certificate Hierarchy" top window pane click on "DigiCert High Assurance EV Root CA" so it is highlighted.
Click on the "Export..." button at the bottom of the page.
At the bottom of the page select "X.509 Certificate (DER)" format then click on Save.
Use your favorite program to convert the binary DER format to ASCII. Here is what I do.
$ xxd -i DigiCertHighAssuranceEVRootCA.crt.der >cacert.h
Edit cacert.h to add PROGMEM and const keywords.
Thank you very much for that! I have being looking for it for a long time.
ReplyDeleteThe link is now broken, this the new one:
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/HTTPSRequestCACertAxTLS/CACert.ino