limal-ca-mgm
CertificatePoliciesExtension.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | _ _ _ _ __ _ |
4 | | | | | | \_/ | / \ | | |
5 | | | | | | |_| | / /\ \ | | |
6 | | |__ | | | | | | / ____ \ | |__ |
7 | |____||_| |_| |_|/ / \ \|____| |
8 | |
9 | ca-mgm library |
10 | |
11 | (C) SUSE Linux Products GmbH |
12 \----------------------------------------------------------------------/
13 
14  File: CertificatePoliciesExtension.hpp
15 
16  Author: <Michael Calmer> <mc@suse.de>
17  Maintainer: <Michael Calmer> <mc@suse.de>
18 
19  Purpose:
20 
21 /-*/
22 #ifndef LIMAL_CA_MGM_CERTIFICATE_POLICIES_EXTENSION_HPP
23 #define LIMAL_CA_MGM_CERTIFICATE_POLICIES_EXTENSION_HPP
24 
25 #include <limal/ca-mgm/config.h>
28 #include <blocxx/COWIntrusiveReference.hpp>
29 
30 namespace LIMAL_NAMESPACE {
31 
32 namespace CA_MGM_NAMESPACE {
33 
34  class CA;
35  class CAConfig;
36  class UserNoticeImpl;
37  class CertificatePolicyImpl;
38  class CertificatePoliciesExtImpl;
39 
40  class UserNotice {
41  public:
42  UserNotice();
43  UserNotice(const UserNotice& notice);
44  virtual ~UserNotice();
45 
46 #ifndef SWIG
47 
48  UserNotice&
49  operator=(const UserNotice& notice);
50 
51 #endif
52 
53  void
54  initWithSection(CAConfig* caConfig, Type type, const String& sectionName);
55 
56  void
57  setExplicitText(const String& text);
58 
59  String
60  getExplicitText() const;
61 
62  void
63  setOrganizationNotice(const String& org,
64  const blocxx::List<blocxx::Int32>& numbers);
65 
66  String
67  getOrganization() const;
68 
69  blocxx::List<blocxx::Int32>
70  getNoticeNumbers() const;
71 
72  virtual blocxx::String
73  commit2Config(CA& ca, Type type, blocxx::UInt32 num) const;
74 
75  virtual bool
76  valid() const;
77 
78  virtual blocxx::StringArray
79  verify() const;
80 
81  virtual blocxx::StringArray
82  dump() const;
83 
84 #ifndef SWIG
85 
86  friend bool
87  operator==(const UserNotice &l, const UserNotice &r);
88 
89  friend bool
90  operator<(const UserNotice &l, const UserNotice &r);
91 
92 #endif
93 
94  private:
95  blocxx::COWIntrusiveReference<UserNoticeImpl> m_impl;
96 
97  };
98 
100  public:
102  CertificatePolicy(const String& policyIdetifier);
103  CertificatePolicy(const CertificatePolicy& policy);
104  virtual ~CertificatePolicy();
105 
106 #ifndef SWIG
107 
109  operator=(const CertificatePolicy& policy);
110 
111 #endif
112 
113  void
114  initWithSection(CAConfig* caConfig, Type type, const String& sectionName);
115 
116  void
117  setPolicyIdentifier(const String& policyIdentifier);
118 
119  String
120  getPolicyIdentifier() const;
121 
122  void
123  setCpsURI(const StringList& cpsURI);
124 
125  StringList
126  getCpsURI() const;
127 
128  void
129  setUserNoticeList(const blocxx::List<UserNotice>& list);
130 
131  blocxx::List<UserNotice>
132  getUserNoticeList() const;
133 
134  virtual blocxx::String
135  commit2Config(CA& ca, Type type, blocxx::UInt32 num) const;
136 
137  virtual bool
138  valid() const;
139 
140  virtual blocxx::StringArray
141  verify() const;
142 
143  virtual blocxx::StringArray
144  dump() const;
145 
146 #ifndef SWIG
147 
148  friend bool
149  operator==(const CertificatePolicy &l, const CertificatePolicy &r);
150 
151  friend bool
152  operator<(const CertificatePolicy &l, const CertificatePolicy &r);
153 
154 #endif
155 
156  private:
157  blocxx::COWIntrusiveReference<CertificatePolicyImpl> m_impl;
158 
159  blocxx::StringArray
160  checkCpsURIs(const StringList& cpsURIs) const;
161 
162  blocxx::StringArray
163  checkNoticeList(const blocxx::List<UserNotice>& list) const;
164  };
165 
167  public:
169  CertificatePoliciesExt(const blocxx::List<CertificatePolicy>& policies);
170  CertificatePoliciesExt(CAConfig* caConfig, Type type);
172  virtual ~CertificatePoliciesExt();
173 
174 #ifndef SWIG
175 
177  operator=(const CertificatePoliciesExt& extension);
178 
179 #endif
180 
181  void
182  enableIA5org(bool ia5org = true);
183 
184  bool
185  isIA5orgEnabled() const;
186 
187  void
188  setPolicies(const blocxx::List<CertificatePolicy>& policies);
189 
190  blocxx::List<CertificatePolicy>
191  getPolicies() const;
192 
193  virtual void
194  commit2Config(CA& ca, Type type) const;
195 
196  virtual bool
197  valid() const;
198 
199  virtual blocxx::StringArray
200  verify() const;
201 
202  virtual blocxx::StringArray
203  dump() const;
204 
205  private:
206  blocxx::COWIntrusiveReference<CertificatePoliciesExtImpl> m_impl;
207 
208  blocxx::StringArray
209  checkPolicies(const blocxx::List<CertificatePolicy>& pl) const;
210 
211  };
212 
213 }
214 }
215 
216 #endif // LIMAL_CA_MGM_CERTIFICATE_POLICIES_EXTENSION_HPP