$NetBSD: openssl_rsa.1,v 1.14 2015/06/12 17:01:15 christos Exp $

Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is turned on, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "RSA 1"
RSA 1 "2014-08-10" "1.0.1n" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
rsa - RSA key processing tool
"LIBRARY"
libcrypto, -lcrypto
"SYNOPSIS"
Header "SYNOPSIS" \fBopenssl rsa [-inform PEM|NET|DER] [-outform PEM|NET|DER] [-in filename] [-passin arg] [-out filename] [-passout arg] [-sgckey] [-aes128] [-aes192] [-aes256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-text] [-noout] [-modulus] [-check] [-pubin] [-pubout] [-RSAPublicKey_in] [-RSAPublicKey_out] [-engine id]
"DESCRIPTION"
Header "DESCRIPTION" The rsa command processes \s-1RSA\s0 keys. They can be converted between various forms and their components printed out. Note this command uses the traditional SSLeay compatible format for private key encryption: newer applications should use the more secure PKCS#8 format using the pkcs8 utility.
"COMMAND OPTIONS"
Header "COMMAND OPTIONS"
"-inform DER|NET|PEM" 4
Item "-inform DER|NET|PEM" This specifies the input format. The \s-1DER\s0 option uses an \s-1ASN1 DER\s0 encoded form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format. The \s-1PEM\s0 form is the default format: it consists of the \s-1DER\s0 format base64 encoded with additional header and footer lines. On input PKCS#8 format private keys are also accepted. The \s-1NET\s0 form is a format is described in the \s-1NOTES\s0 section.
"-outform DER|NET|PEM" 4
Item "-outform DER|NET|PEM" This specifies the output format, the options have the same meaning as the \fB-inform option.
"-in filename" 4
Item "-in filename" This specifies the input filename to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.
"-passin arg" 4
Item "-passin arg" the input file password source. For more information about the format of arg see the \s-1PASS PHRASE ARGUMENTS\s0 section in openssl\|(1).
"-out filename" 4
Item "-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.
"-passout password" 4
Item "-passout password" the output file password source. For more information about the format of arg see the \s-1PASS PHRASE ARGUMENTS\s0 section in openssl\|(1).
"-sgckey" 4
Item "-sgckey" use the modified \s-1NET\s0 algorithm used with some versions of Microsoft \s-1IIS\s0 and \s-1SGC\s0 keys.
"-aes128|-aes192|-aes256|-camellia128|-camellia192|-camellia256|-des|-des3|-idea" 4
Item "-aes128|-aes192|-aes256|-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. This means that using the rsa utility to read in an encrypted key with no encryption option can be used to remove the pass phrase from a key, or by setting the encryption options it can be use to add or change the pass phrase. These options can only be used with \s-1PEM\s0 format output files.
"-text" 4
Item "-text" prints out the various public or private key components in plain text in addition to the encoded version.
"-noout" 4
Item "-noout" this option prevents output of the encoded version of the key.
"-modulus" 4
Item "-modulus" this option prints out the value of the modulus of the key.
"-check" 4
Item "-check" this option checks the consistency of an \s-1RSA\s0 private key.
"-pubin" 4
Item "-pubin" by default a private key is read from the input file: with this option a public key is read instead.
"-pubout" 4
Item "-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" 4
Item "-RSAPublicKey_in, -RSAPublicKey_out" like -pubin and -pubout except RSAPublicKey format is used instead.
"-engine id" 4
Item "-engine id" specifying an engine (by its unique id string) will cause rsa to attempt to obtain a functional reference to the specified engine, thus initialising it if needed. The engine will then be set as the default for all available algorithms.
"NOTES"
Header "NOTES" The \s-1PEM\s0 private key format uses the header and footer lines:

.Vb 2 -----BEGIN RSA PRIVATE KEY----- -----END RSA PRIVATE KEY----- .Ve

The \s-1PEM\s0 public key format uses the header and footer lines:

.Vb 2 -----BEGIN PUBLIC KEY----- -----END PUBLIC KEY----- .Ve

The \s-1PEM \s0RSAPublicKey format uses the header and footer lines:

.Vb 2 -----BEGIN RSA PUBLIC KEY----- -----END RSA PUBLIC KEY----- .Ve

The \s-1NET\s0 form is a format compatible with older Netscape servers and Microsoft \s-1IIS \s0.key files, this uses unsalted \s-1RC4\s0 for its encryption. It is not very secure and so should only be used when necessary.

Some newer version of \s-1IIS\s0 have additional data in the exported .key files. To use these with the utility, view the file with a binary editor and look for the string \*(L"private-key\*(R", then trace back to the byte sequence 0x30, 0x82 (this is an \s-1ASN1 SEQUENCE\s0). Copy all the data from this point onwards to another file and use that as the input to the rsa utility with the -inform \s-1NET\s0 option. If you get an error after entering the password try the -sgckey option.

"EXAMPLES"
Header "EXAMPLES" To remove the pass phrase on an \s-1RSA\s0 private key:

.Vb 1 openssl rsa -in key.pem -out keyout.pem .Ve

To encrypt a private key using triple \s-1DES:\s0

.Vb 1 openssl rsa -in key.pem -des3 -out keyout.pem .Ve

To convert a private key from \s-1PEM\s0 to \s-1DER\s0 format:

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

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

.Vb 1 openssl rsa -in key.pem -text -noout .Ve

To just output the public part of a private key:

.Vb 1 openssl rsa -in key.pem -pubout -out pubkey.pem .Ve

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

.Vb 1 openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem .Ve

"BUGS"
Header "BUGS" The command line password arguments don't currently work with \fB\s-1NET\s0 format.

There should be an option that automatically handles .key files, without having to manually edit them.

"SEE ALSO"
Header "SEE ALSO" \fIopenssl_pkcs8\|(1), openssl_dsa\|(1), openssl_genrsa\|(1), \fIopenssl_gendsa\|(1)