How to use openssl_pkcs12_read()

How to use openssl_pkcs12_read()

am 26.12.2007 13:21:57 von mmacia

Hello, i'm trying to use the function openssl_pkcs12_read() but always
return false and there's no examples in documentation:

$cert = array();

if ( openssl_pkcs12_read('mycert.p12', $cert, 'mypassword') )
{
echo 'success';
}

else
{
echo 'fail';

}

what's wrong?

Re: How to use openssl_pkcs12_read()

am 26.12.2007 15:12:27 von mmacia

The correct way is:

$file = '/home/mmacia/mycert.p12';
$handle = fopen($file, 'r');
$p12buf = fread($handle, filesize($file));
fclose($handle);
openssl_pkcs12_read($p12buf, $p12arr, 'passphrase');