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     INTERNALTESTING = 7,
40 };
41 
42 struct BundleInfo {
43     std::string developerId;
44     std::string developmentCertificate;
45     std::string distributionCertificate;
46     std::string bundleName;
47     std::string apl;
48     std::string appFeature;
49     std::string appIdentifier;
50     std::vector<std::string> dataGroupIds;
51 };
52 
53 struct Acls {
54     std::vector<std::string> allowedAcls;
55 };
56 
57 struct Permissions {
58     std::vector<std::string> restrictedPermissions;
59     std::vector<std::string> restrictedCapabilities;
60 };
61 
62 struct DebugInfo {
63     std::string deviceIdType;
64     std::vector<std::string> deviceIds;
65 };
66 
67 struct Validity {
68     int64_t notBefore = 0;
69     int64_t notAfter = 0;
70 };
71 
72 struct Metadata {
73     std::string name;
74     std::string value;
75     std::string resource;
76 };
77 
78 struct ProvisionInfo {
79     DLL_EXPORT ProvisionInfo();
80     DLL_EXPORT ~ProvisionInfo();
81     DLL_EXPORT ProvisionInfo(const ProvisionInfo &info);
82     DLL_EXPORT ProvisionInfo &operator=(const ProvisionInfo &info);
83 
84     int32_t versionCode = 0;
85     std::string versionName;
86     std::string uuid;
87     ProvisionType type = DEBUG;
88     AppDistType distributionType = NONE_TYPE;
89     BundleInfo bundleInfo;
90     Acls acls;
91     Permissions permissions;
92     DebugInfo debugInfo;
93     std::string issuer;
94     std::string appId;
95     std::string fingerprint;
96     std::vector<std::string> appPrivilegeCapabilities;
97     Validity validity;
98     std::vector<Metadata> metadatas;
99     int32_t profileBlockLength = 0;
100     std::unique_ptr<unsigned char[]> profileBlock;
101     std::string appServiceCapabilities;
102     std::string organization;
103 };
104 } // namespace Verify
105 } // namespace Security
106 } // namespace OHOS
107 #endif // PROVISION_INFO_H
108