Efficient sum query method for homomorphic database based on b+ tree index structure

CN118296038BActive Publication Date: 2026-10-23NANKAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410322560.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-20
Publication Date
2026-10-23
Estimated Expiration
2044-03-20

AI Technical Summary

Technical Problem

然而,这些方案在频繁进行SUM等统计查询时也面临一些挑战和问题

Benefits of technology

[0045]Specifically, the value stored in the index node is a homomorphically encrypted value from the client. Leveraging the property that homomorphic encryption preserves the ability to perform addition operations, the ciphertext values ​​of lower-level child nodes can be directly added together to obtain the ciphertext sum, which is then stored in the `sum` value of the parent node. This is crucial for sensitive data and privacy protection, preventing unauthorized access and data leakage. Therefore, when querying the aggregated result of all data, the homomorphically encrypted `sum` value stored in the root node can be directly returned to obtain the homomorphically encrypted sum of all records. This value is then returned to the client, which can obtain the plaintext result through homomorphic decryption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118296038B_ABST
    Figure CN118296038B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of data security, and specifically relates to an efficient encrypted database SUM query method based on a B+ tree, which can establish a B+ tree index structure on a server, store corresponding sum values, and combine an efficient homomorphic encryption scheme to directly perform summation calculation on the server side. Finally, when performing a SUM query, the sum value stored in the root node is directly returned, and after decryption, the value is used as a query result. The complexity of the entire SUM query time can reach O(1), and compared with other encrypted database SUM query schemes, the query efficiency is high, and the query function is rich. In the scheme, the server does not need to perform additional communication interaction with the client, and at the same time, the storage and calculation pressure of the client is reduced. The method has high flexibility, can support other complex statistical queries, is suitable for various encrypted outsourcing relational databases, and effectively protects the data security and data privacy of the industry using the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of secure encrypted database computing, specifically involving an efficient SUM query method for encrypted databases based on a B+ tree index structure. The method includes establishing a B+ tree index structure on a database server and combining it with homomorphic encryption technology to implement addition, deletion, update, and SUM query algorithms on encrypted data. This provides a secure computing environment, ensures the security of encrypted and decrypted data storage, and improves the efficiency of SUM queries. Background Technology

[0002] With the continuous evolution of internet technology, various industries in the new era are ushering in a period of vigorous development, and their business scale and forms are constantly expanding. At the same time, various devices can communicate via the internet, forming the Internet of Things (IoT). This leads to increasingly fierce competition among major powers in cyberspace. If sensitive information generated by financial, governmental, and military departments, as well as communication and exchange data between IoT devices, are tampered with, deleted, or leaked, it will cause incalculable losses to the nation and its citizens.

[0003] Database Management Systems (DBMS) are among the most widely used and important data carriers in the information society. With the advent of the digital age, organizations are facing the challenge of storing massive amounts of data to unlock its potential value. To meet the ever-growing demands for data storage, computing, and applications, outsourced databases, especially relational database storage solutions, have become an urgent need, requiring extremely high levels of security and stability.

[0004] To fully protect the security of a database system, it is crucial to store data in complete encryption. However, data encryption can trigger a series of problems, such as ciphertext expansion significantly consuming storage resources, and ciphertext storage hindering query operations that would otherwise be performed on plaintext. Therefore, finding suitable methods and technologies to balance security and system performance remains essential in addressing database security issues.

[0005] In the database field, statistical queries are a crucial database operation, providing valuable information about data distribution, attribute relationships, and characteristics, thus helping people better understand and utilize data. The SUM algorithm is one of the most common statistical query algorithms, used to calculate the sum of numerical attributes. Traditional plaintext SUM queries require access to and analysis of the original data, while encrypted databases can perform SUM queries on encrypted data while protecting data privacy. This technology enables data analysis and statistical calculations without disclosing sensitive information.

[0006] A simple approach is to decrypt the encrypted data on the client side before performing the calculation. However, this method incurs significant communication and computational overhead when performing a large number of SUM queries, as frequent data transmission and decryption operations result in additional time and resource consumption.

[0007] First, because encrypted data needs to be transmitted from the server to the client for decryption, a significant amount of data transmission overhead occurs. For large datasets, especially in distributed environments, data transmission can involve substantial network communication and bandwidth consumption.

[0008] Secondly, the decryption operation itself is computationally intensive, requiring significant computing resources. When performing numerous SUM queries, the client needs to repeatedly execute decryption and calculation operations, leading to additional computational overhead. A potential problem with this approach is the risk of data leakage. When data is decrypted on the client side, there is a potential security risk, as the client may be vulnerable to various threats and attacks, resulting in the exposure of sensitive data.

[0009] To address these issues, many scholars have proposed numerous dense database techniques that support SUM queries.

[0010] A common approach is homomorphic encryption. Homomorphic encryption is a special encryption technique that allows addition and multiplication operations to be performed within the ciphertext domain, with the results equivalent to the corresponding operations performed within the plaintext domain. By using homomorphic encryption, encrypted data can be summed without decryption.

[0011] For example, CryptDB uses a representative scheme, the Paillier encryption algorithm, for SUM queries. In this scheme, the data is encrypted into ciphertext, and then a summation operation is performed using homomorphic encryption to obtain the final result.

[0012] Some encrypted database solutions utilize Trusted Execution Environments (TEEs), allowing data to be decrypted and SUM calculated internally before being returned to the client. However, using TEEs increases disk I / O, thus reducing overall performance. Furthermore, the most common TEEs, such as Intel Software Guard Extensions (SGX), suffer from issues like insufficient secure memory and lack of protected access modes, making SUM queries both unsafe and inefficient.

[0013] Other solutions, like ObliDB, have designed some forget operators to protect access patterns when querying data, but this can significantly reduce the performance of queries such as SUM.

[0014] In summary, these schemes and methods rely on specific encryption technologies and protocols, as well as the support of database systems, making it possible to perform computations on encrypted data on the server side, thus avoiding the overhead of data transmission and client-side computation. Simultaneously, these methods can protect data privacy, ensuring that sensitive data is not leaked during decryption. However, these schemes also face some challenges and problems when frequently performing statistical queries such as SUM. One of these is performance issues; performing calculations on encrypted data introduces additional computational overhead, leading to a decrease in query speed. Furthermore, encrypted databases also face the problem of ciphertext bloat; encrypted data typically becomes quite large, increasing storage and transmission costs. In addition, due to the uninterpretable nature of ciphertext data, complex statistical queries may require additional computation and optimization techniques to maintain the accuracy and efficiency of query results. Therefore, encrypted databases need to strike a balance between privacy protection and performance when frequently performing statistical queries. Developing new algorithms and technologies to improve the query efficiency of encrypted databases to meet the statistical needs of large-scale datasets in the real world is a key area of ​​research. Summary of the Invention

[0015] Existing encrypted database solutions that support statistical queries rely on specific encryption technologies and protocols, especially homomorphic encryption algorithms, which enable SUM queries on encrypted data at the server side. However, these solutions have excessively high time complexity and are extremely inefficient when performing frequent SUM queries.

[0016] This SUM query method can be extended to other SQL queries, such as other statistical queries and range queries, to achieve more complex queries. It plays a unique role in securing cloud databases, small and medium-sized databases, and private databases, and is suitable for various data scenarios. It effectively defends against internal and external data security threats, addresses compliance challenges, and maintains information security.

[0017] To address this, this invention presents a highly efficient dense-state database SUM query method based on a B+ tree index structure. This method is plug-and-play in relational databases such as MySQL and openGauss, and can be extended with any secure query scheme based on SUM to achieve complex statistical queries.

[0018] To achieve the above objectives, the present invention provides the following technical solution:

[0019] The efficient dense database SUM query method based on B+ tree index structure includes the following steps: In a data model where a database contains n SUM-related index data, a B+ tree index structure is built for the data to be queried for SUM; where a node of the B+ tree is an IndexNode, each leaf node stores index key-value pairs (key, value), and each non-leaf node contains a value sum in addition to the original index key of the B+ tree, which is used to store the sum or value of all its lower-level child nodes; the key stored in the B+ tree is E(k) sent by the client to the server, and the value is HE(v) sent by the client to the server, where E(x) is the symmetric encryption scheme used by the client.

[0020] In a further optimization of this technical solution, when inserting data into the B+ tree, the input root is the root node of the B+ tree, E(k) is the index key value transmitted by the client after AES encryption, and HE(v) is the value to be inserted into the leaf node after homomorphic encryption.

[0021] First, the algorithm checks if root is empty. If it is empty, it directly calls the Insert_kv function to insert the index key-value pair (E(k), HE(v)) into root. HE(v) is the current sum value.

[0022] If it is not empty, the Insert function is called. The Insert function first checks whether the currently inserted node is a leaf node.

[0023] If node is a leaf node, directly call the Insert_kv function to insert the index key-value pair (E(k), HE(v)) into node;

[0024] If node is not a leaf node, HE(v) is added to the sum value node.sum of this node. Then, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted and compared to obtain which child node the child node to be inserted is.

[0025] Next, the insertion operation function is called recursively to insert the key-value pair (E(k), HE(v)) into the child node child_node and update the sum value of all non-leaf nodes node.

[0026] This technical solution is further optimized in that if the current node overflows, that is, the number of key-value pairs in the node exceeds the node's capacity limit, the Split function needs to be called to split the node.

[0027] In a further optimization of this technical solution, when updating the index data of the B+ tree, the input is the root node, the index key E(k) of the node being updated, and the new value HE(newv).

[0028] First, the algorithm locates the leaf node storing the target key E(k) by calling the search function Search and assigns it to the variable target;

[0029] Next, the difference between the new value HE(newv) and the value target.value stored in the target node is calculated to obtain the result diff;

[0030] Then, HE(newv) is stored in the value target.value in target, and the update operation function Update is called to update the sum attribute of other related nodes;

[0031] In the Update function, first check if the current node is a leaf node;

[0032] If it is a leaf node, return directly, because leaf nodes have no child nodes and the sum value needs to be updated; if the node is not a leaf node, update the node's sum property and add diff to the node's sum value node.sum.

[0033] Subsequently, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted, and compared to determine which child node the child_node to be inserted is.

[0034] Finally, the `Update` function is recursively called to update the `sum` attribute of the child node `child_node` and its child nodes.

[0035] In a further optimization of this technical solution, when deleting index data in the B+ tree, the input is the root node and the index key E(k) of the node to be deleted.

[0036] First, the algorithm also locates the leaf node storing the target key E(k) by calling the search function Search and assigns it to the variable target;

[0037] Next, the value target.value in the target node is assigned to the variable value.

[0038] Then, the delete node operation function Delete is called to delete the target. If the target node underflows after deleting the node, that is, the number of key-value pairs in the node is lower than the minimum requirement, the redistribute or merge operation function Redistribute_or_Merge is called to adjust the distribution of the nodes.

[0039] Finally, the delete operation function Delete is called to complete the recursive deletion process. In the Delete function, the current node is first checked to see if it is a leaf node.

[0040] If it is a leaf node, return directly; if the node is not a leaf node, subtract the value from the node's sum value node.sum to maintain the sum of the values ​​of the child nodes stored in the node.

[0041] Subsequently, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted, and compared to determine which child node the child_node to be inserted is.

[0042] Finally, the function Delete is recursively called to delete the index keys in the child node child_node and adjust the key-value distribution and sum value in the child node;

[0043] Similarly, if an underflow occurs after a node deletes its child nodes, a reallocation or merging operation is required to ensure the balance of the B+ tree.

[0044] Unlike existing technologies, the above technical solution has the following advantages: The B+ tree used in this method to build the index is a commonly used index structure that can guarantee high accuracy, as well as the order and integrity of the data. This invention adds a storage function `sum` to each non-leaf node of the B+ tree to store the sum of the encrypted values ​​of the lower-level nodes, and can update the `sum` value of the upper-level nodes during insertion, modification, and deletion. This facilitates operations such as range and overall SUM queries. Furthermore, this method does not require each node to store a homomorphically encrypted sum, thus saving storage space and computational overhead.

[0045] Specifically, the value stored in the index node is a homomorphically encrypted value from the client. Leveraging the property that homomorphic encryption preserves the ability to perform addition operations, the ciphertext values ​​of lower-level child nodes can be directly added together to obtain the ciphertext sum, which is then stored in the `sum` value of the parent node. This is crucial for sensitive data and privacy protection, preventing unauthorized access and data leakage. Therefore, when querying the aggregated result of all data, the homomorphically encrypted `sum` value stored in the root node can be directly returned to obtain the homomorphically encrypted sum of all records. This value is then returned to the client, which can obtain the plaintext result through homomorphic decryption.

[0046] Therefore, the time complexity of the query can reach O(1). Compared with the traditional approach of traversing the entire data table or the entire tree and then summing, directly obtaining the sum value greatly improves query performance, especially for large-scale databases and frequent complex queries.

[0047] Meanwhile, the server no longer needs to load all the relevant data into the client for decryption and summation, which greatly reduces the amount of decryption and communication interaction and improves the overall query efficiency. Attached Figure Description

[0048] Figure 1 This is a diagram of a B+ tree index structure;

[0049] Figure 2 This is a flowchart of inserting index data;

[0050] Figure 3 This is a flowchart of updating index data;

[0051] Figure 4 This is a flowchart of deleting index data;

[0052] Figure 5 This is a flowchart for obtaining the final SUM query result. Detailed Implementation

[0053] To explain in detail the technical content, structural features, objectives, and effects of the technical solution, the following description is provided in conjunction with specific embodiments and accompanying drawings.

[0054] See Figure 1 The diagram shown is a diagram of the designed B+ tree index structure, which includes the following: In a data model where a database contains n SUM-related index data, the solution is to build a B+ tree index structure for the data used in SUM queries.

[0055] In a B+ tree, a node is called an IndexNode. Each leaf node stores index key-value pairs (key, value). In addition to the original index key of the B+ tree, each non-leaf node contains an additional value, sum, which is used to store the sum or value of all its lower-level child nodes.

[0056] By storing the sum of the child nodes in each non-leaf node, the data index and value of the entire tree can be directly obtained from the root node, achieving a query time complexity of O(1). For large-scale databases and frequent complex queries, compared to the traditional approach of traversing the entire data table or the entire tree and then summing, directly obtaining the sum value greatly improves query performance and enriches statistical query functionality.

[0057] The B+ tree stores the key as E(k) sent by the client to the server, and the value as HE(v) sent by the client to the server. Here, E(x) represents the symmetric encryption scheme used by the client.

[0058] To provide a higher level of security, the encryption scheme should offer indistinguishability under selected plaintext attacks (IND-CPA), such as the CBC or GCM modes of the AES encryption scheme. HE(x) is the homomorphic encryption scheme used by the client, such as the relatively efficient Paillier scheme.

[0059] The algorithm designed in this invention mainly consists of four parts: inserting data, updating data, deleting data, and obtaining the SUM result. These will be described in detail below with reference to the pseudocode shown in the diagram. It should be noted that this algorithm simplifies other update and splitting processes of the B+ tree nodes, only listing the important sum update code. For example, in the Split function, if a new parent node is split off, this node will not only update its index value `key`, but its sum value will also be assigned the sum of the sum values ​​of all its child nodes.

[0060] Refer to the algorithm for inserting index data in the scheme design. Figure 2 As shown. When inserting, the input root is the root node of the B+ tree, E(k) is the index key value sent by the client after AES encryption, and HE(v) is the value to be inserted into the leaf node after homomorphic encryption.

[0061] First, the algorithm checks if root is empty. If it is empty, it directly calls the Insert_kv function to insert the index key-value pair (E(k), HE(v)) into root, where HE(v) is the current sum value.

[0062] If it is not empty, the Insert function is called. The Insert function first checks whether the node to be inserted is a leaf node.

[0063] If it is a leaf node, directly call the Insert_kv function to insert the index key-value pair (E(k), HE(v)) into the node.

[0064] If node is not a leaf node, HE(v) is added to the sum value node.sum of this node. Then, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted, and compared to determine which child node is the one to be inserted.

[0065] Next, the insertion operation function is called recursively to insert the key-value pair (E(k), HE(v)) into the child node child_node and update the sum value of all non-leaf nodes node.

[0066] In the function, if the current node overflows (i.e., the number of key-value pairs in the node exceeds the node's capacity limit), the Split function needs to be called to split the node.

[0067] The algorithm for updating index data in the proposed solution is described in the reference section. Figure 3 As shown. When performing an update, the input is the root node (root), the index key E(k) of the node to be updated, and the new value HE(newv).

[0068] First, the algorithm locates the leaf node storing the target key E(k) by calling the search function Search and assigns it to the variable target.

[0069] Next, the difference between the new value HE(newv) and the value target.value stored in the target node is calculated to obtain the result diff.

[0070] Then, HE(newv) is stored in the value target.value in target. Then, the update operation function Update is called to update the sum attribute of other related nodes.

[0071] In the Update function, the first step is to check whether the current node is a leaf node.

[0072] If it is a leaf node, return directly, because leaf nodes do not have child nodes and the sum value needs to be updated.

[0073] If the node is not a leaf node, update the node's sum property and add diff to the node's sum value node.sum.

[0074] Subsequently, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted, and compared to determine which child node the child_node to be inserted is.

[0075] Finally, the `Update` function is recursively called to update the `sum` attribute of the child node `child_node` and its child nodes.

[0076] The algorithm for deleting index data in the proposed solution is described in the following reference. Figure 4 As shown. When deleting, the input is the root node (root) and the index key E(k) of the node to be deleted.

[0077] First, the algorithm also locates the leaf node storing the target key E(k) by calling the search function Search and assigns it to the variable target.

[0078] Next, the value target.value in the target node is assigned to the variable value.

[0079] Then, the `Delete` function is called to delete the target node. If the target node underflows after deletion (i.e., the number of key-value pairs in the node falls below the minimum requirement), the `Redistribute_or_Merge` function is called to adjust the distribution of nodes.

[0080] Finally, the delete function is called to complete the recursive deletion process. In the delete function, it first checks whether the current node is a leaf node.

[0081] If it is a leaf node, return directly.

[0082] If the node is not a leaf node, the value is subtracted from the node's sum value node.sum to maintain the sum of the values ​​of the child nodes stored in the node.

[0083] Subsequently, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted, and compared to determine which child node the child_node to be inserted is.

[0084] Finally, the function Delete is recursively called to delete the index keys in the child node child_node and adjust the key-value distribution and sum value in the child node.

[0085] Similarly, if an underflow occurs after a node deletes its child nodes, a reallocation or merging operation is required to ensure the balance of the B+ tree.

[0086] The algorithm for obtaining the final SUM query result is described in the solution. Figure 5 As shown, the server directly obtains the sum value stored in the root node of the B+ tree, root.sum, which is the encrypted result of summing all the data.

[0087] The server can then send the encrypted result to the client, which can then decrypt it using the key of the homomorphic encryption scheme HE(x) to obtain the final plaintext sum result. The query is highly efficient and convenient.

[0088] Furthermore, this algorithm is not limited to calculating the sum of all data; it can also be combined with the range constraints of index E(k) to perform SUM queries on a portion of the data, thus satisfying more complex queries for all dense databases.

[0089] This invention designs and implements a high-efficiency SUM query scheme for encrypted databases based on B+ trees. The scheme primarily establishes a B+ tree index structure on the server, adding an extra value to each non-leaf node of the B+ tree to store the sum of all encrypted child nodes under that node. When inserting or deleting data, starting from the leaf node, the sum value of each non-leaf node is updated along the path. Thus, when performing a SUM query, the sum value stored in the root node can be directly returned, decrypted, and used as the query result, with a query time complexity of only O(1). Simultaneously, the invention uses an efficient homomorphic encryption scheme, enabling direct summation calculation on the server side without additional communication with the client, thus reducing the storage and computational burden on the client. Furthermore, this invention offers high flexibility, supporting other complex statistical queries and is applicable to various encrypted outsourced relational databases, effectively protecting the data security and privacy of industries using the database. Compared with other advanced SUM solutions, this invention has superior query performance and richer query functions. In future development, this invention can be applied to scenarios such as frequent statistical queries, effectively resisting data security threats from internal and external sources, addressing compliance challenges, and maintaining information security while ensuring high efficiency.

[0090] The algorithm of this invention is as follows: When performing a SUM query, the server needs to perform insertion, update, and deletion operations on the data sent by the client after encryption in the B+ tree, and finally obtain the final query result by calling the algorithm to obtain the SUM result.

[0091] For example, when executing a simple SUM query, the normal SQL statement would look like this:

[0092] SELECT SUM(c1) FROM T1;

[0093] This statement indicates that all data in field c1 in table T1 can be retrieved using the algorithm of this invention.

[0094] The four algorithm operations performed on the server side are as follows:

[0095] Insert(E(k),HE(v)): Inserts new index data.

[0096] Update(E(k),HE(newv)): Updates the data value of node E(k) to the new value HE(newv).

[0097] Delete(E(k)): Deletes the data with key value E(k).

[0098] GetSum(): Gets the final sum result value.

[0099] An efficient SUM query method for dense databases based on B+ trees is proposed. This method establishes a B+ tree index structure on the server, stores the corresponding sum values, and combines it with an efficient homomorphic encryption scheme. The summation can be performed directly on the server side, and the final SUM query returns the sum stored in the root node, which is then decrypted as the query result. The overall SUM query time complexity reaches O(1), which is more efficient and offers richer query functionality compared to other dense database SUM query schemes. Furthermore, the scheme eliminates the need for additional communication between the server and the client, reducing the storage and computational burden on the client. This method offers high flexibility, supports other complex statistical queries, and is applicable to various encrypted outsourced relational databases, effectively protecting the data security and privacy of industries using the database.

[0100] The server adds an extra `sum` value to each non-leaf node of the B+ tree index built for the corresponding indexed field in the database. This `sum` value stores the sum of all encrypted child nodes under that node. The B+ tree is a commonly used index structure that guarantees high accuracy, as well as data order and integrity. When inserting or deleting data in the B+ tree, the solution starts from the leaf node and updates the sum of each non-leaf node along the path. The root node of the B+ tree stores the encrypted sum of all data, allowing the final result to be directly obtained during a SUM query.

[0101] Using efficient homomorphic encryption schemes to store ciphertext allows for the calculation of sums without exposing plaintext data. This is crucial for sensitive data and privacy protection, preventing unauthorized access and data leaks. Furthermore, data and values ​​can be updated directly on the server, eliminating the need to load the relevant data onto the client for decryption and summation, significantly reducing decryption and communication interactions and improving overall query efficiency.

[0102] It can not only perform SUM queries to sum all data, but also combine index range constraints to perform partial data summation queries. This flexibility makes the solution suitable for more complex query needs and can meet the requirements of different application scenarios. It can also be flexibly applied to query scenarios of various dense databases such as MySQL and OpenGauss.

[0103] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Unless otherwise specified, an element defined by the phrase "comprising..." or "including..." does not exclude the presence of additional elements in the process, method, article, or terminal device that includes said element. Additionally, in this document, "greater than," "less than," "exceeding," etc., are understood to exclude the stated number; "above," "below," "within," etc., are understood to include the stated number.

[0104] Although the above embodiments have been described, those skilled in the art, once they understand the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the above descriptions are merely embodiments of the present invention and do not limit the scope of patent protection of the present invention. Any equivalent structural or procedural transformations made using the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A highly efficient dense-state database SUM query method based on B+ tree index structure, characterized in that, Includes the following steps: In a data model where a database contains n SUM-related indexes, a B+ tree index structure is built for the data used in SUM queries. Each node in the B+ tree is an IndexNode. Each leaf node stores index key-value pairs (key, value). Each non-leaf node, in addition to the original index key, also contains a new value, sum, which stores the sum or value of all its child nodes. The key stored in the B+ tree is E(k) sent by the client to the server, and the value is HE(v) sent by the client to the server, where E() represents the symmetric encryption scheme used by the client. When inserting data into the B+ tree, the input root is the root node of the B+ tree, E(k) is the index key value transmitted by the client after AES encryption, and HE(v) is the value to be inserted into the leaf node after homomorphic encryption. First, the algorithm checks if root is empty. If it is empty, it directly calls the Insert_kv function to insert the index key-value pair (E(k), HE(v)) into root, where HE(v) is the current sum value. If it is not empty, the Insert function is called. The Insert function first checks whether the currently inserted node is a leaf node. If node is a leaf node, directly call the Insert_kv function to insert the index key-value pair (E(k), HE(v)) into node; If node is not a leaf node, HE(v) is added to the sum value node.sum of this node. Then, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted and compared to obtain which child node the child_node to be inserted is. Next, the insertion operation function is called recursively to insert the key-value pair (E(k), HE(v)) into the child node child_node and update the sum value of all non-leaf nodes node.

2. The efficient dense-state database SUM query method based on B+ tree index structure as described in claim 1, characterized in that, In the operation function, if the current node overflows, that is, the number of key-value pairs in the node exceeds the node's capacity limit, the Split function needs to be called to split the node.

3. The efficient dense-state database SUM query method based on B+ tree index structure as described in claim 1, characterized in that, When updating the index data of the B+ tree, the input is the root node, the index key E(k) of the node to be updated, and the new value HE(newv). First, the algorithm locates the leaf node storing the target key E(k) by calling the search function Search and assigns it to the variable target; Next, the difference between the new value HE(newv) and the value target.value stored in the target node is calculated to obtain the result diff; Then, HE(newv) is stored in the value target.value in target, and the update operation function Update is called to update the sum attribute of other related nodes; In the Update function, first check if the current node is a leaf node; If it is a leaf node, return directly, because leaf nodes have no child nodes and the sum value needs to be updated; If node is not a leaf node, update the node's sum property and add diff to the node's sum value node.sum; Subsequently, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted, and compared to determine which child node the child_node to be inserted is. Finally, the Update function is recursively called to update the sum attribute of the child node and its subordinate nodes.

4. The efficient dense-state database SUM query method based on B+ tree index structure as described in claim 1, characterized in that, When deleting index data in the B+ tree, the input is the root node and the index key E(k) of the node to be deleted; First, the algorithm also locates the leaf node storing the target key E(k) by calling the search function Search and assigns it to the variable target; Next, the value target.value in the target node is assigned to the variable value; Then, the delete node operation function Delete is called to delete the target. If the target node underflows after deleting the node, that is, the number of key-value pairs in the node is lower than the minimum requirement, the redistribute or merge operation function Redistribute_or_Merge is called to adjust the distribution of the nodes. Finally, the delete operation function Delete is called to complete the recursive deletion process. In the Delete function, the current node is first checked to see if it is a leaf node. If it is a leaf node, return directly; If node is not a leaf node, the value is subtracted from the node's sum value node.sum to maintain the sum of the values ​​of the child nodes stored in the node; Subsequently, the target key E(k) and the encrypted key stored in the current node need to be loaded into the client, decrypted, and compared to determine which child node the child_node to be inserted is. Finally, the function Delete is recursively called to delete the index keys in the child node child_node and adjust the key-value distribution and sum value in the child node; Similarly, if an underflow occurs after a node deletes its child nodes, a reallocation or merging operation is required to ensure the balance of the B+ tree.

Citation Information

Patent Citations

  • Ciphertext retrieval method based on homomorphic encryption in cloud storage

    CN108011713A

  • Method for realizing security range query based on software and hardware combination mode

    CN111797097A