Skip to content
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

load_pem_x509_certificate errors out if data contains multiple PEM certificates #6550

Closed
felixfontein opened this issue Nov 4, 2021 · 2 comments · Fixed by #6551
Closed

Comments

@felixfontein
Copy link
Contributor

The change in #6365 has the unfortunate side-effect that if one calls load_pem_x509_certificate() on a bytes string which has multiple PEM certificates concatenated, it returns an error (Valid PEM but multiple BEGIN CERTIFICATE/END CERTIFICATE delimiters.). This is a breaking change, this worked fine with 35.0.0 and before.

This usually happens when trying to load the certificate from certificate + chain files that are often used to configure TLS for webservers (see for example https://nginx.org/en/docs/http/configuring_https_servers.html#chains).

If this change is kept in its current form, it really needs to be documented as a breaking change in the changelog.

@reaperhulk
Copy link
Member

Thanks for catching this. I think we probably need to handle this and just load the first one like OpenSSL does even though that is itself a somewhat odd behavior.

@felixfontein
Copy link
Contributor Author

Would it make sense ot make this behavior configurable, i.e. pass a parameter to the loading function which allows to making this an error (with a default for backwards compatibility)?

@alex alex closed this as completed in #6551 Nov 5, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants