2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file widget_register_types.h
18 * @author Tomasz Iwanek (t.iwanek@samsung.com)
22 #ifndef WIDGET_REGISTER_TYPES_H
23 #define WIDGET_REGISTER_TYPES_H
29 #include <dpl/string.h>
30 #include <dpl/optional_typedefs.h>
31 #include <dpl/wrt-dao-ro/config_parser_data.h>
32 #include <dpl/wrt-dao-ro/property_dao_read_only.h>
33 #include <dpl/wrt-dao-ro/common_dao_types.h>
36 enum CertificateSource {
38 SIGNATURE_DISTRIBUTOR = 1,
39 SIGNATURE_DISTRIBUTOR2 = 2,
43 struct WidgetLocalizedInfo
45 DPL::OptionalString name;
46 DPL::OptionalString shortName;
47 DPL::OptionalString description;
48 DPL::OptionalString license;
49 DPL::OptionalString licenseHref;
54 * A structure to hold certificate fingerprints.
56 struct WidgetCertificateData
58 enum Owner { AUTHOR, DISTRIBUTOR, DISTRIBUTOR2, UNKNOWN };
59 enum Type { ROOT, ENDENTITY };
61 // type of signature: author/distributor
63 // indicates whether this is ca certificate
66 // chain id number: relative BASE, where BASE is signatureBASE.xml
68 // certificate fingerprint digested by md5
69 std::string strMD5Fingerprint;
70 // certificate fingerprint digestef by sha1
71 std::string strSHA1Fingerprint;
72 // Common name field in certificate
73 DPL::String strCommonName;
75 bool operator== (const WidgetCertificateData& certData) const
77 return certData.chainId == chainId &&
78 certData.owner == owner &&
79 certData.strCommonName == strCommonName &&
80 certData.strMD5Fingerprint == strMD5Fingerprint &&
81 certData.strSHA1Fingerprint == strSHA1Fingerprint;
85 typedef std::list<WidgetCertificateData> WidgetCertificateDataList;
87 typedef DPL::String Locale;
88 typedef std::set<Locale> LocaleSet;
89 typedef std::list<std::string> ExternalLocationList;
93 * A structure to hold widget's information needed to be registered.
94 * @see WidgetConfigurationInfo
96 struct WidgetRegisterInfo
98 struct LocalizedIcon : public ConfigParserData::Icon
100 LocalizedIcon(const ConfigParserData::Icon& icon,
101 const LocaleSet& _availableLocales) :
102 ConfigParserData::Icon(icon),
103 availableLocales(_availableLocales)
106 LocaleSet availableLocales;
109 struct StartFileProperties
111 DPL::String encoding;
115 typedef std::map<Locale,
116 StartFileProperties> StartFilePropertiesForLocalesMap;
117 struct LocalizedStartFile
120 StartFilePropertiesForLocalesMap propertiesForLocales;
123 typedef std::list<LocalizedIcon> LocalizedIconList;
124 typedef std::list<LocalizedStartFile> LocalizedStartFileList;
125 struct LocalizationData
127 LocalizedIconList icons;
128 LocalizedStartFileList startFiles;
132 WidgetRegisterInfo() :
133 webAppType(APP_TYPE_UNKNOWN),
135 packagingType(PKG_TYPE_UNKNOWN)
138 WidgetType webAppType;
139 DPL::OptionalString guid;
140 DPL::OptionalString version;
141 DPL::OptionalString minVersion;
142 std::string baseFolder;
143 ConfigParserData configInfo;
144 LocalizationData localizationData;
149 time_t installedTime;
150 PackagingType packagingType;
151 EncryptedFileList encryptedFiles;
152 ExternalLocationList externalLocations;
153 DPL::OptionalString widgetInstalledPath;
156 typedef std::list<std::string> CertificateChainList;
157 class IWidgetSecurity
160 virtual ~IWidgetSecurity();
162 virtual const WidgetCertificateDataList& getCertificateList() const = 0;
164 virtual bool isRecognized() const = 0;
166 virtual bool isDistributorSigned() const = 0;
168 virtual void getCertificateChainList(CertificateChainList& list,
169 CertificateSource source) const = 0;
174 * Structure to hold the information of widget's author.
176 struct WidgetAuthorInfo
178 DPL::OptionalString name;
179 DPL::OptionalString email;
180 DPL::OptionalString href;
183 typedef std::list <std::string> WidgetCertificateCNList;
184 typedef std::list<DPL::String> LanguageTagList;
185 typedef std::list<std::string> HostList;
186 typedef std::list<std::string> FingerPrintList;
190 #endif // WIDGET_REGISTER_TYPES_H