A decompilation processing method and device, electronic equipment and storage medium
By creating multiple dynamic arrays and performing link address translation mapping of Java Card bytecode, the problem of decompilation failure when the length of the Java Card bytecode operation object exceeds 1 byte is solved, and effective decompilation of Java bytecode is achieved.
Patent Information
- Application Number
- CN202310088932.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-17
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2043-01-17
AI Technical Summary
Existing technologies cannot effectively handle decompilation failures when the length of Java Card bytecode manipulation objects exceeds 1 byte.
By creating three dynamic arrays in the form of class objects—the first dynamic array, the second dynamic array, and the third dynamic array—the Java Card bytecode is traversed and its information is dynamically filled into these arrays. This process performs link address translation mapping of the Java Card bytecode, thereby achieving decompilation.
It can handle decompilation operations in scenarios where the length of the object being operated on exceeds the agreed length, and even construct compliant Java bytecode freely based on semantics when no corresponding Java bytecode can be found in a one-to-one mapping relationship.
Smart Images

Figure CN115964053B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, and in particular to a decompilation processing method and device, electronic equipment and storage medium. BACKGROUND
[0002] In the process of decompiling the CAP package (a final output result of Java development) of the Java Card, the conventional operation processing number is 1 byte, for example, the operation of using SINC, INC, SWAP (swap) instructions is 1 byte, and in this conventional case, the normal decompilation operation can be performed. However, in the actual decompilation scene, the operation object is often greater than 1 byte, and in this case, the decompilation cannot be supported, thereby causing the decompilation to fail.
[0003] Specifically, the bytecode corresponding to the Method component in the Cap package of the Java Card is generated by the JDK (a software development kit) to generate a class file (a binary file that can run on any hardware platform and operating system supporting the Java virtual machine), and then the corresponding Java bytecode in the class file is compiled to generate the bytecode corresponding to the JavaCard. In principle, there is a one-to-one mapping relationship between the Java Card bytecode and the Java bytecode, and by traversing the Java Card bytecode, the corresponding Java bytecode can be decompiled based on the mapping relationship, but for specific bytecodes, such as SINC_W and IINC_W, the operation object is greater than 1 byte, and through the above mapping relationship, the corresponding Java bytecode cannot be found.
[0004] Therefore, there is an urgent need for a method that can still perform normal decompilation operation processing when the processing byte length exceeds the agreed length. SUMMARY
[0005] In view of the defects in the prior art, the purpose of the present application is to provide a decompilation processing method, device, electronic equipment and storage medium, which can normally process the decompilation operation in the scene where the operation object length exceeds the agreed length.
[0006] To achieve the above purpose, the present application provides a decompilation processing method, which specifically includes the following steps:
[0007] A first dynamic array, a second dynamic array and a third dynamic array in the format of three class objects are created;
[0008] Traverse each Java Card bytecode, and based on the opcode and operand of the Java Card bytecode, fill the Java Card bytecode and the generated Java bytecode information after conversion into the first dynamic array, the second dynamic array and the third dynamic array dynamically;
[0009] Read the Java Card bytecode in the dynamic array in sequence, and perform the linkage address conversion mapping of the Java Card bytecode, to realize the decompilation processing of the Java Card bytecode;
[0010] The first dynamic array is used for storing the information of the Java Card bytecode, the second dynamic array is used for storing the information of the Java Card bytecode and the corresponding Java bytecode generated after conversion, and the third dynamic array is used for storing the information of the Java bytecode generated after conversion.
[0011] On the basis of the above technical solution,
[0012] The first dynamic array includes four members, wherein the first member is the opcode corresponding to the Java Card bytecode, the second member is the first operand, the third member is the second operand, and the fourth member is the third operand;
[0013] The second dynamic array includes two members, wherein the first member is the object instance of the first dynamic array type, and the second member is the dynamic array of the third dynamic array type;
[0014] The third dynamic array includes three members, wherein the first member is the opcode of the Java bytecode corresponding to the Java Card bytecode generated after conversion, the second member is the dynamic array of the corresponding operand of the Java bytecode generated after conversion of the Java Card bytecode, and the third member is the byte number occupied by the Java bytecode generated after conversion and the corresponding operand.
[0015] On the basis of the above technical solution, the steps of traversing each Java Card bytecode, and based on the opcode and operand of the Java Card bytecode, filling the Java Card bytecode and the generated Java bytecode information after conversion into the first dynamic array, the second dynamic array and the third dynamic array dynamically include:
[0016] Store all Java Card bytecodes into the first dynamic array, and create an instance object of the second dynamic array type;
[0017] sequentially taking out the Java Card bytecodes stored in the first dynamic array, and assigning information of the taken-out Java Card bytecodes to a first member of an instance object of the created second dynamic array type;
[0018] creating a fourth dynamic array for storing operation numbers corresponding to the converted Java bytecodes;
[0019] extracting operation numbers of the Java Card bytecodes taken out from the first dynamic array, and mapping the Java Card bytecodes into single or multiple corresponding Java bytecodes according to semantics;
[0020] storing the operation numbers of the mapped Java bytecodes into the fourth dynamic array, and associating a member of the fourth dynamic array with a second member of the third dynamic array.
[0021] On the basis of the above technical solution, the sequentially taking out the Java Card bytecodes stored in the first dynamic array comprises the following steps:
[0022] sequentially traversing the first dynamic array, and taking out the Java Card bytecodes traversed in the first dynamic array;
[0023] naming the taken-out Java Card bytecodes as JCi, wherein JCi represents the i-th Java Card bytecode in the first dynamic array, and i represents an index number in the first dynamic array.
[0024] On the basis of the above technical solution, after mapping the Java Card bytecodes into single or multiple corresponding Java bytecodes according to semantics, the method further comprises the following steps:
[0025] storing the Java Card bytecodes into the created instance object, and simultaneously creating an object of a third dynamic array type, wherein the object contains the same members as the third dynamic array;
[0026] assigning the mapped Java bytecodes to a first member of the object, and assigning the fourth dynamic array to a second member of the object;
[0027] calculating byte spaces occupied by the mapped Java bytecodes and operation numbers according to the first member and the second member of the object, and simultaneously storing the mapped Java bytecodes into the third dynamic array.
[0028] On the basis of the above technical solution, the sequentially taking out the Java Card bytecodes stored in the first dynamic array comprises the following steps:
[0029] sequentially traversing the second dynamic array to obtain Java Card bytecodes in the second dynamic array;
[0030] obtaining corresponding Java bytecodes in the second dynamic array according to the current address and the target address of the current Java Card bytecode;
[0031] looping through the Java bytecodes stored in the second members of the second dynamic array to obtain the second members of the second dynamic array and the number of converted Java bytecodes from the members;
[0032] looping through the Java bytecodes between the obtained Java bytecodes to calculate the relative address offset of the current address and the target address of the converted Java bytecodes, and realizing the decompilation processing of the Java Card bytecodes.
[0033] The application provides a decompilation processing device, which comprises:
[0034] a creating module for creating three dynamic arrays in the format of class objects, namely a first dynamic array, a second dynamic array and a third dynamic array;
[0035] a traversing module for traversing each Java Card bytecode and dynamically filling the Java Card bytecodes and the generated Java bytecode information after conversion into the first dynamic array, the second dynamic array and the third dynamic array based on the operation code and the operation number of the Java Card bytecodes;
[0036] a converting module for sequentially reading the Java Card bytecodes in the dynamic arrays and performing the link address conversion mapping of the Java Card bytecodes to realize the decompilation processing of the Java Card bytecodes;
[0037] The first dynamic array is used for storing the information of the Java Card bytecodes, the second dynamic array is used for storing the information of the Java Card bytecodes and the corresponding Java bytecodes generated after conversion, and the third dynamic array is used for storing the information of the Java bytecodes generated after conversion.
[0038] On the basis of the above technical solution,
[0039] The first dynamic array comprises four members, wherein the first member is the operation code corresponding to the Java Card bytecodes, the second member is the first operation number, the third member is the second operation number, and the fourth member is the third operation number.
[0040] The second dynamic array includes two members, wherein the first member is an object instance corresponding to the first dynamic array type, and the second member is a dynamic array storing the third dynamic array type;
[0041] The third dynamic array includes three members, wherein the first member is an operation code of the generated Java bytecode after the Java Card bytecode conversion, the second member is a dynamic array storing an operation number corresponding to the generated Java bytecode after the Java Card bytecode conversion, and the third member is a byte number occupied by the generated Java bytecode after the conversion and the corresponding operation number.
[0042] The application provides an electronic device, including a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the decompilation processing method when executing the program.
[0043] The application provides a non-transitory computer readable storage medium, which stores a computer program, wherein the computer program is executable by a processor to implement the steps of the decompilation processing method.
[0044] Compared with the prior art, the application has the following advantages: by creating a plurality of dynamic arrays in the format of class object, i.e., a first dynamic array, a second dynamic array and a third dynamic array, then traversing each Java Card bytecode, filling the Java Card bytecode and the generated Java bytecode information into the first dynamic array, the second dynamic array and the third dynamic array, then reading the Java Card bytecode in the dynamic array in sequence and performing the linkage address conversion mapping of the Java Card bytecode, the decompilation operation in the scenario where the operation object length exceeds the agreed length can be normally processed, and when the Java Card corresponding bytecode cannot find the corresponding Java bytecode through the one-to-one mapping relationship, the corresponding Java bytecode conforming to the semantics of the current Java Card corresponding bytecode can be freely constructed according to the semantics of the current Java Card corresponding bytecode. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0046] Figure 1 The flowchart of the decompilation processing method in the embodiments of the present application. DETAILED DESCRIPTION
[0047] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application.
[0048] Referring to Figure 1 The decompiling processing method provided by the embodiments of the present application specifically includes the following steps:
[0049] S1: creating three dynamic arrays in the format of class objects, which are respectively a first dynamic array, a second dynamic array and a third dynamic array;
[0050] That is, three dynamic arrays in the format of class objects are created, wherein the first dynamic array is used to store the information of Java Card bytecodes, the second dynamic array is used to store the information of the Java Card bytecodes and the corresponding Java bytecodes generated after conversion, and the third dynamic array is used to store the information of the Java bytecodes generated after conversion.
[0051] Specifically, the member structure of the first dynamic array is described as follows: the first dynamic array includes four members, wherein the first member is the operation code corresponding to the Java Card bytecodes, the second member is the first operand, the third member is the second operand, and the fourth member is the third operand.
[0052] The member structure of the second dynamic array is described as follows: the second dynamic array includes two members, wherein the first member is the object instance of the type corresponding to the first dynamic array, and the second member is the dynamic array of the type of the third dynamic array.
[0053] The member structure of the third dynamic array is described as follows: the third dynamic array includes three members, wherein the first member is the operation code of the Java bytecodes generated after conversion of the Java Card bytecodes, the second member is the dynamic array storing the corresponding operands of the Java bytecodes generated after conversion of the Java Card bytecodes, and the third member is the number of bytes occupied by the Java bytecodes generated after conversion and the corresponding operands. In actual operation, a single Java bytecode may correspond to multiple operands.
[0054] S2: traversing each Java Card bytecode, and based on the operation code and the operands of the Java Card bytecode, dynamically filling the information of the Java Card bytecode and the Java bytecode generated after conversion into the first dynamic array, the second dynamic array and the third dynamic array;
[0055] In the present application, each Java Card bytecode is traversed, and based on the operation code and operand of the Java Card bytecode, the Java Card bytecode and the generated Java bytecode information after conversion are dynamically filled into the first dynamic array, the second dynamic array and the third dynamic array, and the specific steps include:
[0056] S201: store all Java Card bytecodes into the first dynamic array, and create an instance object of the second dynamic array type; that is, store all Java Card bytecodes into the first dynamic array according to the format of the first dynamic array.
[0057] S202: sequentially take out the Java Card bytecodes stored in the first dynamic array, and assign the information of the taken Java Card bytecodes to the first member of the created instance object of the second dynamic array type;
[0058] In the present application, the Java Card bytecodes stored in the first dynamic array are sequentially taken out, and the specific steps are as follows:
[0059] S2021: sequentially traverse the first dynamic array, and take out the Java Card bytecodes obtained by traversing the first dynamic array;
[0060] S2022: name the taken Java Card bytecodes as JCi, wherein JCi represents the i-th Java Card bytecode in the first dynamic array, and i represents the index number in the first dynamic array.
[0061] S203: create a fourth dynamic array for storing the operation numbers of the converted Java bytecodes;
[0062] S204: extract the operation numbers of the Java Card bytecodes taken from the first dynamic array, and map the Java Card bytecodes into single or multiple corresponding Java bytecodes according to the semantics;
[0063] That is, according to the Java Card bytecodes taken from the first dynamic array, the operation numbers of the Java Card bytecodes are extracted, which can be one or multiple.
[0064] S205: store the mapped Java bytecode corresponding operation numbers into the fourth dynamic array, and associate the members of the fourth dynamic array with the second members of the third dynamic array.
[0065] In the present application, after the Java Card bytecodes are mapped into single or multiple corresponding Java bytecodes according to the semantics, the following steps are further included:
[0066] A: store the Java Card bytecode into the created instance object, and create an object of a third dynamic array type, which contains the same members as the third dynamic array;
[0067] B: assign the mapped Java bytecode to the first member of the object, and assign the fourth dynamic array to the second member of the object;
[0068] C: calculate the byte space occupied by the mapped Java bytecode and the operand according to the first member and the second member of the object, and store the mapped Java bytecode into the third dynamic array.
[0069] S3: read the Java Card bytecodes in the dynamic array in sequence, and perform linkage address conversion mapping of the Java Card bytecodes, to realize the decompilation processing of the Java Card bytecodes;
[0070] In the present application, the Java Card bytecodes in the dynamic array are read in sequence, and linkage address conversion mapping of the Java Card bytecodes is performed, to realize the decompilation processing of the Java Card bytecodes, and the specific steps include:
[0071] S301: sequentially traverse the second dynamic array to obtain the Java Card bytecodes in the second dynamic array; that is, sequentially traverse the second dynamic array, take out each array member, and then obtain the Java Card bytecode corresponding to the current array member.
[0072] S302: obtain the corresponding Java bytecode in the second dynamic array according to the current address and the target address of the current Java Card bytecode;
[0073] In a possible implementation, when the corresponding Java bytecode is obtained according to the current address and the target address of the current Java Card bytecode, the obtained Java bytecodes can be multiple, such as Java bytecode M and Java bytecode N.
[0074] S303: loop through the Java bytecodes stored in the second member of the second dynamic array to obtain the second member of the second dynamic array, and obtain the number of converted Java bytecodes from the member. Since the corresponding Java bytecodes stored in the second member of the second dynamic array in the array member, each Java bytecode corresponds to the third member of the third dynamic array, which indicates the number of bytes occupied by each Java bytecode, so looping through the Java bytecodes stored in the second member of the second dynamic array can obtain the number of Java bytecodes stored in the second member of the second dynamic array.
[0075] S304: loop through the Java bytecodes between the obtained Java bytecodes, calculate the relative address offset of the current address and the target address of the converted Java bytecodes, and realize the decompilation processing of the Java Card bytecodes. In combination with the number of Java bytecodes stored in the second member of the second dynamic array, the relative address offset of the current address and the target address of the converted Java bytecodes can be calculated, the link address conversion mapping of the converted Java bytecodes is realized, and the decompilation processing of the Java Card bytecodes is realized.
[0076] That is, loop through the Java bytecodes between the Java bytecode M and the Java bytecode N, and calculate the relative address offset of the current address and the target address of the converted Java bytecodes.
[0077] The decompilation processing method of the application, by creating a plurality of dynamic arrays in the format of class objects, respectively a first dynamic array, a second dynamic array and a third dynamic array, then traversing each Java Card bytecode, filling the Java Card bytecode and the generated Java bytecode information after conversion into the first dynamic array, the second dynamic array and the third dynamic array, then reading the Java Card bytecode in the dynamic array in turn, and performing the link address conversion mapping of the Java Card bytecode, so as to be able to normally process the decompilation operation under the scene that the operation object length exceeds the agreed length, and when the corresponding bytecode of the Java Card cannot be found through the one-to-one mapping relationship, the corresponding Java bytecode conforming to the semantics can be freely constructed according to the semantics corresponding to the current bytecode of the Java Card. In the actual application process, the bytecode can be one or more, and the number of Java bytecodes is not limited.
[0078] The decompilation processing device provided by the embodiment of the application comprises a creating module, a traversing module and a converting module.
[0079] The creating module is used for creating three dynamic arrays in the format of class object, namely a first dynamic array, a second dynamic array and a third dynamic array; the traversing module is used for traversing each Java Card bytecode and filling the Java Card bytecode and the generated Java bytecode information after conversion into the first dynamic array, the second dynamic array and the third dynamic array based on the operation code and the operand of the Java Card bytecode; the converting module is used for reading the Java Card bytecode in the dynamic array in sequence and performing the address conversion mapping of the Java Card bytecode, so as to realize the decompilation processing of the Java Card bytecode. The first dynamic array is used for storing the information of the Java Card bytecode, the second dynamic array is used for storing the information of the Java Card bytecode and the corresponding Java bytecode information generated after conversion, and the third dynamic array is used for storing the Java bytecode information generated after conversion.
[0080] In the present application, the first dynamic array includes four members, wherein the first member is the operation code corresponding to the Java Card bytecode, the second member is the first operand, the third member is the second operand, and the fourth member is the third operand; the second dynamic array includes two members, wherein the first member is the object instance of the type of the first dynamic array, and the second member is the dynamic array storing the class of the third dynamic array; and the third dynamic array includes three members, wherein the first member is the operation code of the generated Java bytecode after conversion of the Java Card bytecode, the second member is the dynamic array storing the corresponding operand of the generated Java bytecode after conversion of the Java Card bytecode, and the third member is the byte number occupied by the generated Java bytecode after conversion and the corresponding operand.
[0081] In a possible implementation, the present application further provides an electronic device including a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to realize the steps of the above-mentioned decompilation processing method.
[0082] In a possible implementation, the present application further provides a non-transitory computer readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to realize the steps of the above-mentioned decompilation processing method.
[0083] The storage media can be embodied in any combination of one or more computer-readable media. The computer-readable media can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer-readable storage medium can be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
[0084] A computer-readable signal medium can include a computer-readable program code, propagated by or through the propagation medium, comprising any tangible medium under the control of an instruction execution system, apparatus, or device. The computer-readable signal medium can comprise a baseband or propagated signal, propagating by or through a propagation medium, comprising any tangible medium under the control of an instruction execution system, apparatus, or device. The propagated signal can comprise data signals in any suitable digital communications format, including, but not limited to, Global Positioning System, Wireless Application Protocol (WAP), Electronic mail, Instant messaging, Bluetooth, and so on. The propagated signal can comprise propagation media ranging from wireless propagation media to wired propagation media, both electrical, optical, and so on.
[0085] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++, or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, application specific circuitry, or field programmable gate array (FPGA) circuitry can execute the computer program code.
[0086] The foregoing detailed description of the application has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the application to the precise form disclosed, and various modifications and variations are possible in light of the above teachings or can be acquired from practice of the application. The
[0087] The present application is described with reference to the accompanying drawings in which the various embodiments of the present application are illustrated by way of example. It is to be understood that the application is not limited to the examples described herein, but can be carried out in various ways as understood by those skilled in the art once informed by the content of the disclosure. The drawings in which: Figure 1 Each flow and / or block in the flow and / or block diagrams, and combinations of flows and / or blocks in the flow and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flow and / or block diagram block or blocks. Figure 1 The flow and / or block diagrams can also be implemented as programming code, such as an applet, that is executable inside a computing environment. Such an environment can be an application implemented in an OS, a standalone software package, a software package implemented in an application, or a software package implemented in a computing environment such as a cloud computing environment. Such an environment can also be a distributed computing environment, where tasks are performed by remote processing devices that are linked through a communications network. In this case, flow and / or block diagrams can be downloaded as a task package from a software provider to a user's computer for execution.
Claims
1. A decompilation processing method, characterized in that, Specifically, the following steps are included: Create three dynamic arrays in the form of class objects, namely the first dynamic array, the second dynamic array, and the third dynamic array; Iterate through each Java Card bytecode and, based on the opcode and operands of the Java Card bytecode, dynamically fill the Java Card bytecode and the converted Java bytecode information into the first dynamic array, the second dynamic array, and the third dynamic array. The Java Card bytecode is read sequentially from the dynamic array, and the link address translation mapping of the Java Card bytecode is performed to achieve the decompilation of the Java Card bytecode; Wherein, the first dynamic array is used to store information about Java Card bytecode, the second dynamic array is used to store information about Java Card bytecode and information about the corresponding Java bytecode generated after conversion, and the third dynamic array is used to store information about the Java bytecode generated after conversion; in, The first dynamic array includes four members: the first member is the opcode corresponding to the Java Card bytecode, the second member is operand 1, the third member is operand 2, and the fourth member is operand 3. The second dynamic array includes two members: the first member is an object instance of the corresponding first dynamic array type, and the second member is a dynamic array of the storage class third dynamic array type. The third dynamic array includes three members: the first member is the opcode of the Java bytecode generated after Java Card bytecode conversion; the second member is a dynamic array storing the operands of the Java bytecode generated after Java Card bytecode conversion; and the third member is the number of bytes occupied by the converted Java bytecode and its corresponding operands.
2. The decompilation processing method as described in claim 1, characterized in that, The steps of traversing each Java Card bytecode and dynamically filling the Java Card bytecode and the converted Java bytecode information into the first dynamic array, the second dynamic array, and the third dynamic array based on the Java Card bytecode's opcode and operands include: Store all Java Card bytecode into the first dynamic array, and create an instance of a second dynamic array type; The Java Card bytecode stored in the first dynamic array is retrieved sequentially, and the information of the retrieved Java Card bytecode is assigned to the first member of the instance object of the second dynamic array type. Create a fourth dynamic array to store the operands corresponding to the transformed Java bytecode; Extract the operands of the Java Card bytecode taken from the first dynamic array, and map the Java Card bytecode into one or more corresponding Java bytecodes according to the semantics; The corresponding operands of the mapped Java bytecode are stored in the fourth dynamic array, and the members of the fourth dynamic array are associated with the second member of the third dynamic array.
3. The decompilation processing method as described in claim 2, characterized in that, The specific steps for sequentially retrieving the Java Card bytecode stored in the first dynamic array are as follows: Iterate through the first dynamic array sequentially and extract the Java Card bytecode obtained from the iteration of the first dynamic array; The extracted Java Card bytecode is named JCi, where JCi represents the i-th Java Card bytecode in the first dynamic array, and i represents the index number in the first dynamic array.
4. The decompilation processing method as described in claim 2, characterized in that, After mapping Java Card bytecode to one or more corresponding Java bytecode based on semantics, the following is also included: The Java Card bytecode is stored in the created instance object, and an object of type third dynamic array is also created, the members of which are the same as those of the third dynamic array. Assign the mapped Java bytecode to the first member of the object, and assign the fourth dynamic array to the second member of the object; Based on the first and second members of the object, the byte space occupied by the mapped Java bytecode and operands is calculated, and the mapped Java bytecode is stored in the third dynamic array.
5. The decompilation processing method as described in claim 4, characterized in that, The process of sequentially reading Java Card bytecode from a dynamic array and performing link address translation mapping to decompile the Java Card bytecode includes the following steps: Iterate through the second dynamic array to obtain the Java Card bytecode in the second dynamic array; Based on the current address and target address of the current Java Card bytecode, obtain the corresponding Java bytecode in the second dynamic array; Iterate through the Java bytecode stored in the second member of the second dynamic array to obtain the second member of the second dynamic array, and get the number of converted Java bytecode from that member; The Java bytecode obtained by looping through the Java bytecode is used to calculate the relative address offset between the current address and the target address of the converted Java bytecode, thereby realizing the decompilation of Java Card bytecode.
6. A decompilation processing apparatus, characterized in that, include: The module creates three dynamic arrays in the form of class objects: the first dynamic array, the second dynamic array, and the third dynamic array. The traversal module is used to traverse each Java Card bytecode and dynamically fill the Java Card bytecode and the converted Java bytecode information into the first dynamic array, the second dynamic array, and the third dynamic array based on the opcode and operand of the Java Card bytecode; The conversion module is used to read Java Card bytecode from the dynamic array sequentially and perform link address conversion mapping of Java Card bytecode to achieve decompilation of Java Card bytecode; Wherein, the first dynamic array is used to store information about Java Card bytecode, the second dynamic array is used to store information about Java Card bytecode and information about the corresponding Java bytecode generated after conversion, and the third dynamic array is used to store information about the Java bytecode generated after conversion; in, The first dynamic array includes four members: the first member is the opcode corresponding to the Java Card bytecode, the second member is operand 1, the third member is operand 2, and the fourth member is operand 3. The second dynamic array includes two members: the first member is an object instance of the corresponding first dynamic array type, and the second member is a dynamic array of the storage class third dynamic array type. The third dynamic array includes three members: the first member is the opcode of the Java bytecode generated after Java Card bytecode conversion; the second member is a dynamic array storing the operands of the Java bytecode generated after Java Card bytecode conversion; and the third member is the number of bytes occupied by the converted Java bytecode and its corresponding operands.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the decompilation processing method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the decompilation processing method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and device for generating Java Card program library target code based on standard tool
CN101751247A
Application format conversion method and device, equipment and storage medium
CN114327482A