Privacy-preserving database JOIN type query method, system and device based on homomorphic secret sharing
By adopting homomorphic secret sharing and inadvertent sorting methods in cloud database JOIN type query, a secure connection protocol is designed, which solves the problems of output multi-attribute alignment and communication overhead, and realizes efficient and secure database query and aggregation analysis.
Patent Information
- Application Number
- CN202410488387.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-23
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-04-23
AI Technical Summary
The prior art is difficult to meet the alignment requirements of output multi-attributes in cloud database JOIN type query, and there are problems with large communication and computing overhead.
A privacy-protected database JOIN type query method based on homomorphic secret sharing is adopted, and combined with the characteristics of inadvertent sorting and homomorphic secret sharing, a secure connection protocol is designed to avoid communication overhead in the matching stage.
It realizes efficient database query and aggregation analysis while ensuring data privacy, reduces communication and computing complexity, improves query efficiency, and maintains the compactness of the output table.
Smart Images

Figure CN118536150B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of cloud data protection, and specifically relates to a privacy protection database JOIN type query method, system and device based on homomorphic secret sharing. Background Art
[0002] With the development and increasing maturity of cloud computing, more and more institutions or individuals tend to upload their data to the cloud in an encrypted manner. Database owners can perform relevant queries in the cloud, thereby releasing local computing power and storage space. On this basis, a common practical requirement is that there are multiple data sets on the cloud server, each uploaded by a different owner. Data owners do not trust each other, but want to perform queries on the same attributes of the data set, such as measuring the effectiveness of advertisements, which can be calculated by calculating the intersection of user information that browses the advertisement (held by the advertisement sender) and user information that completes the corresponding transaction (held by the merchant). During the query execution process, task information other than the query content must not be leaked to other entities.
[0003] At the same time, in the query task, the traditional method regards the private set intersection protocol as the building block of the secret database Join. Although the private set intersection protocol can be used to identify the same elements, the private set intersection only requires the output of the same elements, which corresponds to the join query, that is, only the same connection key elements are output. In order to obtain more information, in actual queries, it is often necessary to output other attributes or the entire connection table. Therefore, the private set intersection method does not meet the requirements of data alignment.
[0004] In addition, the existing technology uses traditional secret sharing to construct the protocol, which makes it inevitable to call the circuit conversion protocol and the comparison protocol during the connection matching phase, resulting in the need for a large amount of communication and calculation.
[0005] Therefore, how to provide an efficient and secure security connection protocol that can not only meet the alignment requirements of multiple output attributes but also reduce communication and computation is an urgent problem to be solved. Summary of the invention
[0006] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and to provide a privacy-preserving database JOIN type query method, system and device based on homomorphic secret sharing. By combining the characteristics of oblivious sorting and homomorphic secret sharing, a secure connection protocol is designed to avoid the communication overhead in the matching stage.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] In a first aspect, the present invention provides a privacy-preserving database JOIN type query method based on homomorphic secret sharing, comprising a setting phase and a query phase;
[0009] Setup phase:
[0010] Generate the Paillier encrypted public key N and private key d, send the private key d to i cloud servers in the form of additive secret sharing, and the cloud servers obtain the homomorphic secret sharing private key ek i ; Perform Paillier encryption on the private key d to obtain the encrypted private key E(d); package the public key N and the encrypted private key E(d) as the homomorphic secret sharing public key pk(N,E(d)) and send it to the client;
[0011] Query phase:
[0012] The client converts each element x in his table into an encrypted value I through a homomorphic secret algorithm. x , get the encrypted customer table;
[0013] Upload the encrypted customer table to the cloud server;
[0014] The cloud server receives the query instruction and starts to execute the query task; the cloud server shares the private key ek according to the homomorphic secret i , the encrypted value I in the encrypted customer table x The local part is converted into secret shares, and the cloud servers obtain their own secret share tables; each cloud server executes the secure connection protocol according to the encrypted customer table and secret share table it has, and obtains the secret share of the connection table respectively;
[0015] The queryer reconstructs the connection table based on the secret shares of each connection table.
[0016] As a preferred technical solution, the number of the cloud servers is 2, namely P0 and P1; the additive secret sharing includes secret distribution and secret reconstruction;
[0017] Secret distribution: set up a ring The length is l bits; the secret administrator randomly chooses the value Then sr is sent to P0 and r is sent to P1, where sr and r are secret shares, denoted as
[0018] Secret reconstruction: P0 will share the secret Sent to the secret manager, P1 will share the secret Sent to the secret keeper, who calculates Reconstruct to get the secret s.
[0019] As a preferred technical solution, the conversion into an encrypted value I by a homomorphic secret algorithmx ,include:
[0020] The customer needs to encrypt each element x in his table through Paillier to obtain E(x), and encrypt dx through Paillier's additive homomorphism to obtain E(dx), as shown below:
[0021] E(dx)=r N E(d) x
[0022] Convert each element x into an encrypted value I x (E(x),E(dx)).
[0023] As a preferred technical solution, the secure connection protocol includes an alignment operation based on inadvertent sorting and a matching operation based on homomorphic secret sharing;
[0024] The alignment operation based on inadvertent sorting includes the following steps:
[0025] Sort all the elements in the encrypted customer table and stack the same elements;
[0026] Using radix sorting, the integers in the encrypted customer table are cut into different numbers according to the number of digits, and then each digit is compared separately to intercept the precursor of the connection table construction part;
[0027] The matching operation based on homomorphic secret sharing includes the following steps:
[0028] Match each row in the precursor of the connection table construction part to filter out the elements with intersection;
[0029] The parts with intersection are retained, and the parts without intersection are cleared to zero, and the secret share of the connection table is obtained.
[0030] As a preferred technical solution, the number of the cloud servers is 2, and the encrypted customer tables thereof are denoted as sets A and B; the alignment operation based on inadvertent sorting further includes:
[0031] Concatenate the encrypted customer tables of the two cloud servers into an array B||A||B, and sort the array B||A||B to generate a permutation ρ;
[0032] Construct array D = (d n ||0 n ||-d n), correspond each 0 in array D to each element in set A in turn; apply permutation ρ to array D, and perform prefix sum on the permuted array D; perform inverse permutation on array D after prefix sum, and correspond 0 in the original array D to elements of set A. If the original array D and set A have an intersection, assign d to the 0 in a specific sequence of array D after prefix sum, and keep the values of other elements unchanged;
[0033] The specific sequence includes a d||0||-d sequence;
[0034] where d n Represents the concatenation of n private key data.
[0035] As a preferred technical solution, the number of the cloud servers is 2, the connection table construction part precursor includes table A and table B; retaining the part with intersection and clearing the part without intersection includes the following steps:
[0036] Call the homomorphic secret sharing multiplication operation on table A, multiplying array D with each attribute of table A row by row Where D[j] represents the j-th element of array D, Represents the homomorphic secret sharing form of the element in the jth row and ith column of table A;
[0037] Call the secret share conversion operation of state secret sharing on table B to convert the encrypted value of table B into a secret share; reconstruct the array B′=B||0||-B to align table B with table A;
[0038] Get the secret share for the join table.
[0039] As a preferred technical solution, after the encrypted customer table is uploaded, the client deletes the encrypted customer table locally and entrusts all storage tasks to the cloud server; the cloud server only provides storage function in idle state.
[0040] As a preferred technical solution, the query stage also includes an aggregation analysis step, specifically:
[0041] Perform single attribute calculation on the connection table, execute the aggregation function in one column of the connection table, and output the result;
[0042] Perform calculations between different attributes of the connection table, operate one column in the connection table with another column, and output the results.
[0043] In a second aspect, the present invention further provides a privacy-preserving database JOIN type query system based on homomorphic secret sharing, which is applied to the privacy-preserving database JOIN type query method based on homomorphic secret sharing, and includes a setting module and a query module;
[0044] The setup module is used in the setup phase and includes:
[0045] Generate the Paillier encrypted public key N and private key d, send the private key d to i cloud servers in the form of additive secret sharing, and the cloud servers obtain the homomorphic secret sharing private key ek i ; Perform Paillier encryption on the private key d to obtain the encrypted private key E(d); package the public key N and the encrypted private key E(d) as the homomorphic secret sharing public key pk(N,E(d)) and send it to the client;
[0046] The query module is used in the query phase and includes:
[0047] The client converts each element x in his table into an encrypted value I through a homomorphic secret algorithm. x , get the encrypted customer table;
[0048] Upload the encrypted customer table to the cloud server;
[0049] The cloud server receives the query instruction and starts to execute the query task; the cloud server shares the private key ek according to the homomorphic secret i , the encrypted value I in the encrypted customer table x The local part is converted into secret shares, and the cloud servers obtain their own secret share tables; each cloud server executes the secure connection protocol according to the encrypted customer table and secret share table it has, and obtains the secret share of the connection table respectively;
[0050] The queryer reconstructs the connection table based on the secret shares of each connection table.
[0051] In a third aspect, the present invention provides an electronic device, the electronic device comprising:
[0052] at least one processor; and,
[0053] a memory communicatively connected to the at least one processor; wherein,
[0054] The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the privacy-preserving database JOIN type query method based on homomorphic secret sharing.
[0055] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0056] (1) The present invention adopts the technical means of oblivious sorting and homomorphic secret sharing, which can achieve efficient database query and aggregate analysis under the premise of ensuring data privacy. Compared with traditional secret sharing schemes and ABY3 protocol, the present invention reduces communication overhead and computational complexity, and improves query efficiency; at the same time, the present invention maintains the compactness of the output table when extending the intersection of privacy sets to secret connections, eliminating the overhead caused by the matching stage.
[0057] (2) The security of the present invention relies on the underlying structure of homomorphic encryption, which can protect the privacy information in database queries under the outsourcing framework. The present invention does not need to adopt a highly efficient but insecure distributed encryption scheme, avoids the exposure of plaintext data and the leakage of sensitive information, and effectively protects personal privacy.
[0058] (3) The present invention extends the secure connection protocol to the case of multi-table connection by constructing a specific intermediate connection table, which is applicable to more complex database query scenarios. At the same time, the design of the aggregation analysis solution can also cope with the calculation requirements of nonlinear aggregation functions, providing a wider range of functional support. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0060] Figure 1 It is a flowchart of a privacy protection database JOIN type query method based on homomorphic secret sharing according to an embodiment of the present invention;
[0061] Figure 2 A comparison diagram of different security paradigms in an embodiment of the present invention;
[0062] Figure 3 A schematic diagram of radix sorting according to an embodiment of the present invention;
[0063] Figure 4 A schematic diagram of single-bit careless sorting based on radix sorting according to an embodiment of the present invention;
[0064] Figure 5 A schematic diagram of a secure connection sub-protocol according to an embodiment of the present invention;
[0065] Figure 6 It is a schematic diagram of a connection table construction part before the matching stage of an embodiment of the present invention;
[0066] Figure 7 A schematic diagram showing the connection of an embodiment of the present invention;
[0067] Figure 8 This is a structural diagram of a privacy-preserving database JOIN type query system based on homomorphic secret sharing according to an embodiment of the present invention;
[0068] Fig. 9 4 is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0070] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0071] The terms mentioned in this embodiment are explained as follows:
[0072] (1) Secure multi-party computation: a process in which multiple parties jointly compute a function based on their own private inputs to obtain outputs. This process needs to ensure the privacy of the inputs and outputs of each party, as well as the correctness of the outputs.
[0073] (2) Private set intersection: refers to the intersection of the data held by the participants without revealing any additional information. Here, additional information refers to any information other than the data intersection of each participant.
[0074] (3) Paillier semi-homomorphic encryption: It is a probabilistic public key encryption system. Based on the difficult problem of composite residue classes, this encryption algorithm is a homomorphic encryption that satisfies addition and multiplication homomorphism.
[0075] (4) Homomorphic Secret Sharing: It combines the features of secret sharing and homomorphic encryption. Once the secret is distributed to the calculation, whether it is addition or multiplication, the calculation parties can perform the calculation independently without any interaction. At the same time, it avoids the ciphertext expansion of homomorphic encryption and maintains the concise form of secure multi-party computing.
[0076] Example:
[0077] See also Figure 1 ,This embodiment provides a privacy-preserving database JOIN type query method based on homomorphic secret sharing, including a setting phase and a query phase;
[0078] S1. Setting stage:
[0079] Generate Paillier-encrypted public key N and private key d, send private key d to two cloud servers in the form of additive secret sharing, and the cloud servers obtain the homomorphic secret sharing private key. The two servers hold ek0 and ek1 respectively; perform Paillier encryption on private key d to obtain encrypted private key E(d); package public key N and encrypted private key E(d) as homomorphic secret sharing public key pk(N,E(d)) and send them to the client;
[0080] The present invention adopts a homomorphic encryption algorithm. Homomorphic secret sharing is a new type of cryptographic primitive that combines the characteristics of secret sharing and homomorphic encryption. Unlike traditional additive secret sharing, once the data is distributed to different participants, no interaction is required. The trusted third party generates a public key pk and a private key d. The data holder encrypts the private data with the public key pk and sends it to the computing party. The computing party can locally calculate addition and multiplication based on the private key share it holds. Homomorphic secret sharing contains two types of values: one is the additive secret share M x , one is the value I encrypted by some encryption scheme x . The encrypted value can be converted locally into a secret share. Figure 2 As shown in Figure 1, compared with fully homomorphic encryption, the output remains concise; compared with additive secret sharing, no additive interaction is required during calculation. Homomorphic secret sharing supports four types of operations:
[0081] Add up the secret shares: M z =M x +M y ;
[0082] Add the encrypted value: I z =I x +I y ;
[0083] Multiply the secret share and the encrypted value: M z =I x ·M y ;
[0084] Secret share conversion: M z ←I x .
[0085] Specifically, in this embodiment, the Paillier algorithm is used, which is based on the composite remainder class problem, satisfies addition homomorphism and multiplication homomorphism, and has very efficient runtime performance. In addition to realizing basic encryption of data, this algorithm can also ensure that operations are performed directly on ciphertext, and the results after decryption are the same as those of operations on plaintext.
[0086] See also Figure 1 This embodiment considers the scenario of database outsourcing, where the client C uploads the data table it holds to the cloud server S, and the server is responsible for providing storage space and executing query tasks. In order to facilitate understanding of the implementation of the present invention, this embodiment sets up two cloud servers, namely P0 and P1, where the received customer tables and their value sets are both called A and B. The customer table, taking A as an example, is shown in Table 1:
[0087] Table 1
[0088] ID <![CDATA[A 1 ]]> <![CDATA[A 2 ]]> … <![CDATA[A n ]]> 2 14 1 … 34 4 3 21 … 47 6 7 7 … 12 9 8 23 … 9
[0089] Data is generally represented as a table in a database, consisting of a join key and other attributes. We use (ID, A 1 ,A 2 ,…,A n ) indicates user C A A database table, where ID represents the connection key, A i Indicates other attributes.
[0090] It should be noted that in order to share the private key d with the cloud server, secret sharing is required. Secret sharing is a basic technical module used in secure multi-party computing, which mainly includes two stages: secret distribution and secret reconstruction. There are secret managers responsible for secret distribution and reconstruction and secret participants who save secret shares.
[0091] With ring Secret Value Its length is l bits. The secret distribution and reconstruction operations of the secret sharing scheme are: Secret distribution: The secret administrator randomly selects Then sr is sent to P0 and r is sent to P1, where sr and r are usually called secret shares and are recorded as Secret reconstruction: P0 will share the secret Sent to the secret manager, P1 will share the secret Sent to the secret keeper, who calculates Reconstruct the secret s. The secret share of the secret value s is represented in the form of , where the subscripts 0 and 1 indicate that the secret share is held by participants P0 and P1 respectively.
[0092] In particular, this embodiment requires arithmetic operations such as addition and multiplication to be performed on the secret shares. Assume that secret values a and b have been distributed to P0 and P1 through arithmetic secret sharing. At this time, P0 has P1 has For addition, P0 and P1 need to calculate the secret share c = a + b For multiplication, P0 and P1 need to calculate the secret share c = a·b For addition operations, P0 computes locally P1 is calculated locally It can be verified
[0093] Specifically, under the framework of this embodiment, the private keys ek0 and ek1 of the homomorphic secret sharing held by the cloud server need to satisfy ek0+ek1=d.
[0094] S2, query phase:
[0095] S21. The client converts each element x in his table into an encrypted value I through a homomorphic secret algorithm. x , get the encrypted customer table;
[0096] Specifically, each customer first needs to encrypt each element x in his table through Paillier to obtain E(x). In addition, he needs to encrypt dx to obtain E(dx). This can be done through Paillier's additive homomorphism, that is, calculating E(dx) = r N E(d) x For each element x, a transformation x→(E(x), E(dx)) is required. In this embodiment, I x to represent the tuple (E(x), E(dx)).
[0097] S22, uploading the encrypted customer table to the cloud server;
[0098] Each customer uploads the encrypted table to the two cloud servers. At this time, the two cloud servers have the same copy. After that, the client can delete the data locally and entrust all storage tasks to the cloud server. The cloud server only provides storage function in idle state. Since the customer's table is encrypted, the security of customer data stored in the cloud is guaranteed. Once the query request from the inquirer is received, the query task will be executed. See step S23 for details.
[0099] S23, the cloud server receives the query instruction and starts to execute the query task; the cloud server shares the private key ek according to the homomorphic secret i , the encrypted value I in the encrypted customer table xThe local data is converted into secret shares, and the cloud servers obtain their own secret share tables. Each cloud server executes a secure connection protocol based on the encrypted customer table and secret share table it possesses, and obtains the secret shares of the connection table respectively.
[0100] Among them, this embodiment combines the characteristics of careless sorting and homomorphic secret sharing to design a secure connection protocol. The following is a detailed description of the secure connection protocol. For connection, it can actually be divided into two parts, one is alignment and the other is matching. Alignment is to make all possible identical elements mapped or stacked in the same position, which can reduce the number of comparisons. Matching is to identify equal elements.
[0101] In particular, the alignment operation based on inadvertent sorting includes the following steps:
[0102] Sort all the elements in the encrypted customer table and stack the same elements;
[0103] The encrypted integers in the customer table are cut into different numbers according to the number of digits by using radix sorting, and then each digit is compared separately to intercept the connection table construction part of the precursor.
[0104] In actual query, in addition to the need to output the same elements, other attributes or the entire connection table are often required to be output. In this embodiment, inadvertent sorting is used to achieve alignment. The principle is that after all elements are sorted, the same elements always appear continuously. This feature can be used to pile up the same elements together.
[0105] Furthermore, radix sorting is used to sort the secret sharing shares. The principle of radix sorting is to cut the integer into different numbers according to the number of digits, and then compare each digit separately. If the integer is represented in binary form, it only needs to implement radix sorting of 0 and 1, such as Figure 3 As shown. Treat each column in binary form as an array By construction Auxiliary array, and use the following formula to calculate the permutation array in is an identical copy of the original array, It is the inverse array of the original array; for Prefix and array of arrays, for The array is initially Array of prefix sums of maximum values.
[0106]
[0107] Then the array will be permuted Acting on arrays Sorting can be achieved. Since the above formula only involves addition and multiplication, it can be naturally converted into the implementation form of secret sharing, namely:
[0108]
[0109] For further information, see Figure 4 and Figure 5 In order to achieve compact output, it is necessary to align the connection keys as well as other attributes. Specifically, for A and B, the alignment operation based on inadvertent sorting in this embodiment also includes:
[0110] Concatenate the encrypted customer tables of the two cloud servers into an array B||A||B, and sort the array B||A||B to generate a permutation ρ;
[0111] Construct array D = (d n ||0 n ||-d n ), correspond each 0 in array D to each element in set A in turn; apply permutation ρ to array D, and perform prefix sum on the permuted array D; perform inverse permutation on array D after prefix sum, and correspond 0 in the original array D to elements of set A. If the original array D and set A have an intersection, assign d to the 0 in a specific sequence of array D after prefix sum, and keep the values of other elements unchanged;
[0112] The specific sequence includes a d||0||-d sequence, where d n Represents the concatenation of n private key data.
[0113] This part can be used as the construction part of the connection table. In this case, the output of the connection table is kept compact. The specific implementation steps are as follows: Figure 5 shown.
[0114] In particular, after alignment is achieved, this embodiment needs to match each row to filter out elements with intersections. Figure 6 As shown, A i represents the i-th attribute of table A, It is attribute A i The jth element of , ID is the common attribute of the two tables, that is, the connection key. Here, the improved privacy set intersection PSI is used. Compared with the traditional privacy set intersection, this embodiment extends PSI to the secret connection while maintaining the compactness of the output table, eliminating the overhead caused by the matching stage, specifically eliminating the overhead of performing secret sharing multiplication, as shown in the following steps:
[0115] The matching operation based on homomorphic secret sharing includes the following steps:
[0116] Match each row in the precursor of the connection table construction part to filter out the elements with intersection;
[0117] The parts with intersection are retained, and the parts without intersection are cleared to zero, and the secret share of the connection table is obtained.
[0118] Furthermore, the connection table is filtered and cleaned, that is, the parts with intersections are retained, and the parts without intersections are cleared.
[0119] Filter table A: Since the 0 in array D is originally aligned with the elements in table A, the multiplication operation of homomorphic secret sharing is called to multiply array D and each attribute of table A row by row That is, the elements with intersection are retained, and the elements without intersection are set to 0, where D[j] represents the j-th element of array D. Represents the homomorphic secret sharing form of the element in the jth row and ith column of table A.
[0120] Filtering table B: Array B is slightly different, because array D only marks the elements that have an intersection with table A, so table B needs to be aligned. First, the secret share conversion operation of state secret sharing is called to convert the encrypted value of table B into a secret share. Similar to the alignment step, a new array B′=B||0||-B is reconstructed. After executing the same process as the alignment step, table B is aligned with table A, and the elements that do not have an intersection are set to 0.
[0121] At this point, the computing party has completed the construction of the secret share of the connection table, such as Figure 7 shown.
[0122] S24. The inquirer reconstructs the connection table according to the secret shares of each connection table.
[0123] In addition to the secure connection protocol, some other embodiments also support two major types of operations. The first type allows aggregate analysis to be performed on a certain attribute in the connection table, and the second type of aggregate query allows calculations between different attributes.
[0124] For the first category, specifically:
[0125] Perform single attribute calculation on the joined table, execute the aggregate function in one column of the joined table, and output the result.
[0126] For ease of understanding, this embodiment may execute the following instructions:
[0127] SELECT MAX(X.column2)FROM X JOIN Y ON X.column=Y.column
[0128] This SQL query is a JOIN query that combines two tables, X and Y, and tries to find the maximum value of column2 from both tables.
[0129] For the second category, specifically:
[0130] Perform calculations between different attributes of the connection table, operate one column in the connection table with another column, and output the results.
[0131] Suppose there are two tables: The Orders table contains information about orders, including the product ID and quantity of each order. The Products table contains information about products, including product ID and price. In order to calculate the total value of each order, you can perform a joint analysis by joining these two tables. The following SQL query is shown:
[0132] SELECT Orders.Product-ID,
[0133] Orders.Quantity*Products.Price AS total_price
[0134] FROM Orders
[0135] JOIN Products ON Orders.Product-ID=Products.product-ID;
[0136] Get the total value of each order by multiplying the Quantity column by the Price column for each row.
[0137] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.
[0138] Based on the same idea as the privacy-preserving database JOIN type query method based on homomorphic secret sharing in the above-mentioned embodiment, the present invention also provides a privacy-preserving database JOIN type query system based on homomorphic secret sharing, which can be used to execute the above-mentioned privacy-preserving database JOIN type query method based on homomorphic secret sharing. For ease of explanation, the structural diagram of the embodiment of the privacy-preserving database JOIN type query system based on homomorphic secret sharing only shows the parts related to the embodiment of the present invention. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.
[0139] See also Figure 8 In another embodiment of the present application, a privacy-preserving database JOIN type query system 10 based on homomorphic secret sharing is provided, the system comprising a setting module 11 and a query module 12;
[0140] The setting module 11 is used for the setting stage and includes:
[0141] Generate the Paillier encrypted public key N and private key d, send the private key d to i cloud servers in the form of additive secret sharing, and the cloud servers obtain the homomorphic secret sharing private key ek i ; Perform Paillier encryption on the private key d to obtain the encrypted private key E(d); package the public key N and the encrypted private key E(d) as the homomorphic secret sharing public key pk(N,E(d)) and send it to the client;
[0142] The query module 12 is used in the query phase and includes:
[0143] The client converts each element x in his table into an encrypted value I through a homomorphic secret algorithm. x , get the encrypted customer table;
[0144] Upload the encrypted customer table to the cloud server;
[0145] The cloud server receives the query instruction and starts to execute the query task; the cloud server shares the private key ek according to the homomorphic secret i , the encrypted value I in the encrypted customer table x The local part is converted into secret shares, and the cloud servers obtain their own secret share tables; each cloud server executes the secure connection protocol according to the encrypted customer table and secret share table it has, and obtains the secret share of the connection table respectively;
[0146] The queryer reconstructs the connection table based on the secret shares of each connection table.
[0147] It should be noted that the privacy-preserving database JOIN type query system based on homomorphic secret sharing of the present invention corresponds one-to-one to the privacy-preserving database JOIN type query method based on homomorphic secret sharing of the present invention. The technical features and beneficial effects described in the above-mentioned embodiment of the privacy-preserving database JOIN type query method based on homomorphic secret sharing are applicable to the embodiment of the privacy-preserving database JOIN type query method based on homomorphic secret sharing. For specific contents, please refer to the description in the embodiment of the method of the present invention, which will not be repeated here. This is hereby declared.
[0148] In addition, in the implementation of the privacy-preserving database JOIN type query system based on homomorphic secret sharing in the above-mentioned embodiment, the logical division of each program module is only an example. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, for example, for the configuration requirements of the corresponding hardware or the convenience of software implementation. That is, the internal structure of the privacy-preserving database JOIN type query system based on homomorphic secret sharing is divided into different program modules to complete all or part of the functions described above.
[0149] See also Fig. 9 In one embodiment, an electronic device that implements a privacy-preserving database JOIN type query method based on homomorphic secret sharing is provided. The electronic device 20 may include a first processor 21, a first memory 22 and a bus, and may also include a computer program stored in the first memory 22 and executable on the first processor 21, such as a privacy-preserving database JOIN type query program 23 based on homomorphic secret sharing.
[0150] Among them, the first memory 22 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the first memory 22 can be an internal storage unit of the electronic device 20, such as a mobile hard disk of the electronic device 20. In other embodiments, the first memory 22 can also be an external storage device of the electronic device 20, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 20. Further, the first memory 22 can also include both an internal storage unit of the electronic device 20 and an external storage device. The first memory 22 can not only be used to store application software and various types of data installed in the electronic device 20, such as the code of the privacy protection database JOIN type query program 23 based on homomorphic secret sharing, but also can be used to temporarily store data that has been output or is to be output.
[0151] In some embodiments, the first processor 21 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The first processor 21 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes various functions and processes data of the electronic device 20 by running or executing programs or modules stored in the first memory 22, and calling data stored in the first memory 22.
[0152] Fig. 9 Only an electronic device with components is shown, and those skilled in the art will understand that Fig. 9 The structure shown does not constitute a limitation on the electronic device 20 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0153] The privacy protection database JOIN type query program 23 based on homomorphic secret sharing stored in the first memory 22 of the electronic device 20 is a combination of multiple instructions. When running in the first processor 21, it can achieve:
[0154] Setup phase:
[0155] Generate the Paillier encrypted public key N and private key d, send the private key d to i cloud servers in the form of additive secret sharing, and the cloud servers obtain the homomorphic secret sharing private key ek i ; Perform Paillier encryption on the private key d to obtain the encrypted private key E(d); package the public key N and the encrypted private key E(d) as the homomorphic secret sharing public key pk(N,E(d)) and send it to the client;
[0156] Query phase:
[0157] The client converts each element x in his table into an encrypted value I through a homomorphic secret algorithm. x , get the encrypted customer table;
[0158] Upload the encrypted customer table to the cloud server;
[0159] The cloud server receives the query instruction and starts to execute the query task; the cloud server shares the private key ek according to the homomorphic secret i , the encrypted value I in the encrypted customer table xThe local part is converted into secret shares, and the cloud servers obtain their own secret share tables; each cloud server executes the secure connection protocol according to the encrypted customer table and secret share table it has, and obtains the secret shares of the connection table respectively;
[0160] The queryer reconstructs the connection table according to the secret share of each connection table. Furthermore, if the module / unit integrated in the electronic device 20 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0161] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0162] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0163] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A privacy-preserving database JOIN type query method based on homomorphic secret sharing, characterized in that: It includes a setup phase and a query phase; Setup phase: Generate the Paillier encrypted public key N and private key d, send the private key d to i cloud servers in the form of additive secret sharing, and the cloud servers obtain the homomorphic secret sharing private key ek i ; Perform Paillier encryption on the private key d to obtain the encrypted private key E(d); package the public key N and the encrypted private key E(d) as the homomorphic secret sharing public key pk(N, E(d)) and send it to the client; Query phase: The client converts each element x in his table into an encrypted value I through a homomorphic secret algorithm. x , get the encrypted customer table; Upload the encrypted customer table to the cloud server; The cloud server receives the query instruction and starts to execute the query task; The cloud server shares the private key ek based on the homomorphic secret i , the encrypted value I in the encrypted customer table x The local data is converted into secret shares, and the cloud servers obtain their own secret share tables; each cloud server executes a secure connection protocol according to the encrypted customer table and secret share table it possesses, and obtains the secret shares of the connection table respectively; the secure connection protocol includes an alignment operation based on inadvertent sorting and a matching operation based on homomorphic secret sharing; The alignment operation based on inadvertent sorting includes the following steps: Sort all the elements in the encrypted customer table and stack the same elements; Using radix sorting, the integers in the encrypted customer table are cut into different numbers according to the number of digits, and then each digit is compared separately to intercept the precursor of the connection table construction part; The matching operation based on homomorphic secret sharing includes the following steps: Match each row in the precursor of the connection table construction part to filter out the elements with intersection; Keep the parts with intersection, clear the parts without intersection, and obtain the secret share of the connection table; The queryer reconstructs the connection table based on the secret shares of each connection table.
2. According to claim 1, the privacy protection database JOIN type query method based on homomorphic secret sharing is characterized in that: The number of the cloud servers is 2, namely P0 and P1; the additive secret sharing includes secret distribution and secret reconstruction; Secret distribution: set a ring The length is l bits; the secret administrator randomly chooses the value Then sr is sent to P0 and r is sent to P1, where sr and r are secret shares, denoted as Secret reconstruction: P0 will share the secret Sent to the secret manager, P1 will share the secret Sent to the secret keeper, who calculates Reconstruct to get the secret s.
3. The privacy protection database JOIN type query method based on homomorphic secret sharing according to claim 1 is characterized in that: The conversion into an encrypted value I by a homomorphic secret algorithm x ,include: The customer needs to encrypt each element x in his table through Paillier to obtain E(x), and encrypt dx through Paillier's additive homomorphism to obtain E(dx), as shown below: E(dx)=r N E(d) x Convert each element x into an encrypted value I x (E(x), E(dx)).
4. According to claim 1, the privacy protection database JOIN type query method based on homomorphic secret sharing is characterized in that: The number of the cloud servers is 2, and the encrypted customer tables are denoted as sets A and B; the alignment operation based on inadvertent sorting also includes: Concatenate the encrypted customer tables of the two cloud servers into an array B||A||B, and sort the array B||A||B to generate a permutation ρ; Construct array D = (d n ||0 n ||-d n ), correspond each 0 in array D to each element in set A in turn; apply permutation ρ to array D, and perform prefix sum on the permuted array D; perform inverse permutation on array D after prefix sum, and correspond 0 in the original array D to elements of set A. If the original array D and set A have an intersection, assign d to the 0 in a specific sequence of array D after prefix sum, and keep the values of other elements unchanged; The specific sequence includes a d||0||-d sequence; where d n Represents the concatenation of n private key data.
5. According to the privacy protection database JOIN type query method based on homomorphic secret sharing according to claim 1, it is characterized in that: The number of the cloud servers is 2, the connection table construction part precursor includes table A and table B; retaining the part with intersection and clearing the part without intersection includes the following steps: Call the homomorphic secret sharing multiplication operation on table A, multiplying array D with each attribute of table A row by row Where D[j] represents the j-th element of array D, Represents the homomorphic secret sharing form of the element in the jth row and ith column of table A; The secret share conversion operation of the call state secret sharing is used to convert the encrypted value of table B into a secret share; the array B′=B||0||-B is reconstructed to align table B with table A; Get the secret share for the join table.
6. The privacy protection database JOIN type query method based on homomorphic secret sharing according to claim 1 is characterized in that: After the encrypted customer table is uploaded, the customer deletes the encrypted customer table locally and delegates all storage tasks to the cloud server; the cloud server only provides storage functions when idle.
7. The privacy protection database JOIN type query method based on homomorphic secret sharing according to claim 1 is characterized in that: The query stage also includes an aggregation analysis step, specifically: Perform single attribute calculation on the connected table, execute the aggregate function in one column of the connected table, and output the result; Perform calculations between different attributes of the connection table, operate one column in the connection table with another column, and output the results.
8. A privacy-preserving database JOIN-type query system based on homomorphic secret sharing, characterized in that: A privacy-preserving database JOIN type query method based on homomorphic secret sharing applied to any one of claims 1-7, comprising a setting module and a query module; The setup module is used in the setup phase and includes: Generate the Paillier encrypted public key N and private key d, send the private key d to i cloud servers in the form of additive secret sharing, and the cloud servers obtain the homomorphic secret sharing private key ek i ; Perform Paillier encryption on the private key d to obtain the encrypted private key E(d); package the public key N and the encrypted private key E(d) as the homomorphic secret sharing public key pk(N, E(d)) and send it to the client; The query module is used in the query phase and includes: The client converts each element x in his table into an encrypted value I through a homomorphic secret algorithm. x , get the encrypted customer table; Upload the encrypted customer table to the cloud server; The cloud server receives the query instruction and starts to execute the query task; the cloud server shares the private key ek according to the homomorphic secret i , the encrypted value I in the encrypted customer table x The local part is converted into secret shares, and the cloud servers obtain their own secret share tables; each cloud server executes the secure connection protocol according to the encrypted customer table and secret share table it has, and obtains the secret shares of the connection table respectively; The queryer reconstructs the connection table based on the secret shares of each connection table.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the privacy-preserving database JOIN type query method based on homomorphic secret sharing as described in any one of claims 1-7.
Citation Information
Patent Citations
A privacy protection average distance query method based on Paillier homomorphic encryption
CN109818729A
Multi-user distributed privacy protection regression method and device based on secret sharing
CN115632761A