-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Unable to read the cert store when Using openssl_pkcs12_read with OpenSSL 3.x #12128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I also get this error. Any solution? |
I have been looking through We also have got a basic test for If that doesn't help, could you check the errors using something like this in error section: while ($msg = openssl_error_string()) {
echo $msg . "\n";
} If that doesn't help, please share it here. I might also need all the non secret details about the envelope and its key and cert. Or if you are able to provide a script generating the key and cert and creating envelope that is faling the |
I have write in the code block you provided, and the error that comes up is: I have been reading the article about Ubuntu security. I'm sharing the values that appear in my terminal when I run "openssl version -a" in case it helps for guidance:
I hope this helps to better understand the issue. |
I found the problem thanks to the error clue. It's because the certificate I'm using is encrypted with the RC2-40-CBC algorithm and SHA-1. In older versions of OpenSSL, this type of encryption was allowed, but in the newer ones, it's no longer permitted due to its insecurity. I appreciate the assistance provided. I hope this can be of help to others facing the same issue. |
So this is related to legacy provider not being enabled. There is also info how to currently enable it in #12369 which should be hopefully improved in the future minor or major PHP version. There is nothing else that can be done so will close this. |
@bukka hi, I did enable "legacy provider" on openssl config, but still, it doesn't work, i'm using Windows 10 with PHP 8.2.11, |
It works now, thanks |
Reference: php/php-src#12128 https://www.php.net/manual/en/function.openssl-pkcs12-read.php#128992 Signed-off-by: Vitor Mattos <[email protected]>
Reference: php/php-src#12128 https://www.php.net/manual/en/function.openssl-pkcs12-read.php#128992 Signed-off-by: Vitor Mattos <[email protected]>
Reference: php/php-src#12128 https://www.php.net/manual/en/function.openssl-pkcs12-read.php#128992 Signed-off-by: Vitor Mattos <[email protected]>
Prevent error to read certificate generated with old version of openssl and using a newest version of openssl. To check the password is necessary to repack the certificate using openssl command. If the command don't exists, will consider that the password is invalid. Reference: php/php-src#12128 https://www.php.net/manual/en/function.openssl-pkcs12-read.php#128992 Signed-off-by: Vitor Mattos <[email protected]>
Prevent error to read certificate generated with old version of openssl and using a newest version of openssl. To check the password is necessary to repack the certificate using openssl command. If the command don't exists, will consider that the password is invalid. Reference: php/php-src#12128 https://www.php.net/manual/en/function.openssl-pkcs12-read.php#128992 Signed-off-by: Vitor Mattos <[email protected]>
Prevent error to read certificate generated with old version of openssl and using a newest version of openssl. To check the password is necessary to repack the certificate using openssl command. If the command don't exists, will consider that the password is invalid. Reference: php/php-src#12128 https://www.php.net/manual/en/function.openssl-pkcs12-read.php#128992 Signed-off-by: Vitor Mattos <[email protected]>
Would have been nice from you to actually enlighten us with the solution. |
@MirceaZahan, It is so difficult to follow the line of discussion 😄😄 |
Issues with PFX in older versionsIt is known that .pfx files with legacy versions like OpenSSL 1.0 can cause reading issues when used with OpenSSL v3.To generate an updated .pfx file, you can follow these steps:Extract the data from
|
Description
The following code:
Resulted in this output:
But I expected this output instead:
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
The text was updated successfully, but these errors were encountered: