Skip to content

Conversation

@jku
Copy link
Member

@jku jku commented Jul 28, 2025

Using add_root_certificate() multiple times looks like a bug: it usually ends up working because

  • the API accepts multiple roots and handles roots and intermediates in the same way
  • typically the signing cert is actually included in the timestamp itself

However, in the case of timestamps with no embedded certs verification fails with

Certificates neither found in the answer or in the Verification Options

This is understandable since the rfc3161-client Verifier thinks it does not have the actual signing certificate (as it's actually added as root certificate). This case should succeed since our certificate chain contains the signing certificate -- so it is not required in the timestamp itself.

FYI @DarkaMaul

Using add_root_certificate() multiple times looks like a bug: it usually
works but in the case of timestamps with no embedded certs verification
seems to fails with
    Certificates neither found in the answer or in the Verification Options

Signed-off-by: Jussi Kukkonen <[email protected]>
@jku
Copy link
Member Author

jku commented Jul 28, 2025

This seems correct to me and fixes the conformance issue in sigstore/sigstore-conformance#230

@jku jku linked an issue Jul 28, 2025 that may be closed by this pull request
We don't need to modify the list so let's avoid it to make it easier to
review.

Signed-off-by: Jussi Kukkonen <[email protected]>
@jku jku force-pushed the fix-tsa-cert-chain-construction branch from ba05137 to 211f9ef Compare July 28, 2025 12:30
@jku
Copy link
Member Author

jku commented Jul 29, 2025

Added a regression test. Current main fails the test with

Error while verifying certificates: Unable to verify pkcs7 signature: ErrorStack([Error { code: 276824192, library: "PKCS7 routines", function: "PKCS7_get0_signers", reason: "signer certificate not found", file: "crypto/pkcs7/pk7_smime.c", line: 413 }])

@jku jku force-pushed the fix-tsa-cert-chain-construction branch from 52a03c3 to d93b031 Compare July 29, 2025 12:26
Comment on lines +141 to +142
for certificate in certificates[1:-1]:
builder = builder.add_intermediate_certificate(certificate)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagging, nonblocking: we could add these with add_root_certificate instead, since they're semantically root certs ("root" meaning "in the root program," not "is a self-signed certificate"). That would be slightly faster, since our verification would then be one-hop (TSR -> TSA -> TSA-CA) rather than having to chain TSA-CA up to its "root."

In practice that's probably a marginal performance benefit, however.

Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jku!

@woodruffw woodruffw added the component:verification Core verification functionality label Jul 29, 2025
@jku jku enabled auto-merge (squash) July 29, 2025 16:00
@jku jku merged commit 3adc3d4 into sigstore:main Jul 29, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:verification Core verification functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

timestamps without embedded cert seem to fail

2 participants