-
Notifications
You must be signed in to change notification settings - Fork 18
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
Certificates with indentation fail to parse #40
Comments
Hi there, thanks for filing an issue.
I'm not sure we can draw that conclusion on the basis of one implementation. I believe RFC 7468 is the authoritative source for the PEM encoding of a certificate and it says (emphasis mine):
There is some discussion in 7468 of "extant parsers" allowing looser behaviour, but I believe we intend for this crate to match the "strict format" ABNF. The Security Considerations section emphasizes that variations on handling whitespace and non-base64 characters creates ambiguities. |
Agree. But it also says:
So I think it's reasonable to expect we should parse this correctly. |
I saw this as well, but it's a SHOULD for parsers compared to a MUST for encoders, and given the other language about ambiguities I wasn't fully convinced this crate should change. (but I don't feel very strongly) |
It seems pretty reasonable to warn but strip the whitespace — hopefully that's enough to encourage a report to the encoder without blocking users. |
Given that this crate implements a parser, I think we should align with the SHOULD. I support the argument that the encoder is in the wrong here, but given the SHOULD for parsers it seems unlikely that the security considerations apply to this particular form of deviation. Logging for "invalid" whitespace seems like an interesting idea, but given that we have no logging so far it means adding a dependency for tracing, and then we might want to make that optional -- not sure the complexity is worth it. |
Here's one option to consider: #41 I used killjoy1221's |
This is fixed as of rustls-pemfile v2.1.1 Thanks for reporting the issue. |
Example cert:
OpenSSL can load it via
openssl x509 -in cert.crt -noout -text
, so it is valid. Trying to parse this with rustls-pemfile (via rustls-native-certs) creates an error similar to this.The text was updated successfully, but these errors were encountered: