Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / installer / signature_data.h
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef XWALK_APPLICATION_COMMON_INSTALLER_SIGNATURE_DATA_H_
6 #define XWALK_APPLICATION_COMMON_INSTALLER_SIGNATURE_DATA_H_
7
8 #include <list>
9 #include <set>
10 #include <string>
11
12 #include "base/files/file_path.h"
13 #include "libxml/tree.h"
14 #include "libxml/xpath.h"
15
16 namespace xwalk {
17 namespace application {
18
19 class SignatureData {
20  public:
21   SignatureData(const std::string& signature_file_name, int signature_number);
22   ~SignatureData();
23
24   std::string signature_file_name() const {
25     return signature_file_name_;
26   }
27
28   const std::set<std::string>& reference_set() const {
29     return reference_set_;
30   }
31
32   void set_reference_set(const std::set<std::string>& reference_set) {
33     reference_set_ = reference_set;
34   }
35
36   std::string role_uri() const {
37     return role_uri_;
38   }
39
40   void set_role_uri(const std::string& role_uri) {
41     role_uri_ = role_uri;
42   }
43
44   std::string profile_uri() const {
45     return profile_uri_;
46   }
47
48   void set_profile_uri(const std::string& profile_uri) {
49     profile_uri_ = profile_uri;
50   }
51
52   std::string object_id() const {
53     return object_id_;
54   }
55
56   void set_object_id(const std::string& object_id) {
57     object_id_ = object_id;
58   }
59
60   std::string signature_value() const {
61     return signature_value_;
62   }
63
64   void set_signature_value(const std::string& signature_value) {
65     signature_value_ = signature_value;
66   }
67
68   std::string canonicalization_method() const {
69     return canonicalization_method_;
70   }
71
72   void set_canonicalization_method(const std::string& canonicalization_method) {
73     canonicalization_method_ = canonicalization_method;
74   }
75
76   std::string signature_method() const {
77     return signature_method_;
78   }
79
80   void set_signature_method(const std::string signature_method) {
81     signature_method_ = signature_method;
82   }
83
84   const std::list<std::string>& certificate_list() const {
85     return certificate_list_;
86   }
87
88   void set_certificate_list(const std::list<std::string>& certificate_list) {
89     certificate_list_ = certificate_list;
90   }
91
92   bool isAuthorSignature() const {
93     return signature_number_ == -1;
94   }
95
96   base::FilePath GetExtractedWidgetPath() const;
97
98  private:
99   std::string signature_file_name_;
100   // This number is taken from distributor signature file name.
101   // Author signature do not contain any number on the file name.
102   // Author signature should have signature number equal to -1.
103   int signature_number_;
104   std::string role_uri_;
105   std::string profile_uri_;
106   std::string signature_value_;
107   std::string identifier;
108   std::string object_id_;
109   std::string canonicalization_method_;
110   std::string signature_method_;
111   std::set<std::string> reference_set_;
112   std::list<std::string> certificate_list_;
113
114   DISALLOW_COPY_AND_ASSIGN(SignatureData);
115 };
116
117 }  // namespace application
118 }  // namespace xwalk
119
120 #endif  // XWALK_APPLICATION_COMMON_INSTALLER_SIGNATURE_DATA_H_