cosign: Cosign doesn't accept Digicert's TSA certificate when verifying a signature

Description

I signed an image including a timestamp from Digicert (using http://timestamp.digicert.com).

To verify that signature I had to get the TSA certificate that they publish. For example here (https://knowledge.digicert.com/general-information/rfc3161-compliant-time-stamp-authority-server). Cosign requires the full certificate chain and here lies the problem.

When building the chain from the certificates provided by Digicert on that page I got the following error: Error: no matching signatures: unable to verify RFC3161 timestamp bundle: no TSA root certificate(s) provided to verify timestamp.

It appears that Digicert’s Root certificate is not root enough for cosign. After debugging a bit I got to function SplitPEMCertificateChain (utils.go) which only considers that a certificate is root if it’s self-signed. This is not the case for Digicert. There is a more general certificate used to sign that alleged Root certificate. Not sure if the criteria should be revised.

In Digicert’s case, “Digicert Trusted Root G4” certificate is signed by “DigiCert Assured ID Root CA”.

So, I included the true Root certificate in the chain.

Consequently, I got the following error: Error: no matching signatures: unable to verify RFC3161 timestamp bundle: failed to verify EKU on leaf certificate: failed to verify EKU on intermediate certificate: certificate has 0 extended key usages, expected only one.

More debugging. I got to function verifyLeafAndIntermediatesTimestampingEKU (…go\pkg\mod\github.com\sigstore\timestamp-authority@v1.2.2\pkg\verification\verify.go) which has this comment: “Verify the leaf and intermediate certificates (called “EKU chaining”) all have the extended key usage set to only time stamping usage”. So, the intermediate certificates have to be set exclusively for timestamping usage. This was no longer the case with my chain because Digicert’s Trusted Root G4, now turned intermediate, has more uses. Is it reasonable to require all intermediates to be set exclusively for timestamping?

So, it appears, for now, that Digicert’s TSA can’t be used for signing.

In my opinion, this could be fixed in one of two ways:

  • review the criteria for what is a root certificate
  • relax the exclusivity of timestamping use in intermediate certificates, especially if they are deep in the chain (IMO, this solution is more reasonable).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@alt-enio, @haydentherapper, @mktgbnk - Please see my prior comment. I believe that the fix / workaround that was already done works and that it likely could be closed (in case it was reopened due to @mbharambe1 's finding).

I believe the root cause of @mbharambe1 's finding was related to DigiCert rotating their leaf, which also now appears to be available on their website in the meantime.

If you agree, do you feel this could be considered closed?

Note: edit – I see that this functionality works in the newer release of v2.5.2! Thanks!