1 /*
2  * Copyright (c) 2024-2024 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 SIGNATRUETOOLS_PROFILE_INFO_H
16 #define SIGNATRUETOOLS_PROFILE_INFO_H
17 
18 #include <string>
19 #include <vector>
20 #include <memory>
21 
22 #include "export_define.h"
23 
24 namespace OHOS {
25 namespace SignatureTools {
26 
27 enum ProvisionType {
28     NONE_PROVISION_TYPE,
29     RELEASE,
30     DEBUG
31 };
32 enum AppDistType {
33     NONE_TYPE,
34     APP_GALLERY,
35     ENTERPRISE,
36     OS_INTEGRATION,
37     CROWDTESTING,
38     ENTERPRISE_NORMAL,
39     ENTERPRISE_MDM
40 };
41 typedef struct BundleInfoSt {
42     std::string developerId;
43     std::string apl;
44     std::string distributionCertificate;
45     std::string developmentCertificate;
46     std::string bundleName;
47     std::string appIdentifier;
48     std::vector<std::string> dataGroupIds;
49     std::string appFeature;
50 }BundleInfo;
51 typedef struct AclsSt {
52     std::vector<std::string> allowedAcls;
53 }Acls;
54 typedef struct PermissionsSt {
55     std::vector<std::string> restrictedCapabilities;
56     std::vector<std::string> restrictedPermissions;
57 }Permissions;
58 typedef struct DebugInfoSt {
59     std::vector<std::string> deviceIds;
60     std::string deviceIdType;
61 }DebugInfo;
62 typedef struct ValiditySt {
63     int64_t notAfter = 0;
64     int64_t notBefore = 0;
65 }Validity;
66 typedef struct MetadataSt {
67     std::string value;
68     std::string resource;
69     std::string name;
70 }Metadata;
71 struct ProfileInfo {
72     DLL_EXPORT ProfileInfo();
73     DLL_EXPORT ~ProfileInfo();
74     DLL_EXPORT ProfileInfo(const ProfileInfo& info);
75     DLL_EXPORT ProfileInfo& operator=(const ProfileInfo& info);
76     int32_t versionCode = 0;
77     std::string uuid;
78     std::string versionName;
79     AppDistType distributionType = NONE_TYPE;
80     ProvisionType type = NONE_PROVISION_TYPE;
81     BundleInfoSt bundleInfo;
82     PermissionsSt permissions;
83     AclsSt acls;
84     std::string issuer;
85     DebugInfoSt debugInfo;
86     std::string fingerprint;
87     std::string appId;
88     std::vector<std::string> appPrivilegeCapabilities;
89     ValiditySt validity;
90     int32_t profileBlockLength = 0;
91     std::vector<MetadataSt> metadatas;
92     std::string organization;
93     std::string appServiceCapabilities;
94     std::unique_ptr<unsigned char[]> profileBlock;
95 };
96 } // namespace SignatureTools
97 } // namespace OHOS
98 
99 #endif // SIGNATRUETOOLS_PROFILE_INFO_H
100