Skip to content

Conversation

haydentherapper
Copy link
Contributor

@haydentherapper haydentherapper commented Sep 3, 2025

We hardcoded ECDSA-P256-SHA256 as the only supported algorithm. This uses the algorithm registry to load the correct signing algorithm to specify its type and digest in the request to Rekor v2. This also fixes an incompatibility with Ed25519 and hashedrekord with Rekor v2, which requires Ed25519ph where the digest is provided during verification.

To test this, I've added support for other signing algorithms in EphemeralKeypair, which will also make the struct useable with Cosign when a signing algorithm is provided.

Summary

Release Note

Documentation

@haydentherapper haydentherapper requested a review from a team as a code owner September 3, 2025 17:38
@haydentherapper
Copy link
Contributor Author

In the first iteration of this change, I had created a test struct implementing support for other signing algorithms. It seemed useful to just add support to EphemeralKeypair, but if there's any concerns, I can change this.

@haydentherapper haydentherapper marked this pull request as draft September 3, 2025 18:13
@kommendorkapten
Copy link
Member

Thanks Hayden! The code looks good, some minor comments only.

Copy link
Member

@steiza steiza left a comment

Choose a reason for hiding this comment

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

The approach looks fine to me!

@haydentherapper haydentherapper force-pushed the support-other-keys-rekorv2 branch from ecd4e1e to 9f828c3 Compare September 4, 2025 20:31
// Fulcio doesn't support verifying Ed25519ph signatures at the moment,
// so if we're signing with the prehash variant, we need to adapt the
// signer to sign with Ed25519 instead.
subjectSignature, _, err := keypair.SignData(context.WithValue(ctx, adaptEd25519Ctx{}, true), []byte(subject))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Just so I am understanding this. If a client uses Ed25519ph when requesting a cert from fulcio, we silently fallback to Ed25519 but with the same key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, with the same key. We only fallback to Ed25519 to sign the proof of possession, not the artifact signature (Rekor does properly verify ed25519ph).

The reason Fulcio doesn't support Ed25519ph is because crypto/x509 doesn't support the prehash variant. There's no public OID to represent the key algorithm. When I work on the next major release of Fulcio, I'll see what I can to hack this in.

Copy link
Member

Choose a reason for hiding this comment

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

I appreciate the work being done here to try to work around a lack of support for ed25519ph in Fulcio, but I wonder if instead we should return an error for now instead.

What you have here works, but if / when Fulcio supports ed25519ph in the future, figuring out how to unwind this and migrate people off is going to be a bit tricky. Is there a particular need for this use-case right now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The use-case is a bit niche, to support hashedrekord entries with ed25519 signatures and with a Fulcio certificate (note that Rekor already supports verifying both ed25519 and -ph signatures).

Note that if you are signing an entry with a key and not requesting a Fulcio certificate, then this isn't needed. This would only be if you use Cosign with --issue-certificate or if you specify the signature algorithm (not yet supported, sigstore/cosign#3497).

I'm OK with an error for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've dropped support for ed25519ph with Fulcio. I also added e2e testing when signing with a self-managed key.

We hardcoded ECDSA-P256-SHA256 as the only supported algorithm. This
uses the algorithm registry to load the correct signing algorithm to
specify its type and digest in the request to Rekor v2. This also fixes
an incompatibility with Ed25519 and hashedrekord with Rekor v2, which
requires Ed25519ph where the digest is provided during verification.

To test this, I've added support for other signing algorithms in
EphemeralKeypair, which will also make the struct useable with Cosign
when a signing algorithm is provided.

Signed-off-by: Hayden <[email protected]>
@haydentherapper haydentherapper force-pushed the support-other-keys-rekorv2 branch from 0e0b287 to a9e0374 Compare September 5, 2025 21:09
Copy link
Member

@steiza steiza left a comment

Choose a reason for hiding this comment

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

LGTM; nice work!

@haydentherapper haydentherapper merged commit 201a35a into sigstore:main Sep 8, 2025
12 checks passed
@haydentherapper haydentherapper deleted the support-other-keys-rekorv2 branch September 8, 2025 17:18
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.

3 participants