Sample code for 30+ languages & platforms
Visual FoxPro

Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem

See more OpenSSL Examples

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

Chilkat Visual FoxPro Downloads

Visual FoxPro
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