esp_http_client: Add option to use secure_element

Closes https://github.com/espressif/esp-idf/issues/10071
This commit is contained in:
Aditya Patwardhan 2022-11-01 13:45:22 +05:30
parent 3247cd05e4
commit ba43063314
3 changed files with 23 additions and 0 deletions

View File

@ -655,6 +655,12 @@ esp_http_client_handle_t esp_http_client_init(const esp_http_client_config_t *co
}
}
#if CONFIG_ESP_TLS_USE_SECURE_ELEMENT
if (config->use_secure_element) {
esp_transport_ssl_use_secure_element(ssl);
}
#endif
if (config->client_key_pem) {
if (!config->client_key_len) {
esp_transport_ssl_set_client_key_data(ssl, config->client_key_pem, strlen(config->client_key_pem));

View File

@ -139,6 +139,9 @@ typedef struct {
int keep_alive_interval; /*!< Keep-alive interval time. Default is 5 (second) */
int keep_alive_count; /*!< Keep-alive packet retry send count. Default is 3 counts */
struct ifreq *if_name; /*!< The name of interface for data to go through. Use the default interface without setting */
#if CONFIG_ESP_TLS_USE_SECURE_ELEMENT
bool use_secure_element; /*!< Enable this option to use secure element */
#endif
} esp_http_client_config_t;
/**

View File

@ -31,6 +31,20 @@ To allow ESP HTTP client to take full advantage of persistent connections, one s
Check out the example functions ``http_rest_with_url`` and ``http_rest_with_hostname_path`` in the application example. Here, once the connection is created, multiple requests (``GET``, ``POST``, ``PUT``, etc.) are made before the connection is closed.
.. only:: esp32
Use Secure Element (ATECC608) for TLS
_____________________________________
A secure element (ATECC608) can be also used for the underlying TLS connection in the HTTP client connection. Please refer to Secure Element with ESP-TLS section in the :doc:` ESP-TLS documentation</api-reference/protocols/esp_tls` for more details. The secure element support has to be first enabled in menuconfig through :ref:`CONFIG_ESP_TLS_USE_SECURE_ELEMENT`. Then the HTTP client can be configured to use secure element as follows:
.. code-block:: c
esp_http_client_config_t cfg = {
/* other configurations options */
.use_secure_element = true,
};
HTTPS Request
-------------