Rename invalid WRT_SMACK_LABEL macro to WRT_SMACK_ENABLED
[platform/framework/web/wrt-installer.git] / src / jobs / widget_install / widget_security.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file    widget_security.h
18  * @author  Krzysztof Jackiewicz(k.jackiewicz@samsung.com)
19  * @version 1.0
20  * @brief
21  */
22
23 #ifndef WACSECURITY_H_
24 #define WACSECURITY_H_
25
26 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
27 #include <vcore/Certificate.h>
28 #include <vcore/CertificateCollection.h>
29
30 namespace Jobs {
31 namespace WidgetInstall {
32 class WidgetSecurity : public WrtDB::IWidgetSecurity
33 {
34   public:
35     WidgetSecurity() :
36         mRecognized(false),
37         mDistributorSigned(false)
38     {}
39
40     // from IWidgetSecurity
41     virtual const WrtDB::WidgetCertificateDataList& getCertificateList() const
42     {
43         return mCertificateList;
44     }
45
46     virtual bool isRecognized() const
47     {
48         return mRecognized;
49     }
50
51     virtual bool isDistributorSigned() const
52     {
53         return mDistributorSigned;
54     }
55
56     virtual void getCertificateChainList(
57         WrtDB::CertificateChainList& list,
58         WrtDB::CertificateSource source) const;
59
60     void setRecognized(bool recognized)
61     {
62         mRecognized = recognized;
63     }
64     void setDistributorSigned(bool distributorSigned)
65     {
66         mDistributorSigned = distributorSigned;
67     }
68     void setAuthorCertificatePtr(ValidationCore::CertificatePtr certPtr)
69     {
70         mAuthorCertificate = certPtr;
71     }
72
73     ValidationCore::CertificatePtr getAuthorCertificatePtr() const
74     {
75         return mAuthorCertificate;
76     }
77     ValidationCore::CertificateCollectionList& getCertificateChainListRef()
78     {
79         return mCertificateChainList;
80     }
81
82     ValidationCore::CertificateCollectionList&
83     getAuthorsCertificateChainListRef()
84     {
85         return mAuthorsCertificateChainList;
86     }
87
88     WrtDB::WidgetCertificateDataList& getCertificateListRef()
89     {
90         return mCertificateList;
91     }
92
93   private:
94     // This data are used to evaluate policy
95     WrtDB::WidgetCertificateDataList mCertificateList;
96
97     // author signature verified
98     bool mRecognized;
99     // known distribuor
100     bool mDistributorSigned;
101     // Author end entity certificate.
102     // Information from this certificate are shown to user
103     // during installation process.
104     ValidationCore::CertificatePtr mAuthorCertificate;
105     // This certificates are used by OCSP/CRL
106     ValidationCore::CertificateCollectionList mCertificateChainList;
107     // This authors certificates are used by tizen
108     ValidationCore::CertificateCollectionList mAuthorsCertificateChainList;
109 };
110 } // namespace WidgetInstall
111 } // namespace Jobs
112
113 #endif /* WACSECURITY_H_ */