x509-cert: CrlBuilder: omit an empty revokedCertificates list - #2456
Open
yuxi-liu-wired wants to merge 1 commit into
Open
yuxi-liu-wired wants to merge 1 commit into
yuxi-liu-wired wants to merge 1 commit into
Conversation
RFC 5280 5.1.2.6: "When there are no revoked certificates, the revoked
certificates list MUST be absent." `CrlBuilder::with_certificates` with an
empty iterator set `revoked_certificates` to `Some(vec![])`, which encodes
an empty `SEQUENCE {}` in the CRL.
Drop an empty list in `finalize`, before the TBS is encoded and signed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC 5280 5.1.2.6 says: "When there are no revoked certificates, the revoked certificates list MUST be absent."
CrlBuilder::with_certificatessetsrevoked_certificatestoSome(..)before collecting the iterator. With no revoked certificates (an empty iterator), the CRL therefore carries an emptyrevokedCertificates SEQUENCE {}, which the RFC forbids.This PR drops an empty list in
finalize, before the TBS is encoded and signed.Test:
crl_without_revoked_certificatesbuilds a CRL withwith_certificates(core::iter::empty())and expectsrevoked_certificates == None. It fails on master (Some([])).This PR was produced by AI agents (Claude) while reviewing
x509-certcode that the differential fuzzing ofder/x509-certdoes not reach.