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