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.
mbed_app.json@2:6d334ece2345, 2018-04-17 (annotated)
- Committer:
- Osamu Koizumi
- Date:
- Tue Apr 17 18:11:57 2018 +0900
- Revision:
- 2:6d334ece2345
- Parent:
- 1:65339c530def
- Child:
- 4:bbb1d82c5da3
Removed unused setting.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
coisme | 0:f96053986356 | 1 | { |
coisme | 0:f96053986356 | 2 | "macros": [ |
Osamu Koizumi |
1:65339c530def | 3 | "MBED_CONF_APP_MAIN_STACK_SIZE=8192" |
coisme | 0:f96053986356 | 4 | ], |
coisme | 0:f96053986356 | 5 | "config": { |
coisme | 0:f96053986356 | 6 | "network-interface":{ |
coisme | 0:f96053986356 | 7 | "help": "options are ETHERNET, WIFI_ESP8266, WIFI_ODIN, WIFI_RTW, MESH_LOWPAN_ND, MESH_THREAD, CELLULAR_ONBOARD", |
coisme | 0:f96053986356 | 8 | "value": "ETHERNET" |
coisme | 0:f96053986356 | 9 | }, |
coisme | 0:f96053986356 | 10 | "mesh_radio_type": { |
coisme | 0:f96053986356 | 11 | "help": "options are ATMEL, MCR20", |
coisme | 0:f96053986356 | 12 | "value": "ATMEL" |
coisme | 0:f96053986356 | 13 | }, |
coisme | 0:f96053986356 | 14 | "esp8266-tx": { |
coisme | 0:f96053986356 | 15 | "help": "Pin used as TX (connects to ESP8266 RX)", |
coisme | 0:f96053986356 | 16 | "value": "D1" |
coisme | 0:f96053986356 | 17 | }, |
coisme | 0:f96053986356 | 18 | "esp8266-rx": { |
coisme | 0:f96053986356 | 19 | "help": "Pin used as RX (connects to ESP8266 TX)", |
coisme | 0:f96053986356 | 20 | "value": "D0" |
coisme | 0:f96053986356 | 21 | }, |
coisme | 0:f96053986356 | 22 | "esp8266-debug": { |
coisme | 0:f96053986356 | 23 | "value": true |
coisme | 0:f96053986356 | 24 | }, |
coisme | 0:f96053986356 | 25 | "lcd-mosi": { |
coisme | 0:f96053986356 | 26 | "value": "D11", |
coisme | 0:f96053986356 | 27 | "macro_name": "LCD_MOSI" |
coisme | 0:f96053986356 | 28 | }, |
coisme | 0:f96053986356 | 29 | "lcd-sck": { |
coisme | 0:f96053986356 | 30 | "value": "D13", |
coisme | 0:f96053986356 | 31 | "macro_name": "LCD_SCK" |
coisme | 0:f96053986356 | 32 | }, |
coisme | 0:f96053986356 | 33 | "lcd-miso": { |
coisme | 0:f96053986356 | 34 | "value": "D12", |
coisme | 0:f96053986356 | 35 | "macro_name": "LCD_MISO" |
coisme | 0:f96053986356 | 36 | }, |
coisme | 0:f96053986356 | 37 | "lcd-a0": { |
coisme | 0:f96053986356 | 38 | "value": "D7", |
coisme | 0:f96053986356 | 39 | "macro_name": "LCD_A0" |
coisme | 0:f96053986356 | 40 | }, |
coisme | 0:f96053986356 | 41 | "lcd-ncs": { |
coisme | 0:f96053986356 | 42 | "value": "D10", |
coisme | 0:f96053986356 | 43 | "macro_name": "LCD_NCS" |
coisme | 0:f96053986356 | 44 | } |
coisme | 0:f96053986356 | 45 | }, |
coisme | 0:f96053986356 | 46 | "target_overrides": { |
coisme | 0:f96053986356 | 47 | "*": { |
coisme | 0:f96053986356 | 48 | "target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"], |
coisme | 0:f96053986356 | 49 | "mbed-trace.enable": 1, |
Osamu Koizumi |
1:65339c530def | 50 | "tls-socket.debug-level": 0, |
coisme | 0:f96053986356 | 51 | "platform.stdio-baud-rate": 115200, |
coisme | 0:f96053986356 | 52 | "platform.stdio-convert-newlines": true |
coisme | 0:f96053986356 | 53 | }, |
coisme | 0:f96053986356 | 54 | "HEXIWEAR": { |
coisme | 0:f96053986356 | 55 | "esp8266-tx": "PTD3", |
coisme | 0:f96053986356 | 56 | "esp8266-rx": "PTD2" |
coisme | 0:f96053986356 | 57 | }, |
coisme | 0:f96053986356 | 58 | "NUCLEO_F401RE": { |
coisme | 0:f96053986356 | 59 | "esp8266-tx": "D8", |
coisme | 0:f96053986356 | 60 | "esp8266-rx": "D2" |
coisme | 0:f96053986356 | 61 | }, |
coisme | 0:f96053986356 | 62 | "NUCLEO_F411RE": { |
coisme | 0:f96053986356 | 63 | "esp8266-tx": "D8", |
coisme | 0:f96053986356 | 64 | "esp8266-rx": "D2" |
coisme | 0:f96053986356 | 65 | } |
coisme | 0:f96053986356 | 66 | } |
coisme | 0:f96053986356 | 67 | } |