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