# US 2014/0195824 A1 · Protecting method and system of java source code

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2014/0195824 A1
- Document ID: US20140195824A1
- Status: Published application
- Kind: A1
- Application number: 14/117,987
- Filed: 2012-08-27
- Published: 2014-07-10
- Earliest claimed: 2011-09-26
- Assignees: Feitian Technologies Co., Ltd.
- Applicants: Feitian Technologies Co., Ltd.
- Inventors: Zhou Lu; Huazhang Zu
- Web page: https://patentgrep.com/patent/US20140195824A1

## CPC

- G06F 21/50: Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F 21/10: Protecting distributed programs or content, e.g. vending or licensing of copyrighted material (protection in video systems or pay television H04N7/16) {; Digital rights management [DRM]}
- G06F 21/123: {by using dedicated hardware, e.g. dongles, smart cards, cryptographic processors, global positioning systems [GPS] devices}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure discloses a protecting method and system of Java source code. When a first initiating class is invoked, the method comprises following steps, wherein the first initiating class is an initiating class of Java program: the first initiating class decrypts first cipher data to obtain a class loader; the class loader reads second cipher data to the memory and decrypts the second cipher data to obtain a first class, wherein the first class is a class run by a Java virtual machine, and the suffix of the first class is .class; the class loader loads a second initiating class to the memory; wherein the second initiating class is an original class in jar packet of the Java program; and the class loader loads the first class to the Java virtual machine so that the Java virtual machine can invoke a main interface in the second initiating class to run the Java program. The present disclosure can protect Java source code and make it difficult to decompile the Java source code.

## Claims

### Claim 1

A protecting method of Java source code, wherein when a first initiating class is invoked, the method comprises:
S1, the first initiating class reading first cipher data to a memory, decrypting the first cipher data to obtain first plain data, and defining the first plain data as a class loader, wherein the first initiating class is an initiating class of Java program and the first cipher data is data obtained by encrypting the bytecode file of the class loader;
S2, the class loader reading second cipher data to the memory, decrypting the second cipher data to obtain second plain data, and defining the second plain data as a first class, wherein the first class is a class which is run by a Java virtual machine, and the suffix of the first class is .class, and the second cipher data is obtained by encrypting the bytecode file of the first class;
S3, the class loader loading a second initiating class to the memory, wherein the second initiating class is an original class in jar packet of Java program; and
S4, the class loader loading the first class to the Java virtual machine so that the Java virtual machine can invoke a main interface in the second initiating class and run the Java program.

### Claim 2 (depends on 1)

The method of claim 1, wherein the step S1 comprises:
S11, the first initiating class reading the first cipher data to the memory;
S12, the first initiating class loading a local first dynamic library to the memory;
S13, the first initiating class invoking a third interface in the first dynamic library;
S14, the first initiating class transferring an address of the first cipher data in the memory into the third interface in the first dynamic library;
S15, the third interface in the first dynamic library decrypting the first cipher data to obtain the first plain data; and
S16, the third interface in the first dynamic library invoking a define class interface of the Java virtual machine to define the first plain data as the class loader.

### Claim 3 (depends on 2)

The method of claim 2, wherein the step S11 comprises:
S111, invoking a first interface in the first initiating class;
S112, the first interface in the first initiating class invoking a second interface in the first initiating class; and
S113, the second interface in the first initiating class reading the first cipher data to the memory,

### Claim 4 (depends on 2)

The method of claim 2, wherein the step S3 comprises
S31, the third interface in the first dynamic library invoking a fourth interface in the class loader;
S32, the fourth interface in the class loader reading a configuration file in jar packet of the Java program;
S33, the fourth interface in the class loader reading out the second initiating class from the configuration file;
S34, the fourth interface in the class loader invoking a fifth interface in the class loader; and
S35, the fifth interface in the class loader loading the second initiating class to the memory.

### Claim 5 (depends on 4)

The method of claim 4, wherein the step S2 comprises:
S21, the fifth interface of the class loader invoking a sixth interface in the class loader;
S22, the sixth interface in the class loader reading the second cipher data to the memory;
S23, the fifth interface in the class loader decrypting the second cipher data to obtain second plain data; and
S24, the fifth interface in the class loader invoking the define class interface of the Java virtual machine and defining the second plain data as the first class.

### Claim 6 (depends on 1)

The method of claim 1, wherein decrypting the first cipher data and the second cipher data in the following ways:
S2001, invoking a dongle interface to search whether a dongle exists;
S2002, when the dongle is found by searching, invoking the dongle interface to transfer cipher data into the dongle;
S2003, invoking the dongle interface to use a key stored in the dongle to decrypt the cipher data, which is transferred in, to obtain plain data; and
S2004, invoking the dongle interface to obtain the plain data.

### Claim 7

A protecting system of Java source code, comprising:
a first processing module comprising a first initiating class, wherein the first initiating class is an initiating class of Java program;
an invoking module configured to invoke the first initiating class; and
a second processing module comprising a class loader;
an encrypting module configured to encrypt a bytecode file of the class loader to first cipher data and encrypt a bytecode file of a first class to second cipher data, wherein the first class is a class run by a Java virtual machine; and
a decrypting module configured to decrypt the first cipher data to first plain data and decrypt the second cipher data to second plain data,
wherein the first initiating class is configured to read the first cipher data to the memory, and control the decrypting module to decrypt the first cipher data to obtain the first plain data and define the first plain data as the class loader; and
the class loader configured to load a second initiating class to the memory, read the second cipher data to the memory, control the decrypting module to decrypt the second cipher data and load the first class to the Java virtual machine so that the Java virtual machine can invoke a main interface of the second initiating class to run the Java program, wherein the second initiating class is an original class of jar packet of the Java program.

### Claim 8 (depends on 7)

The protecting system of claim 7, wherein
the first initiating class is further configured to load a local first dynamic library to the memory, invoke a third interface in the first dynamic library and transfer the address of the first cipher data in the memory into the third interface in the first dynamic library,
wherein the third interface in the first dynamic library is configured to decrypt the first cipher data to obtain the first plain data and invoke a define class interface of the Java virtual machine to define the first plain data as the class loader.

### Claim 9 (depends on 7)

The protecting system of claim 7, wherein
the first initiating class comprises a first interface and a second interface, wherein the first interface in the first initiating class is configured to invoke the second interface in the first initiating class; the second interface in the first initiating class is configured to read the first cipher data to the memory.

### Claim 10 (depends on 8)

The protecting system of claim 8, wherein
the class loader comprises a fourth interface and a fifth interface, wherein the fourth interface of the class loader is configured to read a configuration file in the jar packet of the Java program, read the second initiating class out from the configuration file and invoke the fifth interface in the class loader; the fifth interface in the class loader is configured to load the second initiating class to the memory; and
the third interface in the first dynamic library is further configured to invoke the fourth interface in the class loader.

### Claim 11 (depends on 10)

The protecting system of claim 10, wherein
the class loader comprises a sixth interface, wherein the sixth interface in the class loader is configured to read the second cipher data to the memory; and
the fifth interface in the class loader is further configured to invoke the sixth interface in the class loader, decrypt the second cipher data to obtain the second plain data, and invoke the define class interface of the Java virtual machine to define the second plain data as the first class.

### Claim 12 (depends on 7)

The protecting system of claim 7, wherein the decrypting module comprises:
a second searching sub-module configured to invoke a dongle interface to search whether a dongle exists;
a second transferring-in sub-module configured to, when the dongle is found by searching, invoke the dangle interface to transfer cipher data into the dongle;
a first decrypting sub-module configured to invoke the dongle interface to use the key stored in the dongle to decrypt the cipher data, which is transferred in, to obtain plain data; and
a third obtaining sub-module configured to invoke the dongle interface to obtain the plain data.
