(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
Note: This example requires Chilkat v11.0.0 or greater.
LOCAL lnSuccess
LOCAL loPkey
LOCAL loPubKey
lnSuccess = 0
loPkey = CreateObject('Chilkat.PrivateKey')
* Load the private key from an PEM file:
lnSuccess = loPkey.LoadPemFile("private.pem")
IF (lnSuccess = 0) THEN
? loPkey.LastErrorText
RELEASE loPkey
CANCEL
ENDIF
loPubKey = CreateObject('Chilkat.PublicKey')
loPkey.ToPublicKey(loPubKey)
lnSuccess = loPubKey.SavePemFile(0,"pubKey.pem")
IF (lnSuccess <> 1) THEN
? loPubKey.LastErrorText
RELEASE loPubKey
RELEASE loPkey
RELEASE loPubKey
CANCEL
ENDIF
? "Success."
RELEASE loPkey
RELEASE loPubKey
|