A data query method and device based on alliance chain
By adopting a data query method based on alliance chain on the blockchain, and using technical means of implicit index values and preset operations, the problem of privacy leakage during data query on the blockchain is solved, and safe and efficient data query is achieved.
Patent Information
- Application Number
- CN202011049423.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-29
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2040-09-29
AI Technical Summary
It is difficult for the prior art to implement effective data query on the blockchain without revealing the user's personal privacy information.
The data query method based on the alliance chain is adopted, and the target index value is implicit in it by generating the first request and the second request, avoiding the direct transmission of specific data content, and using preset operations to convert messages between the target intermediate node and the accounting node to protect the privacy of the data query party.
It realizes effective data query on the blockchain without revealing personal privacy information to the query system, which enhances the security and privacy protection of data query.
Smart Images

Figure CN112131227B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain in the field of financial technology (Fintech), and in particular to a data query method and device based on alliance chain. Background Art
[0002] With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to Fintech. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. Blockchain is widely used in the financial industry due to its advantages such as being difficult to tamper with. When a user needs to query data on the blockchain, the user's fragmented information is generally submitted directly to the query system (such as someone's credit card account), and the query system uses smart contracts to call the query function and then return the data.
[0003] However, after a user's fragmentary information is submitted to the query system, it is easy to analyze the user's situation. For example, a person's credit card account will be exposed after submission. Moreover, the query system also knows the specific data queried. Therefore, how to effectively query data on the blockchain without revealing personal privacy to the query system is a problem that needs to be solved urgently. Summary of the invention
[0004] The present invention provides a data query method and device based on an alliance chain, which solves the problem in the prior art that data cannot be effectively queried on a blockchain without revealing personal privacy to the query system.
[0005] In the first aspect, the present invention provides a data query method based on an alliance chain, including: a data query party generates a first request, and generates a second request based on a preset operation according to a target index value of target encrypted data in a target database and the first request; the data query party sends the first request and the second request to a corresponding accounting node through a target intermediate node; the target intermediate node and the accounting node are nodes in the alliance chain; the data query party obtains a first response message and a second response message from the corresponding accounting node through the target intermediate node; the data query party obtains the target encrypted data according to the first response message and the second response message; the data query party decrypts the target encrypted data to obtain decrypted data of the target encrypted data.
[0006] In the above method, the data query party generates a first request and a second request, implicitly embeds the target index value therein, and does not directly transmit the information in the specific data content, but sends the first request and the second request to the target intermediate node, and selects an accounting node dedicated to accessing the target database, thereby reducing other nodes' direct contact with the encrypted data in the target database. Moreover, the accounting node only knows that the first request and the second request are from the target intermediate node, and does not know that they are issued by the data query party. The target encrypted data can be restored according to the first response message and the second response message through the agreed preset operation to obtain the decrypted data of the target encrypted data. Therefore, the above method will not disclose the data query party to the accounting node, and the target intermediate node does not know the agreed conversion method between the request and response messages, and only plays a forwarding role, thereby protecting the privacy of the data query party.
[0007] Optionally, before the data query party generates the first request, it also includes: the data query party determines the intermediate index node address according to the privacy keyword of the target encrypted data and a preset one-way mapping relationship; the intermediate index node address points to the target intermediate node; the target intermediate node stores the target index value; the data query party obtains the target index value from the target intermediate node.
[0008] In the above method, the target intermediate node stores the target index value, and can determine the intermediate index node address according to a preset one-way mapping relationship, and then obtain the target index value from the target intermediate node, so that the accounting node is not aware that the data query party needs to query, thereby ensuring privacy.
[0009] Optionally, the data query party determines the intermediate index node address according to the privacy keyword of the target encrypted data in accordance with a preset one-way mapping relationship, including: the data query party updates the first Bloom filter based on the first Bloom filter by mapping the privacy keyword through at least one round of hash function to obtain a second Bloom filter; the data query party obtains the intermediate index node address according to the second Bloom filter.
[0010] In the above method, the Bloom filter is an efficient one-way mapping relationship, and it is impossible to analyze each round of update process in the middle of the second Bloom filter, so the address of the intermediate index node can be obtained in an efficient and confidential manner.
[0011] Optionally, the preset operation is an exclusive-OR logical operation; the data query party generates a first request, including: the data query party randomly generates a first request with N bits of data based on the number N of indexes of the encrypted data; wherein each bit in the N bits of data represents a corresponding index, and the different numerical values of each bit represent whether the bit is the target index value that the data query party needs to obtain.
[0012] In the above manner, the data querying party randomly generates a first request with N bits of data according to the number N of indexes of the encrypted data, thereby obtaining the target index value that the data querying party needs to obtain based on an XOR operation, and hiding the target index value of the target encrypted data therein.
[0013] Optionally, the first response message is obtained by the accounting node processing the first encrypted data based on the preset operation; the second response message is obtained by the accounting node processing the second encrypted data based on the preset operation; the first encrypted data is the encrypted data corresponding to the first request obtained from the target database; the second encrypted data is the encrypted data corresponding to the second request obtained from the target database; the data query party obtains the target encrypted data according to the first response message and the second response message, including: the data query party obtains the target encrypted data based on the preset operation according to the first response message and the second response message.
[0014] In the above manner, the first response message and the second response message are both obtained based on the preset operation, so that the data query party can obtain the target encrypted data based on the first response message and the second response message based on the preset operation, that is, the target encrypted data is finally restored through the agreed preset operation.
[0015] Optionally, before the data query party generates the first request, it also includes: the data query party generates a data access request and sends it to the data owner through the alliance chain; the data access request is used by the data owner to encrypt the data it owns with the public key of the data query party and store it in the target database.
[0016] In the above manner, the data query party generates a data access request and sends it to the data owner through the alliance chain, thereby increasing confidentiality.
[0017] In a second aspect, the present invention provides a data query method based on an alliance chain, including: a target intermediate node obtains a first request and a second request from a data query party; the second request is generated based on a preset operation according to a target index value of target encrypted data in a target database and the first request; the target intermediate node sends the first request and the second request to an accounting node; the target intermediate node and the accounting node are nodes in the alliance chain; the target intermediate node obtains a first response message and a second response message from the accounting node; the target intermediate node sends the first response message and the second response message to the accounting node.
[0018] Optionally, the accounting node includes a first accounting node and a second accounting node; the target intermediate node sends the first request and the second request to the accounting node, including: the target intermediate node sends the first request to the first accounting node; the target intermediate node sends the second request to the second accounting node; the target intermediate node obtains a first response message and a second response message from the accounting node, including: the target intermediate node obtains the first response message from the first accounting node; the target intermediate node obtains the second response message from the second accounting node.
[0019] In a third aspect, the present invention provides a data query method based on an alliance chain, comprising: an accounting node obtains a first request and / or a second request from a data query party through a target intermediate node; the second request is generated based on a preset operation according to a target index value of target encrypted data in a target database and the first request; the target intermediate node and the accounting node are nodes in the alliance chain; the accounting node obtains first encrypted data from the target database according to the first request, and obtains a first response message based on the first encrypted data; and / or the accounting node obtains second encrypted data from the target database according to the second request, and obtains a second response message based on the second encrypted data; the second encrypted data includes the target encrypted data; the accounting node sends the first response message and / or the second response message to the target intermediate node.
[0020] Optionally, the preset operation is an exclusive-OR logic operation; the first request and the second request both contain N-bit data; wherein each bit in the N-bit data represents a corresponding index, and the different values of each bit represent whether the bit is the target index value that the data query party needs to obtain; the accounting node obtains the first encrypted data from the target database according to the first request, and obtains a first response message based on the first encrypted data, including: the accounting node divides the first request into multiple first index values; the accounting node obtains multiple first sub-encrypted data corresponding to each of the multiple first index values in the first encrypted data according to the N-bit data in the first request; the accounting node root According to the multiple first sub-encrypted data, based on the preset operation, the first response message is obtained; the accounting node obtains the second encrypted data from the target database according to the second request, and obtains the second response message based on the second encrypted data, including: the accounting node divides the second request into multiple second index values; the accounting node obtains the multiple second sub-encrypted data corresponding to the multiple second index values in the second encrypted data according to the N-bit data in the second request; the multiple second sub-encrypted data include the target encrypted data; the accounting node obtains the second response message according to the multiple second sub-encrypted data based on the preset operation.
[0021] In a fourth aspect, the present invention provides a data query device based on an alliance chain, including: a generation module, used to generate a first request, and generate a second request based on a preset operation according to the target index value of the target encrypted data in the target database and the first request; a processing module, used to send the first request and the second request to the corresponding accounting node through the target intermediate node; the target intermediate node and the accounting node are nodes in the alliance chain; obtaining a first response message and a second response message from the corresponding accounting node through the target intermediate node; obtaining the target encrypted data according to the first response message and the second response message; decrypting the target encrypted data to obtain decrypted data of the target encrypted data.
[0022] Optionally, the processing module is also used to: determine the intermediate index node address according to the privacy keyword of the target encrypted data and a preset one-way mapping relationship; the intermediate index node address points to the target intermediate node; the target intermediate node stores the target index value; and obtain the target index value from the target intermediate node.
[0023] Optionally, the processing module is specifically used to: based on the first Bloom filter, perform at least one round of updating on the first Bloom filter by mapping at least one round of hash function of the privacy keyword to obtain a second Bloom filter; and obtain the intermediate index node address according to the second Bloom filter.
[0024] Optionally, the preset operation is an exclusive OR logic operation; the generation module is specifically used to: randomly generate a first request with N bits of data according to the number N of indexes of the encrypted data; wherein each bit of the N bits of data represents a corresponding index, and the different values of each bit represent whether the bit is the target index value that the data query party needs to obtain.
[0025] Optionally, the first response message is obtained by the accounting node processing the first encrypted data based on the preset operation; the second response message is obtained by the accounting node processing the second encrypted data based on the preset operation; the first encrypted data is the encrypted data corresponding to the first request obtained from the target database; the second encrypted data is the encrypted data corresponding to the second request obtained from the target database; the processing module is specifically used to: obtain the target encrypted data based on the preset operation according to the first response message and the second response message.
[0026] Optionally, the generation module is also used to: generate a data access request and send it to the data owner through the alliance chain; the data access request is used by the data owner to encrypt the data it owns with the public key of the data query party and store it in the target database.
[0027] The beneficial effects of the fourth aspect and each optional device of the fourth aspect can refer to the beneficial effects of the first aspect and each optional method of the first aspect, which will not be repeated here.
[0028] In a fifth aspect, the present invention provides a computer device, including a program or an instruction, which, when executed, is used to execute the above-mentioned first aspect, second aspect, or third aspect and each optional method.
[0029] In a sixth aspect, the present invention provides a storage medium, comprising a program or an instruction, which, when executed, is used to execute the above-mentioned first aspect, second aspect, or third aspect and each optional method.
[0030] These and other aspects of the present invention will become more apparent from the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0032] Figure 1A flowchart of a data query method based on a consortium chain provided by an embodiment of the present invention;
[0033] Figure 2 A schematic diagram of an applicable architecture of a data query method based on a consortium chain provided in an embodiment of the present invention;
[0034] Figure 3 A schematic diagram of a Bloom filter in a data query method based on a consortium chain provided in an embodiment of the present invention;
[0035] Figure 4 A schematic diagram of a specific process of a data query method based on a consortium chain provided by an embodiment of the present invention;
[0036] Figure 5 A schematic diagram of the structure of a data query device based on a consortium chain provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] The abbreviations used in this application are as follows:
[0039] Blockchain: A distributed ledger that combines data blocks in a sequential manner in chronological order to form a chain data structure and is cryptographically guaranteed to be tamper-proof and unforgeable.
[0040] A Bloom Filter is a binary vector and a series of random mapping functions used to retrieve whether an element is in a set.
[0041] PIR protocol (Private information retrieval) Private information retrieval refers to how to complete the query without leaking the user's private information when the user submits a query to the database.
[0042] During the operation of financial institutions (banking institutions, insurance institutions or securities institutions) (such as bank loan business, deposit business, etc.), when users have the need to query data on the blockchain, they generally submit the user's fragmentary information directly to the query system (such as someone's credit card account), and the query system uses smart contracts to call the query function and then return the data. However, after the user's fragmentary information is submitted to the query system, it is easy to analyze the user's situation. For example, someone's credit card account will expose the user's card opening information after submission. Moreover, the query system is also aware of the specific data queried. Therefore, how to achieve effective query of data on the blockchain without revealing personal privacy to the query system is a problem that needs to be solved urgently. This situation does not meet the needs of banks and other financial institutions, and cannot guarantee the efficient operation of various businesses of financial institutions. For this reason, if Figure 1 As shown, the present application provides a data query method based on alliance chain.
[0043] Step 101: The data querying party generates a first request, and generates a second request based on a preset operation according to a target index value of target encrypted data in a target database and the first request.
[0044] Step 102: The data querying party sends the first request and the second request to the corresponding accounting node through the target intermediate node.
[0045] The target intermediate node and the accounting node are nodes in the alliance chain;
[0046] Step 103: The data querying party obtains a first response message and a second response message from the corresponding accounting node through the target intermediate node.
[0047] Step 104: The data querying party obtains the target encrypted data according to the first response message and the second response message.
[0048] Step 105: The data querying party decrypts the target encrypted data to obtain decrypted data of the target encrypted data.
[0049] In step 101 to step 105, the first request may be a random string; the preset operation may be an operation satisfying certain characteristics, for example, the preset operation satisfies the commutative law, the associative law and the reflexive law.
[0050] It should be noted that the method in steps 101 to 105 can be applied to Figure 2 The method in steps 101 to 105 is applied to Figure 2The architecture shown is based on the alliance chain as the underlying chain structure. At the same time, the chain can store the summary of the data file, and the real data file is stored in the target database (such as a distributed database) under the chain. The basic structure of the alliance chain block includes: block header and block body; the block header includes: the block identifier, the parent block identifier, the timestamp, and the Merkle root; the block body contains all the verified records of transactions that occurred during the block creation process, as well as the summary value of the stored data and the real address of the original data file.
[0051] The method in steps 101 to 105 is applied to Figure 2 When the architecture is shown, two types of roles are involved, namely, data owners and data query parties. In the initial stage of the protocol, the user has an asymmetric key pair (PK, SK), PK is the public key, and SK is the private key. This is the key pair that will be derived when the user joins the alliance chain. The alliance chain stores the user's public key PK. The two types of roles involved in the method proposed in this article, namely, data owners and data query parties, are both users of the alliance chain system.
[0052] Figure 2 In the architecture shown, there are three types of nodes in the PIR protocol based on the alliance chain: accounting nodes, consensus nodes, and intermediate nodes. The accounting node is used to store the account book messages in the alliance chain, and each accounting node exists as a server. In the general architecture of the alliance chain, the node usually stores the summary or index information of the data, and the complete information of the data is stored in the distributed database under the chain. In this application, each accounting node stores the index value of the data shared by the data owner on the alliance chain platform, and the index value maps the location of the actual data file stored in the distributed database, and the data file encrypted based on the public key of the data query party is stored in the distributed database.
[0053] The functions of the consensus node are consistent with those of the sorting service node in the traditional alliance chain platform. It provides the ability to ensure node consistency, execute consensus protocols, and adopt preset consensus algorithms such as the PBFT consensus algorithm while ensuring fault tolerance.
[0054] The essence of the intermediate node is still a bookkeeping node when it joins the alliance chain, but it no longer provides bookkeeping capabilities after becoming an intermediate node. The ability of the intermediate node provides the function of request transfer. The intermediate node stores the index value of the data file. That is, if the data owner wants to access the data flow, he needs to find the intermediate node address through the data keyword, and then get the stored data index value from the intermediate node, and then continue to transmit the request to the bookkeeping node, and access the encrypted data file in the distributed database through the index value.
[0055] It should be noted that the intermediate node will randomly select the accounting node when forwarding the message. Since the information in the accounting node is synchronized and consistent, it does not affect the specific accounting node selected. After receiving the request, the accounting node will calculate the index value based on the parameters of the request, find the corresponding encrypted data file in the distributed database, and return the encrypted file to the data query user after finding it. Because the user sends more than one access request, the requesting user calculates the required encrypted file through the reconstruction algorithm after receiving the response message, and then uses its own private key to decrypt it to obtain the data file. In this solution, the data owner and the data query party cannot interact directly, and both types of users interact directly with the alliance chain platform.
[0056] Figure 2 In the architecture shown, the public-private key encryption mechanism is used to ensure that the storage server of the target database cannot know the real data file even if it receives the response message, thereby ensuring the privacy security of the data owner and the data query user.
[0057] Figure 2 In the illustrated architecture, the method of step 101 to step 105 can be composed of three parts: (Q, A, C), where Q is the user query generation algorithm, A is the server query response algorithm, and C is the user result reconstruction algorithm. In this solution, in order to balance the system overhead and ensure the private information retrieval of information theory, dual server copies can be used, that is, the query request of the data query party is two, and the target data is finally calculated based on the two returned response results.
[0058] The user query generation algorithm Q includes generating an n-bit random sequence {0,1}n consisting of 0 and 1, where n depends on the system's initial parameters. The random sequence is used to calculate the data index value, which is request q1. The request q2 generated by the user query generation algorithm Q includes the random sequence of q1 and the index i of the target data, which is XORed, that is, q2=q1 XOR i. After the user generates the request, it sends the request to the intermediate node. After receiving the message, the intermediate node sends two different request messages to different accounting nodes in sequence.
[0059] A is the server query response algorithm. After receiving request q1, the accounting node groups the random sequence based on the interval size of the index value, divides the n-bit random sequence into m groups, calculates the index value once for each n / m-bit sequence, and obtains the index data from the distributed database server for each index value. Then, each index data is XORed to obtain a1, that is, a1=E(data1)⊕E(data2)⊕……⊕E(data(n / m)); After receiving request q2, the accounting node follows a similar processing flow to q1, but because this request contains the index value of the target data, it returns a2=E(data1)⊕E(data2)⊕……⊕E(data(n / m))⊕E(datai), and both a1 and a2 response messages are returned to the intermediate node.
[0060] Among them, C is the user result reconstruction algorithm. After receiving the response message, the data query party reconstructs it, c=a1 XOR a2, and obtains the target data E(datai) encrypted with the query party's public key. The data is decrypted using its own private key to obtain the target data.
[0061] In an optional implementation manner, before step 101, the following steps may be performed:
[0062] The data query party generates a data access request and sends it to the data owner through the alliance chain; the data access request is used by the data owner to encrypt the data it owns with the public key of the data query party and store it in the target database.
[0063] It should be noted that, specifically, the above implementation process may be:
[0064] After the data query party sends a request to the alliance chain to access the data, the request parameters include <data keyword W, data owner name>; the alliance chain will send a message to the data owner and pass the data query party's public key PK to the data owner. The data owner uses the public key PK given by the query party to encrypt the message data and then returns it to the alliance chain platform for distributed storage.
[0065] Therefore, the process for the data owner can be as follows:
[0066] 1. When the data owner stores the data on the chain, he needs to disclose the privacy keyword W of the stored data. The privacy keyword W can be displayed in the form of a string or character. When the k hash functions of the Bloom filter are used to calculate the keyword, the privacy keyword W can be converted into an ASCII code value for calculation.
[0067] 2. The data owner generates a binary string H(W) containing k outputs through a Bloom filter based on the privacy keyword, and maps the binary string to an intermediate index address by one-way hashing. The intermediate index address is the address value of a random intermediate node in the alliance chain, and the owner stores the target index value of the actual storage address of the data at the intermediate node.
[0068] It should be noted that the intermediate node cannot reverse parse the binary string generated by the Bloom filter through its own address. According to the characteristics of the Bloom filter, once the keyword W is not the target keyword, the correct intermediate node address cannot be parsed. The intermediate node can protect the link relationship between the data access party and the accounting node, and the accounting node can only obtain that the request message is sent from the intermediate node.
[0069] 3. After the data query party submits the access request to the alliance chain platform, the alliance chain platform will pass the access request message to the data owner. At this time, the data owner applies for the public key PK of the data query party. After obtaining the public key PK, the data owner encrypts the data E (data) shared on the alliance chain. At the same time, after storing the encrypted data on the distributed server, the target index value corresponding to the actual storage address of the data is returned and stored in the intermediate node shown in step 2.
[0070] Therefore, in an optional implementation manner, before step 101, the following steps may be performed:
[0071] The data querying party determines the intermediate index node address according to the privacy keyword of the target encrypted data and a preset one-way mapping relationship; the data querying party obtains the target index value from the target intermediate node.
[0072] The intermediate index node address points to the target intermediate node; the target intermediate node stores the target index value.
[0073] like Figure 3 As shown, the above optional implementation can be implemented by a Bloom filter, which can be specifically as follows:
[0074] The data query party updates the first Bloom filter based on the first Bloom filter by mapping at least one round of hash function on the privacy keyword to obtain a second Bloom filter; the data query party obtains the intermediate index node address based on the second Bloom filter.
[0075] Specifically, in the above implementation process, by using the Bloom filter and the probabilistic encryption method, a small amount of storage space is used to construct the index of keywords and documents, which can quickly determine whether an element belongs to a certain set, with high space and time efficiency. Since the Bloom filter has a certain positive false positive rate, if it is determined that an element does not belong to the set, then the element must not belong to the set, but if it is determined that an element belongs to the set, then the element may not belong to the set.
[0076] Bloom filter is used to map the address of the intermediate node. After the data owner publishes the keyword W of the shared data, the k-times hash function calculation on the Bloom filter is performed to obtain k-times output, fill the filter table, and obtain a binary sequence H(W) with a specific number of bits. This sequence is used as the address of the intermediate node. The keyword W can be a string or a single character, which is converted into an ASCII code for hash calculation.
[0077] When sharing data to the alliance chain platform, the data owner will first publish the keyword W of the data. The alliance chain platform provides a unified Bloom filter, which uses k hash functions to output a binary value with a specific bit length. The value is identified by the symbol H(W), which is the address value of the intermediate node.
[0078] It should be noted that in the scheme for generating the intermediate index node address, it is also possible not to choose to use the Bloom filter for generation, but to directly randomly designate a node in the system as the target intermediate node. However, the intermediate index node address needs to be disclosed each time, which may cause a concentrated computing power attack on the node. The scheme uses the Bloom filter to generate the intermediate index address, which has randomness while also ensuring a certain degree of encryption security, increasing the complexity of resolving the intermediate index address. In this scheme, the complexity of address resolution is O(N), while the complexity of address resolution in the alternative scheme is O(1).
[0079] In an optional implementation manner, the preset operation is an XOR logic operation; step 101 may specifically be:
[0080] The data query party randomly generates a first request with N bits of data according to the number N of indexes of the encrypted data; wherein each bit of the N bits of data represents a corresponding index, and the different values of each bit represent whether the bit is the target index value that the data query party needs to obtain.
[0081] Based on the optional implementation mode in which the preset operation is an XOR logic operation, one implementation mode is as follows:
[0082] The first response message is obtained by the accounting node processing the first encrypted data based on the preset operation; the second response message is obtained by the accounting node processing the second encrypted data based on the preset operation; the first encrypted data is the encrypted data corresponding to the first request obtained from the target database; the second encrypted data is the encrypted data corresponding to the second request obtained from the target database.
[0083] Specifically, the above method can be as follows:
[0084] The user query generation algorithm Q includes generating an n-bit random sequence {0,1} consisting of 0 and 1. n , n is the total index number of files stored on the server (that is, when retrieving data from the server, the index range is 1 to n, and if the value on the i-th position is 1, the data file with index i will be retrieved, such as 010111, then the data with index 2, 4, 5, and 6 will be retrieved), and the random sequence is request q1; the request q2 generated by the user query generation algorithm Q includes the random sequence of q1 and the index i of the target data, that is, the i-th position is XORed with q2=q1⊕i, (for example, q1 is 010111, and the target index i is 5, then the i-th position is XORed with 1, for example, under the sequence of q1, 0101'1'1, the fifth position is XORed with 1 to obtain the sequence 010101, which is set to q2), and after the user generates the request, it sends the request to the intermediate node. After receiving the message, the intermediate node sends two different request messages to different accounting nodes in sequence.
[0085] A is the server query response algorithm. After receiving the request q1, the accounting node searches for the index data where the bit is set to 1 according to the sequence of q1. For example, if q1 is 010111, the returned data is a1=E(data2) XOR E(data4) XOR E(data5) XOR E(data6) (the representation of the a1 string is in the form of concatenation, but the operations between them are still connected by XOR symbols); after receiving the request q2, the accounting node follows a similar processing flow to q1. If q2 is 010101, the returned data is a2=E(data2) XOR E(data4) XOR E(data6); both a1 and a2 response messages are returned to the intermediate node.
[0086] Where C is the user result reconstruction algorithm. The data query party reconstructs after receiving the response message, c=a1 XOR a2, and obtains the target encrypted data E(datai) encrypted with the query party's public key. In this example, E(data5) is obtained. The data is decrypted using its own private key to obtain the decrypted data of the target encrypted data.
[0087] Step 104 may specifically be:
[0088] The data querying party obtains the target encrypted data according to the first response message and the second response message based on the preset operation.
[0089] Therefore, based on the above description, the data query process can be as follows:
[0090] 1. The data query party parses the intermediate index address through the Bloom filter based on the "keyword W" and accesses the node of the corresponding address.
[0091] 2. The data query party accesses the intermediate node to obtain the index value i of the actual storage address of the data.
[0092] 3. After obtaining the index value of the actual data storage address, first check whether the current block height has changed. If not, the querying party sends an access request to the storage server through the PIR protocol, and broadcasts the access request to the whole network consensus, and obtains the requested data through the reconstruction algorithm written in the smart contract in the data returned by the server. If the block height has changed after obtaining the data storage address, it proves that the data in the system database has been modified or added or deleted. At this time, it is judged that a conflict has occurred and the data request needs to be made again.
[0093] The data query party generates an n-bit random sequence {0,1} consisting of 0 and 1 based on the user query generation algorithm Q. n , n depends on the parameters at the initialization of the system. The random sequence is used to calculate the data index value, which is request q1; the data query party encapsulates request q1 into a transaction and records it as TX1. The request q2 generated by the data query party includes the random sequence of q1 and the index i of the target data, which is XORed, that is, q2=q1⊕i, and then q2 is encapsulated as transaction TX2. After the user generates the request, the request is sent again to the intermediate node address calculated by the Bloom filter before. After the intermediate node receives transactions TX1 and TX2, it sends the two different transactions to different accounting nodes in turn.
[0094] 4. After accounting node 1 receives transaction TX1, it groups random sequences based on the interval size of the index value. The interval is defined as a binary bit within an interval mapped to an interval value. The n-bit random sequence is divided into t groups, and the index value is calculated once for each n / t-bit sequence. The corresponding index value is obtained from the distributed database server, and then each index data is XORed to obtain a1, that is, a1=E(data1)⊕E(data2)⊕……⊕E(data(t)); After accounting node 2 receives transaction TX2, the processing flow is similar to that of receiving transaction TX1, but because this request contains the index value of the target data, it returns a2=E(data1))E(data2)⊕……⊕E(data(t))⊕E(datai), and the a1 and a2 response messages are returned to the intermediate node.
[0095] 5. After receiving the response messages a1 and a2, the intermediate node transmits them back to the data query party. After receiving the response messages, the data query party reconstructs c=a1⊕a2 and obtains the target data E(datai) encrypted with the query party's public key. It then decrypts the data with its own private key to obtain the target data.
[0096] It should be noted that Figure 1 The process shown is similar for the target intermediate node and the accounting node. The process for the target intermediate node is as follows:
[0097] The target intermediate node obtains a first request and a second request from a data query party; the target intermediate node sends the first request and the second request to a bookkeeping node; the target intermediate node and the bookkeeping node are nodes in a consortium chain; the target intermediate node obtains a first response message and a second response message from the bookkeeping node; the target intermediate node sends the first response message and the second response message to the bookkeeping node.
[0098] The second request is generated based on a preset operation according to a target index value of the target encrypted data in the target database and the first request.
[0099] In an optional implementation manner, the accounting node includes a first accounting node and a second accounting node; the target intermediate node sends the first request and the second request to the accounting node, and the steps may be as follows:
[0100] The target intermediate node sends the first request to the first accounting node; the target intermediate node sends the second request to the second accounting node.
[0101] The target intermediate node obtains the first response message and the second response message from the accounting node, and the steps may be as follows:
[0102] The target intermediate node obtains the first response message from the first accounting node; the target intermediate node obtains the second response message from the second accounting node.
[0103] The process of accounting nodes is as follows:
[0104] The accounting node obtains a first request and / or a second request from a data query party through a target intermediate node; the accounting node obtains first encrypted data from the target database according to the first request, and obtains a first response message based on the first encrypted data; and / or the accounting node obtains second encrypted data from the target database according to the second request, and obtains a second response message based on the second encrypted data; the second encrypted data includes the target encrypted data; the accounting node sends the first response message and / or the second response message to the target intermediate node.
[0105] The second request is generated based on a preset operation according to the target index value of the target encrypted data in the target database and the first request; the target intermediate node and the accounting node are nodes in the alliance chain.
[0106] In an optional implementation, the preset operation is an exclusive-OR logic operation; the first request and the second request both contain N bits of data; wherein each bit of the N bits of data represents a corresponding index, and a different value of each bit represents whether the bit is a target index value that the data query party needs to obtain.
[0107] The accounting node obtains first encrypted data from the target database according to the first request, and obtains a first response message based on the first encrypted data. The steps may be as follows:
[0108] The accounting node divides the first request into multiple first index values; the accounting node obtains multiple first sub-encrypted data corresponding to each of the multiple first index values in the first encrypted data based on the N-bit data in the first request; the accounting node obtains the first response message based on the preset operation according to the multiple first sub-encrypted data.
[0109] The accounting node obtains the second encrypted data from the target database according to the second request, and obtains a second response message based on the second encrypted data. The steps may be as follows:
[0110] The accounting node divides the second request into multiple second index values; the accounting node obtains, based on the N-bit data in the second request, multiple second sub-encrypted data corresponding to each of the multiple second index values in the second encrypted data; the multiple second sub-encrypted data include the target encrypted data; the accounting node obtains the second response message based on the preset operation and the multiple second sub-encrypted data.
[0111] Based on the above description, combined with Figure 4 , which describes in detail the data query method based on the alliance chain provided by this application.
[0112] 1. After the alliance chain is established, when the data owner and data query party join the alliance chain, the alliance chain platform will derive an asymmetric key pair (PK, SK) based on the key derivation function according to the user ID string, where PK is the public key and SK is the private key. The alliance chain stores the user's public key PK.
[0113] 2. Before publishing a shared data file to the consortium chain platform, the data owner will first publish the privacy keyword W of the data. The keyword W is the description string defined by the data owner based on the data file. The consortium chain platform provides a unified Bloom filter component. The data owner selects k different string hash functions in the Bloom filter that conform to uniform random distribution, and outputs a binary value with a length of m bits. m is the size of the bit array mapped by the Bloom filter. The value is identified by the symbol H(W), and H(W) is used as the address value of the intermediate node.
[0114] 3. The data owner maps the output binary string H(W) to an intermediate index address by one-way hashing the binary string. The intermediate index address is the address value of a random intermediate node in the alliance chain, and the data owner stores the index value of the actual storage address of the data at the intermediate node.
[0115] 4. After the storage is completed, the target index value can be obtained from the intermediate node. After the data query direction sends a request for access to the data to the alliance chain, the request parameters include <data keyword W, data owner name> keyword W is the description string defined by the data owner based on the data file, and the data owner name name is the ID of the data owner in the system; the alliance chain will send a message to the data owner and pass the public key PK of the data query party to the data owner. After the data owner obtains the public key PK, it encrypts the data E (data) shared on the alliance chain, where the original data is data and the encrypted data is E (data). At the same time, after storing the encrypted data on the distributed server, the index value corresponding to the actual storage address of the data is returned and stored in the node address shown in step 3.
[0116] 5. The data query party parses the intermediate node address through the Bloom filter according to the privacy keyword W and accesses the node with the corresponding address. The data query party accesses the intermediate node to obtain the index value i of the real storage address of the data.
[0117] 6. After obtaining the target index value of the actual data storage address, the data query party first checks whether the current block height has changed. If the block height has changed after obtaining the data storage address, it proves that the data in the target database has been modified or added or deleted. At this time, it is judged that a conflict has occurred and the data request needs to be made again. If there is no change, continue to request data. The data query party generates an n-bit random sequence {0,1} consisting of 0 and 1 based on the user query generation algorithm Q n , n depends on the encryption complexity parameter at the beginning of the system, which can be 128, 192, 256, etc. The more bits, the better the encryption effect. The random sequence is used to calculate the data index value, which is request q1; the data query party encapsulates request q1 into a transaction and records it as TX1. The request q2 generated by the data query party includes the random sequence of q1 and the index i of the target data, which is XORed, that is, q2 = q1 XOR i, and then q2 is encapsulated as transaction TX2. After the user generates the request, it sends the request again to the intermediate node address calculated by the Bloom filter before. After the intermediate node receives transactions TX1 and TX2, it sends two different transactions to different accounting nodes 1 and 2 in turn.
[0118] 7. After accounting node 1 receives transaction TX1, it groups the random sequence based on the interval size of the index value. The interval size is defined as the binary number within an interval that can be mapped to an index value. The n-bit random sequence is divided into t groups, n / t corresponds to an interval, and the index value is calculated once for each n / t-bit sequence. The corresponding index value is obtained from the distributed database server to obtain the index data, and then each index data is XORed to obtain a1, that is, a1=E(data1)⊕E(data2)⊕……⊕E(data(t)), where E(data1), E(data2) and other encrypted data are other encrypted data stored in the distributed database. Because the index value here is calculated based on the random sequence, the other data obtained are randomly obtained and obtained based on the calculated index value.
[0119] After accounting node 2 receives transaction TX2, the processing flow is similar to that of receiving transaction TX1. However, since this request contains the index value of the target data, it returns a2=E(data1)⊕E(data2)⊕…⊕E(data(t))⊕E(datai), and both a1 and a2 response messages are returned to the intermediate node.
[0120] 8. After receiving the response messages a1 and a2, the intermediate node transmits them back to the data query party. After receiving the response messages, the data query party reconstructs c=a1 XOR a2 and obtains the target data E(datai) encrypted with the query party's public key. It decrypts the data with its own private key SK to obtain the target data, thus completing the keyword private information retrieval protocol process based on the alliance chain.
[0121] like Figure 5 As shown, the present invention provides a data query device based on a consortium chain, including: a generation module 501, used to generate a first request, and generate a second request based on a preset operation according to a target index value of target encrypted data in a target database and the first request; a processing module 502, used to send the first request and the second request to a corresponding accounting node through a target intermediate node; the target intermediate node and the accounting node are nodes in the consortium chain; obtaining a first response message and a second response message from the corresponding accounting node through the target intermediate node; obtaining the target encrypted data according to the first response message and the second response message; decrypting the target encrypted data to obtain decrypted data of the target encrypted data.
[0122] Optionally, the processing module 502 is also used to: determine the intermediate index node address according to the privacy keyword of the target encrypted data and a preset one-way mapping relationship; the intermediate index node address points to the target intermediate node; the target intermediate node stores the target index value; and obtain the target index value from the target intermediate node.
[0123] Optionally, the processing module 502 is specifically used to: based on the first Bloom filter, perform at least one round of updating on the first Bloom filter by mapping at least one round of hash function of the privacy keyword to obtain a second Bloom filter; and obtain the intermediate index node address according to the second Bloom filter.
[0124] Optionally, the preset operation is an exclusive OR logic operation; the generation module 501 is specifically used to: randomly generate a first request with N bits of data according to the number N of indexes of the encrypted data; wherein each bit of the N bits of data represents a corresponding index, and the different values of each bit represent whether the bit is the target index value that the data query party needs to obtain.
[0125] Optionally, the first response message is obtained by the accounting node processing the first encrypted data based on the preset operation; the second response message is obtained by the accounting node processing the second encrypted data based on the preset operation; the first encrypted data is the encrypted data corresponding to the first request obtained from the target database; the second encrypted data is the encrypted data corresponding to the second request obtained from the target database; the processing module 502 is specifically used to: obtain the target encrypted data based on the preset operation according to the first response message and the second response message.
[0126] Optionally, the generation module 501 is also used to: generate a data access request and send it to the data owner through the alliance chain; the data access request is used by the data owner to encrypt the data it owns with the public key of the data query party and store it in the target database.
[0127] Based on the same inventive concept, an embodiment of the present invention also provides a computer device, including a program or instructions. When the program or instructions are executed, the data query method based on the alliance chain provided in the embodiment of the present invention and any optional method are executed.
[0128] Based on the same inventive concept, an embodiment of the present invention also provides a computer-readable storage medium, including a program or instructions. When the program or instructions are executed, the data query method based on the alliance chain provided in the embodiment of the present invention and any optional method are executed.
[0129] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0130] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0131] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0132] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0133] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0134] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A data query method based on alliance chain, It is characterized in that include: The data query party determines the intermediate index node address according to the privacy keyword of the target encrypted data and the preset one-way mapping relationship; The intermediate index node address points to the target intermediate node; the target intermediate node stores the target index value; The data querying party obtains the target index value from the target intermediate node; The data querying party generates a first request, and generates a second request based on a preset operation according to a target index value of the target encrypted data in a target database and the first request; The preset operation is an XOR logic operation; The data querying party sends the first request and the second request to the corresponding accounting node through the target intermediate node; the target intermediate node and the accounting node are nodes in the alliance chain; The data querying party obtains a first response message and a second response message from the corresponding accounting node through the target intermediate node; The data querying party obtains the target encrypted data according to the first response message and the second response message; The data querying party decrypts the target encrypted data to obtain decrypted data of the target encrypted data; The data querying party generates a first request, including: The data query party randomly generates a first request with N bits of data according to the number N of indexes of the encrypted data; wherein each bit of the N bits of data represents a corresponding index, and the different values of each bit represent whether the bit is the target index value that the data query party needs to obtain.
2. The method according to claim 1, It is characterized in that The data querying party determines the intermediate index node address according to the privacy keyword of the target encrypted data and a preset one-way mapping relationship, including: The data querying party updates the first Bloom filter at least once based on the first Bloom filter by mapping at least one round of hash functions on the privacy keyword, thereby obtaining a second Bloom filter; The data querying party obtains the intermediate index node address according to the second Bloom filter.
3. The method according to claim 1, It is characterized in that The first response message is obtained by the accounting node processing the first encrypted data based on the preset operation; the second response message is obtained by the accounting node processing the second encrypted data based on the preset operation; The first encrypted data is encrypted data corresponding to the first request obtained from the target database; the second encrypted data is encrypted data corresponding to the second request obtained from the target database; The data querying party obtains the target encrypted data according to the first response message and the second response message, including: The data querying party obtains the target encrypted data according to the first response message and the second response message based on the preset operation.
4. The method according to claim 1 or 2, It is characterized in that Before the data querying party generates the first request, the method further includes: The data query party generates a data access request and sends it to the data owner through the alliance chain; the data access request is used by the data owner to encrypt the data it owns with the public key of the data query party and store it in the target database.
5. A data query method based on alliance chain, It is characterized in that include: The target intermediate node sends the target index value of the target encrypted data in the target database to the data query party; The target index value is stored in the target intermediate node; The intermediate index node address points to the target intermediate node; the intermediate index node address is determined by the data query party according to the privacy keyword of the target encrypted data in accordance with a preset one-way mapping relationship; The target intermediate node obtains the first request and the second request from the data query party; The second request is generated based on a preset operation according to the target index value of the target encrypted data in the target database and the first request; the target intermediate node sends the first request and the second request to the accounting node; the target intermediate node and the accounting node are nodes in the alliance chain; the preset operation is an exclusive OR logic operation; the first request is a request with N bits of data randomly generated by the data query party according to the number N of indexes of the encrypted data; wherein each bit in the N bits of data represents a corresponding index, and the different values of each bit represent whether the bit is the target index value that the data query party needs to obtain; The target intermediate node obtains a first response message and a second response message from the accounting node; The target intermediate node sends the first response message and the second response message to the data querying party.
6. The method according to claim 5, It is characterized in that The accounting nodes include a first accounting node and a second accounting node; The target intermediate node sends the first request and the second request to the accounting node, including: The target intermediate node sends the first request to the first accounting node; the target intermediate node sends the second request to the second accounting node; The target intermediate node obtains the first response message and the second response message from the accounting node, including: The target intermediate node obtains the first response message from the first accounting node; the target intermediate node obtains the second response message from the second accounting node.
7. A data query method based on alliance chain, It is characterized in that include: The accounting node obtains the first request and the second request from the data query party through the target intermediate node; The second request is generated based on the target index value of the target encrypted data in the target database and the first request based on a preset operation; the target intermediate node and the accounting node are nodes in the alliance chain; the target intermediate node is used to store the target index value of the target encrypted data in the target database; the intermediate index node address points to the target intermediate node; the intermediate index node address is determined by the data query party according to the privacy keyword of the target encrypted data according to a preset one-way mapping relationship; the preset operation is an exclusive OR logic operation; the first request is a request with N-bit data randomly generated by the data query party according to the number N of indexes of the encrypted data; wherein each bit in the N-bit data represents a corresponding index, and the different values of each bit represent whether the bit is the target index value that the data query party needs to obtain; The accounting node obtains first encrypted data from the target database according to the first request, and obtains a first response message based on the first encrypted data; and the accounting node obtains second encrypted data from the target database according to the second request, and obtains a second response message based on the second encrypted data; the second encrypted data includes the target encrypted data; The accounting node sends the first response message and the second response message to the target intermediate node.
8. The method according to claim 7, It is characterized in that The first request and the second request both include N-bit data; wherein each bit of the N-bit data represents a corresponding index, and different values of each bit represent whether the bit is a target index value to be obtained by the data querying party; the accounting node obtains first encrypted data from the target database according to the first request, and obtains a first response message based on the first encrypted data, including: The accounting node divides the first request into a plurality of first index values; the accounting node obtains, according to the N-bit data in the first request, a plurality of first sub-encrypted data corresponding to the plurality of first index values in the first encrypted data; the accounting node obtains the first response message based on the preset operation according to the plurality of first sub-encrypted data; The accounting node obtains second encrypted data from the target database according to the second request, and obtains a second response message based on the second encrypted data, including: The accounting node divides the second request into a plurality of second index values; the accounting node obtains a plurality of second sub-encrypted data corresponding to the plurality of second index values in the second encrypted data according to the N-bit data in the second request; the plurality of second sub-encrypted data includes the target encrypted data; The accounting node obtains the second response message according to the multiple second sub-encrypted data based on the preset operation.
9. A data query device based on alliance chain, It is characterized in that include: A generating module, configured to generate a first request, and generate a second request based on a preset operation according to a target index value of the target encrypted data in the target database and the first request; The preset operation is an XOR logic operation; A processing module, configured to determine an intermediate index node address according to a privacy keyword of the target encrypted data and a preset one-way mapping relationship; the intermediate index node address points to a target intermediate node; the target intermediate node stores a target index value; Obtaining the target index value from the target intermediate node; The processing module is further configured to send the first request and the second request to a corresponding accounting node through the target intermediate node; the target intermediate node and the accounting node are nodes in the alliance chain; obtain a first response message and a second response message from the corresponding accounting node through the target intermediate node; and obtain the target encrypted data according to the first response message and the second response message; Decrypting the target encrypted data to obtain decrypted data of the target encrypted data; The generation module is used to randomly generate a first request with N bits of data according to the number N of indexes of the encrypted data; wherein each bit of the N bits of data represents a corresponding index, and the different values of each bit represent whether the bit is the target index value that the data query party needs to obtain.
10. A computer device, It is characterized in that The method comprises a program or an instruction. When the program or the instruction is executed, the method according to any one of claims 1 to 4, 5 to 6, or 7 to 8 is executed.
Citation Information
Patent Citations
Private data processing method and device, equipment and medium
CN111125763A