Data table query method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202510451913.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2026-10-20
AI Technical Summary
虽然服务提供方采用封闭域或者可信硬件的方式保证不会获取查询者的敏感数据,但查询者普遍表示担忧,这是由于敏感数据出域后不可控所导致的
[0056]通过获取查询信息查询请求包括待查索引i,所述待查索引i表征待查询数据在数据表中的位置,所述数据表的行数为n1,列数为n2,将待查索引i分解为行索引i1和列索引i2,并构建比特向量,比特向量的维度数为p,且在第s维度的特征值为1,p=n1,s=i1,或者p=n2,s=i2;本申请仅需要构建一个比特向量,对该比特向量进行同态加密获得第一密文,相较于全同态加密的安全查询,将两个比特向量的加密降低为1个比特向量的加密,被查询端在获得第一密文后对所述第一密文和q个目标数据进行同态内积运算,得到第二密文,并采用q个随机数对所述第二密文进行盲化处理,得到第三密文,查询端根据rs对所述第三密文进行反盲化处理,对反盲化处理后的第三密文进行解密,也即将另一个比特向量用不经意传输的安全查询进行替换,使得查询端加密的密文只有1个且密文模式为2,进一步减少了通信开销和计算开销,并且本申请仅需采用q个随机数对具有q项的第二密文进行盲化处理,相比完全采用不经意传输查询的方案,大幅减少了盲化处理以及与查询端进行数据传输的数据量,提升了查询效率。
Smart Images

Figure HDA0005354423200000011 
Figure HDA0005354423200000012 
Figure HDA0005354423200000013
Abstract
Description
Technical Field
[0001] This application relates to the field of information security technology. Specifically, this application relates to a query terminal method for a data table, a query terminal, a queried terminal, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] With the increasing popularity of federated queries and large language model reasoning services, privacy issues are becoming more and more apparent.
[0003] Users who use query / reasoning services do not want their sensitive data to be accessed and stored by the service provider. Although service providers use closed domains or trusted hardware to ensure that they do not access users' sensitive data, users generally express concern because sensitive data becomes uncontrollable once it leaves the domain. This concern limits the full realization of the value of users' data. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for querying data tables, which can solve the above-mentioned problems of the prior art. The technical solution is as follows:
[0005] According to a first aspect of the embodiments of this application, a method for querying a data table is provided, applied to a query terminal, the method comprising:
[0006] Obtain a query request, the query request including the index to be queried i, the index to be queried i representing the position of the data to be queried in the data table, the data table having n1 rows and n2 columns;
[0007] The index i to be queried is decomposed into row index i1 and column index i2, and a bit vector is constructed. The number of dimensions of the bit vector is p, and the feature value of the s-th dimension is 1; where p = n1, s = i1, or p = n2, s = i2.
[0008] The bit vector is homomorphically encrypted to obtain a first ciphertext, which is then sent to the queried end. The queried end performs homomorphic inner product operations on q target data with the first ciphertext to obtain a second ciphertext. The second ciphertext is then blinded using q random numbers to obtain a third ciphertext. Here, p = n1, the target data is column data of the data table, and q = n2, or p = n2, the target data is row data of the data table, and q = n1.
[0009] Based on s, a random number r is obtained from the q random numbers. s According to r sThe third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
[0010] According to a second aspect of the embodiments of this application, a method for querying a data table is provided, applied to the queried end, the method comprising:
[0011] Receive the first ciphertext; the first ciphertext is the ciphertext obtained by the query end through homomorphic encryption of the bit vector, the bit vector has a dimension of p, and the feature value of the s-th dimension is 1; where, if p = n1, s = i1, if p = n2, s = i2; n1 is the number of rows in the data table, n2 is the number of columns in the data table; i1 represents the row index obtained by decomposing the query index i, and i2 represents the column index obtained by decomposing the query index i.
[0012] The first ciphertext is obtained by performing a homomorphic inner product operation on q target data respectively, where p = n1, the target data is the column data of the data table, q = n2, or p = n2, the target data is the row data of the data table, and q = n1.
[0013] The second ciphertext is blinded using q random numbers to obtain the third ciphertext, which is then sent to the querying end.
[0014] According to a third aspect of the embodiments of this application, a data table query device is provided, applied to a query terminal, the device comprising:
[0015] The request acquisition module is used to acquire a query request, the query request including the index to be queried i, the index to be queried i representing the position of the data to be queried in the data table, the data table having n1 rows and n2 columns;
[0016] The index decomposition module is used to decompose the index to be searched i into row index i1 and column index i2, and construct a bit vector. The number of dimensions of the bit vector is p, and the feature value of the s-th dimension is 1; where p = n1, s = i1, or p = n2, s = i2.
[0017] A homomorphic encryption module is used to homomorphically encrypt the bit vector to obtain a first ciphertext, send the first ciphertext to the queried end, so that the queried end performs homomorphic inner product operations with the first ciphertext with q target data respectively to obtain a second ciphertext, and performs blinding processing on the second ciphertext with q random numbers to obtain a third ciphertext, wherein p = n1, the target data is the column data of the data table, q = n2, or p = n2, the target data is the row data of the data table, q = n1;
[0018] The decryption module is used to obtain a random number r from the q random numbers based on s.s According to r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
[0019] In some embodiments, the homomorphic encryption module performs homomorphic encryption on the bit vector to obtain the first ciphertext, including:
[0020] The preset polynomial is encoded based on the bit vector, and the encoded polynomial is used as the encoding result, wherein the number of terms in the polynomial is p;
[0021] The first ciphertext is obtained by encrypting the encoding result using a homomorphic encryption algorithm based on a preset public key.
[0022] In some embodiments, the q random numbers obtained by the queried end and the random number r obtained by the queried end s This is obtained unintentionally through 1-out-of-q OT transmission between the querying end and the queried end.
[0023] In some embodiments, the second ciphertext includes q terms, where the t-th term represents the homomorphic inner product result between the first ciphertext and the t-th target data, t∈[1,q];
[0024] The third ciphertext is the result of blinding the corresponding items of the second ciphertext by using q random numbers respectively;
[0025] The decryption module is based on r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result, including:
[0026] According to r s The s-th item of the third ciphertext is deblinded to obtain the processed s-th item;
[0027] The s-th item after processing is decrypted based on the preset private key to obtain the query result.
[0028] In some embodiments, if n1 is greater than n2, then p = n1;
[0029] If n1 is less than n2, then p = n2;
[0030] If n1 equals n2, then p = n1 or n2.
[0031] In some embodiments, the index decomposition module decomposes the index to be queried, i, into row index i1 and column index i2, including:
[0032] The row index i1 is obtained by dividing n2 by the index to be searched and rounding down.
[0033] The column index i2 is obtained by performing a modulo operation on n2 with the index i to be queried.
[0034] In some embodiments, the query index i is secretly sharded into i1 (B) and i2 (B) In the case where the queried end performs homomorphic inner product operations on the q target data with the first ciphertext respectively, it also calculates based on i2. (B) Rearrange the data in the data table.
[0035] According to a fourth aspect of the embodiments of this application, a data table query apparatus is provided, applied to a queried end, the method comprising:
[0036] The ciphertext receiving module is used to receive the first ciphertext; the first ciphertext is the ciphertext obtained by the query end through homomorphic encryption of the bit vector, wherein the bit vector has a dimension of p, and the feature value is 1 only in the s-th dimension; wherein, if p = n1, s = i1, if p = n2, s = i2; n1 is the number of rows in the data table, n2 is the number of columns in the data table; i1 represents the row index obtained by decomposing the query index i, and i2 represents the column index obtained by decomposing the query index i.
[0037] The homomorphic inner product module is used to perform homomorphic inner product operations on q target data with the first ciphertext respectively to obtain the second ciphertext, where p = n1, the target data is the column data of the data table, q = n2, or p = n2, the target data is the row data of the data table, q = n1;
[0038] The blinding processing module is used to blind the second ciphertext with q random numbers to obtain the third ciphertext, and then send the third ciphertext to the query terminal.
[0039] In some embodiments, the homomorphic inner product module performs homomorphic inner product operations on q target data with the first ciphertext respectively to obtain the second ciphertext, including:
[0040] For each target data, the target data is treated as a vector of dimension p and homomorphically inner product is performed with the first ciphertext to obtain a fourth ciphertext. The constant term of the plaintext polynomial in the fourth ciphertext represents the homomorphic inner product result between the target data and the first ciphertext.
[0041] Homomorphically package q fourth ciphertexts to obtain the second ciphertext;
[0042] In this context, the t-th coefficient of the plaintext polynomial in the second ciphertext is the constant term of the plaintext polynomial in the t-th fourth ciphertext.
[0043] In some embodiments, the blinding processing module uses q random numbers to blind the second ciphertext to obtain a third ciphertext, including:
[0044] The third ciphertext is obtained by blinding the items in the same order in the second ciphertext by using q random numbers in a preset order.
[0045] In some embodiments, the q random numbers obtained by the queried end and the random number r obtained by the queried end s This is obtained unintentionally through 1-out-of-q OT transmission between the querying end and the queried end.
[0046] In some embodiments, if n1 is greater than n2, then p = n1;
[0047] If n1 is less than n2, then p = n2;
[0048] If n1 equals n2, then p = n1 or n2.
[0049] In some embodiments, the homomorphic inner product module is secretly sharded into i1 by the query index i. (B) and i2 (B) In the case of performing the homomorphic inner product operation on the first ciphertext and q target data, the method further includes:
[0050] For each piece of data in the data table, based on the original position of the data in the data table and i2 (B) Perform an XOR operation and use the result of the XOR operation as the position of the data after rearranging in the data table;
[0051] Among them, i1 (B) For the shards held by the query client, i2 (B) The shard held by the querying end.
[0052] According to a fifth aspect of the embodiments of this application, an electronic device is provided, the electronic device including a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the data table query method provided in the first or second aspect described above.
[0053] According to a sixth aspect of the embodiments of this application, a computer-readable storage medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, it implements the steps of the data table query method provided in the first or second aspect described above.
[0054] According to a seventh aspect of the embodiments of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the data table query method provided in the first or second aspect described above.
[0055] The beneficial effects of the technical solutions provided in this application are:
[0056] The query request, which obtains query information, includes a query index i, which represents the position of the queried data in a data table. The data table has n1 rows and n2 columns. The query index i is decomposed into row index i1 and column index i2, and a bit vector is constructed. The bit vector has a dimension of p, and the eigenvalue of the s-th dimension is 1, where p = n1, s = i1, or p = n2, s = i2. This application only needs to construct one bit vector, and homomorphically encrypts this bit vector to obtain the first ciphertext. Compared to a fully homomorphically encrypted secure query, the encryption of two bit vectors is reduced to the encryption of one bit vector. After obtaining the first ciphertext, the queried end performs a homomorphic inner product operation on the first ciphertext and q target data to obtain the second ciphertext. Then, it uses q random numbers to blind the second ciphertext to obtain the third ciphertext. The query end then uses r... s The third ciphertext is deblinded, and then decrypted. This involves replacing another bit vector with a secure query transmitted unintentionally, ensuring that the ciphertext encrypted at the query end consists of only one ciphertext with a ciphertext mode of 2. This further reduces communication and computational overhead. Moreover, this application only requires q random numbers to blind the second ciphertext with q terms. Compared to the scheme that completely uses a secure query transmitted unintentionally, this significantly reduces the amount of blinding processing and data transmitted with the query end, thereby improving query efficiency. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.
[0058] Figure 1A This is a schematic diagram illustrating the interaction between a queryer and a service provider according to an embodiment of this disclosure;
[0059] Figure 1B This is a schematic diagram of the process for secure querying based on unintentional transmission in an embodiment of this application;
[0060] Figure 1C This is a schematic diagram of the secure query process based on homomorphic encryption in an embodiment of this application;
[0061] Figure 1D A schematic diagram of the system architecture for implementing the data table query method provided in the embodiments of this application;
[0062] Figure 2A A flowchart illustrating a query method combining unintentional transmission and fully homomorphic encryption, provided as an embodiment of this application;
[0063] Figure 2BA flowchart illustrating a data table query method provided in an embodiment of this application;
[0064] Figure 3 An interactive schematic diagram illustrating a data table query method provided in an embodiment of this application;
[0065] Figure 4 A schematic diagram illustrating a data table query method provided in an embodiment of this application;
[0066] Figure 5 An interactive schematic diagram of a data table query method provided in another embodiment of this application;
[0067] Figure 6 A flowchart illustrating the data table query method executed on the query side as provided in this application embodiment;
[0068] Figure 7 A flowchart illustrating a data table query method provided in another embodiment of this application;
[0069] Figure 8 A flowchart illustrating a data table query method executed by the queried end, provided in another embodiment of this application;
[0070] Figure 9 An interactive schematic diagram of a data table query method provided in another embodiment of this application;
[0071] Figure 10 A schematic diagram of the structure of a query device for a data table applied to a query terminal, provided in an embodiment of this application;
[0072] Figure 11 A schematic diagram of the structure of a query device applied to a data table on the querying end, provided in an embodiment of this application;
[0073] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0074] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.
[0075] Those skilled in the art will understand that, unless otherwise stated, the singular forms “a,” “an,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”
[0076] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0077] First, let's introduce and explain several terms used in this application:
[0078] Oblivious Transfer (OT): OT is a cryptographic protocol that allows the sender to transmit information confidentially, so that the receiver can only obtain partial information, and the sender cannot know the receiver's specific choices. For example, the sender inputs n data (x1, x2, ..., x...). n Given that the receiver inputs i∈{1,2,…,n}, and after an unintentional transmission between the two parties, the receiver can only obtain x. i The sender cannot be certain that the receiver will receive i. In this embodiment, the unintentional transmission of 1 out of n data points is referred to as 1-out-of-n OT.
[0079] Two-party secret data sharding is a cryptographic technique designed to split sensitive data into two shares, each held by one of the participating parties, ensuring that neither party can recover the original data independently. The original information can only be reconstructed through collaboration between the two parties. Two-party secret data sharding is a core foundation of secure multi-party computation (MPC) and is commonly used in privacy-preserving scenarios such as joint data analysis and machine learning. For example, After partitioning the element x on the graph, A obtains... Party B received Satisfying x = (x A +x B )mod 2 l Then (xA x B This is called a two-sided partition of element x. Let be the partition of x. <x>Represents the secret fragment of x (x A x B Secret partitioning generally exhibits linear properties, that is... <x> + <y>=<x+y> ,a· <x>=<α·x>.
[0080] BGV fully homomorphic encryption algorithm: polynomial residue class ring The plaintext space is When the plaintext modulus t satisfies certain properties, an automorphism mapping exists The plaintext vector can be regarded as an element of R as a polynomial t , and can also be transformed under φ -1 into an element on R t . These two encoding methods are called coefficient encoding and automorphism encoding respectively. The multiplication after coefficient encoding is the multiplication on the polynomial residue class ring R t , while the multiplication after automorphism encoding is component-wise multiplication on . Usually q is the product of a plurality of primes q i , then can be regarded as s polynomials, each of which has an algebraic degree <N, and s is called the number of moduli. It is worth mentioning that the computational overhead of automorphism encoding is larger than that of coefficient encoding, and the larger s is, the more obvious the difference in overhead between the two is.
[0081] Key pair generation: secret key sk∈R q , public key satisfies u₀(X)·sk+u₁(X)≈0, the public key is made public, and the secret key is kept secret.
[0082] Encryption: input plaintext m∈R t and public key PK, output ciphertext Enc(m)=(a(X), b(X)), satisfying a(X)·sk+b(X)≈m.
[0083] Decryption: input ciphertext Enc(m) and secret key sk, output plaintext m. The number of ciphertext moduli is at least 1.
[0084] Homomorphic inner product operation: the input of the operation is the plaintext vector and the vector corresponding to the ciphertext Enc(u) calculate The specific process is: let and obtained after coefficient encoding Then let At this time, Enc(u)=Enc(u(X)), and the plaintext vector is encoded to obtain v * (X), after performing plaintext-ciphertext multiplication, Enc(u(X)·v * (X)) is obtained. At this time, the constant term of u(X)·v * (X) is It is worth mentioning that since the multiplication operation between the ciphertext and the plaintext is involved, the modulus of Enc(u) should be ≥2.
[0085] Homomorphic matrix operations: Input ciphertext Enc(u) and corresponding vector The encryption and plaintext matrix M are calculated. The specific process is as follows: vector After self-isomorphic encoding, the encrypted result is Enc(u). The plaintext matrix M is then processed by taking vectors along its diagonal, and then self-isomorphic encoded to obtain the plaintext polynomial m. i Then, homomorphically calculate ∑ i m i *Enc(rot(u, i)) is obtained by ciphertext rotation transformation of Enc(u) (rot(u, i) represents cyclic shifting by i bits). This requires n ciphertext multiplications and n-1 ciphertext rotation transformations. Similarly, due to the involvement of ciphertext multiplication, the modulus of Enc(u) should be ≥2. It is worth noting that the computational cost of ciphertext rotation transformation is significantly greater than that of ciphertext multiplication; therefore, the number of ciphertext selection transformations should be minimized.
[0086] Ciphertext pack: Input multiple ciphertexts Enc(u i After being processed by the ciphertext pack, a ciphertext Enc(u) is obtained, such that u(X) = u0[0] + u1[0]X + u2[0]X 2 +…, about to Enc(u) i The plaintext constant terms corresponding to ) are sequentially encoded into the plaintext polynomial u.
[0087] With the increasing prevalence of federated queries and large language model inference services, privacy issues are becoming increasingly exposed. Please see [link / reference]. Figure 1A The illustration exemplifies an interaction between a queryer and a service provider according to an embodiment of this disclosure. As shown, the service provider is able to provide the following services:
[0088] 1. Embedding Query: In scenarios such as RAG that use embedding services, the table lookup operation is the first step in the execution process. It converts the input token into a floating-point vector and then executes the subsequent Transformer calculation logic.
[0089] 2. LLM Inference Service. Similar to Embedding queries, the first step is to convert the input token into a floating-point vector. The subsequent calculation process is similar to the calculation logic of Embedding, but more complex.
[0090] 3. Join Queries. Support for table lookup operations is essential in scenarios requiring secure execution of SQL statements, such as join analysis. This falls under the category of hidden queries, but unlike traditional hidden queries, the input index can be secretly shared.
[0091] Users secretly share sensitive data with service providers, and both parties securely execute the computational logic corresponding to the service. While enjoying query / inference services, users do not want their sensitive data to be accessed and stored by the service provider. Although service providers use closed domains or trusted hardware to ensure that they do not access users' sensitive data, users generally express concern because the data becomes uncontrollable once it leaves the domain. This concern limits the full realization of the value of users' data. How to allow users to enjoy query / inference services while eliminating their concerns about the uncontrollable exposure of their data remains an ongoing topic.
[0092] Currently, secure real-time computation for query operations is urgently needed for both large language model inference and joint queries. How to achieve secure table lookup based on secret sharing while reducing computational and communication overhead and ensuring real-time availability is a challenging problem.
[0093] The data table query method, apparatus, electronic device, computer-readable storage medium, and computer program product provided in this application are intended to solve the above-mentioned technical problems of the prior art.
[0094] Please see Figure 1B The figure illustrates an exemplary flowchart of a secure query based on unintentional transmission according to an embodiment of this application. As shown, the method involves performing a 1-out-of-n unintentional transmission between the querying party's index i and the queried party, thus obtaining a random number r for the querying party. i The queried party receives n irrelevant random numbers r0, r1, ..., r n-1 Let the data table T = {a0, a1, ..., a...} n-1 }, then the queried party calculates n items. Then, these n blinded values are sent to the querying party, which then determines the value based on r. i After removing the blinds, we directly get n a's. i The number of random numbers involved in a secure query based on unintentional transmission is the same as the number of data in the data table. For example, if the data table contains 5 rows and 4 columns of data, this method needs to generate 5 × 4 = 20 random numbers, and use these 20 random numbers to blind the corresponding data (blind 20 times), and then send the 20 blinded data to the querying party.
[0095] The main problem with secure queries based on unintentional data transmission is that the communication volume is linearly related to the table size. On the one hand, when the table size n is large, the communication volume is enormous, and the computation time is mainly spent transmitting n blinded values. On the other hand, if the index i to be queried is a secret shard, i.e. And the querying party A has i (A) The party being queried, B, owns i (B) At this point, the input transmitted unintentionally by 1-out-of-n is i. (A) The output is the random number obtained by query party A. The queried party B receives n irrelevant random numbers. Before blinding, the queried party B first selects numbers according to i... (B) rearrange a i ,Right now Then it is blinded and sent to query party A, who selects the first... A blinding value, using XOR The query result a was obtained i In other words, if the index to be queried uses secret sharding, querying party A still needs to perform additional processing using its own shards in order to obtain the correct query results.
[0096] Please see Figure 1C The figure illustrates an exemplary flowchart of a secure query based on homomorphic encryption according to an embodiment of this application. As shown, the method uses a data table T = {a0, a1, ..., a...} n-1 View the matrix as an n1×n2 matrix, i.e., n = n1·n2. Decompose i into i1 = i / n2 and i2 = i%n2. Construct an n1-dimensional bit vector, where the eigenvalue of the bit vector is 1 only in the i1-th dimension. Construct an n2-dimensional bit vector, where the eigenvalue of the bit vector is 1 only in the i2-th dimension. The two bit vectors constructed in the figure are (1,0). T The two bit vectors (0,0,1,0) are encrypted to obtain ciphertexts Enc1 and Enc2, which are then sent to the queried party B. The queried party B performs a homomorphic matrix operation on the plaintext matrix n1×n2 and the ciphertext Enc2 corresponding to the n2-dimensional unit vector. The result of this operation is then compared with the ciphertext Enc1 corresponding to the n1-dimensional unit vector, and a homomorphic matrix operation is performed on it. The two homomorphic matrix operations require that the ciphertext modulus of Enc2 is 3 and the ciphertext modulus of Enc1 is 2.
[0097] Although this method reduces communication overhead, the homomorphic matrix operation takes about a second and is positively correlated with n1 and n2. When the ciphertext modulus is 3, the communication overhead is at least 10 seconds when n1 and n2 take values of about 4096.
[0098] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.
[0099] Figure 1D This is a schematic diagram of the system architecture for implementing a data table query method according to an embodiment of this application. The system framework 100 can be an application system, and this embodiment of the application does not limit the specific type of the application. The system framework 100 includes: a query terminal 110 and a queried terminal 120.
[0100] The query terminal 110 can be at least one of a smartphone, game console, desktop computer, tablet computer, e-book reader, MP4 player, and laptop computer. The query terminal 110 can be a client application with an application installed and running. This application can be any one of the following: online video application, short video application, image sharing application, audio social application, comic application, wallpaper application, news push application, supply and demand information push application, academic exchange application, technical exchange application, policy exchange application, application with a comment mechanism, application with an opinion posting mechanism, or knowledge sharing application. The query terminal 110 can be a terminal used by a user, and the user's account is logged in within the application running on the query terminal 110.
[0101] The queried endpoint 120 can be at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. The queried endpoint 120 provides background services for applications (such as the query endpoint 110 and the applications on the query endpoint 110). Optionally, the queried endpoint 120 undertakes the primary computational work, and the query endpoint 110 undertakes the secondary computational work; or, the queried endpoint 120 undertakes the secondary computational work, and the query endpoint 110 undertakes the primary computational work; or, the query endpoint 110 and the queried endpoint 120 collaborate on computation using a distributed computing architecture.
[0102] Optionally, the query terminal 110 obtains a query request, decomposes the index to be queried i into row index i1 and column index i2, constructs a bit vector, performs homomorphic encryption on the bit vector to obtain a first ciphertext, and sends the first ciphertext 120 to the queried terminal. The queried terminal 120 performs homomorphic inner product operations on q target data with the first ciphertext to obtain a second ciphertext, and performs blinding processing on the second ciphertext using q random numbers to obtain a third ciphertext. The query terminal 110 obtains a random number r from the q random numbers based on s. s According to r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
[0103] This application provides a query method that combines unintentional transmission and fully homomorphic encryption, achieving a balance between computational and communication overhead. To implement this method, this application includes the following steps:
[0104] Step 1: Decompose the index i to be queried according to the size n of the data table, that is, n = n1·n2 (assuming n1 < n2), then index i is decomposed into i1 = i / n2 and i2 = i%n2;
[0105] Step 2: For i2, the query end and the queried end coordinate to use homomorphic encrypted table lookup, that is, the table of size n is regarded as an n1×n2 matrix, and a secure table lookup process is performed on each row (n1 rows in total) of the data table with i2. During this process, the queried end will generate n1 ciphertexts.
[0106] Step 3: For i1, the query end and the queried end coordinate to use unintentional transmission to look up the table. Based on step 2, n1 ciphertexts are obtained. The query end uses unintentional transmission to select the final ciphertext, and after decryption, the query result is obtained.
[0107] Step 2 is described below, which involves using fully homomorphic encryption to look up a table for i2. In this embodiment, the BGV fully homomorphic encryption algorithm is used for implementation:
[0108] Step 2.1: The querying party constructs an n2-dimensional bit vector based on i2 and n2, such that the value is 1 only at position i2. Then, it uses the BGV algorithm to encode its coefficients and encrypts them to obtain the first ciphertext, which is then sent to the querying party.
[0109] Step 2.2: The queried party treats the table of size n as an n1×n2 matrix, takes each row of the matrix as plaintext, and performs a homomorphic inner product operation with the received first ciphertext to obtain n1 fourth ciphertexts Enc. l (At this time, Enc) l The constant term corresponds to the plaintext after the homomorphic inner product calculation. Then, these n1 fourth ciphertexts are processed by ciphertext pack to obtain the second ciphertext (at this time, the l-th coefficient of the second ciphertext corresponds to the constant term of the l-th fourth ciphertext).
[0110] Specifically, the ciphertext in step 2.1 corresponds to a bit vector, and step 2.2 is essentially a homomorphic multiplication of an n1×n2 plaintext matrix and an n2-dimensional ciphertext vector. To reduce the ciphertext size and computational overhead required for matrix-vector homomorphic multiplication, the bit vector is first encoded with coefficients during encryption (i.e., (0, 0, 1, 0) is treated as a polynomial X). 2 After performing a homomorphic inner product operation on each row of data, a fourth ciphertext is obtained. These fourth ciphertexts are only the plaintext results after the inner product corresponding to the constant terms. Next, the ciphertext pack method is used to transform these fourth ciphertexts into a single ciphertext (second ciphertext), so that the coefficients of the second ciphertext correspond sequentially to the constant terms of the original ciphertext.
[0111] Next, we will introduce step 3, which is to use unintentional table lookup for i1, and implement it using unintentional transfer.
[0112] Step 3.1: The querying end takes i1 as input and performs a 1-out-of-n1 unintentional transmission with the querying end, after which the querying end obtains a random number. The querying end receives n1 random numbers
[0113] Step 3.2: The queried end uses these n1 random numbers to blind the second ciphertext obtained in step 2. For example, it can use r k Add the kth item of the second ciphertext, and then send the blinded third ciphertext to the query end.
[0114] Step 3.3: After receiving the third ciphertext, the query terminal subtracts the i1th item from the third ciphertext. Then decryption is performed. At this point, only the result of the i1th item is the final output, and the rest of the decryption results are blinded.
[0115] Specifically, step 3.2 adds a random number r to the k-th item of the second ciphertext. k The return message only needs to transmit the first n1 terms, that is, assuming the second ciphertext (a(X), b(X)) ∈ R. q The expression a(X)·sk(X)+b(X)≈m(X) is given, where sk(X)∈R. q Here, m(X) is the private key, and m(X) is the plaintext polynomial, where the i-th coefficient corresponds to the plaintext m. i At this point, what needs to be blinded on the queried end is b(X), that is, using... Add a(X) to b(X). To reduce communication overhead, during the return transmission, the queried end only needs to transmit a(X) and b(X) + r(X) ∈ R. q The first n1 terms, denoted as b * (X). When the query terminal decrypts, it will use b. * (X) Fill in with zeros to obtain an N-1 degree polynomial, then subtract... Finally, the plaintext polynomial is obtained through decryption. At this point, only the i1-th term is the final output, while the remaining terms are either generated by a random number r. k Blinding (0 to n1) will result in an incorrect result (n1 to N).
[0116] Additionally, if the query index i is a secret shard, i.e. Then the queried end only needs to sort table T according to i (B) Rearrange it, that is The rest of the operations remain unchanged.
[0117] This application embodiment is based on a secure query using homomorphic encryption. It transforms the encryption of two bit vectors into the encryption of one bit vector. Then, it uses a coefficient encoding and re-encryption method combined with ciphertext pack technology to optimize the homomorphic matrix multiplication operation of the plaintext matrix and the ciphertext vector. The second homomorphic multiplication is replaced by unintentional transmission, so that the ciphertext encrypted at the query end is only one, and the ciphertext modulus is 2, further reducing communication and computational overhead.
[0118] Please see Figure 2A The figure illustrates a flowchart of a data table query method according to an embodiment of this application. First, the query end generates a key pair and synchronizes the public key to the queried end. The query end decomposes the index i to be queried into row index i1 and column index i2, constructing a bit vector (0,0,…,1,…,0). The dimension of this bit vector is n1, and the eigenvalue of the i1th dimension is 1. The query end performs homomorphic encryption on the bit vector to obtain a first ciphertext, which is then sent to the query end. The query end performs a homomorphic inner product of n2 column data with the first ciphertext to obtain a second ciphertext, which consists of two polynomials a(X) and b(X). The query end and the queried end perform a 1-out-of-n2 OT unintentional transmission, and the query end obtains a random number r. i2 The queried end obtains n² random numbers, and uses q random numbers to blind the second ciphertext. The querying end then uses random number r. i2 For the third ciphertext (a(X), b) * (X) is deblinded to obtain the query results.
[0119] This application provides a method for querying a data table, executed by the querying end, such as... Figure 2B As shown, the method includes:
[0120] S101, Obtain the query request.
[0121] This application embodiment can provide a query interface on the query terminal to obtain the query request submitted by the queryer through the query interface.
[0122] The query request in this embodiment includes an index to be queried, which represents the position of the data to be queried in the data table. The data table in this embodiment has n1 rows and n2 columns.
[0123] S102. Decompose the index i to be queried into row index i1 and column index i2, and construct a bit vector.
[0124] It's understandable that the index to be searched, i, is a one-dimensional index. When calculating the column index i2, it can be obtained by taking i modulo n2 (the number of columns), i.e., i2 = i mod n. When calculating the row index i1, it can be obtained by dividing i by n2 and rounding down, i.e., i1 = i / / n. For example, if there exists a data table with 4 rows and 3 columns, i.e., n1 = 4 and n2 = 3, substituting the one-dimensional index to be searched, 5, into the above formula, we can obtain the column index i2 = 5 mod 3 = 2 and the row index i1 = 5 / / 3 = 1. Therefore, the index to be searched, 5, corresponds to the data in the 1st row and 2nd column of the data table.
[0125] It should be noted that the embodiments of this application do not require the above description. Figure 1C As shown in the embodiment, instead of constructing bit vectors for row and column indices separately, a bit vector can be constructed for only one index, which can significantly reduce the time spent constructing the vector. It can be understood that the feature values of each dimension in the bit vector are either 0 or 1.
[0126] The bit vector constructed in this application has a dimension of p, and the feature value is 1 only in the s-th dimension. When the bit vector is constructed based on row index i1 in this embodiment, the dimension p of the bit vector is the number of rows n1, and the feature value is 1 only in dimension i1 (where s = i1), while the other dimensions are 0. Similarly, when the bit vector is constructed based on column index i2, the dimension p of the bit vector is the number of columns n2, and the feature value is 1 only in dimension i2 (where s = i2), while the other dimensions are 0. For example, if the data table has a structure of 4 rows and 3 columns, and the row index i1 = 1 and the column index i2 = 2 obtained by decomposing the index to be searched, the bit vector is (1,0,0,0) when constructed based on the row index, and (0,1,0) when constructed based on the column index.
[0127] S103. Homomorphically encrypt the bit vector to obtain the first ciphertext, and send the first ciphertext to the queried end so that the queried end performs homomorphic inner product operation on q target data with the first ciphertext respectively to obtain the second ciphertext, and uses q random numbers to perform blinding processing on the second ciphertext to obtain the third ciphertext.
[0128] Since step S103 only requires constructing a single bit vector, homomorphic encryption of a single bit vector is obviously more efficient than homomorphic encryption of two bit vectors. In this embodiment, the query terminal first obtains (or generates) a public-private key pair. The public key is used to encrypt data and perform homomorphic operations, while the private key is used to decrypt data. The query terminal uses the public key to encrypt plaintext data (bit vector) into ciphertext (first ciphertext). The encryption process ensures that the original information of the plaintext data is hidden after conversion to ciphertext, but specific homomorphic operations can still be performed between or after the ciphertext.
[0129] It is understandable that the core of homomorphic encryption lies in allowing specific operations to be performed on ciphertext without prior decryption. These operations can be addition, multiplication, or other mathematical operations, depending on the homomorphic encryption scheme used. During the operation, the ciphertext maintains its encrypted state, thereby ensuring data privacy. This application does not specifically limit the homomorphic encryption algorithm; for example, it can be any one of Partially Homomorphic Encryption (PHE), Somewhat Homomorphic Encryption (SWHE), or Fully Homomorphic Encryption (FHE).
[0130] In this embodiment, the bit vector is homomorphically encrypted to obtain a first ciphertext, which is then sent to the queried end. The queried end further performs a homomorphic inner product operation on the first ciphertext and q target data. It should be noted that in this embodiment, the data table is actually regarded as an n1×n2 matrix. If p=n1, the target data is the column data of the data table, and q=n2 means that a homomorphic inner product operation is performed between a bit vector (an n1-dimensional vector) constructed based on row index i1 and the n2 column data in the data table (each column data is regarded as an n1-dimensional vector); if p=n2, the target data is the row data of the data table, and q=n1 means that a homomorphic inner product operation is performed between a bit vector (an n2-dimensional vector) constructed based on column index i2 and the n1 row data in the data table (each row data is regarded as an n2-dimensional vector). It is understood that the second ciphertext obtained in this application includes q items, each corresponding to the homomorphic inner product result between the first ciphertext and target data. Generally, to improve processing efficiency, the embodiments of this application perform homomorphic inner product operations with the first ciphertext sequentially in row / column order. Thus, the t-th item in the second ciphertext corresponds to the homomorphic inner product result between the first ciphertext and the t-th row / column data. This application provides a method for effective data processing and analysis while protecting data privacy through homomorphic inner product operations.
[0131] In this embodiment of the application, after obtaining the second ciphertext, the queried terminal further performs blinding processing on the second ciphertext using q random numbers. Since the second ciphertext has q terms, blinding with q random numbers also means blinding each term of the second ciphertext using the corresponding random number. Thus, the t-th term in the obtained third ciphertext is based on the t-th random number r. t The result of deblinding the second ciphertext is t∈[1,q]. Specifically, the first item of the second ciphertext is blinded using the first random number, the second item of the second ciphertext is blinded using the second random number, ..., the qth item of the second ciphertext is blinded using the qth random number.
[0132] Understandably, in cryptography, blinding is used to protect data privacy and prevent the leakage of original information during encryption or signing. Blinding typically involves some form of randomization or obfuscation of the input data, making it difficult for attackers to extract useful information even if the data is intercepted. This application does not limit the specific operations involved in blinding; for example, it can be addition, subtraction, multiplication, etc.
[0133] It is important to note that, unlike secure query schemes based entirely on unintentional transmission, this application embodiment does not use the generation of n (n = n1 × n2) random numbers to blind the data in the corresponding cells of the entire data table. Instead, it only uses q random numbers to blind each item of the second ciphertext. Taking a 5-row, 4-column data table as an example, this scheme only requires generating 4 or 5 random numbers and performing 4 or 5 blinding processes accordingly. Compared to... Figure 1B The proposed solution can significantly reduce the number of blinding processes (from 20 to 4 or 5), and correspondingly, the amount of data returned from the queried end to the query end is also greatly reduced, which can save communication resources and improve the efficiency of secure queries.
[0134] S104. Obtain a random number r from the q random numbers based on s. s According to r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
[0135] In this embodiment of the application, the query terminal obtains a random number r through s. s And satisfying that r is also included among the q random numbers. s This allows the query end to utilize r s Similarly, the s-th item of the third ciphertext is deblinded. For example, if the blinding process uses addition, the deblinding process uses subtraction. On the other hand, since the querying end encrypts all items, including the s-th item of the second ciphertext, the querying end does not actually know the specific item that the querying end wants to obtain that needs deblinding, thereby protecting the privacy of the querying end and ensuring data security.
[0136] The data table query method provided in this application embodiment obtains query information. The query request includes a query index i, which represents the position of the data to be queried in the data table. The data table has n1 rows and n2 columns. The query index i is decomposed into row index i1 and column index i2, and a bit vector is constructed. The number of dimensions of the bit vector is p, and the feature value is 1 only in the s-th dimension, p = n1, s = i1, or p = n2, s = i2. This application only needs to construct one bit vector, and homomorphically encrypts the bit vector to obtain the first ciphertext. Compared with a fully homomorphically encrypted secure query, the encryption of two bit vectors is reduced to the encryption of one bit vector. After obtaining the first ciphertext, the queried end performs a homomorphic inner product operation on the first ciphertext and q target data to obtain the second ciphertext, and uses q random numbers to blind the second ciphertext to obtain the third ciphertext. The query end then calculates the third ciphertext based on r. s The third ciphertext is deblinded, and then decrypted. This involves replacing another bit vector with a secure query transmitted unintentionally, ensuring that the ciphertext encrypted at the query end consists of only one ciphertext with a ciphertext mode of 2. This further reduces communication and computational overhead. Moreover, this application only requires q random numbers to blind the second ciphertext with q terms. Compared to the scheme that completely uses a secure query transmitted unintentionally, this significantly reduces the amount of blinding processing and data transmitted with the query end, thereby improving query efficiency.
[0137] Based on the above embodiments, as an optional embodiment, homomorphic encryption is performed on the bit vector to obtain the first ciphertext, including:
[0138] The preset polynomial is encoded based on the bit vector, and the encoded polynomial is used as the encoding result, wherein the number of terms in the polynomial is p;
[0139] The first ciphertext is obtained by encrypting the encoding result using a homomorphic encryption algorithm based on a preset public key.
[0140] In this embodiment, a polynomial v(X) can be obtained in advance, which can be expressed as v(X) = a0 + a1X + a2X 2 +…+a n X n , where a i These are the coefficients of the polynomial. In this embodiment, the number of terms in the polynomial (i.e., the exponent of the highest-order term) is the same as the dimension of the bit vector, that is, v(X) = a0 + a1X + a2X. 2 +…+a p-1 X p-1 Therefore, the eigenvalues of each dimension of the bit vector can be directly mapped to the corresponding coefficients of the polynomial. After the bit vector is mapped to the coefficients of the polynomial, the encoded result v(X) = X is obtained. s-1 .
[0141] As can be seen from the above embodiments, the query terminal can generate a public-private key pair, where: the private key sk∈Rq, and the public key... The encoding result v(X) = X is obtained by using a preset public key PK and a random polynomial. s-1 Encryption yields the first ciphertext, which consists of two polynomials, a(X) and b(X), satisfying a(X)·sk+b(X)≈m, where m is the encoded result X. s-1 .
[0142] Based on the above embodiments, as an optional embodiment, the q random numbers obtained by the query end and the r random numbers obtained by the query end... s This is obtained by the querying end and the queried end through unintentional transmission.
[0143] The unintentional transmission in this embodiment can be referred to as 1-out-of-q OT, that is, unintentional transmission of 1 out of q data. The queried end inputs q data (x1, x2, ..., x...). q Given that the query input is s∈{1,2,…,q}, and after an unintentional transmission between the two parties, the query end can only obtain x. s The queried end cannot determine whether the receiving end received x. s .
[0144] Please see Figure 3 The figure illustrates an interactive diagram of a data table query method provided in an embodiment of this application, as shown in the figure, including:
[0145] S301, The query terminal obtains the query request, which includes the index i to be queried;
[0146] S302. The query terminal decomposes the index i to be queried into row index i1 and column index i2, and constructs a bit vector; the number of dimensions of the bit vector is p, and the feature value is 1 only in the s-th dimension; where p = n1, s = i1, or p = n2, s = i2;
[0147] S303. The querying end performs homomorphic encryption on the bit vector to obtain the first ciphertext, and sends the first ciphertext to the querying end.
[0148] S304. The queried end performs a homomorphic inner product operation on the q target data with the first ciphertext respectively to obtain the second ciphertext;
[0149] S305. The querying end and the queried end perform a 1-out-of-q OT unintentional transmission, thereby the querying end obtains a random number r from the q random numbers based on s. s The queried end obtains q random numbers;
[0150] S306. The queried end uses q random numbers to blind the second ciphertext to obtain the third ciphertext;
[0151] S307, The query terminal uses r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
[0152] The process of unintentional 1-out-of-q OT transmission in this embodiment of the application is as follows:
[0153] 1) Sender preparation phase:
[0154] Sender has q random numbers M0, M1, ..., Mn q-1 .
[0155] The Sender generates a sufficient number of public / private key pairs (or uses an existing key pair) and sends the required public key to the Receiver.
[0156] 2) Receiver selection phase:
[0157] The Receiver selects an index s of a random number and generates a key K for a symmetric algorithm. Then, it selects a public key of the Sender to encrypt some representation of the key K and index s (such as a hash value or an encrypted form) and sends it to the Sender.
[0158] 3) Encryption phase on the queried end (Sender):
[0159] The sender uses its own private key to attempt to decrypt the key K and index s sent by the receiver. Since it doesn't know which public key the receiver is using, the sender needs to try all possible private keys.
[0160] Once the sender successfully decrypts the key K and index s (or some representation of index s), it uses the key K to encrypt the corresponding random number M. s The Sender then sends the encrypted message to the Receiver. Simultaneously, the Sender can also generate seemingly random encrypted messages for other unselected secrets (using seemingly random keys).
[0161] 4) Receiver decryption phase:
[0162] The receiver uses its own key K to decrypt the received message. Since the querying end knows its selected index s, it can successfully decrypt the corresponding random number M. s However, other messages could not be decrypted.
[0163] Based on the above embodiments, as an optional embodiment, the second ciphertext generated by the queried end includes q items, where the t-th item represents the homomorphic inner product result between the first ciphertext and the t-th target data, t∈[1,q]. Correspondingly, the third ciphertext is the result of blinding the corresponding items of the second ciphertext using q random numbers, that is, blinding the t-th item of the second ciphertext using the t-th random number.
[0164] According to r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result, including:
[0165] According to r s The s-th item of the third ciphertext is deblinded to obtain the processed s-th item;
[0166] The s-th item after processing is decrypted based on the preset private key to obtain the query result.
[0167] Understandably, deblinding is the reverse process of blinding. For example, if blinding is addition, deblinding is subtraction; if blinding is multiplication, deblinding is division. For instance, if the queried end blinds the second ciphertext by adding the s-th random number to the s-th item of the second ciphertext, the querying end will subtract r from the s-th item of the blinded third ciphertext. s Implement deblinding to obtain the processed s-th term.
[0168] The processed s-th term still includes two polynomials. If the two polynomials are represented as a(Y) and b(Y), the decryption can be achieved by a(Y)·sk+b(Y) to obtain the query result.
[0169] Based on the above embodiments, as an optional embodiment,
[0170] If n1 is greater than n2, then p = n1;
[0171] If n1 is less than n2, then p = n2;
[0172] If n1 equals n2, then p = n1 or n2.
[0173] The following example, where n1 is greater than n2 (i.e., the number of rows in the data table exceeds the number of columns), illustrates the data table query method in this embodiment. Figure 4 As shown, it includes:
[0174] S401. Obtain a query request, the query request including the index to be queried i, the index to be queried i representing the position of the data to be queried in the data table;
[0175] S402. Decompose the index i to be queried into row index i1 and column index i2, and construct a bit vector. The number of dimensions of the bit vector is n1, and the feature value is 1 only in the i1th dimension.
[0176] S403. Homomorphically encrypt the bit vector to obtain the first ciphertext, and send the first ciphertext to the queried end so that the queried end can perform a homomorphic inner product operation on the first ciphertext and n2 target data to obtain the second ciphertext, and use n2 random numbers to blind the second ciphertext to obtain the third ciphertext.
[0177] S404. Obtaining a random number r based on i1 i1 The i1 random numbers include r i1 According to r i1 The i1th item of the third ciphertext is deblinded, and the i1th item after deblinding is homomorphically decrypted to obtain the query result.
[0178] In other words, by considering the relationship between the number of rows and columns in the data table, the embodiments of this application construct a bit vector with a larger number of rows, so that the queried end can perform a homomorphic inner product on the first ciphertext and each column of data. Compared with constructing a bit vector with a smaller number of columns, this can reduce the amount of data in the homomorphic inner product of the queried end. This application embodiment determines the value of p. When the number of rows is greater than the number of columns, a homomorphic encryption lookup table is performed on the column data. When the number of columns is greater than the number of rows, a homomorphic encryption lookup table is performed on the row data. If the number of rows is equal to the number of columns, there is no restriction on whether the homomorphic encryption lookup object is row data or column data. This operation allows the queried end to perform homomorphic inner product operations on target data with a relatively small amount of data. When the number of rows is greater than the number of columns, a homomorphic inner product is performed on the column data, and the number of inner product operations is less than that of the row data, resulting in fewer items in the second ciphertext. Similarly, when the number of columns is greater than the number of rows, the queried end performs a homomorphic inner product on the first ciphertext and each row data, which results in fewer inner product operations and fewer items in the second ciphertext compared to that of the first ciphertext and each column data, further reducing the time consumption of homomorphic encryption.
[0179] In privacy-preserving computation, to protect data privacy, sensitive information (such as query indexes) is not directly exposed to any single party. Instead, this information is divided into multiple parts (i.e., shards), each securely assigned to different participants (here, the querying party and the queried party). Secret sharding ensures that no single party can reconstruct the original sensitive information independently, but specific computations (such as query operations) can be performed on these shards without disclosing the privacy information of any party. Based on the above embodiments, as an optional embodiment, the query index i is secretly sharded into i1. (B) and i2 (B) In this case, the queried end performs homomorphic inner product operations on q target data with the first ciphertext respectively, and previously also based on i2 (B) Rearrange the data in the data table.
[0180] In this embodiment, the queried client preprocesses the stored data table based on its own shards. This preprocessing includes rearranging to improve efficiency or meet specific privacy requirements in subsequent calculations. Rearranging means adjusting the physical storage order of data in the table according to shard information, or creating a mapping relationship so that subsequent shard-based calculations can be performed more efficiently.
[0181] It should be noted that, in this embodiment of the application, regardless of whether the query index is secretly sharded, the query end regards the query index (shard) it holds as a complete query index, which is decomposed into row index and column index. In other words, whether the query index is secretly sharded or not makes no difference to the execution process of the query end.
[0182] The embodiments of this application are applicable to the case where query index i is secretly fragmented, and are different from... Figure 1B The illustrated embodiment requires both the querying end and the queried end to process based on their own shards. This application only requires the queried end to rearrange the data before performing the homomorphic inner product operation on the target data and the first ciphertext. The querying end does not need to perform any additional operations on the secret shards, which can further improve the efficiency of data query.
[0183] Please see Figure 5 The figure illustrates an interactive diagram of a data table query method according to another embodiment of this application, as shown in the figure, including:
[0184] S501. The query terminal obtains a query request, the query request including the index to be queried i, i being secretly sharded into i1. (B) and i2 (B) The query only retrieved i1 (B) The queried end only received i2 (B) .
[0185] S502, the query terminal will use i1 (B) As the index to be queried, i is decomposed into row index i1 and column index i2, and a bit vector is constructed; the number of dimensions of the bit vector is p, and the feature value is 1 only in the s-th dimension; where, if p = n1, s = i1, if p = n2, s = i2;
[0186] S503. The querying end performs homomorphic encryption on the bit vector to obtain the first ciphertext and sends the first ciphertext to the querying end.
[0187] S504, The queried end uses i2 (B) The data in the data table is rearranged, and the q rearranged target data are then subjected to a homomorphic inner product operation with the first ciphertext to obtain the second ciphertext.
[0188] S505, the querying end and the queried end transmit data inadvertently, so that the querying end obtains a random number r from the q random numbers based on s. s The queried end obtains q random numbers;
[0189] S506. The queried end uses q random numbers to blind the second ciphertext to obtain the third ciphertext;
[0190] S507, the query terminal based on r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
[0191] Please see Figure 6 The figure illustrates a flowchart of a data table query method executed on the query side according to an embodiment of this application, as shown in the figure, including:
[0192] S601. Obtain a query request, wherein the query request includes a query index i, the query index i represents the position of the data to be queried in the data table, and the data table has n1 rows and n2 columns.
[0193] S602. Divide n2 by the index i to be searched and round down to obtain the row index i1. Perform a modulo operation on n2 by the index i to be searched to obtain the column index i2.
[0194] S603. Construct a bit vector with dimension p, and the eigenvalue is 1 only in the s-th dimension; where, if n1 is greater than n2, then p = n1; if n1 is less than n2, then p = n2; if n1 is equal to n2, then p = n1 or n2. When p = n1, s = i1, and when p = n2, s = i2.
[0195] S604. Encode the coefficients of a preset polynomial based on the bit vector, and use the coefficient-encoded polynomial as the encoding result, wherein the number of terms in the polynomial is p; use a homomorphic encryption algorithm to encrypt the encoding result based on a preset public key to obtain the first ciphertext;
[0196] S605. Perform a 1-out-of-q OT inadvertent transmission with the queried end to obtain a random number r. s ;
[0197] S606, Receive the third ciphertext sent by the queried end, according to r s Perform deblinding on the s-th item of the third ciphertext to obtain the processed s-th item; decrypt the processed s-th item based on the preset private key to obtain the query result.
[0198] Please see Figure 7 The example illustrates a flowchart of a data table query method provided in another embodiment of this application, which is applied to the queried end and includes:
[0199] S701, Receive the first ciphertext.
[0200] In this embodiment of the application, the first ciphertext received by the query end is the ciphertext obtained by the query end through homomorphic encryption of the bit vector. The number of dimensions of the bit vector is p, and the feature value is 1 only in the s-th dimension. Wherein, if p = n1, s = i1, if p = n2, s = i2; n1 is the number of rows in the data table, n2 is the number of columns in the data table; i1 represents the row index obtained by decomposing the query index i, and i2 represents the column index obtained by decomposing the query index i.
[0201] S702. Perform homomorphic inner product operations on the q target data with the first ciphertext respectively to obtain the second ciphertext.
[0202] In this embodiment of the application, if p = n1, then the target data is the column data of the data table, and q = n2; if p = n2, then the target data is the row data of the data table, and q = n1.
[0203] The queried end views the data table as an n1×n2 matrix. If p = n1, the target data is the column data of the data table, and q = n2 means performing a homomorphic inner product operation with the n2 column data (each column data is considered an n1-dimensional vector) constructed based on row index i1. If p = n2, the target data is the row data of the data table, and q = n1 means performing a homomorphic inner product operation with the n1 row data (each row data is considered an n2-dimensional vector) constructed based on column index i2. It is understood that the second ciphertext obtained in this application includes q items, each corresponding to the homomorphic inner product result between the first ciphertext and the target data. Generally, to improve processing efficiency, the t-th item in the second ciphertext also corresponds to the homomorphic inner product result between the first ciphertext and the t-th row / column data. This application provides a method for effective data processing and analysis while protecting data privacy through homomorphic inner product operations.
[0204] S703. Use q random numbers to perform blinding processing on the second ciphertext to obtain the third ciphertext, and send the third ciphertext to the query terminal.
[0205] After obtaining the second ciphertext, the queried end further blinds it using q random numbers. Since the second ciphertext has q terms, blinding it with q random numbers means blinding each term of the second ciphertext using the corresponding random number. Therefore, the t-th term in the obtained third ciphertext is based on the t-th random number r. t The result of deblinding the second ciphertext is t∈[1,q]. For example, the first item of the second ciphertext is blinded with the first random number, the second item of the second ciphertext is blinded with the second random number, ..., the qth item of the second ciphertext is blinded with the qth random number.
[0206] The data table query method of this application embodiment receives a first ciphertext, which is the ciphertext obtained by the query end through homomorphic encryption of a bit vector. The bit vector has a dimension of p, and its feature value is 1 only in the s-th dimension. Where p = n1, s = i1; p = n2, s = i2; n1 is the number of rows in the data table, n2 is the number of columns in the data table; i1 represents the row index obtained by decomposing the query index i, and i2 represents the column index obtained by decomposing the query index i. The number of bit vectors is only 1, which is more secure than fully homomorphic encryption. The full query improves query efficiency. The queried end performs homomorphic inner product operations with the first ciphertext on q target data respectively to obtain the second ciphertext, where p = n1, the target data is the column data of the data table, and q = n2, or p = n2, the target data is the row data of the data table, and q = n1. Only q random numbers are needed to perform blinding processing on the second ciphertext with q items. Compared with the scheme of completely inadvertent transmission query, it greatly reduces the amount of blinding processing and data transmission with the query end, thus improving query efficiency.
[0207] Based on the above embodiments, as an optional embodiment, the queried terminal performs a homomorphic inner product operation on q target data with the first ciphertext to obtain the second ciphertext, including:
[0208] For each target data, the target data is treated as a vector of dimension p and homomorphically inner product is performed with the first ciphertext to obtain a fourth ciphertext;
[0209] Homomorphically package q fourth ciphertexts to obtain the second ciphertext.
[0210] The target data in this embodiment can be represented as a vector with p dimensions. Furthermore, as can be seen from the above embodiments, if p = n1, the target data is the column data of the data table, and if p = n2, the target data is the row data of the data table.
[0211] Next, we will analyze the vector corresponding to the target data. Encode to obtain That is, v * (X)=v0-v1X N-1 -v2X N-2 -…-v p-1 X N-p+1 At this point, for the first ciphertext Enc(u) and v * (X) performs plaintext-ciphertext multiplication to obtain the fourth ciphertext Enc(u(X)·v) * (X)), at this time the plaintext polynomial u(X)·V in the fourth ciphertext * The constant term of (X) is This represents the homomorphic inner product result of the target data and the first ciphertext.
[0212] Next, the accessed end uses the ciphertext pack method to convert q fourth ciphertexts into one ciphertext (second ciphertext), such that the t-th coefficient of the plaintext polynomial in the new ciphertext is the constant term of the plaintext polynomial in the t-th fourth ciphertext. Specifically, by inputting q fourth ciphertexts Enc(u i After passing through the ciphertext pack, the second ciphertext Enc(k) is obtained, such that the plaintext polynomial k(X) of the second ciphertext Enc(k) is u0[0]+u1[0]X+u2[0]X. 2 +…u q-1 [0]X q-1 The coefficients in the equation, namely u0[0], u1[0], u2[0], ... u q-1 [0] and each equal.
[0213] Based on the above embodiments, as an optional embodiment, the second ciphertext is blinded using q random numbers to obtain the third ciphertext, which includes:
[0214] The third ciphertext is obtained by blinding the items in the same order in the second ciphertext with q random numbers in a preset order.
[0215] In other words, this application uses the first random number to blind the first item in the second ciphertext, uses the second random number to blind the second item in the second ciphertext, ..., uses the qth random number to blind the qth item in the second ciphertext, and uses all q items after blinding as the third ciphertext.
[0216] The embodiments of this application do not limit the method of blinding processing, such as addition, subtraction or multiplication operations, etc.
[0217] Based on the above embodiments, as an optional embodiment, the q random numbers obtained by the query end and the r random numbers obtained by the query end... s The data is obtained through unintentional transmission between the querying end and the queried end. This unintentional transmission in this embodiment can be referred to as 1-out-of-q OT, meaning an unintentional transmission where 1 out of q data points is selected. The queried end inputs q data points (x1, x2, ..., x...). q Given that the query input is s∈{1,2,…,q}, and after an unintentional transmission between the two parties, the query end can only obtain x. s The queried end cannot determine whether the receiving end received x. s .
[0218] The process of unintentional 1-out-of-q OT transmission in this embodiment of the application is as follows:
[0219] 1) Sender preparation phase:
[0220] Sender has q random numbers M0, M1, ..., Mn q-1 .
[0221] The Sender generates a sufficient number of public / private key pairs (or uses an existing key pair) and sends the required public key to the Receiver.
[0222] 2) Receiver selection phase:
[0223] The Receiver selects an index s of a random number and generates a key K for a symmetric algorithm. Then, it selects a public key of the Sender to encrypt some representation of the key K and index s (such as a hash value or an encrypted form) and sends it to the Sender.
[0224] 3) Encryption phase on the queried end (Sender):
[0225] The sender uses its own private key to attempt to decrypt the key K and index s sent by the receiver. Since it doesn't know which public key the receiver is using, the sender needs to try all possible private keys.
[0226] Once the sender successfully decrypts the key K and index s (or some representation of index s), it uses the key K to encrypt the corresponding random number M. s The Sender then sends the encrypted message to the Receiver. Simultaneously, the Sender can also generate seemingly random encrypted messages for other unselected secrets (using seemingly random keys).
[0227] 4) Receiver decryption phase:
[0228] The receiver uses its own key K to decrypt the received message. Since the querying end knows its selected index s, it can successfully decrypt the corresponding random number M. s However, other messages could not be decrypted.
[0229] Based on the above embodiments, as an optional embodiment,
[0230] If n1 is greater than n2, then p = n1;
[0231] If n1 is less than n2, then p = n2;
[0232] If n1 equals n2, then p = n1 or n2.
[0233] This application embodiment considers the relationship between the number of rows and columns in the data table and constructs a bit vector with a larger number of rows, so that the queried end can perform a homomorphic inner product on the first ciphertext and each column of data. Compared with constructing a bit vector with a smaller number of columns, this can reduce the amount of data in the homomorphic inner product of the queried end. This application embodiment determines the value of p. When the number of rows is greater than the number of columns, a homomorphic encryption lookup table is performed on the column data. When the number of columns is greater than the number of rows, a homomorphic encryption lookup table is performed on the row data. If the number of rows is equal to the number of columns, there is no restriction on whether the homomorphic encryption lookup object is row data or column data. This operation allows the queried end to perform homomorphic inner product operations on target data with a relatively small amount of data. When the number of rows is greater than the number of columns, a homomorphic inner product is performed on the column data, and the number of inner product operations is less than that of the row data, resulting in fewer items in the second ciphertext. Similarly, when the number of columns is greater than the number of rows, the queried end performs a homomorphic inner product on the first ciphertext and each row data, which results in fewer inner product operations and fewer items in the second ciphertext compared to that of the first ciphertext and each column data, further reducing the time consumption of homomorphic encryption.
[0234] In privacy-preserving computation, to protect data privacy, sensitive information (such as query indexes) is not directly exposed to any single party. Instead, this information is divided into multiple parts (i.e., shards), each securely assigned to different participants (here, the querying party and the queried party). Secret sharding ensures that no single party can reconstruct the original sensitive information independently, but specific computations (such as query operations) can be performed on these shards without disclosing the privacy information of any party. Based on the above embodiments, as an optional embodiment, the query index i is secretly sharded into i1. (B) and i2 (B) In the case of performing the homomorphic inner product operation on the first ciphertext and q target data, the method further includes:
[0235] For each piece of data in the data table, based on the original position of the data in the data table and i2 (B) Perform an XOR operation and use the result of the XOR operation as the position of the data after rearranging in the data table;
[0236] Among them, i1 (B) For the shards held by the query client, i2 (B) The shard held by the querying end.
[0237] For example, suppose the data table has 4 data items, a0, a1, a2, and a3, respectively. If i2 (B) If it is 1, then through i2 (B) Perform an XOR operation on the original positions (i.e., 0, 1, 2, and 3), and the rearranged 4 data are a1, a0, a3, and a2.
[0238] Figure 8 A flowchart illustrating a data table query method executed by the queried end, provided in another embodiment of this application, is shown in the figure, including:
[0239] S801. Receive the first ciphertext; the first ciphertext is the ciphertext obtained by the query end through homomorphic encryption of the bit vector, the number of dimensions of the bit vector is p, and the feature value is 1 only in the s-th dimension; wherein, if p = n1, s = i1, if p = n2, s = i2;
[0240] S802. Determine whether the query index i is secretly sharded. If yes, execute S803; otherwise, execute S804.
[0241] S803. For each piece of data in the data table, based on the original position of the data in the data table and i2 (B) Perform an XOR operation and use the result of the XOR operation as the position of the data after rearranging in the data table;
[0242] S804. For each of the q target data, treat the target data as a vector with dimension p and perform a homomorphic inner product operation with the first ciphertext to obtain a fourth ciphertext. The constant term of the plaintext polynomial in the fourth ciphertext represents the homomorphic inner product result of the target data and the first ciphertext, where p = n1, the target data is the column data of the data table, and q = n2, or p = n2, the target data is the row data of the data table, and q = n1.
[0243] S805. Homomorphically package the q fourth ciphertexts to obtain the second ciphertext;
[0244] S806, obtains q random numbers by inadvertently transmitting 1-out-of-q OT data to the query end;
[0245] S807. Take q random numbers and blind the items in the same order in the second ciphertext according to a preset order to obtain the third ciphertext, and send it to the query terminal.
[0246] Figure 9 This is an interactive schematic diagram of a data table query method according to another embodiment of this application, as shown in the figure, including:
[0247] S901. The querying end generates a key pair and synchronizes the public key in the key pair to the querying end.
[0248] S902. The query terminal obtains a query request, the query request including the index to be queried i, the index to be queried i representing the position of the data to be queried in the data table, the data table having n1 rows and n2 columns;
[0249] S903. The query terminal performs a division operation on n2 with the index i to be queried and rounds down to obtain the row index i1; and performs a modulo operation on n2 with the index i to be queried to obtain the column index i2.
[0250] S904. The query end constructs a bit vector, the number of dimensions of the bit vector is p, and the feature value is 1 only in the s-th dimension; wherein, if n1 is greater than n2, then p = n1, s = i1; if n1 is less than n2, then p = n2, s = i2; if n1 is equal to n2, then p = n1 or n2, when p = n1, s = i1, when p = n2, s = i2;
[0251] S905. The query terminal encodes the coefficients of the preset polynomial based on the bit vector, and uses the polynomial after coefficient encoding as the encoding result.
[0252] S906. The query terminal uses a homomorphic encryption algorithm to encrypt the encoding result based on a preset public key, and sends the first ciphertext to the queried terminal.
[0253] S908. The queried end performs a homomorphic inner product operation on q target data with the first ciphertext respectively. For each target data, the target data is treated as a vector with dimension p and the first ciphertext is subjected to a homomorphic inner product operation to obtain a fourth ciphertext. The constant term of the plaintext polynomial in the fourth ciphertext represents the homomorphic inner product result of the target data and the first ciphertext.
[0254] S909. The queried end performs homomorphic packaging on q fourth ciphertexts to obtain the second ciphertext. The t-th coefficient of the plaintext polynomial in the second ciphertext is the constant term of the plaintext polynomial in the t-th fourth ciphertext.
[0255] S910, the querying end and the queried end perform a 1-out-of-q OT unintentional transmission, and the querying end obtains a random number r. s q random numbers obtained by the querying end;
[0256] S911. The queried end uses q random numbers in a preset order to blind the items in the same order in the second ciphertext, obtains the third ciphertext, and sends it to the query end.
[0257] S912, The query terminal uses r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
[0258] In this embodiment, taking n1≤n2≤N as an example, the ciphertext communication volume during the homomorphic inner product operation at the queried end is approximately 16N bytes, meaning each coefficient of the polynomial is represented by 64 bits, and the ciphertext modulus is 2. Returning the third ciphertext requires at most 16N bytes (the first n1 terms of polynomials a and b). The unintentional transmission of 1-out-of-n1 uses log2n1 1-out-2 OTs, so log2n1·n2 1-out-2 OTs using Silent-OT can make the computational communication complexity negligible compared to the computational ciphertext overhead of fully homomorphic encryption. Therefore, the total communication volume is approximately 32N bytes. Assuming n1=n2=N=4096, then in 2 24 In a table lookup scenario, the single-threaded computation time of this embodiment is approximately 4 seconds, and the communication volume is approximately 128KB, compared to:
[0259] 1. Figure 1B The method shown is based on 1-out-of-N OT, with a communication volume of 16MB, which is a very significant reduction in communication volume.
[0260] 2. Figure 1C The method shown is based on fully homomorphic encryption. The query end sends two ciphertexts to the query end, with corresponding moduli of 3 and 2, respectively. The total homomorphic communication volume is about 224KB (40N+16N). The computation involves homomorphic multiplication of the n1×n2 plaintext matrix and ciphertext vector and homomorphic multiplication of the ciphertext. The total computation time under single-threaded conditions is greater than 12s.
[0261] The embodiments of this application reduce computation and communication to a reasonable level, making secure table lookup available in real time.
[0262] This application provides a data table query device, applied to a query terminal, such as... Figure 10 As shown, the query device for this data table may include: a request retrieval module 801, an index decomposition module 802, a homomorphic encryption module 803, and a decryption module 804, wherein,
[0263] The request acquisition module 801 is used to acquire a query request, the query request including the index to be queried i, the index to be queried i representing the position of the data to be queried in the data table, the data table having n1 rows and n2 columns;
[0264] The index decomposition module 802 is used to decompose the index to be searched i into row index i1 and column index i2, and construct a bit vector, wherein the number of dimensions of the bit vector is p, and the feature value is 1 only in the s-th dimension; where p = n1, s = i1, or p = n2, s = i2;
[0265] The homomorphic encryption module 803 is used to homomorphically encrypt the bit vector to obtain a first ciphertext, send the first ciphertext to the queried end, so that the queried end performs homomorphic inner product operation with the first ciphertext with q target data respectively to obtain a second ciphertext, and performs blinding processing on the second ciphertext with q random numbers to obtain a third ciphertext, wherein p = n1, the target data is the column data of the data table, q = n2, or p = n2, the target data is the row data of the data table, q = n1; t ∈ [1, q];
[0266] Decryption module 804 is used to obtain a random number r from the q random numbers based on s. s According to r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
[0267] The apparatus in this application embodiment can execute the query method on the query end side provided in this application embodiment. The implementation principle is similar. The actions performed by each module in the apparatus of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.
[0268] Based on the above embodiments, as an optional embodiment, the homomorphic encryption module performs homomorphic encryption on the bit vector to obtain the first ciphertext, including:
[0269] The preset polynomial is encoded based on the bit vector, and the encoded polynomial is used as the encoding result, wherein the number of terms in the polynomial is p;
[0270] The first ciphertext is obtained by encrypting the encoding result using a homomorphic encryption algorithm based on a preset public key.
[0271] Based on the above embodiments, as an optional embodiment, the q random numbers obtained by the query end and the r random numbers obtained by the query end... s , is obtained by the querying end and the queried end based on 1-unintentional transmission.
[0272] Based on the above embodiments, as an optional embodiment, the second ciphertext includes q terms, where the t-th term represents the homomorphic inner product result between the first ciphertext and the t-th target data, and t∈[1,q];
[0273] The third ciphertext is the result of blinding the corresponding items of the second ciphertext by using q random numbers respectively;
[0274] The decryption module is based on r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result, including:
[0275] According to r s The s-th item of the third ciphertext is deblinded to obtain the processed s-th item;
[0276] The s-th item after processing is decrypted based on the preset private key to obtain the query result.
[0277] Based on the above embodiments, as an optional embodiment, if n1 is greater than n2, then p = n1;
[0278] If n1 is less than n2, then p = n2;
[0279] If n1 equals n2, then p = n1 or n2.
[0280] Based on the above embodiments, as an optional embodiment, the index decomposition module decomposes the index to be queried i into row index i1 and column index i2, including:
[0281] The row index i1 is obtained by dividing n2 by the index to be searched and rounding down.
[0282] The column index i2 is obtained by performing a modulo operation on n2 with the index i to be queried.
[0283] Based on the above embodiments, as an optional embodiment, the query index i is secretly sharded into i1. (B) and i2 (B) In this case, the queried end performs homomorphic inner product operations on q target data with the first ciphertext respectively, and previously also based on i2 (B) Rearrange the data in the data table.
[0284] This application provides a data table query device, applied to the queried end, such as... Figure 11 As shown, the data table query device may include: a ciphertext receiving module 901, a homomorphic inner product module 902, and a blinding processing module 903, wherein,
[0285] The ciphertext receiving module 901 is used to receive the first ciphertext; the first ciphertext is the ciphertext obtained by the query end through homomorphic encryption of the bit vector, wherein the bit vector has a dimension of p, and the feature value is 1 only in the s-th dimension; wherein, if p = n1, s = i1, if p = n2, s = i2; n1 is the number of rows in the data table, n2 is the number of columns in the data table; i1 represents the row index obtained by decomposing the query index i, and i2 represents the column index obtained by decomposing the query index i.
[0286] The homomorphic inner product module 902 is used to perform homomorphic inner product operations on q target data with the first ciphertext respectively to obtain the second ciphertext, wherein p = n1, the target data is the column data of the data table, q = n2, or p = n2, the target data is the row data of the data table, q = n1; t ∈ [1, q];
[0287] The blinding processing module 903 is used to blind the second ciphertext with q random numbers to obtain the third ciphertext, and then send the third ciphertext to the query terminal.
[0288] The apparatus in this application embodiment can execute the query method on the queried end side provided in this application embodiment. The implementation principle is similar. The actions performed by each module in the apparatus of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the apparatus, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.
[0289] Based on the above embodiments, as an optional embodiment, the homomorphic inner product module performs homomorphic inner product operations on q target data with the first ciphertext respectively to obtain the second ciphertext, including:
[0290] For each target data, the target data is treated as a vector of dimension p and homomorphically inner product is performed with the first ciphertext to obtain a fourth ciphertext. The constant term of the plaintext polynomial in the fourth ciphertext represents the homomorphic inner product result between the target data and the first ciphertext.
[0291] Homomorphically package q fourth ciphertexts to obtain the second ciphertext;
[0292] In this context, the t-th coefficient of the plaintext polynomial in the second ciphertext is the constant term of the plaintext polynomial in the t-th fourth ciphertext.
[0293] Based on the above embodiments, as an optional embodiment, the blinding processing module uses q random numbers to blind the second ciphertext to obtain the third ciphertext, including:
[0294] The third ciphertext is obtained by blinding the items in the same order in the second ciphertext with q random numbers in a preset order.
[0295] Based on the above embodiments, as an optional embodiment, the q random numbers obtained by the query end and the r random numbers obtained by the query end... s This is obtained by the querying end and the queried end through unintentional transmission.
[0296] Based on the above embodiments, as an optional embodiment, if n1 is greater than n2, then p = n1;
[0297] If n1 is less than n2, then p = n2;
[0298] If n1 equals n2, then p = n1 or n2.
[0299] Based on the above embodiments, as an optional embodiment, the homomorphic inner product module is secretly sharded into i1 when the query index i is sharded. (B) and i2 (B) In the case of performing the homomorphic inner product operation on the first ciphertext and q target data, the method further includes:
[0300] For each piece of data in the data table, based on the original position of the data in the data table and i2 (B) Perform an XOR operation and use the result of the XOR operation as the position of the data after rearranging in the data table;
[0301] Among them, i1 (B) For the shards held by the query client, i2 (B) The shard held by the querying end.
[0302] This application provides an electronic device, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of a data table query method. Compared with related technologies, it can achieve the following: A query request includes a query index i, where the query index i represents the position of the data to be queried in the data table. The data table has n1 rows and n2 columns. The query index i is decomposed into row index i1 and column index i2, and a bit vector is constructed. The bit vector has p dimensions, and only the eigenvalue of the s-th dimension is 1, where p = n1, s = i1, or p = n2, s = i2. This application only needs to construct one bit vector, and homomorphically encrypts this bit vector to obtain the first ciphertext. Compared with a fully homomorphically encrypted secure query, the encryption of two bit vectors is reduced to the encryption of one bit vector. After obtaining the first ciphertext, the queried end performs a homomorphic inner product operation on the first ciphertext and q target data to obtain the second ciphertext, and uses q random numbers to blind the second ciphertext to obtain the third ciphertext. The query end then uses r... s The third ciphertext is deblinded, and then decrypted. This involves replacing another bit vector with a secure query transmitted unintentionally, ensuring that the ciphertext encrypted at the query end consists of only one ciphertext with a ciphertext mode of 2. This further reduces communication and computational overhead. Moreover, this application only requires q random numbers to blind the second ciphertext with q terms. Compared to the scheme that completely uses a secure query transmitted unintentionally, this significantly reduces the amount of blinding processing and data transmitted with the query end, thereby improving query efficiency.
[0303] In one alternative embodiment, an electronic device is provided, such as Figure 12 As shown, Figure 12 The illustrated electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.
[0304] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0305] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of representation, bus 4002 is represented by only one thick line in the figure, but this does not indicate that there is only one bus or one type of bus.
[0306] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.
[0307] The memory 4003 stores computer programs that execute embodiments of this application, and its execution is controlled by the processor 4001. The processor 4001 executes the computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.
[0308] This application provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the steps and corresponding content of the aforementioned method embodiments.
[0309] This application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments.
[0310] The terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the figures or text.
[0311] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.
[0312] The above description is only an optional implementation method for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application without departing from the technical concept of this application also fall within the protection scope of the embodiments of this application.< / x> < / y> < / x> < / x>
Claims
1. A method for querying a data table, characterized in that, Applied to the query end, the methods include: Obtain a query request, the query request including the index to be queried i, the index to be queried i representing the position of the data to be queried in the data table, the data table having n1 rows and n2 columns; The index i to be queried is decomposed into row index i1 and column index i2, and a bit vector is constructed. The number of dimensions of the bit vector is p, and the feature value of the s-th dimension is 1; where p = n1, s = i1, or p = n2, s = i2. The bit vector is homomorphically encrypted to obtain a first ciphertext, which is then sent to the queried end. The queried end performs homomorphic inner product operations on q target data with the first ciphertext to obtain a second ciphertext. The second ciphertext is then blinded using q random numbers to obtain a third ciphertext. Here, p = n1, the target data is column data of the data table, and q = n2, or p = n2, the target data is row data of the data table, and q = n1. Based on s, a random number r is obtained from the q random numbers. s According to r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
2. The method according to claim 1, characterized in that, The step of homomorphically encrypting the bit vector to obtain the first ciphertext includes: The preset polynomial is encoded based on the bit vector, and the encoded polynomial is used as the encoding result, wherein the number of terms in the polynomial is p; The first ciphertext is obtained by encrypting the encoding result using a homomorphic encryption algorithm based on a preset public key.
3. The method according to claim 1, characterized in that, The q random numbers obtained by the queried end and the random number r obtained by the querying end s This is obtained unintentionally through 1-out-of-q OT transmission between the querying end and the queried end.
4. The method according to claim 1 or 3, characterized in that, The second ciphertext includes q terms, where the t-th term represents the homomorphic inner product result between the first ciphertext and the t-th target data, t∈[1,q]; The third ciphertext is the result of blinding the corresponding items of the second ciphertext by using q random numbers respectively; According to r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result, including: According to r s The s-th item of the third ciphertext is deblinded to obtain the processed s-th item; The s-th item after processing is decrypted based on the preset private key to obtain the query result.
5. The method according to any one of claims 1-4, characterized in that, If n1 is greater than n2, then p = n1; If n1 is less than n2, then p = n2; If n1 equals n2, then p = n1 or n2.
6. The method according to claim 1, characterized in that, The step of decomposing the index i to be queried into row index i1 and column index i2 includes: The row index i1 is obtained by dividing n2 by the index to be searched and rounding down. The column index i2 is obtained by performing a modulo operation on n2 with the index i to be queried.
7. The method according to claim 1, characterized in that, The query index i is secretly sharded into i1 (B) and i2 (B) In this case, before performing homomorphic inner product operations on the q target data with the first ciphertext, the queried end also calculates according to i2. (B) Rearrange the data in the data table; Among them, i1 (B) For the shards held by the query client, i2 (B) The shard held by the querying end.
8. A method for querying a data table, characterized in that, Applied to the queried end, the method includes: Receive the first ciphertext; the first ciphertext is the ciphertext obtained by the query end through homomorphic encryption of the bit vector, the bit vector has a dimension of p, and the feature value of the s-th dimension is 1; where, if p = n1, s = i1, if p = n2, s = i2; n1 is the number of rows in the data table, n2 is the number of columns in the data table; i1 represents the row index obtained by decomposing the query index i, and i2 represents the column index obtained by decomposing the query index i. The first ciphertext is obtained by performing a homomorphic inner product operation on q target data respectively, where p = n1, the target data is the column data of the data table, q = n2, or p = n2, the target data is the row data of the data table, and q = n1. The second ciphertext is blinded using q random numbers to obtain the third ciphertext, which is then sent to the querying end.
9. The method according to claim 8, characterized in that, The step of performing homomorphic inner product operations between the q target data and the first ciphertext respectively to obtain the second ciphertext includes: For each target data, the target data is treated as a vector of dimension p and homomorphically inner product is performed with the first ciphertext to obtain a fourth ciphertext. The constant term of the plaintext polynomial in the fourth ciphertext represents the homomorphic inner product result between the target data and the first ciphertext. Homomorphically package q fourth ciphertexts to obtain the second ciphertext; In this context, the t-th coefficient of the plaintext polynomial in the second ciphertext is the constant term of the plaintext polynomial in the t-th fourth ciphertext.
10. The method according to claim 8, characterized in that, The second ciphertext is blinded using q random numbers to obtain the third ciphertext, which includes: The third ciphertext is obtained by blinding the items in the same order in the second ciphertext with q random numbers in a preset order.
11. The method according to claim 8, characterized in that, The q random numbers obtained by the queried end and the random number r obtained by the querying end s This is obtained unintentionally through 1-out-of-q OT transmission between the querying end and the queried end.
12. The method according to any one of claims 8-11, characterized in that, If n1 is greater than n2, then p = n1; If n1 is less than n2, then p = n2; If n1 equals n2, then p = n1 or n2.
13. The method according to claim 8, characterized in that, The query index i is secretly sharded into i1 (B) and i2 (B) In the case of performing the homomorphic inner product operation on the first ciphertext and q target data, the method further includes: For each piece of data in the data table, based on the original position of the data in the data table and i2 (B) Perform an XOR operation and use the result of the XOR operation as the position of the data after rearranging in the data table; Among them, i1 (B) For the shards held by the query client, i2 (B) The shard held by the querying end.
14. A data table query device, characterized in that, The device, used for querying, includes: The request acquisition module is used to acquire a query request, the query request including the index to be queried i, the index to be queried i representing the position of the data to be queried in the data table, the data table having n1 rows and n2 columns; The index decomposition module is used to decompose the index to be searched i into row index i1 and column index i2, and construct a bit vector. The number of dimensions of the bit vector is p, and the feature value of the s-th dimension is 1; where p = n1, s = i1, or p = n2, s = i2. A homomorphic encryption module is used to homomorphically encrypt the bit vector to obtain a first ciphertext, send the first ciphertext to the queried end, so that the queried end performs homomorphic inner product operations with the first ciphertext with q target data respectively to obtain a second ciphertext, and performs blinding processing on the second ciphertext with q random numbers to obtain a third ciphertext, wherein p = n1, the target data is the column data of the data table, q = n2, or p = n2, the target data is the row data of the data table, q = n1; The decryption module is used to obtain a random number r from the q random numbers based on s. s According to r s The third ciphertext is deblinded, and the deblinded third ciphertext is decrypted to obtain the query result.
15. A data table query device, characterized in that, Applied to the queried end, the device includes: The ciphertext receiving module is used to receive the first ciphertext; the first ciphertext is the ciphertext obtained by the query end through homomorphic encryption of the bit vector, wherein the bit vector has a dimension of p and the eigenvalue of the s-th dimension is 1; wherein, if p = n1, s = i1, if p = n2, s = i2; n1 is the number of rows in the data table, n2 is the number of columns in the data table; i1 represents the row index obtained by decomposing the query index i, and i2 represents the column index obtained by decomposing the query index i. The homomorphic inner product module is used to perform homomorphic inner product operations on q target data with the first ciphertext respectively to obtain the second ciphertext, where p = n1, the target data is the column data of the data table, q = n2, or p = n2, the target data is the row data of the data table, q = n1; The blinding processing module is used to blind the second ciphertext with q random numbers to obtain the third ciphertext, and then send the third ciphertext to the query terminal.
16. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the data table query method according to any one of claims 1-13.
17. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data table query method according to any one of claims 1-13.
18. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the data table query method according to any one of claims 1-13.