Perl Requires Chilkat v11.0.0+
Perl
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 Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $pkey = Chilkat2::PrivateKey->new;
# Load the private key from an PEM file:
my $success = $pkey->LoadPemFile('private.pem');
if (!$success) {
print $pkey->LastErrorText, "\n";
exit;
}
my $pubKey = Chilkat2::PublicKey->new;
$pkey->ToPublicKey($pubKey);
$success = $pubKey->SavePemFile(0, 'pubKey.pem');
if (!$success) {
print $pubKey->LastErrorText, "\n";
exit;
}
print "Success.\n";