rand.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?xml version="1.0" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>rand</title>
  6. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  7. <link rev="made" href="mailto:root@localhost" />
  8. </head>
  9. <body>
  10. <ul id="index">
  11. <li><a href="#NAME">NAME</a></li>
  12. <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
  13. <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
  14. <li><a href="#OPTIONS">OPTIONS</a></li>
  15. <li><a href="#NOTES">NOTES</a></li>
  16. <li><a href="#SEE-ALSO">SEE ALSO</a></li>
  17. <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
  18. </ul>
  19. <h1 id="NAME">NAME</h1>
  20. <p>openssl-rand, rand - generate pseudo-random bytes</p>
  21. <h1 id="SYNOPSIS">SYNOPSIS</h1>
  22. <p><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></p>
  23. <h1 id="DESCRIPTION">DESCRIPTION</h1>
  24. <p>This command generates <i>num</i> random bytes using a cryptographically secure pseudo random number generator (CSPRNG).</p>
  25. <p>The random bytes are generated using the <a href="../man3/RAND_bytes.html">RAND_bytes(3)</a> 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 <a href="../man3/RAND_bytes.html">RAND_bytes(3)</a>, <a href="../man7/RAND.html">RAND(7)</a>, and <a href="../man7/RAND_DRBG.html">RAND_DRBG(7)</a>.</p>
  26. <h1 id="OPTIONS">OPTIONS</h1>
  27. <dl>
  28. <dt id="help"><b>-help</b></dt>
  29. <dd>
  30. <p>Print out a usage message.</p>
  31. </dd>
  32. <dt id="out-file"><b>-out file</b></dt>
  33. <dd>
  34. <p>Write to <i>file</i> instead of standard output.</p>
  35. </dd>
  36. <dt id="rand-file"><b>-rand file...</b></dt>
  37. <dd>
  38. <p>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 <a href="#NOTES">&quot;NOTES&quot;</a> section for more information.</p>
  39. </dd>
  40. <dt id="writerand-file">[<b>-writerand file</b>]</dt>
  41. <dd>
  42. <p>Writes random data to the specified <i>file</i> upon exit. This can be used with a subsequent <b>-rand</b> flag.</p>
  43. </dd>
  44. <dt id="base64"><b>-base64</b></dt>
  45. <dd>
  46. <p>Perform base64 encoding on the output.</p>
  47. </dd>
  48. <dt id="hex"><b>-hex</b></dt>
  49. <dd>
  50. <p>Show the output as a hex string.</p>
  51. </dd>
  52. </dl>
  53. <h1 id="NOTES">NOTES</h1>
  54. <p>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>
  55. <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>.</p>
  56. <h1 id="SEE-ALSO">SEE ALSO</h1>
  57. <p><a href="../man3/RAND_bytes.html">RAND_bytes(3)</a>, <a href="../man7/RAND.html">RAND(7)</a>, <a href="../man7/RAND_DRBG.html">RAND_DRBG(7)</a></p>
  58. <h1 id="COPYRIGHT">COPYRIGHT</h1>
  59. <p>Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.</p>
  60. <p>Licensed under the OpenSSL license (the &quot;License&quot;). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
  61. </body>
  62. </html>