We will setup a client side certificate authentication in Nginx with Elliptic curve cryptography using ECDSA (curve secp384r1) for certificates and a self signed Certificate Authority (CA).
Create Server Key and Certificate Signing Request (CSR) in PEM format:
Create CA Key and Certificate (CRT) in PEM format:
Sign server certificate with our own Certificate Authority (CA):
Create client Key and Certificate Signing Request (CSR):
Sign client certificate with our own Certificate Authority (CA):
Convert client Key and Certificate to PKCS:
Of course clients can generate their own key, send the CSR to the CA, the CA signs it and sends certificates to clients. Then the client can generates the PKCS himself for his browser.
An example of Nginx config is:
We can now import the client PKCS certificate (.p12
) into a browser and try to reach our website or try it with openssl
or curl
:
Other algorithms#
To list supported curves by openSSL:
ed25519 is not in the list of officially supported curves but it's still possible to generate a private key with it using another command:
Nginx can support what openSSL but the issue web browsers are not compliant to RFC's (for example about TLS 1.3) and support a very few amount of curves.
So for example Firefox and Chromium don't support ed25519 or brainpoolP512r1 while curl and openssl client can.
It's possible to see what TLS related cryptography is supported by your browser with SSL Labs Client test.
Firefox 104.0.2 on Linux (2022):
- Signature algorithms: SHA256/ECDSA, SHA384/ECDSA, SHA512/ECDSA, RSA_PSS_SHA256, RSA_PSS_SHA384, RSA_PSS_SHA512, SHA256/RSA, SHA384/RSA, SHA512/RSA, SHA1/ECDSA, SHA1/RSA
- Named Groups: x25519, secp256r1, secp384r1, secp521r1, ffdhe2048, ffdhe3072
Chromium 105.0.5195.125 on Linux (2022):
- Signature algorithms: SHA256/ECDSA, RSA_PSS_SHA256, SHA256/RSA, SHA384/ECDSA, RSA_PSS_SHA384, SHA384/RSA, RSA_PSS_SHA512, SHA512/RSA
- Named Groups: tls_grease_9a9a, x25519, secp256r1, secp384r1
So unfortunately for a large support we are force to use secp384r1
or secp521r1
if we don't care about Chrome-based browser. It makes it especially hard to avoid using NIST supported algorithms.