File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -172,8 +172,8 @@ var (
172
172
},
173
173
{
174
174
Name : "EcCurve" ,
175
- // TODO(XXX): validate " EcCurve" format.
176
- Validate : noValidateFormat ,
175
+ // TODO(XXX): Seems like the EcCurve format should be defined as an enum?
176
+ Validate : validateCurve ,
177
177
},
178
178
{
179
179
Name : "HexBytes" ,
@@ -223,3 +223,17 @@ func validatePem(value any) error {
223
223
224
224
return nil
225
225
}
226
+
227
+ func validateCurve (value any ) error {
228
+ strVal , ok := value .(string )
229
+ if ! ok {
230
+ return fmt .Errorf ("invalid non-string EcCurve value: %v" , value )
231
+ }
232
+
233
+ switch strVal {
234
+ case "curve25519" , "curve448" :
235
+ return nil
236
+ default :
237
+ return fmt .Errorf ("invalid EcCurve: unknown curve name: %v" , value )
238
+ }
239
+ }
You can’t perform that action at this time.
0 commit comments