A database SQL query method

Through technologies such as symmetric operation and inadvertent transmission protocols, an efficient and secure database SQL query method is built, solving the problems of data leakage and computing overhead in traditional methods, and achieving safe and efficient query in cloud environments.

CN114911815BActive Publication Date: 2025-02-11EAST CHINA NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210197780.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-01
Publication Date
2025-02-11
Estimated Expiration
2042-03-01

AI Technical Summary

Technical Problem

When facing dishonest data requesters, traditional database query methods may leak the privacy data of the data provider, and full homomorphic encryption cannot be applied to efficient SQL queries due to the high computing overhead.

Method used

Using symmetric operation (exclusive or hashing) methods, an efficient and secure database SQL query method is built, supporting data matching between two tables, and ensuring data security and computing efficiency through inadvertent transmission protocols and Bloom filters.

Benefits of technology

It realizes the secure execution of SQL queries in a cloud environment, protects the privacy and security of data leakage, and reduces computing overhead, solving the application problem of fully homomorphic encryption in efficient SQL queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114911815B_ABST
    Figure CN114911815B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for SQL query of a database, which is characterized by specifically including: 1) system initialization; 2) data demander initiates query request; 3) data supplier constructs obfuscated Bloom filter according to the column that the data demander needs to query; 4) data demander constructs Bloom filter according to its own local data; 5) oblivious transfer protocol is executed; 6) demander reconstructs obfuscated Bloom filter; 7) demander outputs intersection and corresponding information. Compared with the prior art, the present invention supports data matching between two tables, can safely execute SQL query, except for the data of the corresponding row of the element in the intersection, other data is unknown to the other party, and can be applied to cloud environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of information security, in particular to an efficient and secure database SQL query method. Background Art

[0002] In general scenarios, the data supplier owns a batch of data, and honest data requesters will initiate query requests based on their own needs. When encountering dishonest data requesters, traditional database queries may expose data beyond the data supplier's query request, causing the leakage of the data supplier's private data.

[0003] However, current column-by-column privacy data queries are all based on fully homomorphic encryption, but fully homomorphic encryption cannot be applied to efficient SQL queries due to its high computational overhead. Summary of the invention

[0004] The purpose of the present invention is to provide a database SQL query method to address the deficiencies in the prior art. A symmetric operation (XOR and hash) method is used to construct an efficient and secure database SQL query, which supports data matching between two tables and can safely execute SQL queries. Except for the data of the rows corresponding to the elements in the intersection, other data is unknown to the other party. The method can be applied to a cloud environment, which not only greatly protects the privacy and security of data leakage, but also reduces the computing overhead. The method effectively solves the problem that fully homomorphic encryption cannot be applied to efficient SQL queries due to its large computing overhead. The method is an efficient and secure database SQL query method with broad application prospects.

[0005] The object of the present invention is achieved by: an efficient and safe database SQL query method, which is characterized in that the database SQL query specifically includes the following steps:

[0006] (I) System initialization

[0007] The data supplier and the data demander need to first negotiate the length m of the Bloom filter, the length λ of each bit string in the obfuscated Bloom filter, the number k of hash functions, and the hash family H: {h1,h2,...,h k}:{0,1} * →[m] and is made public as a public parameter.

[0008] (II) Data demander initiates query request

[0009] The data demander initiates a query request as needed, for example, select id, name from table2 where table1.id = table2.id, where table1 comes from the data supplier and table2 comes from the data requester. The data demander's table only has the id field but no name field. The data supplier and the data demander hold sets X and Y respectively. The corresponding label records in the data supplier's set X are set L, that is, (x i ,l i )∈(X,L).

[0010] (III) The data supplier constructs a confused Bloom filter based on the columns that the data demander needs to query

[0011] After receiving the query request, the data supplier takes out all the data corresponding to the columns of all id and name fields in the query request, and uses the hash function in the hash family to construct a confused Bloom filter, which is recorded as GBF and GBF. id ,GBF name , the corresponding i-th position is recorded as GBF id [i],GBF name [i], where have And there is

[0012] (IV) Data demanders build Bloom filters based on their own local data

[0013] The data demander takes out all the data listed in the id field according to its query request, and uses the hash function in the hash family to construct a confused Bloom filter, denoted as BF, where the i-th bit is denoted as BF[i].

[0014] (V) Implementation of Oblivious Transfer Protocol

[0015] 1) In order to restore the obfuscated Bloom filter corresponding to the restored id, the data supplier and the data requester execute m rounds of the oblivious transfer protocol. In the i-th round of the oblivious transfer protocol, the data supplier acts as the sender and the data requester acts as the receiver. The data sender sends (r i ,GBF id [i]) as the sending vector (r i Each time, the data supplier randomly selects, and the data demander uses BF[i] as the selection vector. After the i-th round of the oblivious transfer protocol is executed, when BF[i]=0, the data demander obtains r i When BF[i]=1, the data demander obtains GBF id [i];

[0016] 2) Similarly, in order to restore the obfuscated Bloom filter corresponding to name, the data supplier and the data requester execute m rounds of oblivious transfer protocol. In the i-th round of oblivious transfer protocol, the data supplier acts as the sender and the data requester acts as the receiver. The data sender sends (r i ,GBF name [i]) as the sending vector (r i Each time, the data supplier randomly selects, and the data demander uses BF[i] as the selection vector. After the i-th round of the oblivious transfer protocol is executed, when BF[i]=0, the data demander obtains r i When BF[i]=1, the data demander obtains GBF name [i].

[0017] (VI) Demand-side reconstruction of obfuscated Bloom filters

[0018] The data demander needs to restore the obfuscated Bloom filter corresponding to the id and name, that is, the data demander places the m elements received by the first round of inadvertent transmission in order as GBF' id The data demander places the m elements received by the second round of oblivious transmission in order as GBF' name .

[0019] (VII) The demand side outputs the intersection and corresponding label information

[0020] For each element y in the set Y held by the data demander, the data demander calculates Is it equal to y? If it is equal to y, continue calculating And the operation result is output as the label value.

[0021] Compared with the prior art, the present invention supports data matching between two tables and can execute SQL queries safely and efficiently. Except for the data of the rows corresponding to the elements in the intersection, other data is unknown to the other party. It can be applied to cloud environments, which not only greatly protects the privacy security of data leakage, but also reduces computing overhead, and effectively solves the problem that fully homomorphic encryption cannot be applied to efficient SQL queries due to its large computing overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0023] The theory applied in the present invention is described as follows:

[0024] 1) Inadvertent transmission

[0025] Oblivious transfer is referred to as OT protocol. In the execution of OT protocol, there are two participants, namely sender and receiver. The sender inputs two messages m0 and m1, and the receiver inputs a bit b∈{0,1}. After the protocol is executed, the receiver can only get m. b , and for m 1-b The sender does not know which data the receiver has received.

[0026] 2) Bloom filter

[0027] The Bloom filter is a bit array and a probabilistic data structure. When an element is inserted, different hash values ​​are generated using multiple different hash functions, and the pointed position is set to 1. If there is no corresponding hash function mapped to other positions, the corresponding position is set to 0. The main algorithm flow is as follows:

[0028] a. Initialize an array of length n bits, with each bit initialized to 0;

[0029] b. First, k hash functions are needed, each of which can calculate the element to be inserted into a non-negative integer less than n;

[0030] c. When an element to be inserted is added to the set, k hash values ​​are calculated using k hash functions, and the corresponding bits in the array are set to 1;

[0031] d. When determining whether an element is in a set, use k hash functions to calculate k hash values ​​and query the corresponding bit positions in the array. If all bit positions are 1, the element is in the set.

[0032] 3) Confusion Bloom Filter

[0033] The obfuscated Bloom filter (GBF) is also an array in form. When an element is inserted, several different hash functions are used to generate different hash values. The difference between GBF and BF is that each position in GBF contains a string of fixed length. When an element is inserted, it is divided into k shares of λ bits in length. Each share is mapped to the corresponding position by the hash function. When all elements in the set are inserted, the unmapped indexes are filled with λ-bit long random strings.

[0034] If you need to query an element x i , just need to calculate Is it equal to x? i If they are equal, then x i In the collection.

[0035] The present invention will be further described and explained in detail below in conjunction with specific implementations to understand the technical means, creative features, objectives and effects achieved by the present invention.

[0036] See also Figure 1 The implementation process of the present invention mainly includes the following steps:

[0037] (1) System initialization; (2) The data demander initiates a query request; (3) The data supplier constructs a confused Bloom filter based on the columns that the data demander needs to query; (4) The data demander constructs a Bloom filter based on its own local data; (5) The oblivious transfer protocol is executed; (6) The demander reconstructs the confused Bloom filter; (7) The demander outputs the intersection and correspondence information.

[0038] In step (1), the data supplier and the data demander need to first negotiate the length m of the Bloom filter, the length λ of each bit string in the obfuscated Bloom filter, the number k of hash functions, and the hash family H: {h1,h2,...,h k}:{0,1} * →[m] and is made public as a public parameter.

[0039] In step (2), the data demander initiates a query request as needed, for example, select id, name from table2 where table1.id = table2.id, where table1 comes from the data supplier, table2 comes from the data requester, and the table of the data demander only has the id field but no name field. The sets held by the data supplier and the data demander are X and Y respectively, and the corresponding label records in the data supplier set X are set L, that is, (x i ,l i )∈(X,L);

[0040] In step (3), after receiving the query request, the data supplier extracts all the data in the query request according to the columns corresponding to all ids and names, and uses the hash function in the hash family to construct a confused Bloom filter, which is recorded as GBF id ,GBF name , the corresponding i-th position is recorded as GBF id [i],GBF name [i], where have And there is

[0041] In step (4), the data demander retrieves all data corresponding to all id columns according to its query request, and uses the hash function in the hash family to construct a confused Bloom filter, denoted as BF, where the i-th bit is denoted as BF[i].

[0042] The implementation of step (5) is divided into two parts:

[0043] 5-1: In order to restore the obfuscated Bloom filter corresponding to the id, the data supplier and the data requester execute m rounds of the oblivious transfer protocol. In the i-th round of the oblivious transfer protocol, the data supplier acts as the sender and the data requester acts as the receiver. The data sender sends (r i ,GBF id [i]) as the sending vector (r i Each time, the data supplier randomly selects, and the data demander uses BF[i] as the selection vector. After the i-th round of the oblivious transfer protocol is executed, when BF[i]=0, the data demander obtains r i When BF[i]=1, the data demander obtains GBF id [i].

[0044] 5-2: Similarly, in order to restore the obfuscated Bloom filter corresponding to name, the data supplier and the data requester execute m rounds of oblivious transfer protocol. In the i-th round of oblivious transfer protocol, the data supplier acts as the sender and the data requester acts as the receiver. The data sender sends (r i ,GBF name [i]) as the sending vector (r i Each time, the data supplier randomly selects, and the data demander uses BF[i] as the selection vector. After the i-th round of the oblivious transfer protocol is executed, when BF[i]=0, the data demander obtains r i When BF[i]=1, the data demander obtains GBF name [i].

[0045] In step (6), the data demander needs to restore the obfuscated Bloom filter corresponding to id and name, that is, the data demander places the m elements received by the first round of oblivious transmission in order as GBF' id The data demander places the m elements received by the second round of oblivious transmission in order as GBF' name .

[0046] In step (7), for each element y in the set Y held by the data demander, the data demander calculates Is it equal to y? If it is equal to y, continue calculating The calculation result is output as the label value, that is, the demander outputs the intersection and corresponding label information to complete the database SQL query.

[0047] The above is only a further explanation of the present invention and is not intended to limit the patent of the present invention. Any equivalent implementation of the present invention should be included in the scope of the claims of the patent of the present invention.

Claims

1. A database SQL query method, characterized in that The database SQL query specifically includes the following steps: (I) System initialization The data supplier and the data demander need to negotiate the length m of the Bloom filter and obfuscate the length of each bit string in the Bloom filter. The number of hash functions k and hash families and expose it as a public parameter; (II) Data demander initiates query request The data demander initiates a query request as needed, and there is only an id field in the data demander's table. The corresponding label record in the set X held by the data supplier is set L, that is, (III) The data supplier constructs a confused Bloom filter based on the columns that the data demander needs to query After receiving the query request, the data supplier takes out all the data in the columns corresponding to the id and name fields in the query request, and uses the hash function in the hash family to construct a confused Bloom filter, which is recorded as GBF and GBF. id and GBF name , the corresponding i-th GBF id [i} and GBF name [i], where Have GBF id [h1(x i )]⊕GBF id [h2(x i )]⊕...⊕GBF id [h k (x i )]=x i , and GBF name [h1(x i )]⊕GBF name [h2(x i )]⊕...⊕GBF name [h k (x i )]=l i ; (IV) Data demanders build Bloom filters based on their own local data The data demander retrieves all the data in the column corresponding to the id field according to its query request, and uses the hash function in the hash family to construct a confused Bloom filter, which is recorded as BF, where the i-th bit is recorded as BF[i]; (V) Implementation of Oblivious Transfer Protocol 1) Restore the obfuscated Bloom filter corresponding to the id field: The data supplier and the data requester execute m rounds of the oblivious transfer protocol. In the i-th round of the oblivious transfer protocol, the data supplier, as the data sender, sends As the sending vector, Each time, the data supplier randomly selects; the data demander, as the receiver, uses BF[i] as the selection vector. After the i-th round of the oblivious transfer protocol is executed, when BF[i] = 0, the data demander obtains When BF[i]=1, the data demander obtains 2) Restore the obfuscated Bloom filter corresponding to the name field: The data provider and the data requester execute m rounds of the oblivious transfer protocol. In the i-th round of the oblivious transfer protocol, the data provider, as the data sender, sends As the sending vector, Each time, the data supplier randomly selects; the data demander, as the receiver, uses BF[i] as the selection vector. After the i-th round of the oblivious transfer protocol is executed, when BF[i] = 0, the data demander obtains When BF[i]=1, the data demander obtains (VI) Demand-side reconstruction of obfuscated Bloom filters The data demander restores the obfuscated Bloom filters corresponding to the id and name fields, that is, the data demander places the m elements received by the first round of oblivious transmission in order as The data demander places the m elements received by the second round of oblivious transmission in order as (VII) The demand side outputs the intersection and corresponding label information For each element y in the set Y held by the data demander, the data demander calculates GBF' id [h1(x)]⊕GBF' id [h2(y)]⊕...⊕GBF' id [h k (y)] is equal to y, if it is equal to y, then continue to calculate GBF' name [h1(y)]⊕GBF' name [h2(y)]⊕...⊕GBF' name [h k (y)], and output the operation result as the label value, that is, the demand side outputs the intersection and the corresponding label information to complete the database SQL query.