CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cond::auth::KeyGenerator Class Reference

#include <DecodingKey.h>

Public Member Functions

 KeyGenerator ()
 
std::string make (size_t keySize)
 
std::string makeWithRandomSize (size_t maxSize)
 

Private Attributes

int m_iteration
 

Detailed Description

Definition at line 20 of file DecodingKey.h.

Constructor & Destructor Documentation

cond::auth::KeyGenerator::KeyGenerator ( )
inline

Definition at line 94 of file DecodingKey.h.

94  :m_iteration(0){
95 }

Member Function Documentation

std::string cond::auth::KeyGenerator::make ( size_t  keySize)

Definition at line 75 of file DecodingKey.cc.

References mps_fire::i, rand(), cond::randomChar(), SurveyInfoScenario_cff::seed, AlCaHLTBitMon_QueryRunRegistry::string, and protons_cff::time.

Referenced by cond::auth::DecodingKey::createFromInputFile(), cond::CredentialStore::createSchema(), cond::updateConnectionData(), and cond::updatePrincipalData().

75  {
76  ::srand( m_iteration+2 );
77  int rseed = ::rand();
78  int seed = ::time( nullptr)%10 + rseed;
79  ::srand( seed );
80  std::string ret("");
81  for( size_t i=0;i<keySize; i++ ){
82  ret += randomChar();
83  }
84  m_iteration++;
85  return ret;
86 }
Signal rand(Signal arg)
Definition: vlib.cc:442
char randomChar()
Definition: DecodingKey.cc:37
std::string cond::auth::KeyGenerator::makeWithRandomSize ( size_t  maxSize)

Definition at line 88 of file DecodingKey.cc.

References reco::modules::make(), copyPickMerge_cfg::maxSize, rand(), SurveyInfoScenario_cff::seed, and protons_cff::time.

88  {
89  ::srand( m_iteration+2 );
90  int rseed = ::rand();
91  int seed = ::time( nullptr)%10 + rseed;
92  ::srand( seed );
93  size_t sz = rand()%maxSize;
94  return make( sz );
95 }
std::string make(size_t keySize)
Definition: DecodingKey.cc:75
Signal rand(Signal arg)
Definition: vlib.cc:442

Member Data Documentation

int cond::auth::KeyGenerator::m_iteration
private

Definition at line 30 of file DecodingKey.h.