expression

Build a client with standard certificate verification

The ordinary client builder configures server verification using supplied roots. with_no_client_auth means the client does not present its own certificate; it does not switch off server verification. Empty roots are intentionally used for an offline configuration demonstration, not for successful connections. External crate example; candidate dependency is not approved for deployment. Expected stdout (not executed): true Common mistake: Confusing lack of client certificate authentication with lack of server verification.

Formal Syntax & Structure

rust syntaxrust
ClientConfig::builder().with_root_certificates(roots).with_no_client_auth()

Working Example

Example Snippetrust
fn main() {    use rustls::{ClientConfig, RootCertStore};    let config = ClientConfig::builder().with_root_certificates(RootCertStore::empty()).with_no_client_auth();    println!("{}", config.alpn_protocols.is_empty());}
Rust Reference