Rust
Rust
Find Certificate by Subject OU (Organizational Unit)
See more Cert Store Examples
Demonstrates how to find a certificate having the specified subject organizational unit (OU).Note: Requires Chilkat v10.1.2 or later.
Chilkat Rust Downloads
let cert_store = chilkat::CertStore::new();
// This opens the Current User certificate store on Windows,
// On MacOS and iOS it opens the default Keychain.
let read_only = false;
if cert_store.open_current_user_store(read_only).is_err() {
println!("{}", cert_store.last_error_text());
return;
}
// Find the certificate having a Subject OU = "Secretaria da Receita Federal do Brasil - RFB".
let json = chilkat::JsonObject::new();
let ou = "Secretaria da Receita Federal do Brasil - RFB".to_string();
let _ = json.update_string("OU", &ou);
let cert = chilkat::Cert::new();
if cert_store.find_cert(&json, &cert).is_ok() {
// Show the full distinguished name of the certificate.
println!("Found: {}", cert.subject_dn());
} else {
println!("Not found.");
}