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

List Certificates in the Current User Certificate Store (Windows Only)

See more Certificates Examples

This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).

Chilkat Rust Downloads

Rust

// This is a Windows-only example because it lists the certificates
// stored in the Windows Current User Certificate Store located in the
// Windows Registry.

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

let read_only = true;
if cert_store.open_current_user_store(read_only).is_err() {
    println!("{}", cert_store.last_error_text());
    return;
}

let cert = chilkat::Cert::new();
let num_certs = cert_store.num_certificates();
let mut i = 0;
while i < num_certs {
    let _ = cert_store.get_cert(i, &cert);
    println!("DN = {}", cert.subject_dn());
    println!("Email = {}", cert.subject_e());
    i = i + 1;
}