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_mock.h"
17
18 #ifdef EL5_FILEKEY_MANAGER
19 #include "el5_filekey_manager_kit.h"
20 #endif
21
22 using namespace OHOS::StorageDaemon;
23 #ifdef EL5_FILEKEY_MANAGER
24 using namespace OHOS::Security::AccessToken;
25
GetUserAppKey(int32_t userId,std::vector<std::pair<int32_t,std::string>> & keyInfos)26 int32_t El5FilekeyManagerKit::GetUserAppKey(int32_t userId, std::vector<std::pair<int32_t, std::string>> &keyInfos)
27 {
28 if (IEl5FilekeyManagerKitMoc::el5FilekeyManagerKitMoc == nullptr) {
29 return 0;
30 }
31 return IEl5FilekeyManagerKitMoc::el5FilekeyManagerKitMoc->GetUserAppKey(userId, keyInfos);
32 }
33
ChangeUserAppkeysLoadInfo(int32_t userId,std::vector<std::pair<std::string,bool>> & loadInfos)34 int32_t El5FilekeyManagerKit::ChangeUserAppkeysLoadInfo(int32_t userId,
35 std::vector<std::pair<std::string, bool>> &loadInfos)
36 {
37 if (IEl5FilekeyManagerKitMoc::el5FilekeyManagerKitMoc == nullptr) {
38 return 0;
39 }
40 return IEl5FilekeyManagerKitMoc::el5FilekeyManagerKitMoc->ChangeUserAppkeysLoadInfo(userId, loadInfos);
41 }
42
GetUserAllAppKey(int32_t userId,std::vector<std::pair<int32_t,std::string>> & keyInfos)43 int32_t El5FilekeyManagerKit::GetUserAllAppKey(int32_t userId, std::vector<std::pair<int32_t, std::string>> &keyInfos)
44 {
45 if (IEl5FilekeyManagerKitMoc::el5FilekeyManagerKitMoc == nullptr) {
46 return 0;
47 }
48 return IEl5FilekeyManagerKitMoc::el5FilekeyManagerKitMoc->GetUserAllAppKey(userId, keyInfos);
49 }
50 #endif
51