I am trying to read a p12 formatted certificate file with php function openssl_pkcs12_read
. My code looks like this:
<?php
$fname = "./client-cert.p12";
$handle = fopen($fname, "r") or die ("Unable to open file!");
$p12buf = fread($handle, filesize($fname));
fclose($handle);
$certs = array();
$pass = "bliblablup";
$result = openssl_pkcs12_read($p12buf, $certs, $pass);
if ( $result ) {
print_r( $certs );
} else {
print_r( "Error!
");
}
I am always running into the error-branch of if($result) ...
and cannot find any information how to get more details on the error condition. Any hints welcome.