| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "OPENSSL-RAND 1SSL" |
| 58 |
.TH OPENSSL-RAND 1SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
openssl\-rand \- generate pseudo\-random bytes |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
\&\fBopenssl rand\fR |
| 68 |
[\fB\-help\fR] |
| 69 |
[\fB\-out\fR \fIfile\fR] |
| 70 |
[\fB\-base64\fR] |
| 71 |
[\fB\-hex\fR] |
| 72 |
[\fB\-engine\fR \fIid\fR] |
| 73 |
[\fB\-rand\fR \fIfiles\fR] |
| 74 |
[\fB\-writerand\fR \fIfile\fR] |
| 75 |
[\fB\-provider\fR \fIname\fR] |
| 76 |
[\fB\-provider\-path\fR \fIpath\fR] |
| 77 |
[\fB\-provparam\fR \fI[name:]key=value\fR] |
| 78 |
[\fB\-propquery\fR \fIpropq\fR] |
| 79 |
\&\fInum\fR[K|M|G|T] |
| 80 |
.SH DESCRIPTION |
| 81 |
.IX Header "DESCRIPTION" |
| 82 |
This command generates \fInum\fR random bytes using a cryptographically |
| 83 |
secure pseudo random number generator (CSPRNG). A suffix [K|M|G|T] may be |
| 84 |
appended to the num value to indicate the requested value be scaled as a |
| 85 |
multiple of KiB/MiB/GiB/TiB respectively. Note that suffixes are case |
| 86 |
sensitive, and that the suffixes represent binary multiples |
| 87 |
(K = 1024 bytes, M = 1024*1024 bytes, etc). |
| 88 |
.PP |
| 89 |
The string 'max' may be substituted for a numerical value in num, to request the |
| 90 |
maximum number of bytes the CSPRNG can produce per instantiation. Currently, |
| 91 |
this is restricted to 2^61 bytes as per NIST SP 800\-90C. |
| 92 |
.PP |
| 93 |
The random bytes are generated using the \fBRAND_bytes\fR\|(3) function, |
| 94 |
which provides a security level of 256 bits, provided it managed to |
| 95 |
seed itself successfully from a trusted operating system entropy source. |
| 96 |
Otherwise, the command will fail with a nonzero error code. |
| 97 |
For more details, see \fBRAND_bytes\fR\|(3), \fBRAND\fR\|(7), and \fBEVP_RAND\fR\|(7). |
| 98 |
.SH OPTIONS |
| 99 |
.IX Header "OPTIONS" |
| 100 |
.IP \fB\-help\fR 4 |
| 101 |
.IX Item "-help" |
| 102 |
Print out a usage message. |
| 103 |
.IP "\fB\-out\fR \fIfile\fR" 4 |
| 104 |
.IX Item "-out file" |
| 105 |
Write to \fIfile\fR instead of standard output. |
| 106 |
.IP \fB\-base64\fR 4 |
| 107 |
.IX Item "-base64" |
| 108 |
Perform base64 encoding on the output. |
| 109 |
.IP \fB\-hex\fR 4 |
| 110 |
.IX Item "-hex" |
| 111 |
Show the output as a hex string. |
| 112 |
.IP "\fB\-engine\fR \fIid\fR" 4 |
| 113 |
.IX Item "-engine id" |
| 114 |
See "Engine Options" in \fBopenssl\fR\|(1). |
| 115 |
This option is deprecated. |
| 116 |
.IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4 |
| 117 |
.IX Item "-rand files, -writerand file" |
| 118 |
See "Random State Options" in \fBopenssl\fR\|(1) for details. |
| 119 |
.IP "\fB\-provider\fR \fIname\fR" 4 |
| 120 |
.IX Item "-provider name" |
| 121 |
.PD 0 |
| 122 |
.IP "\fB\-provider\-path\fR \fIpath\fR" 4 |
| 123 |
.IX Item "-provider-path path" |
| 124 |
.IP "\fB\-provparam\fR \fI[name:]key=value\fR" 4 |
| 125 |
.IX Item "-provparam [name:]key=value" |
| 126 |
.IP "\fB\-propquery\fR \fIpropq\fR" 4 |
| 127 |
.IX Item "-propquery propq" |
| 128 |
.PD |
| 129 |
See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7). |
| 130 |
.SH "SEE ALSO" |
| 131 |
.IX Header "SEE ALSO" |
| 132 |
\&\fBopenssl\fR\|(1), |
| 133 |
\&\fBRAND_bytes\fR\|(3), |
| 134 |
\&\fBRAND\fR\|(7), |
| 135 |
\&\fBEVP_RAND\fR\|(7) |
| 136 |
.SH HISTORY |
| 137 |
.IX Header "HISTORY" |
| 138 |
The \fB\-engine\fR option was deprecated in OpenSSL 3.0. |
| 139 |
.SH COPYRIGHT |
| 140 |
.IX Header "COPYRIGHT" |
| 141 |
Copyright 2000\-2021 The OpenSSL Project Authors. All Rights Reserved. |
| 142 |
.PP |
| 143 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 144 |
this file except in compliance with the License. You can obtain a copy |
| 145 |
in the file LICENSE in the source distribution or at |
| 146 |
<https://www.openssl.org/source/license.html>. |