PHP : Function Reference : OpenSSL Functions : openssl_pkey_export
07-may-2007 08:31
you can get public key using openssl_pkey_get_details(resource $key ) function:
<?php
$pub_key = openssl_pkey_get_public(file_get_contents('./cert.crt'));
$keyData = openssl_pkey_get_details($pub_key);
fule_put_contents('./key.pub', $keyData['key']);
?>
robbat2
Warning, this function is NOT capable of exporting PEM-encoded public keys. It can only export private keys.
|