Home » » openssl_pkcs12_read

openssl_pkcs12_read

Written By 1 on Tuesday, October 2, 2012 | 10:19 AM

bool openssl_pkcs12_read ( string $pkcs12 , array &$certs , string $pass )
Parse a PKCS#12 Certificate Store into an array
openssl_pkcs12_read() parses the PKCS#12 certificate store supplied by pkcs12 into a array named certs.

$p12cert = array();
$file = '/home/mmacia/mycert.p12';
$fd = fopen($file, 'r');
$p12buf = fread($fd, filesize($file));
fclose($fd);
if ( openssl_pkcs12_read($p12buf, $p12cert, 'passphrase') )
{
echo 'Works!';
print_r($p12cert);
}
else
{
echo 'Fail';
}

0 Comment:

Post a Comment