[go: up one dir, main page]

WO2015058620A1 - Method and apparatus for generating installation package corresponding to an application and executing application - Google Patents

Method and apparatus for generating installation package corresponding to an application and executing application Download PDF

Info

Publication number
WO2015058620A1
WO2015058620A1 PCT/CN2014/088279 CN2014088279W WO2015058620A1 WO 2015058620 A1 WO2015058620 A1 WO 2015058620A1 CN 2014088279 W CN2014088279 W CN 2014088279W WO 2015058620 A1 WO2015058620 A1 WO 2015058620A1
Authority
WO
WIPO (PCT)
Prior art keywords
codes
functions
executable file
application
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.)
Ceased
Application number
PCT/CN2014/088279
Other languages
French (fr)
Inventor
Lichun Zhang
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Publication of WO2015058620A1 publication Critical patent/WO2015058620A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Definitions

  • the present disclosure relates to the field of computer technology, and more particularly, to a method and apparatus of generating an installation package corresponding to an application and executing an application.
  • code obfuscation method One way to protect the codes of the installation package file in an application is to utilize a code obfuscation method.
  • the principle of code obfuscation method is by modifying class information names, function names and variable names using symbols which are different from the original names and therefore not easily recognized or easily understood.
  • the code obfuscation method is to increase the complexity and difficulties for other developers to reverse engineer or to read the codes of the application, thus protecting the codes of the installation package file of the application.
  • a function may be originally named “display () ” , utilizing a code obfuscation method may modify all the names of this function in the codes of the installation package file to be “D () ” . That way, other developers may not be able to determine the specific meaning of the function by the modified function name.
  • the current code obfuscation method only increases the difficulty of identifying the codes but may not protect the logic and data of the codes of the installation package file. Thus, the chance of modifying the installation package file itself still exists.
  • the present disclosure provides a method and apparatus for generating an installation package corresponding to an application and executing an application, the technical solution is as follows.
  • a method for generating an installation package corresponding to an application including: acquiring: an executable file which contains at least application logic and a first file which is different from the executable file by decompressing the installation package corresponding to the application; modifying first codes from within the executable file on types declaration of functions which implement the application logic, and encrypting second codes corresponding to the functions which implement the application logic; and generating a new application package from the corresponding application package by repackaging: the first file, the modified executable file and a preset dynamic link library, wherein the dynamic link library is utilized for: restoring the types declaration of the functions which implement the application logic, and decrypting the second codes corresponding to the functions which implement the application logic.
  • a method for executing an application including: when a system running an installation package corresponding to an application, acquiring from an installation package corresponding to the application: an executable file containing at least application logic, a first file which is different from the executable file and a preset dynamic link library; calling the dynamic link library, restoring types declaration of functions which implement the application logic from within first codes of the executable file, and decrypting second codes corresponding to the functions which implement the application logic; and executing the application by a modified executable file according to the first file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
  • an apparatus for generating an installation package corresponding to an application including: at least a processor with circuitry operating in conjunction with at least a memory storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units include: a first acquiring module, which causes the apparatus to acquire an executable file which contains at least application logic, a first file which is different from the executable file and a preset dynamic link library by decompressing the installation package corresponding to the application; a first modifying module, which causes the apparatus to modify types declaration of functions which implement the application logic from first codes in the executable file and encrypting second codes corresponding to the functions which implement the application logic; and a packaging module, which causes the apparatus to generate a new installation package corresponding to the application by re-packaging the first file, a modified executable file, and the preset dynamic link library, wherein the dynamic link library is configured for: restoring the types declaration of the functions which implement the application logic and decrypting the second codes corresponding to
  • an apparatus for executing an application including: at least a processor with circuitry operating in conjunction with at least a memory storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units include: an acquiring module, which causes the apparatus to acquire an executable file containing application logic, a first file which is different from the executable file, and a preset dynamic link library from an installation package corresponding to the application when the system runs the installation package corresponding to the application; a modifying module, which causes the apparatus to call the dynamic link library, restoring the types declaration of functions which implement the application logic from first codes in the executable file, and decrypting the second codes corresponding to the functions which implement the application logic; and an executing module, which causes the apparatus to execute the application according to the first file and a modified executable file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
  • the advantages of the technical solution provided in the various embodiments of the present disclosure include: regenerating a new installation package corresponding to an application by modifying the types declaration of functions which implement the application logic of the executable file (which the executable file contains the application logic of the original installation package corresponding to the application) and encrypting the codes corresponding to the functions.
  • the application logic for implementing the application may at least be hidden and therefore may not be modified by others, thus improving the security of the application.
  • Figure 1 is a flow chart illustrating an exemplary method for generating an installation package corresponding to an application, according to a first embodiment of the present disclosure
  • Figure 2 is a flow chart illustrating an exemplary method for generating an installation package corresponding to an application, according to a second embodiment of the present disclosure
  • Figure 3 is a flow chart illustrating an exemplary method for executing an application, according to a third embodiment of the present disclosure
  • Figure 4 is a flow chart illustrating an exemplary method for executing an application, according to a fourth embodiment of the present disclosure
  • Figure 5 is an exemplary structural block diagram of an apparatus for generating an installation package corresponding to an application, according to a fifth embodiment of the present disclosure.
  • Figure 6 is an exemplary structural block diagram of an apparatus for executing an application, according to a sixth embodiment of the present disclosure.
  • a first embodiment is disclosed to provide a method for generating an installation package corresponding to an application.
  • the method includes at least the following operations:
  • Step 101 acquiring: an executable file which contains at least application logic and a first file which is different from the executable file and a preset dynamic link library by decompressing the installation package corresponding to the application;
  • Step 102 modifying first codes from within the executable file on types declaration of functions which implement the application logic, and encrypting second codes corresponding to the functions which implement the application logic;
  • Step 103 generating a new application package from the corresponding application package by repackaging: the first file, the modified executable file and a preset dynamic link library, wherein the dynamic link library is utilized for: restoring the types declaration of the functions which implement the application logic, and decrypting the second codes corresponding to the functions which implement the application logic.
  • the above disclosed embodiment achieves the objective of: regenerating a new installation package corresponding to an application by modifying the types declaration of functions which implement the application logic of the executable file (which the executable file contains the application logic of the original installation package corresponding to the application) and encrypting the codes corresponding to the functions.
  • the application logic for implementing the application may at least be hidden and therefore may not be modified by others, thus improving the security of the application.
  • a second embodiment is disclosed to provide a method for generating an installation package corresponding to an application.
  • the method may include at least the following steps.
  • Step 201 acquiring an executable file which contains at least application logic and a first file which is different from the executable file from an installation package corresponding to an application by decompressing the installation package corresponding to an application.
  • an installation package corresponding to an application such as to an Android application may typically use a ZIP compression file format.
  • the installation package corresponding to the application e. g. , an Android application
  • a variety of documents in the installation package corresponding to an application may include necessary files required by Android rules, and may also include dynamic link library files written in other languages (such as C++ language) .
  • Android applications are mainly written in JAVA language. Since some functions combined with the system may not be achieved by JAVA language, the disclosure includes a method of adopting other languages may be provided and the Native method may be used to declare that the method may not be implemented by JAVA language, therefore the dynamic link library file may be called to call the corresponding method for loading the dynamic link library.
  • Step 202 modifying types declaration of functions which implement the application logic from codes in the executable file and encrypting the codes corresponding to the functions which implement the application logic.
  • modifying the types declaration of functions there may be a need to set a function list that should be modified in accordance with different types of applications. For example, for communication applications, communication functions may be selected to be in the function list that corresponds to the communication application for modification.
  • Step 202 may be embodied with the following more detailed steps.
  • Step 2021 decompiling the executable file to obtain the codes of the executable file, where the executable file may be in the “classes. dex” file in the installation package.
  • Step 2022 modifying the types declaration of the functions which implement the application logic to be the types declaration for calling functions of the dynamic link library in the codes of the executable file.
  • the functions which implement the application logic may be re-declared and encrypted such that other developers may not identify and modify the codes.
  • the types declaration have been modified in step 202, assuming even if the applications may be modified and repackaged by other developers, corresponding functions still may not be found according to the modified declaration types, and thus the modified applications (i. e. , by other developers) still may not be able to run normally by the system.
  • a specific way of modifying types declaration may be achieved by: modifying the types declaration corresponding to the functions of JAVA type into types declaration corresponding to the Native method, wherein the types declaration corresponding to the Native method may be the corresponding types declaration for calling functions of the called dynamic link library.
  • the original declaration may be: public void displayHelloWorld () .
  • This original declaration may be modified to become: public native void displayHelloWorld () .
  • the system may search a corresponding dynamic link library file according to the Native method. Therefore, if the dynamic link library may not be searched, the application may not be able to run normally.
  • Step 2023 encrypting the codes corresponding to the functions which implement the application logic in accordance with a preset encryption algorithm.
  • Step 2024 recording location information of the types declaration corresponding to the modified functions which implement the application logic, and storing the location information at a preset storage location in the codes of the executable file.
  • modified locations of the functions modified in step 2022 may be recorded and stored as the location information.
  • the modified locations may be located in a number of rows in the codes, which is not limited herein.
  • the location information may be saved, the location information may be stored at a preset storage location in the codes so that the types declaration may be restored by searching the location information when the application is to be run.
  • Step 2025 compiling codes of the executable file to generate a modified executable file. This process may be a step of regenerating the modified “classes. dex” file.
  • Step 203 acquiring an installation configuration file of the first file.
  • Step 204 adding codes for calling a preset dynamic link library into a preset field of the installation configuration file. More specifically, the file corresponding to the dynamic link library may be added in step 204 so that the dynamic link library file may be called in advance to restore the types declaration corresponding to functions and the codes corresponding to the functions which may be decrypted when the application is to be run.
  • the process of adding codes for calling preset dynamic link library into a preset field of the installation configuration file of step 204 may further include the following detail steps:
  • Step 2041 determining whether a preset field is provided in the installation configuration file. More specifically, the determination may be one or more of: to find out whether a preset field may be provided or not, to search whether a section of “application” may be provided in the file of “AndroidManifest. xml” (installation configuration file) and to find out whether an attribute field “android: name” may be provided in the section of “application” .
  • Step 2042 if the preset field is provided, adding codes for calling a preset dynamic link library into specified class information of the preset field.
  • the preset field of the installation configuration file may be the entrance of the application executed in the Android operation system. The Contents in this preset field may be called first when the application is executed.
  • the preset dynamic link library may be called first when the application is executed.
  • Step 2043 if no preset field may be provided, adding a preset field into a preset position in the installation configuration file, adding the specified class information into the preset field, and adding codes for calling the preset dynamic link library into the specified class information.
  • Step 205 generating an application installation package corresponding to an application by re-packaging: the first file, the modified executable file, and the preset dynamic link library. More specifically, the dynamic link library is configured for restoring the types declaration of functions which implement the application logic and decrypting the codes corresponding to the functions which implement the application logic.
  • the installation package corresponding to the application corresponding to the application may be generated by: re-packaging the modified “classes. dex” file, “AndroidManifest. xml” file, added files corresponding to the dynamic link library, and other files that are not modified.
  • the above disclosed embodiment achieves the objective of: regenerating a new installation package corresponding to an application by modifying the types declaration of functions which implement the application logic of the executable file (which the executable file contains the application logic of the original installation package corresponding to the application) and encrypting the codes corresponding to the functions.
  • the application logic for implementing the application may at least be hidden and therefore may not be modified by others, thus improving the security of the application.
  • the third embodiment of the present disclosure provides a method for executing an application.
  • the method includes at least the following steps:
  • Step 301 when a system running an installation package corresponding to an application, acquiring from an installation package corresponding to the application: an executable file containing at least application logic, a first file which is different from the executable file and a preset dynamic link library.
  • Step 302 calling the dynamic link library, restoring types declaration of functions which implement the application logic from within first codes of the executable file, and decrypting second codes corresponding to the functions which implement the application logic.
  • Step 303 executing the application by a modified executable file according to the first file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
  • the functions which implement the application logic of the executable file containing the application logic having the types declaration being modified may be restored via the preset dynamic link library, and the original installation package corresponding to an application may be restored by decryption.
  • the application being encrypted may be securely executed and the security of the application is thus improved.
  • a fourth embodiment of the present disclosure provides a method for executing an application. Referring to Figure 4, the method includes steps as follows.
  • Step 401 when a system running an installation package corresponding to an application, acquiring from an installation package corresponding to the application: an executable file containing at least application logic, a first file which is different from the executable file and a preset dynamic link library.
  • Step 402 calling the dynamic link library, restoring the types declaration of functions which implement the application logic from first codes in the executable file, and decrypting second codes corresponding to the functions which implement the application logic.
  • process of calling the dynamic link library in step 402 may further include the following detailed steps:
  • Step 4021 acquiring an installation configuration file from the first file and calling specified class information according to content of a preset field of the installation configuration file.
  • the application may be executed according to the content of the preset field of the installation configuration file of the installation package.
  • the specified class information may have been set in the preset field of the installation configuration file of the installation package.
  • the specified class information may be called first when the application is executed.
  • the content of the preset field of the installation configuration file of the installation package may be configured for being called first when the application is executed.
  • the class information may be called first.
  • Step 4022 calling the dynamic link library according to previously-added third codes of the preset dynamic link library in the specified class information. Since the third codes for calling the preset dynamic link library may have been added into the installation configuration file when the installation package corresponding to an application is generated, the third codes for calling the preset dynamic link library may be executed when the specified class information is called, thereby calling the dynamic link library.
  • the third codes for calling the preset dynamic link library may contain a saving path of a file corresponding to the dynamic link library, the file corresponding to the dynamic link library may be searched and called according to the saving path.
  • the dynamic link library may be configured for restoring the types declaration of functions which implement the application logic in step 402, and decrypting the second codes corresponding to the functions which implement the application logic. This process is the reverse process of step 202 of the second embodiment, the right executable file of the application may be acquired by restoring the types declaration corresponding to the functions and decrypting the second codes corresponding to the encrypted functions.
  • Step 4023 decompiling the executable file to obtain the first codes of the executable file.
  • the executable file may be the “ classes. dex ” file from the installation package.
  • Step 4024 searching location information of the types declaration corresponding to the modified functions which implement the application logic in a preset storage location from first codes in the executable file.
  • Step 4025 searching the modified functions which implement the application logic according to the location information, and modifying the types declaration corresponding to the functions to be types declaration for calling JAVA functions.
  • Step 4026 decrypting the second codes corresponding to the functions which implement the application logic according to the preset decryption algorithm.
  • Step 4027 compiling the first codes of the modified executable file and regenerating a modified executable file.
  • Step 403 executing the application by the modified executable file according to the first file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
  • the executable file “classes. dex” of the installation package has been restored to be the originally-unmodified executable file, thus, the application may be properly executed through the executable file and other files contained in the installation package.
  • the functions which implement the application logic in the executable file containing the application logic and have the types declaration thereof being modified are restored via the preset dynamic link library, and the original installation package corresponding to an application is restored by decryption. In this way, the application being encrypted is securely executed and the security of the application is thus improved.
  • a fifth embodiment of the present disclosure provides an apparatus (500) for generating an installation package corresponding to an application.
  • the apparatus includes: at least a processor with circuitry (507) operating in conjunction with at least a memory (508) storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units include:
  • a first acquiring module (501) which causes the apparatus (500) to acquire an executable file which contains at least application logic and a first file which is different from the executable file by decompressing the installation package corresponding to the application;
  • a first modifying module (502) , which causes the apparatus (500) to modify types declaration of functions which implement the application logic from first codes in the executable file and encrypting second codes corresponding to the functions which implement the application logic;
  • a packaging module (503) which causes the apparatus (500) to generate a new installation package corresponding to the application by re-packaging the first file, the modified executable file, and the preset dynamic link library, wherein the dynamic link library is configured for: restoring the types declaration of the functions which implement the application logic and decrypting the second codes corresponding to the functions which implement the application logic.
  • the first modifying module (502) may include: a first decompiling unit, which causes the apparatus to decompile the executable file to obtain the first codes of the executable file; a first modifying unit, which causes the apparatus to modify types declaration of the functions which implement the application logic to be types declaration for calling the functions of the dynamic link library; an encrypting unit, which causes the apparatus to encrypt the second codes corresponding to the functions which implement the application logic in accordance with a preset encryption algorithm; a recording unit, which causes the apparatus to record location information of the types declaration corresponding to the modified functions which implement the application logic, and storing the location information at a preset storage location from the first codes in the executable file; and a compiling unit, which causes the apparatus to compile the first codes of the executable file to generate the modified executable file.
  • a first decompiling unit which causes the apparatus to decompile the executable file to obtain the first codes of the executable file
  • a first modifying unit which causes the apparatus to modify types declaration of the functions which
  • the apparatus (500) may further include: a second acquiring module (504) , which causes the apparatus (500) to acquire an installation configuration file of the first file; and an adding module (505) , which causes the apparatus (500) to add third codes for calling the preset dynamic link library into a preset field of the installation configuration file.
  • a second acquiring module (504) which causes the apparatus (500) to acquire an installation configuration file of the first file
  • an adding module (505) which causes the apparatus (500) to add third codes for calling the preset dynamic link library into a preset field of the installation configuration file.
  • the adding module (505) may further include: a determining unit, which causes the apparatus to determine whether the preset field is provided in the installation configuration file; a first adding unit, which causes the apparatus to add the third codes for calling the preset dynamic link library into specified class information of the preset field if the preset field is provided; and a second adding unit, which causes the apparatus to add the preset field into a preset position in the installation configuration file and adding the specified class information into the preset field, and adding the third codes for calling the preset dynamic link library into the specified class information if no preset field is provided.
  • a sixth embodiment of the present disclosure provides an apparatus (600) for executing an application.
  • the apparatus (600) may include: at least a processor with circuitry (607) operating in conjunction with at least a memory (608) storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units include:
  • an acquiring module (601) which causes the apparatus (600) to acquire an executable file containing application logic, a first file which is different from the executable file, and a preset dynamic link library from an installation package corresponding to the application when the system runs the installation package corresponding to the application;
  • a modifying module (602) , which causes the apparatus (600) to call the dynamic link library, restoring the types declaration of functions which implement the application logic from first codes in the executable file, and decrypting the second codes corresponding to the functions which implement the application logic;
  • an executing module (603) , which causes the apparatus (600) to execute the application by a modified executable file according to the first file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
  • the modifying module (602) further includes: a first calling unit, which causes the apparatus to acquire an installation configuration file from the first file and calling specified class information according to content of a preset field of the installation configuration file; and a second calling unit, which causes the apparatus to call the dynamic link library according to previously-added third codes for calling preset dynamic link library of the class information.
  • the modifying module (602) further includes: a decompiling unit, which causes the apparatus to decompile the executable file to obtain the first codes of the executable file; a searching unit, which causes the apparatus to search location information of the types declaration corresponding to the modified functions which implement the application logic in a preset storage location from the first codes in the executable file; a modifying unit, which causes the apparatus to search the modified functions which implement the application logic according to the location information, and modifying the types declaration corresponding to the functions to be types declaration for calling JAVA functions; a decrypting unit, which causes the apparatus to decrypt the second codes corresponding to the functions which implement the application logic according to the preset decryption algorithm; and a compiling unit, which causes the apparatus to compile the first codes of the modified executable file and regenerating a modified executable file.
  • a decompiling unit which causes the apparatus to decompile the executable file to obtain the first codes of the executable file
  • a searching unit which causes the apparatus to search location information of the
  • the above disclosed apparatuses of Figures 5 and 6 achieve the objective of: regenerating a new installation package corresponding to an application by modifying the types declaration of functions which implement the application logic of the executable file (which the executable file contains the application logic of the original installation package corresponding to the application) and encrypting the codes corresponding to the functions.
  • the application logic for implementing the application may at least be hidden and therefore may not be modified by others, thus improving the security of the application.
  • sequence numbers of the above-mentioned embodiments may be intended only for description, instead of indicating the relative merits of the embodiments. It should be understood by those with ordinary skill in the art that all or some of the steps of the foregoing embodiments may be implemented by hardware, or software program codes stored on a non-transitory computer-readable storage medium with computer-executable commands stored within.
  • the disclosure may be implemented as an algorithm as codes stored in a program module or a system with multi-program-modules.
  • the computer-readable storage medium may be, for example, nonvolatile memory such as compact disc, hard drive. ROM or flash memory.
  • the computer-executable commands may enable a computer, a server, a smart phone, a tablet or any similar computing device to perform generating installation package corresponding to an application and executing an application.

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)
  • Stored Programmes (AREA)
  • Storage Device Security (AREA)

Abstract

The disclosure provides a method and apparatus for generating installation package corresponding to an application and executing an application. The method includes: acquiring: an executable file which contains at least application logic and a first file which is different from the executable file by decompressing the installation package corresponding to the application; modifying first codes from within the executable file on types declaration of functions which implement the application logic, and encrypting second codes corresponding to the functions which implement the application logic; and generating a new application package from the corresponding application package by repackaging: the first file, the modified executable file and a preset dynamic link library, wherein the dynamic link library is utilized for: restoring the types declaration of the functions which implement the application logic, and decrypting the second codes corresponding to the functions which implement the application logic.

Description

METHOD AND APPARATUS FOR GENERATING INSTALLATION PACKAGE CORRESPONDING TO AN APPLICATION AND EXECUTING APPLICATION
CROSS-REFERENCE TO RELATED APPLICATIONS
The application claims priority to Chinese Patent Application No. 2013105124256, filed on October 25, 2013, which is incorporated by reference in its entirety.
FIELD OF THE TECHNOLOGY
The present disclosure relates to the field of computer technology, and more particularly, to a method and apparatus of generating an installation package corresponding to an application and executing an application.
BACKGROUND
Android operating system and applications have been developed to meet various types of users ’ requirements. In the process of application developing, in order to prevent malicious intent from some who attempt to modify and re-package the application to disguise as an official application release to install the modified application files into users ’ terminals. Therefore, there is a need to protect the codes of the installation package file of the application.
One way to protect the codes of the installation package file in an application is to utilize a code obfuscation method. The principle of code obfuscation method is by modifying class information names, function names and variable names using symbols which are different from the original names and therefore not easily recognized or easily understood. In effect, the code obfuscation method is to increase the complexity and difficulties for other developers to reverse engineer or to read the codes of the application,  thus protecting the codes of the installation package file of the application.
For example, a function may be originally named “display () ” , utilizing a code obfuscation method may modify all the names of this function in the codes of the installation package file to be “D () ” . That way, other developers may not be able to determine the specific meaning of the function by the modified function name. The current code obfuscation method only increases the difficulty of identifying the codes but may not protect the logic and data of the codes of the installation package file. Thus, the chance of modifying the installation package file itself still exists.
SUMMARY
To solve the above mentioned problem, the present disclosure provides a method and apparatus for generating an installation package corresponding to an application and executing an application, the technical solution is as follows.
In an embodiment, a method for generating an installation package corresponding to an application is provided, including: acquiring: an executable file which contains at least application logic and a first file which is different from the executable file by decompressing the installation package corresponding to the application; modifying first codes from within the executable file on types declaration of functions which implement the application logic, and encrypting second codes corresponding to the functions which implement the application logic; and generating a new application package from the corresponding application package by repackaging: the first file, the modified executable file and a preset dynamic link library, wherein the dynamic link library is utilized for: restoring the types declaration of the functions which implement the application logic, and decrypting the second codes corresponding to the functions which implement the application logic.
In another embodiment, a method for executing an application is provided,  including: when a system running an installation package corresponding to an application, acquiring from an installation package corresponding to the application: an executable file containing at least application logic, a first file which is different from the executable file and a preset dynamic link library; calling the dynamic link library, restoring types declaration of functions which implement the application logic from within first codes of the executable file, and decrypting second codes corresponding to the functions which implement the application logic; and executing the application by a modified executable file according to the first file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
In another aspect, an apparatus for generating an installation package corresponding to an application is provided, including: at least a processor with circuitry operating in conjunction with at least a memory storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units include: a first acquiring module, which causes the apparatus to acquire an executable file which contains at least application logic, a first file which is different from the executable file and a preset dynamic link library by decompressing the installation package corresponding to the application; a first modifying module, which causes the apparatus to modify types declaration of functions which implement the application logic from first codes in the executable file and encrypting second codes corresponding to the functions which implement the application logic; and a packaging module, which causes the apparatus to generate a new installation package corresponding to the application by re-packaging the first file, a modified executable file, and the preset dynamic link library, wherein the dynamic link library is configured for: restoring the types declaration of the functions which implement the application logic and decrypting the second codes corresponding to the functions which implement the application logic, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes. 
In another aspect, an apparatus for executing an application is provided, including: at least a processor with circuitry operating in conjunction with at least a memory storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units include: an acquiring module, which causes the apparatus to acquire an executable file containing application logic, a first file which is different from the executable file, and a preset dynamic link library from an installation package corresponding to the application when the system runs the installation package corresponding to the application; a modifying module, which causes the apparatus to call the dynamic link library, restoring the types declaration of functions which implement the application logic from first codes in the executable file, and decrypting the second codes corresponding to the functions which implement the application logic; and an executing module, which causes the apparatus to execute the application according to the first file and a modified executable file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
The advantages of the technical solution provided in the various embodiments of the present disclosure include: regenerating a new installation package corresponding to an application by modifying the types declaration of functions which implement the application logic of the executable file (which the executable file contains the application logic of the original installation package corresponding to the application) and encrypting the codes corresponding to the functions. In this way, the application logic for implementing the application may at least be hidden and therefore may not be modified by others, thus improving the security of the application.
BRIEF DESCRIPTION OF THE DRAWINGS
The accompanying drawings may be included to provide further understanding of the claims and disclosure which may be incorporated in, and constitute a part of this  specification. The detailed description and illustrated embodiments described may serve to explain the principles defined by the claims.
Figure 1 is a flow chart illustrating an exemplary method for generating an installation package corresponding to an application, according to a first embodiment of the present disclosure;
Figure 2 is a flow chart illustrating an exemplary method for generating an installation package corresponding to an application, according to a second embodiment of the present disclosure;
Figure 3 is a flow chart illustrating an exemplary method for executing an application, according to a third embodiment of the present disclosure;
Figure 4 is a flow chart illustrating an exemplary method for executing an application, according to a fourth embodiment of the present disclosure;
Figure 5 is an exemplary structural block diagram of an apparatus for generating an installation package corresponding to an application, according to a fifth embodiment of the present disclosure; and
Figure 6 is an exemplary structural block diagram of an apparatus for executing an application, according to a sixth embodiment of the present disclosure.
DETAILED DESCRIPTION
The various embodiments of the disclosure may be further described in details in combination with attached drawings and embodiments below. It should be understood that the specific embodiments described here may be used only to explain the disclosure, and may not be which causes the device to limit the disclosure. In addition, for the sake of keeping description brief and concise, the newly added features, or features which may be different from those previously described in each new embodiment will be described in  details. Similar features may be referenced back to the prior descriptions in a prior numbered drawing or referenced ahead to a higher numbered drawing. Unless otherwise specified, all technical and scientific terms herein may have the same meanings as understood by a person skilled in the art.
A first embodiment is disclosed to provide a method for generating an installation package corresponding to an application. Referring to Figure 1, the method includes at least the following operations:
Step 101: acquiring: an executable file which contains at least application logic and a first file which is different from the executable file and a preset dynamic link library by decompressing the installation package corresponding to the application;
Step 102: modifying first codes from within the executable file on types declaration of functions which implement the application logic, and encrypting second codes corresponding to the functions which implement the application logic; and
Step 103: generating a new application package from the corresponding application package by repackaging: the first file, the modified executable file and a preset dynamic link library, wherein the dynamic link library is utilized for: restoring the types declaration of the functions which implement the application logic, and decrypting the second codes corresponding to the functions which implement the application logic.
The above disclosed embodiment achieves the objective of: regenerating a new installation package corresponding to an application by modifying the types declaration of functions which implement the application logic of the executable file (which the executable file contains the application logic of the original installation package corresponding to the application) and encrypting the codes corresponding to the functions. In this way, the application logic for implementing the application may at least be hidden and therefore may not be modified by others, thus improving the security of the application.
A second embodiment is disclosed to provide a method for generating an installation package corresponding to an application. Referring to Figure 2, the method may include at least the following steps.
Step 201: acquiring an executable file which contains at least application logic and a first file which is different from the executable file from an installation package corresponding to an application by decompressing the installation package corresponding to an application. More specifically, an installation package corresponding to an application such as to an Android application may typically use a ZIP compression file format. Thus, the installation package corresponding to the application (e. g. , an Android application) may be decompressed according to a normal ZIP compression solution to obtain a variety of documents in the installation package corresponding to the application.
A variety of documents in the installation package corresponding to an application may include necessary files required by Android rules, and may also include dynamic link library files written in other languages (such as C++ language) . Android applications are mainly written in JAVA language. Since some functions combined with the system may not be achieved by JAVA language, the disclosure includes a method of adopting other languages may be provided and the Native method may be used to declare that the method may not be implemented by JAVA language, therefore the dynamic link library file may be called to call the corresponding method for loading the dynamic link library.
Step 202: modifying types declaration of functions which implement the application logic from codes in the executable file and encrypting the codes corresponding to the functions which implement the application logic. Regarding modifying the types declaration of functions, there may be a need to set a function list that should be modified in accordance with different types of applications. For example, for communication  applications, communication functions may be selected to be in the function list that corresponds to the communication application for modification.
Step 202 may be embodied with the following more detailed steps.
Step 2021: decompiling the executable file to obtain the codes of the executable file, where the executable file may be in the “classes. dex” file in the installation package.
Step 2022: modifying the types declaration of the functions which implement the application logic to be the types declaration for calling functions of the dynamic link library in the codes of the executable file.
More specifically, to prevent the variety of documents in the installation package corresponding to the application from being modified by other developers, in the present embodiment, the functions which implement the application logic may be re-declared and encrypted such that other developers may not identify and modify the codes. In the same embodiment, after the types declaration have been modified in step 202, assuming even if the applications may be modified and repackaged by other developers, corresponding functions still may not be found according to the modified declaration types, and thus the modified applications (i. e. , by other developers) still may not be able to run normally by the system.
According to an embodiment of the disclosure, a specific way of modifying types declaration may be achieved by: modifying the types declaration corresponding to the functions of JAVA type into types declaration corresponding to the Native method, wherein the types declaration corresponding to the Native method may be the corresponding types declaration for calling functions of the called dynamic link library.
For example: suppose there is a function of “displayHelloWorld” in the “HelloWorld” type. The original declaration may be: public void displayHelloWorld () .  This original declaration, however, may be modified to become: public native void displayHelloWorld () .
In this regard, assuming even if the codes of the installation package corresponding to an application may have been modified, however, if a correct declaration type may not be restored, the system may search a corresponding dynamic link library file according to the Native method. Therefore, if the dynamic link library may not be searched, the application may not be able to run normally.
Step 2023: encrypting the codes corresponding to the functions which implement the application logic in accordance with a preset encryption algorithm.
Step 2024: recording location information of the types declaration corresponding to the modified functions which implement the application logic, and storing the location information at a preset storage location in the codes of the executable file.
More specifically, modified locations of the functions modified in step 2022 may be recorded and stored as the location information. In an embodiment, the modified locations may be located in a number of rows in the codes, which is not limited herein. After the location information may be saved, the location information may be stored at a preset storage location in the codes so that the types declaration may be restored by searching the location information when the application is to be run.
Step 2025: compiling codes of the executable file to generate a modified executable file. This process may be a step of regenerating the modified “classes. dex” file.
Step 203: acquiring an installation configuration file of the first file.
Step 204: adding codes for calling a preset dynamic link library into a preset field of the installation configuration file. More specifically, the file corresponding to the dynamic link library may be added in step 204 so that the dynamic link library file may be  called in advance to restore the types declaration corresponding to functions and the codes corresponding to the functions which may be decrypted when the application is to be run.
The process of adding codes for calling preset dynamic link library into a preset field of the installation configuration file of step 204 may further include the following detail steps:
Step 2041: determining whether a preset field is provided in the installation configuration file. More specifically, the determination may be one or more of: to find out whether a preset field may be provided or not, to search whether a section of “application” may be provided in the file of “AndroidManifest. xml” (installation configuration file) and to find out whether an attribute field “android: name” may be provided in the section of “application” .
Step 2042: if the preset field is provided, adding codes for calling a preset dynamic link library into specified class information of the preset field. More specifically, the preset field of the installation configuration file may be the entrance of the application executed in the Android operation system. The Contents in this preset field may be called first when the application is executed. Thus, by adding codes for calling the preset dynamic link library into the specified class information, the preset dynamic link library may be called first when the application is executed.
Step 2043: if no preset field may be provided, adding a preset field into a preset position in the installation configuration file, adding the specified class information into the preset field, and adding codes for calling the preset dynamic link library into the specified class information.
Step 205: generating an application installation package corresponding to an application by re-packaging: the first file, the modified executable file, and the preset dynamic link library. More specifically, the dynamic link library is configured for  restoring the types declaration of functions which implement the application logic and decrypting the codes corresponding to the functions which implement the application logic.
The installation package corresponding to the application corresponding to the application may be generated by: re-packaging the modified “classes. dex” file, “AndroidManifest. xml” file, added files corresponding to the dynamic link library, and other files that are not modified.
The above disclosed embodiment achieves the objective of: regenerating a new installation package corresponding to an application by modifying the types declaration of functions which implement the application logic of the executable file (which the executable file contains the application logic of the original installation package corresponding to the application) and encrypting the codes corresponding to the functions. In this way, the application logic for implementing the application may at least be hidden and therefore may not be modified by others, thus improving the security of the application.
The third embodiment of the present disclosure provides a method for executing an application. Referring to Figure 3, the method includes at least the following steps:
Step 301: when a system running an installation package corresponding to an application, acquiring from an installation package corresponding to the application: an executable file containing at least application logic, a first file which is different from the executable file and a preset dynamic link library.
Step 302: calling the dynamic link library, restoring types declaration of functions which implement the application logic from within first codes of the executable file, and decrypting second codes corresponding to the functions which implement the application logic.
Step 303: executing the application by a modified executable file according to  the first file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
In this embodiment of the present disclosure, when the repackaged installation package corresponding to an application may be executed, the functions which implement the application logic of the executable file containing the application logic having the types declaration being modified may be restored via the preset dynamic link library, and the original installation package corresponding to an application may be restored by decryption. In this way, the application being encrypted may be securely executed and the security of the application is thus improved.
A fourth embodiment of the present disclosure provides a method for executing an application. Referring to Figure 4, the method includes steps as follows.
Step 401: when a system running an installation package corresponding to an application, acquiring from an installation package corresponding to the application: an executable file containing at least application logic, a first file which is different from the executable file and a preset dynamic link library.
Step 402: calling the dynamic link library, restoring the types declaration of functions which implement the application logic from first codes in the executable file, and decrypting second codes corresponding to the functions which implement the application logic.
More specifically, the process of calling the dynamic link library in step 402 may further include the following detailed steps:
Step 4021: acquiring an installation configuration file from the first file and calling specified class information according to content of a preset field of the installation configuration file. When calling specified class information, the application may be  executed according to the content of the preset field of the installation configuration file of the installation package.
More specifically, the specified class information may have been set in the preset field of the installation configuration file of the installation package. Thus, the specified class information may be called first when the application is executed. The content of the preset field of the installation configuration file of the installation package may be configured for being called first when the application is executed. Thus, the class information may be called first.
Step 4022: calling the dynamic link library according to previously-added third codes of the preset dynamic link library in the specified class information. Since the third codes for calling the preset dynamic link library may have been added into the installation configuration file when the installation package corresponding to an application is generated, the third codes for calling the preset dynamic link library may be executed when the specified class information is called, thereby calling the dynamic link library.
The third codes for calling the preset dynamic link library may contain a saving path of a file corresponding to the dynamic link library, the file corresponding to the dynamic link library may be searched and called according to the saving path. The dynamic link library may be configured for restoring the types declaration of functions which implement the application logic in step 402, and decrypting the second codes corresponding to the functions which implement the application logic. This process is the reverse process of step 202 of the second embodiment, the right executable file of the application may be acquired by restoring the types declaration corresponding to the functions and decrypting the second codes corresponding to the encrypted functions.
The process of restoring the types declaration of functions which implement the application logic and decrypting the second codes corresponding to the functions which  implement the application logic may further be embodied with the following steps as follows.
Step 4023: decompiling the executable file to obtain the first codes of the executable file. The executable file may be the “ classes. dex ” file from the installation package.
Step 4024: searching location information of the types declaration corresponding to the modified functions which implement the application logic in a preset storage location from first codes in the executable file.
Step 4025: searching the modified functions which implement the application logic according to the location information, and modifying the types declaration corresponding to the functions to be types declaration for calling JAVA functions.
Step 4026: decrypting the second codes corresponding to the functions which implement the application logic according to the preset decryption algorithm.
Step 4027: compiling the first codes of the modified executable file and regenerating a modified executable file.
Step 403: executing the application by the modified executable file according to the first file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes. After the step 402 is performed, the executable file “classes. dex” of the installation package has been restored to be the originally-unmodified executable file, thus, the application may be properly executed through the executable file and other files contained in the installation package.
In this embodiment of the present disclosure, when the repackaged installation package corresponding to an application is executed, the functions which implement the application logic in the executable file containing the application logic and have the types  declaration thereof being modified are restored via the preset dynamic link library, and the original installation package corresponding to an application is restored by decryption. In this way, the application being encrypted is securely executed and the security of the application is thus improved.
A fifth embodiment of the present disclosure provides an apparatus (500) for generating an installation package corresponding to an application. Referring to Figure 5, the apparatus includes: at least a processor with circuitry (507) operating in conjunction with at least a memory (508) storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units include:
a first acquiring module (501) , which causes the apparatus (500) to acquire an executable file which contains at least application logic and a first file which is different from the executable file by decompressing the installation package corresponding to the application;
a first modifying module (502) , which causes the apparatus (500) to modify types declaration of functions which implement the application logic from first codes in the executable file and encrypting second codes corresponding to the functions which implement the application logic; and
a packaging module (503) , which causes the apparatus (500) to generate a new installation package corresponding to the application by re-packaging the first file, the modified executable file, and the preset dynamic link library, wherein the dynamic link library is configured for: restoring the types declaration of the functions which implement the application logic and decrypting the second codes corresponding to the functions which implement the application logic.
Wherein, the first modifying module (502) may include: a first decompiling unit, which causes the apparatus to decompile the executable file to obtain the first codes of the  executable file; a first modifying unit, which causes the apparatus to modify types declaration of the functions which implement the application logic to be types declaration for calling the functions of the dynamic link library; an encrypting unit, which causes the apparatus to encrypt the second codes corresponding to the functions which implement the application logic in accordance with a preset encryption algorithm; a recording unit, which causes the apparatus to record location information of the types declaration corresponding to the modified functions which implement the application logic, and storing the location information at a preset storage location from the first codes in the executable file; and a compiling unit, which causes the apparatus to compile the first codes of the executable file to generate the modified executable file.
Furthermore, the apparatus (500) may further include: a second acquiring module (504) , which causes the apparatus (500) to acquire an installation configuration file of the first file; and an adding module (505) , which causes the apparatus (500) to add third codes for calling the preset dynamic link library into a preset field of the installation configuration file.
The adding module (505) may further include: a determining unit, which causes the apparatus to determine whether the preset field is provided in the installation configuration file; a first adding unit, which causes the apparatus to add the third codes for calling the preset dynamic link library into specified class information of the preset field if the preset field is provided; and a second adding unit, which causes the apparatus to add the preset field into a preset position in the installation configuration file and adding the specified class information into the preset field, and adding the third codes for calling the preset dynamic link library into the specified class information if no preset field is provided.
A sixth embodiment of the present disclosure provides an apparatus (600) for executing an application. Referring to Figure 6, the apparatus (600) may include: at least a  processor with circuitry (607) operating in conjunction with at least a memory (608) storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units include:
an acquiring module (601) , which causes the apparatus (600) to acquire an executable file containing application logic, a first file which is different from the executable file, and a preset dynamic link library from an installation package corresponding to the application when the system runs the installation package corresponding to the application;
a modifying module (602) , which causes the apparatus (600) to call the dynamic link library, restoring the types declaration of functions which implement the application logic from first codes in the executable file, and decrypting the second codes corresponding to the functions which implement the application logic; and
an executing module (603) , which causes the apparatus (600) to execute the application by a modified executable file according to the first file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
The modifying module (602) further includes: a first calling unit, which causes the apparatus to acquire an installation configuration file from the first file and calling specified class information according to content of a preset field of the installation configuration file; and a second calling unit, which causes the apparatus to call the dynamic link library according to previously-added third codes for calling preset dynamic link library of the class information.
The modifying module (602) further includes: a decompiling unit, which causes the apparatus to decompile the executable file to obtain the first codes of the executable file; a searching unit, which causes the apparatus to search location information of the types  declaration corresponding to the modified functions which implement the application logic in a preset storage location from the first codes in the executable file; a modifying unit, which causes the apparatus to search the modified functions which implement the application logic according to the location information, and modifying the types declaration corresponding to the functions to be types declaration for calling JAVA functions; a decrypting unit, which causes the apparatus to decrypt the second codes corresponding to the functions which implement the application logic according to the preset decryption algorithm; and a compiling unit, which causes the apparatus to compile the first codes of the modified executable file and regenerating a modified executable file.
The above disclosed apparatuses of Figures 5 and 6 achieve the objective of: regenerating a new installation package corresponding to an application by modifying the types declaration of functions which implement the application logic of the executable file (which the executable file contains the application logic of the original installation package corresponding to the application) and encrypting the codes corresponding to the functions. In this way, the application logic for implementing the application may at least be hidden and therefore may not be modified by others, thus improving the security of the application.
The sequence numbers of the above-mentioned embodiments may be intended only for description, instead of indicating the relative merits of the embodiments. It should be understood by those with ordinary skill in the art that all or some of the steps of the foregoing embodiments may be implemented by hardware, or software program codes stored on a non-transitory computer-readable storage medium with computer-executable commands stored within. For example, the disclosure may be implemented as an algorithm as codes stored in a program module or a system with multi-program-modules. The computer-readable storage medium may be, for example, nonvolatile memory such as compact disc, hard drive. ROM or flash memory. The computer-executable commands may enable a computer, a server, a smart phone, a tablet or any similar computing device to  perform generating installation package corresponding to an application and executing an application.

Claims (14)

  1. A method for generating an installation package corresponding to an application, comprising:
    acquiring: an executable file which contains at least application logic and a first file which is different from the executable file by decompressing the installation package corresponding to the application;
    modifying first codes from within the executable file on types declaration of functions which implement the application logic, and encrypting second codes corresponding to the functions which implement the application logic; and
    generating a new application package from the corresponding application package by repackaging: the first file, the modified executable file and a preset dynamic link library, wherein the dynamic link library is utilized for:
    restoring the types declaration of the functions which implement the application logic, and
    decrypting the second codes corresponding to the functions which implement the application logic.
  2. The method according to claim 1, wherein the step of modifying the first codes from within the executable file on types declaration of functions which implement the application logic, and encrypting the second codes corresponding to the functions which implement the application logic, comprises:
    decompiling the executable file to obtain the first codes of the executable file;
    modifying the first codes within the executable file, the types declaration of the functions which implement the application logic into types declaration for calling functions of the dynamic link library;
    encrypting the second codes corresponding to the functions which implement the application logic in accordance with a preset encryption algorithm;
    recording location information of the types declaration corresponding to the modified first codes which implement the application logic, and storing the location information at a  preset storage location within the first codes of the executable file; and
    compiling the first codes of the executable file to generate a modified executable file.
  3. The method according to claim 1, wherein after the step of acquiring the executable file which contains at least the application logic and the first file which is different from the executable file, comprises:
    acquiring an installation configuration file of the first file; and
    adding third codes for calling the preset dynamic link library into a preset field of the installation configuration file.
  4. The method according to claim 3, wherein the step of adding the third codes for calling the preset dynamic link library into the preset field of the installation configuration file, comprises:
    determining whether the preset field is provided in the installation configuration file;
    if the preset field is provided, adding the third codes for calling the preset dynamic link library into specified class information of the preset field; and
    if no preset field is provided, adding a preset field into a preset position in the installation configuration file and adding the specified class information into the preset field, and adding the third codes for calling preset dynamic link library into the specified class information.
  5. A method for executing an application, comprising:
    when a system running an installation package corresponding to an application, acquiring from an installation package corresponding to the application: an executable file containing at least application logic, a first file which is different from the executable file and a preset dynamic link library;
    calling the dynamic link library, restoring types declaration of functions which implement the application logic from within first codes of the executable file, and decrypting second codes corresponding to the functions which implement the application logic; and
    executing the application by a modified executable file according to the first file,  wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
  6. The method according to claim 5, wherein the step of calling the dynamic link library, comprises:
    acquiring an installation configuration file from the first file, and calling specified class information according to content of a preset field of the installation configuration file; and
    calling the preset dynamic link library according to previously-added third codes of the preset dynamic link library in the specified class information.
  7. The method according to claim 5, wherein the step of restoring the types declaration of the functions which implement the application logic from within the first codes of the executable file, and decrypting the second codes corresponding to the functions which implement the application logic, comprises:
    decompiling the executable file to obtain the first codes of the executable file;
    searching location information of the types declaration corresponding to the modified functions which implement the application logic in a preset storage location from the first codes in the executable file;
    searching the modified functions which implement the application logic according to the location information, and modifying the types declaration corresponding to the functions to be types declaration for calling JAVA functions;
    decrypting the second codes corresponding to the functions which implement the application logic according to the preset decryption algorithm; and
    compiling the first codes of the modified executable file and regenerating a modified executable file.
  8. An apparatus for generating an installation package corresponding to an application, comprises at least a processor with circuitry operating in conjunction with at least a memory storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units comprise:
    a first acquiring module, which causes the apparatus to acquire an executable file  which contains at least application logic, a first file which is different from the executable file by decompressing the installation package corresponding to the application;
    a first modifying module, which causes the apparatus to modify types declaration of functions which  implement the application logic from first codes in a executable file and encrypting second codes corresponding to the functions which implement the application logic; and
    a packaging module, which causes the apparatus to generate a new installation package corresponding to the application by re-packaging the first file, a modified executable file, and a preset dynamic link library, wherein the dynamic link library is configured for:
    restoring the types declaration of the functions which implement the application logic and
    decrypting the second codes corresponding to the functions which implement the application logic,
    wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
  9. The apparatus according to claim 8, wherein the first modifying module comprises:
    a first decompiling unit, which causes the apparatus to decompile the executable file to obtain the first codes of the executable file;
    a first modifying unit, which causes the apparatus to modify types declaration of the functions which implement the application logic to be types declaration for calling the functions of the dynamic link library;
    an encrypting unit, which causes the apparatus to encrypt the second codes corresponding to the functions which implement the application logic in accordance with a preset encryption algorithm;
    a recording unit, which causes the apparatus to record location information of the types declaration corresponding to the modified first codes which implement the application logic, and storing the location information at a preset storage location from the first codes in the executable file; and
    a compiling unit, which causes the apparatus to compile the first codes of the executable file to generate the modified executable file.
  10. The apparatus according to claim 8, further comprising:
    a second acquiring module, which causes the apparatus to acquire an installation configuration file of the first file; and
    an adding module, which causes the apparatus to add third codes for calling the preset dynamic link library into a preset field of the installation configuration file.
  11. The apparatus according to claim 10, wherein the adding module comprises:
    a determining unit, which causes the apparatus to determine whether the preset field is provided in the installation configuration file;
    a first adding unit, which causes the apparatus to add the third codes for calling the preset dynamic link library into specified class information of the preset field if the preset field is provided; and
    a second adding unit, which causes the apparatus to add the preset field into a preset position in the installation configuration file and adding the specified class information into the preset field, and adding the third codes for calling the preset dynamic link library into the specified class information if no preset field is provided.
  12. An apparatus for executing an application, comprises at least a processor with circuitry operating in conjunction with at least a memory storing codes to be executed as a plurality of modules or units to perform functions, wherein the plurality of modules or units comprise:
    an acquiring module, which causes the apparatus to acquire an executable file containing application logic, a first file which is different from the executable file, and a preset dynamic link library from an installation package corresponding to the application when the system runs the installation package corresponding to the application;
    a modifying module, which causes the apparatus to call the dynamic link library, restoring the types declaration of functions which implement the application logic from first codes in the executable file, and decrypting the second codes corresponding to the functions which implement the application logic; and
    an executing module, which causes the apparatus to execute the application according  to the first file and a modified executable file, wherein the modified executable file comprises the restored types declaration of functions and the decrypted second codes.
  13. The apparatus according to claim 12, wherein the modifying module comprises:
    a first calling unit, which causes the apparatus to acquire an installation configuration file from the first file and calling specified class information according to content of a preset field of the installation configuration file; and
    a second calling unit, which causes the apparatus to call the dynamic link library according to previously-added third codes for calling preset dynamic link library of the class information.
  14. The apparatus according to claim 12, wherein the modifying module comprises:
    a decompiling unit, which causes the apparatus to decompile the executable file to obtain the first codes of the executable file;
    a searching unit, which causes the apparatus to search location information of the types declaration corresponding to the modified functions which implement the application logic in a preset storage location from the first codes in the executable file;
    a modifying unit, which causes the apparatus to search the modified functions which implement the application logic according to the location information, and modifying the types declaration corresponding to the functions to be types declaration for calling JAVA functions;
    a decrypting unit, which causes the apparatus to decrypt the second codes corresponding to the functions which implement the application logic according to the preset decryption algorithm; and
    a compiling unit, which causes the apparatus to compile the first codes of the modified executable file and regenerating a modified executable file.
PCT/CN2014/088279 2013-10-25 2014-10-10 Method and apparatus for generating installation package corresponding to an application and executing application Ceased WO2015058620A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310512425.6A CN104573416B (en) 2013-10-25 2013-10-25 A kind of method and device for generating application installation package, executing application
CN201310512425.6 2013-10-25

Publications (1)

Publication Number Publication Date
WO2015058620A1 true WO2015058620A1 (en) 2015-04-30

Family

ID=52992242

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/088279 Ceased WO2015058620A1 (en) 2013-10-25 2014-10-10 Method and apparatus for generating installation package corresponding to an application and executing application

Country Status (3)

Country Link
CN (1) CN104573416B (en)
TW (1) TWI530874B (en)
WO (1) WO2015058620A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062582A (en) * 2018-07-23 2018-12-21 北京云测信息技术有限公司 A kind of encryption method and device of application installation package
CN110309630A (en) * 2019-06-28 2019-10-08 南京冰鉴信息科技有限公司 A kind of Java code encryption method and device
CN110837630A (en) * 2019-11-11 2020-02-25 维沃移动通信有限公司 Login method, image processing method and electronic device
WO2020193583A1 (en) * 2019-03-28 2020-10-01 Banks And Acquirers International Holding Method for running secure code, corresponding devices, system and programs
CN112825035A (en) * 2019-11-21 2021-05-21 北京搜狗科技发展有限公司 Program installation file generating and processing method and device
CN114020324A (en) * 2021-09-29 2022-02-08 中孚安全技术有限公司 Executable file packaging and publishing method and system based on runtime library
CN114020278A (en) * 2020-07-19 2022-02-08 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106203007B (en) * 2015-05-08 2020-03-03 腾讯科技(深圳)有限公司 Code processing method and device and computing equipment
CN105068832B (en) * 2015-07-30 2018-06-01 北京奇虎科技有限公司 A kind of method and apparatus for generating executable file
CN105260184B (en) * 2015-10-15 2019-02-19 Oppo广东移动通信有限公司 Debugging method and device for restoring image file
CN107766096A (en) * 2016-08-19 2018-03-06 阿里巴巴集团控股有限公司 The generation method of application program installation kit, the operation method of application program and device
CN108228196A (en) * 2016-12-12 2018-06-29 腾讯科技(深圳)有限公司 The packaging method and device of application program
CN108279941B (en) * 2016-12-31 2021-06-15 阿里巴巴集团控股有限公司 Application program compression method and device
CN113761482A (en) * 2017-06-06 2021-12-07 杭州网易智企科技有限公司 Program code protection method and device
CN108388432A (en) * 2018-05-29 2018-08-10 浪潮软件股份有限公司 A kind of Android system Compilation Method and miniature compiling system
CN109033765A (en) * 2018-08-07 2018-12-18 麒麟合盛网络技术股份有限公司 The treating method and apparatus of application installation package
CN109408073B (en) * 2018-09-21 2021-10-08 北京大学 A non-intrusive application repackaging method for Android
CN109857454B (en) * 2018-12-15 2023-07-18 中国平安人寿保险股份有限公司 Method, device, electronic equipment and storage medium for generating and caching installation package
CN113110841A (en) * 2020-01-13 2021-07-13 奇安信科技集团股份有限公司 Mobile application program generation method and device, electronic equipment and storage medium
CN112083930B (en) * 2020-09-14 2024-06-14 华帝股份有限公司 Optimization method for android project compiling process
CN114090070A (en) * 2021-09-28 2022-02-25 阿里巴巴(中国)有限公司 Application program installation package file processing method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609284A (en) * 2012-02-01 2012-07-25 上海游安网络科技有限公司 Method for safely loading executable file
CN102760219A (en) * 2011-12-20 2012-10-31 北京安天电子设备有限公司 Android platform software protecting system, method and equipment
CN104021321A (en) * 2014-06-17 2014-09-03 北京奇虎科技有限公司 Reinforcing protection method and device for software installation package

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101256612B (en) * 2008-04-01 2010-11-03 北京飞天诚信科技有限公司 Program protection method and system based on .Net card
CN103140856B (en) * 2011-09-13 2016-02-17 松下电器产业株式会社 Content regeneration system, the information processing terminal, media server, safety device and server security device
CN103246848B (en) * 2013-03-26 2016-05-18 北京深思数盾科技股份有限公司 The method and apparatus of protection software security

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102760219A (en) * 2011-12-20 2012-10-31 北京安天电子设备有限公司 Android platform software protecting system, method and equipment
CN102609284A (en) * 2012-02-01 2012-07-25 上海游安网络科技有限公司 Method for safely loading executable file
CN104021321A (en) * 2014-06-17 2014-09-03 北京奇虎科技有限公司 Reinforcing protection method and device for software installation package

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062582A (en) * 2018-07-23 2018-12-21 北京云测信息技术有限公司 A kind of encryption method and device of application installation package
WO2020193583A1 (en) * 2019-03-28 2020-10-01 Banks And Acquirers International Holding Method for running secure code, corresponding devices, system and programs
FR3094515A1 (en) * 2019-03-28 2020-10-02 Ingenico Group secure code execution process, corresponding devices, system and programs
CN110309630A (en) * 2019-06-28 2019-10-08 南京冰鉴信息科技有限公司 A kind of Java code encryption method and device
CN110309630B (en) * 2019-06-28 2023-05-30 南京冰鉴信息科技有限公司 Java code encryption method and device
CN110837630A (en) * 2019-11-11 2020-02-25 维沃移动通信有限公司 Login method, image processing method and electronic device
CN112825035A (en) * 2019-11-21 2021-05-21 北京搜狗科技发展有限公司 Program installation file generating and processing method and device
CN114020278A (en) * 2020-07-19 2022-02-08 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium
CN114020324A (en) * 2021-09-29 2022-02-08 中孚安全技术有限公司 Executable file packaging and publishing method and system based on runtime library

Also Published As

Publication number Publication date
TW201516871A (en) 2015-05-01
TWI530874B (en) 2016-04-21
CN104573416B (en) 2018-07-17
CN104573416A (en) 2015-04-29

Similar Documents

Publication Publication Date Title
WO2015058620A1 (en) Method and apparatus for generating installation package corresponding to an application and executing application
KR101518420B1 (en) Apparatus and method for managing apk file in a android platform
KR101471589B1 (en) Method for Providing Security for Common Intermediate Language Program
US20150095653A1 (en) Method and apparatus of creating application package, method and apparatus of executing application package, and recording medium storing application package
KR102546601B1 (en) Method and apparatus for protecting kernel control-flow integrity using static binary instrumentaiton
CN105683990B (en) Method and apparatus for protecting dynamic base
CN104462959B (en) A reinforcement protection method, server and system for Android applications
US9443064B2 (en) Protecting method and system of java source code
KR101623096B1 (en) Apparatus and method for managing apk file in a android platform
US20190114401A1 (en) On device structure layout randomization for binary code to enhance security through increased entropy
CN103413073B (en) A kind of method and apparatus protecting JAVA executable program
KR102433011B1 (en) Method of apk file protection, apk file protection system performing the same, and storage medium storing the same
CN104392181A (en) SO file protection method and device and android installation package reinforcement method and system
WO2006009081A1 (en) Application execution device and application execution device application execution method
CN106663025A (en) Method, apparatus, and computer-readable medium for obfuscating execution of application on virtual machine
CN108133147B (en) Method and device for protecting executable code and readable storage medium
CN105512521A (en) Reinforcement and protection method and system for software installation package
CN109657488A (en) A kind of resource file cipher processing method, intelligent terminal and storage medium
CN105653432A (en) Processing method and device of crash data
US20150026483A1 (en) Systems and Methods for Mobile Application Protection
US11061998B2 (en) Apparatus and method for providing security and apparatus and method for executing security to protect code of shared object
CN110309630B (en) Java code encryption method and device
US8707050B1 (en) Integrity self-check of secure code within a VM environment using native VM code
Matsumoto et al. A proposal for the privacy leakage verification tool for android application developers
EP2856377B1 (en) Identification and execution of subsets of a plurality of instructions in a more secure execution environment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14855697

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC ( EPO FORM 1205A DATED 13/09/2016 )

122 Ep: pct application non-entry in european phase

Ref document number: 14855697

Country of ref document: EP

Kind code of ref document: A1