-
Notifications
You must be signed in to change notification settings - Fork 146
x509-cert: another parse failure on publicly known cert #826
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
Here's how OpenSSL parses it:
|
Haven't confirmed yet, but I'm guessing it's this: formats/x509-cert/src/serial_number.rs Lines 32 to 44 in 1c001b3
(Although that doesn't make total sense, since the SN is 20 bytes here. But maybe I made a mistake in my |
Ah, yep, this is because of an implementation decision I made: It makes the enum Int {
Signed(Sint),
Unsigned(Uint),
} ...and delegating through that way. Alternatively, I could have |
@woodruffw the encoding is two’s complement, and in that regard, I think that rather than an |
(follow up on #764 (comment)) An I kind of have in mind an I would left out intentionally the |
Yeah, I don't think there should be any explicit APIs for constructing negative serial numbers. It should only be something that can be decoded. Perhaps there could also be something like |
Just to summarize: the problem here is an ambiguity in RFC 5280's wording: the length constraint on a serial number can either be interpreted as "no more than 20 bytes, encoded as an unsigned integer" or as "no more than 20 bytes, however they end up being encoded, so long as they end up unsigned." Other X.509 implementations generally take the latter interpretation, and allow generating serial numbers that encode to 21 bytes, so long as their unsigned representation is only 20 bytes:
These implementations also don't generally check the length of serial numbers they receive. |
I guess the point here is:
|
Like #821, although probably a different cause:
d3eefbcbbcf49867838626e23bb59ca01e305db7
in the Windows CTL fails to parse with:The offending cert, as PEM:
Happy to debug this again, just making the issue for visibility.
The text was updated successfully, but these errors were encountered: