c674c80e1d9f8471759638b5cab51655cf8b042a
[openssl.git] / doc / man1 / openssl-rand.pod.in
1 =pod
2 {- OpenSSL::safe::output_do_not_edit_headers(); -}
3
4 =head1 NAME
5
6 openssl-rand - generate pseudo-random bytes
7
8 =head1 SYNOPSIS
9
10 B<openssl rand>
11 [B<-help>]
12 [B<-out> I<file>]
13 [B<-base64>]
14 [B<-hex>]
15 {- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_r_synopsis -}
16 {- $OpenSSL::safe::opt_provider_synopsis -}
17 I<num>
18
19 =for openssl ifdef engine
20
21 =head1 DESCRIPTION
22
23 This command generates I<num> random bytes using a cryptographically
24 secure pseudo random number generator (CSPRNG).
25
26 The random bytes are generated using the L<RAND_bytes(3)> function,
27 which provides a security level of 256 bits, provided it managed to
28 seed itself successfully from a trusted operating system entropy source.
29 Otherwise, the command will fail with a nonzero error code.
30 For more details, see L<RAND_bytes(3)>, L<RAND(7)>, and L<EVP_RAND(7)>.
31
32 =head1 OPTIONS
33
34 =over 4
35
36 =item B<-help>
37
38 Print out a usage message.
39
40 =item B<-out> I<file>
41
42 Write to I<file> instead of standard output.
43
44 =item B<-base64>
45
46 Perform base64 encoding on the output.
47
48 =item B<-hex>
49
50 Show the output as a hex string.
51
52 {- $OpenSSL::safe::opt_engine_item -}
53
54 {- $OpenSSL::safe::opt_r_item -}
55
56 {- $OpenSSL::safe::opt_provider_item -}
57
58 =back
59
60 =head1 SEE ALSO
61
62 L<openssl(1)>,
63 L<RAND_bytes(3)>,
64 L<RAND(7)>,
65 L<EVP_RAND(7)>
66
67 =head1 HISTORY
68
69 The B<-engine> option was deprecated in OpenSSL 3.0.
70
71 =head1 COPYRIGHT
72
73 Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
74
75 Licensed under the Apache License 2.0 (the "License").  You may not use
76 this file except in compliance with the License.  You can obtain a copy
77 in the file LICENSE in the source distribution or at
78 L<https://www.openssl.org/source/license.html>.
79
80 =cut