Skip to content

Commit f5a6c54

Browse files
committed
cmd/cosign: set default ko.SigningAlgorithm
Signed-off-by: Riccardo Schirone <[email protected]>
1 parent f6a5beb commit f5a6c54

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/cosign/cli/sign/sign_blob.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
cbundle "github.com/sigstore/cosign/v2/pkg/cosign/bundle"
4141
protobundle "github.com/sigstore/protobuf-specs/gen/pb-go/bundle/v1"
4242
protocommon "github.com/sigstore/protobuf-specs/gen/pb-go/common/v1"
43+
v1 "github.com/sigstore/protobuf-specs/gen/pb-go/common/v1"
4344
"github.com/sigstore/rekor/pkg/generated/models"
4445
"github.com/sigstore/sigstore-go/pkg/sign"
4546
"github.com/sigstore/sigstore/pkg/cryptoutils"
@@ -66,6 +67,13 @@ func SignBlobCmd(ro *options.RootOptions, ko options.KeyOpts, payloadPath string
6667
ctx, cancel := context.WithTimeout(context.Background(), ro.Timeout)
6768
defer cancel()
6869

70+
if ko.SigningAlgorithm == "" {
71+
ko.SigningAlgorithm, err = signature.FormatSignatureAlgorithmFlag(v1.PublicKeyDetails_PKIX_ECDSA_P256_SHA_256)
72+
if err != nil {
73+
return nil, fmt.Errorf("formatting signature algorithm: %w", err)
74+
}
75+
}
76+
6977
shouldUpload, err := ShouldUploadToTlog(ctx, ko, nil, tlogUpload)
7078
if err != nil {
7179
return nil, fmt.Errorf("upload to tlog: %w", err)

0 commit comments

Comments
 (0)