Rust Requires Chilkat v11.0.0+
Rust
Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem
See more OpenSSL Examples
How to output the public part of a private key: Demonstrates how to duplicate this OpenSSL command:openssl pkey -in private.pem -pubout -out pubkey.pem
Chilkat Rust Downloads
let pkey = chilkat::PrivateKey::new();
// Load the private key from an PEM file:
if pkey.load_pem_file("private.pem").is_err() {
println!("{}", pkey.last_error_text());
return;
}
let pub_key = chilkat::PublicKey::new();
let _ = pkey.to_public_key(&pub_key);
if pub_key.save_pem_file(false, "pubKey.pem").is_err() {
println!("{}", pub_key.last_error_text());
return;
}
println!("Success.");