Encrypted data query processing method and electronic device
By converting the query vector and data in the server into polynomial form, the query result ciphertext is generated using the polynomial method, which solves the problem of inefficiency caused by complex encrypted data query process in the prior art, and realizes efficient and secure data query.
Patent Information
- Application Number
- CN202411843219.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-04
AI Technical Summary
In the prior art, the encrypted data query process is complicated, resulting in low data query efficiency.
By converting the query vector and the data stored in the server into a polynomial form, the query result ciphertext is quickly generated by polynomial, including receiving the query ciphertext, encoding multiple pieces of data, generating the result ciphertext based on the query ciphertext and polynomial, and sending the result ciphertext to the target terminal for decryption processing.
While ensuring the security of data query, it improves data query efficiency, simplifies the operation process, and reduces the computational complexity.
Smart Images

Figure CN119759953A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cryptography, and in particular to an encrypted data query processing method and an electronic device. Background Art
[0002] The Private Information Retrieval (PIR) protocol allows users to query a remote database for one or more records without revealing the specific information they are querying. PIR can be applied to scenarios such as privacy-protected exception list queries, Domain Name System (DNS) lookup table queries, password verification, anonymous communication, etc. It can protect the user's query information from being known by the server while ensuring the correctness of the query. It is very useful in querying some information that is sensitive to users.
[0003] The PIR in the related art is based on a fully homomorphic encryption structure. At present, the use of PIR is mainly restricted by computing efficiency, communication efficiency, and ease of use. Taking the most widely used private information retrieval (Private Information Retrieval, SealPIR) based on homomorphic encryption as an example, it uses a fully homomorphic encryption method to retrieve private information. Although SealPIR is already a relatively efficient PIR solution in terms of computing efficiency, its computing efficiency still has room for improvement. On the other hand, in terms of ease of use, SealPIR requires each user to send a rotating key during the initialization phase, and the server needs to store this rotating key, which greatly increases the burden on the server when the SealPIR solution is expanded to a multi-user scenario. In addition, due to the use of single instruction multiple data (Single Input Multiple Data, SIMD) encoding, the server needs to perform pre-processing calculations on the database, that is, to encode all data once according to SIMD encoding so that it can be directly calculated when the user queries, but the above operation process is relatively complicated, which easily leads to low data query efficiency when performing encrypted data queries.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide an encrypted data query processing method and an electronic device, so as to at least solve the technical problem in the related art that when performing encrypted data query, the operation process is complicated, resulting in low data query efficiency.
[0006] According to one aspect of an embodiment of the present invention, there is provided an encrypted data query processing method, comprising: receiving a query ciphertext sent by a target terminal, wherein the query ciphertext is obtained by the target terminal by encrypting a first polynomial, the first polynomial is obtained by the target terminal encoding a query vector, the query vector is obtained by the target terminal based on a received data query request, the query vector includes a plurality of elements, the plurality of elements correspond one-to-one to a plurality of data in a server, the elements are used to indicate whether to access the corresponding data; encoding the plurality of data to obtain a second polynomial; generating a result ciphertext based on the query ciphertext and the second polynomial; and sending the result ciphertext to the target terminal, for the target terminal to decrypt the result ciphertext to obtain a data query result corresponding to the data query request.
[0007] According to one aspect of an embodiment of the present invention, another encrypted data query processing method is also provided, including: constructing a query vector based on a data query request, wherein the query vector includes multiple elements, and the multiple elements correspond one-to-one to multiple data in the server; encoding the query vector to obtain a first polynomial; encrypting the first polynomial to obtain a query ciphertext, and sending the query ciphertext to the server; receiving a result ciphertext generated by the server based on the query ciphertext and a second polynomial, wherein the second polynomial is obtained by the server encoding the multiple data; decrypting the result ciphertext to obtain a data query result corresponding to the data query request.
[0008] According to one aspect of an embodiment of the present invention, another encrypted data query processing method is also provided, including: a target terminal constructs a query vector based on a data query request, wherein the query vector includes multiple elements, and the multiple elements correspond one-to-one to multiple data in a server; the target terminal encodes the query vector to obtain a first polynomial; the target terminal encrypts the first polynomial to obtain a query ciphertext, and sends the query ciphertext to the server; the server encodes the multiple data to obtain a second polynomial; the server generates a result ciphertext based on the query ciphertext and the second polynomial, and sends the result ciphertext to the target terminal; the target terminal decrypts the result ciphertext to obtain a data query result corresponding to the data query request.
[0009] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the encrypted data query processing methods.
[0010] In an embodiment of the present invention, a query ciphertext sent by a target terminal is received, wherein the query ciphertext is obtained by the target terminal by encrypting a first polynomial, the first polynomial is obtained by the target terminal encoding a query vector, the query vector is obtained by the target terminal based on a received data query request, and the query vector includes multiple elements, the multiple elements correspond one-to-one to multiple data in the server, and the elements are used to indicate whether to access the corresponding data; the multiple data are encoded to obtain a second polynomial; based on the query ciphertext and the second polynomial, a result ciphertext is generated; the result ciphertext is sent to the target terminal, and the target terminal decrypts the result ciphertext to obtain a data query result corresponding to the data query request, thereby achieving the purpose of converting the query vector and the data stored in the server into a polynomial form and quickly generating the query result ciphertext in a polynomial manner, thereby achieving the technical effect of improving the data query efficiency while ensuring the security of the data query, thereby solving the technical problem of the complicated operation process and low data query efficiency in the related technology when performing encrypted data query. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0012] Figure 1 is a flow chart of an encrypted data query processing method according to an embodiment of the present invention;
[0013] Figure 2 is a schematic diagram of an optional vector encoding according to an embodiment of the present invention;
[0014] Figure 3 is a flowchart of another encrypted data query processing method according to an embodiment of the present invention;
[0015] Figure 4 is a flowchart of another encrypted data query processing method according to an embodiment of the present invention;
[0016] Figure 5 is a flow chart of an optional encrypted data query processing method according to an embodiment of the present invention;
[0017] Figure 6 The flowchart of another optional encrypted data query processing method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0020] First, to facilitate understanding of the embodiments of the present invention, some terms or nouns involved in the present invention are explained below:
[0021] Private Information Retrieval (PIR) is a cryptographic protocol that allows a user to retrieve specific information from a database without revealing what specific information is being requested. PIR aims to protect the user's privacy by preventing the database owner from learning the user's query.
[0022] Fully Homomorphic Encryption (FHE) is an encryption algorithm that allows data to be added, multiplied, and more complex operations after encryption.
[0023] Single Instruction Multiple Data (SIMD) usually refers to a computer architecture design that allows a single instruction to execute on multiple data elements at the same time. In the context of fully homomorphic encryption, SIMD and encoding mean the same thing, which is to encode an array into a fully homomorphic encrypted plaintext, that is, a polynomial. Addition and multiplication operations on polynomials can correspond to one-to-one addition and multiplication of arrays.
[0024] Brakerski / Fan-Vercauteren (BFV) fully homomorphic encryption scheme, a scheme that supports fully homomorphic encryption. Fully homomorphic encryption is a special encryption technology that allows addition and multiplication operations on ciphertext while protecting the privacy and security of data. The BFV scheme provides important technical support for achieving secure computation outsourcing and privacy protection.
[0025] The Private Information Retrieval (PIR) protocol allows users to query a remote database for one or more records without revealing the specific information they are querying. PIR can be applied to scenarios such as privacy-protected exception list queries, DNS lookup table queries, password verification, anonymous communication, etc. It can protect the user's query information from being known by the server under the premise of ensuring the correctness of the query. It is very useful in querying some information that is sensitive to users. PIR in related technologies is based on fully homomorphic encryption. At present, the use of PIR is mainly restricted by computing efficiency, communication efficiency, and ease of use.
[0026] Take the most widely used SealPIR as an example, which uses fully homomorphic encryption to retrieve private information. Let the size of the database be N, and the indexes be 0, 1, ..., N-1. If a user wants to query the i-th data, he needs to construct an N-dimensional vector, let the i-th element of the vector be 1, and the rest of the elements be 0, and encrypt the vector and send it to the database. The database will perform an inner product of the user's ciphertext vector and its own database elements, and return the encrypted inner product result to the user. The user decrypts it to get the plaintext. In this way, the user needs to send N query ciphertexts, the server performs N multiplication operations, N addition operations, and finally gets 1 ciphertext and returns it to the user.
[0027] Since users need to send N ciphertexts when querying, in order to reduce communication overhead, SealPIR uses the coefficient extraction method to extract a single element of the n-th order polynomial ciphertext into n {0,1} ciphertexts, at the cost of sending an additional homomorphic rotation key and additional server computing overhead. Through such optimization, users only need to send In terms of calculation, since it is necessary to homomorphically calculate N multiplications and N additions to represent an inner product, if the number of elements N in the database is too large, SealPIR divides the database into two dimensions and regards the database as , two query ciphertexts are sent, representing the row index and the column index. Through this optimization, the query ciphertext that the user needs to send becomes The server needs to do times multiplication, times of addition, and returns F ciphertexts, where F is the expansion multiple of the ciphertext compared to the plaintext. It can be seen that when the amount of data is small, the efficiency of 1-dimensional query is higher than that of 2-dimensional query.
[0028] Although SealPIR is a relatively efficient PIR solution in terms of computational efficiency, its computational efficiency still has room for improvement. On the other hand, in terms of ease of use, SealPIR requires each user to send a rotating key during the initialization phase, and the server needs to store this rotating key, which greatly increases the burden on the server when the SealPIR solution is expanded to multi-user scenarios. In addition, due to the use of single instruction multiple data SIMD encoding, the server needs to perform pre-processing calculations on the database, that is, to encode all data once according to SIMD encoding so that it can be directly calculated when the user queries, and the operation process is complicated.
[0029] According to an embodiment of the present invention, a method embodiment of encrypted data query processing is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] Figure 1 is a flowchart of an encrypted data query processing method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0031] Step S102, constructing a query vector based on the data query request, wherein the query vector includes a plurality of elements, and the plurality of elements correspond one-to-one to a plurality of pieces of data in the server;
[0032] Optionally, the data query request is used to indicate the data that needs to be queried in the server. One piece of data can be queried based on the data query request, or multiple pieces of data can be queried simultaneously based on the query request. The query vector includes multiple dimensions, each dimension corresponds to an element, and the value of the element is 0 or 1, which is used to indicate whether the corresponding data is queried; when the user wants to query a certain piece of data, the value of the element in the corresponding query vector is 1, otherwise it is 0. For example, for data corresponding to N elements in the server, the user wants to query the data corresponding to the i-th element, then construct an N-dimensional vector q, where q[i]=1, and the remaining elements are 0. For another example, the server database stores 5 pieces of data [a,b,c,d,e], and the user's data query request indicates that he wants to query data d, and the corresponding query vector is <0,0,0,1,0>.
[0033] Step S104, encoding the query vector to obtain a first polynomial;
[0034] Optionally, the first polynomial may be obtained by encoding the query vector in a first encoding manner, that is, encoding the query vector in a first encoding manner to obtain the first polynomial. The first encoding manner may be a positive sequence encoding π1: It is also possible to encode π2 in reverse order: Among them, π1 represents the positive sequence code; π2 represents the reverse sequence code; t [x] represents the remainder class ring of integers modulo t; n represents the dimension, that is, the constructed n-dimensional vector; represents n-dimensional integer vector space; Z t [x] / x n +1 for ring Z t The polynomial ring of degree not exceeding n in [x] is called the n-order polynomial ring; x represents the unknown number in the polynomial. Both positive order coding and reverse order coding encode the n-dimensional vector into an n-1-order polynomial. Specifically, positive order coding is used to indicate that the polynomial is arranged in order from low-order terms to high-order terms, and reverse order coding is used to indicate that the polynomial is arranged in order from high-order terms to low-order terms.
[0035] Specifically, the following polynomial can be obtained through positive sequence coding:
[0036] a(x)=π1(a)=a i x i :a(x)=a0+a1x+…+a n-1 x n-1
[0037] Among them, a i (i=0,1,…,n-1) represents the coefficient of any term in the polynomial a(x).
[0038] By reversing the encoding, we can get a polynomial of the following form:
[0039] b(x)=π2(b)=b n-i-1 x i :b(x)=b n-1 +b n-2 x+…+b0x n-1
[0040] Among them, b i (i=0,1,…,n-1) represents the coefficient of any term in the polynomial b(x).
[0041] Where a(x) = a i x i ,b(x)=b i x n-i-1 , x that satisfies a(x)·b(x) n-1 The coefficient of the term is<a,b> The inner product of vectors, where<a,b> The a in the equation represents the coefficient of the polynomial a(x), and the b represents the coefficient of the polynomial b(x).
[0042] For example, Figure 2 is a schematic diagram of an optional vector encoding according to an embodiment of the present invention, such as Figure 2 As shown, for two vectors <2,3,3,7> and <5,2,4,1>, the vector <2,3,3,7> is inversely encoded to obtain the polynomial 7+3x+8x 2 +2x 3 ; Perform forward coefficient encoding on the vector <5,2,4,1> to obtain the polynomial 5+2x+4x 2 +1x 3 .
[0043] It should be noted that in the related art, the server is required to encode the data using SIMD encoding, which is a solution that requires preprocessing. In this embodiment, it is not necessary to encode it, and only a virtual encoding operation is required, that is, a query vector is encoded into a polynomial, for example, the vector (a, b, c, d) is directly encoded into the polynomial a+bx+cx 2 +dx 3 , and the above operations do not consume any time and computing resources.
[0044] In an optional embodiment, when the total number of elements in the query vector is greater than a preset number of polynomial terms and there are multiple first polynomials, the query vector is encoded to obtain the first polynomial, including: dividing the total number of elements and the number of polynomial terms to obtain a target number, wherein the target number is an integer greater than or equal to 2; dividing the query vector into the target number to obtain multiple sub-vectors; and encoding the multiple sub-vectors into multiple first polynomials using a first encoding method, wherein the multiple first polynomials correspond one-to-one to the multiple sub-vectors.
[0045] Optionally, the preset number of polynomial terms is the total number of terms of the first polynomial that is preset. If the total number of elements N in the query vector is less than or equal to the preset number of polynomial terms n, the query vector q can be encoded as a polynomial using reverse order; if the total number of elements N in the query vector is greater than the preset number of polynomial terms n, the total number of elements N and the preset number of polynomial terms n can be divided to divide the query vector into , in order To this The query vectors are respectively subjected to reverse encoding (i.e., π2 encoding) to obtain The polynomials are That is, multiple first polynomials are obtained. In the above manner, by encoding the query vector in reverse order, the query vector can be expressed in the form of a polynomial, which simplifies the operation and calculation of the query vector. Dividing a large query vector into multiple small query vectors and encoding each small query vector is conducive to improving the efficiency of data query and reducing the complexity of calculation.
[0046] Step S106, encrypting the first polynomial to obtain a query ciphertext, and sending the query ciphertext to the server;
[0047] This embodiment utilizes the properties of polynomials and does not use the original SIMD encoding in fully homomorphic encryption (FHE). Instead, it uses polynomial-based coefficient encoding to construct the user's query ciphertext. The query ciphertext constructed by coefficient encoding does not require the server to extract coefficients. For example, the inner product of n numbers can be expressed through one multiplication operation. Compared with the related technology that requires n multiplications and n additions to express one inner product operation, the method provided by this embodiment has higher data query efficiency.
[0048] Optionally, the first polynomial can be encrypted using, but is not limited to, the BFV fully homomorphic encryption scheme to generate the user private key s and calculate the query ciphertext ct i =(c i,0 ,c i,1 ), where c i,1is a randomly chosen polynomial, and another polynomial e is a noise that conforms to Gaussian distribution. Query ciphertext {ct i} is sent to the server, t represents the size of the modulus used in the coefficient coding scheme; in the coefficient coding scheme, the choice of modulus t affects the complexity of encoding and decoding and the performance of the system.
[0049] Step S108, receiving the result ciphertext generated by the server based on the query ciphertext and the second polynomial, wherein the second polynomial is obtained by encoding the plurality of data by the server;
[0050] Optionally, the second polynomial is obtained by encoding multiple pieces of data by the server, and the total number of terms in the second polynomial is the same as the total number of terms in the first polynomial. Specifically, when the total number of elements N in the query vector is greater than the preset number of polynomial terms n, the multiple pieces of data in the server can be recorded as d, |d|=N, N is the total number of elements in the query vector, and similarly, the server splits the data into group, and Each group in the group is taken as a vector, and multiple data vectors are obtained, which are recorded as The server respectively Vectors are mapped to positive order encoding π1. Multiple second polynomials are obtained:
[0051] Optionally, the result ciphertext can be obtained by the server performing inner product calculation on the query ciphertext and each second polynomial and summing them up, that is, the server result ciphertext It should be noted that the result ciphertext ct r There is only the highest degree term, that is, x n-1 The term contains the required inner product result, and the remaining terms are irrelevant. Note that the ciphertext of the result initially obtained by the inner product calculation is in the form of ct r =(ct r,0 ,ct r,1 ), which is consistent with the query ciphertext format, where the plaintext information is mainly contained in ct r,0 Therefore, the server can ct r,0 Except x n-1 All elements except the item are set to 0. On the one hand, it can reduce the communication overhead during the transmission of the result ciphertext, and on the other hand, it can reduce the additional information leakage caused by other redundant items. The server sends the above de-redundant result ciphertext ct ′ r =(ct ′ r,0 ,ct r,1 ) is sent to the target terminal.
[0052] In an optional embodiment, the second polynomial is obtained by encoding the plurality of data using a second encoding method, wherein the encoding order of the first encoding method is opposite to that of the second encoding method, that is, when the first encoding method is a positive encoding, the corresponding second encoding method is a reverse encoding; when the first encoding method is a reverse encoding, the corresponding second encoding method is a positive encoding.
[0053] It should be noted that the polynomial a(x)=a constructed by the positive sequence coding i x i The polynomial b(x)=b constructed with the reverse coding i x n-i-1 , x that satisfies a(x)·b(x) n-1 The coefficient of the term is<a,b> The inner product value of the vector. Therefore, the first polynomial and the second polynomial are encoded in the opposite order, and then the first polynomial and the second polynomial are encoded in the opposite order. n-1 The coefficients of the terms and other information are used to generate and optimize the structure of the resulting ciphertext.
[0054] Step S110, decrypting the result ciphertext to obtain a data query result corresponding to the data query request.
[0055] Optionally, the received result ciphertext t may be coded using the BFV method, but is not limited to ′ r =(ct ′ r,0 ,ct r,1 ) to perform decryption processing and obtain the data query result corresponding to the data query request
[0056] The execution subject of the above steps S102 to S110 is the target terminal. Through the above steps S102 to S108, the purpose of quickly generating the ciphertext of the query result by converting the query vector and the data stored in the server into a polynomial form can be achieved, thereby achieving the technical effect of improving the data query efficiency while ensuring the security of the data query, and thus solving the technical problem of complex operation process and low data query efficiency when performing encrypted data query in related technologies.
[0057] According to an embodiment of the present invention, another encrypted data query processing method is also provided. Figure 3 is a flowchart of another encrypted data query processing method according to an embodiment of the present invention. Figure 3 As shown, the method comprises the following steps:
[0058] Step S202, receiving a query ciphertext sent by a target terminal, wherein the query ciphertext is obtained by encrypting a first polynomial by the target terminal, the first polynomial is obtained by encoding a query vector by the target terminal, the query vector is obtained by the target terminal based on a received data query request, the query vector includes a plurality of elements, the plurality of elements correspond one-to-one to a plurality of pieces of data in the server, and the elements are used to indicate whether to access the corresponding data;
[0059] Optionally, before executing step S202, the target terminal constructs a query vector based on the query request, the query vector includes multiple elements, each element corresponds to a piece of data in the server; each dimension corresponds to an element, the value of the element is 0 or 1, which is used to indicate whether the corresponding data is queried; when the user wants to query a piece of data, the value of the element in the corresponding query vector is 1, otherwise it is 0. The target terminal encodes the query vector using the first encoding method to obtain a first polynomial, and encrypts the first polynomial using the BFV fully homomorphic encryption scheme to obtain a query ciphertext.
[0060] It should be noted that before executing step S202, the target terminal constructs the user's query ciphertext based on the coefficient coding of the polynomial. The query ciphertext constructed by coefficient coding does not require the server to extract coefficients. For example, the inner product of n numbers can be expressed by one multiplication operation. Compared with the related technology that requires n multiplications and n additions to express one inner product operation, the method provided by this embodiment has higher data query efficiency.
[0061] Optionally, when the total number of elements N in the query vector is less than or equal to the preset number of polynomial terms n, the query vector q can be encoded as a polynomial using reverse order; when the total number of elements N in the query vector is greater than the preset number of polynomial terms n, the total number of elements N and the preset number of polynomial terms n can be divided to divide the query vector into , respectively To this The query vectors are respectively subjected to reverse encoding (i.e., π2 encoding) to obtain Polynomial That is, multiple first polynomials are obtained. In the above manner, by encoding the query vector in reverse order, the vector can be represented in the form of a polynomial, which simplifies the operation and calculation of the query vector. Dividing a large query vector into multiple small query vectors and encoding each small query vector is conducive to improving the query efficiency and reducing the complexity of the calculation.
[0062] Step S204, encoding the plurality of pieces of data to obtain a second polynomial;
[0063] Optionally, the first polynomial may be obtained by encoding the query vector in a first encoding method; the second polynomial may be obtained by encoding the plurality of data in a second encoding method, and the encoding order of the first encoding method and the second encoding method is opposite. The first encoding method may be a forward encoding method or a reverse encoding method, that is, the first polynomial may be obtained by a forward encoding method or a reverse encoding method.
[0064] In the case where the first encoding method is forward encoding, the second encoding method is reverse encoding, wherein the forward encoding is used to indicate that the polynomial is arranged in order from low-order terms to high-order terms, and the reverse encoding is used to indicate that the polynomial is arranged in order from high-order terms to low-order terms; or in the case where the first encoding method is reverse encoding, the second encoding method is forward encoding. By using opposite encoding methods to obtain the first polynomial and the second polynomial, when the result ciphertext is subsequently generated, such as when the result ciphertext is generated based on the inner product method, the result ciphertext can be simplified based on the number of specified items in the inner product result (also in the form of a polynomial), and redundant items in the result ciphertext can be removed. The above method can reduce the communication overhead in the transmission process of the result ciphertext, and reduce the additional information leakage caused by other redundant items in the ciphertext result.
[0065] In an optional embodiment, when the total number of elements in the query vector is greater than a preset number of polynomial terms and there are multiple second polynomials, multiple data are encoded to obtain a second polynomial, including: dividing the total number of elements and the number of polynomial terms to obtain a target number, wherein the target number is an integer greater than or equal to 2; dividing the multiple data into the target number to obtain multiple groups of data; and encoding the multiple groups of data into multiple second polynomials using a second encoding method, wherein the multiple second polynomials correspond one-to-one to the multiple groups of data.
[0066] Optionally, when the total number of elements N in the query vector is greater than the preset number of polynomial terms n, a division operation may be performed on the total number of elements N and the number of polynomial terms n to split the multiple data d (where |d|=N) into group, and Each group in the group is taken as a vector, and multiple data vectors are obtained, which are recorded as The server respectively Vectors are mapped to positive order encoding π1. Multiple second polynomials are obtained: In the above method, by encoding the query vector in positive order, multiple data can be expressed in the form of polynomials, which simplifies the operation and calculation of multiple data. Dividing large multiple data into multiple small groups and encoding each small group of data is conducive to improving the efficiency of data query and reducing the complexity of calculation. And setting the splitting form of multiple data to be the same as the splitting form of the query vector is conducive to the subsequent calculation and generation of the result ciphertext.
[0067] Step S206, generating a result ciphertext based on the query ciphertext and the second polynomial;
[0068] Optionally, a result ciphertext may be obtained by performing corresponding operations on the query ciphertext and the second polynomial, so that the generated result ciphertext includes both information related to the query ciphertext and information related to the query result, thereby realizing encrypted query of data.
[0069] In an optional embodiment, generating a result ciphertext based on the query ciphertext and the second polynomial includes: performing inner product processing on the query ciphertext and the second polynomial to obtain an inner product processing result; and generating a result ciphertext based on the inner product processing result.
[0070] Optionally, in the case where there is only one second polynomial, the result ciphertext can be generated based on an inner product processing result. In the case where there are multiple second polynomials, multiple second polynomials can be respectively processed with the query ciphertext to obtain multiple inner product processing results, and the multiple inner product processing results can be summed to obtain a summation result, wherein the summation result can be understood as the result ciphertext calculated initially:
[0071]
[0072] In an optional embodiment, generating a result ciphertext based on the inner product processing result includes: extracting items corresponding to a predetermined number of times in the inner product processing result to obtain an extraction result; and generating a result ciphertext based on the extraction result.
[0073] Optionally, the item of the predetermined number may be the item of the highest number in the inner product processing result.
[0074] It should be noted that the result ciphertext ct r There is only the highest degree term, that is, x n-1 The term contains the required inner product result, and the remaining terms are irrelevant. Note that the ciphertext of the result initially obtained by the inner product calculation is in the form of ct r =(ct r,0 ,ct r,1 ), which is consistent with the query ciphertext format, where the plaintext information is mainly contained in ct r,0 Therefore, the server can ctr,0 Except x n-1 All elements except the item are set to 0. On the one hand, it can reduce the communication overhead during the transmission of the result ciphertext, and on the other hand, it can reduce the additional information leakage caused by other redundant items. The server sends the above de-redundant result ciphertext ct ′ r =(ct ′ r,0 ,ct r,1 ) is sent to the target terminal.
[0075] Step S208: Send the result ciphertext to the target terminal, so that the target terminal decrypts the result ciphertext to obtain the data query result corresponding to the data query request.
[0076] Optionally, after sending the result ciphertext to the target terminal, the target terminal may use the BFV method to perform the received result ciphertext t ′ r =(ct ′ r,0 ,ct r,1 ) to perform decryption processing and obtain the data query result corresponding to the data query request
[0077]
[0078] The execution subject of the above steps S202 to S208 is the server. Through the above steps S102 to S108, the purpose of quickly generating the ciphertext of the query result by converting the query vector and the data stored in the server into a polynomial form can be achieved, thereby achieving the technical effect of improving the data query efficiency while ensuring the security of the data query, and further solving the technical problem of complex operation process and low data query efficiency when performing encrypted data query in related technologies.
[0079] According to an embodiment of the present invention, another encrypted data query processing method is also provided. Figure 4 is a flowchart of another encrypted data query processing method according to an embodiment of the present invention. Figure 4 As shown, the method comprises the following steps:
[0080] Step S302: The target terminal constructs a query vector based on the data query request, wherein the query vector includes a plurality of elements, and the plurality of elements correspond one-to-one to a plurality of pieces of data in the server;
[0081] Step S304: the target terminal encodes the query vector to obtain a first polynomial;
[0082] Step S306: the target terminal encrypts the first polynomial to obtain a query ciphertext, and sends the query ciphertext to the server;
[0083] Step S308, the server encodes the multiple pieces of data to obtain a second polynomial;
[0084] Step S310: The server generates a result ciphertext based on the query ciphertext and the second polynomial, and sends the result ciphertext to the target terminal;
[0085] Step S312: the target terminal decrypts the result ciphertext to obtain a data query result corresponding to the data query request.
[0086] The execution entities of the above steps S302 to S312 are the target terminal and the server. Through the above steps S302 to S312, the purpose of quickly generating the ciphertext of the query result by converting the query vector and the data stored in the server into a polynomial form can be achieved, thereby achieving the technical effect of improving the data query efficiency while ensuring the security of the data query, and further solving the technical problem of complex operation process and low data query efficiency when performing encrypted data query in related technologies.
[0087] Based on the above embodiments and optional embodiments, the present invention proposes an optional implementation mode: Figure 5 is a flowchart of an optional encrypted data query processing method according to an embodiment of the present invention, such as Figure 5 As shown, the method includes:
[0088] S1, the user (i.e., the terminal device side) constructs a query vector. For a server with N elements corresponding to data, the user wants to query the data corresponding to the i-th element, so an N-dimensional vector q is constructed, where q[i]=1 and the remaining elements are 0.
[0089] S2, the user performs coefficient encoding on the query vector, including:
[0090] For the case of N≤n, the user uses the reverse encoding of the query vector q into a polynomial. For the case of N>n, the user divides the query vector into , respectively To this The query vectors are respectively subjected to reverse encoding (i.e., π2 encoding) to obtain Polynomial
[0091] S3, the user encrypts the encoded vector (i.e. the query ciphertext) and sends it to the server, including:
[0092] The BFV fully homomorphic encryption scheme can be used for encryption operations. The user generates a private key s and calculates ct i =(c i,0 ,c i,1 ), where c i,1 is a randomly chosen polynomial, e is a noise that conforms to Gaussian distribution. Query ciphertext {ct i} is sent to the server, where t represents the modulus corresponding to the query vector q.
[0093] S4: The server performs an inner product operation on the query ciphertext and the database, including:
[0094] Let the multiple pieces of data in the server be d, |d| = N, N is the total number of elements in the query vector, and similarly, the server splits the data into group, and Each group is taken as a vector, and multiple data vectors are obtained, which are recorded as The server respectively The vectors are mapped to the positive sequence code π1. The resulting polynomial is Server calculation result ciphertext
[0095] S5: The server removes irrelevant items from the resulting ciphertext, including:
[0096] As mentioned in the second step of coefficient encoding, only x is included in the result. n-1 The term contains the required inner product result, and the remaining terms are irrelevant. Note that the ciphertext of the result initially obtained by the inner product calculation is in the form of ct r =(ct r,0 ,ct r,1 ), which is consistent with the query ciphertext format, where the plaintext information is mainly contained in ct r,0 Therefore, the server can ct r,0 Except x n-1 All elements outside the items are set to 0. On the one hand, it can reduce the communication overhead, and on the other hand, it can reduce the additional information leakage caused by other redundant items.
[0097] S6: The user decrypts and obtains the query results, including:
[0098] The server will remove the above redundancy and ciphertext ct ′ r =(ct ′ r,0 ,ct r,1 ) is sent to the user, who uses the BFV decryption method to obtain:
[0099] It should be noted that, for data items with a large single data size, the server can split it into multiple logt size range data according to bits, perform a query operation on each data, and return them to the user together. The solution proposed in this embodiment can use cuckoo hash to perform mPIR transformation, which can turn a single query into multiple queries. The transformation solution of this embodiment (realizing a single PIR through coefficient encoding) from a single PIR to multiple PIRs is still within the scope of protection of this application.
[0100] It should be noted that this embodiment uses the properties of polynomials and can use coefficient coding to construct the user's query ciphertext instead of the original SIMD coding in FHE. The query ciphertext constructed by coefficient coding does not require the server to extract coefficients, and one multiplication operation can express the inner product of n numbers, compared to the related art that requires n multiplications and n additions to express one inner product operation. In the scheme constructed by coefficient coding, the modulus t of the coefficient can take any value, while in the original SIMD scheme, the modulus needs to satisfy the restriction of t≡1mod 2n, resulting in the need for a modulus space of logt+1 bits to express data of logt size, while in this embodiment, the modulus t can be set to 2 k , we can use the modulus space of logt to express data of logt size. When computing the data on the server, there is no need to encode it. We only need to perform a virtual encoding operation, that is, to directly regard a query vector as a polynomial. For example, we can directly regard the vector (a, b, c, d) as a+bx+cx 2 +dx 3 This operation does not consume any time and computing resources. In the related art, the server is required to encode the data using SIMD encoding, which is a solution that requires preprocessing.
[0101] In the single-server private information retrieval algorithm in the related art, the user needs to send a rotating key to the server that needs to be saved by the server. As the number of users increases, the number of keys that the server needs to maintain will become too many, which is not easy to expand. In addition, since SIMD encoding is used to perform operations on ciphertext, the server needs to add an additional overhead for preprocessing the database. In contrast, this embodiment can achieve at least one of the following effects: 1) Stronger scalability: the server does not need to store the rotating key of each user, users can come and go, and user changes do not affect the server overhead. It is easier to expand to multiple users than the solutions in the related art. 2) Stronger usability: the server does not need to preprocess the data, and queries can be performed directly. 3) Higher-speed server computing performance: Through the solution designed in this embodiment, for 1-dimensional database queries, the computing efficiency can be increased by up to O(n) times. In addition, the server does not need to extract coefficients for the user's query information, which further enhances the computing efficiency. 4) Higher-speed user-side computing performance: Through the solution designed in this embodiment, the user query process calculates one less SIMD encoding process than the original solution. 5) When the results are returned, the scheme designed in this embodiment will not leak other data in the database, and the security is enhanced compared to the previous one. In the scheme of the related art, in order to reduce communication and computing overhead, multiple database information will be put into a ciphertext, and the user will get additional information in addition to the query results. 6) The scheme proposed in this embodiment can effectively adopt the cuckoo hash method proposed in SealPIR to transform it into a multi-query. The multi-query constructed by this embodiment still has advantages in computing performance, ease of use and scalability compared to the multi-query constructed by SealPIR.
[0102] Based on the above embodiments and optional embodiments, the present invention proposes another optional implementation mode: Figure 6 is a flowchart of another optional encrypted data query processing method according to an embodiment of the present invention. Figure 6 As shown, in this method, a user (i.e., a target terminal) queries a database of 5 pieces of data in a server, and the server contains 5 pieces of data [a, b, c, d, e]. The user uses a PIR to query the fourth piece of data. The method includes:
[0103] S21, the user generates a query vector of <0,0,0,1,0>.
[0104] S22, the user encodes the vector into a polynomial x using π2 inverse encoding.
[0105] S23, encrypt x into a query ciphertext ct = (c0, c1) using BFV encryption, where c1 is a random polynomial.
[0106]
[0107] S24, the user sends the query ciphertext ct to the server.
[0108] S25, the server encodes its own database in π1 positive sequence as m(x)=a+bx+cx 2 +dx 3 +ex 4 .
[0109] S26, the server uses a homomorphic multiplication operation to obtain the result ciphertext ct r =(c0·m(x),c1·m(x)).
[0110] S27, the server divides the number x in c0·m(x) by n-1 Delete all items other than the first one and return the processed ciphertext to the user.
[0111] S28, the user decrypts and obtains the query result d.
[0112] In the present embodiment, an encrypted data query processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the terms "module" and "device" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0113] According to an embodiment of the present invention, another device embodiment for implementing the above-mentioned encrypted data query processing method is provided. The above-mentioned encrypted data query processing device includes: a first receiving module, a first encoding module, a first generating module, and a first sending module, wherein:
[0114] A first receiving module is used to receive a query ciphertext sent by a target terminal, wherein the query ciphertext is obtained by the target terminal by encrypting a first polynomial, the first polynomial is obtained by the target terminal encoding a query vector, the query vector is obtained by the target terminal based on a received data query request, the query vector includes a plurality of elements, the plurality of elements correspond one-to-one to a plurality of data in the server, and the elements are used to indicate whether to access the corresponding data;
[0115] A first encoding module, connected to the first receiving module, for encoding the plurality of data to obtain a second polynomial;
[0116] A first generating module, connected to the first encoding module, for generating a result ciphertext based on the query ciphertext and the second polynomial;
[0117] The first sending module is connected to the first generating module and is used to send the result ciphertext to the target terminal, so that the target terminal decrypts the result ciphertext to obtain the data query result corresponding to the data query request.
[0118] According to an embodiment of the present invention, another device embodiment for implementing the above-mentioned encrypted data query processing method is also provided. The above-mentioned encrypted data query processing device includes: a first construction module, a second encoding module, a first encryption module, a second generation module, and a first decryption module, wherein:
[0119] A first building module is used to build a query vector based on the data query request, wherein the query vector includes a plurality of elements, and the plurality of elements correspond one-to-one to a plurality of data in the server;
[0120] A second encoding module, connected to the first building module, is used to encode the query vector to obtain a first polynomial;
[0121] A first encryption module, connected to the second encoding module, is used to encrypt the first polynomial to obtain a query ciphertext, and send the query ciphertext to the server;
[0122] A second generation module, connected to the first encryption module, is used to receive a result ciphertext generated by the server based on the query ciphertext and a second polynomial, wherein the second polynomial is obtained by encoding a plurality of data by the server;
[0123] The first decryption module is connected to the second generation module and is used to decrypt the result ciphertext to obtain the data query result corresponding to the data query request.
[0124] According to an embodiment of the present invention, another device embodiment for implementing the above-mentioned encrypted data query processing method is also provided. The above-mentioned encrypted data query processing device includes: a second construction module, a third encoding module, a second encryption module, a fourth encoding module, a third generation module, and a second decryption module, wherein:
[0125] A second building module is used for the target terminal to build a query vector based on the data query request, wherein the query vector includes multiple elements, and the multiple elements correspond one-to-one to the multiple data in the server;
[0126] A third encoding module, connected to the second building module, is used for the target terminal to encode the query vector to obtain a first polynomial;
[0127] A second encryption module, connected to the third encoding module, is used for the target terminal to encrypt the first polynomial to obtain a query ciphertext, and send the query ciphertext to the server;
[0128] A fourth encoding module, connected to the second encryption module, is used for the server to encode the plurality of data to obtain a second polynomial;
[0129] A third generating module, connected to the fourth encoding module, is used for the server to generate a result ciphertext based on the query ciphertext and the second polynomial, and send the result ciphertext to the target terminal;
[0130] The second decryption module is connected to the third generation module and is used for the target terminal to decrypt the result ciphertext to obtain the data query result corresponding to the data query request.
[0131] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0132] It should be noted that the first construction module, the second coding module, the first encryption module, the second generation module, and the first decryption module correspond to steps S102 to S110 in the embodiment, the first receiving module, the first coding module, the first generation module, and the first sending module correspond to steps S202 to S208 in the embodiment, and the second construction module, the third coding module, the second encryption module, the fourth coding module, the third generation module, and the second decryption module correspond to steps S302 to S312 in the embodiment. The examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules can be run in a computer terminal as part of the device.
[0133] It should be noted that the optional or preferred implementation of this embodiment can refer to the relevant description in the embodiment, which will not be repeated here.
[0134] The above-mentioned encrypted data query processing device may also include a processor and a memory. The above-mentioned modules are all stored in the memory as program modules, and the processor executes the above-mentioned program modules stored in the memory to realize corresponding functions.
[0135] The processor includes a kernel, which retrieves the corresponding program module from the memory. The kernel may be one or more. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory includes at least one memory chip.
[0136] According to an embodiment of the present application, an embodiment of a non-volatile storage medium is also provided. Optionally, in this embodiment, the non-volatile storage medium includes a stored program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute any one of the encrypted data query processing methods.
[0137] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group, and the non-volatile storage medium includes a stored program.
[0138] Optionally, when the program is running, the device where the non-volatile storage medium is located is controlled to perform the following functions: receiving a query ciphertext sent by the target terminal, wherein the query ciphertext is obtained by the target terminal by encrypting a first polynomial, the first polynomial is obtained by the target terminal encoding a query vector, the query vector is obtained by the target terminal based on a received data query request, the query vector includes multiple elements, the multiple elements correspond one-to-one to multiple data in the server, and the elements are used to indicate whether to access the corresponding data; encoding the multiple data to obtain a second polynomial; generating a result ciphertext based on the query ciphertext and the second polynomial; sending the result ciphertext to the target terminal, for the target terminal to decrypt the result ciphertext to obtain a data query result corresponding to the data query request.
[0139] According to an embodiment of the present application, an embodiment of a processor is also provided. Optionally, in this embodiment, the processor is used to run a program, wherein the program executes any one of the encrypted data query processing methods when it is run.
[0140] According to an embodiment of the present application, an embodiment of a computer program product is also provided. When executed on a data processing device, it is suitable for executing a program that initializes any one of the steps of the above-mentioned encrypted data query processing method.
[0141] Optionally, the above-mentioned computer program product, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: receiving a query ciphertext sent by a target terminal, wherein the query ciphertext is obtained by the target terminal by encrypting a first polynomial, the first polynomial is obtained by the target terminal encoding a query vector, the query vector is obtained by the target terminal based on a received data query request, the query vector includes multiple elements, the multiple elements correspond one-to-one to multiple data in the server, and the elements are used to indicate whether to access the corresponding data; encoding the multiple data to obtain a second polynomial; generating a result ciphertext based on the query ciphertext and the second polynomial; sending the result ciphertext to the target terminal, for the target terminal to decrypt the result ciphertext to obtain a data query result corresponding to the data query request.
[0142] An embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: receiving a query ciphertext sent by a target terminal, wherein the query ciphertext is obtained by the target terminal by encrypting a first polynomial, the first polynomial is obtained by the target terminal encoding a query vector, the query vector is obtained by the target terminal based on a received data query request, the query vector includes multiple elements, the multiple elements correspond one-to-one to multiple data in a server, and the elements are used to indicate whether to access the corresponding data; encoding the multiple data to obtain a second polynomial; generating a result ciphertext based on the query ciphertext and the second polynomial; sending the result ciphertext to the target terminal, so that the target terminal decrypts the result ciphertext to obtain a data query result corresponding to the data query request.
[0143] The above sequence of the embodiments of the present invention is for description only and does not represent the superiority or inferiority of the embodiments.
[0144] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0145] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above modules can be a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, modules or indirect coupling or communication connection of modules, which can be electrical or other forms.
[0146] The modules described above as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0147] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of software functional modules.
[0148] If the above-mentioned integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a non-volatile storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0149] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for querying encrypted data, characterized in that: include: receiving a query ciphertext sent by a target terminal, wherein the query ciphertext is obtained by the target terminal by encrypting a first polynomial, the first polynomial is obtained by the target terminal by encoding a query vector, the query vector is obtained by the target terminal based on a received data query request, the query vector includes a plurality of elements, the plurality of elements correspond one-to-one to a plurality of pieces of data in the server, and the elements are used to indicate whether to access the corresponding data; Performing encoding processing on the plurality of pieces of data to obtain a second polynomial; Generate a result ciphertext based on the query ciphertext and the second polynomial; The result ciphertext is sent to the target terminal, so that the target terminal decrypts the result ciphertext to obtain the data query result corresponding to the data query request.
2. The method according to claim 1, characterized in that The first polynomial is obtained by encoding the query vector in a first encoding manner; the second polynomial is obtained by encoding the multiple pieces of data in a second encoding manner, and the encoding order of the first encoding manner is opposite to that of the second encoding manner.
3. The method according to claim 2, characterized in that In the case where the first encoding mode is forward encoding, the second encoding mode is reverse encoding, wherein the forward encoding is used to indicate that the polynomials are arranged in order from low-order terms to high-order terms, and the reverse encoding is used to indicate that the polynomials are arranged in order from high-order terms to low-order terms; or When the first encoding method is the reverse encoding method, the second encoding method is the forward encoding method.
4. The method according to claim 2, characterized in that: When the total number of elements in the query vector is greater than the preset number of polynomial terms and there are multiple second polynomials, encoding the multiple pieces of data to obtain the second polynomial includes: Performing a division operation on the total number of elements and the number of terms of the polynomial to obtain a target number, wherein the target number is an integer greater than or equal to 2; Dividing the plurality of pieces of data into the target number to obtain a plurality of groups of data; The plurality of groups of data are encoded into a plurality of second polynomials by adopting a second encoding method, wherein the plurality of second polynomials correspond to the plurality of groups of data one by one.
5. The method according to claim 1, characterized in that The generating a result ciphertext based on the query ciphertext and the second polynomial includes: Performing inner product processing on the query ciphertext and the second polynomial to obtain an inner product processing result; Based on the inner product processing result, the result ciphertext is generated.
6. The method according to claim 5, characterized in that The generating the result ciphertext based on the inner product processing result includes: Extracting items corresponding to a predetermined number of times from the inner product processing result to obtain an extraction result; Based on the extraction result, the result ciphertext is generated.
7. A method for querying encrypted data, characterized in that: include: Based on the data query request, construct a query vector, wherein the query vector includes a plurality of elements, and the plurality of elements correspond one-to-one to a plurality of pieces of data in the server; Performing encoding processing on the query vector to obtain a first polynomial; Encrypting the first polynomial to obtain a query ciphertext, and sending the query ciphertext to the server; Receiving a result ciphertext generated by the server based on the query ciphertext and a second polynomial, wherein the second polynomial is obtained by encoding the plurality of pieces of data by the server; The result ciphertext is decrypted to obtain the data query result corresponding to the data query request.
8. The method according to claim 7, characterized in that When the total number of elements in the query vector is greater than the preset number of polynomial terms and there are multiple first polynomials, encoding the query vector to obtain the first polynomial includes: Performing a division operation on the total number of elements and the number of terms of the polynomial to obtain a target number, wherein the target number is an integer greater than or equal to 2; Divide the query vector into the target number to obtain multiple sub-vectors; The plurality of sub-vectors are encoded into a plurality of first polynomials by adopting a first encoding method, wherein the plurality of first polynomials correspond to the plurality of sub-vectors one-to-one.
9. A method for querying encrypted data, characterized in that: include: The target terminal constructs a query vector based on the data query request, wherein the query vector includes a plurality of elements, and the plurality of elements correspond one-to-one to the plurality of data in the server; The target terminal performs encoding processing on the query vector to obtain a first polynomial; The target terminal encrypts the first polynomial to obtain a query ciphertext, and sends the query ciphertext to the server; The server performs encoding processing on the plurality of pieces of data to obtain a second polynomial; The server generates a result ciphertext based on the query ciphertext and the second polynomial, and sends the result ciphertext to the target terminal; The target terminal decrypts the result ciphertext to obtain a data query result corresponding to the data query request.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the encrypted data query processing method described in any one of claims 1 to 9.
Citation Information
Cited By
Data query method, data query device, data query system and storage medium
CN120372690A
Location privacy protection method and system based on homomorphic encryption
CN120433975A
A homomorphic encryption-based location privacy protection method and system
CN120433975B