pub fn client_tls(
key_prefix: &str,
ca: Option<&Path>,
server_name: &str,
client_cert: Option<&Path>,
client_key: Option<&Path>,
) -> Result<ClientTls, String>Expand description
Loads a client TLS configuration that verifies a peer as server_name.
ca set to a PEM bundle trusts exactly those certificate authorities;
None trusts the operating system’s trust store instead, which is where
an organizational CA normally lives.
client_cert/client_key set together present that certificate to the
peer — mutual TLS, this side proving itself rather than verifying the
other side. Both unset (the default) presents nothing, same as before
mutual TLS existed; exactly one set is a configuration error.
§Errors
Returns a message if ca/client_cert/client_key cannot be read or
parsed, if the OS trust store cannot be read and no ca was given, if
only one of client_cert/client_key is set, or if server_name is
not a usable DNS name or IP address.