(Visual FoxPro) Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem
How to output the public part of a private key:
Demonstrates how to duplicate this OpenSSL command:
openssl pkey -in private.pem -pubout -out pubkey.pem
LOCAL loPkey
LOCAL lnSuccess
LOCAL loPubKey
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.PrivateKey')
loPkey = CreateObject('Chilkat.PrivateKey')
* Load the private key from an PEM file:
lnSuccess = loPkey.LoadPemFile("private.pem")
IF (lnSuccess <> 1) THEN
? loPkey.LastErrorText
RELEASE loPkey
CANCEL
ENDIF
loPubKey = loPkey.GetPublicKey()
IF (loPkey.LastMethodSuccess = 0) THEN
? loPkey.LastErrorText
RELEASE loPkey
CANCEL
ENDIF
lnSuccess = loPubKey.SavePemFile(0,"pubKey.pem")
IF (lnSuccess <> 1) THEN
? loPubKey.LastErrorText
RELEASE loPubKey
RELEASE loPkey
CANCEL
ENDIF
? "Success."
RELEASE loPubKey
RELEASE loPkey
|