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

263 lines
6.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of PKEY</TITLE>
</HEAD><BODY>
<H1>PKEY</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-pkey, pkey - public or private key processing tool
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>openssl</B> <B>pkey</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>-traditional</B>]
[<B>-</B>cipher<B></B>]
[<B>-text</B>]
[<B>-text_pub</B>]
[<B>-noout</B>]
[<B>-pubin</B>]
[<B>-pubout</B>]
[<B>-engine id</B>]
[<B>-check</B>]
[<B>-pubcheck</B>]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <B>pkey</B> command processes public or private keys. They can be converted
between various forms and their components printed out.
<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 <FONT SIZE="-1">DER</FONT> or <FONT SIZE="-1">PEM.</FONT> The default format is <FONT SIZE="-1">PEM.</FONT>
<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>-traditional</B><DD>
Normally a private key is written using standard format: this is PKCS#8 form
with the appropriate encryption algorithm (if any). If the <B>-traditional</B>
option is specified then the older ``traditional'' format is used instead.
<DT id="9"><B>-</B>cipher<B></B><DD>
These options encrypt the private key with the supplied cipher. Any algorithm
name accepted by <B>EVP_get_cipherbyname()</B> is acceptable such as <B>des3</B>.
<DT id="10"><B>-text</B><DD>
Prints out the various public or private key components in
plain text in addition to the encoded version.
<DT id="11"><B>-text_pub</B><DD>
Print out only public key components even if a private key is being processed.
<DT id="12"><B>-noout</B><DD>
Do not output the encoded version of the 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>-engine id</B><DD>
Specifying an engine (by its unique <B>id</B> string) will cause <B>pkey</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.
<DT id="16"><B>-check</B><DD>
This option checks the consistency of a key pair for both public and private
components.
<DT id="17"><B>-pubcheck</B><DD>
This option checks the correctness of either a public key or the public component
of a key pair.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLES</H2>
To remove the pass phrase on an <FONT SIZE="-1">RSA</FONT> private key:
<P>
<PRE>
openssl pkey -in key.pem -out keyout.pem
</PRE>
<P>
To encrypt a private key using triple <FONT SIZE="-1">DES:</FONT>
<P>
<PRE>
openssl pkey -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 pkey -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 pkey -in key.pem -text -noout
</PRE>
<P>
To print out the public components of a private key to standard output:
<P>
<PRE>
openssl pkey -in key.pem -text_pub -noout
</PRE>
<P>
To just output the public part of a private key:
<P>
<PRE>
openssl pkey -in key.pem -pubout -out pubkey.pem
</PRE>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+genpkey">genpkey</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+rsa">rsa</A></B>(1), <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="lbAH">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 2006-2017 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="18"><A HREF="#lbAB">NAME</A><DD>
<DT id="19"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="20"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="21"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="22"><A HREF="#lbAF">EXAMPLES</A><DD>
<DT id="23"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="24"><A HREF="#lbAH">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:23 GMT, March 31, 2021
</BODY>
</HTML>