Sample code for 30+ languages & platforms
Lianja

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 Lianja Downloads

Lianja
llSuccess = .F.

loPkey = createobject("CkPrivateKey")

// Load the private key from an PEM file:
llSuccess = loPkey.LoadPemFile("private.pem")
if (llSuccess = .F.) then
    ? loPkey.LastErrorText
    release loPkey
    return
endif

loPubKey = createobject("CkPublicKey")
loPkey.ToPublicKey(loPubKey)

llSuccess = loPubKey.SavePemFile(.F.,"pubKey.pem")
if (llSuccess <> .T.) then
    ? loPubKey.LastErrorText
    release loPubKey
    release loPkey
    release loPubKey
    return
endif

? "Success."


release loPkey
release loPubKey