Sample code for 30+ languages & platforms
VB.NET

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 VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim pkey As New Chilkat.PrivateKey

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


Dim pubKey As New Chilkat.PublicKey
pkey.ToPublicKey(pubKey)

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

    Exit Sub
End If


Debug.WriteLine("Success.")