Sample code for 30+ languages & platforms
Rust

Convert Certificate from DER to PEM.

See more Certificates Examples

Loads a digital certificate from any format, such as DER, and saves to PEM format.

Chilkat Rust Downloads

Rust

let cert = chilkat::Cert::new();

// LoadFromFile will load virtually any certificate format file.
// It will auto-recognize the format and load appropiately.
// In this case, load a DER format certificate and convert to PEM.
if cert.load_from_file("qa_data/certs/testCert.cer").is_err() {
    println!("{}", cert.last_error_text());
    return;
}

if cert.export_cert_pem_file("qa_data/certs/testCert.pem").is_err() {
    println!("{}", cert.last_error_text());
    return;
}

println!("Converted certificate from DER to PEM format.");