Method and system for realizing multi-application asynchronous communication by resource-constrained device
By introducing card proxy service programs and communication threads into the smart card system, the problem of not being able to access multiple logical channels concurrently under the limitation of smart card resources is solved, and the concurrent execution and efficiency improvement of multiple logical channels is achieved.
Patent Information
- Application Number
- CN202510071451.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-06-13
AI Technical Summary
Due to resource limitations, only one logical channel session can be active at the same time, and it is impossible to concurrently access the card applications selected by multiple logical channels on the smart card.
Concurrent execution of multiple logical channels is achieved by introducing card proxy service programs on the host and introducing communication threads on the smart card. The card proxy service program sends one or more card application commands initiated by the host card application to the smart card, and the communication thread forwards each card application command to the corresponding logical channel to execute, and notifies the card proxy service program to obtain a reply when the data is ready.
It realizes concurrent execution of multiple logical channels, improves the transmission efficiency of the host and smart card and the utilization rate of the smart card, and ensures timely reading of the reply data returned by the logical channel.
Smart Images

Figure CN120144331A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and system for implementing asynchronous communication of multiple applications in a resource-constrained device. Background Art
[0002] The ISO 7816-4 standard defines the logical channel management of smart cards and provides multi-channel support capabilities, allowing the host to interact with different card applications in the smart card through different logical channels on the smart card.
[0003] However, due to resource limitations of the smart card operating system and hardware, only one logical channel session can be active at the same time, which means that only the card application selected by one logical channel on the smart card can be accessed at the same time, and card applications selected by multiple logical channels on the smart card cannot be accessed concurrently. Summary of the invention
[0004] The purpose of the present application is to propose a method and system for implementing multi-application asynchronous communication in a resource-constrained device in response to the above-mentioned deficiencies in the prior art. This purpose is achieved through the following technical solutions.
[0005] In a first aspect, the present application provides a method for implementing multi-application asynchronous communication in a resource-constrained device, which is applied to a system for implementing multi-application asynchronous communication in a resource-constrained device. The system includes a host with a built-in or external card reader and a smart card. The host is provided with a host card application and a card proxy service program. The host card application accesses the smart card through the card proxy service program. The card proxy service program accesses the smart card through a driver of the card reader. The smart card is provided with a communication thread and multiple logical channels. The system allocates a thread for processing card application commands on the logical channel to each logical channel. When each logical channel selects an application, the thread is started to execute the application. The method includes:
[0006] The card proxy service program sends one or more card application commands initiated by the host card application program to the smart card;
[0007] The communication thread forwards the one or more card application commands to different target logical channels for execution;
[0008] When the card proxy service program receives the data ready notification sent by the smart card, it sends a get response command to the smart card; the data ready notification is a notification generated when the communication thread receives the response data returned by one or more target logical channels;
[0009] In response to the obtain response command, the communication thread sends a response including the response data of the one or more target logical channels and the identifier of the target logical channel to the host.
[0010] The second aspect of the present application proposes a multi-application asynchronous communication system implemented by a resource-constrained device. The system includes a host with a built-in or external card reader device and a smart card. The host is provided with a host card application program and a card proxy service program. The host card application program accesses the smart card through the card proxy service program. The card proxy service program accesses the smart card through the driver program of the card reader device. The smart card is provided with a communication thread and a plurality of logical channels. The system assigns a thread for processing card application commands on the respective logical channels to each logical channel. When each logical channel selects an application, the thread is started to execute the application.
[0011] The host is configured to use the card proxy service program to send one or more card application commands initiated by the host card application program to the smart card.
[0012] The smart card is configured to use the communication thread to forward the one or more card application commands to different target logical channels for execution respectively.
[0013] The host is further configured to, when receiving a data ready notification sent by the smart card, use the card proxy service program to send an obtain response command to the smart card; the data ready notification is a notification generated when the communication thread receives response data returned by one or more target logical channels.
[0014] The smart card is further configured to, in response to the obtain response command, use the communication thread to send a response including the response data of the one or more target logical channels and the identifier of the target logical channel to the host.
[0015] Based on the above-mentioned multi-application asynchronous communication method and system implemented by a resource-constrained device, the present application has at least the following beneficial effects or advantages:
[0016] On the host, by using the card proxy service program, one or more card application commands concurrent by the host card application program are sent together to the communication thread of the smart card. The communication thread forwards each card application command to the corresponding logical channel for execution respectively, so as to achieve concurrent execution of multiple logical channels, improve the transmission efficiency between the host and the smart card and the utilization rate of the smart card. When the communication thread receives response data returned by one or more logical channels, a data ready notification is generated and sent to the card proxy service program. Thus, the card proxy service program sends an obtain response command to the communication thread to timely read the response data returned by the logical channel.
[0017] The above description is only an overview of the technical solution of the present application. In order to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the following specific embodiments of the present application are specifically given. Description of the Drawings
[0018] The drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0019] Figure 1 is an APDU command structure in the prior art;
[0020] Figure 2 is an APDU response structure in the prior art;
[0021] Figure 3 is a schematic structural diagram of a resource-constrained device implementing a multi-application asynchronous communication system shown according to an exemplary embodiment;
[0022] Figure 4 is a flowchart of a method for a resource-constrained device to implement multi-application asynchronous communication shown according to an exemplary embodiment;
[0023] Figure 5 is an interaction flowchart of smart card asynchronous communication shown according to an exemplary embodiment. Detailed Description of the Embodiments
[0024] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of systems and methods consistent with some aspects of the present application as detailed in the appended claims.
[0025] The terms used in the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The singular forms of "a", "the" and "said" used in the present application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0026] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to a determination".
[0027] The resource-constrained devices involved in this application include, but are not limited to, smart cards such as SE (Secure Element), SIM (Subscriber Identity Module) cards, eSIM (Embedded Subscriber Identity Module), eSE (Embedded Secure Element), iSIM (Integrated Subscriber Identity Module), etc.
[0028] APDU (Application Protocol Data Unit) is a communication protocol used by smart cards. The host card application on the host can select an application through an APDU command on a specified logical channel. Once the application is selected, all APDU commands dispatched to this logical channel subsequently are processed by this application until the application is deselected.
[0029] However, due to the functional limitations of the logical channels defined by the ISO 7816-4 standard and the resource limitations of the operating system and hardware of smart cards, existing smart cards can only have one active session at the same time, that is, they can only access one logical channel on the smart card at the same time, and cannot concurrently access multiple logical channels on the smart card.
[0030] After analysis by the inventor, the messages of the application protocol defined by the ISO 7816-4 standard include two structures: one is the command sent by the card reader to the smart card, called the APDU command; the other is the response sent by the smart card to the card reader, called the APDU response. As Figure 1 shown in the APDU command structure, "CLA" is used to specify the logical channel number for executing this command, "INS" is used to specify the type of command to be executed, "P1" and "P2" are used to provide additional parameters for the command, "Lc" is used to indicate the length of the subsequent data field, "data" indicates the data to be sent, and "Le" indicates the expected length of the response data. As Figure 2The APDU response structure shown in the figure, “Data” indicates the response data, and “SW” indicates the response status.
[0031] Depend on Figure 2 It can be seen that there is a limitation in the communication between the external process and the application implemented in the smart card, that is, the external processes accessing the smart card must coordinate with each other and are not allowed to cross their commands and responses, because the APDU response from the smart card does not identify the logical channel associated with the original APDU command. This means that the external process cannot determine which command the returned APDU response is the answer to, so the external process cannot send any new commands before receiving the response to the previous command.
[0032] In view of the limitations of existing standards, by extending the communication protocol, adding a card proxy service program on the host, and adding a communication thread on the smart card, the concurrent execution of multiple logical channels on the smart card can be achieved, thereby improving the utilization rate of the smart card.
[0033] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The several specific embodiments listed can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0034] Figure 3 The present invention is a structural diagram of a resource-constrained device implementing a multi-application asynchronous communication system according to an exemplary embodiment. The system includes a host 100, a smart card 200 and a card reader 300. The host 100 can have a built-in or external card reader 300. The host 100 is provided with a host card application 101 and a card proxy service program 102. The host card application 101 can access the smart card 200 through the card proxy service program 102. The card proxy service program 102 accesses the smart card 200 through a driver of the card reader 300. The smart card 200 is provided with a communication thread 201 and multiple logical channels: logical channel 1, logical channel 2, ..., logical channel n. The system allocates a thread for processing card application commands on the corresponding logical channel to each logical channel. When each logical channel selects an application, a thread is started to execute the application.
[0035] When implementing smart card asynchronous communication, the interaction steps between the host 100 and the smart card 200 are as follows;
[0036] The host 100 uses the card proxy service program 102 to send one or more card application commands initiated by the host card application program 101 to the smart card 200;
[0037] The smart card 200 uses the communication thread 201 to forward one or more card application commands to different target logical channels for execution respectively;
[0038] When the host 100 receives the data ready notification sent by the smart card 200, it uses the card proxy service program 102 to send the get response command to the smart card 200; wherein, the data ready notification is a notification generated when the communication thread 201 receives the response data returned by one or more target logical channels;
[0039] In response to the get response command, the smart card 200 uses the communication thread 201 to send a response containing the response data of one or more target logical channels and the identifier of the target logical channel to the host 100.
[0040] In this embodiment, the host 100 can be regarded as a device such as a PC, a server or a mobile phone, and the host card application program 101 can be understood as an application program installed on the host 100, which can access the security-related services provided by the applications implemented on the smart card 200 through the card proxy service program 102. The card proxy service program 102 is a service program of the smart card 200, which is used to handle the command sending and response processing when the host card application program accesses the applications implemented on the smart card.
[0041] The smart card 200 can be understood as a card with an operating system, but the resources of the operating system on it are relatively limited, so it can be regarded as a resource-constrained device.
[0042] Exemplarily, the smart card 200 can be a SE, a SIM card, an eSIM card, an eSE, an iSIM card, etc.
[0043] The communication thread 201 on the smart card 200 is used to forward the commands of the card proxy service program 102 to the relevant logical channels for execution, and send the responses of the logical channels to the card proxy service program 102.
[0044] Each logical channel on the smart card 200 can represent an independent session. The host card application program 101 can interact with different applications implemented on the smart card 200 in different logical channels, and each logical channel starts a thread to execute the selected application.
[0045] The card reader device 300 is used to realize the communication interaction between the host card application program 101 on the host 100 and the smart card 200. A driver program of the card reader device 300 is provided on the host 100, and the card proxy service program 102 automatically processes the command sending and response processing when the host card application program 101 accesses the card application by calling the driver program.
[0046] That is to say, when implementing the asynchronous communication of the smart card, the card reader device 300 is used to forward one or more card application commands sent by the card proxy service program 102 to the smart card 200, notify the host 100 of the data ready notification, forward the get response command of the card proxy service program 102 to the smart card 200, and forward the response containing the response data of one or more target logical channels and the identifier of the target logical channel sent by the communication thread 201 to the host 100.
[0047] Applying the solution of the above embodiment, on the host, multiple card application commands concurrent by the host card application program are sent to the communication thread of the smart card together through the card proxy service program. The communication thread forwards each card application command to the corresponding logical channel for execution respectively, so as to realize the concurrent execution of multiple logical channels, improve the transmission efficiency between the host and the smart card and the utilization rate of the smart card. When the communication thread receives the response data returned by one or more logical channels, it generates a data ready notification and notifies the card proxy service program, so that the card proxy service program sends a get response command to the communication thread to read the response data returned by the logical channel in time.
[0048] In some embodiments of the present application, since the APDU described by the ISO 7816-4 standard is a command-response mode and does not support the active notification mechanism, in the prior art, the card reader usually needs to poll to obtain the responses of each logical channel. However, the polling method has problems such as too high frequency occupying the card processing resources and too low frequency delaying the response acquisition and reducing the concurrent efficiency.
[0049] Therefore, the present application uses the interrupt method to implement the active notification mechanism of the smart card, that is, when the communication thread 201 receives the response data returned by one or more target logical channels, it triggers an interrupt through a preset physical interface on the smart card 200 to realize notifying the card proxy service program 102 of the data ready notification. The preset physical interface on the smart card 200 is connected to the card reader device 300.
[0050] Therefore, the data ready notification is notified by the smart card 200 in an interrupt manner through the preset physical interface, and the driver of the card reader device 300 notifies the card proxy service program 102 through the application programming interface.
[0051] Exemplarily, the implementation form of the preset physical interface on the smart card 200 usually includes any one of SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit), USB (Universal Serial Bus), and SWP (Single Wire Protocol).
[0052] Based on different physical interface characteristics, the implementation methods for a smart card to trigger an interruption include:
[0053] For a smart card using the SPI interface: When there is response data available in the communication thread 201 on the smart card 200, the communication thread 201 triggers an interruption by setting the SPI-IRQ line on the smart card 200 to a high level. When the card reader detects the high level on the SPI interface, it sends a data ready notification to the card proxy service program 102 to notify the card proxy service program 102 to read the response data.
[0054] For a smart card using the I2C interface: When there is response data available in the communication thread 201 on the smart card 200, the communication thread 201 triggers an interruption by using the SDA (Serial Data, the data signal line of the I2C bus) line of the I2C on the smart card 200. When the card reader detects the interruption on the I2C interface, it sends a data ready notification to the card proxy service program 102 to notify the card proxy service program 102 to read the response data.
[0055] For a smart card using the USB interface: When there is response data available in the communication thread 201 on the smart card 200, the communication thread 201 uses the USB interrupt endpoint (Interrupt Endpoint) to send a data ready notification to the card reader. When the card reader receives the data ready notification, it sends the data ready notification to the card proxy service program 102 to notify the card proxy service program 102 to read the response data.
[0056] For a smart card using SWP: By defining a dedicated ready status flag bit, the communication thread 201 on the smart card 200 writes the ready status to the flag bit. The card reader determines to generate a data ready notification based on the flag bit and sends it to the card proxy service program 102 to notify the card proxy service program 102 to read the response data.
[0057] Corresponding to the foregoing embodiments of the resource-constrained device implementing a multi-application asynchronous communication system, the present application also provides embodiments of the resource-constrained device implementing multi-application asynchronous communication.
[0058] Figure 4 FIG. is a flowchart of a method for a resource-constrained device to implement multi-application asynchronous communication according to an exemplary embodiment. This method is applied to the Figure 3 resource-constrained device implementing a multi-application asynchronous communication system provided in the foregoing Figure 4 shown embodiment. As
[0059] Step 401: The card proxy service program sends one or more card application commands initiated by the host card application program to the smart card;
[0060] Step 402: The communication thread forwards one or more card application commands to different target logical channels for execution respectively;
[0061] Step 403: When the card proxy service program receives a data ready notification sent by the smart card, it sends an acquisition response command to the smart card. The data ready notification is generated when the communication thread receives response data returned by one or more target logical channels;
[0062] Step 404: In response to the acquisition response command, the communication thread sends a response containing the response data of one or more target logical channels and the identifier of the target logical channel to the host.
[0063] The card application command can be understood as a request from the host card application program to access the card application on the smart card, that is, the APDU command. The card application command is processed by a card application on the smart card.
[0064] The identifier of the logical channel to which the command is sent is carried in the card application command. Therefore, the communication thread on the smart card forwards the card application command to the target logical channel indicated by the identifier parsed from each card application command for execution.
[0065] Optionally, the card proxy service program can assemble one or more card application commands into one command and then send it to the smart card to improve the command transmission efficiency.
[0066] The assembly format of the multi-APDU command is as follows:
[0067] T L(APDU command 1)||L(APDU command 2)|……
[0068] Wherein, T represents the APDU command, such as 0xFF, as long as it can be clearly distinguished from the CLA in the single command format, L represents the length of the APDU command, and the symbol "|" represents connection and does not need to be actually sent.
[0069] Thus, when the communication thread on the smart card receives multiple APDU commands, it sequentially sends the APDU commands to the relevant logical channels for execution.
[0070] The data ready notification is used to indicate that the response data is ready.
[0071] The function of the Get Response command is to obtain the identification and response data of one or more logical channels. The format of the Get Response command is similar to the structure of the APDU command, as shown in Table 1. In the Get Response command, "CLA" is defined as "00", indicating that the response data of one or more logical channels is obtained; "INS" is defined as "C0", indicating the command type for reading data; "P1" and "P2" are defined as "01" and "00" respectively, without special meaning; "Le" is defined as "00", indicating that the length of the expected response data is unlimited.
[0072]
[0073]
[0074] Table 1
[0075] When the communication thread returns a response containing the response data of one or more target logical channels and the identification of the target logical channels to the host, it can also assemble the status of each target logical channel into the response and send it to the host. Therefore, the data format of the response to the Get Response command can be:
[0076] Logical channel number | L (response data | status word) | logical channel number | L (response data | status word) ……
[0077] Among them, the logical channel number is represented by one byte, L is the length of the response data and the status word, which can be represented by 1 or 2 bytes. The response data is optional, and the status word is represented by 2 bytes. The symbol "|" represents connection and does not need to be actually sent. For example: 1 2 90 00 0 4 11 22 90 00 means that logical channel 1 returns a 2-byte response 90 00, indicating that no response data is returned, and the status word is 0x9000; logical channel 0 returns a 4-byte response 11 22 90 00, the response data is 11 22, and the status word is 0x9000.
[0078] Based on the above embodiment solution, by using a card proxy service program on the host to send multiple card application commands concurrently issued by the host card application program to the communication thread of the smart card, the communication thread forwards each card application command to the corresponding logical channel for execution respectively, so as to achieve the concurrent execution of multiple logical channels, improve the transmission efficiency between the host and the smart card and the utilization rate of the smart card. When the communication thread receives the response data returned by one or more logical channels, it generates a data ready notification and notifies the card proxy service program. Therefore, the card proxy service program sends a Get Response command to the communication thread to timely read the response data returned by the logical channel.
[0079] In some embodiments of the present application, after the card proxy service program sends multiple card application commands initiated by the host card application to the smart card in step 401, the method further includes:
[0080] The card proxy service program records the identifier of the target logical channel carried in each card application command into the logical channel list, and sets a corresponding timeout for the identifier of the target logical channel in the logical channel list. Wherein, this logical channel list records the identifiers of the logical channels currently processing commands.
[0081] Further, when the card proxy service program receives a response containing the response data of the target logical channel and the identifier of the target logical channel, it deletes the identifier of the target logical channel and the corresponding timeout from the logical channel list, and when the card proxy service program still has not received a response containing the response data of the target logical channel and the identifier of the target logical channel when the timeout expires, it returns a timeout response notification to the host card application.
[0082] It should be noted that after the communication thread forwards multiple card application commands to different target logical channels for execution in step 402, it may further include:
[0083] The communication thread returns a response to the host for one or more card application commands, and this response includes at least the identifier of the target logical channel and the status word of the target logical channel.
[0084] Based on the fact that the above one or more card application commands are assembled into one command for sending, here, the communication thread can also assemble the status word and identifier of each target logical channel into one response and send it to the host.
[0085] The assembly format of the multi-APDU response is as follows:
[0086] T L (logical channel number | status word) | (logical channel number | status word) ……
[0087] Wherein, T represents the multi-APDU response, such as 0xFE, L represents the length of the multi-APDU response, the logical channel number represents the identifier of the logical channel, the status word represents the status of the logical channel, as shown in Table 2, there are 5 different statuses defined, and the symbol "|" represents connection and does not need to be actually sent.
[0088] Status Word Function Description 0x8D00 Indicates that the logical channel has started processing the APDU command 0x8D01 Indicates that the response data of one or more logical channels is ready 0x6A81 Indicates that the logical channel is unavailable 0x6A83 Indicates that the logical channel is busy 0x6A88 Indicates that the response is not ready
[0089] Table 2
[0090] Based on the descriptions of the above embodiments, Figure 5It is an interaction flowchart of asynchronous communication of a smart card shown according to an exemplary embodiment. The card proxy service program sends an APDU command using logical channel 1. When the communication thread receives the APDU command, it returns a response containing logical channel 1 and status word 0x8D00. The card proxy service program needs to continue waiting for a response from logical channel 1. Before a response is returned, the card proxy service program will not send the next APDU command using logical channel 1; the card proxy service program can send an APDU command to another logical channel 2 before a response is returned from logical channel 1. It should be noted here that if the APDU commands using logical channel 1 and logical channel 2 are concurrent, the card proxy service program can assemble these two APDU commands into one command and send it to the communication thread.
[0091] On the smart card side, multiple logical channels execute concurrently. The logical channel that finishes execution first returns a response to the communication thread. The communication thread uses a data ready notification to notify the card proxy service program to read the response. The card proxy service program obtains the most recently returned response and the corresponding logical channel number by sending a command to obtain the response.
[0092] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include common general knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present application are pointed out by the following claims.
[0093] It should also be noted that the term "comprising", "including", or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article, or apparatus including the element.
[0094] The above are only the preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A method for implementing multi-application asynchronous communication in a resource-constrained device, characterized in that: A multi-application asynchronous communication system is implemented in a resource-constrained device. The system includes a host with a built-in or external card reader and a smart card. The host is provided with a host card application and a card proxy service program. The host card application accesses the smart card through the card proxy service program. The card proxy service program accesses the smart card through a driver of the card reader. The smart card is provided with a communication thread and multiple logical channels. The system allocates a thread for processing card application commands on the logical channel to each logical channel. When each logical channel selects an application, the thread is started to execute the application. The method includes: The card proxy service program sends one or more card application commands initiated by the host card application program to the smart card; The communication thread forwards the multiple card application commands to different target logical channels for execution respectively; When the card proxy service program receives the data ready notification sent by the smart card, it sends a get response command to the smart card; the data ready notification is a notification generated when the communication thread receives the response data returned by one or more target logical channels; In response to the get response command, the communication thread sends a response including the response data of the one or more target logical channels and the identifier of the target logical channel to the host.
2. The method according to claim 1, characterized in that The card proxy service program sends one or more card application commands initiated by the host card application program to the smart card, including: The card agent service program assembles the received one or more card application commands into one command and sends the command to the smart card.
3. The method according to claim 1, characterized in that The data ready notification is that the smart card notifies through a preset physical interface connected to the card reader device in an interrupt manner, and the driver of the card reader device notifies the card proxy service program through an application programming interface; The data ready notification is used to indicate that the response data is ready.
4. The method according to claim 3, characterized in that The preset physical interface includes any one or more of a serial peripheral interface SPI, an integrated circuit bus I2C, a universal serial bus USB, and a single thread protocol SWP.
5. The method according to claim 1, characterized in that After the card proxy service program sends one or more card application commands initiated by the host card application program to the smart card, the method further includes: The card proxy service program records the identifier of the target logical channel carried by each card application command into the logical channel list, and sets a corresponding timeout period for the identifier of the target logical channel in the logical channel list.
6. The method according to claim 5, characterized in that The method further comprises: When the card proxy service program receives a response including the response data of the one or more target logical channels and the identifier of the target logical channels, the card proxy service program deletes the identifier of the one or more target logical channels and the corresponding timeout period from the logical channel list; When the timeout period expires, the card proxy service program still has not received a response including the response data of the target logical channel and the identifier of the target logical channel, and returns a timeout response notification to the host card application program.
7. The method according to claim 1, characterized in that After the communication thread forwards the one or more card application commands to different target logical channels for execution, the method further includes: The communication thread returns a response to the one or more executed card application commands to the host; the response also adds an identifier of the target logical channel.
8. A resource-constrained device implements a multi-application asynchronous communication system, characterized in that: The system comprises a host with a built-in or external card reader and a smart card, the host is provided with a host card application and a card proxy service program, the host card application accesses the smart card through the card proxy service program, the card proxy service program accesses the smart card through the driver of the card reader, the smart card is provided with a communication thread and a plurality of logical channels, the system allocates a thread for processing the card application command on the logical channel to each logical channel, and when each logical channel selects an application, the thread is started to execute the application; The host is used to send one or more card application commands initiated by the host card application program to the smart card using the card agent service program; The smart card is used to use the communication thread to forward the one or more card application commands to different target logical channels for execution; The host is further used to use the card proxy service program to send a get response command to the smart card when receiving a data ready notification sent by the smart card; the data ready notification is a notification generated when the communication thread receives response data returned by one or more target logical channels; The smart card is further configured to respond to the get response command by using the communication thread to send a response including the response data of the one or more target logical channels and the identifier of the target logical channel to the host.
9. The system according to claim 6, characterized in that The data ready notification is that the smart card notifies through a preset physical interface connected to the card reader device in an interrupt manner, and the driver of the card reader device notifies the card proxy service program through an application programming interface; The preset physical interface includes any one or more of a serial peripheral interface SPI, an integrated circuit bus I2C, a universal serial bus USB, and a single thread protocol SWP.
10. The system according to claim 6, characterized in that The smart card includes any one of the following: a security module SE, a subscriber identity module SIM card, an embedded subscriber identity module eSIM card, an embedded security unit eSE, and an integrated subscriber identity module iSIM card.