Sample code for 30+ languages & platforms
Delphi DLL

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 Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, PrivateKey, PublicKey;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
pkey: HCkPrivateKey;
pubKey: HCkPublicKey;

begin
success := False;

pkey := CkPrivateKey_Create();

// Load the private key from an PEM file:
success := CkPrivateKey_LoadPemFile(pkey,'private.pem');
if (success = False) then
  begin
    Memo1.Lines.Add(CkPrivateKey__lastErrorText(pkey));
    Exit;
  end;

pubKey := CkPublicKey_Create();
CkPrivateKey_ToPublicKey(pkey,pubKey);

success := CkPublicKey_SavePemFile(pubKey,False,'pubKey.pem');
if (success <> True) then
  begin
    Memo1.Lines.Add(CkPublicKey__lastErrorText(pubKey));
    CkPublicKey_Dispose(pubKey);
    Exit;
  end;

Memo1.Lines.Add('Success.');

CkPrivateKey_Dispose(pkey);
CkPublicKey_Dispose(pubKey);

end;