[Release] wrt-installer_0.1.114
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_certify_level.h
1 /*
2  * Copyright (c) 2013 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    task_certify_level.h
18  * @author  Jihoon Chung (jihoon.chung@samgsung.com)
19  * @version
20  * @brief
21  */
22 #ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFY_LEVEL_H
23 #define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFY_LEVEL_H
24
25 //SYSTEM INCLUDES
26 #include <string>
27 #include <cstdint>
28 #include <map>
29
30 //WRT INCLUDES
31 #include <vcore/CertStoreType.h>
32 #include <vcore/SignatureFinder.h>
33 #include <dpl/task.h>
34
35 class InstallerContext;
36
37 namespace Jobs {
38 namespace WidgetInstall {
39 class TaskCertifyLevel :
40     public DPL::TaskDecl<TaskCertifyLevel>
41 {
42   public:
43     TaskCertifyLevel(InstallerContext &inCont);
44
45   private:
46     //data
47     InstallerContext& m_contextData;
48
49     enum class Level : std::int8_t {
50         UNKNOWN  = 0,
51         PUBLIC   = 1,
52         PARTNER  = 2,
53         PLATFORM = 3
54     };
55     typedef std::map<std::string, Level> secureSettingMap;
56     typedef std::map<std::string, Level>::iterator secureSettingIter;
57
58     //steps
59     void stepCertifyLevel();
60     void StartStep();
61     void EndStep();
62
63     //util
64     void getSignatureFiles(const std::string& path,
65                            ValidationCore::SignatureFileInfoSet& file);
66     Level getCertifyLevel();
67     bool checkSettingLevel(Level level);
68     std::string enumToString(Level level);
69     Level certTypeToLevel(ValidationCore::CertStoreId::Type type);
70
71 };
72 } //namespace WidgetInstall
73 } //namespace Jobs
74
75 #endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFY_LEVEL_H