CN114722359B - Java source code protection method based on custom class loader - Google Patents
Java source code protection method based on custom class loader Download PDFInfo
- Publication number
- CN114722359B CN114722359B CN202210365175.7A CN202210365175A CN114722359B CN 114722359 B CN114722359 B CN 114722359B CN 202210365175 A CN202210365175 A CN 202210365175A CN 114722359 B CN114722359 B CN 114722359B
- Authority
- CN
- China
- Prior art keywords
- file
- mixed
- encrypted
- encryption
- byte code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000012795 verification Methods 0.000 claims abstract description 12
- 230000000739 chaotic effect Effects 0.000 claims description 29
- 239000011159 matrix material Substances 0.000 claims description 26
- 238000009792 diffusion process Methods 0.000 claims description 20
- 238000013507 mapping Methods 0.000 claims description 20
- 238000004422 calculation algorithm Methods 0.000 claims description 4
- 238000004364 calculation method Methods 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 claims description 3
- 230000001172 regenerating effect Effects 0.000 claims description 3
- 230000004888 barrier function Effects 0.000 description 10
- 230000008569 process Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000002265 prevention Effects 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000000052 comparative effect Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/10—Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
- G06F21/12—Protecting executable software
- G06F21/14—Protecting executable software against software analysis or reverse engineering, e.g. by obfuscation
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Technology Law (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
The invention discloses a Java source code protection method based on a custom class loader, which comprises the following steps: generating a class byte code file from a class source code file to be encrypted in a Java item; encrypting the class byte code file to generate a target encrypted file and a mixed encrypted file; generating a custom class loader capable of loading the target encrypted file, wherein the custom class loader and the official class loader are the same in name; generating an confusion byte code file which has the same name as the class byte code file to be encrypted and has the same verification characteristic of the byte code device; generating a mixed encryption file by using the first mixed encryption file, the target encryption file and the second mixed encryption file in a logical encryption mode; writing the mixed encryption file into the mixed byte code file with a string type constant; and replacing the class byte code file to be encrypted and the official class loader in the Java item by the confusion byte code file and the custom class loader. The invention has the advantages of high safety and strong confusion for Java source codes.
Description
Technical Field
The invention relates to a Java source code method, in particular to a Java source code protection method based on a custom class loader.
Background
Java, a widely used programming language, plays an increasingly important role in the field of computer technology. However, due to the openness and platform independence of the Java language, java code is not directly compiled into binary executable code, but is compiled into class (class) files, which can be easily decompiled into source code, so that a program written in Java can be easily broken, and application logic is leaked or illegally used. However, due to the commercial demands, the intellectual property of the codes needs to be protected, which contradicts the open type of Java codes, so that the technology of each decompilation is endless. The existing Java source code decompiling prevention technology has a Java class program isolation technology, in the technology, because Java codes are compiled into class files to be executed, a Java decompiling prevention method is to prohibit a user from accessing the Java class programs and prevent the user from touching the class files, so that the purpose of protecting knowledge products is achieved.
Code obfuscation is the act of transforming the code of a computer program into a functionally equivalent, but difficult to read and understand form. Code obfuscation may be used for program source code, or intermediate code compiled from sequences. A program that performs code obfuscation is called a code obfuscator. Code obfuscation, however, is merely a difficulty setting for human reading and understanding, and may still be decompiled by decompiling tools into source code that is readable by humans. The byte code encryption is to encrypt the class byte code file directly by an encryption algorithm, store and operate the encrypted byte code file, and the encrypted byte code file cannot be directly identified and operated by a Java Virtual Machine (JVM), so that the user-defined class loader can normally operate after dynamically decrypting the byte code file in a class loading stage by the user-defined class loader or combining with a Java virtual machine tool interface technology. In the related art, one commonly used method for encrypting and decrypting the Java bytecode class file is to encrypt the class bytecode file in an asymmetric encryption manner.
The prior art, such as the Chinese patent with publication number CN112115429B, discloses a Java class encryption and decryption method and a computer readable storage medium, and the patent comprises a Java class encryption method which comprises the steps of generating a secret key; encrypting the first byte code class file by using the key to obtain a first byte code class file ciphertext; generating a second byte code class file which is the same with the first byte code class file in name and the scanning characteristic, wherein the scanning characteristic enables a Java framework to scan the second byte code class file as the first byte code class file through a byte code tool before a class loader loads the byte code class file in a Java application starting stage; writing the ciphertext of the first byte code class file into the second byte code class file in a character string type constant; and replacing the first byte code class file with the second byte code class file.
Disclosure of Invention
The invention aims to provide a Java source code protection method with high safety and strong confusion aiming at the prior art. It comprises the following steps: generating a class byte code file from a class source code file to be encrypted in a Java item through a compiler; generating a target encrypted file by using a mixed encryption method for the class byte code file, wherein the first mixed encrypted file and the second mixed encrypted file; generating a custom class loader capable of loading the target encrypted file, wherein the custom class loader and the official class loader are the same in name; generating an confusion byte code file which has the same name as the class byte code file to be encrypted and has the same verification characteristic of the byte code device; generating a mixed encryption file by using the first mixed encryption file, the target encryption file and the second mixed encryption file in a logical encryption mode; writing the mixed encryption file into the mixed byte code file with a string type constant; and replacing the class byte code file to be encrypted and the official class loader in the Java item by the confusion byte code file and the custom class loader. The Java program is built from a source file to the program operation, the files are compiled into byte codes by a compiler and then interpreted and operated by a JVM (Java virtual machine), the byte code files are firstly verified by a byte code verifier when the JVM operates in a Java operation environment, the byte code files are loaded by a class loader after verification is passed, then local codes are generated, and the generated mixed source code files have the same names and the same verification characteristics as the class byte code files to be encrypted, so that the mixed source code files can pass the verification of the byte code verifier, and the mixed byte code files are not true source codes and can be used as a first protection barrier; after the mixed encryption file is extracted from the mixed byte code file, the first mixed encryption file is firstly required to be re-extracted in a logic decryption mode corresponding to logic encryption, and the target encryption file and the second mixed encryption file can be used as a second channel protection barrier; only the target encrypted file in the first mixed encrypted file and the target encrypted file in the second mixed encrypted file is the real source code after being broken by the custom class loader, and the other two are used as mixed options to further obstruct the breaking, so that the third protection barrier can be used. The three protection barriers can be used for protecting Java source codes with high safety and strong confusion.
The method for writing the mixed encryption file into the mixed byte code file by using the character string type constant comprises the following steps: setting a plurality of character string type constant fields in the mixed byte code file; and splitting the mixed encryption file and writing a plurality of character string type constant fields. The mixed byte code file is not real source code, only a plurality of character string type constant fields are combined to form a mixed encryption file containing a real target encryption file, and the mixed byte code file written by the mixed encryption file is protected by the character string type constant fields.
Extracting and splicing a plurality of character string type constant fields of the mixed byte code file during decoding to generate a mixed encryption file; regenerating a target encrypted file by adopting a corresponding logic decryption method for the mixed encrypted file, wherein the first mixed encrypted file and the second mixed encrypted file are mixed;
The custom class loader comprises a decryption method corresponding to the encryption mode of the target encrypted file, and can decrypt the target encrypted file and load the class. In order to prevent the source code file from being decompiled easily, after the class byte code file is encrypted, the class can be only decrypted by a special class loading mode and loaded into the memory, and a custom class loader comprising a decryption method corresponding to the encryption mode of the target encrypted file firstly decrypts the target encrypted file to restore the class byte code, then loads the class into the memory and normally operates the JAVA program.
The confusion encryption method comprises the following steps: generating a byte code file from a class source code file to be encrypted through a compiler; generating digital information to be encrypted by using an ASCII coding mode to the byte code file; random sequence generation by adopting sine chaotic mapping mode:
Length of the generated sequence LAnd/>May be any positive integer value less than the total length of the digital information to be encrypted,Inputting a random sequence L into a Joseph function/>Processing the digital information to be encrypted in a variable step size Joseph traversal mode: all elements in the digital information to be encrypted are enclosed into a circle, the circle is traversed in sequence, and the/>Step size/>, when using numbersI.e. from the/>The number starts to calculate the traversal/>Number is taken as the/>Numbers to be deleted, by looping until the/>Ending after the number is counted, and obtaining digital information after the step-length-variable Joseph encryption; generating/>, by using digital information after variable step length Joseph encryptionMatrix as matrix to be encrypted/>,/>Is a positive integer, and then generates an initial value of the chaotic system, and the specific method comprises the following steps: generating hash value/>, using keccak algorithm, on variable step size joseph encrypted digital information,/>256 Bits in length, divided into 32 groups of 8 bits each, note/>Then calculating the initial value/>, of the chaotic system,/>,/>The calculation method comprises the following steps:
Expressed as a downward rounding,/> Expressed as absolute value,/>,/>,/>To calculate intermediate values,/>For a given integer value. To/>,/>,/>Generating 3 length-of-/>, as initial value of chaotic system, by using sine chaotic mapping modeRandom sequence/>,/>,Wherein:
3 random sequences/> Conversion to 3/>Diffusion matrix of (a); Using 3 diffusion matrices/>Performing diffusion encryption on matrix P to be encrypted to generate diffusion encryption matrix/>:
Represents the ith row of the encryption matrix,/>Represents the j-th column of the encryption matrix,/>,/>,/>. Will/>And/>Generating a first mixed encrypted file and a second mixed encrypted file respectively, wherein/>And generating a target encrypted file. The mathematical expression of the typical Logistic mapping is simple but the dynamics characteristic is complex, so that the Logistic mapping is often used as a chaotic encryption method, sine feedback is introduced into the classical Logistic mapping by the sine chaotic mapping, and the randomness of the generated sequence can be further enhanced by forming a new mapping relation; the sequence L generated by the sine chaotic mapping is used as the input of a variable step length Joseph traversal mode to process the digital information to be encrypted, the step length is in continuous change, and the digital information to be encrypted can be fully scrambled, so that the original information characteristics of the digital information to be encrypted are completely lost; the initial value generation mode of the chaotic system is based on digital information after Joseph encryption, the sinusoidal chaotic mapping is based on three new random sequences generated by three chaotic system initial values, so that the confusion of the information is further enhanced, three random sequence generation diffusion matrixes are used for carrying out diffusion encryption on a matrix P to be encrypted to generate first confusion encryption files respectively, second confusion encryption files and target encryption files, three encryption files generated after multiple encryption of an input source code file have extremely low similarity with a source file, decryption difficulty is extremely high, the three encryption files have certain similar characteristics due to the similarity of encryption processes, the confusion is strong, and the three encryption files can be used as confusion items to generate misleading to illegal decryption, so that barriers are increased.
The invention adopts the method that class source code files to be encrypted in Java items generate class byte code files through a compiler; generating a target encrypted file by using a mixed encryption method for the class byte code file, wherein the first mixed encrypted file and the second mixed encrypted file; generating a custom class loader capable of loading the target encrypted file, wherein the custom class loader and the official class loader are the same in name; generating an confusion byte code file which has the same name as the class byte code file to be encrypted and has the same verification characteristic of the byte code device; generating a mixed encryption file by using the first mixed encryption file, the target encryption file and the second mixed encryption file in a logical encryption mode; writing the mixed encryption file into the mixed byte code file with a string type constant; and replacing the class byte code file to be encrypted and the official class loader in the Java item by the confusion byte code file and the custom class loader. Therefore, the invention has the advantages of high security and strong confusion for protecting Java source codes.
Drawings
FIG. 1 is a flowchart of a Java source code protection method based on a custom class loader;
FIG. 2 is a timing diagram of a method according to an embodiment of the invention;
FIG. 3 is a comparative diagram of related indicators in embodiment 2 of the present invention.
Detailed Description
The present invention is described in further detail below with reference to examples.
Example 1:
referring to fig. 1 and fig. 2, a Java source code protection method of a custom class loader of the present embodiment includes generating a class byte code file from a class source code file to be encrypted in a Java item by a compiler; generating a target encrypted file by using a mixed encryption method for the class byte code file, wherein the first mixed encrypted file and the second mixed encrypted file; generating a custom class loader capable of loading the target encrypted file, wherein the custom class loader and the official class loader are the same in name; generating an confusion byte code file which has the same name as the class byte code file to be encrypted and has the same verification characteristic of the byte code device; generating a mixed encryption file by using the first mixed encryption file, the target encryption file and the second mixed encryption file in a logical encryption mode; writing the mixed encryption file into the mixed byte code file with a string type constant; and replacing the class byte code file to be encrypted and the official class loader in the Java item by the confusion byte code file and the custom class loader. The Java program needs to compile files into byte codes by a compiler from source file creation to program operation, then the byte codes are interpreted and operated by a JVM (Java virtual machine), the JVM firstly verifies the byte code files by a byte code verifier when operating in a JAVA operating environment, the byte code files are loaded by a class loader after verification, then local codes are generated, and the generated mixed source code files are homonymous with the byte code files to be encrypted and have the same verification characteristics, so that the mixed source code files can pass the verification of the byte code verifier, and the mixed source code files are not true source codes and can be used as a first protection barrier; after the mixed encryption file is extracted from the mixed byte code file, the first mixed encryption file is firstly required to be re-extracted in a logic decryption mode corresponding to logic encryption, and the target encryption file and the second mixed encryption file can be used as a second channel protection barrier; only the target encrypted file in the first mixed encrypted file and the target encrypted file in the second mixed encrypted file is the real source code after being broken by the custom class loader, and the other two are used as mixed options to further obstruct the breaking, so that the third protection barrier can be used. The three protection barriers can be used for protecting java source codes with high safety and strong confusion.
The method for writing the mixed encryption file into the mixed byte code file by using the character string type constant comprises the following steps: setting a plurality of character string type constant fields in the mixed byte code file; and splitting the mixed encryption file and writing a plurality of character string type constant fields. The mixed byte code file is not real source code, only a plurality of character string type constant fields are combined to form a mixed encryption file containing a real target encryption file, and the mixed byte code file written by the mixed encryption file is protected by the character string type constant fields.
Extracting and splicing a plurality of character string type constant fields of the mixed byte code file during decoding to generate a mixed encryption file; regenerating a target encrypted file by adopting a corresponding logic decryption method for the mixed encrypted file, wherein the first mixed encrypted file and the second mixed encrypted file are mixed;
The custom class loader comprises a decryption method corresponding to the encryption mode of the target encrypted file, and can decrypt the target encrypted file and load the class. In order to prevent the source code file from being decompiled easily, after the class byte code file is encrypted, the class can be only decrypted by a special class loading mode and loaded into the memory, and a custom class loader comprising a decryption method corresponding to the encryption mode of the target encrypted file firstly decrypts the target encrypted file to restore the class byte code, then loads the class into the memory and normally operates the JAVA program.
The confusion encryption method comprises the following steps: generating a byte code file from a class source code file to be encrypted through a compiler; generating digital information to be encrypted by using an ASCII coding mode to the byte code file; random sequence generation by adopting sine chaotic mapping mode:
Length of the generated sequence LAnd/>May be any positive integer value less than the total length of the digital information to be encrypted,Inputting a random sequence L into a Joseph function/>Processing the digital information to be encrypted in a variable step size Joseph traversal mode: all elements in the digital information to be encrypted are enclosed into a circle, the circle is traversed in sequence, and the/>Step size/>, when using numbersI.e. from the/>The number starts to calculate the traversal/>Number is taken as the/>Numbers to be deleted, by looping until the/>Ending after the number is counted, and obtaining digital information after the step-length-variable Joseph encryption; generating/>, by using digital information after variable step length Joseph encryptionMatrix as matrix to be encrypted/>,/>Is a positive integer, and then generates an initial value of the chaotic system, and the specific method comprises the following steps: generating hash value/>, using keccak algorithm, on variable step size joseph encrypted digital information,/>256 Bits in length, divided into 32 groups of 8 bits each, note/>Then calculating the initial value/>, of the chaotic system,/>,/>The calculation method comprises the following steps:
Expressed as a downward rounding,/> Expressed as absolute value,/>,/>,/>To calculate intermediate values,/>For a given integer value. To/>,/>,/>Generating 3 length-of-/>, as initial value of chaotic system, by using sine chaotic mapping modeRandom sequence/>,/>,Wherein:
3 random sequences/> Conversion to 3/>Diffusion matrix of (a); Using 3 diffusion matrices/>Performing diffusion encryption on matrix P to be encrypted to generate a diffusion encryption matrix:
Represents the ith row of the encryption matrix,/>Represents the j-th column of the encryption matrix,/>,/>,/>. Will/>And/>Generating a first mixed encrypted file and a second mixed encrypted file respectively, wherein/>And generating a target encrypted file. The mathematical expression of the typical Logistic mapping is simple but the dynamics characteristic is complex, so that the Logistic mapping is often used as a chaotic encryption method, sine feedback is introduced into the classical Logistic mapping by the sine chaotic mapping, and the randomness of the generated sequence can be further enhanced by forming a new mapping relation; the sequence L generated by the sine chaotic mapping is used as the input of a variable step length Joseph traversal mode to process the digital information to be encrypted, the step length is in continuous change, and the digital information to be encrypted can be fully scrambled, so that the original information characteristics of the digital information to be encrypted are completely lost; the initial value generation mode of the chaotic system is based on digital information after Joseph encryption, the sinusoidal chaotic mapping is based on three new random sequences generated by three chaotic system initial values, so that the confusion of the information is further enhanced, three random sequence generation diffusion matrixes are used for carrying out diffusion encryption on a matrix P to be encrypted to generate first confusion encryption files respectively, second confusion encryption files and target encryption files, three encryption files generated after multiple encryption of an input source code file have extremely low similarity with a source file, decryption difficulty is extremely high, the three encryption files have certain similar characteristics due to the similarity of encryption processes, the confusion is strong, and the three encryption files can be used as confusion items to generate misleading to illegal decryption, so that barriers are increased.
Table 1 shows the information entropy test results of the chaos encryption method compared with the prior art, and the disorder of the material state is characterized by using the entropy value through thermodynamics. Analogically, uncertainty of information of the information source can be represented by information entropy, and the larger the entropy value of the information source is, the higher the information disorder degree is. The confusion encryption method of the embodiment fully encrypts the digital information to be encrypted by successively adopting variable step Joseph encryption and diffusion encryption, and the information entropy after the variable step Joseph encryption and the information entropy after the confusion encryption are higher than those of the prior art, thereby explaining the high security of the encryption method.
TABLE 1
Example 2:
The technical scheme is further described on the basis of the embodiment 1.
Referring to fig. 3, this embodiment differs from embodiment 1 in that:
Generating an initial value of the chaotic system ,/>,/>When calculating intermediate value/>The calculation method of (1) is as follows:
Using 3 diffusion matrices Performing diffusion encryption on matrix P to be encrypted to generate a diffusion encryption matrixThe method of (1) is as follows:
represents the ith row of the encryption matrix,/> Represents the j-th column of the encryption matrix,/>,/>,/>。
Table 2 shows that the mixed encryption method of this embodiment is superior to embodiment 1 in comparison with the information entropy test result of the chaotic encryption method of this embodiment. Fig. 3 is a diagram of an embodiment of generating a first mixed encrypted file, a second mixed encrypted file, and a result of comparing correlation coefficients between a target encrypted file and information to be encrypted, where the smaller correlation coefficient indicates that the encryption security is strong, and all three encrypted files have extremely high security.
TABLE 2
Example 3:
this example further illustrates the technical solution based on examples 1 or 2.
The whole Java source code protection method comprises the following steps:
s10, generating a class byte code file by a compiler from a class source code file to be encrypted in a Java item;
S11, generating a target encrypted file by using a mixed encryption method for the class byte code file, wherein the first mixed encrypted file and the second mixed encrypted file;
S12, generating a mixed encryption file by using the first mixed encryption file, the target encryption file and the second mixed encryption file in a logical encryption mode;
S21, generating an confusion byte code file which has the same name as the class byte code file to be encrypted and has the same verification characteristic of a byte code device;
S22, setting a plurality of character string type constant fields in the mixed byte code file, splitting the mixed encryption file, and writing the split mixed encryption file into the plurality of character string type constant fields;
S30, generating a custom class loader with the same name as the official class loader, wherein the custom class loader comprises a decryption method corresponding to the encryption mode of the target encrypted file, and can decrypt the target encrypted file and then load the class;
s40, replacing the class byte code file to be encrypted and the official class loader in the Java item by the mixed byte code file;
s41, replacing the official class loader by the custom class loader in the Java item.
While the invention has been described in connection with preferred embodiments, the invention is not limited by this description. Various modifications and substitutions may be made by those skilled in the art without departing from the spirit and scope of the invention. The scope of the invention should be determined from the following claims.
Claims (7)
1. A Java source code protection method based on a custom class loader is characterized in that: comprising the steps of (a) a step of,
Generating a class byte code file from a class source code file to be encrypted in a Java item through a compiler;
generating a target encrypted file by using a mixed encryption method for the class byte code file, wherein the first mixed encrypted file and the second mixed encrypted file;
generating a custom class loader for loading the target encrypted file, wherein the custom class loader and the official class loader have the same name;
Generating an confusion byte code file which has the same name as the class byte code file to be encrypted and has the same verification characteristic of a byte code device;
Generating a mixed encryption file by using the first mixed encryption file, the target encryption file and the second mixed encryption file in a logic encryption mode;
writing the mixed encryption file into an confusion byte code file by using a character string type constant;
replacing the class byte code file to be encrypted and the official class loader in Java items by the confusion byte code file and the custom class loader;
The confusion encryption method comprises the following steps:
generating a byte code file from the class source code file to be encrypted through a compiler;
Generating digital information to be encrypted by using the byte code file in an ASCII coding mode;
random sequence generation by adopting sine chaotic mapping mode :
The length s of the generated sequence L is equal toFor any integer value less than the total length of the digital information to be encrypted, k is the system number and k+.0, a random sequence L is input to the Joseph function/>Processing the digital information to be encrypted in a variable step size Joseph traversal mode: surrounding all elements in the digital information to be encrypted into a circle, traversing the circle in sequence, and deleting the ith digit by using step lengthTraversal/>, starting from the ith numberThe number is used as the number which needs to be deleted in the (i+1) th step, the cycle is completed until the s number is deleted, and the digital information after the variable step length Joseph encryption is obtained;
Generating an MxN matrix by using the digital information subjected to variable step Joseph encryption as a matrix P to be encrypted, wherein M and N are positive integers;
The method for generating the initial value of the chaotic system comprises the following steps: hash value F is generated for variable step length joseph encrypted digital information using keccak algorithm, the length of F is 256 bits, and divided into 32 groups each containing 8 bits, and recorded Then calculating the initial value/>, of the chaotic system,/>,/>The calculation method comprises the following steps:
round () represents a downward rounding, abs () represents an absolute value of j=6 (i-1), i e {1,2,3}, To calculate intermediate values,/>For a given integer value;
To be used for ,/>,/>Generating 3 random sequences/>, with the length of t=M×N, by using a sine chaotic mapping mode as an initial value of a chaotic system,/>,/>:
Converting 3 random sequences X, Y, Z into 3M×N diffusion matrices Q, R, S;、/>、/> is a positive integer parameter;
Performing diffusion encryption on a matrix P to be encrypted by using 3 diffusion matrixes Q, R and S to generate a diffusion encryption matrix :
⨁ Denotes an exclusive-or operation,Represents the ith row of the encryption matrix,/>Represents the j-th column of the encryption matrix,/>Representation/>I-th line of/>Representation/>I-th line of/>Representation/>Is the j-th row of (2); will/>And/>Generating a first mixed encrypted file and a second mixed encrypted file respectively, wherein/>And generating a target encrypted file.
2. The java source code protection method based on the custom class loader according to claim 1, wherein the java source code protection method is characterized in that:
The method for writing the mixed encryption file into the mixed byte code file by using the character string type constant comprises the following steps: setting a plurality of character string type constant fields in the mixed byte code file; and splitting the mixed encryption file and writing the split mixed encryption file into the plurality of character string type constant fields.
3. The java source code protection method based on the custom class loader according to claim 1 or 2, wherein the mixed encryption file is written into the mixed byte code file with a string type constant, and is characterized in that: extracting and splicing a plurality of character string type constant fields of the mixed byte code file during decoding to generate the mixed encryption file; and regenerating the target encrypted file by adopting a corresponding logic decryption method for the mixed encrypted file, wherein the first mixed encrypted file and the second mixed encrypted file are mixed.
4. The java source code protection method based on the custom class loader according to claim 1, wherein the java source code protection method is characterized in that: the custom class loader for generating and loading the target encrypted file is characterized in that: the custom class loader comprises a decryption method corresponding to the encryption mode of the target encrypted file, and loads the class after decrypting the target encrypted file.
5. A computer program product implementing the method of claim 1.
6. A storage medium storing the computer program product of claim 5.
7. Terminal device provided with a computer program product according to claim 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210365175.7A CN114722359B (en) | 2022-04-08 | 2022-04-08 | Java source code protection method based on custom class loader |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210365175.7A CN114722359B (en) | 2022-04-08 | 2022-04-08 | Java source code protection method based on custom class loader |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114722359A CN114722359A (en) | 2022-07-08 |
CN114722359B true CN114722359B (en) | 2024-05-10 |
Family
ID=82241033
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210365175.7A Active CN114722359B (en) | 2022-04-08 | 2022-04-08 | Java source code protection method based on custom class loader |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114722359B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117828555B (en) * | 2024-03-05 | 2024-05-28 | 山东浪潮科学研究院有限公司 | Low-cost Java source code protection method and device |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103065072A (en) * | 2011-10-21 | 2013-04-24 | 北京大学 | Method and device to improve Java software jailbreak difficulty and copyright verification method |
CN104268444A (en) * | 2014-08-25 | 2015-01-07 | 浪潮电子信息产业股份有限公司 | Cloud OS Java source code protection method |
WO2017026739A1 (en) * | 2015-08-10 | 2017-02-16 | 라인 가부시키가이샤 | System and method for obfuscating application code |
CN109614771A (en) * | 2018-10-31 | 2019-04-12 | 同盾控股有限公司 | It is a kind of that method and apparatus are obscured based on Java code |
CN110826031A (en) * | 2019-10-31 | 2020-02-21 | 北京东软望海科技有限公司 | Encryption method, device, computer equipment and storage medium |
CN112115429A (en) * | 2020-08-25 | 2020-12-22 | 北京基调网络股份有限公司 | Java class encryption and decryption method and computer readable storage medium |
CN113282294A (en) * | 2021-05-19 | 2021-08-20 | 武汉极意网络科技有限公司 | Android platform-based Java character string confusion method and device |
WO2021217980A1 (en) * | 2020-04-30 | 2021-11-04 | 平安科技(深圳)有限公司 | Java code packing method and system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20210154017A (en) * | 2020-06-11 | 2021-12-20 | 라인플러스 주식회사 | Method and system for protecting file using class dispersion and sequential memory loading |
-
2022
- 2022-04-08 CN CN202210365175.7A patent/CN114722359B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103065072A (en) * | 2011-10-21 | 2013-04-24 | 北京大学 | Method and device to improve Java software jailbreak difficulty and copyright verification method |
CN104268444A (en) * | 2014-08-25 | 2015-01-07 | 浪潮电子信息产业股份有限公司 | Cloud OS Java source code protection method |
WO2017026739A1 (en) * | 2015-08-10 | 2017-02-16 | 라인 가부시키가이샤 | System and method for obfuscating application code |
CN109614771A (en) * | 2018-10-31 | 2019-04-12 | 同盾控股有限公司 | It is a kind of that method and apparatus are obscured based on Java code |
CN110826031A (en) * | 2019-10-31 | 2020-02-21 | 北京东软望海科技有限公司 | Encryption method, device, computer equipment and storage medium |
WO2021217980A1 (en) * | 2020-04-30 | 2021-11-04 | 平安科技(深圳)有限公司 | Java code packing method and system |
CN112115429A (en) * | 2020-08-25 | 2020-12-22 | 北京基调网络股份有限公司 | Java class encryption and decryption method and computer readable storage medium |
CN113282294A (en) * | 2021-05-19 | 2021-08-20 | 武汉极意网络科技有限公司 | Android platform-based Java character string confusion method and device |
Non-Patent Citations (5)
Title |
---|
Dynamic Multi Levels Java Code Obfuscation Technique;Adwan Yasin 等;International Journal of Computer Science and Security(IJCSS);20161231;140-160 * |
Java Source Code Protection Based on JNI and AES Algorithm;Zhao Hong 等;2017 IEEE International Conference on Computational Science and Engineering(CSE) and IEEE International Conference on Embedded and Ubiquitous Computing(EUC);20170810;846-849 * |
Java类装载机制的研究及其在代码保护中的应用;尹松强;中国优秀硕士学位论文全文数据库 信息科技辑;20090615(第06期);I138-512 * |
Java软件保护机制的研究与实现;尹艳阳 等;现代计算机(专业版);20160705(第19期);27-31 * |
面向JAVA代码的加密及动态解密机制的研究与实现;董晚华;中国优秀硕士学位论文全文数据库 信息科技辑;20110515(第05期);I138-41 * |
Also Published As
Publication number | Publication date |
---|---|
CN114722359A (en) | 2022-07-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1993922B (en) | Stream cipher combining system and method | |
US8050401B2 (en) | High speed configurable cryptographic architecture | |
US8428251B2 (en) | System and method for stream/block cipher with internal random states | |
CN101401348B (en) | Method and system for cipher function vagueness | |
EP2656266B1 (en) | Improvements relating to cryptography using polymorphic code | |
KR101324825B1 (en) | Message authentication code pre-computation with applications to secure memory | |
EP1807965B1 (en) | Method, server and computer readable medium for obfuscating a cryptographic function | |
CN108964872B (en) | Encryption method and device based on AES | |
US20090077388A1 (en) | Information processing apparatus and computer readable medium | |
CN110505054B (en) | Data processing method, device and equipment based on dynamic white box | |
EP1712032B1 (en) | Block ciphering system, using permutations to hide the core ciphering function of each encryption round | |
CN105095695A (en) | Realizing authorization via incorrect functional behavior of a white-box implementation | |
CN103095449A (en) | Dynamic encryption and decryption method based on stream ciphers | |
CN114722359B (en) | Java source code protection method based on custom class loader | |
CN113098675B (en) | Binary data encryption system and method based on polynomial complete homomorphism | |
KR20080046515A (en) | Encoding and decoding method of contents file | |
Forgáč et al. | Contribution to symmetric cryptography by convolutional neural networks | |
CN1251444A (en) | Efficient block encryption method | |
US20210143978A1 (en) | Method to secure a software code performing accesses to look-up tables | |
US20140105402A1 (en) | Data protection using key translation | |
CN100359494C (en) | Electronic file characters internal code transformation encryption method | |
KR101790325B1 (en) | Encryption and Decryption System | |
CN111602367A (en) | Method for protecting entropy sources used in countermeasures securing white-box cryptographic algorithms | |
CN111314052A (en) | Data encryption and decryption method based on uniformly distributed symmetric compression algorithm | |
CN114254372B (en) | Data encryption processing method and system and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |