Protection method, device, equipment and storage medium
By stealthily writing copyright information into Java bytecode files, the problem of difficulty in protecting the copyright of bytecode files and proving ownership in the prior art is solved, thereby achieving effective protection of bytecode files.
Patent Information
- Application Number
- CN202111128993.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-26
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-09-26
AI Technical Summary
Existing technologies are difficult to effectively protect the copyright of Java bytecode files, and it is difficult to prove the ownership of pirated and misappropriated code. Existing DRM systems cannot completely prevent piracy and code theft.
The copyright information is converted into binary form, the target bytecode file is determined, and the stack value of its method is updated to write the copyright information into the bytecode file in a steganographic manner.
The bytecode file's anti-attack capability is enhanced, and the copyright ownership of the code file can be proven through the written copyright information after piracy or modification, thereby protecting copyright.
Smart Images

Figure CN113868603B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of bytecode file steganography technology, and in particular to a protection method, apparatus, device and storage medium. Background Art
[0002] With the rapid spread of the internet, the rapid growth of data volumes and user numbers, and the increasing competition among internet companies, software code is a resource that every internet company strives to protect. If core software code is stolen, the company suffers significant losses. After Java files are written, they are compiled into bytecode files, which are then compiled by the class loader at startup. However, bytecode files are highly susceptible to decompilation, making core business programs easily cracked, leading to the development of pirated software.
[0003] Common protection methods currently used include encrypting bytecode files, injecting invalid code, and obfuscating the code to prevent decompilation. Obfuscated code is difficult to decompile, meaning the resulting code is extremely difficult to understand and cryptic, making it difficult for decompilers to derive the true semantics of the program.
[0004] Existing technologies simply encrypt or perform other operations on bytecode files to prevent decompilation, but bytecode files can still be used by rival companies. Proving ownership of bytecode files is difficult and requires specialized comparisons, which consumes significant resources and effort. Existing DRM systems protect file copyrights by invoking DRM interfaces to obtain installation copyright status. These systems, however, only determine whether a user has installed or has permission to run the software. Therefore, they cannot completely prevent piracy and code theft, and it is even more difficult to prove ownership of pirated or misappropriated code. Summary of the Invention
[0005] The embodiments of the present invention provide a protection method, apparatus, device and storage medium, so as to achieve the purpose of protecting copyright by writing copyright information into bytecode files, thereby enhancing the anti-attack capability of steganography.
[0006] In a first aspect, an embodiment of the present invention provides a protection method, including:
[0007] Convert the copyright information into binary format to obtain the target data;
[0008] Determine at least one target bytecode file in the jar package according to the target data;
[0009] The stack value of the method in the at least one target bytecode file is updated according to the target data.
[0010] In a second aspect, an embodiment of the present invention further provides a protection device, comprising:
[0011] A conversion module, used for converting copyright information into binary format to obtain target data;
[0012] A determination module, configured to determine at least one target bytecode file in a jar package according to the target data;
[0013] An updating module is configured to update a stack value of a method in the at least one target bytecode file according to the target data.
[0014] In a third aspect, an embodiment of the present invention further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the protection method as described in any one of the embodiments of the present invention is implemented.
[0015] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the protection method as described in any one of the embodiments of the present invention.
[0016] The present invention enhances steganographic attack resistance by writing copyright information into the bytecode file, thereby achieving the purpose of protecting copyright. By using steganography to write copyright information into the bytecode file, even if other companies use the file or modify it, they can still easily prove the copyright ownership of the code file through the written copyright information. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 This is a flow chart of a protection method provided in Example 1 of the present invention;
[0019] Figure 2 This is a flowchart of an implementation of a protection method provided in Example 1 of the present invention;
[0020] Figure 3 This is a schematic structural diagram of a protection device provided in the second embodiment of the present invention;
[0021] Figure 4 This is a schematic structural diagram of an electronic device provided by Embodiment 3 of the present invention;
[0022] Figure 5 This is a structural diagram of a computer-readable storage medium containing a computer program provided in a fourth embodiment of the present invention. DETAILED DESCRIPTION
[0023] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It will be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all of the structures. Furthermore, the embodiments of the present invention and the features of the embodiments may be combined with one another unless otherwise specified.
[0024] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. When its operation is completed, the process can be terminated, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the features in the embodiments of the present invention and the embodiments can be combined with each other without conflict.
[0025] The term "including" and its variations used in the present invention are open inclusions, that is, "including but not limited to." The term "based on" means "based at least in part on." The term "one embodiment" means "at least one embodiment."
[0026] It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are used only to distinguish the description and should not be understood as indicating or implying relative importance.
[0027] Example 1
[0028] Figure 1 This is a flow chart of a protection method provided by the first embodiment of the present invention. This embodiment is applicable to the protection situation. The method can be executed by the protection device in the embodiment of the present invention. The device can be implemented in software and / or hardware. Figure 1 As shown, the method specifically includes the following steps:
[0029] S101. Convert copyright information into binary format to obtain target data.
[0030] In this embodiment, copyright information can be understood as a digital copyright secret that is custom-written by the developer and written into the code file to prove the copyright ownership of the code file. Copyright information can be a number, a word composed of letters, or some custom symbols. For example, copyright information can be a word W composed of the phonetic letters of the abbreviation of a company name. The length of word W can be L. For example, word W can be cr, in which case the length L corresponding to cr is 2.
[0031] The binary conversion may be performed by representing each letter in the copyright information with a five-bit binary number. For example, the letter c is the third letter in the alphabet, and its five-bit binary representation is 00011 (decimal 3). The letter r is the 18th letter, and its binary representation is 10010 (decimal 18).
[0032] It should be noted that the target data refers to the binary number obtained by binary conversion of the copyright information. For example, the binary representation of cr is 0001110010.
[0033] When the words in the copyright information are converted into binary, English contains a total of 26 letters, and five bits of binary can represent 32 letters. Therefore, in addition to letters, 6 custom symbols can also be supported.
[0034] S102: Determine at least one target bytecode file in the jar package according to the target data.
[0035] It should be noted that a jar (Java Archive) package can be understood as a pre-existing executable file package in zip format that can be directly called. Common classes are referenced during development, packaged for easier storage and management, and can be used directly later. In this embodiment, the jar package specifically refers to a jar package that has been processed to prevent decompilation.
[0036] The target bytecode file, also known as the target class file, refers to at least one class file in the JAR file corresponding to the target data. A Java bytecode class file (.class) is the "target file" generated by the Java compiler when compiling a Java source file (.java). It is the Java executable file.
[0037] After determining the copyright information, the target data is obtained, and the bytecode file to be inserted into the jar package is determined based on the target data. There may be one or more bytecode files, which are not limited in this embodiment.
[0038] S103: Update the stack value of the method in at least one target bytecode file according to the target data.
[0039] It should be noted that the stack value can also be called the stack value, which is the value of the minimum stack depth required for calculating the implementation method during the JVM (Java Virtual Machine) compilation process.
[0040] The target bytecode file is updated according to the target data, specifically the stack value of the method contained in the target bytecode file is updated.
[0041] Optionally, determining at least one target bytecode file in the jar package according to the target data includes:
[0042] Determine the target quantity based on the length of the target data.
[0043] For example, the target number can be calculated as L*5, where L is the length L of the copyright information word W in step S101. Since the specific method of binary conversion in step S101 is to represent each letter with a five-bit binary number, the target number can be calculated as L*5.
[0044] Get the target bytecode file in the jar package that contains a method number greater than or equal to the target number.
[0045] Specifically, a target bytecode file containing methods greater than or equal to L*5 in the jar package is obtained, and the length of the target bytecode file is ensured to be greater than the target number.
[0046] Accordingly, updating a stack value of a method in at least one target bytecode file according to the target data includes:
[0047] If there is only one target bytecode file, the stack value of the method in the target bytecode file is updated according to the target data.
[0048] For example, in actual operation, if there is only one target bytecode file that meets the target quantity in the jar package, the stack value of the method in the target bytecode file is updated according to the target data.
[0049] If there are at least two target bytecode files, an average change rate ACR of the at least two target bytecode files is obtained, and the stack value of the method in the target bytecode file with the smallest ACR is updated according to the target data.
[0050] It should be noted that ACR is the abbreviation of average change rate.
[0051] For example, in actual operation, if there are at least two target bytecode files in the jar package, the average change rate ACR of each target bytecode file is obtained, the average change rate ACR of each target bytecode file is compared, and the stack value of the method in the target bytecode file with the smallest ACR is updated according to the target data.
[0052] Optionally, updating the stack value of the method in the target bytecode file according to the target data includes:
[0053] The stack values of the methods in the target bytecode file are arranged in descending order.
[0054] Exemplarily, in actual operation, all methods contained in the target bytecode file determined according to the target data are sorted from largest to smallest according to the stack value (ie, stack value) of the method.
[0055] Increment the stack value corresponding to the position of the first value in the target data by one.
[0056] It should be explained that the first value specifically refers to the value 1 in the target data represented by the binary number obtained by performing binary conversion on the copyright information.
[0057] Specifically, the addition operation can be understood as adding 1 to the first value. This operation consumes only negligible resources relative to the overall value, but it can better protect the bytecode file. Furthermore, when the bytecode file contains complex methods, the large cardinality makes it difficult to detect that the stack value has been modified. The stack value corresponding to the position with a value of 0 in the target data is not modified.
[0058] For example, in actual operation, the copyright information may be cr, and the target data obtained after binary conversion is 0001110010, and the corresponding target quantity is 2*5=10. Assuming that the bytecode file 1.class corresponding to c contains 6 methods, and the bytecode file 2.class corresponding to r contains 5 methods, then the target bytecode file corresponding to the target data contains a total of 11 methods, which is greater than the target quantity of 10. These 11 methods are sorted from largest to smallest according to their stack values (i.e., stack values), and the stack values of the 4th, 5th, 6th, and 9th methods (the positions with 1 in 0001110010) are incremented by one.
[0059] Optionally, obtaining an average change rate (ACR) of at least two target bytecode files includes:
[0060] An average change rate ACR of the at least two target bytecode files is determined according to the number of methods in the at least two target bytecode files, stack values of the methods in the at least two target bytecode files, and the target data.
[0061] For example, in actual operation, assuming that the target bytecode file contains n methods, the stack values of the n methods are sorted by size and recorded as S1 to S2. n The total length of the target data obtained after the copyright information is converted into binary is recorded as K, K = 5 * L, and the value of each bit of the binary target data is recorded as B1~B K (0 or 1).
[0062] The calculation formula for the average change rate ACR of at least two target bytecode files is:
[0063]
[0064] Where n represents the number of methods in at least two target bytecode files, S i Represents the stack values of at least two methods in the target bytecode file, B i Indicates the value of each bit of the target data, and K indicates the total length of the target data.
[0065] Optionally, the copyright information includes: at least two pieces of information to be inserted;
[0066] For example, the information to be inserted may be word information included in the copyright information. For example, the copyright information may include two pieces of information to be inserted, the two pieces of information to be inserted may be word A and word B, word A may be composed of letters cr, and word B may be composed of letters ab.
[0067] Accordingly, the copyright information is converted into binary format, and the target data obtained includes:
[0068] At least two pieces of information to be inserted are binary-converted to obtain at least two pieces of data to be inserted, and the at least two pieces of data to be inserted are sequentially determined as target data.
[0069] Exemplarily, during operation, for example, copyright information may include two pieces of information to be inserted, the two pieces of information to be inserted being, for example, word A and word B. Word A may be composed of the letters cr, and word B may be composed of the letters ab. The two pieces of information to be inserted are converted into binary. The letter c is the third letter in the alphabet, and its five-bit binary representation is 00011 (decimal 3). The letter r is the 18th letter in the alphabet, and its binary representation is 10010 (decimal 18). Therefore, the data to be inserted for the information word A to be inserted is 0001110010. The letter a is the first letter in the alphabet, and its five-bit binary representation is 00001 (decimal 1). The letter b is the second letter in the alphabet, and its binary representation is 00010 (decimal 2). Therefore, the data to be inserted for the information word B to be inserted is 0000100010. The two pieces of data to be inserted, 0001110010 and 0000100010, are sequentially determined as target data.
[0070] Exemplarily, in the actual operation process, the copyright information to be inserted may contain multiple words, or the operator may split the copyright information word into multiple words for insertion, so as to enhance the anti-attack property of steganography and achieve the purpose of better protecting copyright. The specific operation process of inserting multiple information to be inserted into the bytecode file can be illustrated by taking the following example where the copyright information to be inserted contains two words A and B, or the operator splits the copyright information word into two words A and B for insertion. The order in which word A and word B are inserted into the target bytecode file can be determined according to the order in which the words appear, such as if word A appears first, word A is inserted first, or it can be determined according to the length of the words to be inserted, such as inserting the long word first and then the short word, or inserting the short word first and then the long word. This embodiment does not limit this. The following is illustrated by taking the example of inserting word A first.
[0071] As an exemplary description of the present embodiment, a certain company CRAB carries out copyright protection for a certain Java program under its umbrella. The specific method is to insert copyright information into the bytecode file of the jar package after preventing decompilation. The copyright information can be the company's full spelling "crab". The word "crab" can be split into two words A and B. Word A can be "cr" and word B can be "ab". Of course, the word "crab" can also be split into individual letters. The method of inserting letters into the bytecode file is the same as the method of inserting words into the bytecode file, which will not be repeated here. Here, the insertion of word A (cr) and word B (ab) is used as an example.
[0072] You can insert word A(cr) first. The specific operation is to first perform binary conversion on word A(cr) to obtain the target data 0001110010 (the specific method is as described above and will not be repeated here). Then, determine whether there is a bytecode file in the jar package that contains more than or equal to 10 methods (the length of word A is 2, 2*5=10), and determine the bytecode file that meets the conditions as the target bytecode file. If there is only one target bytecode file, insert word A(cr) into the target bytecode file; if there are at least two target bytecode files, obtain the average change rate ACR of at least two target bytecode files, and insert word A(cr) into the target bytecode file with the smallest ACR.
[0073] After word A (cr) is inserted into the target bytecode file, the target bytecode file is removed from the bytecode file pile, and word B (ab) is inserted. The method and steps for inserting word B (ab) are the same as those for inserting word A (cr), so they will not be repeated here.
[0074] Optionally, before determining at least one target bytecode file in the jar package according to the target data, the method further includes:
[0075] Store all bytecode files in the jar package into the bytecode file pile.
[0076] It should be noted that the bytecode file pile may be a file pile consisting of all bytecode files in a jar package. Before determining at least one target bytecode file in the jar package according to the target data, all bytecode files in the jar package are stored in the bytecode file pile.
[0077] Accordingly, after updating the stack value of the method in at least one target bytecode file according to the target data, the method further includes:
[0078] Move the updated target bytecode file out of the bytecode file pile.
[0079] Specifically, after the stack value of the method in at least one target bytecode file is updated according to the target data, the updated target bytecode file is moved out of the bytecode file stack.
[0080] Optionally, determining at least one target bytecode file in the jar package according to the target data includes:
[0081] At least one target bytecode file in the bytecode file pile is determined according to the target data.
[0082] Specifically, all bytecode files in the jar package are stored in a bytecode file pile, and at least one target bytecode file in the bytecode file pile is determined according to the target data.
[0083] The present invention enhances steganographic attack resistance by writing copyright information into the bytecode file, thereby achieving the purpose of protecting copyright. By using steganography to write copyright information into the bytecode file, even if other companies use the file or modify it, they can still easily prove the copyright ownership of the code file through the written copyright information.
[0084] As an exemplary description of this embodiment, Figure 2 This is a flow chart of an implementation of a protection method provided in the first embodiment of the present invention. This embodiment is applicable to protection situations. The method can be executed by the protection device in the embodiment of the present invention, and the device can be implemented in software and / or hardware.
[0085] like Figure 2 As shown, a flowchart of an implementation of a protection method provided in Embodiment 1 of the present invention specifically includes the following operations:
[0086] Scan all bytecode files in the jar package that has been processed to prevent decompilation, put them into the bytecode file pile, and sort the bytecode files from large to small according to the number of methods they contain.
[0087] The copyright information is determined, and the word length L of the copyright information is calculated.
[0088] Convert the copyright information into binary format to obtain the target data.
[0089] It is determined based on the target data whether there is at least one target bytecode file containing methods whose number is greater than or equal to L*5.
[0090] If it does not exist, determine whether the sum of the number of methods contained in all target bytecode files is greater than or equal to L*5.
[0091] If the total number of methods in all target bytecode files is less than L*5, it is recommended to abbreviate the copyright information or preprocess the copyright information to convert it to the required length. Then, return to step "Determine the copyright information and calculate the copyright information word length L" to continue.
[0092] If the sum of the number of methods contained in all target bytecode files is greater than or equal to L*5, then all methods protected by all target bytecode files are sorted from largest to smallest according to the stack value, the stack value corresponding to the position where the target data is the first value is incremented by one, the stegoscopy information is recorded, and the program exits.
[0093] If there is at least one target bytecode file containing a number of methods greater than or equal to L*5, the stack values of the methods contained in each target bytecode file that meets the requirements will be sorted from large to small, and the average change rate ACR of at least each target bytecode file will be determined based on the number of methods in each target bytecode file, the stack value of the method in each target bytecode file, and the target data.
[0094] Sort the ACR values of all target bytecode files, select the target bytecode file with the smallest ACR value, write the copyright information, record the stego information, and remove the target bytecode file from the bytecode file pile.
[0095] Determine whether all the information to be entered and exited contained in the copyright information has been inserted.
[0096] If there is information to be inserted, return to step "determine the copyright information and calculate the word length L of the copyright information" and continue to perform operations until all copyright information is inserted; if there is no information to be inserted, exit and the process ends.
[0097] Existing technologies only protect bytecode files from decompilation, but these files and programs can still be used by rival companies. Proving the ownership of bytecode files is difficult, requiring specialized comparisons and significant effort. Existing DRM systems protect file copyrights by invoking DRM interfaces to obtain installation copyright status. However, this only determines whether a user has installation or execution permissions, and the key cannot be guaranteed to be crack-proof. Therefore, it cannot completely prevent piracy and code theft, and it is even more difficult to prove the ownership of pirated or misappropriated code.
[0098] The present invention builds upon existing bytecode file anti-decompilation capabilities by writing digital copyright information. Using an algorithm, the system minimizes overall changes to the JAR package. It also offers both single-file and multi-file writing methods to enhance steganographic attack resistance. By using steganography to secretly write digital copyright information into the bytecode file, even if other companies use the file, even modified versions, the written digital copyright information can easily prove the copyright ownership of the code file.
[0099] Example 2
[0100] Figure 3 This is a schematic diagram of the structure of a protection device provided by the second embodiment of the present invention. This embodiment is applicable to the case of protection. The device can be implemented in software and / or hardware. The device can be integrated into any device that provides protection functions, such as Figure 3 As shown, the protection device specifically includes: a conversion module 201, a determination module 202 and an update module 203.
[0101] The determining module 202 may include:
[0102] a determining unit, configured to determine a target quantity according to a length of the target data;
[0103] An acquisition unit is used to acquire a target bytecode file in a jar package whose number of methods is greater than or equal to a target number;
[0104] Accordingly, the updating module 203 may include:
[0105] a first updating unit, configured to update a stack value of a method in the target bytecode file according to the target data if there is only one target bytecode file;
[0106] The second updating unit is configured to obtain an average change rate ACR of the at least two target bytecode files if there are at least two target bytecode files, and update the stack value of the method in the target bytecode file with the smallest ACR according to the target data.
[0107] Furthermore, the first updating unit may include:
[0108] a sorting subunit, configured to arrange the stack values of the methods in the target bytecode file in descending order;
[0109] The operation subunit is used to add one to the stack value corresponding to the position of the first value in the target data.
[0110] Furthermore, the second updating unit is specifically configured to:
[0111] An average change rate ACR of the at least two target bytecode files is determined according to the number of methods in the at least two target bytecode files, stack values of the methods in the at least two target bytecode files, and the target data.
[0112] Furthermore, the copyright information in the conversion module 201 includes: at least two pieces of information to be inserted;
[0113] Accordingly, the copyright information is converted into binary format, and the target data obtained includes:
[0114] At least two pieces of information to be inserted are binary-converted to obtain at least two pieces of data to be inserted, and the at least two pieces of data to be inserted are sequentially determined as target data.
[0115] Furthermore, before determining at least one target bytecode file in the jar package according to the target data, the method further includes:
[0116] Store all bytecode files in the jar package into the bytecode file pile;
[0117] Accordingly, after updating the stack value of the method in the at least one target bytecode file according to the target data, the method further includes:
[0118] Move the updated target bytecode file out of the bytecode file pile.
[0119] Further, determining at least one target bytecode file in the jar package according to the target data includes:
[0120] At least one target bytecode file in the bytecode file pile is determined according to the target data.
[0121] The above-mentioned product can execute the method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0122] The present invention enhances steganographic attack resistance by writing copyright information into the bytecode file, thereby achieving the purpose of protecting copyright. By using steganography to write copyright information into the bytecode file, even if other companies use the file or modify it, they can still easily prove the copyright ownership of the code file through the written copyright information.
[0123] Example 3
[0124] Figure 4 This is a structural diagram of an electronic device provided in Example 3 of the present invention. Figure 4 A block diagram of an electronic device 312 suitable for implementing embodiments of the present invention is shown. Figure 4 The electronic device 312 shown is merely an example and should not limit the functionality and scope of use of the embodiments of the present invention. The device 312 is a typical computing device with protection functions.
[0125] like Figure 4 As shown, electronic device 312 is implemented as a general purpose computing device. Components of electronic device 312 may include, but are not limited to, one or more processors 316, storage device 328, and a bus 318 connecting various system components (including storage device 328 and processor 316).
[0126] Bus 318 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. Examples of these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0127] The electronic device 312 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 312, including volatile and non-volatile media, removable and non-removable media.
[0128] The storage device 328 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 330 and / or cache memory 332. The electronic device 312 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 334 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 Not shown, often called a "hard drive"). Although Figure 4 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a floppy disk) and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a Compact Disc-Read Only Memory (CD-ROM), a Digital Video Disc-Read Only Memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 318 via one or more data media interfaces. Storage device 328 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various embodiments of the present invention.
[0129] A program 336 having a set (at least one) of program modules 326 may be stored, for example, in a storage device 328. Such program modules 326 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may include an implementation of a network environment. Program modules 326 generally implement the functions and / or methods of the embodiments described herein.
[0130] The electronic device 312 can also communicate with one or more external devices 314 (e.g., a keyboard, pointing device, camera, display 324, etc.), one or more devices that enable a user to interact with the electronic device 312, and / or any device that enables the electronic device 312 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). This communication can occur via an input / output (I / O) interface 322. Furthermore, the electronic device 312 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 320. As shown, the network adapter 320 communicates with other modules of the electronic device 312 via a bus 318. It should be understood that, although not shown, other hardware and / or software modules can be used in conjunction with the electronic device 312, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Arrays of Independent Disks (RAID) systems, tape drives, and data backup storage systems.
[0131] The processor 316 executes various functional applications and data processing by running the programs stored in the storage device 328, such as implementing the protection method provided by the above embodiment of the present invention.
[0132] Example 4
[0133] Figure 5 This is a schematic diagram of the structure of a computer-readable storage medium containing a computer program in a fourth embodiment of the present invention. This embodiment of the present invention provides a computer-readable storage medium 61 on which a computer program 610 is stored. When the program is executed by one or more processors, it implements the protection method provided in all the embodiments of the present invention:
[0134] Convert the copyright information into binary format to obtain the target data;
[0135] Determine at least one target bytecode file in the jar package according to the target data;
[0136] The stack value of the method in the at least one target bytecode file is updated according to the target data.
[0137] Any combination of one or more computer-readable media can be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in combination with an instruction execution system, device or device.
[0138] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0139] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0140] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0141] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0142] The computer program code for performing the operations of the present invention can be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, 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 can be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0143] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0144] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0145] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0146] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0147] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will appreciate that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions are possible for those skilled in the art without departing from the scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of the present invention. The scope of the present invention is determined by the scope of the appended claims.
Claims
1. A protection method, characterized in that: include: Convert the copyright information into binary format to obtain the target data; Determine at least one target bytecode file in the jar package according to the target data; updating a stack value of a method in the at least one target bytecode file according to the target data; Wherein, determining at least one target bytecode file in the jar package according to the target data includes: determining a target quantity according to the length of the target data; Get the target bytecode file whose number of methods in the jar package is greater than or equal to the target number; Accordingly, updating the stack value of the method in the at least one target bytecode file according to the target data includes: If there is only one target bytecode file, updating the stack value of the method in the target bytecode file according to the target data; If there are at least two target bytecode files, obtaining an average change rate ACR of the at least two target bytecode files, and updating the stack value of the method in the target bytecode file with the smallest ACR according to the target data; The calculation formula for the average change rate ACR of at least two target bytecode files is: Where n represents the number of methods in at least two target bytecode files, S i Represents the stack values of at least two methods in the target bytecode file, B i Indicates the value of each bit of the target data, and K indicates the total length of the target data.
2. The method according to claim 1, characterized in that Updating the stack value of the method in the target bytecode file according to the target data includes: Arrange the stack values of the methods in the target bytecode file in descending order; Increment the stack value corresponding to the position of the first value in the target data by one.
3. The method according to claim 1, characterized in that The copyright information includes: at least two pieces of information to be inserted; Accordingly, the copyright information is converted into binary format, and the target data obtained includes: At least two pieces of information to be inserted are binary-converted to obtain at least two pieces of data to be inserted, and the at least two pieces of data to be inserted are sequentially determined as target data.
4. The method according to claim 3, characterized in that Before determining at least one target bytecode file in the jar package according to the target data, the method further includes: Store all bytecode files in the jar package into the bytecode file pile; Accordingly, after updating the stack value of the method in the at least one target bytecode file according to the target data, the method further includes: Move the updated target bytecode file out of the bytecode file pile.
5. The method according to claim 4, characterized in that Determining at least one target bytecode file in the jar package according to the target data includes: At least one target bytecode file in the bytecode file pile is determined according to the target data.
6. A protection device, characterized in that: include: A conversion module, used for converting copyright information into binary format to obtain target data; A determination module, configured to determine at least one target bytecode file in a jar package according to the target data; an updating module, configured to update a stack value of a method in the at least one target bytecode file according to the target data; The determination module includes: a determining unit, configured to determine a target quantity according to a length of the target data; An acquisition unit is used to acquire a target bytecode file in a jar package whose number of methods is greater than or equal to a target number; Accordingly, the update modules include: a first updating unit, configured to update a stack value of a method in the target bytecode file according to the target data if there is only one target bytecode file; a second updating unit configured to obtain an average change rate ACR of the at least two target bytecode files if there are at least two target bytecode files, and update a stack value of a method in the target bytecode file with the smallest ACR according to the target data; The calculation formula for the average change rate ACR of at least two target bytecode files is: Where n represents the number of methods in at least two target bytecode files, S i Represents the stack values of at least two methods in the target bytecode file, B i Indicates the value of each bit of the target data, and K indicates the total length of the target data.
7. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the processors are enabled to implement the method according to any one of claims 1 to 5.
8. A computer-readable storage medium containing a computer program, wherein the computer program is stored thereon, characterized in that: When the program is executed by one or more processors, the method according to any one of claims 1 to 5 is implemented.