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 TICKET_VERIFY_H
16 #define TICKET_VERIFY_H
17 
18 #include "common/export_define.h"
19 #include "common/hap_byte_buffer.h"
20 #include "common/random_access_file.h"
21 
22 #include "provision/provision_info.h"
23 #include "provision/provision_verify.h"
24 
25 namespace OHOS {
26 namespace Security {
27 namespace Verify {
28 enum TicketVerifyResultCode {
29     TICKET_VERIFY_SUCCESS = 0,
30     OPEN_TICKET_FILE_ERROR = -1,
31     SIGNATURE_VERIFY_FAIL = -2,
32     TICKET_OK = -3,
33     TICKET_NOT_MATCH = -4,
34     TICKET_DEVICE_INVALID = -5,
35     TICKET_PARSE_FAIL = -6,
36     TICKET_PERMISSION_ERROR = -7,
37     TICKET_READ_FAIL = -8,
38 };
39 
40 /**
41  * @brief Parse and verify the ticket
42  * @param profileInfo input param, the parsed profile structure.
43  * @return ticket verify result.
44  */
45 DLL_EXPORT bool CheckTicketSource(const ProvisionInfo& profileInfo);
46 } // namespace Verify
47 } // namespace Security
48 } // namespace OHOS
49 #endif // TICKET_VERIFY_H
50