-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
Description
The following code:
<?php
if (!$cert_store = file_get_contents("/certs/file.p12")) {
echo "Error: Unable to read the cert file.";
exit;
}
if (openssl_pkcs12_read($cert_store, $cert_info, "my_secret_pass")) {
echo "Certificate Information:";
print_r($cert_info);
} else {
echo "Error: Unable to read the cert store.";
exit;
}
?>Resulted in this output:
Error: Unable to read the cert store.
But I expected this output instead:
Certificate Information:
Array
(
[cert] => -----BEGIN CERTIFICATE-----
ICAL0wDQYJKoZIhvcNAQELBQAwgYkxCzAJBgNVBAYTAk
-----END CERTIFICATE-----,
[pkey] => -----BEGIN PRIVATE KEY-----
LyaH3FnQfJkGmc0CgGAV72ecpf06CRrUYVl5sBUcKcT67O
-----END PRIVATE KEY-----
)
// The values are only examples.
The error does not occur in earlier versions, such as PHP 8.2.6 and 8.2.7, which utilize OpenSSL version 1.x. Starting from PHP version 8.2.8 onwards, OpenSSL 3.x is employed, and the error occurs as previously mentioned.
PHP Version
PHP 8.2.8
Operating System
Ubuntu 20.04