Sample code for 30+ languages & platforms
B4X Requires Chilkat v11.0.0+

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

B4X
Dim success As Boolean = False

Dim pkey As ChilkatPrivateKey
pkey.Initialize("pkey")

'  Load the private key from an PEM file:
success = pkey.LoadPemFile("private.pem")
If success = False Then
    Log(pkey.LastErrorText)
    Return
End If


Dim pubKey As ChilkatPublicKey
pubKey.Initialize
pkey.ToPublicKey(pubKey)

success = pubKey.SavePemFile(False, "pubKey.pem")
If success <> True Then
    Log(pubKey.LastErrorText)

    Return
End If


Log("Success.")