openssl-rand.1ossl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  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 1ossl"
  58. .TH OPENSSL-RAND 1ossl 2025-01-17 3.4.0 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\-propquery\fR \fIpropq\fR]
  78. \&\fInum\fR[K|M|G|T]
  79. .SH DESCRIPTION
  80. .IX Header "DESCRIPTION"
  81. This command generates \fInum\fR random bytes using a cryptographically
  82. secure pseudo random number generator (CSPRNG). A suffix [K|M|G|T] may be
  83. appended to the num value to indicate the requested value be scaled as a
  84. multiple of KiB/MiB/GiB/TiB respectively. Note that suffixes are case
  85. sensitive, and that the suffixes represent binary multiples
  86. (K = 1024 bytes, M = 1024*1024 bytes, etc).
  87. .PP
  88. The string 'max' may be substituted for a numerical value in num, to request the
  89. maximum number of bytes the CSPRNG can produce per instantiation. Currently,
  90. this is restricted to 2^61 bytes as per NIST SP 800\-90C.
  91. .PP
  92. The random bytes are generated using the \fBRAND_bytes\fR\|(3) function,
  93. which provides a security level of 256 bits, provided it managed to
  94. seed itself successfully from a trusted operating system entropy source.
  95. Otherwise, the command will fail with a nonzero error code.
  96. For more details, see \fBRAND_bytes\fR\|(3), \fBRAND\fR\|(7), and \fBEVP_RAND\fR\|(7).
  97. .SH OPTIONS
  98. .IX Header "OPTIONS"
  99. .IP \fB\-help\fR 4
  100. .IX Item "-help"
  101. Print out a usage message.
  102. .IP "\fB\-out\fR \fIfile\fR" 4
  103. .IX Item "-out file"
  104. Write to \fIfile\fR instead of standard output.
  105. .IP \fB\-base64\fR 4
  106. .IX Item "-base64"
  107. Perform base64 encoding on the output.
  108. .IP \fB\-hex\fR 4
  109. .IX Item "-hex"
  110. Show the output as a hex string.
  111. .IP "\fB\-engine\fR \fIid\fR" 4
  112. .IX Item "-engine id"
  113. See "Engine Options" in \fBopenssl\fR\|(1).
  114. This option is deprecated.
  115. .IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4
  116. .IX Item "-rand files, -writerand file"
  117. See "Random State Options" in \fBopenssl\fR\|(1) for details.
  118. .IP "\fB\-provider\fR \fIname\fR" 4
  119. .IX Item "-provider name"
  120. .PD 0
  121. .IP "\fB\-provider\-path\fR \fIpath\fR" 4
  122. .IX Item "-provider-path path"
  123. .IP "\fB\-propquery\fR \fIpropq\fR" 4
  124. .IX Item "-propquery propq"
  125. .PD
  126. See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
  127. .SH "SEE ALSO"
  128. .IX Header "SEE ALSO"
  129. \&\fBopenssl\fR\|(1),
  130. \&\fBRAND_bytes\fR\|(3),
  131. \&\fBRAND\fR\|(7),
  132. \&\fBEVP_RAND\fR\|(7)
  133. .SH HISTORY
  134. .IX Header "HISTORY"
  135. The \fB\-engine\fR option was deprecated in OpenSSL 3.0.
  136. .SH COPYRIGHT
  137. .IX Header "COPYRIGHT"
  138. Copyright 2000\-2021 The OpenSSL Project Authors. All Rights Reserved.
  139. .PP
  140. Licensed under the Apache License 2.0 (the "License"). You may not use
  141. this file except in compliance with the License. You can obtain a copy
  142. in the file LICENSE in the source distribution or at
  143. <https://www.openssl.org/source/license.html>.