A method for reading data from a mobile phone file system based on a ternary tree NAT data structure
By adopting the ternary tree NAT data structure in the mobile phone file system, using the target Node identifier and the NAT tree structure to quickly locate the encrypted data and perform decryption authentication, the problems of low reading efficiency and insufficient security of encrypted data in the existing technology are solved. Efficient and secure data access is achieved.
Patent Information
- Application Number
- CN202410903902.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-07-08
AI Technical Summary
The decryption operation of existing mobile phone file systems takes a long time when reading encrypted data, resulting in low reading efficiency and reduced security, especially in random reading mode.
Adopt a method based on the triple tree NAT data structure to quickly locate data through the target Node identifier and NAT tree structure, reduce the need to traverse the file system, provide a flexible ciphertext management method, and use the data block index for decryption authentication to ensure data security sex.
It improves the retrieval and access efficiency of the file system, reduces system overhead, improves response speed and throughput, and at the same time ensures data integrity and security.
Smart Images

Figure CN118445257B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of mobile phone data security, and in particular to a method for reading data from a mobile phone file system based on a ternary tree NAT data structure. Background Art
[0002] As mobile phone performance improves, how to ensure the security of mobile phone data has become an urgent problem to be solved. The mobile phone file system is directly related to data storage and plays an important role in data security. The file system manages the storage method of data on the disk. An excellent file system can greatly maximize the performance of the disk and meet the user's performance requirements. The F2FS (Flash Friendly File System) file system is a file system designed specifically for mobile phone flash memory. It is friendly to mobile phone storage media and has extremely high data read and write performance.
[0003] However, the decryption process of many encryption algorithms is more complicated than the encryption process, which results in a longer decryption time. In addition, when reading encrypted data, it needs to be decrypted immediately to access the data, which adds extra computing overhead and processing time. If the access mode of encrypted data is random reading rather than sequential reading, then each access to the data requires a decryption operation, which increases the reading time. This reduces the reading efficiency of encrypted data in the F2FS mobile phone file system and the security of data storage. Summary of the invention
[0004] Based on this, it is necessary to provide a mobile phone file system data reading method based on a ternary tree NAT data structure that can improve the reading efficiency and data reading security of encrypted data in the mobile phone file system in order to address the above technical problems.
[0005] A method for reading data from a mobile phone file system based on a ternary tree NAT data structure, the method comprising:
[0006] The parsing and reading task obtains the key information of the target ciphertext data. The key information includes: target Node identifier and target data block index.
[0007] Read the plaintext information of the NAT root node in the memory according to the target Node identifier.
[0008] In the ternary tree NAT data structure, the target NAT leaf node that meets the identifier constraint rule is sequentially searched starting from the identifier of the NAT root node plain text information, and the mapping relationship of the target Node identifier is searched in the target NAT leaf node to obtain the target Node.
[0009] According to the matching result between the index directory of the target Node and the target data block index, the target data block information tuple corresponding to the target data block index is obtained.
[0010] The target ciphertext data is obtained by addressing according to the physical address of the target data block information tuple, and the target ciphertext data is decrypted and authenticated using the target data block information tuple to obtain the target plaintext data.
[0011] A mobile phone file system data reading device based on a ternary tree NAT data structure, the device comprising:
[0012] The ciphertext key information acquisition module is used to parse the reading task to obtain the key information of the target ciphertext data. The key information includes: the target Node identifier and the target data block index.
[0013] The root node information decryption module is used to read the plaintext information of the NAT root node in the memory according to the target Node identifier.
[0014] The target Node search module is used to sequentially search for the target NAT leaf node that meets the identifier constraint rule in the ternary tree NAT data structure, starting from the identifier of the NAT root node plain text information, and search for the mapping relationship of the target Node identifier in the target NAT leaf node to obtain the target Node.
[0015] The target data block information tuple parsing module is used to obtain the target data block information tuple corresponding to the target data block index according to the matching result between the index directory of the target Node and the target data block index.
[0016] The plaintext information reading module is used to perform addressing according to the physical address of the target data block information tuple to obtain the target ciphertext data, and use the target data block information tuple to decrypt and authenticate the target ciphertext data to obtain the target plaintext data.
[0017] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0018] The parsing and reading task obtains the key information of the target ciphertext data. The key information includes: target Node identifier and target data block index.
[0019] Read the plaintext information of the NAT root node in the memory according to the target Node identifier.
[0020] In the ternary tree NAT data structure, the target NAT leaf node that meets the identifier constraint rule is sequentially searched starting from the identifier of the NAT root node plain text information, and the mapping relationship of the target Node identifier is searched in the target NAT leaf node to obtain the target Node.
[0021] According to the matching result between the index directory of the target Node and the target data block index, the target data block information tuple corresponding to the target data block index is obtained.
[0022] The target ciphertext data is obtained by addressing according to the physical address of the target data block information tuple, and the target ciphertext data is decrypted and authenticated using the target data block information tuple to obtain the target plaintext data.
[0023] The above-mentioned mobile phone file system data reading method based on the ternary tree NAT data structure can quickly locate the NAT node information where the target data is located through the target Node identifier and the NAT tree structure for the encrypted data in the ternary tree NAT data structure, without traversing the entire file system. This improves the retrieval and access efficiency of the file system. Secondly, in the ternary tree NAT data structure, the NAT nodes that meet the identifier constraint rules are sequentially searched with the identifier of the root node information as the starting point, and the target NAT leaf node corresponding to the target Node identifier is obtained, providing a flexible ciphertext management method, which can conveniently perform operations such as updating, deleting or moving ciphertext without affecting system performance and data integrity. Then, since the NAT tree structure supports multi-level data organization, the file system can better adapt to different data management requirements, including the organization of directory structure and index structure. Finally, according to the data block index in the target node, the corresponding ciphertext data block information tuple is found, the ciphertext data block is read through the physical address, and the corresponding key is used for decryption authentication. After successful decryption, the plaintext information of the target data block is obtained, that is, the required file content or data. Decryption authentication ensures that only authorized users can obtain plaintext data, thereby ensuring the integrity and security of the data. In addition, the use of the ternary tree NAT data structure for encrypted data query can reduce system overhead and improve system response speed and throughput. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is an application scenario diagram of a method for reading data from a mobile phone file system based on a ternary tree NAT data structure in one embodiment;
[0025] Figure 2 A schematic diagram of a flow chart of a method for reading data from a mobile phone file system based on a ternary tree NAT data structure in one embodiment;
[0026] Figure 3 A schematic diagram of a flow chart of a mobile phone file system data reading step based on a ternary tree NAT data structure in an embodiment;
[0027] Figure 4 A Crypt data structure in one embodiment;
[0028] Figure 5The f2fs_inode encrypted data structure in one embodiment;
[0029] Figure 6 A direct_inode encrypted data structure in one embodiment;
[0030] Figure 7 A superblock encryption data structure in one embodiment;
[0031] Figure 8 It is a structural block diagram of a mobile phone file system data reading device based on a ternary tree NAT data structure in one embodiment;
[0032] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0034] The mobile phone file system data reading method based on the ternary tree NAT data structure provided by the present invention can be applied to Figure 1 In the F2FS file system encryption scheme shown in FIG. 1 , the original data structure of F2FS exists in an encrypted form on the disk, and the data structure at the tail of the arrow stores the encryption information of the data structure pointed to by the arrow, including the key and the message verification code. The Node contains the encryption information of the directory entry and the data block. In the F2FS file system, the directory entry and the data block are both stored in the data segment of the disk, and the original Node contains the physical address of the directory entry and the data block. The corresponding directory entry and data block can be directly found through the Node. Therefore, the encryption information of the directory entry and the data block is placed in the Node, thereby ensuring that the F2FS data query process remains basically unchanged. In addition, NAT saves the encryption information of the Node. In the F2FS file system, in order to avoid the snowball effect, the physical address of the Node can be found through NAT. Therefore, the encryption information of the Node is saved in NAT.
[0035] In one embodiment, Figure 2 As shown, a method for reading data from a mobile phone file system based on a ternary tree NAT data structure is provided. Figure 1 The encryption scheme of the F2FS file system in is used as an example to illustrate the encryption scheme, which includes the following steps:
[0036] Step 202: parse the reading task to obtain key information of the target ciphertext data.
[0037] Key information includes: target Node identifier and target data block index.
[0038] Specifically, the data scheme composed of the F2FS file system is constructed based on the ternary tree NAT data structure, the Node data structure, and the metadata super block to store the target ciphertext data. The Crypt of the data block and the directory entry is placed in the corresponding Node structure. The Crypt of the Node structure is placed in the leaf node of the NAT ternary tree according to the node id. In the NAT ternary tree, the Crypt of the child node is saved by its parent node. The Crypt of the root node of the NAT ternary tree is placed in the super block. The Crypt of the CP is placed in the super block. The Crypt of the SIT is placed in the super block. The Crypt of the SSA is placed in the super block. The super block is encrypted by the root key.
[0039] Furthermore, the target data reading task input by the system superior is obtained, and the target data reading task is parsed to obtain the corresponding Node identifier and the data block index of the target data, which are used to point to the target data block of the reading task.
[0040] Step 204: read the plain text information of the NAT root node in the memory according to the target Node identifier.
[0041] Specifically, when the target Node identifier is read for the first time, the physical address, key, and message verification code of the NAT root node are obtained from the metadata super block. The ciphertext of the NAT root node is obtained by physical address addressing, and then the plaintext information of the NAT root node is obtained by the key and message verification code. When it is not the first time to read the target Node identifier, it is read from the memory. According to the state of the NAT root node in the memory, the plaintext information of the NAT root node can usually be obtained without decryption.
[0042] Step 206, in the ternary tree NAT data structure, starting from the identifier of the NAT root node plain text information, sequentially search for the target NAT leaf node that meets the identifier constraint rule, search for the mapping relationship of the target Node identifier in the target NAT leaf node, and obtain the target Node.
[0043] The identifier constraint rule is: for the leaf node in the NAT data structure, its identifier is constrained by the first identifier and the second identifier in its parent node. The identifier is composed of numbers. If the leaf node is the first child node of its parent node, then several Node identifiers in the leaf node are smaller than the first identifier of its parent node. If the leaf node is the second child node of its parent node, then several Node identifiers are between the first identifier and the second identifier of its parent node. If the leaf node is the third child node of its parent node, then several Node identifiers are larger than the second identifier of its parent node. In addition, for non-leaf nodes in the NAT data structure, their first identifier is smaller than the second identifier. If a non-leaf node has a parent node, the size of its first identifier and the second identifier is constrained by the first identifier and the second identifier of the parent node, and the constraint rules are the same as the Node identifier constraints in the leaf node. The corresponding child node can be found based on the identifier relationship and the information tuple of the NAT child node.
[0044] Specifically, in the ternary tree NAT data structure, according to the comparison result of the identifier of the plain text information of the root node and the identifier of the non-leaf node in the ternary tree NAT data structure, the NAT nodes that meet the identifier constraint rules are searched in sequence from the root node to the leaf node, and the information tuple of the Node corresponding to the Node identifier is obtained. The physical address in the information tuple is used for addressing, and the target Node is decrypted in combination with the key and message authentication code of the information tuple to obtain the target Node.
[0045] Step 208: Obtain a target data block information tuple corresponding to the target data block index according to the matching result between the index directory of the target Node and the target data block index.
[0046] Step 210, addressing is performed according to the physical address of the target data block information tuple to obtain the target ciphertext data, and the target ciphertext data is decrypted and authenticated using the target data block information tuple to obtain the target plaintext data.
[0047] In the above-mentioned mobile phone file system data reading method based on the ternary tree NAT data structure, for the encrypted data in the ternary tree NAT data structure, the NAT node information where the target data is located can be quickly located through the target Node identifier and the NAT tree structure, without traversing the entire file system. This improves the retrieval and access efficiency of the file system. Secondly, in the ternary tree NAT data structure, the NAT nodes that meet the identifier constraint rules are sequentially searched with the identifier of the root node information as the starting point, and the target NAT leaf node corresponding to the target Node identifier is obtained, providing a flexible ciphertext management method, which can conveniently perform operations such as updating, deleting or moving ciphertext without affecting system performance and data integrity. Then, since the NAT tree structure supports multi-level data organization, the file system can better adapt to different data management requirements, including the organization of directory structure and index structure. Finally, according to the data block index in the target node, the corresponding ciphertext data block information tuple is found, the ciphertext data block is read through the physical address, and the corresponding key is used for decryption authentication. After successful decryption, the plaintext information of the target data block is obtained, that is, the required file content or data. Decryption authentication ensures that only authorized users can obtain plaintext data, thereby ensuring the integrity and security of the data. In addition, the use of the ternary tree NAT data structure for encrypted data query can reduce system overhead and improve system response speed and throughput.
[0048] In one embodiment, if Figure 3 As shown, a mobile phone file system data reading step based on a ternary tree NAT data structure is provided. The data reading takes reading folder data as an example. The specific contents are as follows:
[0049] Step 1: Receive the task, and provide the inode id and index. In this embodiment, inode id=1, index=0. Folder data is usually small, so in this embodiment, only one data block is used, so index=0.
[0050] Step 2: Since the NAT root node is loaded when the file system is initialized, this step is skipped.
[0051] Step 3: Through NAT, search for the node-related information (physical address (pba), key (key), message authentication code (mac)) corresponding to the inode id. Since the inode id = 1, according to the NAT construction principle, its node-related information is in the first leaf node on the left. NAT follows the leftmost path from the root node to the target leaf node.
[0052] Step 4: Read the node. First, search the memory to see if the node has not been stored in the disk. If it is, directly retrieve it from the memory. If it is not in the memory, it needs to be read from the disk according to the read encryption information and address. Since the index is 0, the target data is obviously in the current node, so jump directly to the next step.
[0053] Step 5: Get the physical address, key, and message verification code of the data block from the current node.
[0054] Step 6: Read the data block ciphertext, complete decryption authentication, and finally return the data.
[0055] In one of the embodiments, a data encryption framework is constructed in the mobile phone file system. The data encryption framework includes: a ternary tree NAT data structure, a metadata super block, and a Node data structure. The metadata super block is set in the previous data encryption link of the ternary tree NAT data structure, so that the metadata super block encrypts and saves the information tuple stored in the root node of the ternary tree NAT data structure through the root key. The Node data structure is set in the next data encryption link of the ternary tree NAT data structure, so that the Node data structure uploads the information tuple of the target Node to the leaf node of the ternary tree NAT data structure for encrypted storage. The data encryption framework stores the target ciphertext data according to the encrypted root node information and the information tuple of the target Node.
[0056] In one embodiment, the encryption interface provided by OpenSSL is used, and the encryption algorithm is AES128, so as to encrypt and authenticate each data written to the disk. In this embodiment, the length of the key and message authentication code is set to 16. For each encrypted data block, a key and message authentication code of the same size are used, so the key and message authentication code are encapsulated into a structure Crypt, such as Figure 4 As shown, it helps improve code readability.
[0057] In one embodiment, if the system reads the target Node identifier for the first time, the information tuple of the NAT root node is obtained from the metadata super block according to the root key, and the ciphertext information of the NAT root node is obtained by addressing in the ternary tree NAT data structure according to the physical address of the information tuple of the root node. The ciphertext information of the NAT root node is decrypted and authenticated by the key and message verification code of the information tuple of the root node to obtain the plaintext information of the NAT root node. If the system does not read the target Node identifier for the first time, the plaintext information of the NAT root node corresponding to the ciphertext identifier is extracted from the memory data.
[0058] In one embodiment, the Node data structure includes: direct Node and indirect Node. The direct Node stores the index of the data block and the ciphertext information tuple of the data block. The indirect Node stores the identifier of the next level Node. The metadata super block includes: the physical address, key and message authentication code of the CP data area, the physical address, key and message authentication code of the SIT data area, the physical address, key and message authentication code of the SSA data area, and the physical address, key and message authentication code of the NAT root node.
[0059] It is worth noting that in the encryption scheme, symmetric encryption algorithms and message authentication code mechanisms are used to ensure both data security and data integrity. Therefore, when saving the encryption information of any data, it is necessary to record the key and message authentication code at the same time, and the plain text is not stored on the disk, but the cipher text is stored in the location of the plain text. In addition:
[0060] 1) Superblock encryption data structure: The superblock records the basic information of the F2FS file system, including the start address of each data area (Check Point (CP), Node Address Table (NAT), etc.), the size of each data area, etc. Here, in order to improve the security of the F2FS file system, the encryption information (key and message verification code) of the four data areas of Check Point (CP), Segment Information Table (SIT), Node Address Table (NAT), and Segment Summary Area (SSA) are placed in the superblock, and the encrypted ciphertext is placed in the location where the plaintext was originally stored. In the superblock, the key and message verification code exist in the form of a Crypt structure. When the file system exits, the encrypted ciphertext is placed in the location where the plaintext was originally stored.
[0061] 2) Node data structure: In the F2FS file system, nodes can be divided into direct nodes and indirect nodes according to whether the physical address of the data block is stored in the node. In direct nodes, since they store the physical address of the data block, in order to facilitate the search of encrypted information, the encryption information of each data block, namely the key and the message verification code, needs to be added to the direct node. However, in indirect nodes, since they store the ID (nid) of the next-level node, the encryption information of the next-level node is not stored in the indirect node. The physical address of the next-level node can be obtained by querying the nid in the NAT, so the encryption information of the next-level node is stored in the NAT.
[0062] In addition, there are two types of direct nodes and one type of indirect nodes, so there are three types of nodes in total, namely f2fs_inode, direct_node, and indirect_node. In f2fs_inode and direct_node, the physical address of the data block is directly saved, so the encryption information of each data block needs to be added to these two nodes, that is, the Crypt structure in this embodiment. In the f2fs_inode structure, the number of addresses of the original saved data blocks is DEF_ADDRS_PER_INODE, so the number of newly added Crypt structures is also DEF_ADDRS_PER_INODE, and its specific structure is as follows Figure 5 In the direct_node structure, the number of addresses of the original saved data blocks is ADDRS_PER_BLOCK, so the number of newly added Crypt structures is also ADDRS_PER_BLOCK. Its specific structure is as follows Figure 6 As shown. In f2fs_inode and direct_node, the address and Crypt structure correspond one-to-one, that is, the address and Crypt at the same index correspond to the same data block. Since indirect_node stores the nid of the next level node and does not store the physical address, the indirect_node structure remains unchanged.
[0063] In addition, the encryption data structure of the super block in the embodiment adds encryption information (key and message verification code) of four data areas, CP, SIT, NAT, and SSA, into the super block. In the super block, the key and message verification code exist in the form of Crypt structure. When the file system exits, the encrypted ciphertext is placed in the location where the plaintext was originally stored, including Figure 7 The super block structure of the encrypted information is shown.
[0064] In one of the embodiments, in a ternary tree NAT data structure, according to the comparison result of the identifier of the NAT root node plain text information and the identifier of the non-leaf node in the ternary tree NAT data structure, the target NAT leaf node that meets the identifier constraint rule is searched in the direction of the NAT leaf node in sequence. According to the target Node identifier, the information tuple of the target Node mapped to the target Node identifier in the target NAT leaf node is obtained, and the information tuple of the target Node is parsed to obtain the target Node.
[0065] In one of the embodiments, according to the matching result between the index directory of the target Node and the target data block index, if the index directory of the target Node does not contain the target data block index, the identifier of the next level Node corresponding to the target Node is searched according to the target data block index, and the information tuple corresponding to the identifier of the next level Node is searched again in the ternary tree NAT data structure. If the index directory of the target Node contains the target data block index, the target data block information tuple corresponding to the target data block index in the index directory of the target Node is obtained.
[0066] It is worth noting that in this embodiment, a ternary tree that integrates the Merkle tree and the B+ tree is used to construct the NAT encryption data structure. The logical structure is a ternary tree (it can also be an N-fork number). The structure of non-leaf nodes is consistent, that is, they all contain two representations of nid, and three groups of physical addresses (pba), keys (key), and message verification codes (mac). The two nids of non-leaf nodes are used to distinguish the nid ranges of the three groups of child nodes they point to. The three groups of pba, key, and mac represent the physical addresses, keys, and message verification codes of the three child nodes, respectively. The leaf node contains multiple nid-> (pba, key, mac) mapping relationships. A leaf node is stored in the same physical block. NAT provides four external functions, namely NAT initialization, NAT disk placement, data query, and data writing.
[0067] In one embodiment, the ternary tree NAT encrypted data structure includes four functions: NAT initialization, NAT disk storage, NAT query data and NAT data writing. The specific steps of each function are as follows:
[0068] 1) NAT initialization: The first case: when the file system is first created, there is no NAT data on the disk. At this time, the entire NAT ternary tree needs to be constructed and all nodes except the root node need to be placed on the disk. This situation is relatively complicated, and the height of the NAT ternary tree needs to be designed according to the size of the file system. In this embodiment, the planned number of nodes is 1024, and each NAT leaf node contains 5 node information, so a ternary tree with a height of 6 is ultimately required. The tree height calculation method is shown in Formula 1, where num represents the number of nodes, leaf represents the number of node information that a single leaf node can store, and tree represents the number of branches of the tree. In this embodiment, num=1024, leaf=5, tree=3, that is:
[0069] ;
[0070] The construction of the ternary tree uses a backtracking algorithm to traverse the entire tree in a depth-first manner. After traversing a node, the node is encrypted, written to disk, and its encrypted information is written to the parent node.
[0071] The second case: when the file system is not created for the first time, that is, there is NAT data on the disk, in which case the address and encryption information of the NAT root node need to be read from the super block, and the NAT root node needs to be decrypted and loaded into the memory.
[0072] 2) NAT disk placement: NAT disk placement is called when the file system exits. It only requires placing the NAT root node in a preset location and placing the encrypted information of the NAT root node in the super block.
[0073] 3) NAT query data: To query data through NAT, you need to provide the node id. NAT searches from the NAT root node to the leaf nodes in sequence according to the node id. Finally, the node id is hit in the leaf node, and the storage address and encrypted information Crypt of the corresponding node are returned.
[0074] 4) NAT writes data: NAT writes data requiring node id and data. This is a two-step process. First, you need to find the location of the corresponding leaf node based on the node id, take out the leaf node, put the data to be written into the leaf node, then put the leaf node back to the location where it was taken out, and reverse the search path to change the encryption information of each node until the root node.
[0075] In one of the embodiments, the target ciphertext data is obtained by addressing in the memory according to the physical address of the target data block information tuple, and the target ciphertext data is decrypted and authenticated using the key and message authentication code of the target data block information tuple to obtain the target plaintext data.
[0076] It should be understood that although Figure 2-Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0077] In one embodiment, Figure 8As shown, a mobile phone file system data reading device based on a ternary tree NAT data structure is provided, comprising: a ciphertext key information acquisition module 802, a root node information decryption module 804, a target Node search module 806, a target data block information tuple parsing module 808 and a plaintext information reading module 810, wherein:
[0078] The ciphertext key information acquisition module 802 is used to parse the reading task to obtain the key information of the target ciphertext data. The key information includes: the target Node identifier and the target data block index.
[0079] The root node information decryption module 804 is used to read the plain text information of the NAT root node in the memory according to the target Node identifier.
[0080] The target Node search module 806 is used to sequentially search for the target NAT leaf node that meets the identifier constraint rule in the ternary tree NAT data structure, starting from the identifier of the NAT root node plain text information, and search for the mapping relationship of the target Node identifier in the target NAT leaf node to obtain the target Node.
[0081] The target data block information tuple parsing module 808 is used to obtain the target data block information tuple corresponding to the target data block index according to the matching result between the index directory of the target Node and the target data block index.
[0082] The plaintext information reading module 810 is used to perform addressing according to the physical address of the target data block information tuple to obtain the target ciphertext data, and use the target data block information tuple to decrypt and authenticate the target ciphertext data to obtain the target plaintext data.
[0083] Regarding the specific limitations of the mobile phone file system data reading device based on the ternary tree NAT data structure, please refer to the limitations of the mobile phone file system data reading method based on the ternary tree NAT data structure in the above text, which will not be repeated here. Each module in the above-mentioned mobile phone file system data reading device based on the ternary tree NAT data structure can be fully or partially implemented by software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0084] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig. 9As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for reading data from a mobile phone file system based on a ternary tree NAT data structure is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0085] Those skilled in the art will understand that Figure 8-Figure 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0086] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0087] The parsing and reading task obtains the key information of the target ciphertext data. The key information includes: target Node identifier and target data block index.
[0088] Read the plaintext information of the NAT root node in the memory according to the target Node identifier.
[0089] In the ternary tree NAT data structure, the target NAT leaf node that meets the identifier constraint rule is sequentially searched starting from the identifier of the NAT root node plain text information, and the mapping relationship of the target Node identifier is searched in the target NAT leaf node to obtain the target Node.
[0090] According to the matching result between the index directory of the target Node and the target data block index, the target data block information tuple corresponding to the target data block index is obtained.
[0091] The target ciphertext data is obtained by addressing according to the physical address of the target data block information tuple, and the target ciphertext data is decrypted and authenticated using the target data block information tuple to obtain the target plaintext data.
[0092] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0093] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0094] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A method for reading data from a mobile phone file system based on a ternary tree NAT data structure, characterized in that: The method comprises: Constructing a data encryption framework in the mobile phone file system; the data encryption framework includes: a ternary tree NAT data structure, a metadata super block and a Node data structure; The metadata super block is set in the previous data encryption link of the ternary tree NAT data structure, so that the metadata super block encrypts and stores the information tuple stored in the root node of the ternary tree NAT data structure through the root key; The Node data structure is set in the next data encryption link of the ternary tree NAT data structure, so that the Node data structure uploads the information tuple of the target Node to the leaf node of the ternary tree NAT data structure for encryption and storage; The data encryption framework stores the target ciphertext data according to the encrypted root node information and the information tuple of the target Node; Parse the reading task to obtain key information of the target ciphertext data; the key information includes: target Node identifier and target data block index; Read the plaintext information of the NAT root node in the memory according to the target Node identifier; In the ternary tree NAT data structure, starting from the identifier of the plain text information of the NAT root node, sequentially search for the target NAT leaf node that meets the identifier constraint rule, and search for the mapping relationship of the target Node identifier in the target NAT leaf node to obtain the target Node; Obtaining a target data block information tuple corresponding to the target data block index according to a matching result between the index directory of the target Node and the target data block index; The target ciphertext data is obtained by addressing according to the physical address of the target data block information tuple, and the target ciphertext data is decrypted and authenticated using the target data block information tuple to obtain the target plaintext data.
2. The method according to claim 1, characterized in that Read the plain text information of the NAT root node in the memory according to the target Node identifier, including: If the system reads the target Node identifier for the first time, obtain the information tuple of the NAT root node from the metadata super block according to the root key, address the NAT root node in the ternary tree NAT data structure according to the physical address of the information tuple of the root node, and obtain the ciphertext information of the NAT root node; decrypt and authenticate the ciphertext information of the NAT root node by using the key and message verification code of the information tuple of the root node to obtain the plaintext information of the NAT root node; If the system is not reading the target Node identifier for the first time, the NAT root node plaintext information corresponding to the ciphertext identifier is extracted from the memory data.
3. The method according to claim 1, characterized in that The Node data structure includes: direct Node and indirect Node; wherein the direct Node stores the index of the data block and the ciphertext information tuple of the data block; the indirect Node stores the identifier of the next level Node; The metadata super block includes: the physical address, key and message authentication code of the CP data area, the physical address, key and message authentication code of the SIT data area, the physical address, key and message authentication code of the SSA data area, and the physical address, key and message authentication code of the NAT root node.
4. The method according to claim 3, characterized in that In the ternary tree NAT data structure, starting from the identifier of the plain text information of the NAT root node, sequentially searching for a target NAT leaf node that meets the identifier constraint rule, searching for a mapping relationship of the target Node identifier in the target NAT leaf node, and obtaining the target Node, including: In the ternary tree NAT data structure, according to the comparison result of the identifier of the plain text information of the NAT root node and the identifier of the non-leaf node in the ternary tree NAT data structure, search for the target NAT leaf node that meets the identifier constraint rule in the direction of the NAT leaf node in sequence; According to the target Node identifier, the information tuple of the target Node mapped by the target Node identifier in the target NAT leaf node is obtained, and the information tuple of the target Node is parsed to obtain the target Node.
5. The method according to claim 4, characterized in that Acquiring a target data block information tuple corresponding to the target data block index according to a matching result between the index directory of the target Node and the target data block index, including: According to the matching result between the index directory of the target Node and the target data block index, if the index directory of the target Node does not contain the target data block index, the identifier of the next-level Node corresponding to the target Node is searched according to the target data block index, and the information tuple corresponding to the identifier of the next-level Node is searched again in the ternary tree NAT data structure; if the index directory of the target Node contains the target data block index, the target data block information tuple corresponding to the target data block index in the index directory of the target Node is obtained.
6. The method according to claim 5, characterized in that Addressing is performed according to the physical address of the target data block information tuple to obtain target ciphertext data, and decrypting and authenticating the target ciphertext data using the target data block information tuple to obtain target plaintext data, including: The target ciphertext data is obtained by addressing in the memory according to the physical address of the target data block information tuple, and the target ciphertext data is decrypted and authenticated using the key and message verification code of the target data block information tuple to obtain the target plaintext data.
Citation Information
Patent Citations
Data processing method and device
CN112199677A
Tamper-proof index structure and construction, storage and query method thereof
CN115237914A
