Rust Requires Chilkat v10.1.2+
Rust
Apple Keychain - List Certificates
See more Apple Keychain Examples
Iterates over the certificates in the Apple Keychain.Chilkat Rust Downloads
let cert_store = chilkat::CertStore::new();
// On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
// The argument passed to OpenCurrentUserStore is ignored.
if cert_store.open_current_user_store(false).is_err() {
println!("{}", cert_store.last_error_text());
return;
}
let num_certs = cert_store.num_certificates();
println!("numCerts = {}", num_certs);
let cert = chilkat::Cert::new();
let mut i = 0;
while i < num_certs {
let _ = cert_store.get_cert(i, &cert);
println!("{}", cert.subject_dn());
println!("{}", cert.subject_cn());
println!("{}", cert.serial_number());
println!("----");
i = i + 1;
}
let _ = cert_store.close_cert_store();