• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_DLP_FILE_OPERATOR_H
17 #define INTERFACES_INNER_API_DLP_FILE_OPERATOR_H
18 
19 #include <mutex>
20 #include <string>
21 #include "dlp_file.h"
22 #include "dlp_zip_file.h"
23 #include "permission_policy.h"
24 namespace OHOS {
25 namespace Security {
26 namespace DlpPermission {
27 
28 class EnterpriseSpaceDlpPermissionKit {
29 private:
30     DISALLOW_COPY_AND_MOVE(EnterpriseSpaceDlpPermissionKit);
31     EnterpriseSpaceDlpPermissionKit();
32     int32_t EnterpriseSpaceParseDlpFileFormat(std::shared_ptr<DlpFile>& filePtr, bool needCheckCustomProperty);
33     int32_t EnterpriseSpacePrepareWorkDir(int32_t dlpFileFd, std::shared_ptr<DlpFile>& filePtr, std::string& workDir);
34     int32_t EnterpriseSpaceParseDlpFileProperty(std::shared_ptr<DlpFile>& filePtr, PermissionPolicy& policy,
35         bool needCheckCustomProperty);
36 public:
37     static EnterpriseSpaceDlpPermissionKit* GetInstance();
38     ~EnterpriseSpaceDlpPermissionKit();
39     int32_t EncryptDlpFile(DlpProperty property, CustomProperty customProperty, int32_t plainFileFd, int32_t dlpFileFd);
40     int32_t DecryptDlpFile(int32_t plainFileFd, int32_t dlpFileFd);
41     int32_t QueryDlpFileProperty(int32_t dlpFileFd, std::string &policyJsonString);
42 };
43 
44 }
45 }
46 }
47 
48 #endif
49