Data integrity verification method, electronic device, computer readable medium and computer program product

By introducing a hierarchical hash tree mechanism and a dual-system backup and restore mechanism into the terminal device, the integrity of dynamic data is verified and repaired, which solves the problem of tampering with the writable partition data of the terminal device and improves the security and stability of the device.

CN121502831APending Publication Date: 2026-02-10ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511726260.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-21
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

In existing technologies, dynamic data in the writable partition of a terminal device cannot be effectively verified for security, resulting in critical data being tampered with and unable to be protected, thus affecting the security and stability of the device.

Method used

A hierarchical hash tree mechanism is introduced to verify the integrity of dynamic data on terminal devices. The target hash value of the root node is generated to determine whether the data has been tampered with, and if tampering occurs, the system switches to a secure and isolated second operating system to repair the data.

Benefits of technology

It effectively protects dynamic data in the writable partition of the terminal device, improves the security and stability of the device, ensures that critical data can be automatically repaired after being tampered with, and prevents unauthorized use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121502831A_ABST
    Figure CN121502831A_ABST
Patent Text Reader

Abstract

The invention provides a data integrity verification method, which is applied to terminal equipment and comprises the following steps: acquiring first dynamic data of a first operating system currently operated by the terminal equipment, and dividing the first dynamic data into data blocks with preset capacity; according to each data block and the preset capacity, determining a target hash value of a root node in the hierarchical hash tree, the target hash value being used for verifying the integrity of the first dynamic data; according to the embodiment of the invention, on the basis of a Hash verification mechanism for the dynamic data, whether the dynamic data in the writable partition of the terminal equipment is tampered or not is judged, so that the data is protected, and the safety and the stability of the terminal equipment in the using process are improved. The invention further provides electronic equipment, a computer readable medium and a computer program product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a data integrity verification method, electronic device, computer-readable medium, and computer program product. Background Technology

[0002] Currently, most terminal devices support dual-system (AB) operation. In related technologies, the encrypted digest of the partition image content is compared with information in the hardware eFuse (a one-time programmable memory based on fuse technology). Because verification is involved, the chip eFuse can only store one public key hash value. Therefore, security verification is only performed on read-only partition image files with fixed content. Thus, the step-by-step verification often stops at the kernel level. When read-only partition data verification fails, a system switch occurs, and the system that failed verification remains in the same state after the switch. However, critical data such as device status and configuration information changes in real time and is stored in the writable partition. Related technologies do not perform information verification on the data in the writable partition, making it impossible to effectively protect this part of the data. Summary of the Invention

[0003] This disclosure provides a data integrity verification method, an electronic device, a computer-readable medium, and a computer program product.

[0004] In a first aspect, embodiments of this disclosure provide a data integrity verification method, applied to a terminal device, the method comprising:

[0005] Obtain first dynamic data of the first operating system currently running on the terminal device, and divide the first dynamic data into data blocks of a preset capacity;

[0006] Based on each data block and the preset capacity, the target hash value of the root node in the hierarchical hash tree is determined; the target hash value is used to verify the integrity of the first dynamic data.

[0007] Secondly, embodiments of this disclosure also provide an electronic device, which includes a memory and a processor; the memory stores a computer program that can be executed by the processor, and when the computer program is executed by the processor, it implements the data integrity verification method.

[0008] Thirdly, embodiments of this disclosure also provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the data integrity verification method described above.

[0009] Fourthly, this disclosure also provides a computer program product, which includes a computer program that, when executed by a processor, implements the data integrity verification method.

[0010] The data integrity verification method of this disclosure is applied to a terminal device, including: acquiring first dynamic data of a first operating system currently running on the terminal device, dividing the first dynamic data into data blocks of a preset capacity; determining the target hash value of the root node in a hierarchical hash tree based on each data block and the preset capacity, wherein the target hash value is used to verify the integrity of the first dynamic data; this disclosure embodiment is based on a hash verification mechanism for dynamic data, and protects this part of the data by determining whether the dynamic data in the writable partition of the terminal device has been tampered with, thereby improving the security and stability of the terminal device during use. Attached Figure Description

[0011] In the accompanying drawings of the embodiments disclosed herein:

[0012] Figure 1 A schematic diagram of the system architecture used in the data integrity verification method provided in this embodiment of the disclosure;

[0013] Figure 2 Flowchart of the data integrity verification method provided in the embodiments of this disclosure Figure 1 ;

[0014] Figure 3 Flowchart of the data integrity verification method provided in the embodiments of this disclosure Figure 2 ;

[0015] Figure 4 A flowchart illustrating a data integrity verification method provided as a specific example of this disclosure;

[0016] Figure 5 This is a schematic diagram of the module composition of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0017] To enable those skilled in the art to better understand the technical solutions of this disclosure, the embodiments of this disclosure will be described in detail below with reference to the accompanying drawings.

[0018] The present disclosure will be described more fully below with reference to the accompanying drawings; however, the embodiments shown may be embodied in different forms, and the present disclosure should not be construed as limited to the embodiments set forth below. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will enable those skilled in the art to fully understand the scope of the disclosure.

[0019] The accompanying drawings are provided to further illustrate this disclosure and form part of the specification. They are used together with the detailed embodiments to explain this disclosure and do not constitute a limitation thereof. These and other features and advantages will become more apparent to those skilled in the art from the description of detailed embodiments with reference to the accompanying drawings.

[0020] Unless otherwise specified, each embodiment and feature of this disclosure may be used individually or in combination with other embodiments and features thereof.

[0021] Those skilled in the art will understand that various changes in form and detail may be made to the embodiments of this disclosure without departing from the scope of this disclosure as set forth by the appended claims.

[0022] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to limit the disclosure. The term "and / or" as used in this disclosure includes any and all combinations of one or more of the associated enumerated entries. The singular forms "a" and "the" as used in this disclosure are also intended to include the plural forms, unless the context clearly indicates otherwise. The terms "comprising," "made of," etc., as used in this disclosure specify the presence of the stated feature, integral, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof.

[0023] Unless otherwise specified, all terms used in this disclosure (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined in this disclosure.

[0024] This disclosure provides a data integrity verification method. Figure 1 A schematic diagram of the system architecture used in the data integrity verification method provided in this disclosure embodiment is shown below. Figure 1 As shown, the system includes terminal devices and servers. The terminal devices are terminal devices that support dual systems, including but not limited to: smartphones, smartwatches, CPE (Customer Premise Equipment), MIFI (Mobile WIFI), data cards, industrial gateways, security equipment, payment terminals, etc.

[0025] The terminal device is used to record multi-dimensional dynamic data during its operation in real time, such as system configuration information and device status information. Based on digest and encryption algorithms, it generates a unique hash value, i.e., a root hash value, and reports this root hash value to the server through a secure channel. The server then decides whether to perform data repair. If it receives a data repair instruction from the server, the terminal device first switches to another securely isolated operating system (System B) to repair the dynamic data that has been tampered with in the original operating system (System A). The server compares the hash value reported by the terminal device with a preset list of baseline hash values ​​to determine whether the dynamic data of the terminal device has been tampered with. If the dynamic data has been tampered with, the server instructs the terminal device to perform data repair on the dynamic data.

[0026] It should be noted that the embodiments of this disclosure support implementation without relying on a server. Hash value verification and data repair command issuance can be completed locally on the terminal device, relying on the terminal device itself to complete a series of processes including "hash value calculation -> local verification decision -> dual system backup and restoration". However, due to the limitations of the terminal device's own computing power and storage space, compared with the solution of terminal device and server collaborative processing, hash value calculation takes a long time, and the number of stored preset baseline hash value lists is limited. Therefore, the amount of data for dynamic data monitoring and the response speed of data integrity judgment are both limited. The embodiments of this disclosure are based on... Figure 1 Based on the system architecture shown, this explanation will take the collaborative processing method of terminal devices and servers as an example.

[0027] This disclosure provides a data integrity verification method, which is applied to a terminal device. Figure 2 Flowchart of the data integrity verification method provided in the embodiments of this disclosure Figure 1 ,like Figure 2 As shown, the data integrity verification method includes the following steps:

[0028] Step S11: Obtain the first dynamic data of the first operating system currently running on the terminal device, and divide the first dynamic data into data blocks of a preset capacity.

[0029] The first dynamic data is data stored in a writable partition. The terminal device is currently running under a first operating system, and the first dynamic data is data stored in the writable partition corresponding to the first operating system. In some embodiments, the first dynamic data includes, but is not limited to, the terminal device's operating status information and the terminal device's configuration information.

[0030] In this step, the terminal device dynamically collects multi-dimensional first dynamic data, splices the acquired first dynamic data, and divides the spliced ​​data into multiple data blocks according to a preset capacity. In some embodiments, the preset capacity is 4KB.

[0031] Step S12: Determine the target hash value of the root node in the hierarchical hash tree based on each data block and the preset capacity; the target hash value is used to verify the integrity of the first dynamic data.

[0032] In this step, a hierarchical hash tree is generated based on each data block and the preset capacity, thereby obtaining the target hash value of the root node in the root node layer of the hierarchical hash tree. This target hash value can be used as the basis for subsequent verification of the integrity of the first dynamic data.

[0033] The data integrity verification method of this disclosure is applied to a terminal device, including: acquiring first dynamic data of a first operating system currently running on the terminal device, dividing the first dynamic data into data blocks of a preset capacity; determining the target hash value of the root node in a hierarchical hash tree based on each data block and the preset capacity, wherein the target hash value is used to verify the integrity of the first dynamic data; this disclosure embodiment is based on a hash verification mechanism for dynamic data, and protects this part of the data by determining whether the dynamic data in the writable partition of the terminal device has been tampered with, thereby improving the security and stability of the terminal device during use.

[0034] In some embodiments, determining the target hash value of the root node in the hierarchical hash tree based on each data block and a preset capacity (i.e., step S12) includes the following steps:

[0035] Step S121, Leaf node layer generation step: Based on each data block and the preset salt value, the initial hash value of each leaf node in the leaf node layer is obtained by salt hash calculation.

[0036] The leaf node layer is the 0th layer in the hierarchical hash tree. The leaf node layer includes multiple leaf nodes. The initial hash value of each leaf node is obtained by a preset digest algorithm based on each data block through salted hash calculation. In this embodiment of the disclosure, the digest algorithm is SHA256.

[0037] In some embodiments, the initial hash value of each leaf node in the leaf node layer can be calculated according to the following formula (1):

[0038] Hash_leaf=SHA256(salt||data_block) (1)

[0039] Here, Hash_leaf is the initial hash value of the leaf node; salt is the preset salt value, which is stored in the read-only partition of the first operating system and is a 16-byte hexadecimal string; data_block is a 4KB data block.

[0040] The initial hash value of each leaf node is calculated using the above formula (1), forming a hash sequence of the leaf node layer.

[0041] Step S122, intermediate node layer generation step: Divide the hash values ​​of each node in the previous layer into multiple groups, with the number of hash values ​​in each group being M / P, where M is the preset capacity and P is the preset hash value length; For each group, concatenate the hash values ​​of each node in the group to obtain the concatenated hash value of the group; Based on the concatenated hash value of the group and the preset salt value, salt hashing is used to calculate the hash value of the group; The hash value of each group is the hash value of each intermediate node in the current intermediate node layer, and the hash value of each intermediate node in the first intermediate node layer is calculated based on the initial hash value of each leaf node in the leaf node layer. Repeat the intermediate node layer generation step (i.e., step S122) until the target hash value of the root node in the root node layer is calculated.

[0042] In step S122, the intermediate node layers and the root node layer of the hierarchical hash tree are constructed recursively, i.e., from layer 1 to the root node layer. Specifically, starting from the layer below the leaf node layer, the hash sequence of the previous layer is grouped sequentially, with each group containing M / P hash values, where M = 4KB. The SHA256 algorithm specifies that each hash value is 32 bytes in size, i.e., P = 32 bytes, therefore, M / P = 128. That is, the hash sequence is grouped, with each group containing 128 hash values. If the last group has fewer than 128 hash values, all remaining hash values ​​are used directly without padding the group. For each group, all hash values ​​within the group are concatenated sequentially into a byte sequence, and the SHA256 algorithm is used to calculate the corresponding hash value for that group with salt hashing, thus obtaining the hash sequence of the current intermediate layer.

[0043] The hash value of each intermediate node in the intermediate layer can be calculated according to the following formula (2):

[0044] Hash_parent=SHA256(salt||concatenated_hashes) (2)

[0045] Here, concatenated_hashes is a byte sequence obtained by concatenating all hash values ​​within a group. For example, 128 hashes concatenated together result in 4096 bytes. Hash_parent (parent hash value) is the hash value of each intermediate node in the intermediate layer, that is, the hash value corresponding to the group.

[0046] The process of constructing a hierarchical hash tree recursively is as follows:

[0047] Layer 0 (leaf node layer): For each of the n data blocks, n initial hash values ​​are calculated according to the above formula (1), where n is the number of data blocks.

[0048] Level 1: Group the initial hash values ​​of Level 0 into groups of 128 initial hash values. Calculate the parent hash value of each group according to the formula (2) above to obtain the hash sequence of Level 1. The number of hash values ​​in the hash sequence is ceil(n / 128).

[0049] Layer 2: Group the hash values ​​of Layer 1 into groups of 128 hash values. Calculate the parent hash value of each group according to the formula (2) above to obtain the hash sequence of Layer 2. The number of hash values ​​in this hash sequence is ceil(ceil(n / 128) / 128).

[0050] Repeat this process until the current layer has only one hash value. This current layer is the root node layer, and the hash value is the target hash value of the root node, i.e., the root hash value. This yields a complete hierarchical hash tree.

[0051] In some embodiments, dividing the first dynamic data into data blocks of a preset capacity (i.e., step S11) includes the following steps:

[0052] Step S111: Sort the first dynamic data according to the logical block attributes or data processing order of the first dynamic data to obtain a dynamic data sequence.

[0053] Logical block attributes include, but are not limited to: storage path (such as directory structure), file format (such as image, text, video), data function (such as user data, log data), and data processing order including but not limited to: access frequency (hot data, cold data) and dependencies (such as stages in the data processing pipeline).

[0054] Step S112: Concatenate each of the first dynamic data in the dynamic data sequence to obtain concatenated data.

[0055] Step S113: Divide the spliced ​​data into blocks according to the preset capacity to obtain each data block.

[0056] In some embodiments, the preset capacity is 4KB, that is, the concatenated data is divided into multiple data blocks of 4KB size. If the last data block is less than 4KB in size, then the data block will not be padded.

[0057] By sorting and dividing the first dynamic data into data blocks using the above method, it is possible to ensure that the size of the data blocks is appropriate to balance processing efficiency and memory overhead. This arrangement preserves the logical relationship between the data, reduces computational pressure through block processing, and facilitates subsequent integrity verification or deduplication operations.

[0058] In related technologies, the only solution for tampered data that fails integrity verification is to terminate the startup process. However, in this embodiment of the present disclosure, the tampered data can be further repaired.

[0059] In some embodiments, Figure 3 Flowchart of the data integrity verification method provided in the embodiments of this disclosure Figure 2 ,like Figure 3 As shown, after determining the target hash value of the root node in the hierarchical hash tree based on each data block and the preset capacity (i.e., step S12), the data integrity verification method may further include the following steps:

[0060] Step S13: In response to determining that the first dynamic data has been tampered with, restart the terminal device and start the second operating system.

[0061] The terminal device is currently running under the first operating system. If the terminal device determines that the first dynamic data has been tampered with, it will set the boot flag of the operating system to the second operating system and restart the terminal device. After the securely isolated second operating system is successfully booted, the second dynamic data of the terminal device under the second operating system is normal.

[0062] Step S14: Obtain the second dynamic data of the second operating system, and repair the first dynamic data based on the second dynamic data.

[0063] By separately mounting the writable partition in the first operating system used to store the first dynamic data, the first dynamic data in the writable partition of the second operating system is restored and repaired based on the second dynamic data in the writable partition of the second operating system.

[0064] In some embodiments, after repairing the first dynamic data based on the second dynamic data (i.e., step S14), the data integrity verification method may further include the following steps:

[0065] Step S15: Obtain the third dynamic data of the first operating system. The third dynamic data is the repaired dynamic data.

[0066] Step S16: Verify the integrity of the third dynamic data. In response to determining that the third dynamic data has been tampered with, obtain the fourth dynamic data of the second operating system, repair the third dynamic data according to the fourth dynamic data, and verify the integrity of the repaired third dynamic data.

[0067] Step S17: In response to the determination that the verified dynamic data has been tampered with when the number of repairs reaches a preset number, the first operating system is configured to the preset initial configuration.

[0068] Step S18: In response to determining that the verified dynamic data has not been tampered with and the number of repairs has not reached the preset number, the terminal device is restarted and the first operating system is started.

[0069] In other words, under the second operating system, the repaired third dynamic data of the first operating system is obtained, and the integrity of the current dynamic data of the first operating system is determined according to steps S11-S14 above, i.e., whether it has been repaired normally. If the dynamic data of the first operating system is still not repaired successfully, steps S11-S14 above are repeated under the second operating system to try to repair the dynamic data of the first operating system again. If the dynamic data of the first operating system is repaired N times in total and still not repaired successfully, where N is a preset number of times and N≥2, then the first operating system is directly restored to factory settings, that is, the current dynamic data of the first operating system is restored to the preset factory default value. If the current dynamic data of the first operating system is normal and the cumulative number of repairs to the dynamic data of the first operating system has not reached N times, then the dynamic data of the first operating system is considered to have been repaired successfully. At this time, the boot flag of the operating system is set to the first operating system and the terminal device is restarted. After the terminal device restarts, it will enter the first operating system.

[0070] In some embodiments, limited by the computing power and storage space of the terminal device itself, the terminal device can send the target hash value to the server, which will then determine whether the first dynamic data has been tampered with. Accordingly, determining that the first dynamic data has been tampered with (i.e., step S13) includes the following steps:

[0071] Step S21: Calculate the target hash value using the preset private key to obtain the encrypted hash value.

[0072] Step S22: Send the encrypted hash value to the server. The encrypted hash value is used to instruct the server to decrypt the encrypted hash value according to the preset public key, and match the decrypted hash value with the preset baseline hash value list to verify the integrity of the first dynamic data.

[0073] Step S23: Receive the data repair instruction sent by the server. The data repair instruction is sent by the server after determining that the first dynamic data has been tampered with.

[0074] In steps S21-S23, when the terminal device uploads the target hash value calculated in step S12 to the server via a secure channel, it uses a pair of keys to achieve encrypted transmission. The private key is pre-set on the terminal device side and uses an asymmetric encryption algorithm, such as RSA2048, RSA3076, or RSA4096, to encrypt the target hash value, resulting in an encrypted hash value of 256 / 384 / 512 bytes. The selected asymmetric encryption algorithm depends on the hash algorithm selected in step S121. For example, if the target hash value is calculated using SHA256, then the RSA2048 asymmetric encryption algorithm is used for encryption. The higher the level of the asymmetric encryption algorithm, the more bytes of signature data are obtained. The public key is pre-set on the server side, and the server decrypts the received encrypted hash value using this public key. Encrypting the target hash value during transmission ensures the security of data transmission. The server will match the decrypted hash value with a preset baseline hash value list. If they match, it means that the first dynamic data has not been tampered with, and the server will send an instruction to the terminal device that the dynamic data has not been tampered with. If they do not match or the corresponding value is not found in the preset baseline hash value list, it means that the first dynamic data has been tampered with, and the server will send a data repair instruction to the terminal device, instructing the terminal device to repair the first dynamic data.

[0075] In some embodiments, the terminal device may also determine whether the first dynamic data has been tampered with. Therefore, determining that the first dynamic data has been tampered with (i.e., step S13) includes the following steps:

[0076] Step S31: Perform hash calculation on the target hash value to obtain the location index.

[0077] Step S32: Determine the base hash value at the corresponding position in the preset base hash value list based on the position index, and match the target hash value with the base hash value.

[0078] Step S33: In response to the mismatch between the target hash value and the base hash value, or the position corresponding to the position index in the preset base hash value list being empty, it is determined that the first dynamic data has been tampered with.

[0079] In steps S31-S33, the terminal device performs hash calculation on the target hash value using the same hash algorithm as the preset baseline hash value list to obtain the location index. This hash algorithm can be the division remainder method, direct addressing method, etc. The calculated location index is used as the lookup key and input into the hash function to obtain the target bucket index. That is, the target storage location (i.e., the target bucket index) is obtained by taking the modulo of the location index with the array length. This target storage location is the position of the hash bucket in the preset baseline hash value list. The baseline hash value corresponding to the target bucket index in the preset baseline hash value list is determined. If the target hash value does not match the baseline hash value, or if the hash value corresponding to the target bucket index in the preset baseline hash value list is empty, it is determined that the first dynamic data has been tampered with and needs to be repaired. The hash calculation result of the target hash value is used as the query key. The hash function is used to convert the key of arbitrary length into an index value within a fixed range, thereby achieving direct location of the data. This avoids the sequential search or multi-level comparison of balanced binary trees required by general linear structures (such as arrays or linked lists), reducing the average time complexity from O(n) or O(log n) to the ideal O(1), where n is the number of levels of the binary tree.

[0080] To clearly illustrate the solutions of the embodiments of this disclosure, a specific example will be used for detailed description below. Figure 4 A flowchart illustrating a specific example of the data integrity verification method provided in this disclosure is shown below. Figure 4 As shown, the data integrity verification method includes the following steps:

[0081] Step S101: The terminal device obtains the dynamic data of the currently running operating system A and divides the dynamic data into data blocks of 4KB size.

[0082] In step S102, the terminal device uses the SHA256 digest algorithm to calculate the target hash value Hash_A of the root node in the hierarchical hash tree based on each data block.

[0083] In step S103, the terminal device uses the RSA20048 asymmetric encryption algorithm to perform encryption calculation on the target hash value Hash_A according to the preset private key to obtain the encrypted hash value Hash_B, and reports the encrypted hash value Hash_B to the server.

[0084] In step S104, the server decrypts the encrypted hash value Hash_B using a preset public key.

[0085] Step S105: Match the decrypted hash value with the preset baseline hash value list. If they match, issue a notification command that the dynamic data is normal. If they do not match or the corresponding position in the preset baseline hash value list is empty, proceed to step S106.

[0086] In step S106, the server sends a data repair command to the terminal device, and the terminal device restarts and starts the operating system B.

[0087] Step S107: Repair the dynamic data of operating system A based on the dynamic data of operating system B.

[0088] Step S108: Verify the data integrity of the current dynamic data of operating system A. If the current dynamic data of operating system A has been tampered with, repair it according to the dynamic data of operating system B, and further verify the data integrity of the current dynamic data of operating system A after repair.

[0089] Specifically, you can follow steps S101-S105 to verify the data integrity of the current dynamic data of operating system A.

[0090] Step S109: If the number of repairs reaches the preset number and the current dynamic data of the repaired operating system A is tampered with, then proceed to step S110; if the current dynamic data of the repaired operating system A is not tampered with and the number of repairs does not reach the preset number N, then restart the terminal device and start the operating system A.

[0091] Step S110: Configure operating system A to the preset initial configuration.

[0092] By establishing a closed-loop process through the terminal device reporting the root hash value to the server, followed by server verification and decision-making, and then dual-system backup and restoration, the security and autonomy of the terminal device can be improved.

[0093] The data integrity verification method of this disclosure is a dual-system anti-tampering solution for dynamic data of terminal devices. Based on the fact that most terminal devices currently support dual systems, it introduces a hash verification mechanism for dynamic data and an active repair mechanism for dual-system backup and restoration to solve the problem of illegal use after the dynamic information of the terminal device is tampered with.

[0094] This disclosure embodiment is based on a hash verification mechanism for dynamic data. It records multi-dimensional dynamic data of the terminal device in real time, such as system configuration information and device status information. A unique hash value is generated using a digest algorithm and an encryption algorithm. This unique hash value is reported to the server through a secure channel. The server compares this hash value with a preset list of baseline hash values ​​to determine whether the multi-dimensional dynamic data has been tampered with, and decides whether to trigger the active repair mechanism of dual-system backup and restoration. The active repair mechanism of dual-system backup and restoration is as follows: After receiving a data repair command from the server under the first operating system, the terminal device automatically switches to a securely isolated second operating system. Under the second operating system, the tampered dynamic data in the first operating system is repaired, such as data erasure and data restoration. The device can choose to restore the original data or preset data. The data integrity verification and data repair process requires no manual intervention. Based on the solution of this disclosure embodiment, if the terminal device's status information, configuration information, and other key data are tampered with, they can be automatically backed up and restored to their original or preset state without affecting the normal use of the terminal device.

[0095] Building upon the common dual-system (AB) implementation, this disclosure introduces a hash verification mechanism for dynamic data and an active repair mechanism for dual-system backup and restoration, which significantly enhances the security and stability of terminal devices during use. For consumer terminals, IoT (Internet of Things) devices, and other terminal devices with high security requirements, the solution in this disclosure ensures that critical data on the terminal device can be actively repaired after tampering, preventing economic losses caused by unauthorized use of the terminal device.

[0096] This disclosure also provides an electronic device, such as... Figure 5 As shown, it includes a memory 1 and a processor 2; the memory 1 has a computer program that can be executed by the processor 2, and when the computer program is executed by the processor 2, it implements any of the data integrity verification methods of the present disclosure embodiments.

[0097] Among them, the processor is a device with data processing capabilities, including but not limited to the central processing unit (CPU); the memory is a device with data storage capabilities, including but not limited to random access memory (RAM), more specifically such as SDRAM, DDR, etc., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); I / O interface, or read-write interface, is connected between the processor and the memory, enabling information exchange between the memory and the processor, including but not limited to the data bus (Bus).

[0098] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the data integrity verification methods of this disclosure.

[0099] This disclosure also provides a computer program product, which includes a computer program that, when executed by a processor, implements any one of the data integrity verification methods of this disclosure.

[0100] Those skilled in the art will understand that all or some of the steps, systems, and devices disclosed above, as functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0101] In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be executed by several physical components working together.

[0102] Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit (CPU), digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media and communication media. In embodiments of this disclosure, computer storage media include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, and any other media that can be used to store desired information and can be accessed by a computer. In embodiments of this disclosure, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

Claims

1. A data integrity verification method, applied to a terminal device, the method comprising: Obtain first dynamic data of the first operating system currently running on the terminal device, and divide the first dynamic data into data blocks of a preset capacity; Based on each data block and the preset capacity, determine the target hash value of the root node in the hierarchical hash tree; The target hash value is used to verify the integrity of the first dynamic data.

2. The method according to claim 1, wherein, Determining the target hash value of the root node in the hierarchical hash tree based on each data block and the preset capacity includes: Leaf node layer generation steps: Based on each data block and the preset salt value, the initial hash value of each leaf node in the leaf node layer is obtained by salt hash calculation; Intermediate node layer generation steps: Divide the hash values ​​of each node in the previous layer into multiple groups, with the number of hash values ​​in each group being M / P, where M is the preset capacity and P is the preset hash value length; For each group, concatenate the hash values ​​of each node in the group to obtain the concatenated hash value of the group; Based on the concatenated hash value of the group and the preset salt value, perform salt hash calculation to obtain the hash value of the group; The hash value of each group is the hash value of each intermediate node in the current intermediate node layer, and the hash value of each intermediate node in the first intermediate node layer is calculated based on the initial hash value of each leaf node in the leaf node layer; Repeat the intermediate node layer generation steps until the target hash value of the root node in the root node layer is calculated.

3. The method according to claim 1, wherein, The step of dividing the first dynamic data into data blocks of a preset capacity includes: Based on the logical block attributes or data processing order of the first dynamic data, the first dynamic data is sorted to obtain a dynamic data sequence; The first dynamic data in the dynamic data sequence are spliced ​​together to obtain spliced ​​data; The spliced ​​data is divided into blocks according to the preset capacity to obtain each data block.

4. The method according to claim 1, wherein, After determining the target hash value of the root node in the hierarchical hash tree based on each data block and the preset capacity, the method further includes: In response to determining that the first dynamic data has been tampered with, the terminal device is restarted and the second operating system is started; Obtain the second dynamic data of the second operating system, and repair the first dynamic data based on the second dynamic data.

5. The method according to claim 4, wherein, After repairing the first dynamic data based on the second dynamic data, the method further includes: Obtain the third dynamic data of the first operating system, wherein the third dynamic data is the repaired dynamic data; Verify the integrity of the third dynamic data; in response to determining that the third dynamic data has been tampered with, obtain the fourth dynamic data of the second operating system, repair the third dynamic data according to the fourth dynamic data, and verify the integrity of the repaired third dynamic data. In response to the determination that the verified dynamic data has been tampered with when the number of repairs reaches a preset number, the first operating system is configured to a preset initial configuration.

6. The method according to claim 5, wherein, After verifying the integrity of the repaired third dynamic data, the process also includes: In response to the determination that the verified dynamic data has not been tampered with and the number of repairs has not reached the preset number, the terminal device is restarted and the first operating system is started.

7. The method according to claim 4, wherein, The determination that the first dynamic data has been tampered with includes: The target hash value is encrypted using a preset private key to obtain an encrypted hash value. The encrypted hash value is sent to the server, which instructs the server to decrypt the encrypted hash value according to a preset public key, and to match the decrypted hash value with a preset baseline hash value list to verify the integrity of the first dynamic data. The server receives a data repair instruction sent by the server after determining that the first dynamic data has been tampered with.

8. The method according to claim 4, wherein, The determination that the first dynamic data has been tampered with includes: Perform a hash calculation on the target hash value to obtain the location index; The baseline hash value at the corresponding position in the preset baseline hash value list is determined based on the location index, and the target hash value is matched with the baseline hash value. In response to a mismatch between the target hash value and the baseline hash value, or if the position corresponding to the position index in the preset baseline hash value list is empty, it is determined that the first dynamic data has been tampered with.

9. An electronic device comprising a memory and a processor; the memory storing a computer program executable by the processor, wherein the computer program, when executed by the processor, implements the data integrity verification method according to any one of claims 1 to 8.

10. A computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the data integrity verification method according to any one of claims 1 to 8.

11. A computer program product comprising a computer program that, when executed by a processor, implements the data integrity verification method according to any one of claims 1 to 8.