Obtaining a Web Page TLS Certificate

This app note describes how to obtain a website's CA cert via the Google Chrome web browser and use the cert to issue a HTTPS GET request command.

Note: This app note describes the procedure for the Chrome browser. A similar process may be used for most web browsers including Internet Explorer, FireFox, and Safari.

In this app note we will:

CA Certificate Overview

A Certificate Authority (CA) certificate is used by the Wi-Fi module to authenticate a HTTP server. The CA cert allows for a secure transaction with the HTTP server. For more details about TLS certificates, see TLS Client Application Note.

Download CA Certificate

In this example we use the Google website at https://www.google.com

Save the site's CA cert, in a Base-64 encoded file, using the following steps in a Chrome web browser:

At this point we have saved the website's CA certificate to our desktop. Double-click on the global_sign_ca.cer file on your desktop to view the certificate's information.

Upload CA Certificate to Wi-Fi Module

Next we need to upload the CA certificate to the Gecko OS module.

The easiest way to do this is to use the Gecko OS Web App provided with Gecko OS. To start the webapp, issue the setup_web command to the device using a Gecko OS terminal:

> setup_web

This starts the Gecko OS softAP and webserver. Connect your computer to the Gecko OS Wi-Fi network. By default, the network name is Gecko OS-XXX, (where XXX is the last 3 digits of the device MAC address).

Then open a web browser and enter the URL: http://setup.com

Wait for the Gecko OS webapp to load, then click on the Files tab. The Files tab enables you to drag and drop files from your computer to the file system on the Gecko OS device.

On your computer, find the CA certificate that you just created: global_sign_ca.cer

Drag this file onto the Gecko OS webapp target area where it says Drop files here. Alternatively, click the button labelled Click to add files.

That's it! The CA certificate is now stored in non-volatile memory on the Gecko OS device flash file system.

Issue HTTPS GET Request

Now that the Wi-Fi module has the website CA cert, we can issue secure HTTPS requests to it.

First, configure the following setting so that our CA certificate is always used by default:

set network.tls.ca_cert global_sign_ca.cer

For details see the network.tls.ca_cert variable.

Set the module's network credentials so that the module can connect to the Internet. See Configuration and Setup, Wi-Fi Setup.

Now, issue a HTTPS request to the server:

http_get https://silabs.com

Assuming we've previously set the Wi-Fi network's SSID/password, this will issue a secure HTTPS request to the server and download the encrypted webpage.

Once the connection is open, read the webpage data with the command:

read 0 1000

Keep issuing this command until all the webpage data is read.

You can store multiple CA certs on the Gecko OS flash file system.

Instead of setting the cert in the network.tls.ca_cert variable, you can specify the CA cert as an argument to the http_get command:

http_get https://silabs.com global_sign_ca.cer

For more details about issuing HTTP requests, see the HTTP GET and POST app note.

Supporting Gecko OS Versions

Change Log