- Generate an EC key
$ openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -pkeyopt ec_param_enc:named_curve -outform PEM -out key.pem
Alternatively, can use
openssl ecparam -name secp521r1 -genkey -param_enc explicit -out private-key.pem
but not useful for use with the crypto library of other languages. Most libraries expect the named_curve option.
According to golang/go#18634: