Go
Go
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 Go Downloads
success := false
// Load a private key from base64.
bd := chilkat.NewBinData()
success = bd.AppendEncoded("MHQCA....n0Q==","base64")
privKey := chilkat.NewPrivateKey()
success = privKey.LoadAnyFormat(bd,"")
if success == false {
fmt.Println(privKey.LastErrorText())
bd.DisposeBinData()
privKey.DisposePrivateKey()
return
}
pubKey := chilkat.NewPublicKey()
privKey.ToPublicKey(pubKey)
pubKeyBase64 := pubKey.GetEncoded(true,"base64")
fmt.Println(*pubKeyBase64)
bd.DisposeBinData()
privKey.DisposePrivateKey()
pubKey.DisposePublicKey()