-
Notifications
You must be signed in to change notification settings - Fork 31
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
Changed the way of extracting certificates. #11
Conversation
Is anyone maintaining this package? 😄 |
Hi @mr-luke , We'll look soon over your pull request :) |
Hi @mr-luke , I'm curious if you've been able to identify the environmental difference that would case the issue. I'm trying to understand if the issue was caused only by a certain certificate, or only by a certain environment or by a combination of certain certificate&environment. Thx, |
// may ended up with additional "\n" characters. | ||
// | ||
$certificates = explode( | ||
"-----END CERTIFICATE-----\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a valid certificate does not always end in "END CERTIFICATE" but can also end in "END PKCS7"
if (count($certificates) > 1) { | ||
// Let's fix first certificate by adding extracted "end" signature. | ||
// | ||
$certificates[0] = $certificates[0] . '-----END CERTIFICATE-----'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the first certificate but not the second one.
I think a more reliable fix would be to still use the initial explode but after that loop through the result and apply trim to all items. In case an item is "" (empty) after the trim, discard it. Would this work on your particular certificate?
I have some trouble. My solution is: |
openssl 1.1.1 change print_cert output format to this https://i.imgur.com/Gt2U5et.jpg just change certificates separate code with |
I had situation when two different servers running same PHP & almost identical openssl ended up with extra "\n" chars. In my opinion that explode was "unfortunate" and is was environmental sensitive.