php and openss functions



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
.



Relevant Pages

  • RSA private key/PKCS12 format
    ... I have a problem with a pkcs12 file, I tryed to extract the private key ... Stefan ...
    (microsoft.public.dotnet.security)
  • Re: server certificate private key
    ... the cert together with the private key. ... Back Up a Server Certificate in Internet Information Services 5.0 ... > private key and the public key, and we can see the public ...
    (microsoft.public.inetserver.iis.security)
  • Re: php and openss functions
    ... > I´m trying to extract an private key from a server certificate. ... Steve ... Prev by Date: ...
    (alt.php)
  • Getting a private key from a file
    ... We are trying to extract a private key that is currently in a file after ... being saved as a byte array. ... the actual object PrivateKey. ...
    (sci.crypt)
  • Re: Cannot Decrypt Files
    ... Is there way to extract the private key from a certificate and make it ...
    (microsoft.public.win2000.security)