Fixing communication problem with security-server
[platform/core/security/security-manager.git] / ace / include / ace-dao-ro / common_dao_types.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  *
18  * @file    common_dao_types.h
19  * @author  Bartlomiej Grzelewski (b.grzelewski@samsung.com)
20  * @version 1.1
21  * @brief   This file contains the declaration of common data types for ace database.
22  */
23 #ifndef ACE_SRC_CONFIGURATION_COMMON_DAO_TYPES_H_
24 #define ACE_SRC_CONFIGURATION_COMMON_DAO_TYPES_H_
25
26 #include <list>
27 #include <dpl/optional_typedefs.h>
28 #include <dpl/string.h>
29 #include "AppTypes.h"
30
31 typedef int WidgetHandle;
32 typedef std::list<WidgetHandle> WidgetHandleList;
33
34 namespace AceDB {
35
36 enum {
37     INVALID_PLUGIN_HANDLE = -1
38 };
39 typedef int DbPluginHandle;
40
41 enum CertificateSource {
42     SIGNATURE_DISTRIBUTOR = 0,
43     SIGNATURE_AUTHOR = 1
44 };
45
46 struct WidgetRegisterInfo {
47     AppTypes type;
48     DPL::OptionalString widget_id;
49     DPL::OptionalString authorName;
50     DPL::OptionalString version;
51     DPL::OptionalString shareHref;
52 };
53
54 typedef std::list <std::string> WidgetCertificateCNList;
55
56 struct WidgetCertificateData {
57     enum Owner { AUTHOR, DISTRIBUTOR, UNKNOWN };
58     enum Type { ROOT, ENDENTITY };
59
60     Owner owner;
61     Type type;
62
63     int chainId;
64     std::string strMD5Fingerprint;
65     std::string strSHA1Fingerprint;
66     DPL::String strCommonName;
67
68     bool operator== (const WidgetCertificateData& certData) const {
69         return certData.chainId == chainId &&
70            certData.owner == owner &&
71            certData.strCommonName == strCommonName &&
72            certData.strMD5Fingerprint == strMD5Fingerprint &&
73            certData.strSHA1Fingerprint == strSHA1Fingerprint;
74     }
75 };
76 typedef std::list<WidgetCertificateData> WidgetCertificateDataList;
77
78 typedef std::list<std::string> FingerPrintList;
79
80 typedef std::list<std::string> CertificateChainList;
81 class IWacSecurity {
82   public:
83     virtual ~IWacSecurity() {}
84     virtual const WidgetCertificateDataList& getCertificateList() const = 0;
85     virtual bool isRecognized() const = 0;
86     virtual bool isDistributorSigned() const = 0;
87     virtual bool isWacSigned() const = 0;
88     virtual void getCertificateChainList(CertificateChainList& list) const = 0;
89 };
90
91 } //namespace AceDB
92
93 #endif /* ACE_SRC_CONFIGURATION_COMMON_DAO_TYPES_H_ */