00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_SECURITY_SECURERANDOM_H_
00019 #define _DECAF_SECURITY_SECURERANDOM_H_
00020
00021 #include <decaf/util/Config.h>
00022
00023 #include <decaf/util/Random.h>
00024 #include <decaf/security/SecureRandomSpi.h>
00025
00026 #include <memory>
00027
00028 namespace decaf {
00029 namespace security {
00030
00034 class DECAF_API SecureRandom : public decaf::util::Random {
00035 private:
00036
00037 std::auto_ptr<SecureRandomSpi> secureRandom;
00038
00039 public:
00040
00049 SecureRandom();
00050
00061 SecureRandom( const std::vector<unsigned char>& seed );
00062
00078 SecureRandom( const unsigned char* seed, int size );
00079
00080 virtual ~SecureRandom();
00081
00082 public:
00083
00087 virtual void nextBytes( std::vector<unsigned char>& buf );
00088
00092 virtual void nextBytes( unsigned char* buf, int size );
00093
00097 virtual void setSeed( unsigned long long seed );
00098
00106 virtual void setSeed( const std::vector<unsigned char>& seed );
00107
00120 virtual void setSeed( const unsigned char* seed, int size );
00121
00122 protected:
00123
00127 virtual int next( int bits );
00128
00129 };
00130
00131 }}
00132
00133 #endif