Botan  1.11.15
Public Member Functions | Static Public Member Functions
Botan::RandomNumberGenerator Class Reference

#include <rng.h>

Inheritance diagram for Botan::RandomNumberGenerator:
Botan::ANSI_X931_RNG Botan::AutoSeeded_RNG Botan::HMAC_DRBG Botan::HMAC_RNG Botan::Null_RNG Botan::Serialized_RNG

List of all members.

Public Member Functions

virtual void add_entropy (const byte in[], size_t length)=0
virtual void clear ()=0
virtual bool is_seeded () const =0
virtual std::string name () const =0
byte next_byte ()
RandomNumberGeneratoroperator= (const RandomNumberGenerator &rng)
virtual secure_vector< byterandom_vec (size_t bytes)
virtual void randomize (byte output[], size_t length)=0
 RandomNumberGenerator (const RandomNumberGenerator &rng)
 RandomNumberGenerator ()
virtual void reseed (size_t 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 21 of file rng.h.


Constructor & Destructor Documentation

Definition at line 96 of file rng.h.

{}

Definition at line 97 of file rng.h.

{}

Member Function Documentation

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

Add entropy to this RNG.

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

Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::AutoSeeded_RNG, Botan::HMAC_DRBG, and Botan::ANSI_X931_RNG.

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

Clear all internally held values of this RNG.

Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::AutoSeeded_RNG, Botan::HMAC_DRBG, and Botan::ANSI_X931_RNG.

virtual bool Botan::RandomNumberGenerator::is_seeded ( ) const [pure virtual]

Check whether this RNG is seeded.

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

Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::HMAC_DRBG, Botan::ANSI_X931_RNG, and Botan::AutoSeeded_RNG.

Create a seeded and active RNG object for general application use Added in 1.8.0

Definition at line 14 of file rng.cpp.

   {
   std::unique_ptr<RandomNumberGenerator> rng(
      new HMAC_RNG(make_a<MessageAuthenticationCode>("HMAC(SHA-512)"),
                   make_a<MessageAuthenticationCode>("HMAC(SHA-256)"))
      );

   rng->reseed(256);

   return rng.release();
   }
virtual std::string Botan::RandomNumberGenerator::name ( ) const [pure virtual]

Return a random byte

Returns:
random byte

Definition at line 53 of file rng.h.

Referenced by Botan::random_prime().

         {
         byte out;
         this->randomize(&out, 1);
         return out;
         }
RandomNumberGenerator& Botan::RandomNumberGenerator::operator= ( const RandomNumberGenerator rng)
virtual secure_vector<byte> Botan::RandomNumberGenerator::random_vec ( size_t  bytes) [inline, virtual]
virtual void Botan::RandomNumberGenerator::randomize ( byte  output[],
size_t  length 
) [pure virtual]
virtual void Botan::RandomNumberGenerator::reseed ( size_t  bits_to_collect) [pure virtual]

Seed this RNG using the entropy sources it contains.

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

Implemented in Botan::Serialized_RNG, Botan::Null_RNG, Botan::HMAC_RNG, Botan::AutoSeeded_RNG, Botan::HMAC_DRBG, and Botan::ANSI_X931_RNG.

Referenced by botan_rng_reseed().


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