C#
C#
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 C# Downloads
bool success = false;
Chilkat.PrivateKey pkey = new Chilkat.PrivateKey();
// Load the private key from an PEM file:
success = pkey.LoadPemFile("private.pem");
if (success == false) {
Debug.WriteLine(pkey.LastErrorText);
return;
}
Chilkat.PublicKey pubKey = new Chilkat.PublicKey();
pkey.ToPublicKey(pubKey);
success = pubKey.SavePemFile(false,"pubKey.pem");
if (success != true) {
Debug.WriteLine(pubKey.LastErrorText);
return;
}
Debug.WriteLine("Success.");