Database privacy protection and query method and device based on full homomorphic encryption
Patent Information
- Application Number
- CN202310148443.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-14
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2043-02-14
AI Technical Summary
[0015]本申请实施例的基于全同态加密的数据库隐私保护和查询方法及装置,利用TFHE同态加密方案和CKKS同态加密方案,主要在与现有的同态加密算法在实际应用中根据不同任务选择不用的算法和参数,没有一个同态加密算法在所有的应用上都是最高效的。使用CKKS同态加密方案对数据进行加密,并在查询中将CKKS密文转换为TFHE密文进行检索,检索后将TFHE密文转化为CKKS密文进行聚合,从而完成在密文数据库上进行SQL查询。由此,利用全同态加密技术,不仅保证了数据外包场景下数据不被泄露,保护用户隐私,而且能够在数据库上进行查询操作,完成对密文的计算。
Smart Images

Figure CN116089692B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information security technology, and in particular to a database privacy protection and query method and apparatus based on fully homomorphic encryption. Background Technology
[0002] With the deep integration of new-generation information technologies such as blockchain, 5G, the Internet of Things, cloud computing, and artificial intelligence into people's daily lives, a large amount of personal data is outsourced to external databases for collection, processing, and transfer. Therefore, the core of data privacy protection is not to strictly guard against data or artificially create data silos; rather, it is to maintain the confidentiality and security of private data while fully ensuring data flow and data value extraction capabilities, achieving data that is "usable but not visible."
[0003] Therefore, there is an urgent need for a publicly verifiable technology that can ensure the database can be queried normally without leaking users' personal privacy data. Summary of the Invention
[0004] This application provides a database privacy protection and query method and apparatus based on fully homomorphic encryption, which is used for data query and privacy protection in database outsourcing scenarios. By using fully homomorphic encryption technology, it not only ensures that data is not leaked in data outsourcing scenarios and protects user privacy, but also enables plaintext SQL query and ciphertext SQL query operations on encrypted databases.
[0005] The first aspect of this application provides a database privacy protection and query method based on fully homomorphic encryption, comprising the following steps: receiving a ciphertext SQL query request from a client; performing a search in an encrypted database according to the ciphertext SQL query request to obtain multiple TFHE ciphertext search results; performing ciphertext conversion on the multiple TFHE ciphertext search results according to a ciphertext conversion algorithm to obtain CKKS ciphertext search results; aggregating the CKKS ciphertext search results and the encrypted database to obtain ciphertext results after SQL query, and sending the ciphertext results of the SQL query to the client.
[0006] Optionally, in one embodiment of this application, before receiving the encrypted SQL query request from the client, the method further includes: receiving an encrypted database sent by the client and storing it locally, wherein the encrypted database is obtained by the client encrypting a local database using the CKKS homomorphic encryption algorithm.
[0007] Optionally, in one embodiment of this application, encrypted database retrieval includes ciphertext comparison and logical operations between ciphertexts. Retrieval is performed in the encrypted database according to the ciphertext SQL query request, including: in the ciphertext comparison stage, comparing the ciphertext of the encrypted database and the ciphertext of the SQL query according to the SQL retrieval conditions to obtain multiple comparison results, wherein when the comparison conditions are met, ciphertext with the encrypted value 1 is output, and when the comparison conditions are not met, ciphertext with the encrypted value 0 is output; in the logical operation stage, performing logical operations between ciphertexts according to the logical function between the SQL retrieval conditions.
[0008] Optionally, in one embodiment of this application, comparing the ciphertext of the encrypted database and the ciphertext of the SQL according to the SQL retrieval conditions includes: performing ciphertext comparison based on the ciphertext bootstrapping process of TFHE, constructing a lookup table polynomial for the MSB function by calculating the difference between the ciphertext of the encrypted database and the ciphertext of the SQL, executing the bootstrapping function of TFHE, and obtaining the comparison result.
[0009] Optionally, in one embodiment of this application, after the logical operation, the method further includes refreshing the noise in the ciphertext of the SQL.
[0010] Optionally, in one embodiment of this application, the aggregation of the CKKS ciphertext retrieval result and the encrypted database includes: performing CKKS homomorphic addition and homomorphic multiplication on the CKKS ciphertext retrieval result and the encrypted database.
[0011] A second aspect of this application provides a database privacy protection and query method based on fully homomorphic encryption, comprising the following steps: encrypting an SQL query request using the CKKS homomorphic encryption algorithm to obtain a ciphertext SQL query request, and sending the ciphertext SQL query request to a server; receiving the ciphertext result of the SQL query sent by the server, wherein the ciphertext result of the SQL query is obtained by the server converting multiple TFHE ciphertext search results obtained by searching the encrypted database with the ciphertext SQL query request into CKKS ciphertext search results, and aggregating the CKKS ciphertext search results with the encrypted database; and decrypting the ciphertext result of the SQL query to obtain the SQL query result.
[0012] Optionally, in one embodiment of this application, before sending the encrypted SQL query request to the server, the method further includes: encrypting the local database using the CKKS homomorphic encryption algorithm to obtain the encrypted database, and then sending the encrypted database to the server.
[0013] A third aspect of this application provides a database privacy protection and query device based on fully homomorphic encryption, comprising: a request receiving module for receiving a ciphertext SQL query request from a client; a retrieval module for performing a retrieval in an encrypted database according to the ciphertext SQL query request to obtain multiple TFHE ciphertext retrieval results; a conversion module for performing ciphertext conversion on the multiple TFHE ciphertext retrieval results according to a ciphertext conversion algorithm to obtain CKKS ciphertext retrieval results; and an aggregation module for aggregating the CKKS ciphertext retrieval results and the encrypted database to obtain ciphertext results after SQL query, and sending the ciphertext results of the SQL query to the client.
[0014] The fourth aspect of this application provides a database privacy protection and query device based on fully homomorphic encryption, comprising: an encryption module, used to encrypt an SQL query request using the CKKS homomorphic encryption algorithm to obtain an ciphertext SQL query request, and send the ciphertext SQL query request to a server; a result receiving module, used to receive the ciphertext result of the SQL query sent by the server, wherein the ciphertext result of the SQL query is obtained by the server converting multiple TFHE ciphertext search results obtained by searching the ciphertext SQL query request in the encrypted database into ciphertext, obtaining CKKS ciphertext search results, and aggregating the CKKS ciphertext search results with the encrypted database; and a decryption module, used to decrypt the ciphertext result of the SQL query to obtain the SQL query result.
[0015] The database privacy protection and query method and apparatus based on fully homomorphic encryption in this application utilizes the TFHE homomorphic encryption scheme and the CKKS homomorphic encryption scheme. The key difference lies in the selection of different algorithms and parameters based on different tasks in practical applications, as no single homomorphic encryption algorithm is the most efficient in all applications. The CKKS homomorphic encryption scheme is used to encrypt the data, and during the query, the CKKS ciphertext is converted to TFHE ciphertext for retrieval. After the retrieval, the TFHE ciphertext is converted back to CKKS ciphertext for aggregation, thereby completing the SQL query on the encrypted database. Therefore, by utilizing fully homomorphic encryption technology, not only is data leakage prevented in data outsourcing scenarios, protecting user privacy, but query operations can also be performed on the database to complete the computation on the encrypted data.
[0016] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0017] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0018] Figure 1 This is the overall framework of the database privacy protection and query scheme system based on fully homomorphic encryption provided in the embodiments of this application;
[0019] Figure 2 This is a flowchart illustrating a database privacy protection and query method based on fully homomorphic encryption, according to an embodiment of this application.
[0020] Figure 3 This is a schematic diagram of an SQL processing scheme based on fully homomorphic encryption provided according to an embodiment of this application;
[0021] Figure 4 This is a flowchart of another database privacy protection and query method based on fully homomorphic encryption provided according to an embodiment of this application;
[0022] Figure 5 This is an example diagram of a database privacy protection and query device based on fully homomorphic encryption according to an embodiment of this application;
[0023] Figure 6 This is an example diagram of another database privacy protection and query device based on fully homomorphic encryption according to an embodiment of this application. Detailed Implementation
[0024] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0025] Fully homomorphic encryption, as a privacy-preserving computation scheme, has been widely applied in various industries in recent years. Based on fully homomorphic encryption, the data owner possessing private data can encrypt the data and transmit it to the computation party; the computation party can directly execute any Turing-complete computer language on the encrypted ciphertext, without any interaction with the data owner during this process. Homomorphic encryption is a two-way computation scenario involving a client and a server. The client encrypts its private data and sends it to the server; the server performs computation on the ciphertext data and returns the result to the client, who then decrypts it to obtain the computation result. The earliest fully homomorphic encryption scheme was proposed in 2009, allowing for arbitrary depth computation on the ciphertext through bootstrapping techniques. Currently, the development trend of homomorphic encryption algorithms mainly falls into two directions: one is homomorphic encryption algorithms supporting algebraic circuits, represented by BFV and CKKS; the other is homomorphic encryption algorithms supporting logic circuits, represented by TFHE. CKKS is an approximate computation homomorphic encryption scheme, whose core lies in treating the noise in the computation of the RLWE hard problem as part of the floating-point operation noise. Unlike previous homomorphic encryption algorithms that aimed for a complete match between the decryption result and the plaintext, the CKKS scheme typically retains only the effective bits of the plaintext after decryption, greatly simplifying the CKKS encryption scheme. Furthermore, this scheme allows for better control over plaintext precision through readjustment, expanding the types of CKKS ciphertext computations. This type of algorithm can efficiently perform algebraic circuit operations using SIMD. TFHE is a single-bit encryption scheme where both plaintext and ciphertext operations are performed on the real number ring. TFHE constructs numerous homomorphic logic operations: selectors and blind rotations, and based on selectors and blind rotations, it constructs a fast single-bit bootstrap scheme and completes the construction and operation of homomorphic LUTs. This type of algorithm leverages the flexibility of single bits to effectively support logic circuit operations.
[0026] Furthermore, fully homomorphic encryption, based on lattice-based hard problems, offers strong security guarantees. Privacy-preserving computation technologies based on homomorphic encryption possess the characteristics of high security and low bandwidth transmission, and are expected to become key technologies for solving data privacy protection issues.
[0027] Currently, database service providers require users to expose plaintext data completely, which can easily lead to privacy leaks. This application aims to address this issue by proposing a database privacy-preserving query and query scheme based on fully homomorphic encryption. This scheme outsources encrypted data to the service provider, enabling both plaintext and encrypted SQL queries on the encrypted database, thus protecting user data privacy.
[0028] like Figure 1The diagram illustrates the overall framework of a database privacy protection and query scheme based on fully homomorphic encryption. The system comprises two main components: a client and a server. The client is the data holder, typically possessing personal, private data, and facing limited local computing resources or storage space. They wish to outsource this data to other service providers and, when needed, be able to query the desired data and even perform some data processing operations. The server, on the other hand, is a service provider with strong computing resources and ample storage space, capable of storing the client's data locally and performing data processing operations.
[0029] The entire system is divided into two phases: offline and online. The offline phase involves data encryption and transmission, while the online phase includes four parts: SQL encryption, encrypted SQL processing, and data decryption. Data encryption primarily involves the client performing homomorphic encryption on the original data and sending it to the server. Query encryption refers to the client encrypting the SQL statement they wish to use for the query and sending it to the server. Query processing involves the server processing the encrypted data and the encrypted SQL statement locally and obtaining the processing result. Data decryption involves the server sending the processed result back to the client, who then decrypts it to obtain the plaintext result.
[0030] Specifically, Figure 2 This is a flowchart illustrating a database privacy protection and query method based on fully homomorphic encryption, provided in an embodiment of this application.
[0031] like Figure 2 As shown, this database privacy protection and query method based on fully homomorphic encryption includes the following steps:
[0032] In step S101, a encrypted SQL query request from the client is received.
[0033] In the offline phase, the client encrypts and transmits data. In the online phase, when a client wants to query its own database, it must first encrypt the sensitive parts of its query command using the client's private key. For example... Figure 1 As shown, the data portion of the SQL statement is encrypted using the user's private key sk, resulting in an encrypted SQL statement. The client sends the encrypted SQL statement to the server. Without the client's key, the server cannot decrypt the plaintext data and obtain any information from it. When there is no need to protect the SQL query request information in the scenario, the plaintext SQL query request can be sent directly.
[0034] Optionally, in one embodiment of this application, before receiving the encrypted SQL query request from the client, the method further includes: receiving an encrypted database sent by the client and storing it locally, wherein the encrypted database is obtained by the client encrypting the local database using the CKKS homomorphic encryption algorithm.
[0035] After receiving a query request from the client, the server retrieves the data from its locally stored database. This local database is the data uploaded by the client to the server during the offline phase. During the offline phase, the client encrypts its local data into ciphertext using a homomorphic encryption scheme. Specifically, for the client's local database D = {t0, t1, ..., t...} m-1}, t i ={t i,0 , t i,1 , ..., t i,m-1 The client first uses its private key sk to encrypt the data under each attribute (and each column) of the database as a whole into a homomorphic ciphertext, resulting in an encrypted database, i.e.:
[0036] CD = {ct0, ct1, ..., ct} m-1}
[0037] Among them, ct i =HE(t) i )=HE(t i,0 , t i,1 , ..., t i,n-1 After encryption, the client sends the encrypted database to the server. The entire process is conducted offline, allowing the client to periodically encrypt and send the current database to the server. Furthermore, the homomorphic encryption algorithm used is based on the RLWE hard problem. As long as the user's private key is not leaked, the server cannot encrypt the database CD = {ct0, ct1, ..., ct2}. m-1 The plaintext database D = {t0, t1, ..., t} is deduced. m-1 The server receives the encrypted database and stores it locally for later querying.
[0038] In step S102, a search is performed in the encrypted database according to the encrypted SQL query request to obtain multiple TFHE encrypted search results.
[0039] During the offline phase, the server receives the user's encrypted database; during the online phase, the server receives the user's encrypted SQL request. At this point, the server uses the encrypted SQL to query the encrypted database locally. The encrypted SQL processing procedure is as follows: Figure 3 As shown, the entire process specifically includes three steps: retrieval, ciphertext conversion, and aggregation.
[0040] Data retrieval based on TFHE ciphertext. TFHE is a single-bit encryption scheme in which plaintext and ciphertext operations are performed on the real number ring. TFHE constructs many homomorphic logical operations: selectors and blind rotations, and based on selectors and blind rotations, a fast single-bit bootstrapping scheme is constructed. The bootstrapping scheme based on TFHE ciphertext can construct lookup table polynomials to complete ciphertext comparison operations of infinite depth. Therefore, the embodiments of this application utilize TFHE ciphertext to construct ciphertext comparison operations to complete the retrieval process in database SQL queries.
[0041] Optionally, in one embodiment of this application, encrypted database retrieval includes ciphertext comparison and logical operations between ciphertexts. Retrieval in the encrypted database according to a ciphertext SQL query request includes: in the ciphertext comparison stage, comparing the ciphertext of the encrypted database with the ciphertext of the SQL query according to the SQL search conditions to obtain multiple comparison results, wherein when the comparison conditions are met, ciphertext with the encrypted value 1 is output, and when the comparison conditions are not met, ciphertext with the encrypted value 0 is output; in the logical operation stage, performing logical operations between ciphertexts according to the logical function between the SQL search conditions.
[0042] Optionally, in one embodiment of this application, the ciphertext of the encrypted database and the ciphertext of the SQL are compared according to the SQL retrieval conditions, including: performing ciphertext comparison based on the ciphertext bootstrapping process of TFHE, constructing the lookup table polynomial of the MSB function by calculating the difference between the ciphertext of the encrypted database and the ciphertext of the SQL, executing the bootstrapping function of TFHE, and obtaining the comparison result.
[0043] First, the server needs to retrieve data rows that meet the conditions based on the encrypted SQL. SQL retrieval involves filtering data rows in the encrypted database that satisfy the conditions defined by the encrypted SQL. Typically, the selection conditions in SQL consist of a series of conditional statements. For example... Figure 1 The ID shown is 2158. Ciphertext SQL retrieval consists of two parts: ciphertext comparison and logical operations between ciphertexts. In the ciphertext comparison phase, the server compares the ciphertext of the encrypted database with the ciphertext of the SQL query according to the SQL search conditions. If the conditions are met, the server outputs the ciphertext with the encrypted value 1; otherwise, it outputs the ciphertext with the encrypted value 0. Ciphertext comparison is based on TFHE's ciphertext bootstrapping process, by calculating the ciphertext ct... a , and encrypted ct a The difference ct is calculated, then the lookup table polynomial T of the MSB function is constructed, and the bootstrap function PBS of TFHE is executed to obtain the comparison result. That is:
[0044] HComp(ct a ct b ) = PBS(ct a -ctb T)
[0045] After all SQL retrieval statements have been executed, Q-1 comparison results will be obtained: cp0, ct1, ..., cp Q-w Where Q is the number of SQL search conditions. Then, based on the logical functions between the SQL search conditions, logical operations are performed between the ciphertext, typically including AND, OR, and other logical functions. The logical gate operations of the ciphertext are also based on the ciphertext bootstrapping process of TFHE, and the noise in the ciphertext is refreshed after each logical function execution. Therefore, the embodiments of this application can support SQL searches of arbitrary depth.
[0046] In summary, TFHE ciphertext ensures high-precision retrieval in homomorphic database SQL queries. TFHE is a single-bit ciphertext encryption scheme, thus enabling high-precision ciphertext data retrieval calculations using a bit-by-bit approach. Furthermore, TFHE ciphertext is based on the LWE hard problem, effectively guaranteeing ciphertext security.
[0047] In step S103, the multiple TFHE ciphertext search results are converted into ciphertext according to the ciphertext conversion algorithm to obtain the CKKS ciphertext search results.
[0048] To fully leverage the advantages of TFHE ciphertext in SQL retrieval and CKKS ciphertext in data aggregation, embodiments of this application combine TFHE and CKKS ciphertext, performing a conversion between them during the computation process to complete the entire database SQL query. Therefore, through the conversion between TFHE and CKKS ciphertext, database retrieval and aggregation can be completed simultaneously, eliminating the need for data to be sent back to the user for decryption and re-encryption. This truly enables data outsourcing.
[0049] This step includes the conversion between CKKS ciphertext and TFHE ciphertext to enable support for different functions during ciphertext SQL queries. For TFHE ciphertext, the encryption process is as follows:
[0050] TFHE(m)=(a,b)=(a,-a T s+Δm+e), Δ=q / p
[0051] Where plaintext m∈Z p key e represents Gaussian noise and a random vector. The encryption process for CKKS ciphertext is as follows:
[0052] CKKS(M)=(A,B)=(A,-AS+ΔM+E)Δ=q / p
[0053] Where, plaintext M∈R n,p Key S∈R n,q Random A∈R n,q Both are circumsegmented polynomial rings modulo q, and E is Gaussian noise. It can be seen that the elements of the TFHE ciphertext are mainly on the integer ring, while the elements of the RLWE ciphertext are on the polynomial ring. By converting between the TFHE and CKKS ciphertexts, the operations supported by different ciphertexts can be accommodated. Specifically, for the conversion from CKKS to TFHE ciphertext, we have:
[0054] TFHE(M i )=(a i B i )
[0055] Among them, a i =(-A n-1 -A n-2 ,...,-A n-i ,...,A0,A1,A2,...,A i-1 ).
[0056] The conversion from TFHE ciphertext to CKKS ciphertext is the opposite. For n TFHE ciphertexts ct0, ct1, ..., ct... n-1 , of which ct i =TFHE(m i After conversion, a CKKS ciphertext CKKS(M) will be obtained, where M = (m0, m1, ..., m...). n-1 ).
[0057] The result of the SQL search is a ciphertext of n THF HE strings: cs0, cs1, ..., cs n-1 , of which cs i =TFHE(m i Here, m i =1 indicates that the i-th row of data was retrieved, m i =0 indicates that the data in the i-th row was not retrieved. Through ciphertext conversion, the ciphertext of n TFHE can be converted into 1 CKKS ciphertext, that is, cs = CKKS(M), M = (m0, m1, ..., m...). n-1 This allows us to proceed to the next aggregation operation.
[0058] Step S104: Aggregate the CKKS ciphertext retrieval results and the encrypted database to obtain the ciphertext results after SQL query, and send the ciphertext results of the SQL query to the client.
[0059] Data aggregation based on CKKS ciphertext: CKKS is a homomorphic encryption scheme based on the RLWE hard problem, which approximates computational noise. Its core lies in treating the noise in the RLWE hard problem computation as part of the floating-point operation noise. Unlike previous homomorphic encryption algorithms that strive for complete consistency between the decryption result and the plaintext, the CKKS scheme often retains only the effective bits of the plaintext after decryption, greatly simplifying the CKKS encryption scheme. This scheme can efficiently perform addition and multiplication of ciphertext. Therefore, the embodiments of this application, based on CKKS ciphertext, implement aggregation functions to complete the aggregation process of retrieval results in database SQL queries.
[0060] Optionally, in one embodiment of this application, the CKKS ciphertext retrieval results and the encrypted database are aggregated, including: performing CKKS homomorphic addition and homomorphic multiplication on the CKKS ciphertext retrieval results and the encrypted database.
[0061] like Figure 3 As shown, the ciphertext aggregation stage only requires executing aggregate functions in the SQL statement, such as SUM and AVG. After the first two steps, the server obtains the CKKS ciphertext of the SQL retrieval result and performs aggregation based on this CKKS ciphertext and the encrypted database. The aggregation mainly utilizes CKKS homomorphic addition and homomorphic multiplication. Specifically, for CKKS ciphertext CKKS(M1) and CKKS ciphertext CKKS(M2), where M1 = (m 1,0 m 1,1 , ..., m 1,n-1 ), M2=(m 2,0 m 2,1 , ..., m 2,n-1 Homomorphic addition mainly includes:
[0062] HEAdd(CKKS(M1),CKKS(M2))=CKKS(M)
[0063] M=(m 1,0 +m 2,0 m 1,1 +m 2,1 , ..., m 1,n-1 +m 2,n-1 )
[0064] Homomorphic multiplication mainly includes:
[0065] HEMul(CKKS(M1),CKKS(M2))=CKKS(M)
[0066] M=(m 1,0 ·m 2,0 m 1,1 ·m 2,1 , ..., m 1,n-1 ·m2,n-1 )
[0067] By using homomorphic addition and homomorphic multiplication of CKKS ciphertext, the ciphertext data and the ciphertext search results can be multiplied. At this time, the data that was not searched becomes 0. Then, the aggregate function of SQL can be completed using homomorphic addition and multiplication to obtain the final ciphertext result after SQL query.
[0068] In summary, CKKS ciphertext ensures the aggregation process in flexible homomorphic database SQL queries. CKKS ciphertext performs operations in SIMD form, thus enabling fast addition and multiplication operations to complete database aggregation. Furthermore, CKKS ciphertext is based on the RLWE hard problem, effectively guaranteeing ciphertext security.
[0069] After processing the SQL statement in encrypted form, the server sends the encrypted result to the client. The client then decrypts the result using its private key sk to obtain the processed result. Since all server-side calculations are performed in encrypted form, the client's data is not leaked.
[0070] Figure 4 This is a flowchart of another database privacy protection and query method based on fully homomorphic encryption according to an embodiment of this application.
[0071] like Figure 4 As shown, this database privacy protection and query method based on fully homomorphic encryption includes the following steps:
[0072] Step S201: Encrypt the SQL query request using the CKKS homomorphic encryption algorithm to obtain the ciphertext SQL query request, and send the ciphertext SQL query request to the server.
[0073] Optionally, in one embodiment of this application, before sending the encrypted SQL query request to the server, the method further includes: encrypting the local database using the CKKS homomorphic encryption algorithm to obtain an encrypted database, and then sending the encrypted database to the server.
[0074] Step S202: Receive the encrypted result of the SQL query sent by the server. The encrypted result of the SQL query is obtained by converting multiple TFHE encrypted search results obtained by the server from the encrypted SQL query request in the encrypted database into CKKS encrypted search results, and then aggregating the CKKS encrypted search results with the encrypted database.
[0075] Step S203: Decrypt the encrypted result of the SQL query to obtain the SQL query result.
[0076] The database privacy protection and query method based on fully homomorphic encryption proposed in this application combines the TFHE homomorphic encryption scheme and the CKKS homomorphic encryption scheme, as well as the conversion between TFHE ciphertext and CKKS ciphertext. This enables efficient database processing while protecting data privacy. The scheme mainly includes encryption / decryption and ciphertext calculation processes. The encryption process uses the CKKS homomorphic encryption scheme to encrypt the original data and query statements. The ciphertext calculation process utilizes TFHE ciphertext for retrieval and CKKS ciphertext for aggregation. Ciphertext retrieval is based on a bootstrap scheme using TFHE ciphertext, which can construct a lookup table polynomial to complete ciphertext comparison operations of infinite depth. Ciphertext aggregation is based on the CKKS homomorphic encryption scheme, using ciphertext SIMD to efficiently perform addition and multiplication operations to implement aggregation functions. Thus, the conversion between CKKS ciphertext and TFHE ciphertext is implemented in the query, enabling the retrieval and aggregation of SQL statements without re-decryption.
[0077] Next, referring to the accompanying drawings, a database privacy protection and query device based on fully homomorphic encryption, according to an embodiment of this application, is described.
[0078] Figure 5 This is an example diagram of a database privacy protection and query device based on fully homomorphic encryption according to an embodiment of this application.
[0079] like Figure 5 As shown, the database privacy protection and query device 10 based on fully homomorphic encryption includes: a request receiving module 501, a retrieval module 503, a conversion module 503, and an aggregation module 504.
[0080] The system includes the following modules: Request receiving module 501 receives encrypted SQL query requests from the client; retrieval module 502 performs a retrieval in the encrypted database based on the encrypted SQL query request, obtaining multiple TFHE encrypted retrieval results; conversion module 503 performs ciphertext conversion on the multiple TFHE encrypted retrieval results using a ciphertext conversion algorithm, obtaining CKKS encrypted retrieval results; and aggregation module 504 aggregates the CKKS encrypted retrieval results and the encrypted database to obtain the encrypted results after the SQL query, and sends the encrypted SQL query results to the client.
[0081] Figure 6 This is an example diagram of another database privacy protection and query device based on fully homomorphic encryption according to an embodiment of this application.
[0082] like Figure 6 As shown, the database privacy protection and query device 20 based on fully homomorphic encryption includes: an encryption module 601, a result receiving module 602, and a decryption module 603.
[0083] The system includes an encryption module 601, which encrypts the SQL query request using the CKKS homomorphic encryption algorithm to obtain a ciphertext SQL query request, and then sends the ciphertext SQL query request to the server. A result receiving module 602 receives the ciphertext result of the SQL query sent by the server. This ciphertext result is obtained by converting multiple TFHE ciphertext search results obtained by the server from retrieving the ciphertext SQL query request from the encrypted database into CKKS ciphertext search results, and then aggregating these CKKS ciphertext search results with the encrypted database. A decryption module 603 decrypts the ciphertext result of the SQL query to obtain the SQL query result.
[0084] It should be noted that the foregoing explanation of the embodiments of the database privacy protection and query method based on fully homomorphic encryption also applies to the database privacy protection and query device based on fully homomorphic encryption in this embodiment, and will not be repeated here.
[0085] The database privacy protection and query device based on fully homomorphic encryption proposed in this application combines the TFHE homomorphic encryption scheme and the CKKS homomorphic encryption scheme, as well as the conversion between TFHE ciphertext and CKKS ciphertext. This enables efficient database processing while protecting data privacy. The scheme mainly includes encryption / decryption and ciphertext calculation processes. The encryption process uses the CKKS homomorphic encryption scheme to encrypt the original data and query statements. The ciphertext calculation process utilizes TFHE ciphertext for retrieval and CKKS ciphertext for aggregation. Ciphertext retrieval is based on a bootstrap scheme using TFHE ciphertext, which can construct a lookup table polynomial to complete ciphertext comparison operations of infinite depth. Ciphertext aggregation is based on the CKKS homomorphic encryption scheme, efficiently performing addition and multiplication operations in the form of ciphertext SIMD to implement aggregation functions. Therefore, by implementing the conversion between CKKS ciphertext and TFHE ciphertext in the query, the retrieval and aggregation of SQL statements can be completed without re-decryption.
[0086] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0087] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0088] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
Claims
1. A database privacy protection and query method based on fully homomorphic encryption, characterized in that, Includes the following steps: Receive encrypted SQL query requests from the client; Based on the encrypted SQL query request, a search is performed in the encrypted database to obtain multiple TFHE encrypted search results; The ciphertext conversion algorithm is used to convert the multiple TFHE ciphertext search results into CKKS ciphertext search results. The CKKS ciphertext retrieval results and the encrypted database are aggregated to obtain the ciphertext results after SQL query, and the ciphertext results of the SQL query are sent to the client; The encrypted database is obtained by the client encrypting its local database using the CKKS homomorphic encryption algorithm. The encryption process is as follows: Among them, plain text Key , All are circular polynomial rings modulo q. It is Gaussian noise.
2. The method according to claim 1, characterized in that, Before receiving the encrypted SQL query request from the client, the process also includes: Receive the encrypted database sent by the client and save it locally.
3. The method according to claim 1, characterized in that, Encrypted database retrieval includes ciphertext comparison and logical operations between ciphertexts, and performs retrieval in the encrypted database according to the ciphertext SQL query request, including: During the ciphertext comparison phase, the ciphertext of the encrypted database and the ciphertext of the SQL are compared according to the SQL retrieval conditions to obtain multiple comparison results. When the comparison conditions are met, the ciphertext with the encrypted value 1 is output, and when the comparison conditions are not met, the ciphertext with the encrypted value 0 is output. During the logical operation phase between ciphertexts, logical operations between ciphertexts are performed based on the logical functions between SQL retrieval conditions.
4. The method according to claim 3, characterized in that, The ciphertext of the encrypted database and the ciphertext of the SQL are compared according to the SQL search criteria, including: Ciphertext comparison is performed based on the ciphertext bootstrapping process of TFHE. By calculating the difference between the ciphertext of the encrypted database and the ciphertext of the SQL, the lookup table polynomial of the MSB function is constructed, the bootstrapping function of TFHE is executed, and the comparison result is obtained.
5. The method according to claim 3, characterized in that, Following the logical operations, it also includes: The noise in the encrypted SQL is refreshed.
6. The method according to claim 1, characterized in that, Aggregating the CKKS encrypted search results and the encrypted database includes: The CKKS ciphertext retrieval results and the encrypted database are subjected to CKKS homomorphic addition and homomorphic multiplication.
7. A database privacy protection and query method based on fully homomorphic encryption, characterized in that, Includes the following steps: The SQL query request is encrypted using the CKKS homomorphic encryption algorithm to obtain the ciphertext SQL query request, which is then sent to the server. The server receives the encrypted result of an SQL query sent by the server. The encrypted result of the SQL query is obtained by the server converting multiple TFHE encrypted search results obtained by searching the encrypted SQL query request in the encrypted database into CKKS encrypted search results, and then aggregating the CKKS encrypted search results with the encrypted database. Decrypt the encrypted result of the SQL query to obtain the SQL query result.
8. The method according to claim 7, characterized in that, Before sending the encrypted SQL query request to the server, the process also includes: The local database is encrypted using the CKKS homomorphic encryption algorithm to obtain the encrypted database, and then the encrypted database is sent to the server.
9. A database privacy protection and query device based on fully homomorphic encryption, characterized in that, include: The request receiving module is used to receive encrypted SQL query requests from clients. The retrieval module is used to perform retrieval in the encrypted database according to the encrypted SQL query request and obtain multiple TFHE encrypted retrieval results; The conversion module is used to convert the multiple TFHE ciphertext search results into CKKS ciphertext search results according to the ciphertext conversion algorithm. The aggregation module is used to aggregate the CKKS ciphertext retrieval results and the encrypted database to obtain the ciphertext results after SQL query, and send the ciphertext results of the SQL query to the client; The encrypted database is obtained by the client encrypting its local database using the CKKS homomorphic encryption algorithm. The encryption process is as follows: Among them, plain text Key , All are circular polynomial rings modulo q. It is Gaussian noise.
10. A database privacy protection and query device based on fully homomorphic encryption, characterized in that, include: The encryption module is used to encrypt the SQL query request using the CKKS homomorphic encryption algorithm to obtain the ciphertext SQL query request, and then send the ciphertext SQL query request to the server. The result receiving module is used to receive the encrypted result of the SQL query sent by the server. The encrypted result of the SQL query is obtained by the server converting multiple TFHE encrypted search results obtained by searching the encrypted SQL query request in the encrypted database into CKKS encrypted search results, and then aggregating the CKKS encrypted search results with the encrypted database. The decryption module is used to decrypt the ciphertext results of SQL queries to obtain the SQL query results.
Citation Information
Patent Citations
Method and apparatus for data processing
CN109063496A
Multi-key fully homomorphic encryption method with fixed ciphertext length
CN112543091A