notaryproject / notation-core-go

Contains support for Notary Project signature envelope, and format specific implementation
Apache License 2.0
14 stars 28 forks source link

bug: leaf certificate key usage should not forbid `ContentCommitment` #201

Closed Two-Hearts closed 6 months ago

Two-Hearts commented 7 months ago

What is not working as expected?

According to Notary Project spec: https://github.com/notaryproject/specifications/blob/main/specs/signature-specification.md#leaf-certificates,

The keyUsage extension MUST be present and MUST be marked critical. Bit positions for digitalSignature MUST be set. The Bit positions for keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, encipherOnly, decipherOnly and cRLSign MUST NOT be set.

Key usage ContentCommitment (formely known as nonRepudiation) is not in the above forbidden list. However, notation-core-go implementation added it in the check. (From RFC-5280, I'm not seeing any good reason of forbidding ContentCommitment while DigitalSignature bit is asserted either.)

What did you expect to happen?

We should remove the ContentCommitment check during leaf certificate validation.

How can we reproduce it?

Use a leaf certificate with ContentCommitment and DigitalSignature bits asserted.

I met this issue while timestamping my signatures with some free TSAs. This issue blocks those TSAs as they have both ContentCommitment and DigitalSignature bits asserted in their timestamp signing certificates.

Describe your environment

all OS, golang v1.22

What is the version of your notation-core-go Library?

v1.0.2

shizhMSFT commented 7 months ago

Looks like it is reasonable since ContentCommitment just indicates the private key is well-protected.

/cc @priteshbandi @gokarnm