C#
C#
Get Base64 Public Key from Private Key
See more ECC Examples
Demonstrates how to get the public key in base64 format from a private key.Chilkat C# Downloads
bool success = false;
// Load a private key from base64.
Chilkat.BinData bd = new Chilkat.BinData();
success = bd.AppendEncoded("MHQCA....n0Q==","base64");
Chilkat.PrivateKey privKey = new Chilkat.PrivateKey();
success = privKey.LoadAnyFormat(bd,"");
if (success == false) {
Debug.WriteLine(privKey.LastErrorText);
return;
}
Chilkat.PublicKey pubKey = new Chilkat.PublicKey();
privKey.ToPublicKey(pubKey);
string pubKeyBase64 = pubKey.GetEncoded(true,"base64");
Debug.WriteLine(pubKeyBase64);