How to setup mutual tls https with esp idf in esp32?
Posted: Thu Sep 19, 2024 11:24 pm
I am trying to setup a mutual tls connection for a simple get request (later it will be other things)
However I cant seem to find any examples online.
I read the docs and thought i figured out how to do it however when i try to connect to the server i get this response:
I included the same certificates on postman and it worked like a charm so this is not the problem.
Does anyone has a link to some examples on how to do that or some tutorials?
Thanks in advance!
this is what i got for my code:
However I cant seem to find any examples online.
I read the docs and thought i figured out how to do it however when i try to connect to the server i get this response:
Code: Select all
<center><h1>400 Bad Request</h1></center>
<center>No required SSL certificate was sent</center>
I included the same certificates on postman and it worked like a charm so this is not the problem.
Does anyone has a link to some examples on how to do that or some tutorials?
Thanks in advance!
this is what i got for my code:
Code: Select all
char local_response_buffer[MAX_HTTP_OUTPUT_BUFFER + 1] = {0};
esp_http_client_config_t config = {
.host = "mtls.taylered.io",
.url = GET_VERSION_URL,
.event_handler = _http_event_handler,
.transport_type = HTTP_TRANSPORT_OVER_SSL,
.user_data = local_response_buffer,
.client_key_pem = (char *)key_buf,
.client_cert_pem = (char *)cert_buf,
.cert_pem = (char *)server_cert_pem_start,
#ifdef CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK
.skip_cert_common_name_check = true,
#endif
};
esp_http_client_handle_t client = esp_http_client_init(&config);
// GET
esp_err_t err = esp_http_client_perform(client);char local_response_buffer[MAX_HTTP_OUTPUT_BUFFER + 1] = {0};