source code open
[framework/security/cert-svc.git] / vcore / src / vcore / DeveloperModeValidator.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        DeveloperModeValidator.h
18  * @author      Bartosz Janiak (b.janiak@samsung.com)
19  * @version     1.0
20  * @brief       DeveloperModeValidatorValidator - implementing WAC 2.0 spec, including TargetRestriction
21  */
22
23 #ifndef \
24     WRT_ENGINE_SRC_INSTALLER_CORE_VALIDATION_CORE_DEVELOPER_MODE_VALIDATOR_H
25 #define \
26     WRT_ENGINE_SRC_INSTALLER_CORE_VALIDATION_CORE_DEVELOPER_MODE_VALIDATOR_H
27
28 #include <string>
29 #include <dpl/exception.h>
30 #include "SignatureData.h"
31
32 namespace ValidationCore {
33
34 class DeveloperModeValidator
35 {
36   public:
37     explicit DeveloperModeValidator(
38         bool complianceMode = false,
39         const std::string &fakeIMEI = "",
40         const std::string &fakeMEID = "")  __attribute__((deprecated));
41
42     explicit DeveloperModeValidator(bool complianceMode = false,
43                                     bool developerMode = false,
44                                     const std::string &fakeIMEI = "",
45                                     const std::string &fakeMEID = "",
46                                     const std::string &realMEID = "");
47
48     class Exception
49     {
50       public:
51         DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
52         DECLARE_EXCEPTION_TYPE(Base, UnableToLoadTestCertificate)
53         DECLARE_EXCEPTION_TYPE(Base, NoTargetRestrictionSatisfied)
54     };
55
56     void check(const SignatureData &data);
57   private:
58     bool m_complianceModeEnabled;
59     bool m_developerModeEnabled;
60     std::string m_fakeIMEI;
61     std::string m_fakeMEID;
62     std::string m_realMEID;
63 };
64
65 }
66 #endif /* WRT_ENGINE_SRC_INSTALLER_CORE_VALIDATION_CORE_DEVELOPER_MODE_VALIDATOR_H */
67