Generate elliptic-curve keypair in OpenSSL

OpenSSLElliptic-Curve Cryptography
Table of contents
  • Source

First, create the private key.

# Feel free to name `private.ec.key` whatever you want
openssl ecparam -name prime256v1 -genkey -noout -out private.ec.key

Next, from the private key, generate the public key.

# Replace `public.pem` with anything that you want.
# Be sure that `private.ec.key` is pointing to the correct private key path.
openssl ec -in private.ec.key -pubout public.pem


  • Generate EC KeyPair from OpenSSL command line
Want to make your own site like this? Try gatsby-theme-code-notes by Zander Martineau.
Notes on code. My second brain, by Sal Rahman.