Rust
Rust
Example: Crypt2.SetDecryptCert method
Demonstrates how to call the SetDecryptCert method.Chilkat Rust Downloads
let cert = chilkat::Cert::new();
if cert.load_pfx_file("c:/pfx_files/my.pfx", "password").is_err() {
println!("{}", cert.last_error_text());
return;
}
let decrypt = chilkat::Crypt2::new();
decrypt.set_crypt_algorithm("pki");
if decrypt.set_decrypt_cert(&cert).is_err() {
println!("{}", decrypt.last_error_text());
return;
}
let bd = chilkat::BinData::new();
let _ = bd.load_file("c:/someDir/pkcs7_encrypted.dat").is_ok();
if decrypt.decrypt_bd(&bd).is_err() {
println!("{}", decrypt.last_error_text());
return;
}
// bd contains the decrypted content.