File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
19
19
"context"
20
20
"fmt"
21
21
"os"
22
+ "strings"
22
23
23
24
"github.com/sigstore/cosign/v2/cmd/cosign/cli/generate"
24
25
"github.com/sigstore/cosign/v2/cmd/cosign/cli/options"
@@ -66,6 +67,21 @@ func SignBlob() *cobra.Command {
66
67
if options .NOf (o .Key , o .SecurityKey .Use ) > 1 {
67
68
return & options.KeyParseError {}
68
69
}
70
+
71
+ // Check if the algorithm is in the list of supported algorithms
72
+ supportedAlgorithms := cosign .GetSupportedAlgorithms ()
73
+ isValid := false
74
+ for _ , algo := range supportedAlgorithms {
75
+ if algo == o .SigningAlgorithm {
76
+ isValid = true
77
+ break
78
+ }
79
+ }
80
+ if ! isValid {
81
+ return fmt .Errorf ("invalid signing algorithm: %s. Supported algorithms are: %s" ,
82
+ o .SigningAlgorithm , strings .Join (supportedAlgorithms , ", " ))
83
+ }
84
+
69
85
return nil
70
86
},
71
87
RunE : func (_ * cobra.Command , args []string ) error {
You can’t perform that action at this time.
0 commit comments