esp-idf/examples/protocols/https_x509_bundle
Mahavir Jain 1d61e300ac
tests: update Root certificate for the test endpoints
Use Root certificate (`DigiCert Global Root G2`) for the
`dl.espressif.com` and `espressif.com` test endpoints.

This fixes the test failure introduced due to renewal of
the intermediate certificate.
2023-05-17 15:28:46 +05:30
..
certs tests: update Root certificate for the test endpoints 2023-05-17 15:28:46 +05:30
main Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
CMakeLists.txt Add ESP certificate bundle feature 2020-03-04 10:51:43 +08:00
example_test.py Split example_tests with Example_WIFI tag group into Example_OTA and Example_Protocols 2021-04-15 04:00:06 +00:00
Makefile Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
README.md docs: Updated protocols/http* examples READMEs 2021-09-13 09:55:19 +05:30
sdkconfig.ci feat(mbedtls): add dynamic buffer and local resource managment to decrease SSL heap cost 2020-05-14 11:45:09 +00:00
sdkconfig.ci.ssldyn feat(mbedtls): add dynamic buffer and local resource managment to decrease SSL heap cost 2020-05-14 11:45:09 +00:00
sdkconfig.defaults Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00

HTTPS x509 Bundle Example

This example shows how to use the ESP certificate bundle utility to embed a bundle of x509 certificates and use them to establish a simple HTTPS connection over a secure connection. The path of the certificates are specified using menuconfig.

See the README.md file in the upper level 'examples' directory for more information about examples.

Example workflow

  • ESP TLS is initialized with the certificate bundle option enabled.
  • The application loops through the given URLs, establishing a secure TLS connection to all of them, verifying the server certificate included.

Configure the project

  • Open the project configuration menu (idf.py menuconfig)
  • Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in examples/protocols/README.md for more details.
  • When using Make build system, set Default serial port under Serial flasher config.
  • If using a different folder than certs for storing certificates then update Custom Certificate Bundle Path under Component config - mbedTLS - Certificate Bundle

Build and Flash

Build the project and flash it to the board, then run monitor tool to view serial output:

idf.py -p PORT flash monitor

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

Example Output

I (0) cpu_start: Starting scheduler on APP CPU.
I (491) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (4051) example_connect: Ethernet Link Up
I (5971) tcpip_adapter: eth ip: 192.168.2.137, mask: 255.255.255.0, gw: 192.168.2.2
I (5971) example_connect: Connected to Ethernet
I (5971) example_connect: IPv4 address: 192.168.2.137
I (5971) example_connect: IPv6 address: fe80:0000:0000:0000:bedd:c2ff:fed4:a92b
I (5981) example: Connecting to 2 URLs
I (7100) esp-x509-crt-bundle: Certificate validated
I (8371) example: Connection established to https://www.howsmyssl.com/a/check
I (11730) esp-x509-crt-bundle: Certificate validated
I (11821) example: Connection established to https://espressif.com
I (12821) example: Completed 2 connections
I (12821) example: Starting over again...