x509:reject certificates with a zero serial number (RFC 5280) - #10839
x509:reject certificates with a zero serial number (RFC 5280)#10839dwivedys wants to merge 1 commit into
Conversation
|
Thank you for your contribution. To quote RFC 5280
As such, I don't think it's useful to reject zero-serial certificates. |
|
Sorry since this was my first time working on an open source project may be I am not fully conversant with how you all handle these things. What I do want to understand is that I worked on this basis my understanding of the ask that zero certs need to be rejected so I did it. Now you are saying its not useful to do so and they should be handled gracefully. What does this mean? Meaning we wont reject them but perhaps send a useful message back to the user saying the cert is invalid which to me is tantamount to rejecting it? |
Description
Fixes #10763
Per RFC 5280 (and Errata #3200), a certificate's serial number
MUST be a positive, non-zero integer. This adds a check in
mbedtls_x509_crt_parse_der_core() (library/x509_crt.c) that rejects a certificate
whose serial number is entirely zero bytes, returning
MBEDTLS_ERR_X509_INVALID_SERIAL.
A new test case is added in test_suite_x509parse.data covering
this.
Note: this change causes ~12 pre-existing tests to fail, because
several existing test certificates in the test suite were
generated with a serial number of zero and were previously
accepted.
I have not modified those test fixtures.
Flagging this for maintainer input — happy to regenerate the
affected test certs in a follow-up commit if that's the
preferred approach.
PR checklist
Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.
Notes for the submitter
Please refer to the contributing guidelines, especially the
checklist for PR contributors.
Help make review efficient: