Nicola-
Thanks for your response. It does help, but at the same time it also raises questions and maybe conflicts with what I thought I was doing correct earlier in this thread. I'm talking mostly about where I landed in this post:
I am only using named curves. You also said:
"...you don't really need at all to generate a ecparam file (which only contains the name): the private key file already contains
the very same name and fully contains what you need to perform ECDSA signatures that can be validated against a matching certificate."
Let me apply that and start from the beginning and outline everything (I think) I need to do in that case:
1 - Generate a certificate and private key pair. Using the OpenSSL command line:
openssl req -nodes -sha256 -newkey ec:<(openssl ecparam -name prime256v1) -keyout mykeyout.pem -new -out mycertfileout.pem -config /etc/ssl/openssl.cnf -x509 -days 365 -outform pem
Note: the "ec:" parameter basically substitutes the openssl command above with the file I had created and used in this command. Also, the "-genkey" parameter I included in the ecparam command was probably not needed, or potentially bad?
2 - Call the SSL_CTX_use_PrivateKey_file() and SSL_CTX_use_certificate_file() to use the certificate and private key pair. (Same as before)
3 - Call the APIs to set the curves and allow the server to pick the appropriate curves for the client:
status = SSL_CTX_set1_curves_list(ctx, "P-521:P-384:P-256"); status = SSL_CTX_set_ecdh_auto(ctx, 1); Do I have this right? Is the only difference combining the two commands into one in Step 1 above, instead of the intermediate ecparams file? Or is there something else I'm missing on the generation of certificate/private key
pairs?
Thanks,
Jason From: Nicola Tuveri <nic.tuv@xxxxxxxxx>
Sent: Tuesday, February 18, 2020 2:50 PM To: Jason Schultz <jetson23@xxxxxxxxxxx> Cc: Kyle Hamilton <aerowolf@xxxxxxxxx>; openssl-users <openssl-users@xxxxxxxxxxx> Subject: Re: Questions about using Elliptic Curve ciphers in OpenSSL The ec parameters are public anyway, so there is no real need to store such files somewhere with restricted reading access.
On the other hand, I want to reiterate that if you are using (and this is highly recommended) one of the named curves (e.g. NIST P-256) you don't really need at all to generate a ecparam file (which only contains the name): the private key file already contains the very same name and fully contains what you need to perform ECDSA signatures that can be validated against a matching certificate. In the same way, for the ECDHE part, pick curves that you want to support (most TLS 1.2 and 1.3 clients will be happy to support P-256 and X25519 key exchanges) from the named curves: also in this case there is no need to generate a separate ecparam file. Hope this helps! Best regards, Nicola Tuveri On Tue, 18 Feb 2020 at 15:27, Jason Schultz <jetson23@xxxxxxxxxxx> wrote:
|