man-pages/man1/rsa.1ssl.html
2021-03-31 01:06:50 +01:00

332 lines
7.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of RSA</TITLE>
</HEAD><BODY>
<H1>RSA</H1>
Section: OpenSSL (1SSL)<BR>Updated: 2021-03-22<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
openssl-rsa, rsa - RSA key processing tool
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>openssl</B> <B>rsa</B>
[<B>-help</B>]
[<B>-inform PEM|DER</B>]
[<B>-outform PEM|DER</B>]
[<B>-in filename</B>]
[<B>-passin arg</B>]
[<B>-out filename</B>]
[<B>-passout arg</B>]
[<B>-aes128</B>]
[<B>-aes192</B>]
[<B>-aes256</B>]
[<B>-aria128</B>]
[<B>-aria192</B>]
[<B>-aria256</B>]
[<B>-camellia128</B>]
[<B>-camellia192</B>]
[<B>-camellia256</B>]
[<B>-des</B>]
[<B>-des3</B>]
[<B>-idea</B>]
[<B>-text</B>]
[<B>-noout</B>]
[<B>-modulus</B>]
[<B>-check</B>]
[<B>-pubin</B>]
[<B>-pubout</B>]
[<B>-RSAPublicKey_in</B>]
[<B>-RSAPublicKey_out</B>]
[<B>-engine id</B>]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <B>rsa</B> command processes <FONT SIZE="-1">RSA</FONT> keys. They can be converted between various
forms and their components printed out. <B>Note</B> this command uses the
traditional SSLeay compatible format for private key encryption: newer
applications should use the more secure PKCS#8 format using the <B>pkcs8</B>
utility.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-help</B><DD>
Print out a usage message.
<DT id="2"><B>-inform DER|PEM</B><DD>
This specifies the input format. The <B></B><FONT SIZE="-1"><B>DER</B></FONT><B></B> option uses an <FONT SIZE="-1">ASN1 DER</FONT> encoded
form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format.
The <B></B><FONT SIZE="-1"><B>PEM</B></FONT><B></B> form is the default format: it consists of the <B></B><FONT SIZE="-1"><B>DER</B></FONT><B></B> format base64
encoded with additional header and footer lines. On input PKCS#8 format private
keys are also accepted.
<DT id="3"><B>-outform DER|PEM</B><DD>
This specifies the output format, the options have the same meaning and default
as the <B>-inform</B> option.
<DT id="4"><B>-in filename</B><DD>
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.
<DT id="5"><B>-passin arg</B><DD>
The input file password source. For more information about the format of <B>arg</B>
see the <B></B><FONT SIZE="-1"><B>PASS PHRASE ARGUMENTS</B></FONT><B></B> section in <B><A HREF="/cgi-bin/man/man2html?1+openssl">openssl</A></B>(1).
<DT id="6"><B>-out filename</B><DD>
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 <B>not</B> be the same as the input
filename.
<DT id="7"><B>-passout password</B><DD>
The output file password source. For more information about the format of <B>arg</B>
see the <B></B><FONT SIZE="-1"><B>PASS PHRASE ARGUMENTS</B></FONT><B></B> section in <B><A HREF="/cgi-bin/man/man2html?1+openssl">openssl</A></B>(1).
<DT id="8"><B>-aes128</B>, <B>-aes192</B>, <B>-aes256</B>, <B>-aria128</B>, <B>-aria192</B>, <B>-aria256</B>, <B>-camellia128</B>, <B>-camellia192</B>, <B>-camellia256</B>, <B>-des</B>, <B>-des3</B>, <B>-idea</B><DD>
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 <B>rsa</B> 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 <FONT SIZE="-1">PEM</FONT> format output files.
<DT id="9"><B>-text</B><DD>
Prints out the various public or private key components in
plain text in addition to the encoded version.
<DT id="10"><B>-noout</B><DD>
This option prevents output of the encoded version of the key.
<DT id="11"><B>-modulus</B><DD>
This option prints out the value of the modulus of the key.
<DT id="12"><B>-check</B><DD>
This option checks the consistency of an <FONT SIZE="-1">RSA</FONT> private key.
<DT id="13"><B>-pubin</B><DD>
By default a private key is read from the input file: with this
option a public key is read instead.
<DT id="14"><B>-pubout</B><DD>
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.
<DT id="15"><B>-RSAPublicKey_in</B>, <B>-RSAPublicKey_out</B><DD>
Like <B>-pubin</B> and <B>-pubout</B> except <B>RSAPublicKey</B> format is used instead.
<DT id="16"><B>-engine id</B><DD>
Specifying an engine (by its unique <B>id</B> string) will cause <B>rsa</B>
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.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>NOTES</H2>
The <FONT SIZE="-1">PEM</FONT> private key format uses the header and footer lines:
<P>
<PRE>
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
</PRE>
<P>
The <FONT SIZE="-1">PEM</FONT> public key format uses the header and footer lines:
<P>
<PRE>
-----BEGIN PUBLIC KEY-----
-----END PUBLIC KEY-----
</PRE>
<P>
The <FONT SIZE="-1">PEM</FONT> <B>RSAPublicKey</B> format uses the header and footer lines:
<P>
<PRE>
-----BEGIN RSA PUBLIC KEY-----
-----END RSA PUBLIC KEY-----
</PRE>
<A NAME="lbAG">&nbsp;</A>
<H2>EXAMPLES</H2>
To remove the pass phrase on an <FONT SIZE="-1">RSA</FONT> private key:
<P>
<PRE>
openssl rsa -in key.pem -out keyout.pem
</PRE>
<P>
To encrypt a private key using triple <FONT SIZE="-1">DES:</FONT>
<P>
<PRE>
openssl rsa -in key.pem -des3 -out keyout.pem
</PRE>
<P>
To convert a private key from <FONT SIZE="-1">PEM</FONT> to <FONT SIZE="-1">DER</FONT> format:
<P>
<PRE>
openssl rsa -in key.pem -outform DER -out keyout.der
</PRE>
<P>
To print out the components of a private key to standard output:
<P>
<PRE>
openssl rsa -in key.pem -text -noout
</PRE>
<P>
To just output the public part of a private key:
<P>
<PRE>
openssl rsa -in key.pem -pubout -out pubkey.pem
</PRE>
<P>
Output the public part of a private key in <B>RSAPublicKey</B> format:
<P>
<PRE>
openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem
</PRE>
<A NAME="lbAH">&nbsp;</A>
<H2>BUGS</H2>
There should be an option that automatically handles .key files,
without having to manually edit them.
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+pkcs8">pkcs8</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+dsa">dsa</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+genrsa">genrsa</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+gendsa">gendsa</A></B>(1)
<A NAME="lbAJ">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
<P>
Licensed under the OpenSSL license (the ``License''). You may not use
this file except in compliance with the License. You can obtain a copy
in the file <FONT SIZE="-1">LICENSE</FONT> in the source distribution or at
&lt;<A HREF="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</A>&gt;.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="17"><A HREF="#lbAB">NAME</A><DD>
<DT id="18"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="19"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="20"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="21"><A HREF="#lbAF">NOTES</A><DD>
<DT id="22"><A HREF="#lbAG">EXAMPLES</A><DD>
<DT id="23"><A HREF="#lbAH">BUGS</A><DD>
<DT id="24"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="25"><A HREF="#lbAJ">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:26 GMT, March 31, 2021
</BODY>
</HTML>