Communication transmission method and apparatus, electronic device, storage medium and program product
By identifying the smart card command header information and utilizing a merged transmission and reception strategy, the technical problems caused by interaction with upper-layer applications in smart card communication were solved, achieving a high-efficiency improvement in communication and processing performance.
Patent Information
- Application Number
- CN202410499491.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-24
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2044-04-24
AI Technical Summary
Due to protocol limitations, smart cards are tightly coupled with application commands during communication, making it impossible to complete the process independently. They need to interact with upper-layer applications, resulting in cumbersome communication steps and reduced efficiency and performance.
By identifying command header information, determining command type using a command type relationship table, and employing a merged send/receive strategy for communication transmission, including the merged processing of data reception and response transmission, the internal communication process is simplified.
It improves the communication efficiency and processing performance of smart cards, reduces the number of interactions between upper and lower layers, and enhances command processing efficiency and latency.
Smart Images

Figure CN118803100B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of communication, and in particular, to a communication transmission method and device, an electronic device, a storage medium, and a program product. BACKGROUND
[0002] At present, when the smart card communicates, because of the limitation of the smart card communication protocol, the internal layer of the smart card and the data frame transmission direction are tightly coupled with the application command. The internal layer of the smart card cannot complete the transmission of the complete data frame independently, and must interact with the upper layer application to establish communication. In other words, when the smart card communicates, only the specific application can execute to parse the specific command and obtain the command type for communication transmission. In this way, the communication transmission steps in the smart card are complicated, and the communication efficiency and processing performance of the smart card are reduced. SUMMARY
[0003] The present disclosure is proposed in view of the above problems. The present disclosure provides a communication transmission method and device, an electronic device, a storage medium, and a program product.
[0004] According to a first aspect of the present disclosure, a communication transmission method is provided, comprising: receiving a first command, the first command carrying at least command header information; identifying whether the first command is of a target type based on a command type relationship table and the command header information; and when the first command is of the target type, performing communication transmission of the first command using a merging transmission strategy corresponding to the target type.
[0005] In addition, according to the method of the first aspect of the present disclosure, the target type includes a first type and a second type; the first type corresponds to a first merging strategy; the first merging strategy indicates merging processing of a data receiving process of the command; the second type corresponds to a second merging strategy; the second merging strategy indicates merging processing of the data receiving process of the command and merging processing of a response sending process of the command.
[0006] In addition, according to the method of the first aspect of the present disclosure, performing communication transmission of the first command using the merging transmission strategy corresponding to the target type comprises: temporarily storing the first command and sending an acknowledgement message to a sending end; receiving a second command, the second command being command data corresponding to the first command; merging the first command and the second command to obtain a merged command; and forwarding the merged command.
[0007] In addition, according to the method of the first aspect of the present disclosure, performing communication transmission of the first command using the merging transmission strategy corresponding to the target type further comprises: receiving and temporarily storing a third command, the third command including response data and a status word of the merged command; sending the status word to the sending end; receiving a response command from the sending end and sending the third command to the sending end.
[0008] Further, according to the method of the first aspect of the present disclosure, the command type relationship table is used to store a set of instruction bytes corresponding to at least one target type; the command type relationship table is stored in the form of at least one 8-bit unsigned integer array; the command type relationship table includes a first relationship table and a second relationship table; the first relationship table is used to represent the type relationship of system type commands, and the second relationship table is used to represent the type relationship of custom type commands.
[0009] Further, according to the method of the first aspect of the present disclosure, based on the command type relationship table and the command header information, whether the first command is the target type is identified, including: using the instruction bytes in the command header information to search in the command type relationship table; when the instruction bytes exist in the command type relationship table, it is determined that the first command is the target type corresponding to the set of instruction bytes.
[0010] Further, according to the method of the first aspect of the present disclosure, the method further includes: when the first command is not the target type, recording the transceiving process data of the first command; and when it is determined based on the transceiving process data that the first command is the target type, updating the command type relationship table.
[0011] Further, according to the method of the first aspect of the present disclosure, the command type relationship table is used to store attribute information of each command, wherein the attribute information at least includes: instruction bytes and command type.
[0012] Further, according to the method of the first aspect of the present disclosure, based on the command type relationship table and the command header information, whether the first command is the target type is identified, including: using the instruction bytes in the command header information to search in the command type relationship table to obtain attribute information of the first command; and based on the command type in the attribute information, determining whether the first command is the target type.
[0013] Further, according to the method of the first aspect of the present disclosure, the command type relationship table is used to store attribute information of each command in the application and the application; before the method further includes: based on the correspondence between the class bytes and the application identifier, the class bytes in the command header information, determining the target application of the command header information; and in the command type relationship table, obtaining the attribute information of each command in the target application.
[0014] Further, according to the method of the first aspect of the present disclosure, the first instruction is an APDU instruction, and the target type includes at least one of a CASE3 type and a CASE4 type.
[0015] According to a method of a second aspect of the present disclosure, a communication transmission method is provided, the method is applied to a card application function entity, and the method comprises the following steps: receiving a merge command, the merge command being sent by performing communication transmission on a first command by using a merge transmission strategy corresponding to a target type; wherein whether the first command is the target type is determined based on a command type relationship table and command header information, wherein the command header information is carried in the first command; processing the merge command, and feeding back third signaling; the third signaling comprises response data and a status word of the merge command.
[0016] According to a third aspect of the present disclosure, a communication transmission apparatus is provided, the apparatus comprises: a receiving unit configured to receive a first command, the first command carrying at least command header information; an identifying unit configured to identify whether the first command is a target type based on a command type relationship table and the command header information; and a transmission unit configured to perform communication transmission on the first command by using a merge transmission strategy corresponding to the target type when the first command is the target type.
[0017] According to a fourth aspect of the present disclosure, a communication transmission apparatus is provided, the apparatus comprises:
[0018] a receiving unit configured to receive a merge command, the merge command being sent by performing communication transmission on a first command by using a merge transmission strategy corresponding to a target type; wherein whether the first command is the target type is determined based on a command type relationship table and command header information, wherein the command header information is carried in the first command; and a feedback unit configured to process the merge command and feed back third signaling; the third signaling comprising response data and a status word of the merge command.
[0019] According to a fifth aspect of the present disclosure, an electronic device is provided, comprising: a memory configured to store computer readable instructions; and a processor configured to execute the computer readable instructions, so that the electronic device performs the communication transmission method as described above.
[0020] According to a sixth aspect of the present disclosure, a non-transitory computer readable storage medium is provided, configured to store computer readable instructions, when the computer readable instructions are executed by a processor, the processor performs the communication transmission method as described above.
[0021] According to a seventh aspect of the present disclosure, a computer program product is provided, comprising a computer program, the computer program being executed by a processor to implement the communication transmission method as described above.
[0022] As will be described in detail below, according to the communication transmission method, apparatus, electronic device, storage medium and program product of embodiments of the present disclosure, the Card Operating System (COS) can receive any command, and when receiving a first command carrying at least command header information, the COS can identify whether the first command is of a target type according to a pre-stored command type relationship table and the command header information of the received first command. In this way, by comparing the command header information carried in the first command with the pre-stored command type table in the COS, it can be efficiently determined whether the first command is of the target type without waiting for the application layer to analyze and execute. Thus, if the first command is of the target type, the communication transmission can be directly performed according to the merging strategy of the target type. In this way, the technical solution provided by the present disclosure can directly determine the command type after receiving the first command, without waiting for the application layer to analyze and execute, thereby overcoming the problem that in the prior art, the specific application needs to be executed to obtain the command type for frequent communication transmission after the smart card receives the command. In this way, the steps of the communication transmission in the card are simplified, and the communication efficiency and processing performance are improved.
[0023] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the subject technology claimed. BRIEF DESCRIPTION OF DRAWINGS
[0024] The foregoing and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description, which proceeds with reference to the accompanying drawings. The drawings are provided to illustrate embodiments of the present disclosure and, together with the detailed description, serve to explain the present disclosure and do not constitute a limitation thereof. In the drawings, like reference numerals refer to like elements or steps throughout.
[0025] Figure 1 is a simple block diagram of the existing smart card structure.
[0026] Figure 2 is a flowchart of the communication transmission in the prior art.
[0027] Figure 3 is a flowchart of the communication transmission method according to embodiments of the present disclosure.
[0028] Figure 4 is a preferred process of communication transmission of the first command using the merging transceiving strategy corresponding to the target type according to embodiments of the present disclosure.
[0029] Figure 5 is another preferred process of communication transmission of the first command using the merging transceiving strategy corresponding to the target type according to embodiments of the present disclosure.
[0030] Figure 6 is a structural diagram of a shaping array according to an embodiment of the present disclosure.
[0031] Figure 7 is a code diagram of a preferred command type relationship table according to an embodiment of the present disclosure.
[0032] Figure 8 is a structural block diagram of a communication transmission device provided by an embodiment of the present disclosure.
[0033] Figure 9 is a structural block diagram of a communication transmission device provided by an embodiment of the present disclosure.
[0034] Figure 10 is a hardware block diagram of an electronic device according to an embodiment of the present disclosure.
[0035] Figure 11 is a schematic diagram of a computer readable storage medium according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0036] In order to make the objectives, technical solutions and advantages of the present disclosure more obvious, the following will describe the example embodiments according to the present disclosure in detail with reference to the drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited by the example embodiments described herein.
[0037] At present, a smart card mainly consists of a chip, an interface, and a card application layer, etc., which cooperate with each other to constitute the functions and performance of the smart card. The smart card can communicate data with external devices through the interface, and the existing smart card physical interface mainly adopts the 7816 smart card international standard transmission protocol.
[0038] It is also because of the limitation of the 7816 protocol that the internal layer of the smart card and the data frame transmission direction are closely coupled with the application command. The smart card cannot complete the complete data frame transmission independently, and must interact with the upper layer application to establish communication. That is, when the smart card performs communication transmission, only the specific application can obtain the command type and perform data communication.
[0039] This makes the bottom layer and the upper layer application transmission steps of the smart card too many in the communication transmission process, which greatly affects the communication efficiency and processing performance of the smart card. Therefore, the present application proposes a communication transmission method, which can directly determine the command type based on the command header, so that when a certain command is a target type, communication transmission can be performed according to the merging strategy of the target type, without waiting for the analysis and execution of the application layer. First, the present disclosure provides a simple block diagram of the existing smart card. Please refer to Figure 1 , Figure 1 is a simple block diagram of the existing smart card structure. AsFigure 1 As shown in
[0040] The smart card includes a hardware layer, a COS layer, an application layer, etc. The hardware layer includes a CPU, a 7816 physical interface, etc. The COS includes at least a 7816 driver, a logical channel management, a command distribution module, an application management module, a storage management module, etc. The application layer includes a plurality of applications, etc.
[0041] When the existing smart card performs communication transmission, the 7816 physical interface is enabled to complete command receiving by the 7816 driver of the COS. Then, the logical channel information of the command header in the command is parsed by the international standard environment GP environment (Global Platform Environment, OPEN) of the COS, and the logical channel information of the command is distributed to different applications in the relationship of being bound with a plurality of applications. Each application performs command parsing and data processing when receiving the command data, and returns the processing result to the OPEN, and the OPEN calls the driver to return the processing result to the command sending device. In this way, the communication transmission of the entire smart card is completed.
[0042] Of course, the command types of the existing 7816 communication protocol include CASE1, CASE2, CASE3 and CASE4, four cases, respectively representing a pure command without data, a command for reading data, a command for writing data, and a command for reading and writing data. Taking the CASE2 and CASE3 types above as examples, Figure 2 As shown in Figure 2
[0043] The CASE2 type is a command for reading data, and the response data is read from the smart card and returned to the correct command type for processing; the CASE3 type is a command for writing data, and the command data is written into the smart card and returned to the correct type for processing.
[0044] Figure 2 In the CASE2 type (reading or sending data), the interface device sends the header (command header information) to the 7816 driver of the smart card, executes command distribution through the logical channel and the command distribution OPEN of the smart card, the card application parses and judges the type, and returns the response data and the status word to the interface device. In the CASE3 type (writing or receiving data), the interface device sends the header (command header information) to the 7816 driver of the smart card, executes command distribution through the logical channel and the command distribution OPEN of the smart card, the card application parses and judges the type and returns the process byte to the interface device. Then the interface device sends the data (command data) to the 7816 driver of the smart card, executes command distribution through the logical channel and the command distribution OPEN of the smart card, the card application processes and returns the status word to the interface device, and the communication transmission is completed.
[0045] In summary, in the prior art, after receiving the command sent by the interface device, the smart card needs to be parsed and applied by the upper layer application of the smart card to obtain the type and command data of the command for communication transmission. In this way, the communication transmission steps of the smart card are complicated, and the communication efficiency and processing performance of the smart card are reduced.
[0046] Therefore, the communication transmission method provided in the present application can determine the command type directly based on the command header information of a certain command, so that when the certain command is of a target type, the communication transmission can be performed according to the merging strategy of the target type without waiting for the parsing and execution of the application layer, thereby overcoming the problem of complex communication in the card. Figure 3 FIG. 1 is a flowchart of a communication transmission method according to an embodiment of the present disclosure.
[0047] As shown in FIG. 1, the method comprises the following steps. Figure 3
[0048] In step S101, a first command is received, and the first command carries at least command header information.
[0049] In the embodiment of the present disclosure, the COS (7816 driver of the COS) of the smart card receives the first command sent by the external device. The first command can be an Application Protocol Data Unit (APDU) instruction. The first command at least includes command header information. It should be noted that receiving the first command can be receiving complete command information (such as CASE1 and CASE2 when the command is an APDU instruction), or receiving only the command header information (such as CASE3 and CASE4 when the command is an APDU instruction). The command header information includes but is not limited to at least one of the command category, the instruction code, and the additional parameter. In other words, the first command at least contains the command header information necessary for identifying and processing the command.
[0050] In step S102, based on a command type relationship table and the command header information, it is identified whether the first command is of a target type.
[0051] In the embodiments of the present disclosure, the COS (7816 driver of the COS) of the smart card uses a command type relationship table to assist in identifying the command header information of the command, and identifies whether the first command is of the target type. The command type relationship table records a table or a data structure of different command types and their relationships. The command type relationship table can include, but is not limited to, a command type identifier of each command (for example, at least one of using an 8-bit unsigned integer array to represent the command type identifier, using a string type to represent the command type identifier, etc.). The command type relationship table can be loaded into the memory at the time of initialization, so as to quickly search and match when processing the command. The command relationship table can also be loaded in real time as needed. In the embodiments of the present disclosure, the first command can be identified and determined to be of the target type by comparing the command header information with the information in the command type relationship table.
[0052] In step S103, when the first command is of the target type, the first command is communicated and transmitted by using the merging transceiving strategy corresponding to the target type.
[0053] In the embodiments of the present disclosure, when it is determined that the first command is of the target type, the COS (7816 driver of the COS) of the smart card can directly communicate and transmit the first command by using the merging transceiving strategy corresponding to the target type. The merging transceiving strategy is an optimization strategy for the command of the target type when communicating and transmitting, that is, a specific communication strategy for optimizing the specific operation steps of receiving and / or sending data in a merging manner. The specific correspondence method of the target type and the merging transceiving strategy is not limited herein. It should be noted that the target type can be one or more, and the merging transceiving strategy corresponding to one target type can also be one or more.
[0054] Therefore, the smart card can efficiently determine whether the received command header information is of the target type by comparing the received command header information with the pre-stored command type relationship table. If the command is of the target type, the communication and transmission can be directly performed according to the merging strategy of the target type, without waiting for the analysis and execution of the application layer. The problem that the specific application needs to be executed to obtain the command type for frequent communication and transmission after the existing smart card receives the command is overcome. In this way, the steps of the communication and transmission in the card are simplified, and the communication efficiency and processing performance are improved.
[0055] As described above, once it is determined that the first command is of the target type, the data communication can be directly performed according to the merging transceiving strategy corresponding to the target type. The specific target type and the merging transceiving strategy of the embodiments of the present disclosure are described below.
[0056] The specific target type and the merging transceiving strategy according to the embodiments of the present disclosure include:
[0057] The target type includes a first type and a second type.
[0058] The first type corresponds to a first merging strategy; the first merging strategy indicates to perform merging processing on a data receiving process of the instruction;
[0059] The second type corresponds to a second merging strategy; the second merging strategy indicates to perform merging processing on the data receiving process of the instruction, and to perform merging processing on a response sending process of the instruction.
[0060] In the embodiments of the present disclosure, the target type includes the first type and the second type.
[0061] The command of the first type can only perform the optimization processing of the instruction data receiving. For example, the CASE3 type of the command is the APDU instruction. The CASE3 type is a write data instruction, that is, the smart card only needs to receive data. For the CASE3 type, the data of the instruction can be received and merged for optimization processing.
[0062] The command of the second type can not only perform the merging optimization processing of the instruction data receiving, but also perform the merging optimization processing of the instruction response sending. For example, the CASE4 type of the command is the APDU instruction. The CASE4 type is a write data and read data instruction, that is, the smart card needs to receive data and send response data. For the CASE4 type, the data receiving of the instruction can be merged for optimization processing, and the response sending of the instruction can be merged for optimization processing.
[0063] For example, when the command is the APDU instruction, the target type includes at least one of the CASE3 type and the CASE4 type.
[0064] As described above, the target type and the specific receiving merging strategy and / or sending merging strategy corresponding thereto according to the embodiments of the present disclosure are described. Hereinafter, the receiving merging strategy and the sending merging strategy according to the embodiments of the present disclosure will be described in detail.
[0065] When it is determined to perform communication transmission by using the merging receiving and sending strategy corresponding to the target type, the method for performing merging optimization processing on the data receiving process of the instruction for the first type of the target type or the receiving side of the second type of the target type includes the following steps:
[0066] temporarily storing the first command and sending an acknowledgement message to the sending end;
[0067] receiving a second command, the second command being command data corresponding to the first command;
[0068] merging the first command and the second command to obtain a merged command;
[0069] forwarding the merged command.
[0070] In the embodiments of the present disclosure, when it is determined that the first command is of the target type, the first command is command header information, and then communication transmission can be performed using the merging and transmitting strategy corresponding to the target command. The communication transmission using the merging and transmitting strategy corresponding to the target command can include merging processing of a data receiving process of the command.
[0071] Specifically, first, the COS (7816 driver of the COS) of the smart card receives the first command, and temporarily stores the command instead of executing it immediately. The temporarily stored command is for waiting for the arrival of a command related to the first command, so that merging processing can be performed. At the same time, the COS (7816 driver of the COS) of the smart card sends an acknowledgement message to the sending end (such as a card reader, a terminal, etc.) to inform the sending end that the first command has been successfully received and temporarily stored, and is waiting for further processing. This ensures that the sending end knows that the command has been received, and can continue to send a related command. Then, after sending the acknowledgement message, the COS (7816 driver of the COS) of the smart card determines that the second command is received. The second command is corresponding data of the first command. Then, the COS (7816 driver of the COS) of the smart card can merge the temporarily stored first command and the just received second command according to the regulation of the merging strategy or the user-defined strategy. The merging operation can be to splice the data parts of the two commands together, or to combine them according to the protocol regulation, so as to obtain a merged command by merging. The merged command contains all the information and data required for execution. Finally, once the first command and the second command are merged into a merged command, the COS (7816 driver of the COS) of the smart card forwards it to the corresponding unit for further processing.
[0072] Exemplarily, Figure 4 The preferred process of communication transmission of the first command using the merging and transmitting strategy corresponding to the target type according to the embodiments of the present disclosure is shown in FIG. 1. Figure 4 As shown in FIG. 1,
[0073] Taking the CASE3 of the APDU command as an example, the communication transmission process of the conventional CASE3 type (writing or receiving data) is that the interface device sends the header (command header information) to the 7816 driver of the smart card, executes command distribution through the logical channel and distribution command OPEN of the smart card, the card application analyzes and judges the type and returns the process byte to the interface device. Then, the interface device sends the data (command data) to the 7816 driver of the smart card, executes command distribution through the logical channel and distribution command OPEN of the smart card, the card application processes and returns the state word to the interface device, and the communication transmission is completed. In short, the conventional CASE3 type receives data in two times of round trips. The data receiving execution application can be specifically executed.
[0074] According to the communication transmission method (optimized) of the embodiment of the present disclosure, the communication flow of the CASE3 type (writing or receiving data) is to temporarily store the header (command header information) of the smart card 7816 drive, and send ACK (i.e. INS) to the interface device, wait to receive command data, merge the received command data with the buffered command header to form a complete data frame, and then send the complete APDU command (header + data) to the COS (or a functional module responsible for logical channels and command distribution in the COS, generally GPOPEN); the COS distributes the command to the corresponding application according to the logical channel information in the command header; the application processes the APDU command and returns the status word SW. In short, when receiving data, the command header information is temporarily stored and the complete command is generated by merging the command data for communication transmission, which only needs one round trip.
[0075] Compared with the conventional CASE3 command transmission and reception processing flow and the CASE3 command transmission and reception processing flow of the communication transmission method (optimized) according to the embodiment of the present disclosure, it can be seen that in the flow of the communication transmission method (optimized) according to the embodiment of the present disclosure, the interaction flow between the smart card 7816 drive and the COS of the smart card, and between the COS and the application, is changed from "two round trips" to "one round trip", that is, the process in the orange part of the figure is omitted, and directly changes to the green part of the figure.
[0076] In a multi-application (or multi-process) operating system, task scheduling and context switching occur every time the upper and lower layers interact with each other. Saving the communication flow reduces system overhead. From the complete APDU command transmission and reception processing flow, reducing the interaction communication flow can improve the command processing efficiency and reduce the command processing delay.
[0077] As follows, when it is determined to perform communication transmission by using the merging transmission strategy corresponding to the target type, a method for performing merging optimization processing on the sending process of the instruction data by the sending side of the second type of the target type comprises:
[0078] Receiving and temporarily storing a third command, the third command comprising: response data of the merged command and a status word;
[0079] Sending the status word to the sending end;
[0080] Receiving a response instruction from the sending end, and sending the third command to the sending end.
[0081] In the embodiment of the present disclosure, the communication transmission of the first command by using the merging transmission strategy corresponding to the target type can further comprise merging processing on the sending process of the response of the instruction.
[0082] Specifically, the COS (7816 driver of the COS) of the smart card receives a third command, which is response data about the merging command and a status word. The response data is a feedback of the execution result of the merging command, including but not limited to at least one of the result of the operation, the returned data, or other related information. The status word is used to indicate the status of the response, such as success, failure, or the need for further operation. The COS (7816 driver of the COS) of the smart card temporarily stores the third command for processing in subsequent steps. Then, after receiving the third command and parsing the status word, the COS (7816 driver of the COS) of the smart card immediately sends the status word to the sending end. The purpose of sending the status word is to inform the sending end of the execution status of the merging command, so that the sending end can timely understand the progress and result of the operation. By sending the status word, the sending end can make corresponding processing according to the content of the status word, such as continuing to send subsequent commands or performing other operations. Finally, after sending the status word, the COS of the smart card continues to listen to the response instruction from the sending end. The response instruction can be a further operation requirement of the sending end according to the previously sent status word. Once the response instruction is received, the COS of the smart card sends the third command previously stored to the sending end, so as to complete the entire communication process.
[0083] Another exemplary, Figure 5 Another utilization of the merging transceiving strategy corresponding to the target type for the communication transmission of the first command is shown in FIG. 6. As shown in FIG. 6, Figure 5
[0084] Taking the CASE4 of the APDU instruction as an example, in addition to the merging processing of the receiving process of the command header and the command data, the sending process of the response data (RESPONSE) after the command processing is further merged. The communication transmission process of the conventional CASE4 type (write data and read data or receive and send data) includes write data and read data. Among them, the write data means that the interface device sends the header command information to the 7816 driver of the smart card, executes the command distribution through the logical channel and the distribution command OPEN of the smart card, the card application parses and judges the type and returns the process byte to the interface device. Then the interface device sends the data command to the 7816 driver of the smart card, executes the command distribution through the logical channel and the distribution command OPEN of the smart card, and the card application processes and returns the status word to the interface device. The read data means that the interface device sends the response data instruction information to the 7816 driver of the smart card, executes the command distribution through the logical channel and the distribution command OPEN of the smart card, the card application determines the response data and the status word, and finally the smart card returns the response data and the status word to the interface device.
[0085] The communication flow of the CASE4 type (writing and reading data or receiving and sending data) of the communication transmission method (optimized) according to the embodiment of the present disclosure is as follows: the optimization process of the preceding steps 1 to 3 is the same as that of the CASE3, that is, the command receiving flow is combined, and the difference is that, after the card application processing is completed, the response data (RESPONSE) and the status word (SW, generally 9000) that are supposed to be sent next time are sent to the underlying 7816 drive in advance in addition to the 6XXX format status word; after receiving the above data, the 7816 drive temporarily stores the response data (RESPONSE) and the status word (SW), and only sends the 6XXX format status word to the interface device (optimization step 4); after receiving the 6XXX format status word, the interface device sends a get response data (GET RESPONSE) command to the smart card (optimization step 5); after receiving the get response data (GET RESPONSE) command, the underlying 7816 drive of the smart card sends the previously cached response data (RESPONSE) and the status word (SW) to the interface device (optimization step 6).
[0086] Compared with the conventional CASE4 command receiving and sending processing flow, in the optimized CASE4 command receiving and sending processing flow, the interaction flow between the 7816 drive and the COS and between the COS and the application changes from “three round trips” to “one round trip”, that is, the flow in the orange part in the figure is omitted. In addition to the command receiving flow, the 7816 drive also processes the get response data (GET RESPONSE) special command instead of the application, that is, the sending flow of the command response is combined and optimized, the internal interaction flow of the smart card is reduced, the CASE4 command processing efficiency is improved, and the command processing delay is reduced.
[0087] As described above, the data communication of the first command can be performed by using the combined receiving and sending strategy corresponding to the target type. Before that, it is necessary to identify and determine whether the first command is the target type. The target type can be identified by means of the command type relationship table. Hereinafter, the specific command type relationship table according to the embodiment of the present disclosure is described.
[0088] The specific command type relationship according to the embodiment of the present disclosure includes:
[0089] The command type relationship table is used to store the instruction byte set corresponding to at least one target type.
[0090] In the embodiments of the present disclosure, a command type relationship table is used to store different target types and their corresponding instruction byte sets. The instruction byte set is a set of instruction bytes corresponding to each target type, which is used to construct or identify the command of the target type. The instruction byte set at least includes the instruction code (INS) of the target type. In the present disclosure, the target types include a first type and a second type. One command type relationship table can include the instruction byte set corresponding to one target type, or two target types, without limitation.
[0091] The specific command type relationship according to the embodiments of the present disclosure further includes:
[0092] The command type relationship table is stored in the form of at least one 8-bit unsigned integer array.
[0093] In the embodiments of the present disclosure, the storage form of the command type relationship table includes at least one of the following: a table form, a key-value pair form, an array form, etc. The storage form of the command type relationship table includes at least one of the following: a hard-coded array, a binary file, and a read-only memory (ROM).
[0094] The table form is suitable for cases where structured data needs to be displayed. The advantages are clear data organization, easy to read and understand, and support for sorting, filtering, and calculation operations on data. For example, the registered command information is stored in an electronic spreadsheet (Excel) or a structured query language (SQL) database, each row represents a command, and each column represents a certain attribute of the command (such as command name, parameter, description, etc.). The key-value pair form is suitable for cases where the corresponding value needs to be quickly found according to the key. The advantages are fast search speed, small space occupation, easy extension and modification. For example, the registered command information is stored in a data format exchange (JSON) file, the name of each command is used as the key, and the detailed information of the command (such as parameters, execution logic, etc.) is used as the value. The array form is suitable for cases where a large amount of similar or related data needs to be stored. The advantages are that data can be flexibly added, deleted or modified, and support for traversal, search and statistics operations on the collection. For example, command objects are stored in a programming language (Java), and each object contains the attributes and methods of the command.
[0095] Among them, the hard-coded array directly encodes the command type relationship table as an array in the source code. This way is simple and direct, but lacks flexibility, and each modification requires recompiling the code. The binary file encodes the command type relationship table data into binary format and saves it as a separate file. When the system starts or initializes, the file is loaded into memory. This way can slightly improve flexibility, but may involve file reading and parsing overhead. The read-only memory (ROM) records the command type relationship table to the read-only memory, such as a part of the firmware.
[0096] For example, the command type relationship table can be stored in the form of at least one 8-bit unsigned integer array. As shown in Figure 6 , the structure of the integer array can be Figure 6 . This means that the command type relationship table is hard-coded into the firmware or read-only memory (ROM) of the system, as a data structure that already exists and cannot be changed when the system starts. This storage method ensures that the command type relationship table remains unchanged during system operation, thereby ensuring the stability and reliability of command parsing and execution. According to the specific command type relationship of the embodiment of the present disclosure, it also includes:
[0097] The command type relationship table includes: a first relationship table and a second relationship table; wherein the first relationship table is used to represent the type relationship of the system type command, and the second relationship table is used to represent the type relationship of the custom type command.
[0098] In the embodiment of the present disclosure, the command type relationship table includes a first relationship table and a second relationship table. The first relationship table is mainly used to represent the type relationship of the system type command. The first relationship table can contain the type relationship of the system predefined or standard command. The second relationship table is mainly used to represent the type relationship of the custom type command. The second relationship table can contain the command type relationship customized by the user or the developer according to the demand.
[0099] It should be noted that the first relationship table and the second relationship table can be stored separately, or the first relationship table and the second relationship table can be stored together, and the storage method of the first relationship table and the second relationship table is not limited here. By dividing the command type relationship table into two parts, the system can more effectively manage different types of commands. The system type command ensures the basic functions and stability of the system, while the custom type command allows users to customize and extend according to specific needs. This design not only guarantees the universality and stability of the system, but also meets the individual needs of users.
[0100] For example, Figure 7 is the code diagram of the preferred command type relationship table according to the embodiment of the present disclosure. As shown in Figure 7 :
[0101] For example, the command type relationship table can include the instruction code specific byte sequence of CASE3 and CASE4 in the APDU instruction.
[0102] The above describes a specific command type relationship table. Based on the command type relationship table and the command header information of the first command, it can be determined whether the first type is the target type. The following describes a method for determining whether the first command is the target type based on the command type relationship table and the command header information according to an embodiment of the present disclosure.
[0103] The method for determining whether the first command is the target type based on the command type relationship table and the command header information according to an embodiment of the present disclosure includes the following steps:
[0104] The instruction byte in the command header information is used to search in the command type relationship table.
[0105] When the instruction byte exists in the command type relationship table, it is determined that the first command is the target type corresponding to the set in which the instruction byte is located.
[0106] In an embodiment of the present disclosure, first, the smart card COS (7816 driver of COS) can extract the instruction byte from the received command header information. These instruction bytes are used to identify the type of the command. Next, the smart card COS (7816 driver of COS) will access the predefined command type relationship table. This table is usually stored in the memory and includes at least one storage mode such as but not limited to a static array, a database, or other data structures. In the command type relationship table, the smart card COS (7816 driver of COS) will traverse or search for an entry matching the extracted instruction byte. Finally, if an entry matching the extracted instruction byte is found in the command type relationship table, the smart card COS (7816 driver of COS) will determine the target type associated with the instruction byte. Once the target type is determined, the smart card COS (7816 driver of COS) can perform the corresponding operation or call the corresponding processing according to this type.
[0107] It should be noted that if the corresponding instruction byte is not found in the command type table, it can be directly determined that it is not the target type, and communication can be performed in the original manner or a custom manner. After communication transmission using the method disclosed in the present application, the command type relationship table is queried again. Specifically, if the corresponding instruction byte does not exist in the command type table, the processing method of the smart card is not limited here.
[0108] The above specifically illustrates that the smart card can use the instruction byte in the command relationship table to determine whether the first command is of the target type. When the first command is not of the target type, the command type relationship table can also be updated, as follows. The updating method of the command type relationship table according to the embodiment of the present disclosure includes:
[0109] When the first command is not of the target type, record the transceiving process data of the first command;
[0110] When it is determined based on the transceiving process data that the first command is of the target type, update the command type relationship table.
[0111] In the embodiment of the present disclosure, if the first command is not of the target type, the smart card COS (7816 driver of COS) records the transceiving process data related to the command. These data can include but are not limited to the sending time and receiving time of the command, the identification of the sender and the receiver, the specific content of the command, and any information related to the transmission and processing of the command, etc. The transceiving execution of the command can be data transmission in the original manner, which is not limited here. Then, the smart card COS (7816 driver of COS) determines whether the first command is actually of the target type based on the recorded transceiving process data. This can be because the type of the command is difficult to determine at the initial analysis, and more context information or subsequent processing is needed to accurately determine it. Once it is determined that the first command is of the target type, the system updates the command type relationship table. After the updating of the command type relationship table is completed, if the same command is received again next time, the identification processing of the command of this type can be immediately performed. In this way, the record of the command of unknown type is applied to the subsequent type determination, so that the smart card operating system has a "learning" ability, which can further improve the command processing efficiency of the smart card operating system, reduce resource consumption, and optimize the user experience.
[0112] For example, the complete type identification and type updating process according to the embodiment of the present disclosure is as follows:
[0113] When the 7816 driver of the smart card receives the Header (command header information) of the APDU instruction, it reads the INS (second byte) and searches for it in the CASE3 and CASE4 arrays of the "first type command type list". If it is found, it means that the command is a CASE3 or CASE4 type system command. If it is not found, it reads the CLA (first byte) to obtain the logical channel of the command, and obtains the application (AID) bound on the current logical channel through the logical channel management information, and then finds the "second type command type list" of the application through the AID, and then searches for the INS again. If it is found, it means that the command is a second type CASE3 or CASE4 type. If it is still not found, it means that the command may be an unknown CASE3 or CASE4 type. The analysis, identification, and recording of unknown type commands are applied to subsequent type judgment, so that the smart card operating system has a "learning" ability.
[0114] In summary, the instruction bytes in the command header information can be used to search and determine the target type in the command type relationship table or update the command type relationship table to determine the target type again. Hereinafter, another method of identifying the target type by using the command type relationship table and the command header information is specifically introduced.
[0115] As follows, the disclosure further provides another method of identifying the target type, in which the command type relationship table can be used to store the attribute information of each command, wherein the attribute information at least includes: instruction bytes and command type.
[0116] In the embodiments of the disclosure, the command type relationship table can also be used to store and manage the attribute information of each command. The command type relationship table can be a data structure or list that records the types and related attributes of various commands in the system. Through this command type relationship table, received commands can be quickly identified and processed to ensure that they are executed in the expected manner.
[0117] It should be noted that in the command type relationship table, at least the following two attribute information of each command will be stored: instruction bytes and command type.
[0118] Specifically, the instruction bytes are a key component of the command, used to identify the specific type or function of the command. It can be a sequence of one or more bytes. The command type is a classification or identification of the command, used to describe at least one of the purpose, source, or execution method of the command. It can be at least one of a string or a number, depending on the design and implementation of the smart card system.
[0119] Of course, in addition to the instruction byte and the command type, the command type relationship table can also store other command-related attribute information, such as: command length indication: indicating the total number of bytes or the number of fields of the command. Parameter list indication: listing the required or acceptable parameters of the command and their types. Execution authority indication: indicating which users or roles can execute the command. Return value type indication: describing the data type or format returned after the command is executed. Related description: a brief description or document link of the command.
[0120] According to the above command type relationship table, based on the command type relationship table and the command header information, the method for identifying whether the first command is of the target type comprises:
[0121] Using the instruction byte in the command header information, the attribute information of the first command is obtained by searching in the command type relationship table;
[0122] Based on the command type in the attribute information, it is determined whether the first command is of the target type.
[0123] In the embodiments of the present disclosure, when the smart card COS (7816 driver of COS) receives the first command, it will first parse the command header information. The command header information includes but is not limited to at least one of the following key information: instruction byte. Then, after the smart card COS (7816 driver of COS) parses the instruction byte, it will search in the command type relationship table. This table can contain multiple entries, each entry corresponding to a specific instruction byte of an application command and related attribute information. The smart card COS (7816 driver of COS) can use the instruction byte as a search key to find a matching entry in the table. Then, if a matching entry is found, the smart card COS (7816 driver of COS) will read the attribute information of the entry, i.e. the attribute information of the first command. These attribute information can include command type, parameter list, execution authority, etc. Furthermore, after the smart card COS (7816 driver of COS) obtains the command type, it can compare it with the target type. The target type has been described above and will not be repeated here. Finally, if the command type of the first command matches the target type, the smart card COS (7816 driver of COS) will consider the first command to be of the target type, and accordingly execute the corresponding operation or processing flow.
[0124] In this method of identifying the target type, the command type relationship table can be used to store the attribute information of the commands of the applications and the applications.
[0125] In the embodiments of the present disclosure, in this method of identifying the target type, the command information in the command type relationship table and the application are strongly related. The command type relationship table records the attribute information of each application and the commands under each application. The method before identifying the target type in the command type relationship table is described below.
[0126] In this method of identifying the target type, the attribute information of the target application can be found in the command type relationship table according to the correspondence between the class byte and the application identifier, and the above-mentioned target type identification method is described in detail as follows:
[0127] Based on the correspondence between the class byte and the application identifier, and the class byte in the command header information, the target application of the command header information is determined.
[0128] In the command type relationship table, the attribute information of each command in the target application is obtained.
[0129] In the embodiments of the present disclosure, the smart card COS (7816 driver of COS) can establish a correspondence table between the class byte and the application identifier. The class byte is a field in the command header information, which is used to identify the application or application category to which the command belongs. The application identifier is an identifier that uniquely identifies a specific application. The class byte and the application identifier correspond to each other or multiple correspondences, and the correspondence method between the class byte and the application identifier is not limited here.
[0130] In the embodiments of the present disclosure, first, when the smart card COS (7816 driver of COS) receives a command, it parses the command header information to obtain the class byte. Then, the smart card COS (7816 driver of COS) can find the corresponding application identifier in the correspondence table between the class byte and the application identifier according to the class byte in the command header information. Then, once the target application is determined, the smart card COS (7816 driver of COS) queries the entries of the application in the command type relationship table to obtain the attribute information of each command in the target application. These entries contain at least one of the attribute information of each command in the target application, such as command type, parameter list, return value type, etc. The smart card COS (7816 driver of COS) can traverse these entries to obtain the required attribute information.
[0131] In summary, based on the correspondence between the class byte and the application identifier, and the class byte in the command header information, the target application of the command is determined, and the attribute information of each command in the target application is obtained in the command type relationship table. The smart card COS (7816 driver of COS) can accurately and efficiently process the commands in different applications, which is crucial for ensuring the stability and performance of the system.
[0132] As described above, it is explained that the smart card COS (7816 driver of COS) can efficiently determine whether it is the target type according to the received command header information and the command type relationship table. If it is the target type, it can directly communicate and transmit according to the merging strategy of the target type. In the following, the present disclosure also describes a communication transmission method that can be applied to the card application function entity.
[0133] The method is applied to a card application function entity, and the communication transmission method according to the embodiment of the present disclosure includes the following.
[0134] A merge command is received, and the merge command is sent by using a merge transceiving strategy corresponding to a target type to perform communication transmission on a first command; whether the first command is the target type is determined based on a command type relationship table and command header information, and the first command carries the command header information;
[0135] The merge command is processed, and a third signaling is fed back; the third signaling includes response data of the merge command and a status word.
[0136] In the embodiment of the present disclosure, a card application function entity of a smart card first receives a merge command. The purpose of the merge command is to merge multiple commands or data for transmission, so as to improve communication efficiency or meet specific application requirements. Meanwhile, the merge command is determined based on whether a first command is a target command, and whether the first command is the target type is determined based on a command type relationship table and command header information. The first command carries the command header information and other necessary data. Then, after processing the merge command, the card application function entity of the smart card generates and sends a third signaling as feedback. The third signaling includes response data of the merge command and a status word. The response data represents the processing result of the merge command, and can include at least one of an execution result, an error code or other related information, etc. The status word is used to indicate the processing status of the merge command, such as success, failure or the need for further processing, etc.
[0137] The present disclosure also provides a communication transmission device. Figure 8 A structural block diagram of a communication transmission device provided by the embodiment of the present disclosure is shown in FIG. 8, which includes a receiving unit 801, an identifying unit 802 and a transmission unit 803. Figure 8
[0138] The receiving unit 801 is configured to receive a first command, and the first command carries at least command header information.
[0139] The identifying unit 802 is configured to identify whether the first command is a target type based on a command type relationship table and command header information.
[0140] The transmission unit 803 is configured to perform communication transmission on the first command by using a merge transceiving strategy corresponding to the target type when the first command is the target type.
[0141] In an example embodiment, the target type includes: a first type and a second type; the first type corresponds to a first merging policy; the first merging policy indicates to merge the data receiving process of the instruction; the second type corresponds to a second merging policy; the second merging policy indicates to merge the data receiving process of the instruction and to merge the response sending process of the instruction.
[0142] In an example embodiment, the communication transmission of the first instruction by using the merging transceiving policy corresponding to the target type includes: temporarily storing the first instruction and sending an acknowledgement message to the sending end; receiving a second instruction, the second instruction being the command data corresponding to the first instruction; merging the first instruction and the second instruction to obtain a merged instruction; and forwarding the merged instruction.
[0143] In an example embodiment, the communication transmission of the first instruction by using the merging transceiving policy corresponding to the target type further includes: receiving and temporarily storing a third instruction, the third instruction including: response data and a status word of the merged instruction; sending the status word to the sending end; receiving a response instruction from the sending end and sending the third instruction to the sending end.
[0144] In an example embodiment, the command type relationship table is used to store a command byte set corresponding to at least one target type; the command type relationship table is stored in the form of at least one 8-bit unsigned integer array; the command type relationship table includes: a first relationship table and a second relationship table; wherein the first relationship table is used to represent the type relationship of system type commands, and the second relationship table is used to represent the type relationship of self-defined type commands.
[0145] In an example embodiment, based on the command type relationship table and the command header information, the first instruction is identified as the target type, including: using the command byte in the command header information to search in the command type relationship table; when the command byte exists in the command type relationship table, the first instruction is determined as the target type corresponding to the set where the command byte is located.
[0146] In an example embodiment, the method further includes: when the first instruction is not the target type, recording the transceiving process data of the first instruction; and when the first instruction is determined as the target type based on the transceiving process data, updating the command type relationship table.
[0147] In an example embodiment, the command type relationship table is used to store attribute information of each command, wherein the attribute information at least includes: a command byte and a command type.
[0148] In an example embodiment, based on the command type relationship table and the command header information, identifying whether the first command is of the target type includes: using the instruction byte in the command header information to search in the command type relationship table to obtain attribute information of the first command; and determining whether the first command is of the target type based on a command type in the attribute information.
[0149] In an example embodiment, the command type relationship table is configured to store attribute information of commands in each application; and before the step of identifying whether the first command is of the target type based on the command type relationship table and the command header information, the method further includes: determining a target application of the command header information based on a correspondence between the class byte and the application identifier and the class byte in the command header information; and obtaining attribute information of commands in the target application in the command type relationship table.
[0150] In an example embodiment, the first instruction is an APDU instruction, and the target type includes at least one of a CASE3 type and a CASE4 type.
[0151] The present disclosure also provides a communication transmission device. Figure 9 As shown in FIG. 9, the communication transmission device 900 includes a receiving unit 901 and a feedback unit 902. Figure 9 The receiving unit 901 is configured to receive a merged command, the merged command being sent by performing communication transmission on the first command using a merged transceiving strategy corresponding to the target type; wherein whether the first command is of the target type is determined based on a command type relationship table and command header information, wherein the first command carries the command header information.
[0152] The feedback unit 902 is configured to process the merged command and feed back third signaling; the third signaling includes response data and a status word of the merged command.
[0153] The feedback unit 902 is configured to process the merged command and feed back third signaling; the third signaling includes response data and a status word of the merged command.
[0154] Figure 10 FIG. 10 is a hardware block diagram of an electronic device 1000 according to an embodiment of the present disclosure. The electronic device according to the embodiment of the present disclosure includes at least a processor and a memory for storing computer readable instructions. When the computer readable instructions are loaded and run by the processor, the processor performs the network access method as described above.
[0155] Figure 10The illustrated electronic device 1000 specifically includes a central processing unit (CPU) 1001, a graphics processing unit (GPU) 1002, and a memory 1003. These units are interconnected via a bus 1004. The CPU 1001 and / or GPU 1002 can function as the aforementioned processor, and the memory 1003 can function as the aforementioned memory storing computer-readable instructions. Furthermore, the electronic device 1000 may also include a communication unit 1005, a storage unit 1006, an output unit 1007, an input unit 1008, and an external device 1009, all of which are also connected to the bus 1004.
[0156] Figure 11 This is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. Figure 11 As shown, a computer-readable storage medium 1100 according to an embodiment of the present disclosure stores computer-readable instructions 1101 thereon. When the computer-readable instructions 1101 are executed by a processor, the network access method according to an embodiment of the present disclosure described with reference to the above figures is performed. The computer-readable storage medium includes, but is not limited to, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, optical disk, magnetic disk, etc.
[0157] This disclosure further provides a computer program product, including a computer program that, when executed by a processor, implements the communication transmission method of any of the embodiments described above.
[0158] The communication transmission method, apparatus, electronic device, storage medium, and program product according to embodiments of the present disclosure have been described above with reference to the accompanying drawings. The Card Operating System (COS) in a smart card receives a first command carrying at least command header information. Based on a pre-stored command type relationship table and the command header information of the received first command, it identifies whether the first command is a target type. When the first command is a target type, a target type merging strategy can be used for communication transmission. In this way, the COS in the smart card can efficiently determine whether it is a target type by comparing the received command header information with the pre-stored command type relationship table. If it is a target type, communication transmission can be directly performed according to the target type merging strategy without waiting for application layer parsing and execution. This overcomes the problem of existing smart cards requiring the specific application to execute the command after receiving it to obtain the command type for frequent communication transmission. This simplifies the steps of intracard communication transmission and improves communication efficiency and processing performance.
[0159] Those skilled in the art can realize combined units or algorithm steps of each example described in connection with the embodiments disclosed herein can be realized by electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solutions. Those skilled in the art can use different methods to implement the described functions for each specific application, but the implementation should not be considered to be beyond the scope of the present disclosure.
[0160] The above describes the basic principles of the present disclosure in combination with specific embodiments, but it should be noted that the advantages, benefits, effects and the like mentioned in the present disclosure are only examples and are not limiting, and these advantages, benefits, effects and the like cannot be considered as the various embodiments of the present disclosure must have. In addition, the above specific details disclosed are only for the purpose of example and for the purpose of understanding, and the above details do not limit the present disclosure to the above specific details.
[0161] The block diagrams of the devices, apparatuses, equipment, systems involved in the present disclosure are only illustrative examples and are not intended to require or imply the connection, arrangement, configuration shown in the block diagram. As those skilled in the art will recognize, these devices, apparatuses, equipment, systems can be connected, arranged, configured in any way. Words such as "include", "contain", "have" and the like are open-ended words, which mean "including but not limited to", and can be used interchangeably. The words "or" and "and" used herein mean the word "and / or", and can be used interchangeably unless the context clearly indicates otherwise. The word "such as" used herein means the phrase "such as but not limited to", and can be used interchangeably.
[0162] In addition, as used herein, "or" used in the list of items starting with "at least one of indicates a separate list, so that, for example, "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e. A and B and C). In addition, the phrase "exemplary" does not mean that the described example is preferred or better than other examples.
[0163] It should also be noted that in the systems and methods of the present disclosure, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be considered as equivalent solutions of the present disclosure.
[0164] Various changes, modifications, and alterations of the technology herein can be made without departing from the teachings of the technology defined by the appended claims. In addition, the scope of the claims of the present disclosure is not limited to the specific aspects described above. Rather, the scope of the claims of the present disclosure is intended to encompass all aspects and features that fall within the spirit and scope of the technology defined by the claims. Accordingly, the appended claims are intended to embrace all such alterations, modifications, and changes of the technology herein. Further, the claims of the present disclosure are not limited to the specific aspects described above. Rather, the scope of the claims of the present disclosure is intended to encompass all aspects and features that fall within the spirit and scope of the technology defined by the claims. Accordingly, the appended claims are intended to embrace all such alterations, modifications, and changes of the technology herein. Further, the claims of the present disclosure are not limited to the specific aspects described above. Rather, the scope of the claims of the present disclosure is intended to encompass all aspects and features that fall within the spirit and scope of the technology defined by the claims. Accordingly, the appended claims are intended to embrace all such alterations, modifications, and changes of the technology herein.
[0165] The above description of the disclosed aspects has been presented for the purpose of illustration and description. Further, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although various example aspects and embodiments have been discussed above, those of ordinary skill in the art will appreciate a variety of modifications, alternatives, permutations, and equivalents thereof. Accordingly, further modifications, variations, and alternatives are within the scope of the claims of the present disclosure.
[0166] The above description has been presented for the purpose of illustration and description. Further, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although various example aspects and embodiments have been discussed above, those of ordinary skill in the art will appreciate a variety of modifications, alternatives, permutations, and equivalents thereof. Accordingly, further modifications, variations, and alternatives are within the scope of the claims of the present disclosure.
Claims
1. A communication transmission method, characterized in that, The method includes: Receive a first command, wherein the first command carries at least command header information; Based on the command type relationship table and the command header information, identify whether the first command is a target type; When the first command is the target type, the first command is transmitted using the merging and receiving strategy corresponding to the target type. The target types include: a first type and a second type; the first type corresponds to a first merging strategy; the first merging strategy indicates that the data receiving process of the instruction is merged; the second type corresponds to a second merging strategy, the second merging strategy indicates that the data receiving process of the instruction is merged, and the response sending process of the instruction is merged. The step of using the merged send / receive strategy corresponding to the target type to transmit the first command includes: temporarily storing the first command and sending an acknowledgment message to the sending end; receiving a second command, wherein the second command is the command data corresponding to the first command; merging the first command and the second command to obtain a merged command; and forwarding the merged command. The step of using the merged transmission and reception strategy corresponding to the target type to transmit the first command further includes: receiving and temporarily storing a third command, the third command including: response data and status word of the merged command; sending the status word to the sending end; receiving a response instruction from the sending end, and sending the third command to the sending end.
2. The method according to claim 1, characterized in that, The command type relationship table is used to store the set of instruction bytes corresponding to at least one target type; The command type relationship table is stored in a fixed form as at least one 8-bit unsigned integer array. The command type relationship table includes a first relationship table and a second relationship table; wherein, the first relationship table is used to represent the type relationship of system-type commands, and the second relationship table is used to represent the type relationship of custom-type commands.
3. The method according to claim 2, characterized in that, The step of identifying whether the first command is a target type based on the command type relationship table and the command header information includes: The command type relationship table is searched using the instruction bytes in the command header information. If the instruction byte exists in the command type relationship table, the first command is determined to be the target type corresponding to the set where the instruction byte is located.
4. The method according to claim 2, characterized in that, The method further includes: When the first command is not the target type, record the sending and receiving process data of the first command; When the first command is determined to be the target type based on the data of the sending and receiving process, the command type relationship table is updated.
5. The method according to any one of claims 1-4, characterized in that, The command type relationship table is used to store the attribute information of each command, wherein the attribute information includes at least: instruction bytes and command type.
6. The method according to claim 5, characterized in that, The step of identifying whether the first command is a target type based on the command type relationship table and the command header information includes: Using the instruction bytes in the command header information, the attribute information of the first command is obtained by searching the command type relationship table; Based on the command type in the attribute information, determine whether the first command is the target type.
7. The method according to claim 6, characterized in that, The command type relationship table is used to store the attribute information of the application and each command in the application; Before identifying whether the first command is a target type based on the command type relationship table and the command header information, the method further includes: Based on the correspondence between class bytes and application identifiers, and the class bytes in the command header information, the target application of the command header information is determined; Obtain the attribute information of each command in the target application from the command type relationship table.
8. The method according to any one of claims 1-7, characterized in that, The first instruction is an APDU instruction, and the target type includes at least one of the CASE3 type and the CASE4 type.
9. A communication transmission method, characterized in that, The method is applied to a card application function entity, and the method includes: A merge command is received, wherein the merge command is sent by transmitting a first command through communication using a merge transmission and reception strategy corresponding to the target type; wherein whether the first command is the target type is determined based on a command type relationship table and command header information, wherein the first command carries the command header information; The merge command is processed, and a third signaling is fed back; the third signaling includes: the response data and status word of the merge command; The target types include: a first type and a second type; the first type corresponds to a first merging strategy; the first merging strategy indicates that the data receiving process of the instruction is merged; the second type corresponds to a second merging strategy, the second merging strategy indicates that the data receiving process of the instruction is merged, and the response sending process of the instruction is merged. The step of using the merged send / receive strategy corresponding to the target type to transmit the first command includes: temporarily storing the first command and sending an acknowledgment message to the sending end; receiving a second command, wherein the second command is the command data corresponding to the first command; merging the first command and the second command to obtain a merged command; and forwarding the merged command. The step of using the merged transmission and reception strategy corresponding to the target type to transmit the first command further includes: receiving and temporarily storing a third command, the third command including: response data and status word of the merged command; sending the status word to the sending end; receiving a response instruction from the sending end, and sending the third command to the sending end.
10. A communication transmission device, characterized in that, The device includes: The receiving unit is configured to receive a first command, wherein the first command carries at least command header information; The identification unit is configured to identify whether the first command is a target type based on the command type relationship table and the command header information. The transmission unit is configured to transmit the first command using a merged transmit / receive strategy corresponding to the target type when the first command is the target type. The target types include: a first type and a second type; the first type corresponds to a first merging strategy; the first merging strategy indicates that the data receiving process of the instruction is merged; the second type corresponds to a second merging strategy, the second merging strategy indicates that the data receiving process of the instruction is merged, and the response sending process of the instruction is merged. The step of using the merged send / receive strategy corresponding to the target type to transmit the first command includes: temporarily storing the first command and sending an acknowledgment message to the sending end; receiving a second command, wherein the second command is the command data corresponding to the first command; merging the first command and the second command to obtain a merged command; and forwarding the merged command. The step of using the merged transmission and reception strategy corresponding to the target type to transmit the first command further includes: receiving and temporarily storing a third command, the third command including: response data and status word of the merged command; sending the status word to the sending end; receiving a response instruction from the sending end, and sending the third command to the sending end.
11. A communication transmission device, characterized in that, The device includes: The receiving unit is configured to receive a merging command, which is sent by transmitting a first command through communication using a merging and receiving strategy corresponding to the target type; wherein whether the first command is the target type is determined based on a command type relationship table and command header information, wherein the first command carries the command header information; The feedback unit is configured to process the merge command and feed back a third signaling; the third signaling includes: response data and status word of the merge command; The target types include: a first type and a second type; the first type corresponds to a first merging strategy; the first merging strategy indicates that the data receiving process of the instruction is merged; the second type corresponds to a second merging strategy, the second merging strategy indicates that the data receiving process of the instruction is merged, and the response sending process of the instruction is merged. The step of using the merged send / receive strategy corresponding to the target type to transmit the first command includes: temporarily storing the first command and sending an acknowledgment message to the sending end; receiving a second command, wherein the second command is the command data corresponding to the first command; merging the first command and the second command to obtain a merged command; and forwarding the merged command. The step of using the merged transmission and reception strategy corresponding to the target type to transmit the first command further includes: receiving and temporarily storing a third command, the third command including: response data and status word of the merged command; sending the status word to the sending end; receiving a response instruction from the sending end, and sending the third command to the sending end.
12. An electronic device, characterized in that, include: Memory, used to store computer-readable instructions; as well as A processor for executing the computer-readable instructions, causing the electronic device to perform the communication transmission method as described in any one of claims 1 to 9.
13. A non-transitory computer-readable storage medium for storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by a processor, the processor performs the communication transmission method as described in any one of claims 1 to 9.
14. A computer program product, characterized in that, It includes a computer program, which is executed by a processor to implement the communication transmission method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
High-capacity data interchange method between mobile terminal and smart card
CN101321336A
Card activating method and device, related equipment and storage medium
CN110366161A