Skip to content

feat: add support for additional transparency log key types#197

Merged
Hayden-IO merged 5 commits intosigstore:mainfrom
vishal-chdhry:addn-tlog-key
Jul 29, 2024
Merged

feat: add support for additional transparency log key types#197
Hayden-IO merged 5 commits intosigstore:mainfrom
vishal-chdhry:addn-tlog-key

Conversation

@vishal-chdhry
Copy link
Copy Markdown
Contributor

@vishal-chdhry vishal-chdhry commented Jun 2, 2024

Summary

Closes: #65

Adds support for transparency log keys with RSA, other ECDSA curves, and ed25519

Release Note

Adds support for transparency log keys with RSA, other ECDSA curves, and ed25519 

Documentation

Comment thread pkg/root/trusted_root.go Outdated
@vishal-chdhry vishal-chdhry marked this pull request as ready for review June 3, 2024 00:26
Copy link
Copy Markdown
Contributor

@Hayden-IO Hayden-IO left a comment

Choose a reason for hiding this comment

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

Thanks! Can you add tests for this?

Comment thread pkg/root/trusted_root.go Outdated
Comment thread pkg/root/trusted_root.go Outdated
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
@vishal-chdhry vishal-chdhry requested a review from Hayden-IO July 21, 2024 16:57
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
@vishal-chdhry
Copy link
Copy Markdown
Contributor Author

@haydentherapper added the changes, please let me know if this is okay.

sorry for the delay on this, I was working on other things (btw, we also added support for sigstore bundle verification in Kyverno, it will be a part of the next release)

Copy link
Copy Markdown
Contributor

@Hayden-IO Hayden-IO left a comment

Choose a reason for hiding this comment

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

Thanks for making these updates! A few comments on reducing the number of supported algorithms and updating the digest.

Comment thread pkg/root/trusted_root.go Outdated
case protocommon.PublicKeyDetails_PKIX_ECDSA_P256_SHA_256,
protocommon.PublicKeyDetails_PKIX_ECDSA_P384_SHA_384,
protocommon.PublicKeyDetails_PKIX_ECDSA_P521_SHA_512,
protocommon.PublicKeyDetails_PKIX_ECDSA_P256_HMAC_SHA_256: //nolint:staticcheck
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't need to support PublicKeyDetails_PKIX_ECDSA_P256_HMAC_SHA_256, we've marked this as deprecated.

Comment thread pkg/root/trusted_root.go
BaseURL: tlog.GetBaseUrl(),
ID: tlog.GetLogId().GetKeyId(),
HashFunc: hashFunc,
SignatureHashFunc: crypto.SHA256,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The signature hash algorithm will differ depending on the signature scheme. I'd recommend a function like https://github.com/slsa-framework/slsa-verifier/blob/d96b9777090694fa5096ee1b9c710a46b5a66f5e/cli/slsa-verifier/verify/verify_vsa.go#L95-L117 to handle the mapping

tldr - RSA can always be SHA256, ECDSA P256 and P384 should be SHA256, P521 SHA512, and ed25519 is SHA512.

Comment thread pkg/root/trusted_root.go Outdated
case protocommon.PublicKeyDetails_PKIX_RSA_PKCS1V15_2048_SHA256,
protocommon.PublicKeyDetails_PKIX_RSA_PKCS1V15_3072_SHA256,
protocommon.PublicKeyDetails_PKIX_RSA_PKCS1V15_4096_SHA256,
protocommon.PublicKeyDetails_PKIX_RSA_PSS_2048_SHA256,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can skip support for PSS, that would require also changing how we call LoadVerifier, which would require conditionally adding an option to use PSS over PKCS1v1.5. Given loading this verifier is in another package, it'd be a bit too much refactoring to try to connect these for not much gain.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have removed PKIX-PSS but I havent removed PKIX-PKCS1v1.5

Comment thread pkg/root/trusted_root.go Outdated
return nil, fmt.Errorf("tlog public key is not RSA: %s", tlog.GetPublicKey().GetKeyDetails())
}
tlogEntry.PublicKey = rsaKey
case protocommon.PublicKeyDetails_PKIX_ED25519, protocommon.PublicKeyDetails_PKIX_ED25519_PH: //nolint:staticcheck
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here, we can skip PKIX_ED25519_PH, the prehash variant of ed25519 isn't needed, and it would require making changes to LoadVerifier.

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
@vishal-chdhry vishal-chdhry requested a review from Hayden-IO July 28, 2024 13:44
Copy link
Copy Markdown
Contributor

@Hayden-IO Hayden-IO left a comment

Choose a reason for hiding this comment

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

Thank you!

@Hayden-IO Hayden-IO merged commit 40042e6 into sigstore:main Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for additional transparency log key types

2 participants