feat: Add domain match to wifi_enterprise example

This commit is contained in:
Michael Stoll
2025-03-14 17:17:09 +01:00
committed by Kapil Gupta
parent 134b9ac589
commit 8144ed8599
2 changed files with 15 additions and 0 deletions

View File

@@ -99,4 +99,16 @@ menu "Example Configuration"
default n
help
Use default CA certificate bundle for WiFi enterprise connection
config EXAMPLE_USE_SERVER_DOMAIN_MATCH
bool "Validate server cert domain"
help
Validate the certificate domain
config EXAMPLE_SERVER_DOMAIN_MATCH_VALUE
string "Server cert domain"
depends on EXAMPLE_USE_SERVER_DOMAIN_MATCH
default "espressif.com"
help
Accept only server certificates matching this domain
endmenu

View File

@@ -155,6 +155,9 @@ static void initialise_wifi(void)
#endif
#ifdef CONFIG_EXAMPLE_USE_DEFAULT_CERT_BUNDLE
ESP_ERROR_CHECK(esp_eap_client_use_default_cert_bundle(true));
#endif
#ifdef CONFIG_EXAMPLE_USE_SERVER_DOMAIN_MATCH
ESP_ERROR_CHECK(esp_eap_client_set_domain_match(CONFIG_EXAMPLE_SERVER_DOMAIN_MATCH_VALUE));
#endif
ESP_ERROR_CHECK(esp_wifi_sta_enterprise_enable());
ESP_ERROR_CHECK(esp_wifi_start());