Sample code for 30+ languages & platforms
Rust Requires Chilkat v10.1.2+

Find a Certificate in the "Other People" Windows Certificate Store

See more Certificates Examples

Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.

Chilkat Rust Downloads

Rust

let cert_store = chilkat::CertStore::new();

// The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
let read_only = true;
if cert_store.open_windows_store("CurrentUser", "AddressBook", read_only).is_err() {
    println!("{}", cert_store.last_error_text());
    return;
}

// Find the certificate for the email address:
let json_e = chilkat::JsonObject::new();
let _ = json_e.update_string("email", "joe@example.com");

let cert = chilkat::Cert::new();
if cert_store.find_cert(&json_e, &cert).is_err() {
    println!("{}", cert_store.last_error_text());
    return;
}

println!("Found certificate: {}", cert.subject_dn());