安信可 HTTP server with TLS support using mbedTLS示例 ====== .. raw:: html HTTP server with TLS support using mbedTLS -------------- Simple HTTPS example that uses mbedTLS to establish a secure socket connection using the certificate bundle with two custom certificates added for verification》 Configure WiFi Connected ::::::::: Please configure the ssid and password that need to be connected to WiFi in advance,in `main.c`. .. code-block:: c #define ROUTER_SSID "your ssid" #define ROUTER_PWD "your password" Compile and download ::::::::::: Compile command ::::::: make -j16 `-j16`is the number of cores in the system. make flash p=/dev/ttyUSB0 b=921600 `/dev/ttyUSBx`is the port number of the Ai-WB2 connection, usually ttyUSB0 Example Output :::::: :: [WF][SM] Exiting wifiConnected_ipObtaining state [WF][SM] State Action ###wifiConnected_ipObtaining### --->>> ###wifiConnected_IPOK### [WF][SM] Entering wifiConnected_IPOK state [APP] [EVT] GOT IP 5535 [SYS] Memory left is 146104 Bytes INFO (5536)[demo.c: 74] Seeding the random number generator INFO (5538)[demo.c: 86] Loading the CA root certificate... INFO (5604)[demo.c: 98] Setting hostname for TLS session... INFO (5604)[demo.c: 107] Setting up the SSL/TLS structure... INFO (5606)[demo.c: 137] Connecting to www.howsmyssl.com:443... -----------------> AABA Request: A-MSDU: Permitted Block Ack Policy: Immediate Block Ack TID: 0 Number of Buffers: 64 -----------------> AABA Response: A-MSDU: Not Permitted Block Ack Policy: Immediate Block Ack TID: 0 Number of Buffers: 8 -----------------> AABA Request: A-MSDU: Permitted Block Ack Policy: Immediate Block Ack TID: 3 Number of Buffers: 64 -----------------> AABA Response: A-MSDU: Not Permitted Block Ack Policy: Immediate Block Ack TID: 3 Number of Buffers: 8 INFO (6071)[demo.c: 146] Connected. INFO (6071)[demo.c: 150] Performing the SSL/TLS handshake... INFO (8014)[demo.c: 161] Verifying peer X.509 certificate... WARN (8014)[demo.c: 166] Failed to verify peer certificate! WARN (8015)[demo.c: 169] verification info: ! The certificate is not correctly signed by the trusted CA INFO (8015)[demo.c: 176] Cipher suite is TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256 INFO (8016)[demo.c: 178] Writing HTTP request... INFO (8018)[demo.c: 188] 103 bytes written INFO (8018)[demo.c: 198] Reading HTTP response... 511 bytes read 511 bytes read 157 bytes read 511 bytes read 431 bytes read INFO (8242)[demo.c: 251] Completed 1 requests INFO (8243)[demo.c: 255] 10... INFO (9243)[demo.c: 255] 9... INFO (10243)[demo.c: 255] 8... INFO (11243)[demo.c: 255] 7... INFO (12243)[demo.c: 255] 6... INFO (13243)[demo.c: 255] 5... INFO (14243)[demo.c: 255] 4... INFO (15243)[demo.c: 255] 3... INFO (16243)[demo.c: 255] 2... Troubleshooting ::::::::::::: For any technical queries, please open an [issue](https://github.com/Ai-Thinker-Open/Ai-Thinker-WB2/issues) on GitHub. We will get back to you soon.