(Visual FoxPro) Get Base64 Public Key from Private Key
Demonstrates how to get the public key in base64 format from a private key.
LOCAL loBd
LOCAL lnSuccess
LOCAL loPrivKey
LOCAL loPubKey
LOCAL lcPubKeyBase64
* Load a private key from base64.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.BinData')
loBd = CreateObject('Chilkat.BinData')
lnSuccess = loBd.AppendEncoded("MHQCA....n0Q==","base64")
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.PrivateKey')
loPrivKey = CreateObject('Chilkat.PrivateKey')
lnSuccess = loPrivKey.LoadAnyFormat(loBd,"")
IF (lnSuccess = 0) THEN
? loPrivKey.LastErrorText
RELEASE loBd
RELEASE loPrivKey
CANCEL
ENDIF
loPubKey = loPrivKey.GetPublicKey()
IF (loPrivKey.LastMethodSuccess = 0) THEN
? loPrivKey.LastErrorText
RELEASE loBd
RELEASE loPrivKey
CANCEL
ENDIF
lcPubKeyBase64 = loPubKey.GetEncoded(1,"base64")
? lcPubKeyBase64
RELEASE loPubKey
RELEASE loBd
RELEASE loPrivKey
|