Botan::RandomNumberGenerator Class Reference

#include <rng.h>

Inheritance diagram for Botan::RandomNumberGenerator:

Botan::ANSI_X931_RNG Botan::AutoSeeded_RNG Botan::HMAC_RNG Botan::Null_RNG Botan::Randpool

List of all members.

Public Member Functions

virtual void add_entropy (const byte in[], u32bit length)=0
virtual void add_entropy_source (EntropySource *source)=0
virtual void clear ()=0
virtual bool is_seeded () const
virtual std::string name () const =0
byte next_byte ()
virtual void randomize (byte output[], u32bit length)=0
 RandomNumberGenerator ()
virtual void reseed (u32bit bits_to_collect)=0
virtual ~RandomNumberGenerator ()

Static Public Member Functions

static RandomNumberGeneratormake_rng ()


Detailed Description

This class represents a random number (RNG) generator object.

Definition at line 20 of file rng.h.


Constructor & Destructor Documentation

Botan::RandomNumberGenerator::RandomNumberGenerator (  )  [inline]

Definition at line 77 of file rng.h.

00077 {}

virtual Botan::RandomNumberGenerator::~RandomNumberGenerator (  )  [inline, virtual]

Definition at line 78 of file rng.h.

00078 {}


Member Function Documentation

virtual void Botan::RandomNumberGenerator::add_entropy ( const byte  in[],
u32bit  length 
) [pure virtual]

Add entropy to this RNG.

Parameters:
in a byte array containg the entropy to be added
length the length of the byte array in

Implemented in Botan::AutoSeeded_RNG, Botan::HMAC_RNG, Botan::Randpool, Botan::Null_RNG, and Botan::ANSI_X931_RNG.

Referenced by Botan::ANSI_X931_RNG::add_entropy(), Botan::AutoSeeded_RNG::add_entropy(), Botan::NR_Signature_Operation::sign(), Botan::ECDSA_Signature_Operation::sign(), and Botan::DSA_Signature_Operation::sign().

virtual void Botan::RandomNumberGenerator::add_entropy_source ( EntropySource source  )  [pure virtual]

Add this entropy source to the RNG object

Parameters:
source the entropy source which will be retained and used by RNG

Implemented in Botan::AutoSeeded_RNG, Botan::HMAC_RNG, Botan::Randpool, Botan::Null_RNG, and Botan::ANSI_X931_RNG.

Referenced by Botan::ANSI_X931_RNG::add_entropy_source(), and Botan::AutoSeeded_RNG::add_entropy_source().

virtual void Botan::RandomNumberGenerator::clear (  )  [pure virtual]

Clear all internally held values of this RNG.

Implemented in Botan::AutoSeeded_RNG, Botan::HMAC_RNG, Botan::Randpool, Botan::Null_RNG, and Botan::ANSI_X931_RNG.

Referenced by Botan::ANSI_X931_RNG::clear(), and Botan::AutoSeeded_RNG::clear().

virtual bool Botan::RandomNumberGenerator::is_seeded (  )  const [inline, virtual]

Check whether this RNG is seeded.

Returns:
true if this RNG was already seeded, false otherwise.

Reimplemented in Botan::AutoSeeded_RNG, Botan::HMAC_RNG, Botan::Randpool, Botan::Null_RNG, and Botan::ANSI_X931_RNG.

Definition at line 45 of file rng.h.

Referenced by Botan::AutoSeeded_RNG::is_seeded().

00045 { return true; }

RandomNumberGenerator * Botan::RandomNumberGenerator::make_rng (  )  [static]

Create a seeded and active RNG object for general application use

Definition at line 29 of file rng.cpp.

00030    {
00031 #if defined(BOTAN_HAS_AUTO_SEEDING_RNG)
00032    return new AutoSeeded_RNG;
00033 #endif
00034 
00035    throw Algorithm_Not_Found("RandomNumberGenerator::make_rng - no RNG found");
00036    }

virtual std::string Botan::RandomNumberGenerator::name (  )  const [pure virtual]

Return the name of this object

Implemented in Botan::AutoSeeded_RNG, Botan::HMAC_RNG, Botan::Randpool, Botan::Null_RNG, and Botan::ANSI_X931_RNG.

Referenced by Botan::AutoSeeded_RNG::name().

byte Botan::RandomNumberGenerator::next_byte (  ) 

Return a random byte

Returns:
random byte

Definition at line 19 of file rng.cpp.

References randomize().

Referenced by Botan::random_prime().

00020    {
00021    byte out;
00022    this->randomize(&out, 1);
00023    return out;
00024    }

virtual void Botan::RandomNumberGenerator::randomize ( byte  output[],
u32bit  length 
) [pure virtual]

virtual void Botan::RandomNumberGenerator::reseed ( u32bit  bits_to_collect  )  [pure virtual]

Seed this RNG using the entropy sources it contains.

Parameters:
bits_to_collect is the number of bits of entropy to attempt to gather from the entropy sources

Implemented in Botan::AutoSeeded_RNG, Botan::HMAC_RNG, Botan::Randpool, Botan::Null_RNG, and Botan::ANSI_X931_RNG.

Referenced by Botan::ANSI_X931_RNG::reseed(), and Botan::AutoSeeded_RNG::reseed().


The documentation for this class was generated from the following files:

Generated on Fri Aug 13 16:20:59 2010 for Botan by  doxygen 1.5.8