Generating ECDSA certificate and private key in one step
This seemed to be the command you want:
openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name secp384r1) -keyout cert.key -out cert.crt -days 3650
Use -pkeyopt
openssl req -x509 -nodes -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 -keyout ecdsa.pem -out mycert.crt -days 30
According to man req:
OPTIONS
-pkeyopt opt:value
set the public key algorithm option opt to value. The precise set of options supported depends on the public key algorithm used and its implementation. See KEY GENERATION OPTIONS in the genpkey manual page for more details.
So then looking at man genpkey:
EC PARAMETER GENERATION OPTIONS
The EC parameter generation options below can also be supplied as EC key generation options. This can (for example) generate a key from a named curve without the need to use an explicit parameter file.
ec_paramgen_curve:curve
the EC curve to use. OpenSSL supports NIST curve names such as "P-256".
ec_param_enc:encoding
the encoding to use for parameters. The "encoding" parameter must be either "named_curve" or "explicit".
openssl ecparam -name secp521r1 -genkey -param_enc explicit -out private-key.pem
openssl req -new -x509 -key private-key.pem -out server.pem -days 730
Creating Self-Signed ECDSA SSL Certificate using OpenSSL is working for me.
You can test certificates after generating as follows.
openssl ecparam -in private-key.pem -text -noout