PHP Extension
PHP Extension
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 PHP Extension Downloads
<?php
include("chilkat.php");
$success = false;
$pkey = new CkPrivateKey();
// Load the private key from an PEM file:
$success = $pkey->LoadPemFile('private.pem');
if ($success == false) {
print $pkey->lastErrorText() . "\n";
exit;
}
$pubKey = new CkPublicKey();
$pkey->ToPublicKey($pubKey);
$success = $pubKey->SavePemFile(false,'pubKey.pem');
if ($success != true) {
print $pubKey->lastErrorText() . "\n";
exit;
}
print 'Success.' . "\n";
?>