Application verification method, packaging method, processor and terminal device

By obtaining the verification values of the index file and the file to be verified in the application, determining whether the application has been tampered with, solving the problem that applications are susceptible to malicious tampering in the prior art, and achieving flexible checksum security guarantees for specific files.

CN116467756BActive Publication Date: 2025-07-18ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310259375.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-13
Publication Date
2025-07-18
Estimated Expiration
2043-03-13

AI Technical Summary

Technical Problem

In the prior art, applications are prone to abnormal operation due to malicious tampering with internal files, especially in systems that lack a unified development platform, which makes it difficult to effectively verify.

Method used

By obtaining the index file in the application, calculating its verification value, and comparing it with the preset value, obtaining the file to be checked based on the path information, calculating its verification value and comparing it with the preset value, determining whether the application contains an exception file. If there is no exception file, the verification will be determined to be successful.

Benefits of technology

It realizes targeted detection of specific files in the application, promptly detects tampering, and solves the problem of abnormal operation of the application due to malicious tampering of internal files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116467756B_ABST
    Figure CN116467756B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention discloses an application program verification method, a packaging method, a processor, and a terminal device. The application program verification method includes: when the verification condition is met, obtaining an index file from the application program; calculating a first verification value of the index file; when the first verification value is the same as a second verification value, determining path information where a file to be verified is located according to the index file, the second verification value being a preset value corresponding to the index file; obtaining the file to be verified from the application program according to the path information of the file to be verified; calculating a third verification value of the file to be verified; when there is no abnormal file in the application program, determining that the application program verification is successful, the abnormal file being a file to be verified for which the third verification value is different from a fourth verification value, the fourth verification value being a preset value corresponding to the file to be verified. Through the present invention, the technical problem in the related art that an application program is prone to abnormal operation due to malicious tampering of internal files is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of application program verification, and in particular, to an application program verification method, a packaging method, a processor, and a terminal device. Background Art

[0002] An application program installed on a user device usually consists of a large number of files, such as an executable program, a dynamic library, a data resource file, etc. These files are usually arranged in an exposed manner, and users can access these files. An attacker can modify some files in the application program to attack the application program, such as dynamic library hijacking and API black box call attacks. Therefore, verifying the application program to confirm whether the application program has been tampered with is an important means to ensure the security of the application program.

[0003] In the related art, during the process of verifying an application program, the application program is usually signed by using a developer certificate issued by a developer platform, and then the signature is verified by using the public key carried in the certificate. For a system without a unified development platform, it is difficult to use this method to verify the application program. This results in the internal files of these application programs lacking effective verification being easily maliciously tampered with, thereby causing abnormal operation of the application program.

[0004] Therefore, in the related art, there is a technical problem that the application program is prone to abnormal operation due to malicious tampering of internal files. For the above problems, no effective solution has been proposed yet.

[0005] The above information disclosed in the background art section is only used to enhance the understanding of the background art of the technology described in this article. Therefore, the background art may contain certain information that is not prior art known to those skilled in the art. Summary of the Invention

[0006] Embodiments of the present invention provide an application program verification method, a packaging method, a processor, and a terminal device to at least solve the technical problem that the application program in the related art is prone to abnormal operation due to malicious tampering of internal files.

[0007] According to the first aspect of the embodiments of the present invention, an application program verification method is provided, and the method includes: when the verification condition is met, obtaining an index file from the application program, where the index file records the path information of the file to be verified; calculating a first verification value of the index file; when the first verification value is the same as the second verification value, obtaining the file to be verified from the application program according to the path information of the file to be verified, where the second verification value is a preset value corresponding to the index file; calculating a third verification value of the file to be verified; when there is no abnormal file in the application program, determining that the application program verification is successful, where the abnormal file is a file to be verified whose third verification value is different from the fourth verification value, and the fourth verification value is a preset value corresponding to the file to be verified.

[0008] Further, the verification condition includes at least one of the following: the application program is installed, a start instruction of the application program is received, and a preset verification time is reached.

[0009] Further, the application program verification method further includes at least one of the following: when the index file does not exist, determining that the application program verification fails; when the first verification value is different from the second verification value, determining that the application program verification fails; when the file to be verified does not exist at the position corresponding to the path information, determining that the application program verification fails; when there is an abnormal file in the application program, determining that the application program verification fails.

[0010] Further, the first verification value, the second verification value, the third verification value, and the fourth verification value are all calculated through a preset calculation step, and the preset calculation step includes: obtaining the file to be calculated; calculating the hash value of the file to be calculated; encrypting the calculated hash value by using a preset encryption algorithm to obtain a verification value calculation result.

[0011] Further, the second verification value is extracted from the index file, and / or the fourth verification value is extracted from the corresponding file to be verified.

[0012] According to a second aspect of the embodiments of the present invention, there is also provided an application program verification device, including: a first acquisition unit, configured to acquire an index file from an application program when a verification condition is satisfied, where the index file records path information of a file to be verified; a first calculation unit, configured to calculate a first verification value of the index file; a second acquisition unit, configured to acquire the file to be verified from the application program according to the path information of the file to be verified when the first verification value is the same as a second verification value, where the second verification value is a preset value corresponding to the index file; a second calculation unit, configured to calculate a third verification value of the file to be verified; a first determination unit, configured to determine that the application program verification is successful when the application program does not include abnormal files, where an abnormal file is a file to be verified whose third verification value is different from a fourth verification value, and the fourth verification value is a preset value corresponding to the file to be verified.

[0013] According to a third aspect of the embodiments of the present invention, there is also provided an application program packaging method, including: compiling source code of an application program to obtain an executable file; determining a file to be verified from the executable file; calculating a fourth verification value corresponding to the file to be verified; storing the path information of the file to be verified into an index file; calculating a second verification value corresponding to the index file; packaging the executable file, the index file, the second verification value, and the fourth verification value to obtain a packaged file of the application program.

[0014] Further, packaging the executable file, the index file, the second verification value, and the fourth verification value to obtain a packaged file of the application program includes: storing the second verification value in the index file, and storing the fourth verification value in the file to be verified corresponding to the executable file.

[0015] According to a fourth aspect of the embodiments of the present invention, there is also provided a non-volatile storage medium, where the non-volatile storage medium includes a stored program, and when the program runs, it controls a device where the non-volatile storage medium is located to execute the above application program verification method, or when the program runs, it controls a device where the non-volatile storage medium is located to execute the above application program packaging method.

[0016] According to a fifth aspect of the embodiments of the present invention, there is also provided a processor, where the processor is used to run a program, and when the program runs, it executes the above application program verification method, or when the program runs, it executes the above application program packaging method.

[0017] According to a sixth aspect of the embodiments of the present invention, there is also provided a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where when the processor executes the computer program, it implements the above application program verification method, or when the processor executes the computer program, it implements the above application program packaging method.

[0018] When the application program verification method according to the embodiment of the present invention performs application program verification, it first obtains an index file from the application program. The index file records the path information of the file to be verified, and verifies the index file. Specifically, calculate the first verification value of the index file, and compare it with the preset second verification value. When the two are the same, it means that the index file has not been tampered with. On this basis, based on the path information of the file to be verified recorded in the index file, obtain the file to be verified from the corresponding path of the application program and verify it. Among them, the file to be verified can be one or more. During the process of verifying the file to be verified, calculate the third verification value of the file to be verified, and compare it with the preset fourth verification value. When the two are the same, it means that the file to be verified has not been tampered with. If the third verification value of a certain file to be verified is different from the preset fourth verification value, it means that it has been tampered with, and it is defined as an abnormal file. If after verifying all the files to be verified, it is found that the application program does not contain the above abnormal files, it means that each file to be verified in the application program has not been tampered with at this time, and it is determined that the application program verification is successful. In actual implementation, during the production process of the application program, according to the actual verification requirements or according to the importance of each file in the application program, the files to be verified can be flexibly selected, the path information of the files to be verified in the application program is stored in the index file, and the fourth verification value of the file to be verified and the second verification value of the index file are calculated. The fourth verification value and the second verification value are used as reference values for subsequent application program verification. When performing application program verification, by extracting the index file in the application program and calculating its first verification value, by comparing whether the first verification value is the same as the second verification value, it can be determined whether the index file has been tampered with, so as to ensure the accuracy of the file to be verified that needs to be verified subsequently. On the basis that the index file has not been tampered with, according to the path information recorded in the index file, the file to be verified can be extracted from the corresponding position in the application program, the third verification value is calculated according to the file to be verified, and by comparing whether the third verification value is the same as the fourth verification value, it can be determined whether the file to be verified has been tampered with. The application program verification method according to the embodiment of the present invention can specify the file to be verified through the index file. When the index file verification is successful, then based on it, obtain the file to be verified that needs to be verified for specific verification. This realizes the targeted detection of specific files in the application program. If it is necessary to detect whether a certain file has been tampered with, only need to use it as the file to be verified and incorporate its path information into the index file. The files to be verified can be flexibly specified according to the actual situation, and the files to be verified are verified according to the index of the index file, which is beneficial to timely discover whether the application program has been tampered with, and solves the problem that the application program in the related technology is prone to abnormal operation due to malicious tampering of internal files. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings described herein are used to provide a further understanding of the present invention and form a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0020] Figure 1 It is a schematic flowchart of an application program verification method provided by an embodiment of the present invention;

[0021] Figure 2 It is a schematic diagram of an application program verification device provided by an embodiment of the present invention;

[0022] Figure 3 It is a schematic process diagram of an application program packaging method provided by an embodiment of the present invention during the application program packaging process;

[0023] Figure 4 It is a schematic process diagram of an application program verification method provided by an embodiment of the present invention during the verification of an index file;

[0024] Figure 5 It is a schematic process diagram of an application program verification method provided by an embodiment of the present invention during the verification of a file to be verified. Detailed implementation manners

[0025] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

[0026] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. And the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse. The terms "first", "second", etc. in the specification, claims, and drawings of the present invention are used to distinguish different objects, rather than to limit a specific order.

[0027] Figure 1 It is an application program verification method according to an embodiment of the present invention. As Figure 1 shown, the method includes the following steps:

[0028] Step S102, when the verification condition is met, obtain an index file from the application, where the index file records the path information of the file to be verified;

[0029] Step S104, calculate the first verification value of the index file;

[0030] Step S106, when the first verification value is the same as the second verification value, obtain the file to be verified from the application according to the path information of the file to be verified, where the second verification value is a preset value corresponding to the index file;

[0031] Step S108, calculate the third verification value of the file to be verified;

[0032] Step S110, when the application does not contain abnormal files, determine that the application verification is successful, where the abnormal file is a file to be verified whose third verification value is different from the fourth verification value, and the fourth verification value is a preset value corresponding to the file to be verified.

[0033] When the application program verification method adopting the above solution verifies an application program, it will first obtain an index file from the application program. The index file records the path information of the file to be verified and verifies the index file. Specifically, calculate the first verification value of the index file and compare it with the preset second verification value. If the two are the same, it means that the index file has not been tampered with. On this basis, based on the path information of the file to be verified recorded in the index file, obtain the file to be verified from the corresponding path of the application program and verify it. Among them, the file to be verified can be one or more. During the process of verifying the file to be verified, calculate the third verification value of the file to be verified and compare it with the preset fourth verification value. If the two are the same, it means that the file to be verified has not been tampered with. If the third verification value of a certain file to be verified is different from the preset fourth verification value, it means that it has been tampered with, and it is defined as an abnormal file. If after verifying all the files to be verified, it is found that the application program does not contain the above abnormal files, it means that each file to be verified in the application program has not been tampered with, and at this time, it is determined that the application program verification is successful. In actual implementation, during the application program production process, according to actual verification requirements or according to the importance of each file in the application program, flexibly select the files to be verified, store the path information of the files to be verified in the application program in the index file, and calculate the fourth verification value of the files to be verified and the second verification value of the index file. The fourth verification value and the second verification value are used as reference values for subsequent application program verification. When performing application program verification, extract the index file in the application program and calculate its first verification value. By comparing whether the first verification value is the same as the second verification value, it can be determined whether the index file has been tampered with, so as to ensure the accuracy of the files to be verified that need to be verified subsequently. On the basis that the index file has not been tampered with, according to the path information recorded in the index file, the file to be verified can be extracted from the corresponding position in the application program, calculate the third verification value according to the file to be verified, and by comparing whether the third verification value is the same as the fourth verification value, it can be determined whether the file to be verified has been tampered with. The application program verification method of the embodiments of the present invention can specify the files to be verified through the index file. When the index file verification is successful, then based on it, obtain the files to be verified that need to be verified for specific verification. This realizes the targeted detection of specific files in the application program. If it is necessary to detect whether a certain file has been tampered with, only need to use it as the file to be verified and include its path information in the index file. The files to be verified can be flexibly specified according to the actual situation, and the files to be verified are verified according to the index of the index file, which is beneficial to timely discover whether the application program has been tampered with, and solves the problem that the application program in the related technology is prone to abnormal operation due to malicious tampering of internal files.

[0034] In actual implementation, the files to be verified can be flexibly selected according to the importance of each file in the application program or the requirements of verification. After calculating their fourth verification values, they are stored in the application program for subsequent verification. After all the files to be verified are determined, the index file can be determined, and then the second verification value of the index file is calculated and stored in the application program for subsequent verification.

[0035] Among them, according to the path information of the files to be verified recorded in the index file, there can be different implementation schemes, as long as the path information can be obtained from the index file. For example, in an optional implementation, the path information of the files to be verified is directly stored in the index file. In this way, the path information can be directly extracted from the index file. In another optional implementation, the index file stores the attribute information of the files to be verified, and the attribute information can be any information related to the files to be verified (such as file name, file size, file type, etc.). Based on the unique attribute information of the files to be verified, the path information of the files to be verified can be matched according to the preset corresponding relationship (such as by looking up a table).

[0036] The first verification value is calculated from the index file, and the second verification value is a preset value corresponding to the index file. In specific implementation, there can be various ways to obtain the second preset value. For example, in an optional implementation, the second preset value is stored in the index file and can be extracted from the index file when in use. In another optional implementation, the second preset value is stored in a preset location in the application program and can be extracted from the application program when in use, where the preset location can be flexibly selected according to the actual situation.

[0037] The verification condition is used to trigger the verification process of the application program. In actual implementation, according to different verification requirement timings, there can be various different selection methods for the verification condition. For example, the verification condition includes at least one of the following: the application program is installed, a startup instruction of the application program is received, a preset verification time is reached.

[0038] As described above, the file to be verified is the file that really needs to be verified in the application, and the index file is used to record which files are the files to be verified. Only when the index file and all the files to be verified pass the verification can it be determined that the application has not been tampered with. Correspondingly, if any one of the index file and the files to be verified fails to pass the verification, it means that the files in the application have been tampered with. Therefore, in this embodiment, the application verification method further includes at least one of the following: determining that the application verification fails when the index file does not exist; determining that the application verification fails when the first verification value is different from the second verification value; determining that the application verification fails when the file to be verified does not exist at the position corresponding to the path information; determining that the application verification fails when the application contains abnormal files.

[0039] In order to be able to verify whether the index file and the files to be verified have been tampered with, there are various implementation methods for the first verification value, the second verification value, the third verification value, and the fourth verification value:

[0040] In an optional implementation method, the first verification value, the second verification value, the third verification value, and the fourth verification value are all hash values (such as MD5 value, SHA1 value, SHA256 value, etc.). By calculating the hash values of the index file and the files to be verified, the two can be transformed into hash values of a fixed length through a hashing algorithm and output. Thus, by comparing the previously calculated hash values, it is convenient to determine whether the index file and / or the files to be verified have been modified.

[0041] In another optional implementation method, the first verification value, the second verification value, the third verification value, and the fourth verification value are all calculated through a pre-designed calculation step. The pre-designed calculation step includes: obtaining the file to be calculated; calculating the hash value of the file to be calculated; encrypting the calculated hash value using a preset encryption algorithm to obtain the calculation result of the verification value.

[0042] In this embodiment, when calculating the above-mentioned first verification value, second verification value, third verification value, and fourth verification value, the hash value will first be calculated based on the corresponding file to be calculated (index file or file to be verified), and then the preset encryption algorithm will be used to encrypt the hash value. This can make the calculated hash value more concealed, reduce the possibility that the verification principle is seen through and the application is modified, and is beneficial to improving the security of application verification.

[0043] In actual implementation, there are various specific forms to choose from for the preset encryption algorithm. In a preferred implementation method, the preset encryption algorithm can be a white-box signature algorithm (the encryption algorithm is combined with a specific key and processed through white-box cryptography technology to form a specific signature algorithm). Based on this algorithm, the security of encryption can be effectively improved, thereby further reducing the possibility of the application being cracked and tampered with.

[0044] In actual implementation, the preset second verification value and fourth verification value can be stored anywhere in the application program. For example, in an alternative implementation, the second verification value and fourth verification value can be stored in an index file, which facilitates extraction during verification. However, with this implementation method, it is easy for an attacker to infer the application program's verification method based on the content stored in the index file, and then discover attacks on the application program based on this, which has an adverse impact on the security of the application program verification. In a preferred implementation, the preset second verification value is stored in the index file, and the preset fourth verification value is stored in the file to be verified. In this way, information related to the storage path of the file to be verified and the verification value information will not be exposed in the index file at the same time, which is conducive to improving the concealment of the verification principle, thereby reducing the risk of the application program being tampered with.

[0045] The application program verification method of the present invention will be described below in conjunction with a specific embodiment as Figure 4 and Figure 5 shown. Figure 4 FIG. is a schematic diagram of the process of verifying an index file by an application program verification method provided by an embodiment of the present invention. Figure 5 FIG. is a schematic diagram of the process of verifying a file to be verified by an application program verification method provided by an embodiment of the present invention. In this embodiment, verification is performed before the application program starts. When performing application program verification, it is first determined whether there is a signature file (corresponding to the above-mentioned index file) in the application program. If not, the verification fails. If it exists, the hash value of the content of the signature file except the last line is calculated (since the second verification value is stored in the last line of the signature file in this embodiment, the second verification value in the signature file needs to be excluded when calculating the first verification value), and the calculated hash value is encrypted with white-box signature to obtain sign1 (i.e., the above-mentioned first verification value). By reading sign2 (the second verification value) stored in the last line of the signature file, it can be further determined whether sign1 and sign2 are the same, so as to determine whether the signature file has been tampered with. In the case where the two are different, it is determined that the signature file verification fails. In the case where the two are the same, it is determined that the signature file verification is successful.

[0046] As Figure 5As shown, after the signature file verification is successful, the relevant target files (corresponding to the files to be verified above) will be further verified. Specifically, the information is read line by line from the signature file, and the path information of a target file is stored in each line of information. According to this path information, the corresponding target file and sign1 (corresponding to the fourth verification value above) can be obtained from the application. By performing a hash calculation (hash value calculation) on the target file and then performing a white box signature on the hash value, sign2 (corresponding to the third verification value above) can be obtained. By comparing the third verification value and the fourth verification value, it can be determined whether the corresponding target file has been tampered with. If after reading the last line of content from the signature file, it is found that none of the target files have been tampered with, it is determined that the application verification is successful; otherwise, if any one or more target files have been tampered with, it is determined that the application verification fails.

[0047] Secondly, as Figure 2 shown, an embodiment of the present invention further provides an application verification device, which includes: a first acquisition unit, configured to acquire an index file from the application when the verification condition is met, and the index file records the path information of the file to be verified; a first calculation unit, configured to calculate the first verification value of the index file; a second acquisition unit, configured to acquire the file to be verified from the application according to the path information of the file to be verified when the first verification value is the same as the second verification value, where the second verification value is a preset value corresponding to the index file; a second calculation unit, configured to calculate the third verification value of the file to be verified; a first determination unit, configured to determine that the application verification is successful when there is no abnormal file in the application, where the abnormal file is a file to be verified with different third and fourth verification values, and the fourth verification value is a preset value corresponding to the file to be verified.

[0048] In this embodiment, the verification condition includes at least one of the following: the application is installed, a start instruction of the application is received, and a preset verification time is reached.

[0049] The application verification device further includes at least one of the following: a second determination unit, configured to determine that the application verification fails when the index file does not exist; a third determination unit, configured to determine that the application verification fails when the first verification value is different from the second verification value; a fourth determination unit, configured to determine that the application verification fails when the file to be verified does not exist at the position corresponding to the path information; a fifth determination unit, configured to determine that the application verification fails when there is an abnormal file in the application.

[0050] The application program verification device further includes a verification value calculation unit, which is used to execute a pre-designed calculation step. The first verification value, the second verification value, the third verification value, and the fourth verification value are all obtained through the pre-designed calculation step. The pre-designed calculation step includes: obtaining the file to be calculated; calculating the hash value of the file to be calculated; encrypting the calculated hash value using a preset encryption algorithm to obtain the verification value calculation result.

[0051] The second verification value is extracted from the index file, and / or the fourth verification value is extracted from the corresponding file to be verified.

[0052] In addition, an embodiment of the present invention further provides an application program packaging method, including: compiling the source code of the application program to obtain an executable file; determining the file to be verified from the executable file; calculating the fourth verification value corresponding to the file to be verified; storing the path information of the file to be verified in the index file; calculating the second verification value corresponding to the index file; packaging the executable file, the index file, the second verification value, and the fourth verification value to obtain a packaged file of the application program.

[0053] In the application program packaging method of this embodiment, during the process of packaging the application program, first compile the source code of the application program to generate an executable file, then determine the file to be verified that needs to be verified from it, and calculate the fourth verification value of the file to be verified. The file to be verified can be one or more. After determining the file to be verified, the path information of the file to be verified will be stored in the index file, and the second verification value of the index file will be calculated. Then, during the packaging process, the index file will be packaged together with the executable file as part of the application program file package. At the same time, the second verification value and the fourth verification value will be stored in the packaged file. In this way, during subsequent application program verification, the second verification value and the fourth verification value can be used to verify whether the index file and the file to be verified have been modified. During verification, the index file can be used as an index for the file to be verified that needs to be verified, so that the file to be verified that needs to be verified can be flexibly specified according to the actual situation, and it can be verified according to the index of the index file, so as to timely discover whether the application program has been tampered with, which is convenient for the subsequent application program verification process, and solves the problem that the application program in the related art is prone to abnormal operation due to malicious tampering of internal files.

[0054] Packaging the executable file, the index file, the second verification value, and the fourth verification value to obtain a packaged file of the application program includes: storing the second verification value in the index file, and storing the fourth verification value in the corresponding file to be verified in the executable file.

[0055] Figure 3 It is a schematic diagram of the process of packaging an application program provided by an embodiment of the present invention during the application program packaging process, as Figure 3As shown, during the process of packaging an application, the source code of the application is compiled to generate an executable file, and then a signature step is performed. The signature step calculates the check values of the files to be checked that have check requirements, obtains multiple fourth check values, stores the path information of the files to be checked in the signature file (corresponding to the above-mentioned index file), and calculates the second check value of the index file. In this embodiment, for the convenience of the check process, the second check value of the index file and the fourth check value of the file to be checked are both stored in the index file. Then, the executable file, the index file, the second check value, and the fourth check value are packaged to form a packaged file Wuying.zip.

[0056] In addition, an embodiment of the present invention further provides a non-volatile storage medium. The non-volatile storage medium includes a stored program. When the program runs, it controls the device where the non-volatile storage medium is located to execute the above-mentioned application check method, or when the program runs, it controls the device where the non-volatile storage medium is located to execute the above-mentioned application packaging method.

[0057] Furthermore, an embodiment of the present invention further provides a processor. The processor is used to run a program. When the program runs, it executes the above-mentioned application check method, or when the program runs, it executes the above-mentioned application packaging method.

[0058] Finally, an embodiment of the present invention further provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-mentioned application check method, or when the processor executes the computer program, it implements the above-mentioned application packaging method.

[0059] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments. Moreover, the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0060] In the above embodiments of the present invention, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0061] In several embodiments provided in the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units can be a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings or direct couplings or communication connections shown or discussed with each other can be through some interfaces. The indirect couplings or communication connections of units or modules can be in electrical or other forms.

[0062] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0063] In addition, in each embodiment of the present invention, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0064] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The foregoing storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks, or optical discs and other various media that can store program codes.

[0065] The above is only the preferred embodiment of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.

Claims

1. An application program verification method, comprising: When the verification condition is met, obtain an index file from the application program, where the index file records the path information of the file to be verified; Calculate a first verification value of the index file; When the first verification value is the same as a second verification value, obtain the file to be verified from the application program according to the path information of the file to be verified, where the second verification value is a preset value corresponding to the index file; Calculate a third verification value of the file to be verified; When there is no abnormal file in the application program, determine that the application program verification is successful, where the abnormal file is the file to be verified whose third verification value is different from a fourth verification value, and the fourth verification value is a preset value corresponding to the file to be verified.

2. The application program verification method according to claim 1, wherein, The verification condition includes at least one of the following: the application program is installed, a start instruction of the application program is received, a preset verification time is reached.

3. The application program verification method according to claim 1, wherein, The application program verification method further includes at least one of the following: When the index file does not exist, determine that the application program verification fails; When the first verification value is different from the second verification value, determine that the application program verification fails; When the file to be verified does not exist at the position corresponding to the path information, determine that the application program verification fails; When there is an abnormal file in the application program, determine that the application program verification fails.

4. The application program verification method according to any one of claims 1 to 3, wherein, The first verification value, the second verification value, the third verification value, and the fourth verification value are all calculated through a preset calculation step, and the preset calculation step includes: Obtain the file to be calculated; Calculate the hash value of the file to be calculated; Encrypt the calculated hash value by using a preset encryption algorithm to obtain a verification value calculation result.

5. The application program verification method according to any one of claims 1 to 3, wherein The second verification value is extracted from the index file, and / or the fourth verification value is extracted from the corresponding file to be verified.

6. An application program verification device, comprising: A first acquisition unit, configured to obtain an index file from an application program when the verification condition is met, where the index file records the path information of the file to be verified; A first calculation unit, configured to calculate a first verification value of the index file; A second acquisition unit, configured to obtain the file to be verified from the application program according to the path information of the file to be verified when the first verification value is the same as a second verification value, where the second verification value is a preset value corresponding to the index file; A second calculation unit, configured to calculate a third verification value of the file to be verified; A first determination unit, configured to determine that the application program verification is successful when there is no abnormal file in the application program, where the abnormal file is the file to be verified whose third verification value is different from a fourth verification value, and the fourth verification value is a preset value corresponding to the file to be verified.

7. An application program packaging method, comprising: Compile the source code of the application program to obtain an executable file; Determine the file to be verified from the executable file; Calculate the fourth check value corresponding to the file to be verified; Store the path information of the file to be verified in the index file; Calculate the second check value corresponding to the index file; Package the executable file, the index file, the second check value, and the fourth check value to obtain the packaged file of the application program.

8. The application program packaging method according to claim 7, wherein, Packaging the executable file, the index file, the second check value, and the fourth check value to obtain the packaged file of the application program includes: Store the second check value in the index file, and store the fourth check value in the file to be verified corresponding to the executable file.

9. A non-volatile storage medium, wherein, The non-volatile storage medium includes a stored program, wherein when the program runs, it controls the device where the non-volatile storage medium is located to execute the application program verification method according to any one of claims 1 to 5, or when the program runs, it controls the device where the non-volatile storage medium is located to execute the application program packaging method according to claim 7 or 8.

10. A processor, wherein, The processor is used to run a program, wherein when the program runs, it executes the application program verification method according to any one of claims 1 to 5, or when the program runs, it executes the application program packaging method according to claim 7 or 8.

11. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the computer program, it implements the application program verification method according to any one of claims 1 to 5, or when the processor executes the computer program, it implements the application program packaging method according to claim 7 or 8.

Citation Information

Patent Citations

  • File calibration method and system

    CN106845278A

  • File processing method and device, storage medium and electronic equipment

    CN115129669A