Skip to content

Instantly share code, notes, and snippets.

@codespool
Created September 16, 2022 12:31
Show Gist options
  • Save codespool/576faa63ae34860d589483b944d5475c to your computer and use it in GitHub Desktop.
Save codespool/576faa63ae34860d589483b944d5475c to your computer and use it in GitHub Desktop.
Generate EC keypar

Private key:

openssl ecparam -name $CURVE -genkey -noout -out private.ec.key

where $CURVE is:

  • prime256v1 for ES256
  • secp384r1 for ES384
  • secp521r1 for ES512

Public key:

openssl ec -in private.ec.key -pubout -out public.pem#

Aside: RS256 key:

ssh-keygen -t rsa -b 4096 -E SHA256 -m PEM -P "" -f RS256.key
openssl rsa -in RS256.key -pubout -outform PEM -out RS256.key.pub

*(first line creates openssh format keys, second converts them to RSA)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment