Rust
Rust
Enumerate Server-Advertised Acceptable Client CAs
See more Socket/SSL/TLS Examples
Demonstrates Socket.GetSslAcceptableClientCaDn, which returns a certificate-authority distinguished name advertised by a TLS server when it requests a client certificate.
Background. Valid indexes range from 0 through
NumSslAcceptableClientCAs minus one. A client can use these names to select an appropriate client certificate.Chilkat Rust Downloads
let socket = chilkat::Socket::new();
// Connect to the server using TLS.
let b_tls = true;
let max_wait_ms = 5000;
if socket.connect("example.com", 5000, b_tls, max_wait_ms).is_err() {
println!("{}", socket.last_error_text());
return;
}
// After connecting to a server that requests a client certificate, enumerate the certificate-
// authority distinguished names the server advertised as acceptable.
let num_c_as = socket.num_ssl_acceptable_client_c_as();
for i in 0..num_c_as {
let Ok(ca_dn) = socket.get_ssl_acceptable_client_ca_dn(i) else {
println!("{}", socket.last_error_text());
return;
};
println!("{}", ca_dn);
}