rand.pod 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. =pod
  2. =head1 NAME
  3. openssl-rand,
  4. rand - generate pseudo-random bytes
  5. =head1 SYNOPSIS
  6. B<openssl rand>
  7. [B<-help>]
  8. [B<-out> I<file>]
  9. [B<-rand file...>]
  10. [B<-writerand file>]
  11. [B<-base64>]
  12. [B<-hex>]
  13. I<num>
  14. =head1 DESCRIPTION
  15. This command generates I<num> random bytes using a cryptographically
  16. secure pseudo random number generator (CSPRNG).
  17. The random bytes are generated using the L<RAND_bytes(3)> function,
  18. which provides a security level of 256 bits, provided it managed to
  19. seed itself successfully from a trusted operating system entropy source.
  20. Otherwise, the command will fail with a nonzero error code.
  21. For more details, see L<RAND_bytes(3)>, L<RAND(7)>, and L<RAND_DRBG(7)>.
  22. =head1 OPTIONS
  23. =over 4
  24. =item B<-help>
  25. Print out a usage message.
  26. =item B<-out file>
  27. Write to I<file> instead of standard output.
  28. =item B<-rand file...>
  29. A file or files containing random data used to seed the random number
  30. generator.
  31. Multiple files can be specified separated by an OS-dependent character.
  32. The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
  33. all others.
  34. Explicitly specifying a seed file is in general not necessary, see the
  35. L</NOTES> section for more information.
  36. =item [B<-writerand file>]
  37. Writes random data to the specified I<file> upon exit.
  38. This can be used with a subsequent B<-rand> flag.
  39. =item B<-base64>
  40. Perform base64 encoding on the output.
  41. =item B<-hex>
  42. Show the output as a hex string.
  43. =back
  44. =head1 NOTES
  45. Prior to OpenSSL 1.1.1, it was common for applications to store information
  46. about the state of the random-number generator in a file that was loaded
  47. at startup and rewritten upon exit. On modern operating systems, this is
  48. generally no longer necessary as OpenSSL will seed itself from a trusted
  49. entropy source provided by the operating system. The B<-rand> and
  50. B<-writerand> flags are still supported for special platforms or
  51. circumstances that might require them.
  52. It is generally an error to use the same seed file more than once and
  53. every use of B<-rand> should be paired with B<-writerand>.
  54. =head1 SEE ALSO
  55. L<RAND_bytes(3)>,
  56. L<RAND(7)>,
  57. L<RAND_DRBG(7)>
  58. =head1 COPYRIGHT
  59. Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
  60. Licensed under the OpenSSL license (the "License"). You may not use
  61. this file except in compliance with the License. You can obtain a copy
  62. in the file LICENSE in the source distribution or at
  63. L<https://www.openssl.org/source/license.html>.
  64. =cut