Sample code for 30+ languages & platforms
Rust

Convert DSA Public Key DER to PEM

See more DSA Examples

Converts a DSA public key from DER format to PEM.

Chilkat Rust Downloads

Rust

// 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 DER public key.
if dsa.from_public_der_file("dsa_pub.der").is_err() {
    println!("{}", dsa.last_error_text());
    return;
}

// Save the public key to PEM:
let pem_str = dsa.to_public_pem().unwrap_or_default();
if dsa.save_text(&pem_str, "dsa_pub.pem").is_err() {
    println!("{}", dsa.last_error_text());
    return;
}

println!("Finished!");