1 /* 2 * Copyright (C) 2021 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 PROVISION_VERIFY_H 16 #define PROVISION_VERIFY_H 17 18 #include "common/export_define.h" 19 #include "provision/provision_info.h" 20 21 namespace OHOS { 22 namespace Security { 23 namespace Verify { 24 #define DEV_UUID_LEN 65 25 26 enum AppProvisionVerifyResult { 27 PROVISION_INVALID, // Invalid json string 28 PROVISION_OK, // Passed 29 PROVISION_UNSUPPORTED_DEVICE_TYPE, // Failed to get device id 30 PROVISION_NUM_DEVICE_EXCEEDED, // No. of device exceeds maximum number 31 PROVISION_DEVICE_UNAUTHORIZED, // Device id not included 32 }; 33 34 /** 35 * @brief Parse and verify the app provision 36 * @param appProvision The app provision json string. 37 * @param info Out param, the parsed app provision structure. 38 * @return AppProvisionVerifyResult Verification result. 39 */ 40 DLL_EXPORT AppProvisionVerifyResult ParseAndVerify(const std::string& appProvision, ProvisionInfo& info); 41 42 /** 43 * @brief Parse app provision 44 * @param appProvision The app provision json string. 45 * @param info Out param, the parsed app provision structure. 46 * @return AppProvisionVerifyResult parse result. 47 */ 48 DLL_EXPORT AppProvisionVerifyResult ParseProvision(const std::string& appProvision, ProvisionInfo& info); 49 50 /** 51 * @brief Parse app provision profile 52 * @param appProvision The app provision json string. 53 * @param info Out param, the parsed app provision structure. 54 * @return AppProvisionVerifyResult parse result. 55 */ 56 DLL_EXPORT AppProvisionVerifyResult ParseProfile(const std::string& appProvision, ProvisionInfo& info); 57 58 DLL_EXPORT void SetRdDevice(bool isRdDevice); 59 } // namespace Verify 60 } // namespace Security 61 } // namespace OHOS 62 #endif // PROVISION_VERIFY_H 63