A file signature method, computing device and storage medium

By summarizing files and signing multiple business operation types, the problem of malicious code tampering and virus intrusion in the software distribution process in the existing technology is solved, the security and integrity of the files are guaranteed, and the signature process is simplified.

CN113190834BActive Publication Date: 2024-09-24UNIONTECH SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110517488.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2024-09-24
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

It is difficult for the existing technology to effectively prevent malicious code tampering and virus intrusion during the software distribution process. In particular, there are flaws in the Android Apk signature mechanism and IOS App signature mechanism. Additional signatures cannot be performed when the secret key cannot be obtained at the same time, and IOS The App signing process is cumbersome.

Method used

Provide a file signature method that generates signature information by summarizing execution files and description files, encrypts and signs them according to the type of business operation, and merges them into files to ensure the integrity and security of files and support multiple businesses. Signing and verification of operation types.

Benefits of technology

It ensures the security and integrity of files, avoids malicious modifications and virus intrusions, simplifies the signature process in different application scenarios, and covers the reliability and integrity of the entire installation file.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113190834B
    Figure CN113190834B
Patent Text Reader

Abstract

The present invention discloses a file signature method, the file includes a description file and an execution file, the method includes the steps of: processing the execution file based on a preset summary algorithm to obtain first summary information; signing the first summary information according to multiple business operation types to obtain signature bytes; merging the signature bytes into the execution file to obtain a new execution file; processing the description file and the execution file based on a preset summary algorithm to obtain second summary information; signing the second summary information according to multiple business operation types to obtain a signature file; packaging the description file, the new execution file, and the signature file to obtain a signed file. The present invention also discloses a corresponding computing device and a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of invention patent 2021101222786 applied for on January 29, 2021. Technical Field

[0002] The present invention relates to the field of Internet technology, and in particular to a file signing method, a computing device and a storage medium. Background Art

[0003] In order to prevent software from being tampered with or maliciously injected with code during the software distribution process, which may cause viruses to invade the system during the software installation process, the Android Apk signature mechanism and the IOS App mechanism are commonly used in the prior art to strengthen the platform's control over third-party software.

[0004] Android Apk signature is to ensure the integrity and authenticity of the source of Apk, and is divided into two schemes: JAR signature and V2 signature. The core idea is to calculate the hash of the APK content, and then use the signature algorithm to sign the hash. During verification, the signature is decrypted by the signer's public key, and then compared with the APK content hash calculated by the verifier. If they are consistent, the verification passes. The JAR signature is stored in the META-INF directory through the signature in the Android Apk signature mechanism. The directory itself is not included in the signature verification process. Malicious code can live in the META-INFO directory and then repackaged into an Apk package. The V2 signature scheme requires that multiple signature keys be entered at the same time when executing the signature task, and each signature will overwrite the existing signature data. Therefore, the V2 signature requires that the user who performs the signature operation can obtain all the keys to complete the signature task at one time, and does not support additional signatures when the keys cannot be obtained at the same time.

[0005] The iOS App signature mechanism is derived from Apple's closed ecosystem, and third-party software distribution must go through Apple's distribution mechanism. To meet the development and debugging scenarios, the iOS App mechanism uses a double-layer signature plus a description document restriction method. The description document is related to AppId, device Id and other related data. Restricting devices and restricting signatures are only for a specific App, and it is necessary to develop corresponding tools to assist in completing the certificate application. The process is too cumbersome. Summary of the invention

[0006] To this end, the present invention provides a technical solution for data processing, in an effort to solve or at least alleviate the above problems.

[0007] According to one aspect of the present invention, a file signing method is provided, the file includes a description file and an execution file, the method includes the steps of: processing the execution file based on a preset digest algorithm to obtain first summary information; signing the first summary information according to multiple business operation types to obtain signature bytes; merging the signature bytes into the execution file to obtain a new execution file; processing the description file and the execution file based on a preset digest algorithm to obtain second summary information; signing the second summary information according to multiple business operation types to obtain a signature file; and packaging the description file, the new execution file, and the signature file to obtain a signed file.

[0008] Optionally, in the file signing method according to the present invention, the first summary information is signed according to the business operation type to obtain the signature byte, including the steps of: encrypting the first summary information using the corresponding encryption keys of multiple business operation types, and generating signer information corresponding to each business operation type; adding the multiple encrypted first summary information and the corresponding signer information to the signature byte according to the structure of the signature byte.

[0009] Optionally, in the file signing method according to the present invention, before adding multiple encrypted first summary information and corresponding signer information to the signature byte according to the structure of the signature byte, the step is included: determining whether there is a signature byte in the execution file, and if not, creating a signature byte according to a preset format.

[0010] Optionally, in the file signing method according to the present invention, the second summary information is signed according to multiple business operation types to obtain the signature file, including the steps of: encrypting the second summary information using encryption keys corresponding to the multiple business operation types, and generating multiple signer information corresponding to the business operation types; adding the multiple encrypted second summary information and the corresponding signer information to the signature file according to the structure of the signature file.

[0011] Optionally, in the file signing method according to the present invention, before adding multiple encrypted second summary information and corresponding signer information to the signature file according to the structure of the signature bytes, the step is included: determining whether there is a signature file in the file, and if not, creating a signature file according to a preset format.

[0012] Optionally, in the file signing method according to the present invention, the signer information includes: a decryption key corresponding to the business operation type and a certificate for verifying special items, a digest algorithm used to obtain the digest information, and a signature algorithm.

[0013] Optionally, in the file signing method according to the present invention, the encryption key is a private key, and the decryption key is a public key.

[0014] Optionally, in the file signing method according to the present invention, the business operation types include: debugging verification, enterprise internal verification, store verification, and developer verification.

[0015] Optionally, in the file signing method according to the present invention, the file is in DEB format.

[0016] Optionally, in the file signing method according to the present invention, the structure of the signature bytes is formulated according to the PKCS#7 encryption standard.

[0017] Optionally, in the file signing method according to the present invention, obtaining the signed file also includes the following steps: when a program needs to be installed, before installing the file corresponding to the program, obtaining the signature file in the signed file to verify the security of the file; when a program needs to be run, before loading the file corresponding to the program, obtaining the signature bytes in the execution file to verify the security of the file.

[0018] Optionally, in the file signing method according to the present invention, after obtaining the signature file in the signed file, the steps are also included: obtaining the encrypted second summary information in the signature file, decrypting the encrypted second summary information using a decryption key corresponding to the encryption key; verifying whether the file has been tampered with using the decrypted second summary information; obtaining multiple signer information in the signature file, and using the multiple signer information to verify the security of the file.

[0019] Optionally, in the file signing method according to the present invention, the decrypted second summary information is used to verify whether the file has been tampered with, including the steps of: obtaining the summary algorithm in each signer information, and processing the description file and the execution file in the file except the signature bytes based on the obtained summary algorithm to obtain second verification data; if the decrypted second summary information and the second verification data are consistent, it is determined that the file has not been tampered with.

[0020] Optionally, in the file signing method according to the present invention, after obtaining the signature bytes in the signed file, the steps are also included: obtaining the encrypted first summary information in the signature bytes, decrypting the encrypted first summary information using a decryption key corresponding to the encryption key; verifying whether the file has been tampered with using the decrypted summary information; obtaining multiple certificates in the signature bytes, and verifying the security of the file using the multiple certificates.

[0021] Optionally, in the file signing method according to the present invention, the decrypted first summary information is used to verify whether the file has been tampered with, including the steps of: obtaining the summary algorithm of the certificate in the signature byte, and processing the executable file in the file except the signature byte based on the obtained summary algorithm to obtain first verification data; if the decrypted first summary information is consistent with the first verification data, it is determined that the file has not been tampered with.

[0022] Optionally, in the file signing method according to the present invention, multiple certificates are used to verify the security of the file, including the steps of: if there is a certificate that matches a preset whitelist database, determining that the file is a secure file.

[0023] Optionally, in the file signing method according to the present invention, if there is a certificate that matches a preset whitelist database, it also includes the steps of: determining whether there are special items in the matching certificate; if there are special items, performing special item verification; after the special item verification passes, determining that the file is a safe file.

[0024] Optionally, in the file signing method according to the present invention, the special item is a preset machine code.

[0025] According to another aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be suitable for being executed by the at least one processor, and the program instructions include instructions for executing the file signing method according to the present invention.

[0026] According to another aspect of the present invention, a readable storage medium storing program instructions is also provided. When the program instructions are read and executed by a client, the client executes any file signing method according to the present invention.

[0027] According to the technical solution of the present invention, the first summary information is constructed according to the execution file included in the installation file, and the signed first summary information is added to the execution file, thereby ensuring the security of the execution file; the second summary information is constructed according to the execution content and the description content, and a new signature file is installed in the file to store the signed second summary information. The signature verification scope covers the entire original file, thereby ensuring the reliability and integrity of the entire installation file and avoiding virus intrusion caused by malicious modification of the description file.

[0028] Furthermore, a specific signature byte structure is constructed, and summary information is processed based on multiple business operation types, thereby making it easy to add signatures according to different application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other purposes, features and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout the present disclosure, the same reference numerals generally refer to the same parts or elements.

[0030] Figure 1 A schematic diagram of a computing device 100 according to an embodiment of the present invention is shown;

[0031] Figure 2 A flowchart of a file signing method 200 according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0032] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0033] Figure 1 1 is a block diagram of an example computing device 100, which typically includes a system memory 106 and one or more processors 104 in a basic configuration 102. A memory bus 108 may be used for communication between the processor 104 and the system memory 106.

[0034] Depending on the desired configuration, the processor 104 can be any type of processor, including but not limited to: a microprocessor (μP), a microcontroller (μC), a digital information processor (DSP), or any combination thereof. The processor 104 can include one or more levels of cache such as a first-level cache 110 and a second-level cache 112, a processor core 114, and registers 116. An example processor core 114 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An example memory controller 118 can be used with the processor 104, or in some implementations, the memory controller 118 can be an internal part of the processor 104.

[0035] Depending on the desired configuration, the system memory 106 can be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. The system memory 106 can include an operating system 120, one or more applications 122, and program data 124. In some embodiments, the application 122 can be arranged to operate on the operating system using the program data 124. In some embodiments, the computing device 100 is configured to execute the file signing method according to the present invention, and the program data 124 includes instructions for executing the method 200.

[0036] The computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to the basic configuration 102 via the bus / interface controller 130. Example output devices 142 include a graphics processing unit 148 and an audio processing unit 150. They can be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, image input devices) or other peripherals (e.g., printers, scanners, etc.) via one or more I / O ports 158. Example communication devices 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other computing devices 162 via a network communication link via one or more communication ports 164.

[0037] A network communication link may be an example of a communication medium. The communication medium may generally be embodied as a computer-readable instruction, data structure, program module in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium. A "modulated data signal" may be a signal in which one or more of its data sets or its changes may be performed in a manner that encodes information in the signal. As a non-limiting example, the communication medium may include a wired medium such as a wired network or a dedicated network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR) or other wireless media. The term computer-readable medium used herein may include both storage media and communication media. In some embodiments, one or more programs are stored in a computer-readable medium, and the one or more programs include instructions for executing certain methods, such as according to an embodiment of the present invention, the computing device 100 executes the file signature method 200 based on the present invention through the instructions. Generally speaking, in an operating system, any application installation package needs to have a signature when it is installed in order to be recognized and installed by the system, and the integrity of information transmission can be ensured by the signature. In order to determine whether the information has been tampered with during the information transmission process, the installation package file of the application program generally adds a signature.

[0038] Figure 2 FIG. 2 is a flowchart of a file signing method 200 according to an embodiment of the present invention. The method 200 is suitable for execution in a computing device (such as the aforementioned computing device 100). Figure 2As shown, the file signature method starts at step S210. The installation package file has different types in different systems. The format of the application installation file of the Java program is usually JAD or JAR, and the format of the Linux system is mostly RPM, TAR.GZ, DEB, and the installation file of the Android system is mostly APK. However, it usually includes a description file and an execution file. The description file stores version information and information related to the execution file. The execution file refers to a file that can be loaded and executed by the operating system. The specific content of the description file and the execution file in the file depends on the file format.

[0039] In step S210, the executable file is processed based on a preset digest algorithm to obtain the first summary information. For example, the installation package file that needs to be signed is a DEB file, and the executable file is the program data actually installed, and the format is an ELF (Executable and Linkable Format) file. The content of the description file includes the version information, version dependency, publisher information, etc. of the DEB package. Before signing the file, the installation package file to be signed needs to be decompressed to extract the ELF file. Usually, an information summary file is required in the installation package. Information summary processing in the usual sense can be understood as the act of recording the specific information of all files in the installation package.

[0040] Specifically, for each signer, the digest value of the ELF file code segment is calculated using a preset digest algorithm. The preset digest algorithm depends on the system specification, MD (Message Digest), SHA-1 (Secure Hash Algorithm) and MAC (Message Authentication Code). In the UOS system, the digest algorithms include SHA256, SM3, etc. The digest algorithm is irreversible, and only when the same plaintext data is input and the same digest algorithm is used can the same ciphertext be obtained.

[0041] Next, in step S220, the first summary information is signed according to multiple business operation types to obtain signature bytes. Business operation types include: debugging verification, enterprise internal verification, store verification, and developer verification, so as to expand different scenarios in which signature verification is required in the system after the application is installed.

[0042] The signature can be to encrypt only the summary, or to encrypt the summary and other information. In this scheme, the first summary information is encrypted with the signer's key to obtain the signature result. The signer's key is related to the business operation type.

[0043] Specifically, the first summary information is processed according to multiple business operation types to obtain the signature byte, including the steps of: encrypting the first summary information using the corresponding encryption keys of the multiple business operation types, and generating the signer information corresponding to each business operation type; adding the multiple encrypted first summary information and the corresponding signer information to the signature byte according to the structure of the signature byte. The signer information includes: a decryption key corresponding to the business operation type and a certificate for verifying special items, a summary algorithm used to obtain the summary information, and a signature algorithm. The encryption key is a private key, and the decryption key is a public key.

[0044] According to one embodiment of the present invention, the structure of the signature bytes is formulated according to the PKCS#7 encryption standard, which is an encryption standard generated by the RSA security system to exchange digital certificates in a public key encryption system. PKCS#7 describes the syntax of digital certificates and other encrypted messages, such as methods for data encryption and digital signatures, and also includes digest algorithms. When PKCS#7 is used for digital signing, the result includes the signing certificate and any other certificates on the certified path.

[0045] Specifically, the signature byte is a PEM format signature message data, and when each signer signs, it is necessary to create the SignedData structure in the PKCS#7 encryption standard to operate the relevant attributes of the signature data. The SignedData structure includes version, digest algorithm set, content information, certificate, revoked certificate, signer information, and fill the corresponding information into the SignedData structure according to the signing process. The content information specifies one of the two formats with or without the original text. In the format with the original text, the signed data is part of the SignedData, and there is no need to carry the source data when verifying the signature. The structure of the signer information also includes the version, the certificate identifier containing the decryption key corresponding to the business operation type and the certificate for verifying special items, the digest algorithm, the authenticated attribute, the signature algorithm, the signature, and the unauthenticated attribute. In the verification process, the certificate flag in the signer information of each SignedData is used to find the corresponding public key certificate, the digest algorithm is used to summarize the original text, and the digest comparison decrypted from the signature constitutes the last step of the signature verification. The signature algorithm is used to decrypt the signature, and the signature is used to obtain the digest. Authenticated attributes are part of the signature calculation. If any part of the attributes is modified, the signature will be invalid.

[0046] Since there are multiple signers, the signature bytes have been constructed during the first signing. Therefore, before adding multiple encrypted first summary information and multiple certificates to the signature bytes according to the structure of the signature bytes, the process also includes the following steps: determining whether there is a signature byte in the executable file, and if not, creating a signature byte in a preset format, which is the aforementioned PKCS#7 encryption standard.

[0047] If the signature byte already exists in the executable file, it is necessary to convert the signature byte into an operable structure to add SignedData when appending the signature. The signature byte is a signed message data in PEM format. The PEM reading interface provided by openssl is used to convert the signature byte into a structured data in the form of SignedData, which is convenient for the operation of the attribute data related to the signature data. According to the process of appending the signature, the corresponding information is filled into a new empty SignedData structure, and then the filled SignedData is added to the unauthenticated attribute of the current SignedData to obtain the new SignedData after the signature is appended. In order to trace the validity period of the signature, the signer's signature timestamp certificate TSA needs to be appended when filling. Modifying the unauthenticated attribute will not affect the verification result of the current SignedData. When verifying the signature, if there is a SignedData in the unauthenticated attribute that is successfully verified, the file can be successfully verified. A specific signature byte structure is constructed, and the summary information is processed based on multiple business operation types, so that signatures can be appended according to different application scenarios.

[0048] Then, in step S230, the signature bytes are merged into the execution file to obtain a new execution file. If the execution file already has signature bytes, the new SignedData obtained according to the above method is converted into PEM format to replace the original signature bytes.

[0049] Then in step S240, the description file and the execution file are processed based on a preset digest algorithm to obtain second digest information. The digest algorithm is not described in detail here. According to one embodiment of the present invention, the digest values ​​of the description file and the new execution file are concatenated, and the digest algorithm is performed again on the concatenated digest values ​​to obtain the second digest information.

[0050] Then in step S250, the second summary information is signed according to multiple business operation types to obtain a signature file. There are multiple business operation types, and each business type corresponds to a signer to expand different scenarios that require signature verification in the system after the application is installed.

[0051] According to one embodiment of the present invention, the second summary information is signed according to multiple business operation types to obtain a signature file, including the steps of: encrypting the second summary information using encryption keys corresponding to the multiple business operation types, and generating multiple signer information corresponding to the business operation types; and adding the multiple encrypted second summary information and the corresponding signer information to the signature file according to the structure of the signature file.

[0052] Specifically, the signature file is stored in PEM format, and when each signer signs, the PEM format data needs to be converted into a SignedData data structure object programmable in C language. Therefore, it is necessary to first create SignedData in the PKCS#7 encryption standard. The SignedData structure includes version, digest algorithm set, content information, certificate, revoked certificate, signer information, and fill the corresponding information into the SignedData structure according to the signing process. The content information specifies one of the two formats with or without the original text. In the format with the original text, the signed data is part of the SignedData, and there is no need to carry the source data when verifying the signature. The structure of the signer information includes the version, the decryption key corresponding to the business operation type and the certificate identifier of the certificate for verifying special items, the digest algorithm, the authenticated attribute, the signature algorithm, the signature, and the unauthenticated attribute.

[0053] Since there are multiple signers, the signature file has been constructed during the first signing. According to an example of the present invention, before adding multiple encrypted second summary information and multiple certificates to the signature file according to the structure of the signature file, the method includes the following steps: determining whether there is a signature file in the file, and if not, creating a signature file in a preset format, which is the aforementioned PKCS#7 encryption standard.

[0054] If a signature file already exists in the file, you need to convert the signature file into an operable structure to add SignedData when appending a signature. The signature file is in PEM format. Use the PEM reading interface provided by openssl to convert the signature file into a structured data in the form of SignedData, which is convenient for the operation of attribute data related to the signature data. According to the process of appending the signature, fill the corresponding information into a new empty SignedData structure, and then add the filled SignedData to the unauthenticated attribute of the current SignedData to obtain the new SignedData after the signature is appended. Modifying the unauthenticated attribute will not affect the verification result of the current SignedData. When verifying the signature, if there is a SignedData in the unauthenticated attribute that is successfully verified, the file can pass the verification successfully.

[0055] Finally, in step S260, the description file, the new execution file, and the signature file are packaged to obtain a signed file. After obtaining the signed file, the process also includes a step of verifying the signed file.

[0056] According to one embodiment of the present invention, the step of verifying the signed file includes: when a program needs to be installed, before installing the file corresponding to the program, obtaining the signature file in the signed file to verify the security of the file; when a program needs to be run, before loading the file corresponding to the program, obtaining the signature bytes in the execution file to verify the security of the file.

[0057] Specifically, verifying the security of a file includes the following steps: obtaining the encrypted second summary information in the signature file, decrypting the encrypted second summary information using the decryption key corresponding to the encryption key; using the decrypted second summary information to verify whether the execution file has been tampered with; obtaining multiple signer information in the signature file, and using multiple signer information to verify the security of the file. The structure of the signer information includes the version, the certificate identifier of the certificate containing the decryption key corresponding to the business operation type and the certificate for verifying special items, the digest algorithm, the authenticated attribute, the signature algorithm, the signature, and the unauthenticated attribute. It should be pointed out that after the signature file is directly converted into the SignedData format, it is also necessary to obtain other additional SignedData from the unauthenticated attribute of the SignedData, and verify the signer information in each SignedData in turn. If there is a SignedData that is successfully verified, then the file can be successfully verified.

[0058] Furthermore, the decrypted second summary information is used to verify whether the file has been tampered with, including the steps of: obtaining a summary algorithm in each signer information, and processing the description file and the execution file except the signature bytes in the file based on the obtained summary algorithm to obtain second verification data; if the decrypted second summary information and the second verification data are consistent, it is determined that the execution file has not been tampered with.

[0059] When running a program, before loading the file corresponding to the program, the signature byte in the execution file is obtained, and the steps of verifying the security of the signature byte include: obtaining the first encrypted summary information in the signature byte, decrypting the encrypted first summary information using the decryption key corresponding to the encryption key; using the decrypted summary information to verify whether the file has been tampered with; obtaining multiple certificates in the signature byte, and using multiple certificates to verify the security of the file. It should be pointed out that after the signature file is directly converted to the SignedData format, it is also necessary to obtain other additional SignedData from the unauthenticated attribute of the SignedData, and verify the certificates in each SignedData in turn. If there is a SignedData that is successfully verified, then the file can be successfully verified.

[0060] Furthermore, the decrypted first summary information is used to verify whether the execution file has been tampered with, including the steps of: obtaining the summary algorithm of the certificate in the signature byte, and processing the execution file except the signature byte in the file based on the obtained summary algorithm to obtain second verification data; if the decrypted first summary information is consistent with the first verification data, it is determined that the file has not been tampered with.

[0061] The security of a file is verified using multiple certificates, including the following steps: if there is a certificate that matches a preset whitelist database, the file is determined to be a safe file, and the whitelist can facilitate debugging during the development phase.

[0062] If there is a certificate that matches the preset whitelist database, the process also includes the following steps: determining whether there are special items in the matching certificate; if there are special items, verifying the special items; and determining that the file is a safe file after the special item verification passes. Furthermore, the special item is a preset machine code. When signing a debug certificate, the developer submits the local machine code when applying for a certificate. A DEB file signed by a debug certificate can only be installed and run on the device where the machine code is located. Internal enterprise certificates are used in internal enterprise app stores to help enterprises further control DEB packages.

[0063] According to the technical solution of the present invention, the first summary information is constructed according to the execution file included in the installation file, and the signed first summary information is added to the execution file, thereby ensuring the security of the execution file; the second summary information is constructed according to the execution content and the description content, and a new signature file is installed in the file to store the signed second summary information. The signature verification scope covers the entire original file, thereby ensuring the reliability and integrity of the entire installation file and avoiding virus intrusion caused by malicious modification of the description file.

[0064] Furthermore, a specific signature byte structure is constructed, and the summary information is signed based on multiple business operation types, thereby making it easy to add signatures according to different application scenarios.

[0065] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0066] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.

[0067] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.

[0068] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0069] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.

[0070] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.

[0071] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or portions of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a floppy disk, a CD-ROM, a hard disk drive, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.

[0072] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the network data processing method of the present invention according to the instructions in the program code stored in the memory.

[0073] By way of example and not limitation, computer readable media include computer storage media and communication media. Computer readable media include computer storage media and communication media. Computer storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and includes any information delivery medium. Any combination of the above is also included within the scope of computer readable media.

[0074] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.

[0075] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative, not restrictive, with respect to the scope of the present invention, which is defined by the appended claims.

Claims

1. A file signing method, wherein the file includes a description file and an execution file, and the method comprises the steps of: Processing the execution file based on a preset digest algorithm to obtain first digest information; The first summary information is signed according to multiple business operation types to obtain signature bytes, including the steps of: Encrypting the first summary information using encryption keys corresponding to a plurality of business operation types respectively, and generating signer information corresponding to each business operation type; Adding the plurality of encrypted first summary information and the corresponding signer information to the signature byte respectively according to the structure of the signature byte; Merge the signature bytes into the execution file to obtain a new execution file; Processing the description file and the new execution file based on a preset digest algorithm to obtain second digest information; The second summary information is signed according to multiple business operation types to obtain a signature file, including the following steps: Encrypting the second summary information using encryption keys corresponding to the multiple business operation types respectively, and generating multiple signer information corresponding to the business operation types; Adding the plurality of encrypted second summary information and the corresponding signer information to the signature file according to the structure of the signature file respectively; Package the description file, new execution file, and signature file to obtain the signed file; When a program needs to be installed, before installing the file corresponding to the program, obtaining a signature file from the signed file, obtaining the encrypted second summary information from the signature file, and decrypting the encrypted second summary information using a decryption key corresponding to the encryption key; Verifying whether the file has been tampered with using the decrypted second summary information; Acquire multiple signer information in the signature file, and use the multiple signer information to verify the security of the file.

2. The method as claimed in claim 1, before adding the plurality of encrypted first summary information and the corresponding signer information to the signature byte according to the structure of the signature byte, comprises the steps of: determining whether there is a signature byte in the execution file, and if not, creating a signature byte according to a preset format.

3. The method as claimed in claim 1, before adding the plurality of encrypted second summary information and the corresponding signer information to the signature file according to the structure of the signature file, comprises the steps of: determining whether there is a signature file in the file, and if not, creating a signature file according to a preset format.

4. The method according to claim 1, wherein the signer information comprises: Contains the decryption key corresponding to the business operation type and the certificate for verifying special items, the digest algorithm used to obtain the summary information, and the signature algorithm. The method according to claim 4 , wherein the encryption key is a private key and the decryption key is a public key.

6. The method according to claim 1 or 2, wherein the business operation type comprises: Debug verification, internal enterprise verification, store verification, and developer verification.

7. The method according to any one of claims 1 to 4, wherein the file is in DEB format.

8. The method according to any one of claims 1 to 4, wherein the structure of the signature bytes is formulated according to the PKCS#7 encryption standard.

9. The method according to any one of claims 1 to 4, wherein obtaining the signed file further comprises the steps of: When a program needs to be installed, before installing the file corresponding to the program, a signature file in the signed file is obtained to verify the security of the file; When a program needs to be run, before loading the file corresponding to the program, the signature bytes in the execution file are obtained to verify the security of the file.

10. The method according to claim 9, after obtaining the signature file in the signed file, further comprising the steps of: Obtaining the encrypted second summary information in the signature file, and decrypting the encrypted second summary information using a decryption key corresponding to the encryption key; Verifying whether the file has been tampered with using the decrypted second summary information; Acquire multiple signer information in the signature file, and use the multiple signer information to verify the security of the file.

11. The method according to claim 10, wherein the step of using the decrypted second summary information to verify whether the file has been tampered with comprises the steps of: Obtaining a digest algorithm in each signer information, and processing the description file and the execution file except the signature bytes in the file based on the obtained digest algorithm to obtain second verification data; If the decrypted second summary information is consistent with the second verification data, it is determined that the file has not been tampered with.

12. The method according to claim 11, after obtaining the signature file in the signed file, further comprising the steps of: Obtaining the encrypted first summary information in the signature byte, and decrypting the encrypted first summary information using a decryption key corresponding to the encryption key; Verifying whether the file has been tampered with using the decrypted first summary information; A plurality of certificates in the signature bytes are obtained, and the security of the file is verified using the plurality of certificates.

13. The method according to claim 12, wherein the step of using the decrypted first summary information to verify whether the file has been tampered with comprises the steps of: Obtaining a digest algorithm of the certificate in the signature byte, and processing the execution file in the file except the signature byte based on the obtained digest algorithm to obtain first verification data; If the decrypted first summary information is consistent with the first verification data, it is determined that the file has not been tampered with.

14. The method according to claim 13, wherein the step of verifying the security of the file by using the multiple certificates comprises the steps of: If there is a certificate that matches the preset whitelist database, the file is determined to be a safe file.

15. The method according to claim 14, further comprising the step of: It is determined whether there is a special item in the matching certificate. If there is a special item, the special item verification is performed. After the special item verification passes, it is determined that the file is a safe file. The method according to claim 15 , wherein the special item is a preset machine code.

17. A computing device comprising: at least one processor; as well as A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to claims 1-16.

18. A readable storage medium storing program instructions, which, when read and executed by a client, enables the client to execute the method according to any one of claims 1 to 16.