Generate PKCS#8 private key with openssl

22,840

You can do this directly:

$ openssl genpkey -out rsakey.pem -algorithm RSA -pkeyopt rsa_keygen_bits:2048

See the man page here:

https://www.openssl.org/docs/man1.1.1/man1/openssl-genpkey.html

Share:
22,840
Benjy Wiener
Author by

Benjy Wiener

I'm an independent mobile and web developer, but I love programming all sorts of things. I've also recently taken a strong interest in computer security. My favorite programming language is Python, but I really enjoy writing Haskell (when I find a suitable project). In addition to programming I enjoy math, logic, linguistics, and paleography. (I am particularly fond of the linguistics and paleography of Semitic languages.)

Updated on July 18, 2022

Comments

  • Benjy Wiener
    Benjy Wiener almost 2 years

    Is it possible to use openssl to generate a PKCS#8 private key directly, or do I have to first generate a PKCS#1 key with genrsa and then convert it?