crypt::random::source::base::handle(3pm) [debian man page]
Crypt::Random::Source::Base::Handle(3pm) User Contributed Perl Documentation Crypt::Random::Source::Base::Handle(3pm)NAME
Crypt::Random::Source::Base::Handle - IO::Handle based random data sources
SYNOPSIS
use Moose;
extends qw(Crypt::Random::Source::Base::Handle);
sub open_handle {
# invoked as needed
}
# this class can also be used directly
Crypt::Random::Source::Base::Handle->new( handle => $file_handle );
# it supports some standard methods:
$p->blocking(0);
$p->read( my $buf, $n ); # no error handling here
DESCRIPTION
This is a concrete base class for all IO::Handle based random data sources.
It implements error handling
ATTRIBUTES
handle
An IO::Handle or file handle to read from.
blocking
This is actually handled by "handle", and is documented in IO::Handle.
allow_under_read
Whether or not under reading is considered an error.
Defaults to false.
reread_attempts
The number of attempts to make at rereading if the handle did not provide enough bytes on the first attempt.
Defaults to 1.
Only used if "allow_under_read" is enabled.
METHODS
get
See "get" in Crypt::Random::Source::Base.
When "blocking" or "allow_under_read" are set to a true value this method may return fewer bytes than requested.
read
This delegates directly to "handle".
It DOES NOT provide the same validation as "get" would have, so no checking for underreads is done.
close
Close the handle and clear it.
_read
"$self->handle->read" but with additional error checking and different calling conventions.
_read_too_short
Called by "_read" when not enough data was read from the handle. Normally it will either die with an error or attempt to reread. When
"allow_under_read" is true it will just return the partial buffer.
open_handle
Abstract method, should return an IO::Handle to use.
AUTHOR
Yuval Kogman <nothingmuch@woobling.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Yuval Kogman.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2011-01-05 Crypt::Random::Source::Base::Handle(3pm)
Check Out this Related Man Page
Random(3) User Contributed Perl Documentation Random(3)NAME
Crypt::OpenSSL::RSA - RSA encoding and decoding, using the openSSL libraries
Crypt::OpenSSL::Random - Routines for accessing the OpenSSL pseudo-random number generator
SYNOPSIS
use Crypt::OpenSSL::Random;
Crypt::OpenSSL::Random::random_seed($good_random_data);
Crypt::OpenSSL::Random::random_egd("/tmp/entropy");
Crypt::OpenSSL::Random::random_status() or
die "Unable to sufficiently seed the random number generator".
my $ten_good_random_bytes = Crypt::OpenSSL::Random::random_bytes(10);
my $ten_ok_random_bytes = Crypt::OpenSSL::Random::random_pseudo_bytes(10);
DESCRIPTION
Crypt::OpenSSL::Random provides the ability to seed and query the OpenSSL library's pseudo-random number generator
EXPORT
None by default.
Static Methods
random_bytes
This function, returns a specified number of cryptographically strong pseudo-random bytes from the PRNG. If the PRNG has not been
seeded with enough randomness to ensure an unpredictable byte sequence, then a false value is returned.
random_pseudo_bytes
This function, is similar to c<random_bytes>, but the resulting sequence of bytes are not necessarily unpredictable. They can be used
for non-cryptographic purposes and for certain purposes in cryptographic protocols, but usually not for key generation etc.
random_seed
This function seeds the PRNG with a supplied string of bytes. It returns true if the PRNG has sufficient seeding. Note: calling this
function with non-random bytes is of limited value at best!
random_egd
This function seeds the PRNG with data from the specified entropy gathering daemon. Returns the number of bytes read from the daemon
on succes, or -1 if not enough bytes were read, or if the connection to the daemon failed.
random_status
This function returns true if the PRNG has sufficient seeding.
BUGS
Because of the internal workings of OpenSSL's random library, the pseudo-random number generator (PRNG) accessed by Crypt::OpenSSL::Random
will be different than the one accessed by any other perl module. Hence, to use a module such as Crypt::OpenSSL::Random, you will need to
seed the PRNG used there from one used here. This class is still advantageous, however, as it centralizes other methods, such as
random_egd, in one place.
AUTHOR
Ian Robertson, iroberts@cpan.com
SEE ALSO perl(1), rand(3), RAND_add(3), RAND_egd(3), RAND_bytes(3).
POD ERRORS
Hey! The above document had some coding errors, which are explained below:
Around line 62:
'=item' outside of any '=over'
Around line 93:
You forgot a '=back' before '=head1'
perl v5.18.2 2007-05-20 Random(3)