xref: /freebsd/crypto/openssl/doc/man1/openssl-rand.pod.in (revision 4e579ad047720775ab580b74192c7de8a3386fea)
1=pod
2{- OpenSSL::safe::output_do_not_edit_headers(); -}
3
4=head1 NAME
5
6openssl-rand - generate pseudo-random bytes
7
8=head1 SYNOPSIS
9
10B<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 -}
17I<num>
18
19=head1 DESCRIPTION
20
21This command generates I<num> random bytes using a cryptographically
22secure pseudo random number generator (CSPRNG).
23
24The random bytes are generated using the L<RAND_bytes(3)> function,
25which provides a security level of 256 bits, provided it managed to
26seed itself successfully from a trusted operating system entropy source.
27Otherwise, the command will fail with a nonzero error code.
28For 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
36Print out a usage message.
37
38=item B<-out> I<file>
39
40Write to I<file> instead of standard output.
41
42=item B<-base64>
43
44Perform base64 encoding on the output.
45
46=item B<-hex>
47
48Show 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
60L<openssl(1)>,
61L<RAND_bytes(3)>,
62L<RAND(7)>,
63L<EVP_RAND(7)>
64
65=head1 HISTORY
66
67The B<-engine> option was deprecated in OpenSSL 3.0.
68
69=head1 COPYRIGHT
70
71Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
72
73Licensed under the Apache License 2.0 (the "License").  You may not use
74this file except in compliance with the License.  You can obtain a copy
75in the file LICENSE in the source distribution or at
76L<https://www.openssl.org/source/license.html>.
77
78=cut
79