Hello,

I´m trying to extract an private key from a server certificate.

$server_pwd="password";
$server_cert="/path/to/certificate";
$fp=fopen($server_cert,"rb");
$certificate=fread($fp,filesize($server_cert));
fclose($fp);
echo "<BR>$certificate";
echo "<BR>";
$key_id=openssl_get_privatekey($certificate,$server_pwd);
echo "<BR>";
echo openssl_error_string();

The certificate is read. Extraction of the private key fails, however.

openssl_error_string() tells:

error:0906D06C:PEM routines:PEM_read_bio:no start line

What´s wrong??

Thanks

Harry