Closed
Description
Related area
WiFiClientSecure
Hardware specification
Any
Is your feature request related to a problem?
The function
int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, bool useRootCABundle, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos
uses host
to resolve the ip and use the it as expected CN. In some cases the CN information is provided by other means
Describe the solution you'd like
Provide a mean to set the CN when it is different.
Describe alternatives you've considered
No response
Additional context
#7350 is tangentially related.
I have checked existing list of Feature requests and the Contribution Guide
- I confirm I have checked existing list of Feature requests and Contribution Guide.
Activity
cziter15 commentedon Dec 8, 2022
Generally speaking, there is some room for refactoring of ssl_client and WiFiClientSecure.
When you look at WiFiClientSecure, you'll see that it simply converts IPAddress to string, passing it to the start_ssl_client function.
Mentioned bug from additonal context has been fixed by #7351 , it will skip host translation logic when it's an IP address, but still some operations are not necessary (redundant string conversions and calls).
Why start_ssl_client uses const char* hostname? I suspect that the idea was to have a proper hostname for certificate validation (parameter of mbedtls_ssl_set_hostname).
The solution is simple - introduce another optional (NULL by default) sslHostname parameter and replace current hostname parameter with IPAddress. You'll then have to translate hostname on your own, but it's not a big deal. It should be done also in WiFiClientSecure.
cziter15 commentedon Dec 31, 2022
I've issued PR that aims to resolve this issue.
Parsaabasi commentedon Jan 16, 2025
Hello,
Due to the overwhelming volume of issues currently being addressed, we have decided to close the previously received tickets. If you still require assistance or if the issue persists, please don't hesitate to reopen the ticket.
Thanks.