Method and device for verifying file system and storage medium
By dividing the file system into a verification part and a storage part, and first checking and executing the verification part when the terminal is initialized, the problem of low file system verification efficiency in the prior art is solved, and more efficient file system verification is achieved.
Patent Information
- Application Number
- CN202411860536.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-05-09
AI Technical Summary
When performing security verification of file systems in the prior art, the entire file system needs to be loaded into memory, resulting in the verification efficiency decreases when the file system data or files are too large or too many, and congestion is prone to occur.
The file system is divided into a verification part and a storage part. When the terminal is initialized, the program file of the verification part is first loaded into memory for verification. After the verification is passed, the program file is executed immediately to realize the interactive function, and the saved files of the storage part are verified during the execution.
Through partition verification, the need for the entire file system to load into memory is avoided, the congestion of the verification channel is reduced, and the efficiency of the verification file system is improved.
Smart Images

Figure CN119961045A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device and storage medium for verifying a file system. Background Art
[0002] The terminal's file system is a key part of storing and organizing data, recording information about the operating system and user files, including operating system core files, applications, user data, system configuration files, etc. If the file system is damaged or tampered with, it may lead to data loss, system crash, or execution of malware.
[0003] The security check of the file system is performed when the terminal is turned on to ensure the stability of the system and the integrity of the data. The security check process can promptly detect and repair problems such as hardware failures, power outages, etc. that lead to data corruption or structural abnormalities, and prevent the system from crashing or malfunctioning after startup.
[0004] However, currently, security verification of a file system requires that the entire file system be loaded into memory for verification. When the data or files in the file system are too large or the number is too large, the security verification channel may become congested, resulting in reduced verification efficiency. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a method, device and storage medium for verifying a file system.
[0006] The technical solution provided in this application is described below:
[0007] In a first aspect, the present application provides a method for verifying a file system, wherein the file system includes a verification part and a storage part, and the method includes:
[0008] When the terminal is initialized, the program file in the verification part is read into the memory, and the program file is used to realize the interactive function;
[0009] Verifying the program file and determining whether the verification passes;
[0010] If the verification passes, the program file is executed, and during the execution, the saved files in the storage part are verified.
[0011] Optionally, reading the program file in the verification part into a memory includes:
[0012] Parsing the verification part, obtaining index blocks and data blocks in the verification part, wherein the data blocks are used to store program files;
[0013] Determine the size of the data block according to the index block;
[0014] The address of the index block is offset according to the size of the data block, and the program file is read into the memory.
[0015] Optionally, the verifying the saved file in the storage part during the execution process includes:
[0016] Initializing the storage portion during execution;
[0017] Verifying the stored files in the storage part and determining whether the verification passes;
[0018] If the verification passes, the saved file is executed or accessed.
[0019] Optionally, the program file includes file data, additional information and signature information, and the verifying the program file and determining whether the verification passes includes:
[0020] Performing hash calculation on the file data to obtain a first hash value;
[0021] Verifying whether the first Hash value is consistent with the pre-stored Hash value carried in the additional information;
[0022] If they are consistent, the signature information is verified and it is determined whether the verification passes.
[0023] Optionally, verifying the signature information and determining whether the verification passes includes:
[0024] Performing a hash calculation on the additional information to obtain a second hash value;
[0025] Obtaining a public key according to the certificate information carried in the additional information, and using the public key to decrypt the signature information to obtain a decrypted hash value;
[0026] Verifying whether the second Hash value is consistent with the decrypted Hash value;
[0027] If they are consistent, the verification is determined to be successful.
[0028] Optionally, the method further includes:
[0029] If the verification fails, the verification is stopped and an exception prompt notification is generated.
[0030] Optionally, the storage part includes a super block, a block descriptor, a block bitmap, an index bitmap, an index table and a data block.
[0031] A second aspect of the present application provides a device for verifying a file system, the device comprising:
[0032] A reading unit, used for reading the program file in the verification part into the memory when the terminal is initialized, wherein the program file is used to realize the interactive function;
[0033] A first verification unit, used to verify the program file and determine whether the verification passes;
[0034] The second verification unit is used to execute the program file and verify the saved files in the storage part during the execution process.
[0035] Optionally, the reading unit is further used for:
[0036] Parsing the verification part, obtaining index blocks and data blocks in the verification part, wherein the data blocks are used to store program files;
[0037] Determine the size of the data block according to the index block;
[0038] The address of the index block is offset according to the size of the data block, and the program file is read into the memory.
[0039] Optionally, the second verification unit is further used for:
[0040] Initializing the storage portion during execution;
[0041] Verifying the stored files in the storage part and determining whether the verification passes;
[0042] If the verification passes, the saved file is executed or accessed.
[0043] Optionally, the first verification unit is further used for:
[0044] Performing hash calculation on the file data to obtain a first hash value;
[0045] Verifying whether the first Hash value is consistent with the pre-stored Hash value carried in the additional information;
[0046] If they are consistent, the signature information is verified and it is determined whether the verification passes.
[0047] Optionally, the first verification unit is further used for:
[0048] Performing a hash calculation on the additional information to obtain a second hash value;
[0049] Obtaining a public key according to the certificate information carried in the additional information, and using the public key to decrypt the signature information to obtain a decrypted hash value;
[0050] Verifying whether the second Hash value is consistent with the decrypted Hash value;
[0051] If they are consistent, the verification is determined to be successful.
[0052] Optionally, the first verification unit is further used for:
[0053] If the verification fails, the verification is stopped and an exception prompt notification is generated.
[0054] Optionally, the storage part includes a super block, a block descriptor, a block bitmap, an index bitmap, an index table and a data block.
[0055] A third aspect of the present application provides a device for verifying a file system, the device comprising:
[0056] Processor, memory, input-output unit, and bus;
[0057] The processor is connected to the memory, the input and output unit, and the bus;
[0058] The memory stores a program, and the processor calls the program to execute the first aspect and any optional method in the first aspect.
[0059] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the program executes the first aspect and any optional method in the first aspect.
[0060] It can be seen from the above technical solutions that this application has the following advantages:
[0061] When the terminal is turned on, the program files of the verification part are first loaded into the memory and verified. When the program files of the verification part pass the verification, the program files are immediately executed to realize the interactive function, and then the saved files of the storage part are verified. The system files are divided into the verification part and the storage part, so that the verification can be carried out in partitions. The verification part is loaded and then verified, and then the storage part is verified. It does not affect the execution of the program files, and can also reduce the congestion of the verification channel and improve the efficiency of the verification file system. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0063] Figure 1 A flowchart of an embodiment of a method for verifying a file system provided by the present application;
[0064] Figure 2 A schematic diagram of an embodiment of a flow chart of reading a program file in a method for verifying a file system provided by the present application;
[0065] Figure 3 A schematic diagram of the file system composition of the method for verifying a file system provided in this application;
[0066] Figure 4 A schematic diagram of an embodiment of a flow chart of a storage verification part in a method for verifying a file system provided by the present application;
[0067] Figure 5 A schematic diagram of an embodiment of a flow chart of verifying a program file in a method for verifying a file system provided by the present application;
[0068] Figure 6 A schematic diagram of the format of a program file in the method for verifying a file system provided by the present application;
[0069] Figure 7 A schematic diagram of another embodiment of a flow chart of verifying a program file in the method for verifying a file system provided by the present application;
[0070] Figure 8 The present application also provides a schematic diagram of an embodiment of a device for verifying a file system;
[0071] Fig. 9 The present application also provides a schematic diagram of the structure of another embodiment of an apparatus for verifying a file system. DETAILED DESCRIPTION
[0072] It should be noted that the method, device and storage medium for verifying a file system provided in this application can be applied to a terminal, a system or a server. For example, the terminal can be a smart phone or a computer, a tablet computer, a smart TV, a smart watch, a portable computer terminal or a fixed terminal such as a desktop computer. For the convenience of explanation, this application uses a terminal as an example for the execution subject.
[0073] It should be noted that the file system is the structure and method used by the operating system to organize and manage data on computer storage devices. It is responsible for storing data as files and directories and controlling the access rights and integrity of the data. In this application, the file system is divided into a verification part and a storage part, and verification is performed in sequence.
[0074] See also Figure 1 , Figure 1 An embodiment of a method for verifying a file system provided by the present application includes:
[0075] S101, when the terminal is initialized, the program file in the verification part is read into the memory, and the program file is used to realize the interactive function;
[0076] When the terminal is initialized, the file system needs to be verified to ensure the security of the stored files and data. Through verification, potential problems are discovered, prompting the system to take necessary repair measures during the startup phase to ensure that the program will not encounter data errors in subsequent operations, thereby providing a reliable operating environment.
[0077] First, the verification part of the file system is verified. There is only one program file stored in the verification part, so the verification rate of the verification part is relatively fast. The program file is used to realize the function of interaction between the system and the user, including controlling the interface display and obtaining key and touch input, etc. It can be seen that compared with the solution of the prior art, the blocking time of the solution of the present application is obviously shorter, and even if the number of files in the storage part of the file system increases, it will not lead to an increase in the blocking time.
[0078] The purpose of reading the program file into the memory first is to improve execution efficiency and response speed, because the access speed of the memory is faster than that of the hard disk, which can ensure that the control system can quickly obtain and execute instructions. In addition, after the program file is loaded into the memory, the operating system can better manage and schedule resources to ensure that the program can efficiently access the required data during operation, and perform necessary verification and configuration in the initialization phase to ensure the stability and security of the system.
[0079] S102, verifying the program file and determining whether the verification passes;
[0080] Program files can be verified by calculating the hash value of the file or using technologies such as checksum to verify the integrity and consistency of the program file during storage and transmission. When the verification passes, it can be determined that no data damage or tampering has been detected, and the program file is safe and usable. Otherwise, it indicates that there may be problems with the program file.
[0081] S103: If the verification is passed, the program file is executed, and during the execution, the saved files in the storage part are verified.
[0082] When the verification passes, the program file will be executed immediately to realize the interactive function. In order to ensure the integrity and accuracy of the data in the file system, in addition to verifying the verification part of the file system, it is also necessary to verify the saved files in the storage part while executing the program file. The saved files include user files and metadata, and the number of files is large, so post-verification of the saved files will not block the verification of the program files.
[0083] In this embodiment, when the terminal is turned on, the program file of the verification part is first loaded into the memory and verified. When the program file of the verification part passes the verification, the program file is immediately executed to realize the interactive function, and then the saved file of the storage part is verified. The system file is divided into a verification part and a storage part, so that the verification can be performed in partitions, the verification part is loaded and then the storage part is verified, which does not affect the execution of the program file, and can also reduce the congestion of the verification channel and improve the efficiency of the verification file system.
[0084] In the above step S101, the program file in the verification part is read into the memory, see Figure 2 , Figure 2 An embodiment of reading a program file in a method for verifying a file system provided by the present application includes:
[0085] S201, parsing the verification part, obtaining the index block and data block in the verification part, the data block is used to store the program file;
[0086] The verification part includes index blocks and data blocks. The index block contains information such as the type, size, and permissions of the program files in the data block, while the data block is used to store program files. When parsing, read from the starting address of the verification part to obtain the information of the index block and data block, and then obtain the program file stored in the data block based on the information in the index block.
[0087] In some specific embodiments, see Figure 3 , Figure 3 The file system composition diagram of the method for verifying the file system provided by the present application. The whole file system is composed of a verification part and a storage part, wherein the verification part is composed of an inode block and a data block, the inode block is the index block in the present application, the index block is used to save the type, size, creation time, permissions and other information of the program file in the verification part, and the data block is used to save the content data of the program file in the verification part. The storage part includes a super block, a block descriptor, a block bitmap, an index bitmap, an index table and a data block, the function of the data block is the same as that of the data block in the verification part, the super block is used to save the number of indexes, the number of free indexes, the number of blocks and the number of free blocks, the block descriptor is used to save the block bitmap block number, the index bitmap block number, the index table block number, the block bitmap is used to record the usage of all blocks, the index bitmap is used to record the usage of all index entries, the index table is a collection of all index entries, and each index saves the type, size, creation time, permissions and other information of a file. When the storage part is subsequently initialized, it is also necessary to obtain information about the saved files in the storage part from the super block, block descriptor, block bitmap, index bitmap and index table of the storage part, so that the system can read the saved files into the memory.
[0088] S202, determining the size of the data block according to the index block;
[0089] Extract the relevant information of the data block from the parsed index block, including its byte length, which indicates the size of the storage space occupied by the data block. According to the size of the data block, appropriate space can be allocated for it in the memory to facilitate the subsequent verification of the program file in the data block.
[0090] S203. Offset the address of the index block according to the size of the data block, and read the program file into the memory.
[0091] By adding the base address of the index block to the size of the data block for offset, the starting address of the data block can be accurately located, and then the program file in the data block is read into the memory, so that the system can quickly operate on the program file.
[0092] In this embodiment, firstly, the index block containing information such as program file type, size and permissions and the data block storing the actual program file are obtained, then appropriate space is allocated for it in the memory according to the data block size information provided in the index block, and finally the data block is accurately located by offsetting the index block address and the program file is read into the memory. This ensures the correct reading of the program file, optimizes the memory allocation, and improves the system's processing speed and efficiency for the program file, thereby achieving efficient use of resources and rapid response to operations.
[0093] In the above step S103, the storage part is verified during the execution process, see Figure 4 , Figure 4 An embodiment of verifying a storage part in a method for verifying a file system provided by the present application includes:
[0094] S401, initializing the storage part during execution;
[0095] In order to improve the verification efficiency, the storage part is initialized while executing the program file to ensure that there is enough memory space to store the data and calculation results of the storage part during the verification process. Initialization usually includes clearing the cache, allocating memory areas, or creating data structures to keep the storage clean and orderly to prevent old data from interfering with the current verification operation. By initializing the storage part, the reliability and efficiency of the verification process can be effectively improved, ensuring that all necessary information can be accurately recorded and processed.
[0096] S402, verifying the saved file in the storage part, and determining whether the verification passes;
[0097] The purpose of verifying the saved files in the storage part is to check whether the stored user files and metadata are complete and correct. The format of the saved files in the storage part is the same as the format of the program files in the verification part, and the verification method performed on the saved files in the storage part is the same as the verification method performed on the program files in the verification part. It verifies whether the saved files are damaged or tampered after storage, and judges the reliability of the data based on the verification results.
[0098] S403, if the verification passes, execute or access the saved file;
[0099] If the verification passes, it indicates that the user files and metadata in the saved files in the storage part are complete and accurate. At this time, the user files and metadata in the saved files can be accessed, and operations such as reading, editing or sharing data can be performed according to user instructions to ensure the normal operation of the system without errors caused by damaged data.
[0100] In some specific embodiments, when the verification fails, other operations are performed, which are described in detail below:
[0101] S404: If the verification fails, the verification is stopped and an abnormal prompt notification is generated.
[0102] If the verification fails during the verification process, the verification process will be terminated immediately and an exception notification will be generated to remind the user or system administrator that the program file may have been tampered with, damaged, or of a suspicious origin. This exception prompt can carry the reason for the verification failure, thereby helping the user take necessary follow-up measures, such as investigating the source of the file, checking system security, or re-obtaining the program file for security verification to prevent potential security vulnerabilities and data risks. Since the verification method used for the verification part and the storage part is the same, when the verification fails during the verification of the program file of the verification part, the verification process will be terminated immediately and an exception notification will be generated.
[0103] In this embodiment, by initializing the storage part while executing the program file, the storage part obtains sufficient memory space during the verification process, ensuring rapid and orderly verification, thereby improving verification efficiency. After completing the initialization of the storage part, the saved files in the storage part are verified to ensure the integrity and accuracy of the data. When the verification passes, the system can safely execute or access the saved files, reducing errors caused by data damage or tampering. When the verification fails, the verification is stopped, and problems in the file system are reflected in a timely manner. At the same time, the generated abnormal prompt notification can help the user take further processing measures on the file system, thereby improving the security and effectiveness of the verification.
[0104] In the above step S102, the program files of the verification part are first verified. Figure 5 and Figure 6 , Figure 5 An embodiment of verifying a program file in a method for verifying a file system provided by the present application, Figure 6 A schematic diagram of the format of a program file in the method for verifying a file system provided in this application. A program file consists of file data, additional information, and signature information. Verifying a program file is to verify the file data, additional information, and signature information in the program file. This embodiment specifically includes:
[0105] S501, performing hash calculation on file data to obtain a first hash value;
[0106] When verifying file data, you can select a hash algorithm, such as SHA-256, to calculate the file data in the program file and generate a hash value of a fixed length, which is used as the first hash value. This value is unique and directly related to the content of the file data. Any modification to the file data will result in a different hash value. Therefore, the first hash value can be used as a verification standard for the integrity of the file data, ensuring that it can be used to compare with the pre-stored hash value of the original file in subsequent steps to determine whether the file has been tampered with.
[0107] S502: Verify whether the first hash value is consistent with the pre-stored hash value carried in the additional information;
[0108] The pre-stored hash value of the original file is a hash value calculated and saved when the program file is created or released, representing the original, unmodified state of the file, and the pre-stored hash value is stored in the additional information. By comparing the first hash value generated by the file data with the pre-stored hash value in the additional information, it is possible to determine whether the file data remains consistent. If the two hash values are the same, it means that the file data has not been tampered with and maintains integrity. If they are inconsistent, it means that the file data may have been modified or damaged.
[0109] S503: If they are consistent, verify the signature information and determine whether the verification passes.
[0110] If the first hash value is consistent with the pre-stored hash value in the additional information, the signature information is further verified. The signature information is a digital signature, and the signature information is verified to confirm the credibility and integrity of the file source.
[0111] In this embodiment, by performing hash calculation on the file data and comparing it with the pre-stored hash value carried in the additional information, changes in the file data can be quickly detected, thereby improving the verification efficiency and the integrity and accuracy of the file data. At the same time, the signature information is further verified to improve the credibility and integrity of the file source, thereby improving the security and reliability of the program file.
[0112] In the above step S503, after verifying the file data in the program file, it is also necessary to verify the signature information. Figure 7 , Figure 7 Another embodiment of verifying a program file in the method for verifying a file system provided by the present application includes:
[0113] S701, performing hash calculation on the additional information to obtain a second hash value;
[0114] The purpose of hashing the additional information is to verify the consistency between the signature information and the additional information. By calculating the additional information using the selected hash algorithm, such as SHA-256, a new hash value can be generated as the second hash value. The second hash value provides a basis for the subsequent consistency check of the signature information, while ensuring the reliability of the additional information and its consistency with the file data.
[0115] S702, obtaining a public key according to the certificate information carried in the additional information, and using the public key to decrypt the signature information to obtain a decrypted hash value;
[0116] The signature information is a digital signature, which is usually generated by the publisher of the file using its private key, and the recipient can use the corresponding public key to verify it. The additional information carries the certificate information, which usually contains the publisher's identity information and its public key. The generated digital signature can be decrypted by the corresponding public key using an encryption algorithm, such as the RSA algorithm. The public key can be obtained by reading the corresponding certificate information to decrypt the signature information. Because the signature information is the encrypted data of the attachment information hash value, a decrypted hash value will be obtained after the signature information is decrypted.
[0117] S703, verify whether the second Hash value is consistent with the decrypted Hash value;
[0118] Verifying the consistency of the second hash value and the decrypted hash value can verify whether the signature information has not been modified during transmission or storage, and can also ensure the consistency and integrity of the additional information. If the second hash value is consistent with the decrypted hash value, the signature information passes the verification, confirming that the program file has not been tampered with, and that the program file is generated by the publisher who holds the private key. Otherwise, the verification fails, indicating that there may be problems with the source or content of the file.
[0119] S704: If they are consistent, determine that the verification is passed.
[0120] If the second hash value is consistent with the decrypted hash value, it can be determined that the verification has passed, indicating that the program file has not been tampered with, the signature information used is valid, the additional information is complete and consistent with the signature information, and the program file can be used safely at this time.
[0121] In this embodiment, a second hash value is obtained by performing a hash calculation on the additional information, and the public key is obtained by using the certificate information in the additional information to decrypt the signature information to obtain a decrypted hash value, and then the consistency of the second hash value and the decrypted hash value is verified. This ensures that the program file is complete and has not been tampered with during transmission or storage, effectively verifies the authenticity of the file source and the reliability of the additional information, so that the program file can be used safely, and effectively prevents the risk of data being illegally modified or forged.
[0122] See also Figure 8 The present application also provides a device for verifying a file system, including:
[0123] The reading unit 801 is used to read the program file in the verification part into the memory when the terminal is initialized, and the program file is used to realize the interactive function;
[0124] The first verification unit 802 is used to verify the program file and determine whether the verification passes;
[0125] The second verification unit 803 is used to execute the program file and verify the saved files in the storage part during the execution process.
[0126] Optionally, the reading unit 801 is further used for:
[0127] Parse the check part, obtain the index block and data block in the check part, the data block is used to store the program file;
[0128] Determine the size of the data block based on the index block;
[0129] The address of the index block is offset according to the size of the data block, and the program file is read into the memory.
[0130] Optionally, the second verification unit 803 is further used for:
[0131] Initialize the storage part during execution;
[0132] Verify the saved files in the storage part and determine whether the verification passes;
[0133] If the verification passes, the saved file is executed or accessed.
[0134] Optionally, the first verification unit 802 is further configured to:
[0135] Performing hash calculation on the file data to obtain a first hash value;
[0136] Verify whether the first hash value is consistent with the pre-stored hash value carried in the additional information;
[0137] If they are consistent, the signature information is verified and it is determined whether the verification passes.
[0138] Optionally, the first verification unit 802 is further configured to:
[0139] Performing hash calculation on the additional information to obtain a second hash value;
[0140] Obtain the public key according to the certificate information carried in the additional information, and use the public key to decrypt the signature information to obtain the decrypted hash value;
[0141] Verify whether the second hash value is consistent with the decrypted hash value;
[0142] If they are consistent, the verification is determined to be successful.
[0143] Optionally, the first verification unit 802 is further configured to:
[0144] If the verification fails, the verification is stopped and an exception prompt notification is generated.
[0145] Optionally, the storage portion includes a super block, a block descriptor, a block bitmap, an index bitmap, an index table, and a data block.
[0146] See also Fig. 9 The present application also provides a device for verifying a file system, including:
[0147] Processor 901, memory 902, input and output unit 903, bus 904;
[0148] The processor 901 is connected to the memory 902, the input and output unit 903 and the bus 904;
[0149] The memory 902 stores a program, and the processor 901 calls the program to execute any of the above methods.
[0150] The present application also relates to a computer-readable storage medium, on which a program is stored. When the program is run on a computer, the computer executes any of the above methods.
[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0152] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0153] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0154] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0155] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A method for verifying a file system, characterized in that: The file system includes a verification part and a storage part, and the method includes: When the terminal is initialized, the program file in the verification part is read into the memory, and the program file is used to realize the interactive function; Verifying the program file and determining whether the verification passes; If the verification passes, the program file is executed, and during the execution, the saved files in the storage part are verified.
2. The method according to claim 1, characterized in that The step of reading the program file in the verification part into the memory comprises: Parsing the verification part, obtaining index blocks and data blocks in the verification part, wherein the data blocks are used to store program files; Determine the size of the data block according to the index block; The address of the index block is offset according to the size of the data block, and the program file is read into the memory.
3. The method according to claim 1, characterized in that The step of verifying the stored files in the storage part during the execution process includes: Initializing the storage portion during execution; Verifying the stored files in the storage part and determining whether the verification passes; If the verification passes, the saved file is executed or accessed.
4. The method according to claim 1, characterized in that: The program file includes file data, additional information and signature information, and the verifying the program file and determining whether the verification passes include: Performing hash calculation on the file data to obtain a first hash value; Verifying whether the first Hash value is consistent with the pre-stored Hash value carried in the additional information; If they are consistent, the signature information is verified and it is determined whether the verification passes.
5. The method according to claim 4, characterized in that The verifying the signature information and determining whether the verification passes includes: Performing a hash calculation on the additional information to obtain a second hash value; Obtaining a public key according to the certificate information carried in the additional information, and using the public key to decrypt the signature information to obtain a decrypted hash value; Verifying whether the second Hash value is consistent with the decrypted Hash value; If they are consistent, the verification is determined to be successful.
6. The method according to claim 1, characterized in that The method further comprises: If the verification fails, the verification is stopped and an exception prompt notification is generated.
7. The method according to any one of claims 1 to 6, characterized in that The storage part includes a super block, a block descriptor, a block bitmap, an index bitmap, an index table and a data block.
8. A device for verifying a file system, characterized in that: The device comprises: A reading unit, used for reading the program file in the verification part into the memory when the terminal is initialized, wherein the program file is used to realize the interactive function; A first verification unit, used to verify the program file and determine whether the verification passes; The second verification unit is used to execute the program file and verify the saved files in the storage part during the execution process.
9. A device for verifying a file system, characterized in that: The device comprises: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a program stored thereon, wherein the program, when executed on a computer, performs the method according to any one of claims 1 to 7.