The correct way to read a PKCS#12 file is:
<?php
$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';
}
?>
openssl_pkcs12_read
(PHP 5 >= 5.2.2)
openssl_pkcs12_read — Parse a PKCS#12 Certificate Store into an array
Beschreibung
openssl_pkcs12_read() parses the PKCS#12 certificate store supplied by PKCS12 into a array named certs .
Parameter-Liste
- PKCS12
-
- certs
-
On success, this will hold the Certificate Store Data.
- pass
-
Encryption password for unlocking the PKCS#12 file.
Rückgabewerte
Gibt bei Erfolg TRUE zurück, im Fehlerfall FALSE.
openssl_pkcs12_read
mmacia at gmail dot com
26-Dec-2007 05:13
26-Dec-2007 05:13
