![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Catie fork
Dependencies: SDFileSystem X_NUCLEO_IKS01A1
Fork of ATT_AWS_IoT_demo by
README.md@2:270602af41c9, 2016-07-28 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Jul 28 23:14:10 2016 +0100
- Revision:
- 2:270602af41c9
- Child:
- 5:8275e4cee0d5
Update examples to use mbed-os-5.1.0-rc3.
Commit copied from ./src/github.com/ARMmbed/mbed-os-example-tls
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 2:270602af41c9 | 1 | # HTTPS File Download Example for TLS Client on mbed OS |
mbed_official | 2:270602af41c9 | 2 | |
mbed_official | 2:270602af41c9 | 3 | This application downloads a file from an HTTPS server (developer.mbed.org) and looks for a specific string in that file. |
mbed_official | 2:270602af41c9 | 4 | |
mbed_official | 2:270602af41c9 | 5 | # Getting started |
mbed_official | 2:270602af41c9 | 6 | |
mbed_official | 2:270602af41c9 | 7 | Set up your environment if you have not done so already. For instructions, refer to the [main readme](../README.md). |
mbed_official | 2:270602af41c9 | 8 | |
mbed_official | 2:270602af41c9 | 9 | ## Required hardware |
mbed_official | 2:270602af41c9 | 10 | |
mbed_official | 2:270602af41c9 | 11 | This example also requires an Ethernet cable an connection to the internet additional to the hardware requirements in the [main readme](../README.md). |
mbed_official | 2:270602af41c9 | 12 | |
mbed_official | 2:270602af41c9 | 13 | ## Monitoring the application |
mbed_official | 2:270602af41c9 | 14 | |
mbed_official | 2:270602af41c9 | 15 | __NOTE:__ Make sure that the Ethernet cable is plugged in correctly before running the application. |
mbed_official | 2:270602af41c9 | 16 | |
mbed_official | 2:270602af41c9 | 17 | The output in the terminal window should be similar to this: |
mbed_official | 2:270602af41c9 | 18 | |
mbed_official | 2:270602af41c9 | 19 | ``` |
mbed_official | 2:270602af41c9 | 20 | Using Ethernet LWIP |
mbed_official | 2:270602af41c9 | 21 | Client IP Address is 10.2.203.43 |
mbed_official | 2:270602af41c9 | 22 | Connecting with developer.mbed.org |
mbed_official | 2:270602af41c9 | 23 | Starting the TLS handshake... |
mbed_official | 2:270602af41c9 | 24 | TLS connection to developer.mbed.org established |
mbed_official | 2:270602af41c9 | 25 | Server certificate: |
mbed_official | 2:270602af41c9 | 26 | cert. version : 3 |
mbed_official | 2:270602af41c9 | 27 | serial number : 11:21:B8:47:9B:21:6C:B1:C6:AF:BC:5D:0C:19:52:DC:D7:C3 |
mbed_official | 2:270602af41c9 | 28 | issuer name : C=BE, O=GlobalSign nv-sa, CN=GlobalSign Organization Validation CA - SHA256 - G2 |
mbed_official | 2:270602af41c9 | 29 | subject name : C=GB, ST=Cambridgeshire, L=Cambridge, O=ARM Ltd, CN=*.mbed.com |
mbed_official | 2:270602af41c9 | 30 | issued on : 2016-03-03 12:26:08 |
mbed_official | 2:270602af41c9 | 31 | expires on : 2017-04-05 10:31:02 |
mbed_official | 2:270602af41c9 | 32 | signed using : RSA with SHA-256 |
mbed_official | 2:270602af41c9 | 33 | RSA key size : 2048 bits |
mbed_official | 2:270602af41c9 | 34 | basic constraints : CA=false |
mbed_official | 2:270602af41c9 | 35 | subject alt name : *.mbed.com, mbed.org, *.mbed.org, mbed.com |
mbed_official | 2:270602af41c9 | 36 | key usage : Digital Signature, Key Encipherment |
mbed_official | 2:270602af41c9 | 37 | ext key usage : TLS Web Server Authentication, TLS Web Client Authentication |
mbed_official | 2:270602af41c9 | 38 | Certificate verification passed |
mbed_official | 2:270602af41c9 | 39 | |
mbed_official | 2:270602af41c9 | 40 | HTTPS: Received 439 chars from server |
mbed_official | 2:270602af41c9 | 41 | HTTPS: Received 200 OK status ... [OK] |
mbed_official | 2:270602af41c9 | 42 | HTTPS: Received 'Hello world!' status ... [OK] |
mbed_official | 2:270602af41c9 | 43 | HTTPS: Received message: |
mbed_official | 2:270602af41c9 | 44 | |
mbed_official | 2:270602af41c9 | 45 | HTTP/1.1 200 OK |
mbed_official | 2:270602af41c9 | 46 | Server: nginx/1.7.10 |
mbed_official | 2:270602af41c9 | 47 | Date: Wed, 20 Jul 2016 10:00:35 GMT |
mbed_official | 2:270602af41c9 | 48 | Content-Type: text/plain |
mbed_official | 2:270602af41c9 | 49 | Content-Length: 14 |
mbed_official | 2:270602af41c9 | 50 | Connection: keep-alive |
mbed_official | 2:270602af41c9 | 51 | Last-Modified: Fri, 27 Jul 2012 13:30:34 GMT |
mbed_official | 2:270602af41c9 | 52 | Accept-Ranges: bytes |
mbed_official | 2:270602af41c9 | 53 | Cache-Control: max-age=36000 |
mbed_official | 2:270602af41c9 | 54 | Expires: Wed, 20 Jul 2016 20:00:35 GMT |
mbed_official | 2:270602af41c9 | 55 | X-Upstream-L3: 172.17.0.3:80 |
mbed_official | 2:270602af41c9 | 56 | X-Upstream-L2: developer-sjc-indigo-1-nginx |
mbed_official | 2:270602af41c9 | 57 | Strict-Transport-Security: max-age=31536000; includeSubdomains |
mbed_official | 2:270602af41c9 | 58 | |
mbed_official | 2:270602af41c9 | 59 | Hello world! |
mbed_official | 2:270602af41c9 | 60 | ``` |
mbed_official | 2:270602af41c9 | 61 | |
mbed_official | 2:270602af41c9 | 62 | ## Debugging the TLS connection |
mbed_official | 2:270602af41c9 | 63 | |
mbed_official | 2:270602af41c9 | 64 | To print out more debug information about the TLS connection, edit the file `main.cpp` and change the definition of `DEBUG_LEVEL` (near the top of the file) from 0 to a positive number: |
mbed_official | 2:270602af41c9 | 65 | |
mbed_official | 2:270602af41c9 | 66 | * Level 1 only prints non-zero return codes from SSL functions and information about the full certificate chain being verified. |
mbed_official | 2:270602af41c9 | 67 | |
mbed_official | 2:270602af41c9 | 68 | * Level 2 prints more information about internal state updates. |
mbed_official | 2:270602af41c9 | 69 | |
mbed_official | 2:270602af41c9 | 70 | * Level 3 is intermediate. |
mbed_official | 2:270602af41c9 | 71 | |
mbed_official | 2:270602af41c9 | 72 | * Level 4 (the maximum) includes full binary dumps of the packets. |
mbed_official | 2:270602af41c9 | 73 | |
mbed_official | 2:270602af41c9 | 74 | |
mbed_official | 2:270602af41c9 | 75 | The TLS connection can fail with an error similar to: |
mbed_official | 2:270602af41c9 | 76 | |
mbed_official | 2:270602af41c9 | 77 | mbedtls_ssl_write() failed: -0x2700 (-9984): X509 - Certificate verification failed, e.g. CRL, CA or signature check failed |
mbed_official | 2:270602af41c9 | 78 | Failed to fetch /media/uploads/mbed_official/hello.txt from developer.mbed.org:443 |
mbed_official | 2:270602af41c9 | 79 | |
mbed_official | 2:270602af41c9 | 80 | This probably means you need to update the contents of the `SSL_CA_PEM` constant (this can happen if you modify `HTTPS_SERVER_NAME`, or when `developer.mbed.org` switches to a new CA when updating its certificate). |
mbed_official | 2:270602af41c9 | 81 | |
mbed_official | 2:270602af41c9 | 82 | Another possible reason for this error is a proxy providing a different certificate. Proxies can be used in some network configurations or for performing man-in-the-middle attacks. If you choose to ignore this error and proceed with the connection anyway, you can change the definition of `UNSAFE` near the top of the file from 0 to 1. |
mbed_official | 2:270602af41c9 | 83 | |
mbed_official | 2:270602af41c9 | 84 | **Warning:** this removes all security against a possible active attacker, so use at your own risk or for debugging only! |
mbed_official | 2:270602af41c9 | 85 |