.NET Core C#
.NET Core C#
Get Public Key from Certificate PEM
See more Certificates Examples
Loads a certificate from a PEM file and gets the cert's public key.Chilkat .NET Core C# Downloads
bool success = false;
Chilkat.Cert cert = new Chilkat.Cert();
success = cert.LoadFromFile("qa_data/certs/someCert.pem");
if (success == false) {
Debug.WriteLine(cert.LastErrorText);
return;
}
// Get the certificate's public key:
Chilkat.PublicKey pubkey = new Chilkat.PublicKey();
cert.GetPublicKey(pubkey);
Debug.WriteLine(pubkey.GetPem(false));
// OK.. we have the public key which can be used in other Chilkat classes/methods...