Chilkat2-Python
Chilkat2-Python
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 Chilkat2-Python Downloads
import sys
import chilkat2
success = False
# Load a private key from base64.
bd = chilkat2.BinData()
success = bd.AppendEncoded("MHQCA....n0Q==","base64")
privKey = chilkat2.PrivateKey()
success = privKey.LoadAnyFormat(bd,"")
if (success == False):
print(privKey.LastErrorText)
sys.exit()
pubKey = chilkat2.PublicKey()
privKey.ToPublicKey(pubKey)
pubKeyBase64 = pubKey.GetEncoded(True,"base64")
print(pubKeyBase64)