• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef PROVISION_INFO_H
16 #define PROVISION_INFO_H
17 
18 #include <string>
19 #include <vector>
20 
21 #include "common/export_define.h"
22 
23 namespace OHOS {
24 namespace Security {
25 namespace Verify {
26 enum ProvisionType {
27     DEBUG = 0,
28     RELEASE = 1,
29 };
30 
31 enum AppDistType {
32     NONE_TYPE = 0,
33     APP_GALLERY = 1,
34     ENTERPRISE = 2,
35     OS_INTEGRATION = 3,
36     CROWDTESTING = 4,
37     ENTERPRISE_NORMAL = 5,
38     ENTERPRISE_MDM = 6,
39 };
40 
41 struct BundleInfo {
42     std::string developerId;
43     std::string developmentCertificate;
44     std::string distributionCertificate;
45     std::string bundleName;
46     std::string apl;
47     std::string appFeature;
48     std::string appIdentifier;
49     std::vector<std::string> dataGroupIds;
50 };
51 
52 struct Acls {
53     std::vector<std::string> allowedAcls;
54 };
55 
56 struct Permissions {
57     std::vector<std::string> restrictedPermissions;
58     std::vector<std::string> restrictedCapabilities;
59 };
60 
61 struct DebugInfo {
62     std::string deviceIdType;
63     std::vector<std::string> deviceIds;
64 };
65 
66 struct Validity {
67     int64_t notBefore = 0;
68     int64_t notAfter = 0;
69 };
70 
71 struct Metadata {
72     std::string name;
73     std::string value;
74     std::string resource;
75 };
76 
77 struct ProvisionInfo {
78     DLL_EXPORT ProvisionInfo();
79     DLL_EXPORT ~ProvisionInfo();
80     DLL_EXPORT ProvisionInfo(const ProvisionInfo &info);
81     DLL_EXPORT ProvisionInfo &operator=(const ProvisionInfo &info);
82 
83     int32_t versionCode = 0;
84     std::string versionName;
85     std::string uuid;
86     ProvisionType type = DEBUG;
87     AppDistType distributionType = NONE_TYPE;
88     BundleInfo bundleInfo;
89     Acls acls;
90     Permissions permissions;
91     DebugInfo debugInfo;
92     std::string issuer;
93     std::string appId;
94     std::string fingerprint;
95     std::vector<std::string> appPrivilegeCapabilities;
96     Validity validity;
97     std::vector<Metadata> metadatas;
98     int32_t profileBlockLength = 0;
99     std::unique_ptr<unsigned char[]> profileBlock;
100 };
101 } // namespace Verify
102 } // namespace Security
103 } // namespace OHOS
104 #endif // PROVISION_INFO_H
105