Skip to content

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
@tuminoid tuminoid deleted the tuomo/add-sha512-and-pss-support branch September 15, 2025 05:47
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