Connecting to SSL from Espressif 8266 SoC

There are 2 ways that I know about validating an SSL certificate:

1 –  Generate a root certificate in DER format (somehow tricky)

2 –  Copying the SHA1 hash from the browser certificate details (easier)

… and as we are mostly lazy developers we will go for the number 2

DER format into hexa

In this example, we will generate the code to validate 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 in Ubuntu:

$ xxd -i DigiCertHighAssuranceEVRootCA.crt.der >cacert.h

Edit cacert.h to add PROGMEM and const keywords like in this ESP8266 example

Using a SHA1 hash

Well this one is the most easier and the one I use. Repeating the first steps of the first option, in the first window that you see the certificate information there is the SHA1 hash at the bottom.

So the trick is to simply copy it and for api.github.com is:
5F:F1:60:31:09:04:3E:F2:90:D2:B0:8A:50:38:04:E8:37:9F:BC:76

Open it in any text editor and replace the “:” for ” ” spaces to paste it in the firgerprint variable declaration:

const char* fingerprint = “5F F1 60 31 09 04 3E F2 90 D2 B0 8A 50 38 04 E8 37 9F BC 76”;

Here you can see an example that is ready to compile and test

And since I’m really lazy to delete this Gutenberg demo of WordPress new editor I will leave the rest here. In resume, in this new editor pressing (+) you can add anything you want in the world. And it would be even cooler if they add a magical (-) button so you can remove the content with the same ease as adding it.

The rest comes from the new editor bells & whistles and it’s not of my writing

Imagine everything that WordPress can do is available to you quickly and in the same place on the interface. No need to figure out HTML tags, classes, or remember complicated shortcode syntax. That’s the spirit behind the inserter—the (+) button you’ll see around the editor—which allows you to browse all available content blocks and add them into your post. Plugins and themes are able to register their own, opening up all sort of possibilities for rich editing and publishing.

Go give it a try, you may discover things WordPress can already add into your posts that you didn’t know about. Here’s a short list of what you can currently find there:

  • Text & Headings
  • Images & Videos
  • Galleries
  • Embeds, like YouTube, Tweets, or other WordPress posts.
  • Layout blocks, like Buttons, Hero Images, Separators, etc.
  • And Lists like this one of course :)

Visual Editing

A huge benefit of blocks is that you can edit them in place and manipulate your content directly. Instead of having fields for editing things like the source of a quote, or the text of a button, you can directly change the content. Try editing the following quote:

The editor will endeavor to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.

Matt Mullenweg, 2017

The information corresponding to the source of the quote is a separate text field, similar to captions under images, so the structure of the quote is protected even if you select, modify, or remove the source. It’s always easy to add it back.

Blocks can be anything you need. For instance, you may want to add a subdued quote as part of the composition of your text, or you may prefer to display a giant stylized one. All of these options are available in the inserter.

You can change the amount of columns in your galleries by dragging a slider in the block inspector in the sidebar.

Media Rich

If you combine the new wide and full-wide alignments with galleries, you can create a very media rich layout, very quickly:

Accessibility is important — don’t forget image alt attribute

Sure, the full-wide image can be pretty big. But sometimes the image is worth it.

The above is a gallery with just two images. It’s an easier way to create visually appealing layouts, without having to deal with floats. You can also easily convert the gallery back to individual images again, by using the block switcher.

Any block can opt into these alignments. The embed block has them also, and is responsive out of the box:

You can build any block you like, static or dynamic, decorative or plain. Here’s a pullquote block:

Code is Poetry

The WordPress community

If you want to learn more about how to build additional blocks, or if you are interested in helping with the project, head over to the GitHub repository.


Thanks for testing Gutenberg!

👋

Create a website or blog at WordPress.com

%d bloggers like this: