OPENSSL-GENRSA(1ossl)

πŸ’– NAME πŸ’–

openssl-genrsa β€” bestie, this is the one that generates an RSA private key for you. iconic behavior only ✨

So this page? It's from the <pink>OpenSSL</pink> fam β€” specifically the 1ossl manual set. Keep that in your back pocket 🫢


✨ SYNOPSIS ✨

openssl genrsa [-help] [-out filename] [-passout arg] [-aes128]
[-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128]
[-camellia192] [-camellia256] [-des] [-des3] [-idea] [-F4] [-f4] [-3]
[-primes num] [-verbose] [-quiet] [-traditional] [-rand files]
[-writerand file] [-engine id] [-provider name] [-provider-path path]
[-provparam [name:]key=value] [-propquery propq] [numbits]

like, yes, that's a lot of brackets. she's thorough πŸ’…


🌸 DESCRIPTION 🌸

okay so the whole entire job of this command is: it generates an RSA private key. that's it. that's the tweet. πŸŽ€

no cap, that's genuinely the whole description. she's a specialist, not a generalist.


🌈 OPTIONS 🌈

  • -help β€” prints out a usage message for you. your lil built-in cheat sheet 🫢
  • -out filename β€” writes the key out to the file you name. and if you don't pass this argument? standard output gets it instead. surprise delivery 🎁
  • -passout arg β€” this is the password source for the output file. want the deets on the format? go look at openssl-passphrase-options(1) β€” she explains it way better than I could πŸ’œ
  • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea β€” these bad boys encrypt the private key with the specified cipher before it gets output. it's giving security era πŸ”₯ and here's the tea: if you specify none of these options, then no encryption is used at all. if encryption is used, it'll prompt you for a pass phrase β€” unless you already supplied one via the -passout argument 😌
  • -F4, -f4, -3 β€” the public exponent to use, either 65537 or 3. default is 65537. also, heads up bestie: the -3 option has been deprecated πŸ’€ (still listed, still real, just, y'know, old news)
  • -primes num β€” tells it how many primes to use while generating the RSA key. the num parameter has to be a positive integer that's greater than 1 and less than 16. and if num is greater than 2, then the generated key is called a 'multi-prime' RSA key β€” which is defined in RFC 8017, so she's official πŸ‘‘
  • -verbose β€” prints extra details about the operations being performed. she's narrating her process πŸ“£
  • -quiet β€” prints fewer details about the operations being performed. lowkey handy during batch scripts and pipelines 🀫
  • -traditional β€” writes the key using the traditional PKCS#1 format instead of the PKCS#8 format. vintage aesthetic, but make it cryptography πŸŽ€
  • -rand files, -writerand file β€” go peep "Random State Options" in openssl(1) for the details, bestie 🌸
  • -engine id β€” see "Engine Options" in openssl(1). also β€” and I cannot stress this enough β€” this option is deprecated πŸ’€
  • -provider name, -provider-path path, -provparam [name:]key=value, -propquery propq β€” see "Provider Options" in openssl(1), plus provider(7) and property(7). the whole provider cinematic universe, honestly πŸ¦‹
  • numbits β€” the size of the private key you want, in bits. ⚠️ this must be the last option specified. default is 2048, and values less than 512 are not allowed β€” do not test her, she will simply refuse πŸ™ˆ

🧚 NOTES 🧚

ok so RSA private key generation essentially involves generating two or more prime numbers. while that's happening, various symbols get output to show you the progress β€” it's like a little loading screen but make it math ⭐

here's the legend, memorize it iykyk:

  • . β€” represents each number which has passed an initial sieve test
  • + β€” means a number has passed a single round of the Miller-Rabin primality test
  • * β€” means the current prime starts a regenerating progress due to some failed tests
  • a newline β€” means the number has passed all the prime tests (the actual number depends on the key size)

and because key generation is a random process, the time taken to generate a key may vary somewhat. kinda unpredictable, we love that for her 😭 but in general, more primes lead to less generation time of a key β€” so that's the tradeoff, periodt.


πŸ”₯ SEE ALSO πŸ”₯

openssl(1), openssl-genpkey(1), openssl-gendsa(1) β€” go read the whole friend group πŸ’–


Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.

like, legal stuff but make it cute β€” read the license, bestie, it's not optional 🫢


mwah πŸ’‹ that's the whole page β€” brought to you by 3.5.9, dated 2026-09-29, straight from the OPENSSL-GENRSA(1ossl) manual. slay, go generate some keys βœ¨πŸ”‘

πŸ“¦ where this page comes from