OPENSSL-RSA(1ossl)

πŸ’– OPENSSL-RSA(1ossl) β€” the RSA key glow-up station πŸ’–

ok so this is the openssl-rsa page from the OpenSSL manual set (that's the 1ossl bit, iykyk), and bestie… it's literally the RSA key processing command. keys go in, keys come out, keys get printed, keys get their whole vibe changed. slay.


✨ SYNOPSIS ✨

openssl rsa [-help] [-inform DER|PEM|P12|ENGINE] [-outform DER|PEM] [-in
filename|uri] [-passin arg] [-out filename] [-passout arg] [-aes128]
[-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128]
[-camellia192] [-camellia256] [-des] [-des3] [-idea] [-text] [-noout]
[-modulus] [-traditional] [-check] [-pubin] [-pubout] [-RSAPublicKey_in]
[-RSAPublicKey_out] [-pvk-strong] [-pvk-weak] [-pvk-none] [-engine id]
[-provider name] [-provider-path path] [-provparam [name:]key=value]
[-propquery propq]

yeah it's a lot. it's giving "too many options" but honestly every single one is pulling its weight πŸ’…


🌸 DESCRIPTION 🌸

okay so this command processes RSA keys. that's the whole thing. they can be converted between various forms and their components printed out. like, the key can change its outfit (DER? PEM? you decide bestie) and also just… tell you what it's made of. main character energy fr πŸ”₯


πŸŽ€ OPTIONS πŸŽ€

  • -help β€” prints out a usage message. the "what do i even do here" option 🫢
  • -inform DER|PEM|P12|ENGINE β€” the key input format; unspecified by default. see openssl-format-options(1) for the deets.
  • -outform DER|PEM β€” the key output format; the default is PEM. again, openssl-format-options(1) has the lore.
  • -traditional β€” when writing a private key, use the traditional PKCS#1 format instead of the PKCS#8 format. vintage aesthetic ✨
  • -in filename|uri β€” this specifies the input to read a key from, or standard input if this option is not specified. and heads up: if the key is encrypted a pass phrase will be prompted for. πŸ”
  • -passin arg, -passout arg β€” the password source for the input and output file. for more info about the format of arg, see openssl-passphrase-options(1).
  • -out filename β€” this specifies the output filename to write a key to, or standard output if this option is not specified. if any encryption options are set then a pass phrase will be prompted for.
⚠️ the output filename should not be the same as the input filename. like. respectfully. don't. πŸ’€
  • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea β€” these options encrypt the private key with the specified cipher before outputting it. a pass phrase is prompted for. if none of these options is specified the key is written in plain text.

so yeah β€” this means the command can be used to remove the pass phrase from a key (by not giving any encryption option) or to add or change the pass phrase by setting them. cute right?

🫢 small catch: these options can only be used with PEM format output files.
  • -text β€” prints out the various public or private key components in plain text, in addition to the encoded version. it's giving "show me your insides" πŸ”
  • -noout β€” this option prevents output of the encoded version of the key.
  • -modulus β€” this option prints out the value of the modulus of the key.
  • -check β€” this option checks the consistency of an RSA private key. a little vibe check for your key, basically 🧚
  • -pubin β€” by default a private key is read from the input. with this option a public key is read instead. and if the input contains no public key but a private key, its public part is used. flexible!
  • -pubout β€” by default a private key is output; with this option a public key will be output instead. this option is automatically set if the input is a public key. ⭐
  • -RSAPublicKey_in, -RSAPublicKey_out β€” like -pubin and -pubout except RSAPublicKey format is used instead. same idea, different fit πŸ’…
  • -pvk-strong β€” enable 'Strong' PVK encoding level (this is the default, bestie πŸ‘‘).
  • -pvk-weak β€” enable 'Weak' PVK encoding level.
  • -pvk-none β€” don't enforce PVK encoding.
  • -engine id β€” see "Engine Options" in openssl(1).
πŸ’€ this option is deprecated. not the vibe anymore.

πŸ¦‹ NOTES πŸ¦‹

the openssl-pkey(1) command is capable of performing all the operations this command can, as well as supporting other public key types. so like… pkey is the overachiever here. rsa walked so pkey could run, honestly 😭


🌈 EXAMPLES 🌈

the documentation for the openssl-pkey(1) command contains examples equivalent to the ones listed here. but here they are anyway because we love a visual πŸŽ€

to remove the pass phrase on an RSA private key:

openssl rsa -in key.pem -out keyout.pem

to encrypt a private key using triple DES:

openssl rsa -in key.pem -des3 -out keyout.pem

to convert a private key from PEM to DER format:

openssl rsa -in key.pem -outform DER -out keyout.der

to print out the components of a private key to standard output:

openssl rsa -in key.pem -text -noout

to just output the public part of a private key:

openssl rsa -in key.pem -pubout -out pubkey.pem

output the public part of a private key in RSAPublicKey format:

openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem

πŸ™ˆ BUGS πŸ™ˆ

there should be an option that automatically handles .key files, without having to manually edit them. like… not me having to hand-edit a file in 2k26 😭 fix it pls.


πŸ“ SEE ALSO πŸ“

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


πŸ’œ HISTORY πŸ’œ

the -engine option was deprecated in OpenSSL 3.0. rip bozo, you had a good run 🫑


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>.


and that's the whole page, bestie! πŸ’… this one's from OpenSSL 3.5.9, dated 2026-09-29 β€” no cap, go forth and process those keys πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from