Skip to content

Commit 4aeb2b8

Browse files
authored
Remove ECDSA P-224 curve support from the ceremony tool (#8515)
BR 7.1.3.2.2 states that only ECDSA curves P-256, P-384, and P-512 are allowed. This should prevent a silly footgun.
1 parent 4dcb267 commit 4aeb2b8

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

cmd/ceremony/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This tool always generates key pairs such that the public and private key are bo
4040
| Field | Description |
4141
| --- | --- |
4242
| `type` | Specifies the type of key to be generated, either `rsa` or `ecdsa`. If `rsa` the generated key will have an exponent of 65537 and a modulus length specified by `rsa-mod-length`. If `ecdsa` the curve is specified by `ecdsa-curve`. |
43-
| `ecdsa-curve` | Specifies the ECDSA curve to use when generating key, either `P-224`, `P-256`, `P-384`, or `P-521`. |
43+
| `ecdsa-curve` | Specifies the ECDSA curve to use when generating key, either `P-256`, `P-384`, or `P-521`. |
4444
| `rsa-mod-length` | Specifies the length of the RSA modulus, either `2048` or `4096`. |
4545

4646
- `outputs`: object containing paths to write outputs.
@@ -267,7 +267,7 @@ This config generates a CSR signed by a key in the HSM, identified by the object
267267
| Field | Description |
268268
| --- | --- |
269269
| `type` | Specifies the type of key to be generated, either `rsa` or `ecdsa`. If `rsa` the generated key will have an exponent of 65537 and a modulus length specified by `rsa-mod-length`. If `ecdsa` the curve is specified by `ecdsa-curve`. |
270-
| `ecdsa-curve` | Specifies the ECDSA curve to use when generating key, either `P-224`, `P-256`, `P-384`, or `P-521`. |
270+
| `ecdsa-curve` | Specifies the ECDSA curve to use when generating key, either `P-256`, `P-384`, or `P-521`. |
271271
| `rsa-mod-length` | Specifies the length of the RSA modulus, either `2048` or `4096`. |
272272

273273
- `outputs`: object containing paths to write outputs.

cmd/ceremony/ecdsa.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ import (
1313
)
1414

1515
var stringToCurve = map[string]elliptic.Curve{
16-
elliptic.P224().Params().Name: elliptic.P224(),
1716
elliptic.P256().Params().Name: elliptic.P256(),
1817
elliptic.P384().Params().Name: elliptic.P384(),
1918
elliptic.P521().Params().Name: elliptic.P521(),
2019
}
2120

2221
// curveToOIDDER maps the name of the curves to their DER encoded OIDs
2322
var curveToOIDDER = map[string][]byte{
24-
elliptic.P224().Params().Name: {6, 5, 43, 129, 4, 0, 33},
2523
elliptic.P256().Params().Name: {6, 8, 42, 134, 72, 206, 61, 3, 1, 7},
2624
elliptic.P384().Params().Name: {6, 5, 43, 129, 4, 0, 34},
2725
elliptic.P521().Params().Name: {6, 5, 43, 129, 4, 0, 35},

cmd/ceremony/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ type keyGenConfig struct {
101101
}
102102

103103
var allowedCurves = map[string]bool{
104-
"P-224": true,
105104
"P-256": true,
106105
"P-384": true,
107106
"P-521": true,
@@ -121,7 +120,7 @@ func (kgc keyGenConfig) validate() error {
121120
return errors.New("if key.type = 'rsa' then key.ecdsa-curve is not used")
122121
}
123122
if kgc.Type == "ecdsa" && !allowedCurves[kgc.ECDSACurve] {
124-
return errors.New("key.ecdsa-curve can only be 'P-224', 'P-256', 'P-384', or 'P-521'")
123+
return errors.New("key.ecdsa-curve can only be 'P-256', 'P-384', or 'P-521'")
125124
}
126125
if kgc.Type == "ecdsa" && kgc.RSAModLength != 0 {
127126
return errors.New("if key.type = 'ecdsa' then key.rsa-mod-length is not used")

cmd/ceremony/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func TestKeyGenConfigValidate(t *testing.T) {
117117
Type: "ecdsa",
118118
ECDSACurve: "bad",
119119
},
120-
expectedError: "key.ecdsa-curve can only be 'P-224', 'P-256', 'P-384', or 'P-521'",
120+
expectedError: "key.ecdsa-curve can only be 'P-256', 'P-384', or 'P-521'",
121121
},
122122
{
123123
name: "key.type is ecdsa but key.rsa-mod-length is present",

0 commit comments

Comments
 (0)