Smart card application patching method and device, equipment and storage medium

By downloading the patch package on the smart card and using the preset patch registration agent application for patch registration, the problem of the inability to update the application patch after the smart card is issued is solved, the patching efficiency and application running speed is improved, and the security and reliability of the smart card application is ensured.

CN120045215APending Publication Date: 2025-05-27CHINA UNITED NETWORK COMM GRP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510134088.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-06
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The existing smart card technology cannot update and repair the application patches after the card is issued, resulting in the inability to modify the problems or requirements after the smart card issuance. The patch development is difficult and the code space is occupied, which affects the application running speed.

Method used

By downloading the patch package to the smart card through standard download instructions, using the patch registration agent application preset on the smart card to register the target application method in the application package according to the registration instructions, obtain the patch registration information and add it to the patch registry.

Benefits of technology

It improves the patching efficiency of smart card applications, saves patch code space, improves the running speed of the application after patching, and ensures the security and reliability of smart card applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045215A_ABST
    Figure CN120045215A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a smart card application patching method and device, equipment and a storage medium. The method comprises the steps that a service pack is downloaded to the intelligent card through a standard downloading instruction, the service pack comprises at least one patching method, the intelligent card further comprises at least one application pack, and the application pack comprises at least one application method; and performing patch registration on a target application method in the application package according to a registration instruction through a patch registration agent application preset on the smart card to obtain patch registration pair information, and adding the patch registration pair information to a patch registration table, the target application method being an application method needing to be patched in the application package. According to the method, the patching efficiency is improved, the patching code space is saved, and the running speed of the application after patching is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of smart card technology, and in particular to a method, apparatus, device and storage medium for patching smart card applications. Background Art

[0002] In the smart card field, it is usually necessary to update the functions of applications or fix problems. There are two common methods: updating the functions of applications or fixing problems by patching the applications; deleting the applications and re-downloading them, re-developing the applications, and then deleting the original applications and downloading new ones.

[0003] Since the existing card support standard function specifications do not define the download method of application patches, the patch download method is usually implemented by the manufacturer's own private function. This private function is turned off after the card leaves the factory, so the application patch can only be downloaded during the production stage, which will result in the inability to patch the application downloaded to the card after the card leaves the factory. The patch mechanism that reserves patch entries in the application code requires patch entry design during the application development stage, which increases the workload of application design. If there are too many reserved patch entries, frequent patch queries in the code will cause the application to run slower, so patch entries can only be reserved in key entries. If a method without a reserved patch entry needs to be updated, it is necessary to develop a patch from the reserved patch entry, which increases the difficulty and workload of the patch, causing the size of the patch to increase exponentially, and may even make it impossible to perform patch repairs.

[0004] Deleting the application and then re-downloading it and re-developing the application will result in loss of application data. The application data needs to be re-issued, which involves the cost of re-issuance and cumbersome operations, resulting in a poor user experience. Summary of the invention

[0005] The embodiments of the present application provide a method, apparatus, device and storage medium for patching smart card applications, so as to solve the problem that problems or requirements of smart cards after issuance cannot be modified in the prior art.

[0006] In a first aspect, the present application provides a method for patching a smart card application, comprising:

[0007] Downloading a patch package to a smart card through a standard download instruction, wherein the patch package includes at least one patch method, and the smart card further includes at least one application package, and the application package includes at least one application method;

[0008] The target application method in the application package is patched according to the registration instruction by the patch registration agent application preinstalled on the smart card to obtain patch registration pair information, and the patch registration pair information is added to the patch registration table, wherein the target application method is the application method in the application package that needs to be patched.

[0009] Optionally, the registration instruction includes a first identifier corresponding to the application package, a coding value of a target application method, a second identifier corresponding to the patch package, and a coding value of the patch method, and the patch registration agent application preinstalled on the smart card performs patch registration on the target application method in the application package according to the registration instruction to obtain patch registration pair information, including:

[0010] Calling the patch registration interface to pass the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package, and the encoding value of the patch method to the patch registration agent application;

[0011] The patch registration agent application analyzes and processes the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package, and the encoding value of the patch method to obtain patch registration pair information.

[0012] Optionally, the patch registration agent application analyzes and processes the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package, and the encoding value of the patch method to obtain patch registration pair information, including:

[0013] Locating the address of the application package according to the first identifier corresponding to the application package, and determining whether the target application method crosses the boundary of the application package according to the encoding value of the target application method;

[0014] In the case where the target application method does not cross the application package, locate the address of the target application method, and determine whether the address of the target application method is a correct method address;

[0015] In the case that the address of the target application method is a correct method address, locating the address of the patch package according to the second identifier corresponding to the patch package, and determining whether the patch method crosses the boundary of the patch package according to the code value of the patch method;

[0016] In the case where the patch method does not cross the boundary of the patch package, locating the address of the patch method, and determining whether the address of the patch method is a correct method address;

[0017] In the case where the address of the patch method is a correct method address, determining whether the type and number of parameters of the target application method and the patch method are consistent;

[0018] In the case where the types and parameter numbers of the target application method and the patch method are consistent, determining whether the target application method has been patched;

[0019] In the case that the target application method has not registered a patch, patch registration pair information is obtained according to the address of the target application method and the address of the patch method.

[0020] Optionally, the encoding value of the target application method is determined according to an offset value of the target application method in the application package, and the encoding value of the patch method is determined according to an offset value of the patch method in the patch package.

[0021] Optionally, after obtaining the patch registration pair information according to the address of the target application method and the address of the patch method, the method further includes:

[0022] An attribute definition is added to the target application method, and the attribute value of the attribute definition is used to indicate whether there is a patch for the target application method.

[0023] Optionally, after patch registration of the target application method in the application package according to the registration instruction is performed by the patch registration agent application preinstalled on the smart card to obtain patch registration pair information, and the patch registration pair information is added to the patch registration table, the method further includes:

[0024] When the application method is executed, determining the bytecode that needs to be called when the application method is executed according to the attribute value;

[0025] In the case where the attribute value indicates that a patch exists for the application method, the address of the patch method is obtained by searching the patch registration table, and the bytecode corresponding to the patch method is executed.

[0026] In a second aspect, the present application provides a device for patching a smart card application, comprising:

[0027] An acquisition module, used to download a patch package to a smart card through a standard download instruction, wherein the patch package includes at least one patch method, and the smart card further includes at least one application package, and the application package includes at least one application method;

[0028] The processing module is used to perform patch registration on the target application method in the application package according to the registration instruction through the patch registration agent application preinstalled on the smart card, obtain patch registration pair information, and add the patch registration pair information to the patch registration table, wherein the target application method is the application method in the application package that needs to be patched.

[0029] Optionally, the registration instruction includes a first identifier corresponding to the application package, a coding value of a target application method, a second identifier corresponding to the patch package, and a coding value of the patch method; the processing module is further used to call a patch registration interface to pass the first identifier corresponding to the application package, the coding value of the target application method, the second identifier corresponding to the patch package, and the coding value of the patch method to the patch registration agent application;

[0030] The processing module is also used to analyze and process the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package and the encoding value of the patch method through the patch registration agent application to obtain patch registration pair information.

[0031] Optionally, the device further includes: a determination module;

[0032] The determination module is used to locate the address of the application package according to the first identifier corresponding to the application package, and determine whether the target application method crosses the boundary of the application package according to the encoding value of the target application method;

[0033] The confirmation module is further used to locate the address of the target application method and determine whether the address of the target application method is a correct method address when the target application method does not cross the application package.

[0034] The determination module is further configured to locate the address of the patch package according to the second identifier corresponding to the patch package when the address of the target application method is a correct method address, and determine whether the patch method crosses the boundary of the patch package according to the code value of the patch method;

[0035] The determination module is further used to locate the address of the patch method and determine whether the address of the patch method is a correct method address when the patch method does not cross the boundary of the patch package;

[0036] The determination module is further used to determine whether the type and number of parameters of the target application method and the patch method are consistent when the address of the patch method is a correct method address;

[0037] The determination module is further configured to determine whether a patch has been registered for the target application method when the types and parameter numbers of the target application method and the patch method are consistent;

[0038] The determination module is further configured to obtain patch registration pair information according to the address of the target application method and the address of the patch method when the target application method has not registered a patch.

[0039] Optionally, the processing module is further used to add an attribute definition for the target application method, and the attribute value of the attribute definition is used to indicate whether there is a patch for the target application method.

[0040] Optionally, the processing module is further used to determine, when the application method is executed, the bytecode that needs to be called when the application method is executed according to the attribute value;

[0041] The processing module is further configured to obtain the address of the patch method by searching the patch registration table when the attribute value indicates that a patch exists for the application method, and execute the bytecode corresponding to the patch method.

[0042] In a third aspect, the present application provides a device for patching a smart card application, comprising:

[0043] Memory;

[0044] processor;

[0045] Wherein, the memory stores computer-executable instructions;

[0046] The processor executes the computer-executable instructions stored in the memory to implement the smart card application patching method as described in the first aspect and various possible implementations of the first aspect.

[0047] In a fourth aspect, the present application provides a computer storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the smart card application patching method as described in the first aspect and various possible implementations of the first aspect.

[0048] The present application provides a method, apparatus, device and storage medium for patching smart card applications. The method downloads a patch package to a smart card through a standard download instruction, performs patch registration on a target application method in the application package according to the registration instruction through a patch registration agent application pre-installed on the smart card, obtains patch registration pair information, and adds the patch registration pair information to a patch registration table, thereby improving the efficiency of patching, saving patch code space, and increasing the running speed of the application after patching. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0050] Figure 1 A method and process for patching a smart card application provided in an embodiment of the present application Figure 1 ;

[0051] Figure 2A method and process for patching a smart card application provided in an embodiment of the present application Figure 2 ;

[0052] Figure 3 A schematic diagram of the structure of a smart card application patching device provided in this application;

[0053] Figure 4 A schematic diagram of the structure of a smart card application patching device provided in this application.

[0054] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0056] The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein.

[0057] In the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0058] Existing smart card patching generally provides patch addition for application through a preset patch library. This method reserves a patch entry and a patch library before the smart card is produced. When the application requires patch function addition, the preset patch library is searched for corresponding patch data for addition.

[0059] Since adding patch entries to all methods will greatly increase the code space of the application, and adding patch entries at each method entry and frequently searching for patches will cause the application to run slower, patch entries will only be added to key entries and important methods.

[0060] Since this method of the prior art is preset before production, it can only modify currently discovered problems or known requirements, and cannot modify problems or requirements after the smart card is issued.

[0061] In view of the above problems existing in the prior art, the present application provides a method for patching smart card applications. The method downloads a patch package to a smart card through a standard download instruction, performs patch registration on a target application method in the application package according to the registration instruction through a patch registration agent application pre-installed on the smart card, obtains patch registration pair information, and adds the patch registration pair information to a patch registration table.

[0062] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0063] Figure 1 This is a method flow of patching a smart card application provided by the embodiment of the present application. Figure 1 .like Figure 1 As shown, the method for patching a smart card application provided in this embodiment includes:

[0064] S101: Download the patch package to the smart card using a standard download instruction.

[0065] Among them, a patch package is a software package containing a patch method, which is used to repair or update the vulnerabilities or functions of an existing application package on the smart card. The patch method is the specific code or instruction in the patch package used to repair or update a specific function. The application package is a collection of one or more applications installed on the smart card, each of which contains a specific application method. The application method is the specific code or instruction in the application package used to perform a specific function or operation.

[0066] Understandably, by developing and testing the patch package, ensure that it can correctly repair or update the application on the smart card. The patch package should contain the necessary patch method and should comply with the download format and requirements of the smart card. Send the standard download command to the smart card through the software tool. The standard download command should contain the path, size, checksum and other information of the patch package to ensure that the patch package can be correctly downloaded and installed.

[0067] Furthermore, after receiving the download instruction, the smart card will verify the integrity and correctness of the patch package. If the verification is successful, the smart card will install the patch method in the patch package and update the corresponding application method in the application package.

[0068] S102: performing patch registration on the target application method in the application package according to the registration instruction through the patch registration agent application preinstalled on the smart card, obtaining patch registration pair information, and adding the patch registration pair information to the patch registration table.

[0069] The target application method is the application method in the application package that needs to be patched. The patch registration agent application is an application pre-installed on the smart card, which is responsible for processing the patch registration request. The registration instruction is an instruction that triggers the patch registration process, which usually contains the identification of the target application method and the patch information. The patch registration pair information contains the pairing data of the target application method and the corresponding patch information. The patch registration table is a database or data structure used to store all registered patch information.

[0070] It can be understood that, through the communication interface of the smart card, a registration instruction including the target application method identifier and the patch information is sent to the patch registration agent application. After receiving the registration instruction, the patch registration agent application verifies the integrity and correctness of the patch, and then performs the patch registration process, including pairing the target application method with the patch information and generating patch registration pair information. The generated patch registration pair information is added to the patch registration table.

[0071] By performing patch registration, you can ensure that the corresponding applications on the smart card can obtain necessary repairs or updates in a timely manner, thereby improving the overall performance and security of the smart card.

[0072] An embodiment of the present application provides a method for patching a smart card application. The method downloads a patch package to a smart card through a standard download instruction, and performs patch registration on a target application method in the application package according to the registration instruction through a patch registration agent application preinstalled on the smart card to obtain patch registration pair information, and adds the patch registration pair information to a patch registration table, thereby improving patching efficiency and ensuring the security and reliability of smart card applications.

[0073] Figure 2 A method and process for patching a smart card application provided in an embodiment of the present application Figure 2 This embodiment is in Figure 1 Based on the embodiment, a possible implementation method of the smart card application patching method is described in detail. Figure 2 As shown, the method includes:

[0074] S201: Download the patch package to the smart card using a standard download instruction.

[0075] Among them, step S201 is similar to the above step S101 and will not be repeated here.

[0076] S202: calling the patch registration interface to transfer the first identifier corresponding to the application package, the coding value of the target application method, the second identifier corresponding to the patch package, and the coding value of the patch method to the patch registration agent application.

[0077] Among them, the first identifier of the application package refers to the unique identifier of the original application or application package, which is used to uniquely identify the application on the system or platform. The encoding value of the target application method refers to the unique identifier of a specific method in the original application, which is used to call or reference the method at runtime. The second identifier of the patch package is used to uniquely identify the patch package. The encoding value of the patch method refers to the unique identifier of a specific method in the patch package that is used to replace or modify a method in the original application.

[0078] It can be understood that the coding value of the target application method is determined based on the offset value of the target application method in the method component of the application package, and the coding value of the patch method is determined based on the offset value of the patch method in the method component of the patch package. The offset value of each method in the method component is different, which is used to uniquely identify this method.

[0079] It is also understandable that when a patch needs to be applied to the original application, the system will call the patch registration interface, which requires the above four parameters to ensure that the patch can be correctly located and applied to the specified method of the target application.

[0080] By passing the patch parameter information and the application parameter information into the proxy application through the registration interface, it can be ensured that the patch is accurately applied to the specified method of the target application.

[0081] S203: Locate the address of the application package according to the first identifier corresponding to the application package, and determine whether the target application method crosses the boundary of the application package according to the encoding value of the target application method.

[0082] It is understandable that the system can locate the specific storage location of the application package based on the unique identifier of the application package. When processing the application package, the user will be allowed to specify an offset to access a specific component or data in the package. Out-of-bounds means that the offset of the application method exceeds the actual size of the application package, which will result in an attempt to read or write a non-existent memory area.

[0083] The purpose of this step is to ensure that any specified offset does not exceed its corresponding component size or range to avoid potential errors and safety risks.

[0084] S204: When the target application method does not cross the boundary of the application package, locate the address of the target application method, and determine whether the address of the target application method is a correct method address.

[0085] It can be understood that a correct method entry address should comply with the memory management specification of the current operating system and must point to a defined and executable code segment.

[0086] Specifically, the correctness of the method header organization format is the key to judging the legitimacy of the method. The method header contains the method metadata, such as the method signature, parameter types, return type, and access modifiers. If the method header organization format is incorrect, the method cannot be called or executed correctly, resulting in program exceptions or crashes.

[0087] In addition, the method pointed to by the located address cannot be an abstract method. An abstract method is declared in an abstract class or interface and has no specific implementation. When checking the legality of a method, make sure that the method pointed to is a concrete implementation method, not an abstract method.

[0088] S205: When the address of the target application method is a correct method address, locate the address of the patch package according to the second identifier corresponding to the patch package, and determine whether the patch method is an out-of-bounds patch package according to the code value of the patch method.

[0089] It is understandable that the system can locate the specific storage location of the patch package based on the unique identifier of the patch package. When processing the patch package, if the patch method offset exceeds the actual size of the patch package, the system will attempt to access invalid memory or data, causing an error.

[0090] By checking the legitimacy of input parameters, potential out-of-bounds errors and security vulnerabilities can be effectively prevented, thereby improving the reliability and security of the system.

[0091] S206: When the patch method does not cross the patch package boundary, locate the address of the patch method and determine whether the address of the patch method is a correct method address.

[0092] It can be understood that when the offset value of the patch method does not exceed the patch package component size, the method address of the patch method is obtained, and the method address is checked to see if it is the correct method address, for example, whether the method header organization format is incorrect and whether the method type of the address is an abstract method.

[0093] S207: When the address of the patch method is a correct method address, determine whether the type and number of parameters of the target application method and the patch method are consistent.

[0094] As you can understand, method type consistency means that the return type of the patch method must match the return type of the application method. At the same time, the patch method needs to accept exactly the same number and type of parameters as the application method, and the order of the parameters must also be consistent. This is because the parameters are passed in order when the method is called. If the parameter list of the patch method is inconsistent with the application method, there will be a parameter mismatch problem when the method is called, resulting in a runtime error.

[0095] Ensuring that the method type and number of parameters of the application method and patch method are consistent is an important measure to ensure the correctness of method calls. It can effectively reduce the risk of errors caused by method mismatches, thereby improving the reliability and stability of the application.

[0096] S208: When the type and parameter number of the target application method and the patch method are consistent, determine whether the target application method has been registered with a patch.

[0097] It is understandable that since the same application method can only register one patch method and cannot register multiple patch methods at the same time, when the type and number of parameters of the target application method and the patch method are consistent, it is necessary to further determine whether the target application method has already registered a patch.

[0098] S209: When the target application method has not registered a patch, obtain patch registration pair information according to the address of the target application method and the address of the patch method.

[0099] As you can understand, there are two forms of registration pairs: the first is to directly store the physical address of the application method and the physical address of the patch method. This method helps to optimize the search speed of the patch. The second is to store the logical address of the application method and the logical address of the patch method.

[0100] In an optional embodiment, after obtaining the patch registration pair information, the method further includes: modifying the header information of the application method, specifically, adding a private patched attribute definition to the target application method to identify that a patch exists for this method.

[0101] S210: Add the patch registration pair information to the patch registration table.

[0102] It can be understood that in order to ensure that patches can be correctly applied and managed, patch registration pair information needs to be added to the patch registration table.

[0103] In an optional embodiment, the method further includes: when the application method is executed, determining the bytecode that needs to be called when the application method is executed according to the attribute value; when the attribute value indicates that a patch exists for the application method, obtaining the address of the patch method by searching the patch registry, and executing the bytecode corresponding to the patch method.

[0104] In another optional embodiment, the method further includes: calling a deregistration interface to cancel the patch registration. Specifically, by passing in the unique application identifier of the application package and the encoding value of the application method, and querying the patch registration pair corresponding to the application method in the patch registration table, deleting the registration pair information from the patch registration table, modifying the application method attributes, removing the added attribute definition of the patched patch, and canceling the patch registration.

[0105] Furthermore, the patch is downloaded to the card in the form of a patch package, so deleting the patch only requires deleting the corresponding patch package. When deleting the patch package, the system automatically searches for the registration item containing the patch package in the patch registration table and deletes it.

[0106] A method for patching a smart card application provided by an embodiment of the present application comprises the following steps: downloading a patch package to a smart card through a standard download instruction, calling a patch registration interface to pass a first identifier corresponding to the smart card application package, a coding value of a target application method, a second identifier corresponding to the patch package, and a coding value of the patch method to a patch registration agent application, locating the address of the application package according to the first identifier corresponding to the application package, locating the address of the target application method when the target application method has not crossed the boundary of the application package, locating the address of the target application method when the address of the target application method is a correct method address, locating the address of the patch package according to the second identifier corresponding to the patch package, locating the address of the patch method when the patch method has not crossed the boundary of the patch package, and determining whether the type and number of parameters of the target application method and the patch method are consistent; determining whether the target application method has registered a patch when the type and number of parameters of the target application method and the patch method are consistent; and obtaining patch registration pair information according to the address of the target application method and the address of the patch method when the target application method has not registered a patch, and adding the patch registration pair information to a patch registration table. This method does not require reserving a patch entry, and can patch any method in the application, greatly reducing the application code and patch code, and saving space resources on the card.

[0107] Figure 3 A schematic diagram of the structure of a smart card application patching device provided in this application. Figure 3 As shown, the smart card application patching device 300 provided in this embodiment includes:

[0108] The acquisition module 301 is used to download a patch package to a smart card through a standard download instruction, wherein the patch package includes at least one patch method, and the smart card further includes at least one application package, and the application package includes at least one application method;

[0109] The processing module 302 is used to perform patch registration on the target application method in the application package according to the registration instruction through the patch registration agent application pre-installed on the smart card, obtain patch registration pair information, and add the patch registration pair information to the patch registration table, wherein the target application method is the application method in the application package that needs to be patched.

[0110] Optionally, the registration instruction includes a first identifier corresponding to the application package, a coding value of a target application method, a second identifier corresponding to the patch package, and a coding value of the patch method. The processing module 302 is further used to call a patch registration interface to pass the first identifier corresponding to the application package, the coding value of the target application method, the second identifier corresponding to the patch package, and the coding value of the patch method to the patch registration agent application;

[0111] The processing module 302 is also used to analyze and process the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package and the encoding value of the patch method through the patch registration agent application to obtain patch registration pair information.

[0112] Optionally, the device further includes: a determination module 303;

[0113] The determination module 303 is used to locate the address of the application package according to the first identifier corresponding to the application package, and determine whether the target application method crosses the boundary of the application package according to the encoding value of the target application method;

[0114] The confirmation module 303 is further used to locate the address of the target application method and determine whether the address of the target application method is a correct method address when the target application method does not cross the application package.

[0115] The determination module 303 is further configured to locate the address of the patch package according to the second identifier corresponding to the patch package when the address of the target application method is a correct method address, and determine whether the patch method crosses the boundary of the patch package according to the code value of the patch method;

[0116] The determination module 303 is further used to locate the address of the patch method and determine whether the address of the patch method is a correct method address when the patch method does not cross the boundary of the patch package;

[0117] The determination module 303 is further used to determine whether the type and number of parameters of the target application method and the patch method are consistent when the address of the patch method is a correct method address;

[0118] The determination module 303 is further configured to determine whether a patch has been registered for the target application method when the types and parameter numbers of the target application method and the patch method are consistent;

[0119] The determining module 303 is further configured to obtain patch registration pair information according to the address of the target application method and the address of the patch method when the target application method has not registered a patch.

[0120] Optionally, the processing module 302 is further used to add an attribute definition for the target application method, and the attribute value of the attribute definition is used to indicate whether there is a patch for the target application method.

[0121] Optionally, the processing module 302 is further used to determine, when the application method is executed, the bytecode that needs to be called when the application method is executed according to the attribute value;

[0122] The processing module 302 is further configured to, when the attribute value indicates that a patch exists for the application method, obtain the address of the patch method by searching the patch registration table, and execute the bytecode corresponding to the patch method.

[0123] The present embodiment provides a device for patching smart card applications, which can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail in this embodiment.

[0124] Figure 4 A schematic diagram of a smart card application patching device provided in this application. Figure 4 As shown, the smart card application patching device provided by the present application, the smart card application patching device 400 includes: a receiver 401, a transmitter 402, a processor 403 and a memory 404.

[0125] Receiver 401, used for receiving instructions and data;

[0126] A transmitter 402, used for sending instructions and data;

[0127] Memory 404, for storing computer-executable instructions;

[0128] The processor 403 is used to execute the computer-executable instructions stored in the memory 404 to implement the various steps performed by the method for patching smart card applications in the above embodiment. For details, please refer to the relevant description in the above embodiment of the method for patching smart card applications.

[0129] Optionally, the memory 404 may be independent or integrated with the processor 403 .

[0130] When the memory 404 is independently provided, the electronic device further includes a bus for connecting the memory 404 and the processor 403 .

[0131] The present application also provides a computer storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, a smart card application patching method executed by the smart card application patching device as described above is implemented.

[0132] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0133] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0134] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for patching a smart card application, characterized in that: include: Downloading a patch package to a smart card through a standard download instruction, wherein the patch package includes at least one patch method, and the smart card further includes at least one application package, and the application package includes at least one application method; The target application method in the application package is patched according to the registration instruction by the patch registration agent application preinstalled on the smart card to obtain patch registration pair information, and the patch registration pair information is added to the patch registration table, wherein the target application method is the application method in the application package that needs to be patched.

2. The method according to claim 1, characterized in that The registration instruction includes a first identifier corresponding to the application package, a coding value of a target application method, a second identifier corresponding to the patch package, and a coding value of the patch method. The patch registration agent application preinstalled on the smart card performs patch registration on the target application method in the application package according to the registration instruction to obtain patch registration pair information, including: Calling the patch registration interface to pass the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package, and the encoding value of the patch method to the patch registration agent application; The patch registration agent application analyzes and processes the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package, and the encoding value of the patch method to obtain patch registration pair information.

3. The method according to claim 2, characterized in that The patch registration agent application analyzes and processes the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package, and the encoding value of the patch method to obtain patch registration pair information, including: Locating the address of the application package according to the first identifier corresponding to the application package, and determining whether the target application method crosses the boundary of the application package according to the encoding value of the target application method; In the case where the target application method does not cross the application package, locate the address of the target application method, and determine whether the address of the target application method is a correct method address; In the case that the address of the target application method is a correct method address, locating the address of the patch package according to the second identifier corresponding to the patch package, and determining whether the patch method crosses the boundary of the patch package according to the code value of the patch method; In the case where the patch method does not cross the boundary of the patch package, locating the address of the patch method, and determining whether the address of the patch method is a correct method address; In the case where the address of the patch method is a correct method address, determining whether the type and number of parameters of the target application method and the patch method are consistent; In the case where the types and parameter numbers of the target application method and the patch method are consistent, determining whether the target application method has been patched; In the case that the target application method has not registered a patch, patch registration pair information is obtained according to the address of the target application method and the address of the patch method.

4. The method according to claim 3, characterized in that The encoding value of the target application method is determined according to the offset value of the target application method in the application package, and the encoding value of the patch method is determined according to the offset value of the patch method in the patch package.

5. The method according to claim 3, characterized in that: After obtaining the patch registration pair information according to the address of the target application method and the address of the patch method, the method further includes: An attribute definition is added to the target application method, and the attribute value of the attribute definition is used to indicate whether there is a patch for the target application method.

6. The method according to claim 5, characterized in that After the patch registration agent application preinstalled on the smart card performs patch registration on the target application method in the application package according to the registration instruction to obtain patch registration pair information, and the patch registration pair information is added to the patch registration table, the method further includes: When the application method is executed, determining the bytecode that needs to be called when the application method is executed according to the attribute value; In the case where the attribute value indicates that a patch exists for the application method, the address of the patch method is obtained by searching the patch registration table, and the bytecode corresponding to the patch method is executed.

7. A device for patching smart card applications, characterized in that: The device comprises: An acquisition module, used to download a patch package to a smart card through a standard download instruction, wherein the patch package includes at least one patch method, and the smart card further includes at least one application package, and the application package includes at least one application method; The processing module is used to perform patch registration on the target application method in the application package according to the registration instruction through the patch registration agent application preinstalled on the smart card, obtain patch registration pair information, and add the patch registration pair information to the patch registration table, wherein the target application method is the application method in the application package that needs to be patched.

8. The device according to claim 7, characterized in that The registration instruction includes a first identifier corresponding to the application package, a coding value of a target application method, a second identifier corresponding to the patch package, and a coding value of the patch method; The processing module is further used to call the patch registration interface to transfer the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package and the encoding value of the patch method to the patch registration agent application; The processing module is also used to analyze and process the first identifier corresponding to the application package, the encoding value of the target application method, the second identifier corresponding to the patch package and the encoding value of the patch method through the patch registration agent application to obtain patch registration pair information.

9. A device for patching smart card applications, characterized in that: The device comprises: Memory; processor; Wherein, the memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the smart card application patching method according to any one of claims 1 to 6.

10. A computer storage medium, characterized in that: The computer storage medium stores computer executable instructions, which are used to implement the smart card application patching method according to any one of claims 1 to 6 when executed by a processor.