Repository navigation
enforce pathLenConstraint when the last certificate is self-issued - #2491
Open
rootvector2 wants to merge 1 commit into
Open
rootvector2 wants to merge 1 commit into
rootvector2 wants to merge 1 commit into
Conversation
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.
BasicConstraintsValidation.validatechecks apathLenConstraintone certificate late: it decrements the remaining length on every certificate that is not self-issued, the last one included, and only throws once the value is already below zero. An intermediate that exceeds the limit is caught on the next non-self-issued certificate, and when there is none (the last certificate carries its issuer's own name, so subject equals issuer) the path validates.TA -> CA (pathLen 0) -> sub CA -> cert issued by the sub CA under its own nameis accepted byCertPath.validate, while BC's PKIXCertPathValidatorand the JDK's both reject it; found comparing the lightweight validator againstRFC3280CertPathUtilities.prepareNextCertL.The check now follows RFC 5280 sec. 6.1.4 (l): each non-self-issued certificate that is not the last in the path needs a remaining length above zero before it is decremented, using the
context.isEndEntity()flagKeyUsageValidationalready relies on. The excess is reported on the certificate that causes it, with the same message, and results for paths ending in a non-self-issued certificate are unchanged (the PKITS 4.6 cases still pass).BasicConstraintsTestgains the self-issued case, which fails without the change, and three permitted paths as controls.AI tooling was used to help prepare this change.