1Random(3)             User Contributed Perl Documentation            Random(3)
2
3
4

NAME

6       Crypt::OpenSSL::RSA - RSA encoding and decoding, using the openSSL
7       libraries
8
9       Crypt::OpenSSL::Random - Routines for accessing the OpenSSL pseudo-ran‐
10       dom number generator
11

SYNOPSIS

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

DESCRIPTION

24       Crypt::OpenSSL::Random provides the ability to seed and query the
25       OpenSSL library's pseudo-random number generator
26
27       EXPORT
28
29       None by default.
30

Static Methods

32random_bytes
33This function, returns a specified number of cryptographically strong pseudo-
34random bytes from the PRNG.  If the PRNG has not been seeded with enough ran‐
35domness to ensure an unpredictable byte sequence, then a false value is
36returned.
37
38random_pseudo_bytes
39This function, is similar to c<random_bytes>, but the resulting sequence of
40bytes are not necessarily unpredictable.  They can be used for non-crypto‐
41graphic purposes and for certain purposes in cryptographic protocols, but usu‐
42ally not for key generation etc.
43
44random_seed
45This function seeds the PRNG with a supplied string of bytes.  It returns true
46if the PRNG has sufficient seeding.  Note: calling this function with non-ran‐
47dom bytes is of limited value at best!
48
49random_egd
50This function seeds the PRNG with data from the specified entropy gathering
51daemon.  Returns the number of bytes read from the daemon on succes, or -1 if
52not enough bytes were read, or if the connection to the daemon failed.
53
54random_status
55This function returns true if the PRNG has sufficient seeding.
56

BUGS

58       Because of the internal workings of OpenSSL's random library, the
59       pseudo-random number generator (PRNG) accessed by Crypt::OpenSSL::Ran‐
60       dom will be different than the one accessed by any other perl module.
61       Hence, to use a module such as Crypt::OpenSSL::Random, you will need to
62       seed the PRNG used there from one used here.  This class is still
63       advantageous, however, as it centralizes other methods, such as ran‐
64       dom_egd, in one place.
65

AUTHOR

67       Ian Robertson, iroberts@cpan.com
68

SEE ALSO

70       perl(1), rand(3), RAND_add(3), RAND_egd(3), RAND_bytes(3).
71
72
73
74perl v5.8.8                       2007-05-20                         Random(3)
Impressum