Verifiable aggregation query method and system for database

By building an index tree in the database and generating verifiable boundary elements, combined with zero-knowledge proof, the problems of privacy leakage and security risks in database queries are solved, and effective verification and efficient query verification of complex aggregation queries are achieved.

CN120045575APending Publication Date: 2025-05-27SHANGHAI JIAOTONG UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311583028.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-24
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The prior art has problems in database queries with privacy leakage risks, security risks, and the inability to effectively verify complex aggregation queries.

Method used

By building an index tree for verifiable aggregate queries, verifiable boundary elements are generated, and combined with zero-knowledge proofs, verifying the correctness of boundary elements and aggregate query values, ensuring that private data does not leave the data owner.

Benefits of technology

It realizes privacy protection and security of private data, ensures the correctness of verification of complex aggregation queries, and improves query verification efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045575A_ABST
    Figure CN120045575A_ABST
Patent Text Reader

Abstract

The invention provides a verifiable aggregate query method and system for a database, and the method comprises the steps: constructing an index tree for verifiable aggregate query, generating verifiable boundary elements according to an aggregate query range interval, and enabling the boundary elements to comprise an upper inner neighbor boundary element, an upper outer neighbor boundary element, a lower inner neighbor boundary element and a lower outer neighbor boundary element, and verifying the aggregate query value through the elements of the upper inner neighbor boundary element and the lower inner neighbor boundary element in the index tree query path. According to the method, the aggregated query is verified by generating the verifiable boundary element, and then the verification is combined with the zero-knowledge proof, so that private data is ensured not to leave a data owner all the time, the privacy of a user is ensured, and malicious data counterfeiting is prevented. And the fixed number of boundary elements are suitable for the variable query range and can also adapt to the large-scale data volume in the database, so that the query verification efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database query, and particularly relates to a database verifiable aggregation query method; in addition, the present invention also relates to a database verifiable aggregation query system. Background Art

[0002] With the wide application of devices such as mobile phones, smart cars, and the Internet of Things, a large amount of data such as location information, movement data, and device usage records are generated and stored. The query and statistical analysis of this data are crucial for many applications and services. For example, determining insurance premiums of different amounts based on vehicle usage records, driving speeds, or violation records; discovering early close contacts of the virus based on whether the user's location information has a spatio-temporal intersection with that of COVID-19 confirmed patients. However, this data often contains privacy information such as the user's address and workplace, and privacy protection is required. At the same time, it is necessary to ensure that the data provided by the user has not been tampered with during the query and processing.

[0003] Previous solutions usually adopt the method of centralized processing by a trusted third party or database after data collection. Privacy protection is carried out through methods such as differential privacy, K-anonymity, TEE, and encrypted search. As Figure 1 shown, in the prior art, the noise-desensitized data is stored in the database for record and data statistics. And the hash values of the desensitized data and the original data are uploaded to the blockchain to ensure the verifiability of the data.

[0004] However, the prior art needs to upload sensitive material data to a trusted data platform for desensitization processing, and when verifying the proof materials, the original materials need to be provided to the verification platform. In this process, there is still a risk of privacy leakage. At the same time, the desensitized materials are centrally stored in the database, posing a certain security risk. In terms of query verification, the solution only judges the correctness of the materials by calculating that the hash value of the desensitized data is equal to the hash value of the desensitized data obtained from the blockchain. This method is only applicable to the full-text query and verification of desensitized materials, and cannot be applied to more complex queries. And it cannot be extended to some aggregation queries on sensitive data.

[0005] In addition, in the prior art, nodes and fields of different scales are selected to form a verifiable object according to the scope size of the query request. However, since the volume of the verifiable object is not fixed, it is difficult to be applicable to a zero-knowledge proof system that requires fixed input, and it is impossible to achieve both query verifiability and high-reliability privacy protection at the same time. Summary of the Invention

[0006] To solve the problems existing in the prior art, at least one embodiment of the present invention provides a database verifiable aggregation query method, which verifies the aggregation query by generating verifiable boundary elements, thereby ensuring that private data never leaves the data owner, protecting the privacy of users, and preventing malicious data forgery. For this reason, at least one embodiment of the present invention also provides a database verifiable aggregation query system.

[0007] In a first aspect, an embodiment of the present invention proposes a database verifiable aggregation query method, the method comprising:

[0008] Construct an index tree for verifiable aggregation query, where the nodes of the index tree store aggregation values and hash values corresponding to the child nodes of the node;

[0009] Generate verifiable boundary elements according to the aggregation query range interval, the boundary elements include upper inner neighbor boundary elements, upper outer neighbor boundary elements, lower inner neighbor boundary elements, and lower outer neighbor boundary elements, the upper inner neighbor boundary elements and the upper outer neighbor boundary elements are continuous with each other, and the lower inner neighbor boundary elements and the lower outer neighbor boundary elements are continuous with each other;

[0010] The key value of the upper inner neighbor boundary element is greater than or equal to the upper query interval value, the key value of the upper outer neighbor boundary element is less than the upper query interval value, the key value of the lower inner neighbor boundary element is less than or equal to the lower query interval value, and the key value of the lower outer neighbor boundary element is greater than the lower query interval value;

[0011] Verify the correctness of the boundary elements through the elements of the nodes in the query path of the index tree by the boundary elements;

[0012] Verify the aggregation query value through the elements of the upper inner neighbor boundary element and the lower inner neighbor boundary element in the query path of the index tree.

[0013] In some embodiments, for a database verifiable aggregation query method provided by the present invention, the nodes of the index tree also store the prefix encoding of each element in the node and the element quantity value.

[0014] In some embodiments, for a database verifiable aggregation query method provided by the present invention, verifying the correctness of the boundary elements includes:

[0015] Verify that the upper inner neighbor boundary element and the upper outer neighbor boundary element are continuous with each other through the prefix encoding, and verify that the lower inner neighbor boundary element and the lower outer neighbor boundary element are continuous with each other through the prefix encoding.

[0016] In some embodiments, for a database verifiable aggregation query method provided by the present invention, verifying the correctness of the boundary elements includes:

[0017] Hash calculations are performed on the aggregate values, hash values, and element quantity values of the elements of each node in the index tree query path for the boundary elements to obtain the hash verification values for each layer of nodes in the index tree query path, and the hash values of each layer of nodes in the index tree query path are verified through the hash verification values.

[0018] In some embodiments, for a database verifiable aggregation query method provided by the present invention, verifying the correctness of boundary elements includes:

[0019] Verifying the aggregate values of each layer of nodes in the index tree query path.

[0020] In some embodiments, for a database verifiable aggregation query method provided by the present invention, verifying the aggregation query value includes:

[0021] Subtract the aggregate values of all elements in the nodes before the query path of the upper inner near neighbor boundary element from the total aggregate value of the root node of the index tree, and at the same time subtract the aggregate values of all elements in the nodes after the query path of the lower inner near neighbor boundary element.

[0022] In some embodiments, for a database verifiable aggregation query method provided by the present invention, the method includes:

[0023] The data owner creates a verifiable query index for the private data in the database through the index tree, and sends the hash value and height value of the root node of the index tree to the result collector;

[0024] Initialize the verifier of the result collector and the prover of the data owner;

[0025] The user sends an aggregation query request to the result collector, and the result collector sends the query parameters to the data owner;

[0026] The data owner calls the verifiable query index to complete the aggregation query, generates corresponding boundary elements, and calls the prover to prove the boundary elements;

[0027] The result collector calls the verifier to verify the evidence generated by the prover.

[0028] In some embodiments, for a database verifiable aggregation query method provided by the present invention, initializing the verifier of the result collector and the prover of the data owner includes:

[0029] The result collector receives the hash value and height value of the index tree, generates zero-knowledge proof instructions, and initializes the verifier;

[0030] The verifier returns the generated public parameters and the verification secret key for verifying the evidence;

[0031] The result collector sends the public parameters and the proof code to the data owner;

[0032] The data owner calls the prover to perform initialization settings based on the proof instructions and the public parameters.

[0033] In a second aspect, an embodiment of the present invention further provides a database verifiable aggregation query system, including:

[0034] A construction module, configured to construct an index tree for verifiable aggregation query, where the nodes of the index tree store the aggregation values and hash values corresponding to the child nodes of the node;

[0035] A generation module, configured to generate verifiable boundary elements according to the aggregation query range interval, where the boundary elements include an upper inner near neighbor boundary element, at least one upper outer near neighbor boundary element, a lower inner near neighbor boundary element, and at least one lower outer near neighbor boundary element. The upper inner near neighbor boundary element and the upper outer near neighbor boundary element are continuous with each other, and the lower inner near neighbor boundary element and the lower outer near neighbor boundary element are continuous with each other; the key value of the upper inner near neighbor boundary element is greater than or equal to the upper query interval value, the key value of the upper outer near neighbor boundary element is less than the upper query interval value, the key value of the lower inner near neighbor boundary element is less than or equal to the lower query interval value, and the key value of the lower outer near neighbor boundary element is greater than the lower query interval value;

[0036] A correctness verification module, configured to verify the correctness of the boundary elements through the elements of the nodes in the query path of the index tree by the boundary elements;

[0037] An aggregation query value verification module, configured to verify the aggregation query value through the elements of the upper inner near neighbor boundary element and the lower inner near neighbor boundary element in the query path of the index tree.

[0038] In some embodiments, for a database verifiable aggregation query system provided by the present invention, the nodes of the index tree further store the prefix codes of the elements in the node and the element quantity values.

[0039] In some embodiments, for a database verifiable aggregation query system provided by the present invention, the correctness verification module includes:

[0040] A continuity verification module, which verifies that the upper inner near neighbor boundary element and the upper outer near neighbor boundary element are continuous with each other through the prefix code, and verifies that the lower inner near neighbor boundary element and the lower outer near neighbor boundary element are continuous with each other through the prefix code.

[0041] In some embodiments, for a database verifiable aggregation query system provided by the present invention, the correctness verification module includes:

[0042] The hash value verification module is used to perform hash calculations on the aggregated value, hash value, and element quantity value of each element of the nodes in the index tree query path of the boundary elements, obtain the hash verification values of each layer of nodes in the index tree query path, and verify the hash values of each layer of nodes in the index tree query path through the hash verification values.

[0043] In some embodiments, for a database verifiable aggregation query system provided by the present invention, the correctness verification module includes:

[0044] The aggregated value verification module is used to verify the aggregated values of each layer of nodes in the index tree query path.

[0045] In some embodiments, for a database verifiable aggregation query system provided by the present invention, the aggregated query value verification module includes:

[0046] The aggregated value calculation module is used to subtract the aggregated values of all elements in each node before the query path of the upper inner neighbor boundary element from the total aggregated value of the root node of the index tree, and at the same time subtract the aggregated values of all elements in each node after the query path of the lower inner neighbor boundary element.

[0047] In some embodiments, a database verifiable aggregation query system provided by the present invention further includes:

[0048] The communication module is used to transfer the data information between the result collector and the data owner;

[0049] The initialization setting module is used to perform initialization settings on the verifier of the result collector and the prover of the data owner;

[0050] The query module is used for the user to send an aggregation query request to the result collector, and the result collector sends the query parameters to the data owner.

[0051] In a third aspect, an embodiment of the present invention further provides a database verifiable aggregation query device, including at least one processor; a memory coupled to the at least one processor, where the memory stores executable instructions, and the executable instructions, when executed by the at least one processor, cause the steps of any method in the first aspect above to be implemented.

[0052] In a fourth aspect, an embodiment of the present invention further provides a chip for executing the steps of the method in the first aspect above. Specifically, the chip includes: a processor for calling and running a computer program from a memory, so that a device equipped with the chip is used to execute the steps of the method in the first aspect above.

[0053] Fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the methods in the first aspect above are implemented.

[0054] It can be seen that a database verifiable aggregation query method and system according to an embodiment of the present invention verify an aggregation query by generating verifiable boundary elements, and then combine with zero-knowledge proof, thereby ensuring that private data never leaves the data owner, protecting the privacy of users, and preventing malicious data forgery at the same time. The fixed number of boundary elements is suitable for the changing query range, and can also adapt to the large amount of data in the database, improving the query verification efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0056] Figure 1 Shown as a flow chart of privacy data query and verification in the prior art;

[0057] Figure 2 Shown as a flow chart of a database verifiable aggregation query method in an embodiment of the present invention;

[0058] Figure 3 Shown as a schematic diagram of a node of an index tree in an embodiment of the present invention;

[0059] Figure 4 Shown as a schematic structural diagram of an index tree in an embodiment of the present invention;

[0060] Figure 5 Shown as a flow chart of the initialization of a prover and a verifier in an embodiment of the present invention;

[0061] Figure 6 Shown as a flow chart of a verifiable query in an embodiment of the present invention;

[0062] Figure 7 Shown as a schematic framework diagram of a database verifiable aggregation query system in an embodiment of the present invention;

[0063] Figure 8 Shown as a model diagram of a database verifiable aggregation query system in an embodiment of the present invention. DETAILED IMPLEMENTATION

[0064] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0065] It should be noted that in this text, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or sequence between these entities or operations. In this text, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0066]

Embodiment 1

[0067] The inventors of this solution found that in the prior art, the prior art needs to upload sensitive material data to a trusted data platform for desensitization processing, and when verifying the proof materials, the original materials need to be provided to the verification platform. In this process, there is still a risk of privacy leakage. At the same time, the desensitized materials are centrally stored in the database, presenting certain security risks. In terms of query verification, the solution only judges the correctness of the materials by calculating that the hash value of the desensitized data is equal to the hash value of the desensitized data obtained from the blockchain. This method is only applicable to the full-text query and verification of desensitized materials, and cannot be applied to more complex queries. Moreover, it cannot be extended to some aggregation queries on sensitive data. In addition, the prior art is difficult to be applicable to a zero-knowledge proof system that requires fixed input, and it is impossible to achieve verifiable and highly reliable privacy protection. Embodiment 1 of the present invention provides the following solution:

[0068] As Figure 2 shown, this embodiment provides a database verifiable aggregation query method, and the method includes:

[0069] Construct an index tree for verifiable aggregation query. The nodes of the index tree store the aggregation value and hash value corresponding to the child nodes of the node, and also store the prefix encoding of each element in the node and the element quantity value.

[0070] Generate verifiable boundary elements according to the aggregation query range interval. The boundary elements include upper inner neighbor boundary elements, upper outer neighbor boundary elements, lower inner neighbor boundary elements, and lower outer neighbor boundary elements. The upper inner neighbor boundary elements and the upper outer neighbor boundary elements are continuous with each other, and the lower inner neighbor boundary elements and the lower outer neighbor boundary elements are continuous with each other.

[0071] The key value of the upper inner neighbor boundary element is greater than or equal to the upper query interval value, the key value of the upper outer neighbor boundary element is less than the upper query interval value, the key value of the lower inner neighbor boundary element is less than or equal to the lower query interval value, and the key value of the lower outer neighbor boundary element is greater than the lower query interval value;

[0072] Verify the correctness of the boundary elements through the elements of the nodes in the index tree query path of the boundary elements.

[0073] Verify the aggregation query value through the elements of the upper inner neighbor boundary element and the lower inner neighbor boundary element in the index tree query path.

[0074] It should be noted that the aggregation query includes range maximum value query, range minimum value query, range sum value query, range average value query, range count query, etc. One or more upper outer neighbor boundary elements can be used, and one or more lower outer neighbor boundary elements can be used. For the sake of reducing the calculation amount, it is preferred to use one for both. The prefix coding is implicit in the label of the index element, which identifies the position information of the element among all the elements of the node.

[0075] Such as Figure 3 shown, in the intermediate node of the index tree, in addition to the key value k i and the child node pointer c i , the hash verification value h i , the aggregation value a i and the number of entries n included in the node are also stored. Perform hash calculation on the aggregation value, hash value, and element quantity value of each element of the nodes in the index tree query path of the boundary elements, that is, concatenate the above aggregation value, hash value, and element quantity value in sequence and then perform hash calculation to obtain the hash verification value of each layer of nodes in the index tree query path, and verify the hash value of each layer of nodes in the index tree query path through the hash verification value.

[0076] Specifically, when verifying the correctness of the boundary elements, verify that the upper inner neighbor boundary elements and the upper outer neighbor boundary elements are continuous with each other through the prefix coding, and verify that the lower inner neighbor boundary elements and the lower outer neighbor boundary elements are continuous with each other through the prefix coding.

[0077] Hash calculations are performed on the aggregate values, hash values, and element quantity values of the elements in each node of the boundary elements in the index tree query path to obtain the hash verification values for each layer of nodes in the index tree query path, and the hash values of each layer of nodes in the index tree query path are verified through the hash verification values. At the same time, the aggregate values of each layer of nodes in the index tree query path are verified.

[0078] Specifically, when verifying the aggregate query value, subtract the aggregate values of all elements in each node before the query path of the upper inner near neighbor boundary element from the total aggregate value of the root node of the index tree, and at the same time subtract the aggregate values of all elements in each node after the query path of the lower inner near neighbor boundary element.

[0079] To simplify subsequent verification, the number of key values and data in the leaf nodes corresponds to the number of key values and child node pointers in the intermediate nodes.

[0080] As Figure 4 shown, for the above index tree structure, taking the example of querying the sum value in the range of 1 to 4. A binary tuple (a, h) in a node represents an element in the node, where a represents the aggregate value and h represents the hash value. Similar to the B+ tree, the values between the binary tuples are the key values on the index tree, and at the same time, the number of elements n in the node is stored at the end of each node. A simple hash function is used for hash calculation, that is, hash(a||b||c) = (a + b + c) mod 100, where the input of the hash function can be any number of values, that is, a, b, c can be any values.

[0081] Query query range sum(1, 4) and generate verifiable boundary elements, where the query lower bound lb is 1 and the query upper bound ub is 4. Four elements x 0 、x 1 、x 2 、x 3 are obtained according to lb and ub, where x 0 and x 3 are the upper outer near neighbor boundary element and the lower outer near neighbor boundary element respectively, and x 1 and x 2 are the upper inner near neighbor boundary element and the lower inner near neighbor boundary element respectively.

[0082] Starting from the root node and iterating towards the leaf nodes, subtract the aggregate values of all elements in each node before the query path of the lower boundary element x 1 from each layer, and at the same time subtract the aggregate values of all elements in each node after the query path of the upper boundary element x 2 . The aggregate values that meet the conditions for each layer are shown in Table 1. Therefore, the aggregate query result is 4.

[0083] Table 1 Statistical Table of Path Aggregation Values

[0084]

[0085]

[0086] Extract verification information for the query paths of the four boundary elements, and store the sibling element information on the query path nodes into the verifiable object. Represent the sibling element information in quadruples: (number of elements n, sorting index in the node elements, aggregation value list, hash value list). The verification information corresponding to each boundary element is shown in Table 2.

[0087] Table 2 Boundary Elements in the Verifiable Object

[0088]

[0089] Store the range query and result information into the verifiable object, record the queries performed, and the verifiable index tree information, as shown in Table 3.

[0090] Table 3 Query and Query Result Information of the Verifiable Object

[0091] Name Value Root Node Hash Value 55 lb 1 ub 4 Aggregate Query Result 4

[0092] Verify that the four boundary elements meet the query boundary: x 0 : 0 < lb; x 1 : 1 ≥ lb; x 2 : 4 ≤ ub; x 3 : 5 > ub; The above conditions are met, so the verification passes.

[0093] When calculating the hash value from the bottom up, taking x 0 as an example, as shown in Table 4, it is calculated that the hash value of the root node is consistent with the hash value of the root node in the verifiable object, that is, the verification passes. The calculation method of the hash value is hash(h 1 ||a 1 ||...||h n ||a n ||n).

[0094] Table 4 x 0 Hash Value Verification

[0095] Index Tree Level Hash Value Calculation Aggregate Value Calculation level 2 hash(0||1) = 1 SUM(1) = 1 level 1 hash(0||1||1||1||1||2||3) = 9 SUM(0,1,1) = 2 level 0 hash(2||9||3||18||2) = 34 SUM(2,3) = 5 root hash(5||34||1||13) = 55

[0096] When calculating the aggregation value from the bottom up, using the verification information related to elements x 1 and x 2 , the aggregation value can be calculated. The aggregation value is equal to the total aggregation value minus the lower boundary element x 1Query the aggregated values of all elements in the nodes before the query path, and subtract the upper boundary element x 2 Query the aggregated values of all elements in the nodes after the query path, and the final aggregated result is 4.

[0097] When verifying the continuity of boundary elements, extract the sorting index of the element path from the root node to the leaf node layer in the node to obtain the prefix code of the element. Then verify two adjacent elements. The prefix code of the previous element plus 1 is equal to the prefix code of the next element. The verification process is shown in Table 5.

[0098] Table 5 Continuity Verification

[0099]

[0100] As Figure 5 shown, the above method also includes the data owner and the result collector, as well as the work flow in the initialization phase.

[0101] The data owner builds a verifiable query index for the private data in the database through the index tree, and sends the hash value of the root node of the index tree and the height value to the result collector; initialize the verifier of the result collector and the prover of the data owner.

[0102] Specifically, the data information transfer between the result collector and the data owner is all implemented through the communication module. First step, the data owner constructs a verifiable index tree for the private data in the database, and the hash value of the root node of the index tree and the height value of the index tree are sent to the communication module. Second step, the data owner sends the hash value of the root node and the height value of the index tree to the result collector through the communication module. Third step, the result collector receives the hash value of the root node and the height value of the index tree through the communication module, generates a zero-knowledge proof request, and calls the verifier for initialization. Fourth step, the verifier returns the generated public parameters and the verification secret key for verifying the evidence. Fifth step, the result collector sends the proof request and the public parameters to the data owner DO. Sixth step, the data owner calls the prover to perform initialization settings based on the proof request and the public parameters to ensure that it is in the same state as the verifier. Seventh step, the prover returns the result of the initialization. Eighth step, the result collector stores the generated verification secret key, the hash value of the root node and the height value of the index tree in the data table of the local database for use when verifying the query result later. The fields of the data table include the data owner number, the table name for building the index, the attribute column name, and the corresponding verification key, the hash value of the root node and the height value of the index tree.

[0103] As Figure 6As shown in the figure, the user sends an aggregation query request to the result collector, and the result collector sends the query parameters to the data owner; the data owner calls the verifiable query index to complete the aggregation query, generates the corresponding boundary elements, and calls the prover to prove the boundary elements; the result collector calls the verifier to verify the evidence generated by the prover.

[0104] Specifically, in the first step, the query user sends an aggregation query request through the query interface provided on the database of the result collector. In the second step, the SQL extension extracts the query parameters and transmits the query parameters to the communication module. In the third step, the result collector sends the query parameters to the data owner through the communication module. In the fourth step, after receiving through the communication module, the data owner calls the verifiable index to complete the range aggregation query and generates the corresponding verifiable object. In the fifth step, the storage module sends the query result and the generated verifiable object to the communication module. In the sixth step, the communication module calls the prover to prove the verifiable object. In the seventh step, the prover returns the proof process information and the generated evidence file. In the eighth step, the data owner returns the evidence and the query result to the result collector through the communication module. In the ninth step, the result collector calls the verifier to verify the evidence. In the tenth step, the verifier returns the information of successful or failed verification. In the eleventh step, the communication module puts the query result and the verification result into the result collection table together. The result collection table contains the number, table name, column name of the data owner DO for the query, the query result, the evidence file, and the verification result.

[0105]

Embodiment 2

[0106] As Figure 7 shown in the figure, this embodiment provides a database verifiable aggregation query system, including a construction module, a generation module, a correctness verification module, and an aggregation query value verification module.

[0107] The construction module is used to construct an index tree for verifiable aggregation query, and the nodes of the index tree store the aggregation values and hash values corresponding to the child nodes of the node;

[0108] The generation module is used to generate verifiable boundary elements according to the aggregation query range interval. The boundary elements include upper inner near neighbor boundary elements, upper outer near neighbor boundary elements, lower inner near neighbor boundary elements, and lower outer near neighbor boundary elements. The upper inner near neighbor boundary elements and the upper outer near neighbor boundary elements are continuous with each other, and the lower inner near neighbor boundary elements and the lower outer near neighbor boundary elements are continuous with each other; the key value of the upper inner near neighbor boundary element is greater than or equal to the upper query interval value, the key value of the upper outer near neighbor boundary element is less than the upper query interval value, the key value of the lower inner near neighbor boundary element is less than or equal to the lower query interval value, and the key value of the lower outer near neighbor boundary element is greater than the lower query interval value;

[0109] The correctness verification module is used to verify the correctness of the boundary elements by validating the elements of the nodes in the index tree query path for the boundary elements;

[0110] The aggregated query value verification module is used to verify the aggregated query value by validating the elements of the upper inner neighbor boundary element and the lower inner neighbor boundary element in the index tree query path.

[0111] Each node of the index tree also stores the prefix encoding of each element in the node and the element quantity value.

[0112] The correctness verification module includes a continuity verification module, a hash value verification module, and an aggregated value verification module.

[0113] The continuity verification module is used to verify that the upper inner neighbor boundary element and the upper outer neighbor boundary element are continuous with each other through the prefix encoding, and to verify that the lower inner neighbor boundary element and the lower outer neighbor boundary element are continuous with each other through the prefix encoding.

[0114] The hash value verification module is used to perform hash calculations on the aggregated value, hash value, and element quantity value of each element of the nodes in the index tree query path for the boundary elements, to obtain the hash verification values of each layer of nodes in the index tree query path, and to verify the hash values of each layer of nodes in the index tree query path through the hash verification values.

[0115] The aggregated value verification module is used to verify the aggregated values of each layer of nodes in the index tree query path.

[0116] The aggregated query value verification module also includes an aggregated value calculation module. The aggregated value calculation module is used to subtract the aggregated values of all elements in each node before the query path of the upper inner neighbor boundary element from the total aggregated value of the root node of the index tree, and at the same time subtract the aggregated values of all elements in each node after the query path of the lower inner neighbor boundary element.

[0117] This system also includes a communication module, an initialization setting module, and a query module. The communication module is used to transfer the data information between the result collector and the data owner; the initialization setting module is used to perform initialization settings on the verifier of the result collector and the prover of the data owner; the query module is used for the user to send an aggregated query request to the result collector, and the result collector sends the query parameters to the data owner.

[0118] Specifically, the data owner can be further divided into a communication module, a zero-knowledge proof module, and an internal database extension on the system. The zero-knowledge proof module is based on the snarkjs library and realizes two functions: the trusted setup of the constraint circuit and the verification of the proof.

[0119] The internal extension module of the database mainly designs verifiable indexes for the database and provides methods for querying and validating data generation. Taking postgres as an example, it is necessary to add user-defined function extensions in the database in the form of C functions.

[0120] In addition to the network interface for communicating with the data owner, the communication module also includes:

[0121] The prover interface: encapsulates the operation functions of initializing by calling the validator and proving the constraint circuit.

[0122] The index interface: interacts with the verifiable index, and encapsulates the interaction functions of building the index and obtaining the commitment information, as well as querying and obtaining the query results.

[0123] The zero-knowledge proof module mainly realizes two functions: initialization and proof of the constraint circuit. The verifiable index module is responsible for the construction of the index tree, the generation of commitments, the calculation of aggregated values, the processing of queries, and the generation of verifiable objects.

[0124] The result collector can be subdivided into a communication module, a zero-knowledge proof module, and a verifiable index module on the system.

[0125] The communication module transfers data between different modules, including network data transfer between each module of the result collector and between the result collector and the data owner. It includes interfaces for interacting with different modules:

[0126] The database interface: encapsulates some operation functions for the commitment table and the result collection table in the database of the data owner. It realizes the connection of the database and realizes operations such as inserting, searching, and querying tables. In addition, it also includes a query extension of the database for obtaining information on the user's aggregated query request.

[0127] The validator interface: encapsulates the operation functions of calling the validator for circuit code generation, trusted initialization, and validating evidence and query results.

[0128] The network communication interface: realizes functions for socket communication with the result collector, including functions such as sending query information, receiving commitment information, receiving query results and evidence.

[0129] As Figure 8 shown, the main body of this system includes the data owner and the result collector. The data owner stores the privacy data locally, responds to queries, and proves the correctness of the query results. The result collector interacts with multiple data owners, makes aggregated query requests, collects results, and verifies the correctness of the results.

[0130] The data owner periodically uploads its commitment to its data to the database at the result collector side. When the result collector needs to perform query analysis, it sends a request to the data owner. After receiving the request, the data owner returns the query result and its evidence to the result collector. Finally, the result collector obtains the root node hash value and height of the index tree from the database and verifies the query result.

[0131]

Embodiment 3

[0132] This embodiment provides a database verifiable aggregation query device, including:

[0133] At least one processor; a memory coupled to the at least one processor, the memory storing executable instructions, wherein the executable instructions, when executed by the at least one processor, cause the method steps of Embodiment 1 of the present invention to be implemented.

[0134] For the database verifiable aggregation query device provided by the embodiment of the present invention, the processor and the memory can be set separately or integrated together.

[0135] For example, the memory may include random access memory, flash memory, read-only memory, programmable read-only memory, non-volatile memory, or registers, etc. The processor may be a central processing unit (CPU), etc. Or a graphic processing unit (GPU). The memory can store executable instructions. The processor can execute the executable instructions stored in the memory, thereby implementing the various processes described herein.

[0136] It can be understood that the memory in this embodiment can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be ROM (Read-Only Memory), PROM (Programmable ROM), EPROM (Erasable PROM), EEPROM (Electrically EPROM), or flash memory. The volatile memory can be RAM (Random Access Memory), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as SRAM (Static RAM), DRAM (Dynamic RAM), SDRAM (Synchronous DRAM), DDR SDRAM (Double Data Rate SDRAM), ESDRAM (Enhanced SDRAM), SLDRAM (Synchlink DRAM), and DRRAM (Direct Rambus RAM). The memory described herein is intended to include but not be limited to these and any other suitable types of memory.

[0137] In some embodiments, the memory stores the following elements, an upgrade package, an executable unit, or a data structure, or a subset thereof, or an extended set thereof: an operating system and an application program.

[0138] Among them, the operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application program includes various application programs for implementing various application services. The program for implementing the method of the embodiment of the present invention can be included in the application program.

[0139] In the embodiment of the present invention, the processor, by calling the program or instruction stored in the memory, specifically, the program or instruction stored in the application program, the processor is used to execute the method steps of Embodiment 1 of the present invention.

[0140]

Embodiment 4

[0141] This embodiment provides a chip for implementing the method of Embodiment 1 of the present invention. Specifically, the chip includes: a processor for calling and running a computer program from a memory, such that a device installed with the chip is used to implement the method of Embodiment 1 of the present invention.

[0142]

Embodiment 5

[0143] This embodiment provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method of Embodiment 1 of the present invention are implemented.

[0144] For example, the machine-readable storage medium may include, but is not limited to, various known and unknown types of non-volatile memories.

[0145] In summary, Embodiments 1-5 of the present invention provide a database-verifiable aggregation query method and system. By generating verifiable boundary elements to verify the aggregation query and combining it with zero-knowledge proof, it is ensured that private data never leaves the data owner, protecting the privacy of users and preventing malicious data forgery at the same time. The fixed number of boundary elements is suitable for changing query ranges and can also adapt to large-scale data volumes in the database, improving the query verification efficiency.

[0146] Those skilled in the art can understand that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0147] In the embodiments of the present application, the disclosed systems, devices, and methods can be implemented in other ways. For example, the division of units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system. In addition, the coupling between each unit can be direct coupling or indirect coupling. In addition, in the embodiments of the present application, each functional unit can be integrated in a processing unit or exist separately physically, etc.

[0148] It should be understood that in various embodiments of the present application, the magnitudes of the serial numbers of the processes do not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0149] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a machine-readable storage medium. Therefore, the technical solution of this application can be embodied in the form of a software product, which can be stored in a machine-readable storage medium and may include several instructions to enable an electronic device to execute all or part of the processes of the technical solution described in the embodiments of this application. The above storage medium may include various media that can store program codes, such as ROM, RAM, removable disks, hard disks, magnetic disks, or optical discs.

[0150] The above content is only the specific implementation manner of this application, and the protection scope of this application is not limited thereto. Those skilled in the art can make changes or substitutions within the technical scope disclosed in this application, and these changes or substitutions should be within the protection scope of this application.

Claims

1. A database verifiable aggregation query method, characterized in that, the method includes: Construct an index tree for verifiable aggregation query, where the nodes of the index tree store aggregation values and hash values corresponding to the child nodes of the node; Generate verifiable boundary elements according to the aggregation query range interval, the boundary elements include upper inner neighbor boundary elements, upper outer neighbor boundary elements, lower inner neighbor boundary elements, and lower outer neighbor boundary elements, the upper inner neighbor boundary elements and the upper outer neighbor boundary elements are continuous with each other, and the lower inner neighbor boundary elements and the lower outer neighbor boundary elements are continuous with each other; The key value of the upper inner neighbor boundary element is greater than or equal to the upper query interval value, the key value of the upper outer neighbor boundary element is less than the upper query interval value, the key value of the lower inner neighbor boundary element is less than or equal to the lower query interval value, and the key value of the lower outer neighbor boundary element is greater than the lower query interval value; Verify the correctness of the boundary elements through the elements of the nodes in the query path of the index tree by the boundary elements; Verify the aggregation query value through the elements of the upper inner neighbor boundary element and the lower inner neighbor boundary element in the query path of the index tree.

2. The database verifiable aggregation query method according to claim 1, characterized in that, The nodes of the index tree also store the prefix codes of the elements in the node and the element quantity value.

3. The database verifiable aggregation query method according to claim 2, characterized in that, The verification of the correctness of the boundary elements includes: Verify that the upper inner neighbor boundary element and the upper outer neighbor boundary element are continuous with each other through the prefix code, and verify that the lower inner neighbor boundary element and the lower outer neighbor boundary element are continuous with each other through the prefix code.

4. The database verifiable aggregation query method according to claim 2, characterized in that, The verification of the correctness of the boundary elements includes: Perform hash calculation on the aggregation values, hash values, and element quantity values of the elements of the nodes in the query path of the index tree by the boundary elements to obtain the hash verification values of the nodes at each layer in the query path of the index tree, and verify the hash values of the nodes at each layer in the query path of the index tree through the hash verification values.

5. The database verifiable aggregation query method according to claim 1, characterized in that, The verification of the correctness of the boundary elements includes: Verify the aggregation values of the nodes at each layer in the query path of the index tree.

6. The database verifiable aggregation query method according to claim 1, characterized in that, The verification of the aggregation query value includes: Subtract the aggregation values of all elements in the nodes before the query path of the upper inner neighbor boundary element from the total aggregation value of the root node of the index tree, and subtract the aggregation values of all elements in the nodes after the query path of the lower inner neighbor boundary element at the same time.

7. The database verifiable aggregation query method according to claim 1, characterized in that, the method includes: The data owner establishes a verifiable query index for the private data in the database through the index tree, and sends the hash value and height value of the root node of the index tree to the result collector; Initialize the verifier of the result collector and the prover of the data owner; The user sends an aggregation query request to the result collector, and the result collector sends the query parameters to the data owner; The data owner calls the verifiable query index to complete the aggregation query, generates the corresponding boundary elements, and calls the prover to prove the boundary elements; The result collector calls the verifier to verify the evidence generated by the prover.

8. The database verifiable aggregation query method according to claim 7, characterized in that, The initialization of the verifier of the result collector and the prover of the data owner includes: The result collector receives the hash value and height value of the index tree, generates a zero-knowledge proof instruction, and initializes the verifier; The verifier returns the generated public parameters and the verification secret key for verifying the evidence; The result collector sends the public parameters and the proof code to the data owner; The data owner calls the prover to perform initialization settings based on the proof instruction and the public parameters.

9. A database verifiable aggregation query system, characterized in that, including: A construction module for constructing an index tree for verifiable aggregation query, where the nodes of the index tree store the aggregation values and hash values corresponding to the child nodes of the node; A generation module for generating verifiable boundary elements according to the aggregation query range interval, the boundary elements include upper inner near neighbor boundary elements, upper outer near neighbor boundary elements, lower inner near neighbor boundary elements, and lower outer near neighbor boundary elements, the upper inner near neighbor boundary elements and the upper outer near neighbor boundary elements are continuous with each other, and the lower inner near neighbor boundary elements and the lower outer near neighbor boundary elements are continuous with each other; the key value of the upper inner near neighbor boundary element is greater than or equal to the upper query interval value, the key value of the upper outer near neighbor boundary element is less than the upper query interval value, the key value of the lower inner near neighbor boundary element is less than or equal to the lower query interval value, and the key value of the lower outer near neighbor boundary element is greater than the lower query interval value; A correctness verification module for verifying the correctness of the boundary elements by the elements of the nodes in the query path of the index tree by the boundary elements; An aggregation query value verification module for verifying the aggregation query value by the elements of the upper inner near neighbor boundary element and the lower inner near neighbor boundary element in the query path of the index tree.

10. The database verifiable aggregation query system according to claim 9, characterized in that, The nodes of the index tree also store the prefix encoding of each element in the node and the element quantity value.

11. The database verifiable aggregation query system according to claim 9, characterized in that, The correctness verification module includes: A continuity verification module for verifying that the upper inner near neighbor boundary element and the upper outer near neighbor boundary element are continuous with each other by the prefix encoding, and verifying that the lower inner near neighbor boundary element and the lower outer near neighbor boundary element are continuous with each other by the prefix encoding.

12. The database verifiable aggregation query system according to claim 9, characterized in that, The correctness verification module includes: A hash value verification module is used to perform hash calculations on the aggregated value, hash value, and element quantity value of each element of the nodes in the index tree query path of the boundary element, to obtain the hash verification values of each layer of nodes in the index tree query path, and to verify the hash values of each layer of nodes in the index tree query path through the hash verification values.

13. The database verifiable aggregation query system according to claim 9, wherein: The correctness verification module includes: An aggregated value verification module is used to verify the aggregated values of each layer of nodes in the index tree query path.

14. The database verifiable aggregation query system according to claim 9, wherein: The aggregated query value verification module includes: An aggregated value calculation module is used to subtract the aggregated values of all elements in each node before the query path of the upper inner neighbor boundary element from the total aggregated value of the root node of the index tree, and at the same time subtract the aggregated values of all elements in each node after the query path of the lower inner neighbor boundary element.

15. The database verifiable aggregation query system according to claim 9, wherein: It further includes: A communication module is used to transfer the data information of the result collector and the data owner; An initialization setting module is used to perform initialization settings on the verifier of the result collector and the prover of the data owner; A query module is used for a user to send an aggregation query request to the result collector, and the result collector sends query parameters to the data owner.

16. A database verifiable aggregation query device includes at least one processor; a memory coupled to the at least one processor, and the memory stores executable instructions, wherein: When the executable instructions are executed by the at least one processor, the steps of the method according to any one of claims 1 to 8 are implemented.

17. A chip, wherein: It includes a processor for calling and running a computer program from a memory, so that a device installed with the chip executes the steps of the method according to any one of claims 1 to 8.

18. A computer-readable storage medium, on which a computer program is stored, wherein: When the computer program is executed by a processor, the steps of the method according to any one of the above claims 1 to 8 are implemented.

Citation Information

Cited By

  • Tree node linkage department associated piece counting data integrated query method and system

    CN121764976A

  • A method and system for integrating and querying piecework data related to departments with tree-like node linkage

    CN121764976B