openssl_pkcs12_read

(PHP 5 >= 5.2.2, PHP 7, PHP 8)

openssl_pkcs12_readParst eine PKCS#12-Zertifikats-Datei in ein Array

Beschreibung

openssl_pkcs12_read(string $pkcs12, array &$certificates, string $passphrase): bool

openssl_pkcs12_read() parst den im Parameter pkcs12 übergebenen Inhalt der PKCS#12-Zertifikats-Datei in das im Parameter certificates angegebene Array.

Parameter-Liste

pkcs12

Der Inhalt der Zertifikats-Datei, nicht ihr Dateiname.

certificates

Enthält im Erfolgsfall die Daten der Zertifikats-Datei als Array.

passphrase

Das Passwort zum Entschlüsseln der PKCS#12-Datei.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Beispiele

Beispiel #1 openssl_pkcs12_read()-Beispiel

<?php
if (!$cert_store = file_get_contents("/certs/file.p12")) {
echo
"Fehler: die Zertifikats-Datei kann nicht gelesen werden\n";
exit;
}

if (
openssl_pkcs12_read($cert_store, $cert_info, "my_secret_pass")) {
echo
"Zertifikatsinformationen\n";
print_r($cert_info);
} else {
echo
"Fehler: das Zertifikats-Datei kann nicht gelesen werden.\n";
exit;
}
?>
add a note

User Contributed Notes 2 notes

up
2
Anonymous
9 months ago
The openssl_pkcs12_read method does not work in PHP 8.2 due to the change in the OpenSSL library from version ^1 to ^3.
up
1
Also Anonymous
8 months ago
In response to Anonymous' note:(https://www.php.net/manual/en/function.openssl-pkcs12-read.php#128790)

I'm using 8.2.6 on Windows and this function is working without issue.
To Top