1# HTTPS x509 Bundle Example
2
3This example shows how to use the ESP certificate bundle utility to embed a bundle of x509 certificates and use them to
4establish a simple HTTPS connection over a secure connection. The path of the certificates are specified using menuconfig.
5
6See the README.md file in the upper level 'examples' directory for more information about examples.
7
8## Example workflow
9- ESP TLS is initialized with the certificate bundle option enabled.
10- The application loops through the given URLs, establishing a secure TLS connection to all of them, verifying the server certificate included.
11
12### Configure the project
13
14* Open the project configuration menu (`idf.py menuconfig`)
15* Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../README.md) for more details.
16* When using Make build system, set `Default serial port` under `Serial flasher config`.
17* If using a different folder than `certs` for storing certificates then update `Custom Certificate Bundle Path` under `Component config` - `mbedTLS` - `Certificate Bundle`
18
19### Build and Flash
20
21Build the project and flash it to the board, then run monitor tool to view serial output:
22
23```
24idf.py -p PORT flash monitor
25```
26
27(To exit the serial monitor, type ``Ctrl-]``.)
28
29See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
30
31## Example Output
32```
33I (0) cpu_start: Starting scheduler on APP CPU.
34I (491) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
35I (4051) example_connect: Ethernet Link Up
36I (5971) tcpip_adapter: eth ip: 192.168.2.137, mask: 255.255.255.0, gw: 192.168.2.2
37I (5971) example_connect: Connected to Ethernet
38I (5971) example_connect: IPv4 address: 192.168.2.137
39I (5971) example_connect: IPv6 address: fe80:0000:0000:0000:bedd:c2ff:fed4:a92b
40I (5981) example: Connecting to 2 URLs
41I (7100) esp-x509-crt-bundle: Certificate validated
42I (8371) example: Connection established to https://www.howsmyssl.com/a/check
43I (11730) esp-x509-crt-bundle: Certificate validated
44I (11821) example: Connection established to https://espressif.com
45I (12821) example: Completed 2 connections
46I (12821) example: Starting over again...
47```
48