Rust
Rust
Example: Crypt2.SetSigningCert method
Demonstrates how to call the SetSigningCert method.Chilkat Rust Downloads
// Signing certificates can be obtained from many different sources..
// Load from a PFX
let crypt_a = chilkat::Crypt2::new();
let cert_a = chilkat::Cert::new();
let _ = cert_a.load_pfx_file("c:/someDir/pfx_files/a.pfx", "pfx_file_password").is_ok();
let _ = crypt_a.set_signing_cert(&cert_a).is_ok();
// ...
// Load from a smart card or USB token.
let crypt_b = chilkat::Crypt2::new();
let cert_b = chilkat::Cert::new();
cert_b.set_smart_card_pin("123456");
let _ = cert_b.load_from_smartcard("").is_ok();
let _ = crypt_b.set_signing_cert(&cert_b).is_ok();
// ...
// Load from a the Windows certificate store or macOS keychain
let crypt_c = chilkat::Crypt2::new();
let cert_c = chilkat::Cert::new();
let _ = cert_c.load_by_common_name("Xyz 123").is_ok();
let _ = crypt_c.set_signing_cert(&cert_c).is_ok();
// ...