openssl-rand.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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>openssl-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="#SEE-ALSO">SEE ALSO</a></li>
  16. <li><a href="#HISTORY">HISTORY</a></li>
  17. <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
  18. </ul>
  19. <h1 id="NAME">NAME</h1>
  20. <p>openssl-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>-base64</b>] [<b>-hex</b>] [<b>-engine</b> <i>id</i>] [<b>-rand</b> <i>files</i>] [<b>-writerand</b> <i>file</i>] [<b>-provider</b> <i>name</i>] [<b>-provider-path</b> <i>path</i>] [<b>-propquery</b> <i>propq</i>] <i>num</i>[K|M|G|T]</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). A suffix [K|M|G|T] may be appended to the num value to indicate the requested value be scaled as a multiple of KiB/MiB/GiB/TiB respectively. Note that suffixes are case sensitive, and that the suffixes represent binary multiples (K = 1024 bytes, M = 1024*1024 bytes, etc).</p>
  25. <p>The string &#39;max&#39; may be substituted for a numerical value in num, to request the maximum number of bytes the CSPRNG can produce per instantiation. Currently, this is restricted to 2^61 bytes as per NIST SP 800-90C.</p>
  26. <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/EVP_RAND.html">EVP_RAND(7)</a>.</p>
  27. <h1 id="OPTIONS">OPTIONS</h1>
  28. <dl>
  29. <dt id="help"><b>-help</b></dt>
  30. <dd>
  31. <p>Print out a usage message.</p>
  32. </dd>
  33. <dt id="out-file"><b>-out</b> <i>file</i></dt>
  34. <dd>
  35. <p>Write to <i>file</i> instead of standard output.</p>
  36. </dd>
  37. <dt id="base64"><b>-base64</b></dt>
  38. <dd>
  39. <p>Perform base64 encoding on the output.</p>
  40. </dd>
  41. <dt id="hex"><b>-hex</b></dt>
  42. <dd>
  43. <p>Show the output as a hex string.</p>
  44. </dd>
  45. <dt id="engine-id"><b>-engine</b> <i>id</i></dt>
  46. <dd>
  47. <p>See <a href="../man1/openssl.html">&quot;Engine Options&quot; in openssl(1)</a>. This option is deprecated.</p>
  48. </dd>
  49. <dt id="rand-files--writerand-file"><b>-rand</b> <i>files</i>, <b>-writerand</b> <i>file</i></dt>
  50. <dd>
  51. <p>See <a href="../man1/openssl.html">&quot;Random State Options&quot; in openssl(1)</a> for details.</p>
  52. </dd>
  53. <dt id="provider-name"><b>-provider</b> <i>name</i></dt>
  54. <dd>
  55. </dd>
  56. <dt id="provider-path-path"><b>-provider-path</b> <i>path</i></dt>
  57. <dd>
  58. </dd>
  59. <dt id="propquery-propq"><b>-propquery</b> <i>propq</i></dt>
  60. <dd>
  61. <p>See <a href="../man1/openssl.html">&quot;Provider Options&quot; in openssl(1)</a>, <a href="../man7/provider.html">provider(7)</a>, and <a href="../man7/property.html">property(7)</a>.</p>
  62. </dd>
  63. </dl>
  64. <h1 id="SEE-ALSO">SEE ALSO</h1>
  65. <p><a href="../man1/openssl.html">openssl(1)</a>, <a href="../man3/RAND_bytes.html">RAND_bytes(3)</a>, <a href="../man7/RAND.html">RAND(7)</a>, <a href="../man7/EVP_RAND.html">EVP_RAND(7)</a></p>
  66. <h1 id="HISTORY">HISTORY</h1>
  67. <p>The <b>-engine</b> option was deprecated in OpenSSL 3.0.</p>
  68. <h1 id="COPYRIGHT">COPYRIGHT</h1>
  69. <p>Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.</p>
  70. <p>Licensed under the Apache License 2.0 (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>
  71. </body>
  72. </html>