Rust
Rust
Load PFX/P12 from a Base64 Encoded PFX File
See more PFX/P12 Examples
Demonstrates how to call LoadPfxEncoded.Chilkat Rust Downloads
let bd = chilkat::BinData::new();
if bd.load_file("qa_data/pfx/cert_test123.pfx").is_err() {
println!("Failed to load PFX file.");
return;
}
// Get the bytes contained in the PFX in base64 format:
let str_base64 = bd.get_encoded("base64").unwrap_or_default();
// The base64 looks like this: "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..."
println!("{}", str_base64);
let pfx = chilkat::Pfx::new();
// Load the PFX from the base64 string
let password = "test123".to_string();
if pfx.load_pfx_encoded(&str_base64, "base64", &password).is_err() {
println!("{}", pfx.last_error_text());
return;
}
println!("success");