Smart card application processing method, device, smart card and readable storage medium
By analyzing the type and encoding of smart card applications, using a combination of virtual machines and on-chip operating systems, the problem of compatibility with multiple applications on smart cards is solved, and execution efficiency and compatibility are improved.
Patent Information
- Application Number
- CN202210066507.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-20
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2042-01-20
AI Technical Summary
The existing technology is difficult to compatible with multiple smart card applications on smart cards, and there are differences in the execution efficiency of native cards and Java cards, resulting in compatibility issues.
By analyzing the types and encodings of the smart card applications to be run, the virtual machine is used to directly interpret and execute non-native types of applications, and then the on-chip operating system is used to interpret and execute native types of applications, including decomposing core and peripheral program coding, building registry and other steps.
It realizes compatibility with non-native and native types of applications on smart cards, improving execution efficiency and compatibility.
Smart Images

Figure CN114510320B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart card technology, and in particular to a smart card application processing method and device, a smart card, and a readable storage medium. Background Art
[0002] At present, with the rapid development of smart card applications, the social affairs, commercial business and consumer activities involved are increasing continuously, and there is an urgent need for smart cards that can support multiple business applications.
[0003] Common smart card types include native cards and Java cards. Native card business applications are compiled and executed together with the underlying COS, minimizing execution time. Java card business applications, on the other hand, are interpreted and executed through a virtual machine, which takes longer to execute.
[0004] How to achieve compatibility of multiple smart card applications on smart cards is an urgent problem to be solved. Summary of the Invention
[0005] In order to solve the above technical problems, the present invention provides a smart card application processing method, device, smart card and readable storage medium.
[0006] In a first aspect, the present invention provides a smart card application processing method, the smart card application processing method comprising:
[0007] Obtaining a smart card application to be run, and analyzing to obtain an application type and an application code of the smart card application to be run;
[0008] Based on the application code, non-native applications and native applications are compatible with each other. When the type of the smart card application to be run is non-native, it is directly interpreted and executed by the virtual machine. When the type of the smart card application to be run is native, it is converted using a predefined non-native conversion mechanism and then interpreted and executed by the on-chip operating system.
[0009] Optionally, when the type of the smart card application to be run is a native type, converting the application using a predefined non-native conversion mechanism and then interpreting and executing the application by the on-chip operating system includes:
[0010] Decomposing the application code into a core program code and a peripheral program code;
[0011] Converting the core program code into native program code executable by the on-chip operating system;
[0012] The peripheral program code is executed by the virtual machine, and after the execution is completed, the native program code is transferred to the on-chip operating system so that the on-chip operating system can execute the native program code.
[0013] Optionally, when the type of the smart card application to be run is a native type, converting the application using a predefined non-native conversion mechanism and then interpreting and executing the application by the on-chip operating system includes:
[0014] Based on the application code, a registry of a non-native smart card application to be run is obtained;
[0015] Building a native registry based on the registry;
[0016] After the native registry is added to the native application, it is transmitted to the on-chip operating system so that the on-chip operating system can run the native application with the native registry added.
[0017] Optionally, when the type of the smart card application to be run is a native type, converting the application using a predefined non-native conversion mechanism and then interpreting and executing the application by the on-chip operating system includes:
[0018] Based on the application code, a registry of a non-native smart card application to be run is obtained;
[0019] Building a native registry based on the registry during the process of the on-chip operating system running the native application;
[0020] Following the installation process of non-native smart card applications, an installation process is added to native applications and passed to the on-chip operating system for execution.
[0021] Optionally, the non-native type is a Java type.
[0022] In a second aspect, the present invention further provides a smart card application processing device, the smart card application processing device comprising:
[0023] An acquisition module is used to acquire the smart card application to be run, and analyze and obtain the application type and application code of the smart card application to be run;
[0024] The application implementation module is used to execute non-native applications and native applications compatibly based on the application code. When the type of the smart card application to be run is non-native, it is directly interpreted and executed by the virtual machine. When the type of the smart card application to be run is native, it is converted using a predefined non-native conversion mechanism and then interpreted and executed by the on-chip operating system.
[0025] Optionally, the application implementation module is used to:
[0026] Decomposing the application code into a core program code and a peripheral program code;
[0027] Converting the core program code into native program code executable by the on-chip operating system;
[0028] The peripheral program code is executed by the virtual machine, and after the execution is completed, the native program code is transferred to the on-chip operating system so that the on-chip operating system can execute the native program code.
[0029] Optionally, the application implementation module is used to:
[0030] Based on the application code, a registry of a non-native smart card application to be run is obtained;
[0031] Building a native registry based on the registry;
[0032] After the native registry is added to the native application, it is transmitted to the on-chip operating system so that the on-chip operating system can run the native application with the native registry added.
[0033] In a third aspect, the present invention further provides a smart card, comprising a processor, a memory, and a smart card application processing program stored in the memory and executable by the processor, wherein when the smart card application processing program is executed by the processor, the steps of the smart card application processing method described above are implemented.
[0034] In a fourth aspect, the present invention further provides a readable storage medium, on which a smart card application processing program is stored, wherein when the smart card application processing program is executed by a processor, the steps of the smart card application processing method described above are implemented.
[0035] In the present invention, a smart card application to be run is obtained and analyzed to obtain its application type and application code. Based on the application code, both non-native and native applications are compatibly executed. When the smart card application to be run is of a non-native type, it is directly interpreted and executed by a virtual machine. When the smart card application to be run is of a native type, it is converted using a predefined non-native conversion mechanism and then interpreted and executed by an on-chip operating system. This invention achieves compatibility between non-native and native smart card applications on a smart card. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a flow chart of an embodiment of a smart card application processing method of the present invention;
[0037] Figure 2 A schematic diagram of a scenario of an embodiment of a smart card application processing method of the present invention;
[0038] Figure 3 FIG. 1 is a schematic diagram of functional modules of an embodiment of a smart card application processing device according to the present invention.
[0039] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0040] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0041] In a first aspect, embodiments of the present invention provide a smart card. The smart card includes a processor, a memory, and a smart card application processing program stored in the memory and executable by the processor. The processor invokes the smart card application processing program stored in the memory and executes the smart card application processing method provided in embodiments of the present invention.
[0042] In a second aspect, an embodiment of the present invention provides a smart card application processing method.
[0043] In one embodiment, referring to Figure 1 , Figure 1 FIG. 1 is a flow chart of an embodiment of a smart card application processing method of the present invention. Figure 1 As shown, the smart card application processing method includes:
[0044] Step S10, obtaining the smart card application to be run, and analyzing to obtain the application type and application code of the smart card application to be run;
[0045] In this embodiment, the execution entity is a smart card. The smart card obtains the application ID of the smart card application to be executed from the interaction instruction sent by the smart card application to be executed. The application ID uniquely identifies a smart card application. In this embodiment, after obtaining the application ID, the application type of the smart card application to be executed is determined by determining the application ID. Application types are categorized as non-native and native. Furthermore, the application code of the smart card application to be executed is obtained by parsing the binary code of the smart card application to be executed.
[0046] Step S20: Based on the application code, non-native applications and native applications are compatibly executed. When the type of the smart card application to be run is non-native, it is directly interpreted and executed by the virtual machine. When the type of the smart card application to be run is native, it is converted using a predefined non-native conversion mechanism and then interpreted and executed by the on-chip operating system.
[0047] In this embodiment, non-native smart card applications are interpreted and executed by a virtual machine based on the application code. Non-native smart card applications, such as Java-based smart card applications, are illustrated here for illustrative purposes only and do not limit the scope of non-native smart card applications. Native smart card applications are converted using a predefined non-native conversion mechanism and then interpreted and executed by the on-chip operating system.
[0048] In this embodiment, a smart card application to be run is obtained and analyzed to obtain its application type and application code. Based on the application code, both non-native and native applications are compatibly executed. If the smart card application to be run is of a non-native type, it is directly interpreted and executed by the virtual machine. If the smart card application to be run is of a native type, it is converted using a predefined non-native conversion mechanism and then interpreted and executed by the on-chip operating system. This embodiment achieves compatibility between non-native and native smart card applications on a smart card.
[0049] Furthermore, in one embodiment, when the type of the smart card application to be run is a native type, a predefined non-native conversion mechanism is used for conversion and then interpreted and executed by the on-chip operating system, including:
[0050] Step S201: Decompose the application code into core program code and peripheral program code.
[0051] Step S202, converting the core program code into a native program code executable by the on-chip operating system;
[0052] Step S203 , executing the peripheral program code through the virtual machine, and after the execution is completed, transferring the native program code to the on-chip operating system so that the on-chip operating system can execute the native program code.
[0053] In this embodiment, the application code is decomposed into peripheral program code and core program code. The peripheral program code is not modified and remains unchanged; the core program code is converted into native program code that can be executed by the on-chip operating system, which is equivalent to building an application with a Java shell and a native kernel. Here, the Java shell is explained using a Java-type smart card as an example. Other non-native types can refer to this method.
[0054] The peripheral program code is executed through the virtual machine. After the execution is completed, the native program code is transferred to the on-chip operating system for the on-chip operating system to execute the native program code.
[0055] In this embodiment, the smart card application to be run is implemented by converting the core program code, so that after the implementation is completed, the smart card application to be run is run based on steps S10 to S20.
[0056] Reference Figure 2 , Figure 2 This is a scene diagram of an embodiment of the smart card application processing method of the present invention. Figure 2 As shown, arrow (2) indicates "converting the core program code into native program code executable by the on-chip operating system"; arrow (3) indicates interpreting and executing the peripheral program code through the virtual machine; after the virtual machine completes interpreting and executing the peripheral program code, the native program code is transferred to the on-chip operating system for the on-chip operating system COS to execute the native program code.
[0057] Furthermore, in one embodiment, when the type of the smart card application to be run is a native type, a predefined non-native conversion mechanism is used for conversion and then interpreted and executed by the on-chip operating system, including:
[0058] Step S203: obtaining a registry of a non-native smart card application to be run based on the application code;
[0059] Step S204, building a native registry based on the registry;
[0060] In step S205 , the native registry is added to the native application and then transmitted to the on-chip operating system, so that the on-chip operating system can run the native application with the native registry added.
[0061] In this embodiment, first, a registry of a non-native type of smart card application to be run is constructed according to the application code, and then a native registry of corresponding content is constructed according to the structure of the registry outside the native application (this process is equivalent to Figure 2 Arrow (2) in the figure is used to build a corresponding registry outside the native application. After adding the native registry to the native application, it is directly passed to COS for execution (i.e. Figure 2 As shown by arrow 4 in the figure). It should be noted that the actual logic of application execution is to access the method address, and the application code execution process of each non-native type smart card application to be run will store address information, AID information, package information, associated security domain information, etc. in the corresponding registry. In this way, the corresponding method function can be executed by accessing the address in the registry. By building a registry with consistent content, the conversion execution of the corresponding application can be completed.
[0062] In this embodiment, the smart card application to be run is implemented by constructing a native registry outside the native application, so that after the implementation is completed, the smart card application to be run is run based on steps S10 to S20.
[0063] Furthermore, in one embodiment, when the type of the smart card application to be run is a native type, a predefined non-native conversion mechanism is used for conversion and then interpreted and executed by the on-chip operating system, including:
[0064] Step S206: obtaining a registry of a non-native smart card application to be run based on the application code;
[0065] Step S207 , constructing a native registry based on the registry during the process of the on-chip operating system running the native application;
[0066] Step S208 , following the installation process of non-native smart card applications, an installation process is added to the native application, and the application is passed to the on-chip operating system for execution.
[0067] In this embodiment, a registry of a non-native smart card application to be run is constructed based on the application code, and then a native registry of corresponding content is constructed according to the structure of the registry during the process of running the native application in the chip operating system (this process is equivalent to Figure 2 Arrow (2) in the figure is used to construct a corresponding registry within the native application. After the native registry is constructed, the install process of the non-native smart card application to be run is imitated, and an install process is also added to the native application, and then passed to the COS for execution. The registry implementation scheme is consistent with the previous embodiment and will not be repeated here.
[0068] In this embodiment, the smart card application to be run is implemented by constructing a native registry within the native application, so that after the implementation is completed, the smart card application to be run is run based on steps S10 to S20.
[0069] Furthermore, in one embodiment, continue to refer to Figure 2 , determine the application type before the application is executed. If the application is a non-native smart card application, it will be executed directly through the virtual machine (equivalent to Figure 2 Arrow (1) in the figure); if the application is a native smart card application, it is executed directly through COS (equivalent to Figure 2 In this way, it is also possible to achieve compatibility between non-native smart card applications and native smart card applications on the smart card.
[0070] In a third aspect, an embodiment of the present invention further provides a smart card application processing device.
[0071] In one embodiment, referring to Figure 3 , Figure 3 This is a functional module diagram of an embodiment of a smart card application processing device of the present invention. Figure 3 The smart card application processing device shown includes:
[0072] An acquisition module 10 is configured to acquire a smart card application to be run, and analyze the application type and application code of the smart card application to be run;
[0073] The application implementation module 20 is used to execute non-native applications and native applications based on the application code. When the type of the smart card application to be run is non-native, it is directly interpreted and executed by the virtual machine. When the type of the smart card application to be run is native, it is converted using a predefined non-native conversion mechanism and then interpreted and executed by the on-chip operating system.
[0074] Furthermore, in one embodiment, the application implementation module 20 is configured to:
[0075] Decomposing the application code into a core program code and a peripheral program code;
[0076] Converting the core program code into native program code executable by the on-chip operating system;
[0077] The peripheral program code is executed by the virtual machine, and after the execution is completed, the native program code is transferred to the on-chip operating system so that the on-chip operating system can execute the native program code.
[0078] Furthermore, in one embodiment, the application implementation module 20 is configured to:
[0079] Based on the application code, a registry of a non-native smart card application to be run is obtained;
[0080] Building a native registry based on the registry;
[0081] After the native registry is added to the native application, it is transmitted to the on-chip operating system so that the on-chip operating system can run the native application with the native registry added.
[0082] Furthermore, in one embodiment, the application implementation module 20 is configured to:
[0083] Based on the application code, a registry of a non-native smart card application to be run is obtained;
[0084] Building a native registry based on the registry during the process of the on-chip operating system running the native application;
[0085] Following the installation process of non-native smart card applications, an installation process is added to native applications and passed to the on-chip operating system for execution.
[0086] Furthermore, in one embodiment, the non-native type is a Java type.
[0087] The functional implementation of each module in the above-mentioned smart card application processing device corresponds to each step in the above-mentioned smart card application processing method embodiment, and their functions and implementation processes are not repeated here one by one.
[0088] In a fourth aspect, an embodiment of the present invention further provides a readable storage medium.
[0089] The readable storage medium of the present invention stores a smart card application processing program, wherein when the smart card application processing program is executed by a processor, the steps of the smart card application processing method described above are implemented.
[0090] The method implemented when the smart card application processing program is executed may refer to the various embodiments of the smart card application processing method of the present invention, and will not be described in detail here.
[0091] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0092] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0093] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device to execute the methods described in various embodiments of the present invention.
[0094] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A smart card application processing method, characterized in that: The smart card application processing method includes: Obtaining a smart card application to be run, and analyzing to obtain an application type and an application code of the smart card application to be run; Based on the application code, non-native applications and native applications are compatible with each other, wherein when the type of the smart card application to be run is non-native, it is directly interpreted and executed by the virtual machine; when the type of the smart card application to be run is native, it is converted using a predefined non-native conversion mechanism and then interpreted and executed by the on-chip operating system; When the type of the smart card application to be run is a native type, a predefined non-native conversion mechanism is used to convert the application and the application is interpreted and executed by the on-chip operating system, including: Based on the application code, a registry of a non-native smart card application to be run is obtained; Building a native registry based on the registry; After the native registry is added to the native application, it is transmitted to the on-chip operating system so that the on-chip operating system can run the native application with the native registry added.
2. The smart card application processing method according to claim 1, wherein: When the type of the smart card application to be run is a native type, a predefined non-native conversion mechanism is used to convert the application and the application is interpreted and executed by the on-chip operating system, including: Decomposing the application code into a core program code and a peripheral program code; Converting the core program code into native program code executable by the on-chip operating system; The peripheral program code is executed by the virtual machine, and after the execution is completed, the native program code is transferred to the on-chip operating system so that the on-chip operating system can execute the native program code.
3. The smart card application processing method according to claim 1, wherein: When the type of the smart card application to be run is a native type, a predefined non-native conversion mechanism is used to convert the application and the application is interpreted and executed by the on-chip operating system, including: Based on the application code, a registry of a non-native smart card application to be run is obtained; Building a native registry based on the registry during the process of the on-chip operating system running the native application; Following the installation process of non-native smart card applications, an installation process is added to native applications and passed to the on-chip operating system for execution.
4. The smart card application processing method according to any one of claims 1 to 3, wherein: The non-native type is a Java type.
5. A smart card application processing device, characterized in that: The smart card application processing device includes: An acquisition module is used to acquire the smart card application to be run, and analyze and obtain the application type and application code of the smart card application to be run; an application implementation module, configured to execute non-native and native applications based on the application program code, wherein when the smart card application to be executed is of a non-native type, it is directly interpreted and executed by the virtual machine; and when the smart card application to be executed is of a native type, it is converted using a predefined non-native conversion mechanism and then interpreted and executed by the on-chip operating system; The application implementation module is used to: Based on the application code, a registry of a non-native smart card application to be run is obtained; Building a native registry based on the registry; After the native registry is added to the native application, it is transmitted to the on-chip operating system so that the on-chip operating system can run the native application with the native registry added.
6. The smart card application processing device according to claim 5, wherein: The application implementation module is used to: Decomposing the application code into a core program code and a peripheral program code; Converting the core program code into native program code executable by the on-chip operating system; The peripheral program code is executed by the virtual machine, and after the execution is completed, the native program code is transferred to the on-chip operating system so that the on-chip operating system can execute the native program code.
7. A smart card, characterized in that: The smart card includes a processor, a memory, and a smart card application processing program stored in the memory and executable by the processor, wherein when the smart card application processing program is executed by the processor, the steps of the smart card application processing method according to any one of claims 1 to 4 are implemented.
8. A readable storage medium, characterized in that: The readable storage medium stores a smart card application processing program, wherein when the smart card application processing program is executed by a processor, the steps of the smart card application processing method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Method and device for realizing smart card multi-service application
CN101739755A
Smart card, application implementation method and device and computer readable storage medium
CN109993261A