-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8277246: Check for NonRepudiation as well when validating a TSA certificate #6416
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
…icate 8277246: No need to check about KeyUsage when validating a TSA certificate
👋 Welcome back weijun! A progress list of the required criteria for merging this PR into |
Webrevs
|
if (checkKeyUsage(cert, KU_SIGNATURE) == false) { | ||
throw new ValidatorException | ||
("KeyUsage does not allow digital signatures", | ||
ValidatorException.T_EE_EXTENSIONS, cert); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment here just in case someone else adding the checking back? Otherwise, looks nice to me.
Mailing list message from Michael StJohns on security-dev: On 11/16/2021 2:43 PM, Weijun Wang wrote: I just ran this by one of the PKIX folk and this fix isn't correct.?? In this case, checkKeyUsage attempts to find? keyUsageExtension and if
It would be acceptable to have a certificate without a Recommend backing out the change and closing the bug report as mistaken. Mike -------------- next part -------------- |
Hi Michael. Thanks for the comment. That was also our previous understanding but we are seeing timestamp returning by sigstore.dev (see the -----BEGIN CERTIFICATE----- |
@wangweij This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 41 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Mailing list message from Michael StJohns on security-dev: On 11/16/2021 4:05 PM, Weijun Wang wrote: The certificate is either incorrect, or weird and correct. I actually // insert around line 109. private static final int KU_NON_REPUDIATION = 1; // replace line 359. if (checkKeyUsage (cert, KU_SIGNATURE) == false && checkKeyUsage(cert, From RFC5280:
In any event, if you have a KU extension and it includes neither of I'll reach out again to my expert and let you know what I find out. Thanks - Mike -------------- next part -------------- |
Sean found RFC 5280, 4.2.1.12:
so it seems either is OK. That said, it's just a "may", and to me it reads more like that others are NOT consistent and should be rejected. |
I did see an issuer of TSA certs whose own certificate has EKU with id-kp-timeStamping and KU with both DigitialSignature and keyCertsign. This cert should be rejected if it signed a timestamp response. |
Mailing list message from Michael StJohns on security-dev: On 11/16/2021 5:58 PM, Michael StJohns wrote:
According to the guy who wrote RFC5280, nonRepudiation (aka I added a note to the Rekor CA repository, hopefully at the correct Mike -------------- next part -------------- |
Mailing list message from Michael StJohns on security-dev: On 11/16/2021 6:37 PM, Weijun Wang wrote: Not quite.?? The rule is that if there's both an ExtendedKeyUsage and The cert you cite would be valid for timestamping. Mike |
Really? The TSA is http://timestamp.digicert.com and the cert chain is
You mean this CA can be used for time stamping as well? I understand that when KU is missing you can find out its usage in EKU (vice versa), but here it's a CA that can sign cert and CRLs. Does it really need to act as the end entity cert of a TSA server? |
Mailing list message from Michael StJohns on security-dev: On 11/16/2021 7:46 PM, Weijun Wang wrote: It doesn't need to act as an EE of a TSA server, but with those markings Whoever issued these over marked them.?? I think their intent was to say If I were issuing this chain, there would be no extendedKeyUsage Hmm... while I was researching - I found this in RFC5280 - 4.2.1.12
and
I hope that helps. Mike -------------- next part -------------- |
Mailing list message from Xuelei Fan on security-dev: On Nov 16, 2021, at 7:28 PM, Michael StJohns <mstjohns at comcast.net<mailto:mstjohns at comcast.net>> wrote: id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 } Hm, we may want to check it strictly in this update, by allowing nonRepudiation alternatively. Xuelei |
Revert the removal and add check on nonRepudiation as well. And the test still works. :-) |
Can you change the synopsis of the bug to more accurately reflect the current fix? |
Updated. Thanks. |
I agree that having a CA act as a TSA is probably a bad idea. However, I don't think this particular CA is acting as a TSA, just looks like they overmarked it as you say. In any case, I agree we should allow the KU of a TSA cert to be absent or if present it must contain a non-repudiation and/or digitalSignature bit. |
/integrate |
Going to push as commit 262d070.
Your commit was automatically rebased without conflicts. |
Mailing list message from Mike StJohns on security-dev: You?ll be amused to find out that the code that generated the Rekor TS cert has been changed to use digitalSignature as its KU. https://github.com/sigstore/rekor/pull/504/files I think the change you made is correct, but you probably won?t see a nonRepudiation bit for a while again. Mike Sent from my iPad -------------- next part -------------- |
Great. Thanks a lot for your suggestion to them. I really appreciate it. |
There is no need to check for the KeyUsage extension when validating a TSA certificate.
A test is modified where a TSA cert has a KeyUsage but without the DigitalSignature bit.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6416/head:pull/6416
$ git checkout pull/6416
Update a local copy of the PR:
$ git checkout pull/6416
$ git pull https://git.openjdk.java.net/jdk pull/6416/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6416
View PR using the GUI difftool:
$ git pr show -t 6416
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6416.diff