• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 
16 #ifndef INTERFACES_INNER_API_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_PROXY_H
17 #define INTERFACES_INNER_API_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_PROXY_H
18 
19 #include "clipboard_info.h"
20 #include "clipboard_policy.h"
21 #include "enterprise_device_mgr_proxy.h"
22 #include "password_policy.h"
23 #include "watermark_param.h"
24 
25 namespace OHOS {
26 namespace EDM {
27 struct DeviceEncryptionStatus {
28     bool isEncrypted = false;
29 };
30 
31 struct CertBlobCA {
32     std::vector<uint8_t> certArray;
33     std::string alias;
34     int32_t accountId = 0;
35 };
36 
37 class SecurityManagerProxy {
38 public:
39     static std::shared_ptr<SecurityManagerProxy> GetSecurityManagerProxy();
40     int32_t GetSecurityPatchTag(const AppExecFwk::ElementName &admin, std::string &info);
41     int32_t GetSecurityPatchTag(MessageParcel &data, std::string &info);
42     int32_t GetDeviceEncryptionStatus(const AppExecFwk::ElementName &admin,
43         DeviceEncryptionStatus &deviceEncryptionStatus);
44     int32_t GetDeviceEncryptionStatus(MessageParcel &data, DeviceEncryptionStatus &deviceEncryptionStatus);
45     int32_t SetPasswordPolicy(MessageParcel &data);
46     int32_t GetPasswordPolicy(const AppExecFwk::ElementName &admin, PasswordPolicy &policy);
47     int32_t GetPasswordPolicy(PasswordPolicy &policy);
48     int32_t GetRootCheckStatus(const AppExecFwk::ElementName &admin, std::string &info);
49     int32_t SetAppClipboardPolicy(MessageParcel &data);
50     int32_t GetAppClipboardPolicy(MessageParcel &data, std::string &policy);
51     int32_t SetPermissionManagedState(MessageParcel &data);
52     int32_t GetPermissionManagedState(MessageParcel &data, int32_t &policy);
53     int32_t SetWatermarkImage(const AppExecFwk::ElementName &admin, std::shared_ptr<WatermarkParam> param);
54     int32_t CancelWatermarkImage(MessageParcel &data);
55     int32_t InstallUserCertificate(const AppExecFwk::ElementName &admin,
56         const CertBlobCA &certblobCA, std::string &result, std::string &innerCodeMsg);
57     int32_t GetUserCertificates(MessageParcel &data, std::vector<std::string> &uriList);
58 private:
59     int32_t GetPasswordPolicy(const AppExecFwk::ElementName *admin, PasswordPolicy &policy);
60     static std::shared_ptr<SecurityManagerProxy> instance_;
61     static std::once_flag flag_;
62 };
63 } // namespace EDM
64 } // namespace OHOS
65 #endif // INTERFACES_INNER_API_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_PROXY_H