Sample code for 30+ languages & platforms
Rust

Windows Certificate Stores - Find Certificate by Common Name

See more Certificates Examples

Searches the Windows certificate stores for a certificate that matches the specified common name (CN).

Note: This example requires Chilkat v10.0.0 or greater.

Chilkat Rust Downloads

Rust

let cert = chilkat::Cert::new();
if cert.load_by_common_name("Chilkat Software, Inc.").is_err() {
    println!("{}", cert.last_error_text());
    return;
}

println!("{}", cert.subject_dn());
println!("Success.");