CN113032741B - Class file encryption method, class file operation method, device, equipment and medium - Google Patents

Class file encryption method, class file operation method, device, equipment and medium Download PDF

Info

Publication number
CN113032741B
CN113032741B CN202110423886.0A CN202110423886A CN113032741B CN 113032741 B CN113032741 B CN 113032741B CN 202110423886 A CN202110423886 A CN 202110423886A CN 113032741 B CN113032741 B CN 113032741B
Authority
CN
China
Prior art keywords
application software
target application
file
class
class file
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
Application number
CN202110423886.0A
Other languages
Chinese (zh)
Other versions
CN113032741A (en
Inventor
钟丹晔
袁海洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Baowangda Software Technology Co ltd
Original Assignee
Jiangsu Baowangda Software Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Jiangsu Baowangda Software Technology Co ltd filed Critical Jiangsu Baowangda Software Technology Co ltd
Priority to CN202110423886.0A priority Critical patent/CN113032741B/en
Publication of CN113032741A publication Critical patent/CN113032741A/en
Application granted granted Critical
Publication of CN113032741B publication Critical patent/CN113032741B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/14Protecting executable software against software analysis or reverse engineering, e.g. by obfuscation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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 embodiment of the invention discloses a class file encryption method, a class file operation method, a device, equipment and a medium. The method comprises the following steps: invoking a compiler to compile source program codes of the target application software to generate at least one class file of the target application software; calling a file encryption plug-in, encrypting each class file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted class files to obtain a compressed file of the target application software; and sending the compressed file of the target application software to the target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software. According to the embodiment of the invention, the compiled class file of the application software can be automatically encrypted through the file encryption plug-in, so that the class file can be effectively prevented from being decompiled, the security of the class file is improved, and the source program code of the application software is prevented from being leaked.

Description

Class file encryption method, class file operation method, device, equipment and medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a class file encryption method, a class file operation method, a device, equipment and a medium.
Background
In general, source program codes of application software written by java are compiled by a java compiler to generate class files (class files) of the java application software. A java application typically includes at least one class file that is typically compressed into a compressed file (e.g., a "jar" package). When java application software is started and operated, class files in the compressed files are required to be loaded into the memory space of the virtual machine for operation.
However, because java is always in possession of the open sharing concept, the property of decompiling is inherent. The class files in the compressed files are easy to decompil to obtain the complete source program codes of the java application software, so that the complete source program codes of the java application software are leaked.
Disclosure of Invention
The embodiment of the invention provides a class file encryption method, a class file operation device, class file operation equipment and a class file medium, which can improve the security of a class file and avoid the leakage of a source program code.
In a first aspect, an embodiment of the present invention provides a method for encrypting a class file, including:
Invoking a compiler to compile source program codes of target application software to generate at least one class file of the target application software;
calling a file encryption plug-in, encrypting each class file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted class files to obtain a compressed file of the target application software;
and sending the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software.
In a second aspect, an embodiment of the present invention further provides a method for running a class file, including:
receiving a compressed file of target application software, wherein the compressed file of target application software comprises at least one encrypted class file of the target application software;
decompressing the compressed file of the target application software to obtain encrypted class files of the target application software;
and sending a loading request corresponding to the target application software to a custom class loader, decrypting the encrypted class files by the custom class loader by using a preset decryption algorithm corresponding to the target application software, and loading the decrypted class files into a virtual machine memory space for operation.
In a third aspect, an embodiment of the present invention further provides a device for encrypting a class file, including:
the class file generation module is used for calling a compiler to compile source program codes of target application software and generating at least one class file of the target application software;
the class file encryption module is used for calling a file encryption plug-in, encrypting each class file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted class files to obtain a compressed file of the target application software;
and the compressed file sending module is used for sending the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software.
In a fourth aspect, an embodiment of the present invention further provides a class file running device, including:
the compressed file receiving module is used for receiving a compressed file of target application software, wherein the compressed file of the target application software comprises at least one encrypted class file of the target application software;
the compressed file decompression module is used for decompressing the compressed file of the target application software to obtain encrypted class files of the target application software;
And the class file running module is used for sending a loading request corresponding to the target application software to a custom class loader, decrypting the encrypted class files by the custom class loader through a preset decryption algorithm corresponding to the target application software, and loading the decrypted class files into a memory space of the virtual machine for running.
In a fifth aspect, an embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements a class file encryption method according to the embodiment of the present invention or implements a class file running method according to the embodiment of the present invention when executing the computer program.
In a sixth aspect, an embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program when executed by a processor implements a class file encryption method according to an embodiment of the present invention, or implements a class file running method according to an embodiment of the present invention.
According to the technical scheme, a compiler is called to compile source program codes of target application software to generate at least one class file of the target application software, then a file encryption plug-in is called, each class file is encrypted by using a preset encryption algorithm corresponding to the target application software, and each encrypted class file is packaged to obtain a compressed file of the target application software; the compressed files of the target application software are sent to target terminal equipment, so that the target terminal equipment runs each class file of the target application software according to the compressed files of the target application software, the compiled class files of the application software can be automatically encrypted through a file encryption plug-in, then the compressed files packaged into the application software are sent to the terminal equipment needing to run the application software, the class files in the compressed files of the application software can be effectively prevented from being decompiled, the security of the class files of the application software is improved, and source program code leakage of the application software is avoided.
Drawings
Fig. 1 is a flowchart of a method for encrypting a class file according to an embodiment of the present invention.
Fig. 2 is a flowchart of a method for running a class file according to a second embodiment of the present invention.
Fig. 3 is a schematic structural diagram of a file-like encryption device according to a third embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a file running device according to a fourth embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof.
It should be further noted that, for convenience of description, only some, but not all of the matters related to the present invention are shown in the accompanying drawings. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart depicts operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently, or at the same time. Furthermore, the order of the operations may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example 1
Fig. 1 is a flowchart of a method for encrypting a class file according to an embodiment of the present invention. The embodiment of the invention can be applied to the situation of protecting the class file of the application software, the method can be executed by the class file encryption device provided by the embodiment of the invention, and the device can be realized in a software and/or hardware mode and can be generally integrated in computer equipment. For example in a server. As shown in fig. 1, the method in the embodiment of the present invention specifically includes:
and step 101, calling a compiler to compile source program codes of target application software, and generating at least one class file of the target application software.
Optionally, the target application software is java application software that needs to be run in the terminal device. The source program code of the target application software is written by java. The called compiler is a java compiler and is used for compiling source program codes of the application software written by using java to generate at least one class file (class file) of the application software. The class file is a file for storing the code instruction set of the java program runtime.
Optionally, after the completion of the source program code writing of the target application software is detected, invoking a compiler to compile the source program code of the target application software, and generating at least one class file of the target application software.
And 102, calling a file encryption plug-in, encrypting each class file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted class files to obtain a compressed file of the target application software.
Optionally, the file encryption plug-in is a plug-in for encrypting at least one class file of the application software by using a preset encryption algorithm corresponding to the application software, and packaging the encrypted at least one class file to obtain a compressed file of the application software.
Optionally, the file encryption plugin is a preconfigured maven plugin.
Optionally, the configuration file of the maven plug-in is configured in advance, at least one class file of the application software is encrypted by using a preset encryption algorithm corresponding to the application software, and the encrypted at least one class file is packaged, so that the operation logic of the compressed file of the application software is packaged to the maven plug-in.
Optionally, the preset encryption algorithm is an encryption algorithm for encrypting the class file of the application software. And a plurality of preset encryption algorithms are stored in the file encryption plug-in. The preset encryption algorithm corresponding to the target application software is an encryption algorithm for encrypting the class file of the target application software.
Optionally, the identification information of the target application software is identification information for distinguishing the target application software from other application software, and may be a digital number. The method comprises the steps of pre-establishing a corresponding relation between identification information of target application software and an encryption algorithm for encrypting class files of the target application software. The file encryption plug-in can determine a preset encryption algorithm corresponding to the target application software from a plurality of preset encryption algorithms stored in the file encryption plug-in according to the identification information of the target application software.
Optionally, the calling a file encryption plug-in encrypts each class file by using a preset encryption algorithm corresponding to the target application software, including: and calling the file encryption plug-in to execute the following operations: determining a preset encryption algorithm corresponding to the target application software according to the identification information of the target application software; sequentially acquiring one class file from all class files of the target application software as a current processing class file; encrypting the current processing class file by using a preset encryption algorithm corresponding to the target application software to obtain an encrypted current processing class file; replacing the current processing class file with the encrypted current processing class file; and returning to execute the operation of sequentially acquiring one class file in all class files of the target application software as the current processing class file until the encryption and replacement of all class files of the target application software are completed.
And then, packaging the encrypted class files to obtain the compressed file of the target application software subjected to encryption processing. When the compressed file of the target application software subjected to encryption processing is opened by a decompilation tool, the decompilation tool cannot decompil each encrypted class file, so that the source program code of the target application software cannot be seen. The class file encryption method provided by the embodiment of the invention can prevent each class file in the compressed file of the target application software from being decompiled aiming at the target application software with the core confidentiality, improve the security of the class file of the target application software and avoid the source program code of the target application software from being leaked.
And step 103, sending the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software.
Optionally, the target terminal device is a terminal device that needs to run the target application software. And sending the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software, thereby starting and running the target application software.
Optionally, the target terminal device runs each class file of the target application software according to the compressed file of the target application software, including: the method comprises the steps that target terminal equipment receives a compressed file of target application software, wherein the compressed file of the target application software comprises at least one encrypted class file of the target application software; the target terminal equipment decompresses the compressed file of the target application software to obtain encrypted class files of the target application software; and the target terminal equipment sends a loading request corresponding to the target application software to a custom class loader, decrypts the encrypted class files by the custom class loader by using a preset decryption algorithm corresponding to the target application software, and loads the decrypted class files into a virtual machine memory space for operation.
The embodiment of the invention provides a kind of file encryption method, which comprises the steps of compiling source program codes of target application software by calling a compiler to generate at least one kind of file of the target application software, then calling a file encryption plug-in, encrypting each kind of file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted kinds of file to obtain a compressed file of the target application software; the compressed files of the target application software are sent to target terminal equipment, so that the target terminal equipment runs each class file of the target application software according to the compressed files of the target application software, the compiled class files of the application software can be automatically encrypted through a file encryption plug-in, then the compressed files packaged into the application software are sent to the terminal equipment needing to run the application software, the class files in the compressed files of the application software can be effectively prevented from being decompiled, the security of the class files of the application software is improved, and source program code leakage of the application software is avoided.
Example two
Fig. 2 is a flowchart of a method for running a class file according to a second embodiment of the present invention. The embodiment of the invention can be suitable for the condition of class files for running application software, the method can be executed by the class file running device provided by the embodiment of the invention, and the device can be realized in a software and/or hardware mode and can be generally integrated in computer equipment. For example, in the target terminal device. As shown in fig. 2, the method in the embodiment of the present invention specifically includes:
step 201, receiving a compressed file of target application software, wherein the compressed file of target application software contains at least one encrypted class file of the target application software.
Optionally, the server for managing the target application software invokes a compiler to compile source program codes of the target application software, and generates at least one class file of the target application software; the server calls a file encryption plug-in, encrypts each class file by using a preset encryption algorithm corresponding to the target application software, and packages each encrypted class file to obtain a compressed file of the target application software; and the server sends the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software. The target terminal device is a terminal device that needs to run the target application software.
Optionally, the target terminal device receives a compressed file of the target application software, where the compressed file of the target application software includes at least one encrypted class file of the target application software.
Step 202, decompressing the compressed file of the target application software to obtain each encrypted class file of the target application software.
Optionally, the target terminal device uses a decompression tool to decompress the compressed file of the target application software to obtain encrypted class files of the target application software, and stores the encrypted class files of the target application software in a preset class file storage position.
Step 203, a loading request corresponding to the target application software is sent to a custom class loader, and the encrypted class files are decrypted by the custom class loader by using a preset decryption algorithm corresponding to the target application software, and the decrypted class files are loaded into a virtual machine memory space for running.
Optionally, the loading request corresponding to the target application software is a request for loading the class file of the target application software into the virtual machine memory space for running.
Optionally, the custom class loader is a class loader for decrypting the encrypted at least one class file of the application software using a preset decryption algorithm corresponding to the application software, and then loading the decrypted at least one class file into the virtual machine memory space for operation.
Optionally, the custom class loader encapsulates the arithmetic logic of the class loader that decrypts the encrypted at least one class file of the application software using a preset decryption algorithm corresponding to the application software, and then loads the decrypted at least one class file into the virtual machine memory space.
Optionally, the preset decryption algorithm is a decryption algorithm for decrypting an encrypted class file of the application software. And a plurality of preset decryption algorithms are stored in the custom class loader. The preset decryption algorithm corresponding to the target application software is a decryption algorithm for decrypting each class file encrypted by the target application software, which is obtained by using the preset encryption algorithm corresponding to the target application software.
Optionally, the identification information of the target application software is identification information for distinguishing the target application software from other application software, and may be a digital number. The corresponding relation between the identification information of the target application software and a decryption algorithm for decrypting the encrypted class file of the target application software is established in advance. The custom class loader can determine a preset decryption algorithm corresponding to the target application software from a plurality of preset decryption algorithms stored in the custom class loader according to the identification information of the target application software.
Optionally, the decrypting, by the custom class loader, each encrypted class file by using a preset decryption algorithm corresponding to the target application software includes: executing the following operations through the custom class loader: when a loading request corresponding to the target application software is detected, determining a preset decryption algorithm corresponding to the target application software according to the identification information of the target application software; sequentially acquiring one encrypted class file in all encrypted class files of the target application software as a current processing class file; decrypting the current processing type file by using a preset decryption algorithm corresponding to the target application software to obtain a decrypted current processing type file; replacing the current processing class file with the decrypted current processing class file; and returning to execute the operation of sequentially acquiring one encrypted class file in all the encrypted class files of the target application software as the current processing class file until decryption and replacement of all the encrypted class files of the target application software are completed.
And then loading the decrypted class files into a virtual machine memory space for running, so as to start and run the target application software.
Optionally, the virtual machine of the target terminal device is a java virtual machine, and is a virtual computer capable of running java codes.
Optionally, loading each decrypted class file into a virtual machine memory space for operation, including: the self-defined class loader converts the content in each decrypted class file into class byte codes used by the virtual machine, namely, into codes executable by the virtual machine, and then loads the codes into the memory space of the virtual machine to run.
Optionally, the loading, by the custom class loader, each decrypted class file into the virtual machine memory space for running includes: and the self-defined class loader loads the decrypted class files into a virtual machine memory space to run according to the class file loading sequence corresponding to the target application software.
The class file loading sequence corresponding to the target application software is the loading sequence of at least one class file of the target application software. Optionally, according to the attribute of each class file of the target application software, setting a class file loading sequence corresponding to the target application software.
The embodiment of the invention provides a class file running method, which is characterized in that a compressed file of target application software is received, the compressed file of the target application software comprises at least one encrypted class file of the target application software, then the compressed file of the target application software is decompressed to obtain each encrypted class file of the target application software, finally a loading request corresponding to the target application software is sent to a custom class loader, the encrypted class files are decrypted by the custom class loader through a preset decryption algorithm corresponding to the target application software, and each decrypted class file is loaded to a virtual machine memory space for running, so that after the compressed file of the encrypted target application software is received, the encrypted class files are automatically decrypted by the custom class loader and then the decrypted class files are loaded to the virtual machine memory space for running, the safety of the class files of the application software can be effectively improved, and the source code of the application software is prevented from being leaked.
Example III
Fig. 3 is a schematic structural diagram of a file-like encryption device according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: a class file generation module 301, a class file encryption module 302, and a compressed file transmission module 303.
The class file generation module 301 is configured to invoke a compiler to compile source program code of target application software, and generate at least one class file of the target application software; a class file encryption module 302, configured to invoke a file encryption plug-in, encrypt each class file using a preset encryption algorithm corresponding to the target application software, and package each encrypted class file to obtain a compressed file of the target application software; and the compressed file sending module 303 is configured to send the compressed file of the target application software to a target terminal device, so that the target terminal device runs each class file of the target application software according to the compressed file of the target application software.
The embodiment of the invention provides a class file encryption device, which is characterized in that a compiler is called to compile source program codes of target application software to generate at least one class file of the target application software, then a file encryption plug-in is called, each class file is encrypted by using a preset encryption algorithm corresponding to the target application software, and each encrypted class file is packaged to obtain a compressed file of the target application software; the compressed files of the target application software are sent to target terminal equipment, so that the target terminal equipment runs each class file of the target application software according to the compressed files of the target application software, the compiled class files of the application software can be automatically encrypted through a file encryption plug-in, then the compressed files packaged into the application software are sent to the terminal equipment needing to run the application software, the class files in the compressed files of the application software can be effectively prevented from being decompiled, the security of the class files of the application software is improved, and source program code leakage of the application software is avoided.
In an optional implementation manner of the embodiment of the present invention, optionally, when executing the operation of calling the file encryption plug-in and encrypting each class file by using a preset encryption algorithm corresponding to the target application software, the class file encryption module 302 is specifically configured to: and calling the file encryption plug-in to execute the following operations: determining a preset encryption algorithm corresponding to the target application software according to the identification information of the target application software; sequentially acquiring one class file from all class files of the target application software as a current processing class file; encrypting the current processing class file by using a preset encryption algorithm corresponding to the target application software to obtain an encrypted current processing class file; replacing the current processing class file with the encrypted current processing class file; and returning to execute the operation of sequentially acquiring one class file in all class files of the target application software as the current processing class file until the encryption and replacement of all class files of the target application software are completed.
In an optional implementation manner of the embodiment of the present invention, optionally, the file encryption plugin is a preconfigured maven plugin.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
The class file encryption device can execute the class file encryption method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the class file encryption method.
Example IV
Fig. 4 is a schematic structural diagram of a file running device according to a fourth embodiment of the present invention. As shown in fig. 4, the apparatus includes: a compressed file receiving module 401, a compressed file decompressing module 402, and a class file running module 403.
The compressed file receiving module 401 is configured to receive a compressed file of a target application software, where the compressed file of the target application software includes at least one encrypted class file of the target application software; a compressed file decompression module 402, configured to decompress a compressed file of the target application software to obtain encrypted class files of the target application software; and the class file running module 403 is configured to send a loading request corresponding to the target application software to a custom class loader, decrypt, by using a preset decryption algorithm corresponding to the target application software, the encrypted class files by using the custom class loader, and load, by using the custom class loader, the decrypted class files into a virtual machine memory space for running.
The embodiment of the invention provides a class file running device, which is characterized in that by receiving a compressed file of target application software, wherein the compressed file of the target application software comprises at least one encrypted class file of the target application software, then decompressing the compressed file of the target application software to obtain each encrypted class file of the target application software, finally sending a loading request corresponding to the target application software to a custom class loader, decrypting each encrypted class file by using a preset decryption algorithm corresponding to the target application software through the custom class loader, and loading each decrypted class file to a virtual machine memory space for running, the encrypted class file is automatically decrypted by the custom class loader when the encrypted class file of the target application software is required to be loaded to the virtual machine memory space for running after the compressed file of the encrypted target application software is received, and then the decrypted class file is loaded to the virtual machine memory space for running, so that the safety of the class file of the application software can be effectively improved, and the source code of the application software is prevented from being leaked.
In an optional implementation manner of the embodiment of the present invention, optionally, when executing the operation of decrypting, by the custom class loader, each encrypted class file by using a preset decryption algorithm corresponding to the target application software, the class file running module 403 is specifically configured to: executing the following operations through the custom class loader: when a loading request corresponding to the target application software is detected, determining a preset decryption algorithm corresponding to the target application software according to the identification information of the target application software; sequentially acquiring one encrypted class file in all encrypted class files of the target application software as a current processing class file; decrypting the current processing type file by using a preset decryption algorithm corresponding to the target application software to obtain a decrypted current processing type file; replacing the current processing class file with the decrypted current processing class file; and returning to execute the operation of sequentially acquiring one encrypted class file in all the encrypted class files of the target application software as the current processing class file until decryption and replacement of all the encrypted class files of the target application software are completed.
In an optional implementation manner of the embodiment of the present invention, optionally, when executing an operation of loading each decrypted class file into a virtual machine memory space by a custom class loader, the class file running module 403 is specifically configured to: and the self-defined class loader loads the decrypted class files into a virtual machine memory space to run according to the class file loading sequence corresponding to the target application software.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
The class file running device can execute the class file running method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the class file running method.
Example five
Fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention. Fig. 5 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in fig. 5 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in FIG. 5, the computer device 12 is in the form of a general purpose computing device. Components of computer device 12 may include, but are not limited to: one or more processors 16, a memory 28, a bus 18 that connects the various system components, including the memory 28 and the processor 16.
Bus 18 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, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard disk drive"). Although not shown in fig. 5, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and/or any devices (e.g., network card, modem, etc.) that enable the computer device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Moreover, computer device 12 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be appreciated that although not shown in fig. 5, other hardware and/or software modules may be used in connection with computer device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processor 16 executes programs stored in the memory 28 to perform various functional applications and data processing, thereby implementing the file-like encryption method provided by the embodiment of the present invention: invoking a compiler to compile source program codes of target application software to generate at least one class file of the target application software; calling a file encryption plug-in, encrypting each class file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted class files to obtain a compressed file of the target application software; and sending the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software.
Or, the class file running method provided by the embodiment of the invention is realized: receiving a compressed file of target application software, wherein the compressed file of target application software comprises at least one encrypted class file of the target application software; decompressing the compressed file of the target application software to obtain encrypted class files of the target application software; and sending a loading request corresponding to the target application software to a custom class loader, decrypting the encrypted class files by the custom class loader by using a preset decryption algorithm corresponding to the target application software, and loading the decrypted class files into a virtual machine memory space for operation.
Example six
A sixth embodiment of the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the class file encryption method provided by the embodiments of the present invention: invoking a compiler to compile source program codes of target application software to generate at least one class file of the target application software; calling a file encryption plug-in, encrypting each class file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted class files to obtain a compressed file of the target application software; and sending the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software.
Or, the class file running method provided by the embodiment of the invention is realized: receiving a compressed file of target application software, wherein the compressed file of target application software comprises at least one encrypted class file of the target application software; decompressing the compressed file of the target application software to obtain encrypted class files of the target application software; and sending a loading request corresponding to the target application software to a custom class loader, decrypting the encrypted class files by the custom class loader by using a preset decryption algorithm corresponding to the target application software, and loading the decrypted class files into a virtual machine memory space for operation.
Any combination of one or more computer readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
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.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or computer device. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (8)

1. A method of encrypting a class file, comprising:
invoking a compiler to compile source program codes of target application software to generate at least one class file of the target application software;
calling a file encryption plug-in, encrypting each class file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted class files to obtain a compressed file of the target application software;
transmitting the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software;
the calling file encryption plug-in encrypts each class file by using a preset encryption algorithm corresponding to the target application software, and the calling file encryption plug-in comprises the following steps:
and calling the file encryption plug-in to execute the following operations:
determining a preset encryption algorithm corresponding to the target application software according to the identification information of the target application software;
sequentially acquiring one class file from all class files of the target application software as a current processing class file;
Encrypting the current processing class file by using a preset encryption algorithm corresponding to the target application software to obtain an encrypted current processing class file;
replacing the current processing class file with the encrypted current processing class file;
and returning to execute the operation of sequentially acquiring one class file in all class files of the target application software as the current processing class file until the encryption and replacement of all class files of the target application software are completed.
2. The method of claim 1, wherein the file encryption plug-in is a preconfigured maven plug-in.
3. A method of class file operation, comprising:
receiving a compressed file of target application software, wherein the compressed file of target application software comprises at least one encrypted class file of the target application software;
decompressing the compressed file of the target application software to obtain encrypted class files of the target application software;
sending a loading request corresponding to the target application software to a custom class loader, decrypting the encrypted class files by using a preset decryption algorithm corresponding to the target application software through the custom class loader, and loading the decrypted class files into a virtual machine memory space for operation;
The decrypting, by the custom class loader, each encrypted class file by using a preset decryption algorithm corresponding to the target application software includes:
executing the following operations through the custom class loader:
when a loading request corresponding to the target application software is detected, determining a preset decryption algorithm corresponding to the target application software according to the identification information of the target application software;
sequentially acquiring one encrypted class file in all encrypted class files of the target application software as a current processing class file;
decrypting the current processing type file by using a preset decryption algorithm corresponding to the target application software to obtain a decrypted current processing type file;
replacing the current processing class file with the decrypted current processing class file;
and returning to execute the operation of sequentially acquiring one encrypted class file in all the encrypted class files of the target application software as the current processing class file until decryption and replacement of all the encrypted class files of the target application software are completed.
4. The method of claim 3, wherein loading each decrypted class file into a virtual machine memory space for execution by a custom class loader, comprising:
And the self-defined class loader loads the decrypted class files into a virtual machine memory space to run according to the class file loading sequence corresponding to the target application software.
5. A document-like encryption apparatus, comprising:
the class file generation module is used for calling a compiler to compile source program codes of target application software and generating at least one class file of the target application software;
the class file encryption module is used for calling a file encryption plug-in, encrypting each class file by using a preset encryption algorithm corresponding to the target application software, and packaging the encrypted class files to obtain a compressed file of the target application software;
the compressed file sending module is used for sending the compressed file of the target application software to target terminal equipment so that the target terminal equipment runs each class file of the target application software according to the compressed file of the target application software;
the class file encryption module is specifically configured to, when executing an operation of calling a file encryption plug-in and encrypting each class file by using a preset encryption algorithm corresponding to the target application software: and calling the file encryption plug-in to execute the following operations: determining a preset encryption algorithm corresponding to the target application software according to the identification information of the target application software; sequentially acquiring one class file from all class files of the target application software as a current processing class file; encrypting the current processing class file by using a preset encryption algorithm corresponding to the target application software to obtain an encrypted current processing class file; replacing the current processing class file with the encrypted current processing class file; and returning to execute the operation of sequentially acquiring one class file in all class files of the target application software as the current processing class file until the encryption and replacement of all class files of the target application software are completed.
6. A document-like operation apparatus, comprising:
the compressed file receiving module is used for receiving a compressed file of target application software, wherein the compressed file of the target application software comprises at least one encrypted class file of the target application software;
the compressed file decompression module is used for decompressing the compressed file of the target application software to obtain encrypted class files of the target application software;
the class file running module is used for sending a loading request corresponding to the target application software to a custom class loader, decrypting the encrypted class files by using a preset decryption algorithm corresponding to the target application software through the custom class loader, and loading the decrypted class files into a virtual machine memory space for running;
the class file running module is specifically configured to, when executing the operation of decrypting each encrypted class file by the custom class loader by using a preset decryption algorithm corresponding to the target application software: executing the following operations through the custom class loader: when a loading request corresponding to the target application software is detected, determining a preset decryption algorithm corresponding to the target application software according to the identification information of the target application software; sequentially acquiring one encrypted class file in all encrypted class files of the target application software as a current processing class file; decrypting the current processing type file by using a preset decryption algorithm corresponding to the target application software to obtain a decrypted current processing type file; replacing the current processing class file with the decrypted current processing class file; and returning to execute the operation of sequentially acquiring one encrypted class file in all the encrypted class files of the target application software as the current processing class file until decryption and replacement of all the encrypted class files of the target application software are completed.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the class file encryption method according to any one of claims 1-2 or the class file running method according to any one of claims 3-4 when executing the computer program.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements a class file encryption method according to any one of claims 1-2 or a class file running method according to any one of claims 3-4.
CN202110423886.0A 2021-04-20 2021-04-20 Class file encryption method, class file operation method, device, equipment and medium Active CN113032741B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110423886.0A CN113032741B (en) 2021-04-20 2021-04-20 Class file encryption method, class file operation method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110423886.0A CN113032741B (en) 2021-04-20 2021-04-20 Class file encryption method, class file operation method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN113032741A CN113032741A (en) 2021-06-25
CN113032741B true CN113032741B (en) 2024-01-26

Family

ID=76457652

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110423886.0A Active CN113032741B (en) 2021-04-20 2021-04-20 Class file encryption method, class file operation method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN113032741B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113489723B (en) * 2021-07-05 2022-11-22 平安科技(深圳)有限公司 Data transmission method, system, computer device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104268444A (en) * 2014-08-25 2015-01-07 浪潮电子信息产业股份有限公司 Cloud OS Java source code protection method
CN105022936A (en) * 2014-04-30 2015-11-04 北京畅游天下网络技术有限公司 Class file encryption and decryption method and class file encryption and decryption device
CN111639311A (en) * 2020-05-29 2020-09-08 杭州安恒信息技术股份有限公司 Method, apparatus, computer device and medium for preventing decompiling of executable files
CN112395564A (en) * 2020-11-17 2021-02-23 平安普惠企业管理有限公司 Protection and operation method, device, equipment and storage medium of class file

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105022936A (en) * 2014-04-30 2015-11-04 北京畅游天下网络技术有限公司 Class file encryption and decryption method and class file encryption and decryption device
CN104268444A (en) * 2014-08-25 2015-01-07 浪潮电子信息产业股份有限公司 Cloud OS Java source code protection method
CN111639311A (en) * 2020-05-29 2020-09-08 杭州安恒信息技术股份有限公司 Method, apparatus, computer device and medium for preventing decompiling of executable files
CN112395564A (en) * 2020-11-17 2021-02-23 平安普惠企业管理有限公司 Protection and operation method, device, equipment and storage medium of class file

Also Published As

Publication number Publication date
CN113032741A (en) 2021-06-25

Similar Documents

Publication Publication Date Title
WO2021217980A1 (en) Java code packing method and system
US20160203087A1 (en) Method for providing security for common intermediate language-based program
CN104573416A (en) Method and device for generating application installation package and executing application
CN109885990B (en) Script management method
US20180067777A1 (en) Application protection method, server, and terminal
CN113568680B (en) Dynamic link library protection method, device, equipment and medium for application program
US9256756B2 (en) Method of encryption and decryption for shared library in open operating system
CN111832014A (en) Dynamic loading-based Java SDK code encryption and decryption method and terminal
CN108898007A (en) A kind of safety method based on JavaAgent and dll enhancing Java distribution software
CN110619224A (en) Data processing method and related device
US9292708B2 (en) Protection of interpreted source code in virtual appliances
CN113032741B (en) Class file encryption method, class file operation method, device, equipment and medium
CN111382447B (en) Encryption method for installation package, storage medium and computer equipment
CN112115491B (en) Symmetric encryption key protection method, device, equipment and storage medium
CN117150515B (en) Safety protection method for EDA secondary development source code, electronic equipment and storage medium
CN117313046A (en) Code reinforcement method, code loading method, device and medium
CN109995774B (en) Key authentication method, system, device and storage medium based on partial decryption
CN109995534B (en) Method and device for carrying out security authentication on application program
CN114154123B (en) Encryption protection method applied to Python project
CN115033870A (en) Anti-malicious tampering code method and device based on big data cloud deployment
CN114329535A (en) File encryption method and device, electronic equipment and computer readable medium
CN113836582A (en) Software encryption and decryption method and device, electronic equipment and storage medium
CN111460464B (en) Data encryption and decryption method and device, electronic equipment and computer storage medium
CN113420313A (en) Program safe operation and encryption method and device, equipment and medium thereof
CN114943062B (en) Data processing method, device, electronic equipment and computer readable storage medium

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