1 /*
2 * Copyright (c) 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
16 #include "el5_filekey_manager_kit.h"
17
18 #include "el5_filekey_manager_client.h"
19
20 namespace OHOS {
21 namespace Security {
22 namespace AccessToken {
AcquireAccess(DataLockType type)23 int32_t El5FilekeyManagerKit::AcquireAccess(DataLockType type)
24 {
25 return El5FilekeyManagerClient::GetInstance().AcquireAccess(type);
26 }
27
ReleaseAccess(DataLockType type)28 int32_t El5FilekeyManagerKit::ReleaseAccess(DataLockType type)
29 {
30 return El5FilekeyManagerClient::GetInstance().ReleaseAccess(type);
31 }
32
GenerateAppKey(uint32_t uid,const std::string & bundleName,std::string & keyId)33 int32_t El5FilekeyManagerKit::GenerateAppKey(uint32_t uid, const std::string& bundleName, std::string& keyId)
34 {
35 return El5FilekeyManagerClient::GetInstance().GenerateAppKey(uid, bundleName, keyId);
36 }
37
DeleteAppKey(const std::string & bundleName,int32_t userId)38 int32_t El5FilekeyManagerKit::DeleteAppKey(const std::string& bundleName, int32_t userId)
39 {
40 return El5FilekeyManagerClient::GetInstance().DeleteAppKey(bundleName, userId);
41 }
42
GetUserAppKey(int32_t userId,std::vector<std::pair<int32_t,std::string>> & keyInfos)43 int32_t El5FilekeyManagerKit::GetUserAppKey(int32_t userId, std::vector<std::pair<int32_t, std::string>> &keyInfos)
44 {
45 return El5FilekeyManagerClient::GetInstance().GetUserAppKey(userId, false, keyInfos);
46 }
47
ChangeUserAppkeysLoadInfo(int32_t userId,std::vector<std::pair<std::string,bool>> & loadInfos)48 int32_t El5FilekeyManagerKit::ChangeUserAppkeysLoadInfo(int32_t userId,
49 std::vector<std::pair<std::string, bool>> &loadInfos)
50 {
51 return El5FilekeyManagerClient::GetInstance().ChangeUserAppkeysLoadInfo(userId, loadInfos);
52 }
53
SetFilePathPolicy()54 int32_t El5FilekeyManagerKit::SetFilePathPolicy()
55 {
56 return El5FilekeyManagerClient::GetInstance().SetFilePathPolicy();
57 }
58
RegisterCallback(const sptr<El5FilekeyCallbackInterface> & callback)59 int32_t El5FilekeyManagerKit::RegisterCallback(const sptr<El5FilekeyCallbackInterface> &callback)
60 {
61 return El5FilekeyManagerClient::GetInstance().RegisterCallback(callback);
62 }
63
GetUserAllAppKey(int32_t userId,std::vector<std::pair<int32_t,std::string>> & keyInfos)64 int32_t El5FilekeyManagerKit::GetUserAllAppKey(int32_t userId, std::vector<std::pair<int32_t, std::string>> &keyInfos)
65 {
66 return El5FilekeyManagerClient::GetInstance().GetUserAppKey(userId, true, keyInfos);
67 }
68 } // namespace AccessToken
69 } // namespace Security
70 } // namespace OHOS
71