1c5e268c6Sopenharmony_ci/*
2c5e268c6Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
3c5e268c6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c5e268c6Sopenharmony_ci * you may not use this file except in compliance with the License.
5c5e268c6Sopenharmony_ci * You may obtain a copy of the License at
6c5e268c6Sopenharmony_ci *
7c5e268c6Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8c5e268c6Sopenharmony_ci *
9c5e268c6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10c5e268c6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c5e268c6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c5e268c6Sopenharmony_ci * See the License for the specific language governing permissions and
13c5e268c6Sopenharmony_ci * limitations under the License.
14c5e268c6Sopenharmony_ci */
15c5e268c6Sopenharmony_cipackage ohos.hdi.secure_element.sim_secure_element.v1_0;
16c5e268c6Sopenharmony_ci
17c5e268c6Sopenharmony_ciimport ohos.hdi.secure_element.sim_secure_element.v1_0.ISecureElementCallback;
18c5e268c6Sopenharmony_ciimport ohos.hdi.secure_element.sim_secure_element.v1_0.SecureElementTypes;
19c5e268c6Sopenharmony_ci
20c5e268c6Sopenharmony_ci/**
21c5e268c6Sopenharmony_ci * @brief Declares the APIs provided by the SecureElement module for obtaining SecureElement operations,
22c5e268c6Sopenharmony_ci * see "Open Mobile API Specification".
23c5e268c6Sopenharmony_ci *
24c5e268c6Sopenharmony_ci * @since 5.0
25c5e268c6Sopenharmony_ci * @version 1.0
26c5e268c6Sopenharmony_ci */
27c5e268c6Sopenharmony_ciinterface ISecureElementInterface {
28c5e268c6Sopenharmony_ci
29c5e268c6Sopenharmony_ci    /**
30c5e268c6Sopenharmony_ci     * Initializes the secure element.
31c5e268c6Sopenharmony_ci     *
32c5e268c6Sopenharmony_ci     * @param callback The callback used to notify the secure element status changed.
33c5e268c6Sopenharmony_ci     * @param status The status code to initialize the secure element.
34c5e268c6Sopenharmony_ci     * @since 5.0
35c5e268c6Sopenharmony_ci     * @version 1.0
36c5e268c6Sopenharmony_ci     */
37c5e268c6Sopenharmony_ci    init([in] ISecureElementCallback clientCallback, [out] enum SecureElementStatus status);
38c5e268c6Sopenharmony_ci
39c5e268c6Sopenharmony_ci    /**
40c5e268c6Sopenharmony_ci     * Get the ATR of this SE.
41c5e268c6Sopenharmony_ci     *
42c5e268c6Sopenharmony_ci     * @return response The ATR or empty array SHALL be returned if the ATR for this SE is not available.
43c5e268c6Sopenharmony_ci     * @since 5.0
44c5e268c6Sopenharmony_ci     * @version 1.0
45c5e268c6Sopenharmony_ci     */
46c5e268c6Sopenharmony_ci    getAtr([out] List<unsigned char> response);
47c5e268c6Sopenharmony_ci
48c5e268c6Sopenharmony_ci    /**
49c5e268c6Sopenharmony_ci     * Checks if a SE is present in this reader.
50c5e268c6Sopenharmony_ci     *
51c5e268c6Sopenharmony_ci     * @param present True if the SE is present, false otherwise.
52c5e268c6Sopenharmony_ci     * @since 5.0
53c5e268c6Sopenharmony_ci     * @version 1.0
54c5e268c6Sopenharmony_ci     */
55c5e268c6Sopenharmony_ci    isSecureElementPresent([out] boolean present);
56c5e268c6Sopenharmony_ci
57c5e268c6Sopenharmony_ci    /**
58c5e268c6Sopenharmony_ci     * Open a logical channel with the SE, selecting the applet represented by the given AID (when the AID is not
59c5e268c6Sopenharmony_ci     * Null and the length of the AID is not 0).
60c5e268c6Sopenharmony_ci     *
61c5e268c6Sopenharmony_ci     * @param aid The AID of the applet to be selected on this channel, as a byte array.
62c5e268c6Sopenharmony_ci     * @param p2 The P2 parameter of the SELECT APDU executed on this channel.
63c5e268c6Sopenharmony_ci     * @param response The response to SELECT command, or empty if failure.
64c5e268c6Sopenharmony_ci     * @param channelNumber The channel number of new logical channel.
65c5e268c6Sopenharmony_ci     * @param status The status code to open logical channel.
66c5e268c6Sopenharmony_ci     * @since 5.0
67c5e268c6Sopenharmony_ci     * @version 1.0
68c5e268c6Sopenharmony_ci     */
69c5e268c6Sopenharmony_ci    openLogicalChannel([in] List<unsigned char> aid, [in] unsigned char p2, [out] List<unsigned char> response,
70c5e268c6Sopenharmony_ci        [out] unsigned char channelNumber, [out] enum SecureElementStatus status);
71c5e268c6Sopenharmony_ci
72c5e268c6Sopenharmony_ci    /**
73c5e268c6Sopenharmony_ci     * Get access to the basic channel, as defined in [ISO 7816-4] (the one that has number 0). The obtained object
74c5e268c6Sopenharmony_ci     * is an instance of the channel class.
75c5e268c6Sopenharmony_ci     *
76c5e268c6Sopenharmony_ci     * @param aid The AID of the applet to be selected on this channel, as a byte array.
77c5e268c6Sopenharmony_ci     * @param p2 The P2 parameter of the SELECT APDU executed on this channel.
78c5e268c6Sopenharmony_ci     * @param response The response to SELECT command, or empty if failure.
79c5e268c6Sopenharmony_ci     * @param status The status code to open basic channel.
80c5e268c6Sopenharmony_ci     * @since 5.0
81c5e268c6Sopenharmony_ci     * @version 1.0
82c5e268c6Sopenharmony_ci     */
83c5e268c6Sopenharmony_ci    openBasicChannel([in] List<unsigned char> aid, [in] unsigned char p2, [out] List<unsigned char> response,
84c5e268c6Sopenharmony_ci        [out] enum SecureElementStatus status);
85c5e268c6Sopenharmony_ci
86c5e268c6Sopenharmony_ci    /**
87c5e268c6Sopenharmony_ci     * Closes this logical channel to the SE.
88c5e268c6Sopenharmony_ci     * Closing a basic channel must return SecureElementStatus::FAILED.
89c5e268c6Sopenharmony_ci     *
90c5e268c6Sopenharmony_ci     * @param channelNumber The logical channel number to be closed
91c5e268c6Sopenharmony_ci     * @param status The status code to close the logical channel.
92c5e268c6Sopenharmony_ci     * @since 5.0
93c5e268c6Sopenharmony_ci     * @version 1.0
94c5e268c6Sopenharmony_ci     */
95c5e268c6Sopenharmony_ci    closeChannel([in] unsigned char channelNumber, [out] enum SecureElementStatus status);
96c5e268c6Sopenharmony_ci
97c5e268c6Sopenharmony_ci    /**
98c5e268c6Sopenharmony_ci     * Transmit an APDU command (as per ISO/IEC 7816) to the SE.
99c5e268c6Sopenharmony_ci     *
100c5e268c6Sopenharmony_ci     * @param command The APDU command to be transmitted, as a byte array.
101c5e268c6Sopenharmony_ci     * @param response The response received, as a byte array.
102c5e268c6Sopenharmony_ci     * @param status The status code to transmit command.
103c5e268c6Sopenharmony_ci     * @since 5.0
104c5e268c6Sopenharmony_ci     * @version 1.0
105c5e268c6Sopenharmony_ci     */
106c5e268c6Sopenharmony_ci     transmit([in] List<unsigned char> command, [out] List<unsigned char> response, [out] enum SecureElementStatus status);
107c5e268c6Sopenharmony_ci
108c5e268c6Sopenharmony_ci    /**
109c5e268c6Sopenharmony_ci     * Transmit an APDU command (as per ISO/IEC 7816) to the SE.
110c5e268c6Sopenharmony_ci     *
111c5e268c6Sopenharmony_ci     * @param status The status code to reset the secure element.
112c5e268c6Sopenharmony_ci     * @since 5.0
113c5e268c6Sopenharmony_ci     * @version 1.0
114c5e268c6Sopenharmony_ci     */
115c5e268c6Sopenharmony_ci     reset([out] enum SecureElementStatus status);
116c5e268c6Sopenharmony_ci}
117