Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add support for variable digests and paddings, ie. stop hardcoding SHA256 in verify.go #3917

Closed

Conversation

tuminoid
Copy link

@tuminoid tuminoid commented Oct 30, 2024

Work-in-progress!

Summary

cosign verify has a switch called --signature-digest-algorithm, which apparently does nothing. You can have SHA256 signature, pass flag for --signature-digest-algorithm sha512 and nothing complains. It also does not make SHA512 supported. Also, only PKCS#1 is supported. PSS is not.

Namely, this PR stops hardcoding SHA256 and assuming PKCS#1 in verify.go, in minimal way. It makes verify work for SHA512/PSS for example. Let's say its a starting point. Feedback welcome.

It does not:

Release Note

Partially-fixes: #1775

Documentation

TODO, though this is a bugfix, so not aiming to change anything, just make things work.

Namely, stop hardcoding SHA256 and assuming PKCS#1 in verify.go

Signed-off-by: Tuomo Tanskanen <[email protected]>
@haydentherapper
Copy link
Contributor

I believe the signature-digest-algorithm flag was specifically for KMS keys, as it's used in https://github.com/sigstore/cosign/blob/main/cmd/cosign/cli/verify/verify.go#L198.

Note there was prior work on cryptographic agility: #3497

I recognize the difference between these two approaches requires far more work for the earlier PR, but I don't want to shoehorn RSA-PSS support in in one specific verification workflow. I'd want to explore pulling in parts of that PR to support additional algorithms and digests for both signing and verification.

@tuminoid
Copy link
Author

tuminoid commented Nov 1, 2024

Thanks @haydentherapper! We discussed this also in slack, and as expected, this was very simplistic approach. To actually get support for SHA512/PSS in Cosign/Sigstore, one would need:

  • implement same support for Cosign SDKs in all supported languages
  • Refactor signing/verifying library
  • Implement support in Sigstore services (Fulcio/Rekor)
  • Fix all clients

IMO this kind of effort must be thus coordinated and roadmapped properly, with approved designs, and hence outside of individual contributor scope.

I will close my PR.

@tuminoid tuminoid closed this Nov 1, 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.

cosigned: allow configuring hash algorithm for signature verification
2 participants