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

139 lines
4.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of RAND</TITLE>
</HEAD><BODY>
<H1>RAND</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-rand, rand - generate pseudo-random bytes
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>openssl rand</B>
[<B>-help</B>]
[<B>-out</B> <I>file</I>]
[<B>-rand file...</B>]
[<B>-writerand file</B>]
[<B>-base64</B>]
[<B>-hex</B>]
<I>num</I>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
This command generates <I>num</I> random bytes using a cryptographically
secure pseudo random number generator (<FONT SIZE="-1">CSPRNG</FONT>).
<P>
The random bytes are generated using the <B><A HREF="/cgi-bin/man/man2html?3+RAND_bytes">RAND_bytes</A></B>(3) function,
which provides a security level of 256 bits, provided it managed to
seed itself successfully from a trusted operating system entropy source.
Otherwise, the command will fail with a nonzero error code.
For more details, see <B><A HREF="/cgi-bin/man/man2html?3+RAND_bytes">RAND_bytes</A></B>(3), <FONT SIZE="-1"><B><A HREF="/cgi-bin/man/man2html?7+RAND">RAND</A></B></FONT><B></B>(7), and <FONT SIZE="-1"><B><A HREF="/cgi-bin/man/man2html?7+RAND_DRBG">RAND_DRBG</A></B></FONT><B></B>(7).
<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>-out file</B><DD>
Write to <I>file</I> instead of standard output.
<DT id="3"><B>-rand file...</B><DD>
A file or files containing random data used to seed the random number
generator.
Multiple files can be specified separated by an OS-dependent character.
The separator is <B>;</B> for MS-Windows, <B>,</B> for OpenVMS, and <B>:</B> for
all others.
Explicitly specifying a seed file is in general not necessary, see the
``<FONT SIZE="-1">NOTES''</FONT> section for more information.
<DT id="4">[<B>-writerand file</B>]<DD>
Writes random data to the specified <I>file</I> upon exit.
This can be used with a subsequent <B>-rand</B> flag.
<DT id="5"><B>-base64</B><DD>
Perform base64 encoding on the output.
<DT id="6"><B>-hex</B><DD>
Show the output as a hex string.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>NOTES</H2>
Prior to OpenSSL 1.1.1, it was common for applications to store information
about the state of the random-number generator in a file that was loaded
at startup and rewritten upon exit. On modern operating systems, this is
generally no longer necessary as OpenSSL will seed itself from a trusted
entropy source provided by the operating system. The <B>-rand</B> and
<B>-writerand</B> flags are still supported for special platforms or
circumstances that might require them.
<P>
It is generally an error to use the same seed file more than once and
every use of <B>-rand</B> should be paired with <B>-writerand</B>.
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+RAND_bytes">RAND_bytes</A></B>(3),
<FONT SIZE="-1"><B><A HREF="/cgi-bin/man/man2html?7+RAND">RAND</A></B></FONT><B></B>(7),
<FONT SIZE="-1"><B><A HREF="/cgi-bin/man/man2html?7+RAND_DRBG">RAND_DRBG</A></B></FONT><B></B>(7)
<A NAME="lbAH">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 2000-2020 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="7"><A HREF="#lbAB">NAME</A><DD>
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="10"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="11"><A HREF="#lbAF">NOTES</A><DD>
<DT id="12"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="13"><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:26 GMT, March 31, 2021
</BODY>
</HTML>