Merge branch 'feat/updating_configs_of_esp_https_server' into 'master'

feat(esp_https_server): Updated the ESP_TLS_SERVER_CERT_SELECT_HOOK config

Closes IDF-8418

See merge request espressif/esp-idf!33966
This commit is contained in:
Mahavir Jain
2024-11-15 18:35:00 +08:00
9 changed files with 55 additions and 7 deletions

View File

@@ -70,6 +70,26 @@ Application Examples
- :example:`protocols/https_server/wss_server` demonstrates how to create an SSL server with a simple WebSocket request handler that supports handling multiple clients, PING-PONG mechanism, and sending asynchronous messages to all clients.
HTTPS Server Cert Selection Hook
--------------------------------
The ESP HTTPS Server component provides an option to set the server certification selection hook. This feature allows you to configure and use a certificate selection callback during server handshake. The callback helps to select a certificate to present to the client based on the TLS extensions supplied in the client hello message, such as ALPN and SNI. To enable this feature, please enable :ref:`CONFIG_ESP_HTTPS_SERVER_CERT_SELECT_HOOK` in the ESP HTTPS Server menuconfig. Note that you also need to enable :ref:`CONFIG_ESP_TLS_SERVER_CERT_SELECT_HOOK` from the ESP-TLS component, as this option depends on it. Please note that the ESP-TLS option is only available when Mbedtls is used as the TLS stack for ESP-TLS (default behaviour).
When enabled, you can set the certificate selection callback using the :cpp:member:`httpd_ssl_config::cert_select_cb` member of the :cpp:type:`httpd_ssl_config_t` structure.
.. code-block:: c
int cert_selection_callback(mbedtls_ssl_context *ssl)
{
/* Code that the callback should execute */
return 0;
}
httpd_ssl_config_t cfg = {
cert_select_cb = cert_section_callback,
};
API Reference
-------------