1Random(3) User Contributed Perl Documentation Random(3)
2
3
4
6 Crypt::OpenSSL::RSA - RSA encoding and decoding, using the openSSL
7 libraries
8
9 Crypt::OpenSSL::Random - Routines for accessing the OpenSSL
10 pseudo-random number generator
11
13 use Crypt::OpenSSL::Random;
14
15 Crypt::OpenSSL::Random::random_seed($good_random_data);
16 Crypt::OpenSSL::Random::random_egd("/tmp/entropy");
17 Crypt::OpenSSL::Random::random_status() or
18 die "Unable to sufficiently seed the random number generator".
19
20 my $ten_good_random_bytes = Crypt::OpenSSL::Random::random_bytes(10);
21 my $ten_ok_random_bytes = Crypt::OpenSSL::Random::random_pseudo_bytes(10);
22
24 Crypt::OpenSSL::Random provides the ability to seed and query the
25 OpenSSL library's pseudo-random number generator
26
27 EXPORT
28 None by default.
29
31 random_bytes
32 This function, returns a specified number of cryptographically
33 strong pseudo-random bytes from the PRNG. If the PRNG has not been
34 seeded with enough randomness to ensure an unpredictable byte
35 sequence, then a false value is returned.
36
37 random_pseudo_bytes
38 This function, is similar to c<random_bytes>, but the resulting
39 sequence of bytes are not necessarily unpredictable. They can be
40 used for non-cryptographic purposes and for certain purposes in
41 cryptographic protocols, but usually not for key generation etc.
42
43 random_seed
44 This function seeds the PRNG with a supplied string of bytes. It
45 returns true if the PRNG has sufficient seeding. Note: calling
46 this function with non-random bytes is of limited value at best!
47
48 random_egd
49 This function seeds the PRNG with data from the specified entropy
50 gathering daemon. Returns the number of bytes read from the daemon
51 on succes, or -1 if not enough bytes were read, or if the
52 connection to the daemon failed.
53
54 random_status
55 This function returns true if the PRNG has sufficient seeding.
56
58 Because of the internal workings of OpenSSL's random library, the
59 pseudo-random number generator (PRNG) accessed by
60 Crypt::OpenSSL::Random will be different than the one accessed by any
61 other perl module. Hence, to use a module such as
62 Crypt::OpenSSL::Random, you will need to seed the PRNG used there from
63 one used here. This class is still advantageous, however, as it
64 centralizes other methods, such as random_egd, in one place.
65
67 Ian Robertson, iroberts@cpan.com
68
70 perl(1), rand(3), RAND_add(3), RAND_egd(3), RAND_bytes(3).
71
73 Hey! The above document had some coding errors, which are explained
74 below:
75
76 Around line 62:
77 '=item' outside of any '=over'
78
79 Around line 93:
80 You forgot a '=back' before '=head1'
81
82
83
84perl v5.10.1 2007-05-20 Random(3)