Https example program using TLSSocket library.

Hello-TLSSocket

TLSSocket library example program.

In this example, https connection to os.mbed.com is established by using TLSSocket. The program is tested on K64F.

Output from console

When set mbed-trace.enable true.

HelloTSLSocket, HTTPS example of TLSSocket

[INFO][TLSx]: Connecting to os.mbed.com:443
[INFO][TLSx]: Connected.
[INFO][TLSx]: Starting the TLS handshake...
[INFO][TLSx]: TLS connection to os.mbed.com:443 established

[DBG ][TLSx]: Server certificate:
    cert. version     : 3
    serial number     : 03:56:D4:79:41:63:31:CA:E0:56:06:61
    issuer name       : C=BE, O=GlobalSign nv-sa, CN=GlobalSign Organization Validation CA - SHA256 - G2
    subject name      : C=GB, ST=Cambridgeshire, L=Cambridge, O=Arm Ltd, CN=*.mbed.com
    issued  on        : 2018-05-04 15:36:03
    expires on        : 2019-06-06 10:31:02
    signed using      : RSA with SHA-256
    RSA key size      : 2048 bits
    basic constraints : CA=false
    subject alt name  : *.mbed.com, mbed.org, *.mbed.org, mbed.com
    key usage         : Digital Signature, Key Encipherment
    ext key usage     : TLS Web Server Authentication, TLS Web Client Authentication


[INFO][TLSx]: Certificate verification passed

GET / HTTP/1.1
Host: os.mbed.com
Connection: close

HTTP/1.1 200 OK
Server: nginx/1.11.12
Date: Wed, 13 Jun 2018 08:26:02 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Language,Cookie,Accept-Encoding
Content-Language: en-gb
Set-Cookie: csrftoken=zM3AGfeZ6W4OQZsT6nCcxNBYxEEN73sf; expires=Wed, 12-Jun-2019 08:25:33 GMT; Max-Age=31449600; Path=/
Strict-Transport-Security: max-age=31536000; includeSubdomains

eae
<!DOCTYPE html>

...
...
...

        AJAX_req.onreadystatechange = handle_AJAX_Complete;
        AJAX_req.send();
    }
</script>


</body>
</html>

0

HelloTSLSocket DONE.

History

Updated TLSSocket library. default tip

2018-06-15, by Osamu Koizumi [Fri, 15 Jun 2018 00:43:00 +0900] rev 13

Updated TLSSocket library.


Updated TLSSocket library.

2018-06-13, by Osamu Koizumi [Wed, 13 Jun 2018 15:04:05 +0900] rev 12

Updated TLSSocket library.


Updated to the latest libraries.

2018-06-12, by Osamu Koizumi [Tue, 12 Jun 2018 22:49:50 +0900] rev 11

Updated to the latest libraries.


Updated TLSSocket library.

2018-04-27, by Osamu Koizumi [Fri, 27 Apr 2018 14:03:57 +0900] rev 10

Updated TLSSocket library.


Update TLSSocket library. Changed to set root CA certificate by mbed_app.json.

2018-04-27, by Osamu Koizumi [Fri, 27 Apr 2018 14:03:25 +0900] rev 9

Update TLSSocket library. Changed to set root CA certificate by mbed_app.json.


Changed TLSSoclet memory allocation.

2018-04-25, by Osamu Koizumi [Wed, 25 Apr 2018 17:19:46 +0900] rev 8

Changed TLSSoclet memory allocation.


Changed TLSSocket instance allocation to stack.

2018-04-25, by Osamu Koizumi [Wed, 25 Apr 2018 17:18:22 +0900] rev 7

Changed TLSSocket instance allocation to stack.


Updated TLSSocket library. Changed to use new operator to create an instance of TLSSocket, to reduce stack use.

2018-04-24, by Osamu Koizumi [Tue, 24 Apr 2018 17:24:26 +0900] rev 6

Updated TLSSocket library. Changed to use new operator to create an instance of TLSSocket, to reduce stack use.


Updated TLSSocket library.

2018-04-19, by Osamu Koizumi [Thu, 19 Apr 2018 16:43:27 +0900] rev 5

Updated TLSSocket library.


Removed unused LCD related settings.

2018-04-19, by Osamu Koizumi [Thu, 19 Apr 2018 16:41:07 +0900] rev 4

Removed unused LCD related settings.