Rust
Rust
DSA Public Key PEM to DER Conversion
See more DSA Examples
Converts a DSA public key from PEM format to DER.Chilkat Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let dsa = chilkat::Dsa::new();
// Load a PEM public key.
let pem_public_key = dsa.load_text("dsa_pub.pem").unwrap_or_default();
// Import the public key PEM into the DSA object.
if dsa.from_public_pem(&pem_public_key).is_err() {
println!("{}", dsa.last_error_text());
return;
}
// Write it out as a DER file:
if dsa.to_public_der_file("dsa_pub.der").is_err() {
println!("{}", dsa.last_error_text());
return;
}
println!("Finished!");