Skip to content

Commit e01c68c

Browse files
committed
Use ED25519ph only when uploading to TLog
Signed-off-by: Riccardo Schirone <562321+ret2libc@users.noreply.github.com>
1 parent 1046eea commit e01c68c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/cosign/cli/sign/sign_blob.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ func SignBlobCmd(ro *options.RootOptions, ko options.KeyOpts, payloadPath string
6868

6969
svOptions := []signature.LoadOption{
7070
signatureoptions.WithHash(crypto.SHA256),
71-
signatureoptions.WithED25519ph(),
71+
}
72+
// Use ED25519 pre-hashed version only when uploading to tlog to maintain
73+
// backwards compatibility. When self-managed keys are used this keeps the
74+
// behavior consistent with older cosign clients, which will still be able
75+
// to verify the newer signatures.
76+
if tlogUpload {
77+
svOptions = append(svOptions, signatureoptions.WithED25519ph())
7278
}
7379

7480
sv, err := signerFromKeyOptsWithSVOpts(ctx, "", "", ko, svOptions...)

0 commit comments

Comments
 (0)