Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion command/certificate/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ of private keys.

## EXAMPLES

Create a root certificate and private key using the default parameters (EC P-256 curve):
Create a root certificate and private key using the default parameters (EC P-384 curve):
'''
$ step certificate create foo foo.crt foo.key --profile root-ca
'''
Expand Down
9 changes: 9 additions & 0 deletions command/certificate/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,15 @@ func parseOrCreateKey(ctx *cli.Context) (crypto.PublicKey, crypto.Signer, error)
if err != nil {
return nil, nil, err
}
// Keys for CA certificates (the root-ca and intermediate-ca)
// profiles) default to the CA curve, unless a curve was
// explicitly requested.
if kty == "EC" && !ctx.IsSet("crv") && !ctx.IsSet("curve") {
switch ctx.String("profile") {
case profileRootCA, profileIntermediateCA:
crv = utils.DefaultECCurveForCA
}
}
if insecureMode { // put keyutil in insecure mode, allowing RSA keys shorter than 2048 bits
undoInsecure := keyutil.Insecure()
defer undoInsecure()
Expand Down
3 changes: 3 additions & 0 deletions utils/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const DefaultRSASize = 2048
// DefaultECCurve sets the default curve for EC to P-256.
const DefaultECCurve = "P-256"

// DefaultECCurveForCA sets the default curve for EC CA keys to P-384.
const DefaultECCurveForCA = "P-384"

// GetKeyDetailsFromCLI gets the key pair algorithm, curve, and size inputs
// from the CLI context.
func GetKeyDetailsFromCLI(ctx *cli.Context, insecure bool, ktyKey, curveKey, sizeKey string) (string, string, int, error) {
Expand Down