DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Variant vBd
Handle hoBd
Handle hoPrivKey
Variant vPubKey
Handle hoPubKey
String sPubKeyBase64
String sTemp1
Move False To iSuccess
// Load a private key from base64.
Get Create (RefClass(cComChilkatBinData)) To hoBd
If (Not(IsComObjectCreated(hoBd))) Begin
Send CreateComObject of hoBd
End
Get ComAppendEncoded Of hoBd "MHQCA....n0Q==" "base64" To iSuccess
Get Create (RefClass(cComChilkatPrivateKey)) To hoPrivKey
If (Not(IsComObjectCreated(hoPrivKey))) Begin
Send CreateComObject of hoPrivKey
End
Get pvComObject of hoBd to vBd
Get ComLoadAnyFormat Of hoPrivKey vBd "" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoPrivKey To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatPublicKey)) To hoPubKey
If (Not(IsComObjectCreated(hoPubKey))) Begin
Send CreateComObject of hoPubKey
End
Get pvComObject of hoPubKey to vPubKey
Get ComToPublicKey Of hoPrivKey vPubKey To iSuccess
Get ComGetEncoded Of hoPubKey True "base64" To sPubKeyBase64
Showln sPubKeyBase64
End_Procedure