Elliptic curve keys, small and fast
ECDSA keys give the same security as much larger RSA keys. A P-256 key offers about 128 bits of security, similar to 3072-bit RSA, with a public key of just 65 bytes. That makes ECDSA a good fit for JWT signing (ES256, ES384 and ES512), TLS certificates and code signing.
Choose PEM for OpenSSL and most libraries, or JWK to drop the public key into a JWKS endpoint.
Matching curves to JWT algorithms
| Curve | Security | JWT algorithm |
|---|---|---|
| P-256 | 128-bit | ES256 |
| P-384 | 192-bit | ES384 |
| P-521 | 256-bit | ES512 |
Frequently asked questions
ECDSA or Ed25519?
Both are strong. Ed25519 is simpler and harder to misuse, but ECDSA on P-256 has wider support in older systems, hardware security modules and standards that require NIST curves.
Is the PEM private key encrypted?
No, it is unencrypted PKCS#8. Encrypt it with a passphrase using openssl pkcs8 -topk8 if it will be stored on disk.