CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DecodingKey.h
Go to the documentation of this file.
1 #ifndef CondCoreDBCommon_DecodingKey_H
2 #define CondCoreDBCommon_DecodingKey_H
3 
4 #include <iostream>
5 #include <string>
6 #include <set>
7 #include <map>
8 
9 namespace cond {
10 
16  };
17 
18  class KeyGenerator {
19  public:
20 
21  KeyGenerator();
22 
23  std::string make( size_t keySize );
25 
26  private:
27 
29 
30  };
31 
32  class DecodingKey {
33 
34  public:
35 
36  static const std::string FILE_NAME;
37  static const std::string FILE_PATH;
38  static const size_t DEFAULT_KEY_SIZE = 100;
39  static std::string templateFile();
40 
41  public:
42 
43  DecodingKey();
44 
45  virtual ~DecodingKey(){}
46 
47  size_t init( const std::string& keyFileName, const std::string& password, bool readMode = true );
48 
49  size_t createFromInputFile( const std::string& inputFileName, size_t generatedKeySize = 0 );
50 
51  void list( std::ostream& out );
52 
53  void flush();
54 
55  const std::string& principalName() const;
56 
57  const std::string& principalKey() const;
58 
59  bool isNominal() const;
60 
61  const std::string& ownerName() const;
62 
63  const std::map< std::string, ServiceCredentials >& services() const;
64 
66 
67  void addService( const std::string& serviceName, const std::string& connectionString, const std::string& userName, const std::string& password );
68 
69 
70  private:
71 
73 
74  bool m_mode;
75 
77 
79 
81 
83 
84  std::map< std::string, ServiceCredentials > m_services;
85 
86  };
87 }
88 
89 inline
91 }
92 
93 inline
95 }
96 
97 inline
98 cond::DecodingKey::DecodingKey():m_fileName(""),m_mode( true ),m_pwd(""),m_principalName(""),m_principalKey(""),m_owner(""),m_services(){
99 }
100 
101 inline
102 const std::string&
104  return m_principalName;
105 }
106 
107 inline
108 const std::string&
110  return m_principalKey;
111 }
112 
113 inline
114 bool
116  return !m_owner.empty();
117 }
118 
119 inline
120 const std::string&
122  return m_owner;
123 }
124 
125 inline
126 const std::map< std::string, cond::ServiceCredentials >&
127 cond::DecodingKey::services() const { return m_services; }
128 
129 #endif // CondCoreDBCommon_DecodingKey_H
130 
131 
static const std::string FILE_PATH
Definition: DecodingKey.h:37
void addService(const std::string &serviceName, const std::string &connectionString, const std::string &userName, const std::string &password)
Definition: DecodingKey.cc:290
std::string makeWithRandomSize(size_t maxSize)
Definition: DecodingKey.cc:87
static std::string templateFile()
Definition: DecodingKey.cc:99
std::string connectionString
Definition: DecodingKey.h:13
void addDefaultService(const std::string &connectionString)
Definition: DecodingKey.cc:286
std::string m_principalName
Definition: DecodingKey.h:78
virtual ~DecodingKey()
Definition: DecodingKey.h:45
static const std::string serviceName
const std::map< std::string, ServiceCredentials > & services() const
Definition: DecodingKey.h:127
static const size_t DEFAULT_KEY_SIZE
Definition: DecodingKey.h:38
tuple maxSize
&#39;/store/data/Commissioning08/BeamHalo/RECO/StuffAlmostToP5_v1/000/061/642/10A0FE34-A67D-DD11-AD05-000...
const std::string & principalKey() const
Definition: DecodingKey.h:109
size_t createFromInputFile(const std::string &inputFileName, size_t generatedKeySize=0)
Definition: DecodingKey.cc:189
std::map< std::string, ServiceCredentials > m_services
Definition: DecodingKey.h:84
void list(std::ostream &out)
Definition: DecodingKey.cc:238
std::string m_pwd
Definition: DecodingKey.h:76
tuple out
Definition: dbtoconf.py:99
std::string m_principalKey
Definition: DecodingKey.h:80
size_t init(const std::string &keyFileName, const std::string &password, bool readMode=true)
Definition: DecodingKey.cc:111
string connectionString
Definition: autoCondHLT.py:4
std::string m_owner
Definition: DecodingKey.h:82
std::string make(size_t keySize)
Definition: DecodingKey.cc:74
const std::string & principalName() const
Definition: DecodingKey.h:103
bool isNominal() const
Definition: DecodingKey.h:115
const std::string & ownerName() const
Definition: DecodingKey.h:121
std::string m_fileName
Definition: DecodingKey.h:72
static const std::string FILE_NAME
Definition: DecodingKey.h:36