CN105989306B - File signature method and device and file verification method and device for operating system - Google Patents
File signature method and device and file verification method and device for operating system Download PDFInfo
- Publication number
- CN105989306B CN105989306B CN201510079120.XA CN201510079120A CN105989306B CN 105989306 B CN105989306 B CN 105989306B CN 201510079120 A CN201510079120 A CN 201510079120A CN 105989306 B CN105989306 B CN 105989306B
- Authority
- CN
- China
- Prior art keywords
- file
- hash value
- image
- signature
- acquiring
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Storage Device Security (AREA)
Abstract
The invention provides a file signature method, a file verification method and a file verification device of an operating system. The file checking method comprises the following steps: acquiring a mirror image file of an operating system; acquiring a signature strategy file and a private key file; according to the signature strategy file and the private key file, digitally signing and encrypting files meeting conditions in the image files to obtain a safe image file; acquiring a check strategy file and a public key file; and verifying the security mirror image file according to the verification policy file and the public key file, and if the verification condition is met, determining that the file of the operating system is secure. The invention only checks the files recorded by the checking strategy file, improves the checking efficiency, simultaneously, the file digital signature of the invention is directly stored in the file attribute items of the checked files, and the system can access the files and read the signature information at the same time after starting, thus being very convenient; the invention can prevent the system file from being tampered, and can upgrade single or a plurality of files.
Description
Technical Field
The invention relates to the technical field of intelligent equipment safety, in particular to a file signature method, a file verification method and a file verification device of an operating system.
Background
At present, security events of an intelligent setting operating system, such as an android system, are endless, and one of the main reasons is that the content or the attribute of a key file of the system is tampered. One of the two tampering methods is runtime tampering, that is, a cracking tool is executed on a running operating system to forcibly modify a specified file on a memory or a disk. The other is that the operating system of the device is subjected to flash tampering under the condition of non-operation, and the disk file is directly modified, so that the operating system of the device does not normally operate, the safety protection capability is relatively weak, and a cracker can take the device.
The existing disk image tamper-resistant patent documents include: the method and the device for preventing data from being tampered refer to that whether the modification operation of a first application program on determined protected data is legal operation is judged by an operating system kernel according to a pre-stored security policy. However, the method has the disadvantage that the file image on the disk or the FLASH cannot be tampered in a FLASH writing mode under the condition that the equipment is not operated. The implementation principles OF a system start VERIFICATION method, a system start VERIFICATION device and a terminal, an OPTIMIZED STARTUP VERIFICATION OF FILE SYSTEM INTEGRITY and a system for realizing system file integrity VERIFICATION in a system boot area determine that in the VERIFICATION methods, VERIFICATION actions can only occur during the device start boot period. A software tamper-proof verification method and a software tamper-proof verification device refer to a verification method for comparing a file verification value with a server verification value. However, the method has a disadvantage that there is a dependence on the network speed, and the verification efficiency of the method is very low in the case that the network condition is not good or in the case that the number of files to be verified is large and the verification is frequent.
INTELLIGENT MOBILE TERMINAL AND DATA PROCESSING METHOD THEREFOR introduces a signature library and a filter module, the signature library is used for signature check of all files accessed by a processor, the signature library is stored in a hidden partition, and once the signature of the accessed file does not exist or is incorrect, the file is accessed by a CPU through the filter module. The method has the disadvantages that obvious performance is caused, the number of files of a file system of a general operating system is very large, if each file has a signature stored in a signature library, a large space is additionally consumed, and moreover, signature verification is carried out on each file of the system, the boot starting speed of the operating system is seriously slowed down, and the user experience is reduced. The method for verifying the image file in operation refers to that a new file image is formed after the file image is subjected to digital signature, so that the digital signature of the file image can be checked at regular time when equipment is started or after the equipment is started, and the anti-tampering effect is achieved. The invention has the disadvantages that the whole file mirror image can only be verified, the content of the mirror image file cannot be selectively verified, and the existing file mirror image is generally large, such as hundreds of megabytes, so that the verification efficiency is very high.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a file signature method, a file verification method and a file verification device for an operating system, which are used for completing verification of key files through signature strategy files and verification strategy files, thereby avoiding verification of all files and improving verification efficiency.
In order to solve the technical problems, the invention adopts the following technical scheme:
according to an aspect of an embodiment of the present invention, a file signature method for an operating system is provided, including: acquiring a mirror image file of an operating system; acquiring a signature strategy file and a private key file; and according to the signature strategy file and the private key file, digitally signing and encrypting files meeting conditions in the image files to obtain the safe image files.
Optionally, the obtaining the image file of the operating system includes: obtaining an operating system source file; and compiling the source file of the operating system to generate the image file.
Optionally, the private key file is an asymmetric password private key file.
Optionally, the digitally signing and encrypting a file meeting a condition in the image file according to the signature policy file and the private key file to obtain a secure image file includes: acquiring a directory in the signature policy file; determining a mirror image file corresponding to a directory in the signature policy file in the mirror image file; and signing and encrypting the image file to obtain the safe image file.
Optionally, the step of signing and encrypting the image file to obtain the secure image file includes: acquiring a first hash value corresponding to the file content of the image file corresponding to the directory in the signature policy file; encrypting the first hash value according to the private key file, and storing the encrypted first hash value into a first attribute entry of the file attribute of the image file; acquiring a second hash value corresponding to the file attribute of the image file corresponding to the directory in the signature policy file; and encrypting the second hash value according to the private key file, and storing the encrypted second hash value into a second attribute entry of the file attribute of the image file to obtain the secure image file.
Optionally, the file signing method further includes: acquiring an update file corresponding to a file needing to be updated in an operating system; and carrying out digital signature on the update file to obtain an upgrade package.
Optionally, the performing digital signature on the update file to obtain an upgrade package includes: acquiring a first hash value corresponding to the file content of the updated file and a second hash value corresponding to the file attribute of the updated file; storing the first hash value, the second hash value, the file name and the file path of the file which is corresponding to the updated file and needs to be updated into an update information file; obtaining a hash value corresponding to the file content of the upgrade information file, encrypting the hash value according to the private key file, and storing an encryption result in the upgrade information file; and packaging the update file and the upgrade information file to obtain the upgrade package.
According to another aspect of the embodiments of the present invention, there is provided a file verification method for an operating system, including: acquiring a mirror image file of an operating system; acquiring a signature strategy file and a private key file; according to the signature strategy file and the private key file, digitally signing and encrypting files meeting conditions in the image files to obtain a safe image file; acquiring a check strategy file and a public key file; and verifying the security mirror image file according to the verification policy file and the public key file, and if the verification condition is met, determining that the file of the operating system is secure.
Optionally, the digitally signing and encrypting a file meeting a condition in the image file according to the signature policy file and the private key file to obtain a secure image file includes: acquiring a directory in the signature policy file; determining a mirror image file corresponding to a directory in the signature policy file in the mirror image file; and signing and encrypting the image file to obtain the safe image file.
Optionally, the step of signing and encrypting the image file to obtain the secure image file includes: acquiring a first hash value corresponding to the file content of the image file corresponding to the directory in the signature policy file; encrypting the first hash value according to the private key file, and storing the encrypted first hash value into a first attribute entry of the file attribute of the image file; acquiring a second hash value corresponding to the file attribute of the image file corresponding to the directory in the signature policy file; and encrypting the second hash value according to the private key file, and storing the encrypted second hash value into a second attribute entry of the file attribute of the image file to obtain the secure image file.
Optionally, the verifying the secure image file according to the signing policy file and the public key file, and if the verification condition is met, the step of regarding that the file of the operating system is secure includes: acquiring a directory in the check strategy file; determining a security image file corresponding to a directory in the check strategy file in the security image files; acquiring a second hash value corresponding to the file attribute of the security image file corresponding to the directory in the check strategy file; decrypting a second hash value in a second attribute entry of the secure image file corresponding to the directory in the signing policy file according to the public key file; comparing the second hash value decrypted by the public key file with a second hash value corresponding to the file attribute of the secure image file corresponding to the directory in the check and sign policy file, and if the second hash value is the same as the second hash value, decrypting the first hash value in the first attribute entry of the secure image file corresponding to the directory in the check and sign policy file according to the public key file; acquiring a first hash value corresponding to the file content of the security image file corresponding to the directory in the check strategy file; and comparing the first hash value decrypted by the public key file with the first hash value corresponding to the file content of the security image file corresponding to the directory in the verification policy file, and if the first hash value is the same as the first hash value, determining that the file of the operating system is secure.
Optionally, the file verification method further includes: acquiring an update file corresponding to a file needing to be updated in an operating system; carrying out digital signature on the update file to obtain an upgrade package; and checking the upgrading package, and replacing the files needing to be upgraded with the files in the upgrading package if the upgrading package meets the checking condition.
Optionally, the performing digital signature on the update file to obtain an upgrade package includes: acquiring a first hash value corresponding to the file content of the updated file and a second hash value corresponding to the file attribute of the updated file; storing the first hash value, the second hash value, the file name and the file path of the file which is corresponding to the updated file and needs to be updated into an update information file; obtaining a hash value corresponding to the file content of the upgrade information file, encrypting the hash value according to the private key file, and storing an encryption result in the upgrade information file; and packaging the update file and the upgrade information file to obtain the upgrade package.
Optionally, the verifying the upgrade package, and if the verification condition is met, replacing the file to be upgraded with the file in the upgrade package includes: acquiring a hash value corresponding to the file content of the upgrade information file in the upgrade package; decrypting the hash value corresponding to the file content of the upgrade information file in the upgrade package according to the public key file; and comparing the hash value decrypted by the public key file with the hash value corresponding to the file content of the acquired upgrade information file, if the hash values are the same, replacing the file corresponding to the update file in the operating system by using the update file in the upgrade package according to the upgrade package, and respectively storing the first hash value and the second hash value of the update file in the upgrade information file into the first attribute entry and the second attribute entry of the update file.
Optionally, the obtaining the image file of the operating system includes: obtaining an operating system source file; and compiling the source file of the operating system to generate the image file.
According to another aspect of the embodiments of the present invention, there is provided a file signing apparatus of an operating system, including: the first acquisition module is used for acquiring a mirror image file of the operating system; the second acquisition module is used for acquiring the signature strategy file and the private key file; and the first signature module is used for digitally signing and encrypting the files meeting the conditions in the image files according to the signature strategy files and the private key files to obtain the safe image files.
According to another aspect of the embodiments of the present invention, there is provided a file verification apparatus for an operating system, including: the third acquisition module is used for acquiring the mirror image file of the operating system; the fourth acquisition module is used for acquiring the signature strategy file and the private key file; the second signature module is used for digitally signing and encrypting the files meeting the conditions in the image files according to the signature strategy files and the private key files to obtain safe image files; the fifth acquisition module is used for acquiring the check strategy file and the public key file; and the verification module is used for verifying the security mirror image file according to the verification strategy file and the public key file, and if the verification condition is met, the file security of the operating system is considered.
The embodiment of the invention has the beneficial effects that: according to the embodiment of the invention, the key files in the mirror image files are signed through the signature strategy files, so that the verification of all files is avoided, and the verification efficiency is improved; furthermore, the file digital signature is directly stored in the file attribute entry of the verified file, the file is accessed after the system is started, and the signature information is read conveniently, so that the CPU expense for reading an additional signature file in the process of verifying the signature in a general method is saved, and the verification efficiency is greatly improved; the embodiment of the invention can prevent the system file from being tampered, and can upgrade a single file or a plurality of files, the upgrading mode is verified, the safety problem of the system upgrading is ensured, the user experience is improved on the premise of ensuring the safety, and the maintenance cost of the system upgrading is reduced.
Drawings
Fig. 1 is a schematic diagram illustrating a file signature method of an operating system according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a file-checking method of an operating system according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating an actual application of the file signing method of the operating system according to the embodiment of the present invention;
FIG. 4 is a flowchart illustrating an actual application of the file-checking method of the operating system according to the embodiment of the present invention;
fig. 5 is a flowchart illustrating an actual application of the file-checking method for an operating system according to an embodiment of the present invention during system upgrade;
FIG. 6 is a diagram of a file signing apparatus of an operating system according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a file checking apparatus of an operating system according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1, a schematic diagram of a file signature method for an operating system provided in an embodiment of the present invention includes the following steps:
and step S100, acquiring an image file of the operating system.
Here, the image file of the operating system is generated by compiling the source file by the compiling server.
And step S200, acquiring a signature strategy file and a private key file.
The signature policy file is written by a user according to a specified syntax, wherein the signature policy file comprises names or characteristics of a series of files to be verified, the files conforming to the file names or characteristics in the signature policy file are signed, the private key file is an asymmetric password private key file, the signature policy file is obtained by the prior art, for example, the signature policy file is generated by using an RSA 1024 algorithm in cryptographic algorithms such as openSSL, and the directory of the signature policy file contains the file names of the signature policy file.
And step S300, according to the signature strategy file and the private key file, digitally signing and encrypting files meeting conditions in the mirror image file to obtain a safe mirror image file.
The file to be digitally signed is present in a directory in the signature policy file, and the image file is digitally signed according to the directory, wherein the signature mode is that a hash value corresponding to the file content of the image file is calculated, the hash value is encrypted through a private key file, and the encrypted hash value is stored in the file attribute of the image file, wherein the file attribute further comprises an extended attribute, specifically, a first attribute entry is created in the file attribute to store the encrypted hash value; calculating hash values corresponding to all file attributes of the image file, encrypting the hash values through a private key file, and storing the encrypted hash values into a second attribute entry of the image file, preferably, the hash values in the first attribute entry and the second attribute entry are encrypted by adopting different private key files.
When the operating system is upgraded, in order to avoid errors occurring during file verification, the files which are changed before and after the upgrade are determined, and the update files corresponding to the files needing to be upgraded in the operating system are digitally signed, wherein the digital signature method is the same as the digital signature method for the files in the directory of the signature policy file, and is not repeated herein.
As shown in fig. 2, a schematic diagram of a file verification method for an operating system according to an embodiment of the present invention includes the following steps:
and step S400, acquiring an image file of the operating system.
Here, the image file of the operating system is generated by compiling the source file by the compiling server.
And step S500, acquiring a signature strategy file and a private key file.
The signature policy file is written by a user according to a specified syntax, wherein the signature policy file comprises names or characteristics of a series of files to be verified, the files conforming to the file names or characteristics in the signature policy file are signed, the private key file is an asymmetric password private key file, the signature policy file is obtained by the prior art, for example, the signature policy file is generated by using an RSA 1024 algorithm in cryptographic algorithms such as openSSL, and the directory of the signature policy file contains the file names of the signature policy file.
And S600, according to the signature strategy file and the private key file, digitally signing and encrypting files meeting conditions in the mirror image file to obtain the safe mirror image file.
The file to be digitally signed is present in a directory in the signature policy file, and the image file is digitally signed according to the directory, wherein the signature mode is that a hash value corresponding to the file content of the image file is calculated, the hash value is encrypted through a private key file, and the encrypted hash value is stored in the file attribute of the image file, wherein the file attribute further comprises an extended attribute, specifically, a first attribute entry is created in the file attribute to store the encrypted hash value; calculating hash values corresponding to all file attributes of the image file, encrypting the hash values through a private key file, and storing the encrypted hash values into a second attribute entry of the image file, preferably, the hash values in the first attribute entry and the second attribute entry are encrypted by adopting different private key files.
And S700, acquiring a verification policy file and a public key file.
Here, the directory in the signing policy file is the same as the directory in the signing policy file, and the public key file corresponds to the private key file, and the encrypted hash value of the private key file can be decrypted.
And step S800, verifying the security mirror image file according to the verification policy file and the public key file, and if the verification condition is met, determining that the file of the operating system is secure.
Here, there is a file to be verified in a directory in the verification policy file, and the image file is digitally signed according to the directory, where the directory of the verification policy file contains its own file name, and the verification is performed through the following steps:
and step S810, acquiring a directory in the check strategy file.
And step S820, determining the security image file corresponding to the directory in the signing policy file in the security image file.
Step S830, a second hash value corresponding to the file attribute of the secure image file corresponding to the directory in the check strategy file is obtained.
Step 840, according to the public key file, decrypting a second hash value in a second attribute entry of the secure image file corresponding to the directory in the signing policy file.
Step S850, comparing the second hash value decrypted by the public key file with the second hash value corresponding to the file attribute of the secure image file corresponding to the directory in the check policy file, and if the second hash value is the same as the second hash value, decrypting the first hash value in the first attribute entry of the secure image file corresponding to the directory in the check policy file according to the public key file.
Step S860, obtain a first hash value corresponding to the file content of the secure image file corresponding to the directory in the check policy file.
Step S870, comparing the first hash value decrypted by the public key file with the first hash value corresponding to the file content of the secure image file corresponding to the directory in the verification policy file, and if the first hash value is the same as the first hash value, determining that the secure image file is secure.
When the operating system is upgraded, in order to avoid errors during file verification, files which are changed before and after the upgrade are determined, digital signature is carried out on an update file corresponding to a file which needs to be upgraded in the operating system, signature information, the name and the path of the update file are stored in an upgrade information file, then a hash value corresponding to the file content of the upgrade information file is calculated, the hash value is encrypted, the encrypted result is also stored in the upgrade information file, during verification, only whether the upgrade information file exists and is tampered or not needs to be verified, if the upgrade information file passes the verification, the signature information of the update file is inquired according to the file name and the path of the update file, and the inquired signature information is stored in the file attribute of the update file. The embodiment of the invention can prevent the system file from being tampered, and can upgrade a single file or a plurality of files, and the upgrading mode is verified, thereby ensuring the safety problem of system upgrading. And the user experience is improved on the premise of ensuring safety, and the maintenance cost of system upgrading is reduced.
According to the embodiment of the invention, the key files in the mirror image files are signed through the signature strategy files, so that the verification of all files is avoided, and the verification efficiency is improved; furthermore, the file digital signature is directly stored in the file attribute entry of the verified file, the file is accessed after the system is started, the signature information is read conveniently, the CPU expense for reading an additional signature file in the process of verifying the signature in a general method is saved, and the verification efficiency is greatly improved.
As shown in fig. 3, a flowchart of an actual application of the file signing method for the operating system according to the embodiment of the present invention includes the following steps:
Step 303, the file signature and injection tool scans and analyzes the file contents hung in the mirror image file in sequence.
Step 305, ignoring no processing and continuing to scan the next file.
And step 306, calculating the hash value of the file content, encrypting the hash value by using a private key, and writing the encryption result into the first attribute item of the attribute node corresponding to the file.
And step 308, after the file is scanned, digitally signing the signature strategy file and storing the signature strategy file in the file attribute entry.
As shown in fig. 4, a flowchart of an actual application of the file checking method for the operating system provided in the embodiment of the present invention includes the following steps:
And step 403, judging whether the signature of the signature strategy file passes or not.
And step 408, if the file does not belong to the verification range, ignoring the file, and continuously scanning the next file.
And step 412, the file is verified, the system continues to conduct operation, and the kernel driver needs to perform real-time verification before opening or operating the file every time.
And step 413, checking whether the file passes through in real time.
As shown in fig. 5, a flowchart of an actual application of the file checking method for the operating system provided in the embodiment of the present invention during system upgrade includes the following steps:
Step 503, ignore the file, and continue to scan the next file. Specifically, if the user modifies the source code of the system as required and recompiles the source code, the file a and the file B in the recompiled image are both modified, and the file a and the file B can be detected through the steps 501 and 503.
And 505, calculating a digital abstract of the upgrade information file by the file signing and injection tool, encrypting the digital abstract by using a private key file of an asymmetric password to generate digital signature information, storing the signature information at the tail of the upgrade information file, and merging the upgrade information file into a system upgrade package for repacking.
And 507, reading the system upgrade package by the kernel, verifying the integrity of the upgrade package, searching and extracting an upgrade information file from the upgrade package, and verifying the digital signature of the file by using a public key. The kernel with the upgrading function reads the system upgrading package, verifies the integrity of the system upgrading package, then searches and extracts the upgrading information file, obtains the digital signature information from the upgrading information file content, and adopts a public key or a digital certificate file to compare the digital signature at the tail of the upgrading information file. If the upgrade information file does not exist or the upgrade information file does not pass, the kernel should terminate the upgrade process, and prompt the user with an alarm screen or adopt other self-defined security protection behaviors.
And step 508, whether the upgrade information file exists and whether the verification passes if the upgrade information file exists.
In step 509, the kernel terminates the upgrade process and performs predefined security protection actions, such as popping a security alert on a user interface.
And 510, expanding a system upgrade package by the kernel with the upgrade function, copying the files in the upgrade package on the equipment to be upgraded to replace the source file, and finishing the upgrade operation.
The embodiment of the invention can prevent the system file from being tampered, and can upgrade a single file or a plurality of files, the upgrading mode is verified, the safety problem of the system upgrading is ensured, the user experience is improved on the premise of ensuring the safety, and the maintenance cost of the system upgrading is reduced.
As shown in fig. 6, an embodiment of the present invention further provides a schematic diagram of a file signing apparatus of an operating system, including: a first obtaining module 61, configured to obtain an image file of an operating system; a second obtaining module 62, configured to obtain a signature policy file and a private key file; and the first signature module 63 is configured to digitally sign and encrypt a file meeting a condition in the mirror image file according to the signature policy file and the private key file, so as to obtain a secure mirror image file.
It should be noted that the apparatus is an apparatus corresponding to the file signature method of the operating system, and all implementation manners in the method embodiments are applicable to the embodiment of the apparatus, and the same technical effect can be achieved.
As shown in fig. 7, an embodiment of the present invention further provides a schematic diagram of a file checking device of an operating system, including: a third obtaining module 71, configured to obtain an image file of the operating system; a fourth obtaining module 72, configured to obtain a signature policy file and a private key file; the second signature module 73 is configured to digitally sign and encrypt a file meeting a condition in the mirror image file according to the signature policy file and the private key file, so as to obtain a secure mirror image file; a fifth obtaining module 74, configured to obtain a check policy file and a public key file; and the verification module 75 is configured to verify the secure image file according to the verification policy file and the public key file, and if the verification condition is met, consider that the file of the operating system is secure.
It should be noted that the apparatus is an apparatus corresponding to the file signature method of the operating system, and all implementation manners in the method embodiments are applicable to the embodiment of the apparatus, and the same technical effect can be achieved.
The foregoing is a preferred embodiment of the present invention, and it should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and those improvements and modifications are also within the scope of the present invention.
Claims (15)
1. A file signature method of an operating system is characterized by comprising the following steps:
acquiring a mirror image file of an operating system;
acquiring a signature strategy file and a private key file;
and according to the signature strategy file and the private key file, digitally signing the files which are packed in the image file and need to be digitally signed in the directory in the signature strategy file, and encrypting the hash value corresponding to the content of the files and the hash values corresponding to the attributes of all the files in the image file to obtain the safe image file.
2. The file signing method of claim 1, wherein said obtaining an image file of an operating system comprises:
obtaining an operating system source file;
and compiling the source file of the operating system to generate the image file.
3. The file signing method of claim 1, wherein the private key file is an asymmetric cryptographic private key file.
4. The file signature method of claim 1, wherein the step of encrypting the hash value corresponding to the file content and the hash values corresponding to all file attributes in the image file to obtain the secure image file comprises:
acquiring a first hash value corresponding to the file content of the image file corresponding to the directory in the signature policy file;
encrypting the first hash value according to the private key file, and storing the encrypted first hash value into a first attribute entry of the file attribute of the image file;
acquiring a second hash value corresponding to the file attribute of the image file corresponding to the directory in the signature policy file;
and encrypting the second hash value according to the private key file, and storing the encrypted second hash value into a second attribute entry of the file attribute of the image file to obtain the secure image file.
5. The file signing method of claim 1, wherein the file signing method further comprises:
acquiring an update file corresponding to a file needing to be updated in the image files;
and carrying out digital signature and encryption on the update file to obtain a safe update file.
6. The file signing method of claim 5, wherein said digitally signing and encrypting said update file to obtain a secure update file comprises:
acquiring a first hash value corresponding to the file content of the updated file;
encrypting the first hash value according to the private key file, and storing the encrypted first hash value into a first attribute entry of the file attribute of the update file;
acquiring a second hash value corresponding to the file attribute of the updated file;
and encrypting the second hash value according to the private key file, and storing the encrypted second hash value into a second attribute entry of the file attribute of the update file to obtain the safe update file.
7. A file checking method of an operating system is characterized by comprising the following steps:
acquiring a mirror image file of an operating system;
acquiring a signature strategy file and a private key file;
according to the signature strategy file and the private key file, digitally signing the files which are packed in the image file and need to be digitally signed in the directory in the signature strategy file, and encrypting the hash value corresponding to the content of the files and the hash values corresponding to the attributes of all the files in the image file to obtain a safe image file;
acquiring a check strategy file and a public key file;
and verifying the security mirror image file according to the verification policy file and the public key file, and if the verification condition is met, determining that the file of the operating system is secure.
8. The file verification method of claim 7, wherein the step of encrypting the hash value corresponding to the file content and the hash values corresponding to all file attributes in the image file to obtain the secure image file comprises:
acquiring a first hash value corresponding to the file content of the image file corresponding to the directory in the signature policy file;
encrypting the first hash value according to the private key file, and storing the encrypted first hash value into a first attribute entry of the file attribute of the image file;
acquiring a second hash value corresponding to the file attribute of the image file corresponding to the directory in the signature policy file;
and encrypting the second hash value according to the private key file, and storing the encrypted second hash value into a second attribute entry of the file attribute of the image file to obtain the secure image file.
9. The file verification method according to claim 8, wherein the step of verifying the secure image file according to the verification policy file and the public key file, and if the verification condition is met, considering that the secure image file is secure comprises:
acquiring a directory in the check strategy file;
determining a security image file corresponding to a directory in the check strategy file in the security image files;
acquiring a second hash value corresponding to the file attribute of the security image file corresponding to the directory in the check strategy file;
decrypting a second hash value in a second attribute entry of the secure image file corresponding to the directory in the signing policy file according to the public key file;
comparing the second hash value decrypted by the public key file with a second hash value corresponding to the file attribute of the secure image file corresponding to the directory in the check and sign policy file, and if the second hash value is the same as the second hash value, decrypting the first hash value in the first attribute entry of the secure image file corresponding to the directory in the check and sign policy file according to the public key file;
acquiring a first hash value corresponding to the file content of the security image file corresponding to the directory in the check strategy file;
and comparing the first hash value decrypted by the public key file with the first hash value corresponding to the file content of the secure image file corresponding to the directory in the verification policy file, and if the first hash value is the same as the first hash value, determining that the secure image file is secure.
10. The file verification method of claim 7, wherein the file verification method further comprises:
acquiring an update file corresponding to a file needing to be updated in the image files;
carrying out digital signature and encryption on the update file to obtain a safe update file;
and verifying the safe update file, and replacing the file needing to be upgraded with the safe update file if the safe update file meets the verification condition.
11. The file verification method of claim 10, wherein said digitally signing and encrypting the update file to obtain a secure update file comprises:
acquiring a first hash value corresponding to the file content of the updated file;
encrypting the first hash value according to the private key file, and storing the encrypted first hash value into a first attribute entry of the file attribute of the update file;
acquiring a second hash value corresponding to the file attribute of the updated file;
and encrypting the second hash value according to the private key file, and storing the encrypted second hash value into a second attribute entry of the file attribute of the update file to obtain the safe update file.
12. The file verification method of claim 11, wherein the verifying the security update file, and if a verification condition is met, replacing the file to be upgraded with the security update file comprises:
acquiring a second hash value corresponding to the file attribute of the security update file;
decrypting a second hash value in a second attribute entry of the security update file according to the public key file;
comparing the second hash value decrypted by the public key file with a second hash value corresponding to the file attribute of the security update file, and if the second hash value is the same as the second hash value, decrypting the first hash value in the first attribute entry of the security update file according to the public key file;
acquiring a first hash value corresponding to the file content of the security update file;
and comparing the first hash value decrypted by the public key file with the first hash value corresponding to the file content of the safe updating file, and if the first hash value is the same and meets the verification condition, replacing the file needing to be updated with the safe updating file.
13. The file verification method of claim 7, wherein the obtaining the image file of the operating system comprises:
obtaining an operating system source file;
and compiling the source file of the operating system to generate the image file.
14. A file signing apparatus for an operating system, comprising:
the first acquisition module is used for acquiring a mirror image file of the operating system;
the second acquisition module is used for acquiring the signature strategy file and the private key file;
and the first signature module is used for digitally signing the files which are packed in the image files and need to be digitally signed in the directory in the signature policy file according to the signature policy file and the private key file, and encrypting the hash value corresponding to the file content and the hash values corresponding to all the file attributes in the image files to obtain the safe image files.
15. A file verification apparatus for an operating system, comprising:
the third acquisition module is used for acquiring the mirror image file of the operating system;
the fourth acquisition module is used for acquiring the signature strategy file and the private key file;
the second signature module is used for digitally signing the files which are packed in the image files and need to be digitally signed in the directory in the signature strategy file according to the signature strategy file and the private key file, and encrypting the hash value corresponding to the file content and the hash values corresponding to all the file attributes in the image files to obtain the safe image files;
the fifth acquisition module is used for acquiring the check strategy file and the public key file;
and the verification module is used for verifying the security mirror image file according to the verification strategy file and the public key file, and if the verification condition is met, the file security of the operating system is considered.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510079120.XA CN105989306B (en) | 2015-02-13 | 2015-02-13 | File signature method and device and file verification method and device for operating system |
PCT/CN2015/078902 WO2016127516A1 (en) | 2015-02-13 | 2015-05-13 | File signature method for operating system, file check method, and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510079120.XA CN105989306B (en) | 2015-02-13 | 2015-02-13 | File signature method and device and file verification method and device for operating system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105989306A CN105989306A (en) | 2016-10-05 |
CN105989306B true CN105989306B (en) | 2020-04-28 |
Family
ID=56615403
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510079120.XA Active CN105989306B (en) | 2015-02-13 | 2015-02-13 | File signature method and device and file verification method and device for operating system |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105989306B (en) |
WO (1) | WO2016127516A1 (en) |
Families Citing this family (24)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106548092B (en) * | 2016-10-31 | 2019-07-16 | 杭州嘉楠耘智信息科技有限公司 | File processing method and device |
CN106569865B (en) * | 2016-11-14 | 2020-04-10 | 青岛海信移动通信技术股份有限公司 | Method and device for manufacturing system upgrade file of terminal |
CN108427888A (en) * | 2017-02-15 | 2018-08-21 | 阿里巴巴集团控股有限公司 | File signature method, file verification method and corresponding intrument and equipment |
WO2019075622A1 (en) * | 2017-10-16 | 2019-04-25 | 华为技术有限公司 | Security element and related device |
CN108762788B (en) * | 2018-05-31 | 2023-07-28 | 杭州吉吉知识产权运营有限公司 | Method and system for encrypting firmware of embedded equipment based on server |
CN109766134A (en) * | 2019-01-08 | 2019-05-17 | 四川虹微技术有限公司 | System start method, device, electronic equipment and storage medium |
CN110704852B (en) * | 2019-09-26 | 2021-06-08 | 江苏方天电力技术有限公司 | Encryption system for RTOS system program image file |
CN111045704B (en) * | 2019-11-22 | 2024-05-24 | 林洋能源科技(上海)有限公司 | Method and equipment for safety upgrading of intelligent power network high-end AMI acquisition and analysis equipment |
CN111158728B (en) * | 2019-12-31 | 2024-02-02 | 深圳市潮流网络技术有限公司 | Firmware upgrading method, firmware starting method and device |
CN111241536A (en) * | 2020-01-10 | 2020-06-05 | 杭州涂鸦信息技术有限公司 | Method and system for loading production test image and preventing illegal swiping |
CN111245616B (en) * | 2020-03-10 | 2023-03-24 | 阿波罗智联(北京)科技有限公司 | Authentication method, device, equipment and storage medium for network communication |
CN111680298B (en) * | 2020-04-29 | 2023-10-27 | 杭州涂鸦信息技术有限公司 | Safe starting method of embedded system and device with storage function |
CN113296873B (en) * | 2020-05-15 | 2024-08-06 | 阿里巴巴集团控股有限公司 | Mirror image construction method and device, terminal equipment and computer storage medium |
CN112257058A (en) * | 2020-10-12 | 2021-01-22 | 麒麟软件有限公司 | Trusted computing verification method and system for operating system |
CN112328279B (en) * | 2020-11-02 | 2023-04-14 | 宁波和利时信息安全研究院有限公司 | System firmware file upgrading method, device and system |
CN112817644A (en) * | 2021-01-20 | 2021-05-18 | 浪潮电子信息产业股份有限公司 | Virtual CD driver generation method, device and computer readable storage medium |
CN112817621B (en) * | 2021-01-22 | 2024-10-29 | 浪潮电子信息产业股份有限公司 | BIOS firmware refreshing method and device and related components |
CN113037494B (en) * | 2021-03-02 | 2023-05-23 | 福州汇思博信息技术有限公司 | Burning piece mirror image file signature method and terminal |
CN113157286A (en) * | 2021-04-20 | 2021-07-23 | 深圳市优必选科技股份有限公司 | System upgrading method and device |
CN113391880B (en) * | 2021-06-21 | 2023-04-07 | 超越科技股份有限公司 | Trusted mirror image transmission method for layered double hash verification |
CN114547620A (en) * | 2022-01-11 | 2022-05-27 | 瑞芯微电子股份有限公司 | Signature firmware upgrading method, device and computer readable medium |
CN114594912A (en) * | 2022-03-14 | 2022-06-07 | 中国第一汽车股份有限公司 | Information protection method, device, equipment and medium for vehicle instrument system |
CN115941208B (en) * | 2022-12-28 | 2024-04-02 | 广州文远知行科技有限公司 | Method, system, equipment and medium for transmitting vehicle-end file |
CN117390702B (en) * | 2023-12-11 | 2024-03-15 | 厦门天锐科技股份有限公司 | Split type driving and shell adding method and device, electronic equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1740941A (en) * | 2004-08-25 | 2006-03-01 | 微软公司 | System and method for secure execution of program code |
CN101149773A (en) * | 2007-08-27 | 2008-03-26 | 中国人民解放军空军电子技术研究所 | Software real name authentication system and its safe checking method |
CN101578609A (en) * | 2007-01-07 | 2009-11-11 | 苹果公司 | Secure booting a computing device |
CN102572595A (en) * | 2012-02-03 | 2012-07-11 | 深圳市同洲电子股份有限公司 | IPTV upgrade package structure, upgrading method and startup calibration method |
CN104156659A (en) * | 2014-08-14 | 2014-11-19 | 电子科技大学 | Embedded system secure start method |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6189100B1 (en) * | 1998-06-30 | 2001-02-13 | Microsoft Corporation | Ensuring the integrity of remote boot client data |
JP5904505B2 (en) * | 2010-12-09 | 2016-04-13 | インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation | Computer-readable storage medium for encrypting and decrypting virtual disks |
CN102025744A (en) * | 2010-12-20 | 2011-04-20 | 北京世纪互联工程技术服务有限公司 | Import and export system of virtual machine image in cloud computing |
CN103761329B (en) * | 2014-02-08 | 2017-06-16 | 广东欧珀移动通信有限公司 | A kind of method and its device that brush machine is carried out to mobile device |
-
2015
- 2015-02-13 CN CN201510079120.XA patent/CN105989306B/en active Active
- 2015-05-13 WO PCT/CN2015/078902 patent/WO2016127516A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1740941A (en) * | 2004-08-25 | 2006-03-01 | 微软公司 | System and method for secure execution of program code |
CN101578609A (en) * | 2007-01-07 | 2009-11-11 | 苹果公司 | Secure booting a computing device |
CN101149773A (en) * | 2007-08-27 | 2008-03-26 | 中国人民解放军空军电子技术研究所 | Software real name authentication system and its safe checking method |
CN102572595A (en) * | 2012-02-03 | 2012-07-11 | 深圳市同洲电子股份有限公司 | IPTV upgrade package structure, upgrading method and startup calibration method |
CN104156659A (en) * | 2014-08-14 | 2014-11-19 | 电子科技大学 | Embedded system secure start method |
Also Published As
Publication number | Publication date |
---|---|
WO2016127516A1 (en) | 2016-08-18 |
CN105989306A (en) | 2016-10-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105989306B (en) | File signature method and device and file verification method and device for operating system | |
US11176255B2 (en) | Securely booting a service processor and monitoring service processor integrity | |
US10397230B2 (en) | Service processor and system with secure booting and monitoring of service processor integrity | |
EP0849657B1 (en) | Secure data processing method and system | |
TWI607376B (en) | System and method for processing requests to alter system security databases and firmware stores in a unified extensible firmware interface-compliant computing device | |
CN102651061B (en) | System and method of protecting computing device from malicious objects using complex infection schemes | |
US8087086B1 (en) | Method for mitigating false positive generation in antivirus software | |
US20070180509A1 (en) | Practical platform for high risk applications | |
US9432397B2 (en) | Preboot environment with system security check | |
US7962952B2 (en) | Information processing apparatus that executes program and program control method for executing program | |
TW201500960A (en) | Detection of secure variable alteration in a computing device equipped with unified extensible firmware interface (UEFI)-compliant firmware | |
CN112800429B (en) | Method for protecting driver in UEFI BIOS firmware system based on basicity | |
KR20170088858A (en) | Method and device for providing verifying application integrity | |
KR20170089859A (en) | Method and device for providing verifying application integrity | |
EP3583536B1 (en) | Securely defining operating system composition without multiple authoring | |
CN106560830A (en) | Linux embedded system safety protection method and system | |
KR101805310B1 (en) | User apparatus based on trusted platform module and firmware updating method using the same | |
KR20170087887A (en) | Method and device for providing verifying application integrity | |
CN108595950A (en) | A kind of safe Enhancement Methods of SGX of combination remote authentication | |
CN112511306A (en) | Safe operation environment construction method based on mixed trust model | |
KR102111327B1 (en) | Integrity verification system for boot process in linux and update and integrity verification method of managed machine | |
EP3176723B1 (en) | Computer system and operating method therefor | |
CN116541891A (en) | UEFI image file integrity protection method, device, equipment and medium | |
CN113609529B (en) | Method and system for safely supplying computer firmware | |
KR102369874B1 (en) | A system for remote attestation, os deployment server, attestation target device and method for updating operating system and integrity information simultaneously |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |