Sample code for 30+ languages & platforms
B4X Requires Chilkat v11.0.0+

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 B4X Downloads

B4X
Dim success As Boolean = False

'  Load a private key from base64.
Dim bd As ChilkatBinData
bd.Initialize
success = bd.AppendEncoded("MHQCA....n0Q==", "base64")

Dim privKey As ChilkatPrivateKey
privKey.Initialize("privKey")
success = privKey.LoadAnyFormat(bd, "")
If success = False Then
    Log(privKey.LastErrorText)
    Return
End If


Dim pubKey As ChilkatPublicKey
pubKey.Initialize
privKey.ToPublicKey(pubKey)

Dim pubKeyBase64 As String = pubKey.GetEncoded(True, "base64")
Log(pubKeyBase64)