Rust Requires Chilkat v11.0.0+
Rust
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.Chilkat Rust Downloads
let cert = chilkat::Cert::new();
let str_pem = "-----BEGIN CERTIFICATE----- ...".to_string();
if cert.load_pem(&str_pem).is_err() {
println!("{}", cert.last_error_text());
return;
}
let pub_key = chilkat::PublicKey::new();
let _ = cert.get_public_key(&pub_key);
// You can now use the public key object however it is needed,
// and access its various properties and methods..
println!("{}", pub_key.get_xml().unwrap_or_default());