limal-ca-mgm
CertificatePoliciesExtension.hpp
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                     _     _   _   _     __     _                     |
00004 |                    | |   | | | \_/ |   /  \   | |                    |
00005 |                    | |   | | | |_| |  / /\ \  | |                    |
00006 |                    | |__ | | | | | | / ____ \ | |__                  |
00007 |                    |____||_| |_| |_|/ /    \ \|____|                 |
00008 |                                                                      |
00009 |                             ca-mgm library                           |
00010 |                                                                      |
00011 |                                         (C) SUSE Linux Products GmbH |
00012 \----------------------------------------------------------------------/
00013 
00014   File:       CertificatePoliciesExtension.hpp
00015 
00016   Author:     <Michael Calmer>     <mc@suse.de>
00017   Maintainer: <Michael Calmer>     <mc@suse.de>
00018 
00019   Purpose:
00020 
00021 /-*/
00022 #ifndef    LIMAL_CA_MGM_CERTIFICATE_POLICIES_EXTENSION_HPP
00023 #define    LIMAL_CA_MGM_CERTIFICATE_POLICIES_EXTENSION_HPP
00024 
00025 #include  <limal/ca-mgm/config.h>
00026 #include  <limal/ca-mgm/CommonData.hpp>
00027 #include  <limal/ca-mgm/ExtensionBase.hpp>
00028 #include  <blocxx/COWIntrusiveReference.hpp>
00029 
00030 namespace LIMAL_NAMESPACE {
00031 
00032 namespace CA_MGM_NAMESPACE {
00033 
00034         class CA;
00035         class CAConfig;
00036         class UserNoticeImpl;
00037         class CertificatePolicyImpl;
00038         class CertificatePoliciesExtImpl;
00039         
00040         class UserNotice {
00041     public:
00042                 UserNotice();
00043                 UserNotice(const UserNotice& notice);
00044                 virtual ~UserNotice();
00045 
00046 #ifndef SWIG
00047         
00048                 UserNotice&
00049                 operator=(const UserNotice& notice);
00050 
00051 #endif
00052                 
00053                 void
00054                 initWithSection(CAConfig* caConfig, Type type, const String& sectionName);
00055 
00056                 void
00057                 setExplicitText(const String& text);
00058                 
00059                 String
00060                 getExplicitText() const;
00061 
00062                 void
00063                 setOrganizationNotice(const String& org, 
00064                                       const blocxx::List<blocxx::Int32>& numbers);
00065 
00066                 String
00067                 getOrganization() const;
00068                 
00069                 blocxx::List<blocxx::Int32>
00070                 getNoticeNumbers() const;
00071 
00072                 virtual blocxx::String
00073                 commit2Config(CA& ca, Type type, blocxx::UInt32 num) const;
00074 
00075                 virtual bool
00076                 valid() const;
00077                 
00078                 virtual blocxx::StringArray
00079                 verify() const;
00080 
00081                 virtual blocxx::StringArray
00082                 dump() const;
00083 
00084 #ifndef SWIG
00085 
00086                 friend bool
00087                 operator==(const UserNotice &l, const UserNotice &r);
00088                 
00089                 friend bool
00090                 operator<(const UserNotice &l, const UserNotice &r);
00091 
00092 #endif
00093 
00094         private:
00095                 blocxx::COWIntrusiveReference<UserNoticeImpl> m_impl;
00096         
00097         };
00098 
00099         class CertificatePolicy {
00100         public:
00101                 CertificatePolicy();
00102                 CertificatePolicy(const String& policyIdetifier);
00103                 CertificatePolicy(const CertificatePolicy& policy);
00104                 virtual ~CertificatePolicy();
00105                 
00106 #ifndef SWIG
00107 
00108                 CertificatePolicy&
00109                 operator=(const CertificatePolicy& policy);
00110 
00111 #endif
00112 
00113                 void
00114                 initWithSection(CAConfig* caConfig, Type type, const String& sectionName);
00115 
00116                 void
00117                 setPolicyIdentifier(const String& policyIdentifier);
00118                 
00119                 String
00120                 getPolicyIdentifier() const;
00121 
00122                 void
00123                 setCpsURI(const StringList& cpsURI);
00124                 
00125                 StringList
00126                 getCpsURI() const;
00127                 
00128                 void
00129                 setUserNoticeList(const blocxx::List<UserNotice>& list);
00130                 
00131                 blocxx::List<UserNotice>
00132                 getUserNoticeList() const;
00133         
00134                 virtual blocxx::String
00135                 commit2Config(CA& ca, Type type, blocxx::UInt32 num) const;
00136 
00137                 virtual bool
00138                 valid() const;
00139                 
00140                 virtual blocxx::StringArray
00141                 verify() const;
00142 
00143                 virtual blocxx::StringArray
00144                 dump() const;
00145 
00146 #ifndef SWIG
00147 
00148                 friend bool
00149                 operator==(const CertificatePolicy &l, const CertificatePolicy &r);
00150                 
00151                 friend bool
00152                 operator<(const CertificatePolicy &l, const CertificatePolicy &r);
00153 
00154 #endif
00155 
00156         private:
00157                 blocxx::COWIntrusiveReference<CertificatePolicyImpl> m_impl;
00158                 
00159                 blocxx::StringArray
00160                 checkCpsURIs(const StringList& cpsURIs) const;
00161                 
00162                 blocxx::StringArray
00163                 checkNoticeList(const blocxx::List<UserNotice>& list) const;
00164     };
00165 
00166         class CertificatePoliciesExt : public ExtensionBase {
00167         public:
00168                 CertificatePoliciesExt();
00169                 CertificatePoliciesExt(const blocxx::List<CertificatePolicy>& policies);
00170                 CertificatePoliciesExt(CAConfig* caConfig, Type type);
00171                 CertificatePoliciesExt(const CertificatePoliciesExt& extension);
00172                 virtual ~CertificatePoliciesExt();
00173                 
00174 #ifndef SWIG
00175 
00176                 CertificatePoliciesExt&
00177                 operator=(const CertificatePoliciesExt& extension);
00178 
00179 #endif
00180 
00181                 void
00182                 enableIA5org(bool ia5org = true);
00183                 
00184                 bool
00185                 isIA5orgEnabled() const;
00186                 
00187                 void
00188                 setPolicies(const blocxx::List<CertificatePolicy>& policies);
00189                 
00190                 blocxx::List<CertificatePolicy>
00191                 getPolicies() const;
00192 
00193         virtual void
00194         commit2Config(CA& ca, Type type) const;
00195                 
00196                 virtual bool
00197                 valid() const;
00198                 
00199                 virtual blocxx::StringArray
00200                 verify() const;
00201 
00202                 virtual blocxx::StringArray
00203                 dump() const;
00204 
00205         private:
00206                 blocxx::COWIntrusiveReference<CertificatePoliciesExtImpl> m_impl;
00207                 
00208                 blocxx::StringArray
00209                 checkPolicies(const blocxx::List<CertificatePolicy>& pl) const;
00210 
00211     };
00212 
00213 }
00214 }
00215 
00216 #endif // LIMAL_CA_MGM_CERTIFICATE_POLICIES_EXTENSION_HPP