|
activemq-cpp-3.4.0
|
00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 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: // Virtual Methods 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: // Virtual method used by all non-virtual methods in Random. 00123 00127 virtual int next( int bits ); 00128 00129 }; 00130 00131 }} 00132 00133 #endif /* _DECAF_SECURITY_SECURERANDOM_H_ */