Data query method and device, computer device, and storage medium

By employing privacy intersection computation and key data concatenation encryption and decryption mechanisms, the problems of high computational load and low efficiency in existing technologies are solved, enabling efficient retrieval of privacy information and ensuring data security and privacy.

CN115422224BActive Publication Date: 2026-04-07HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-02
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing privacy information retrieval methods are based on fully homomorphic encryption, which can guarantee privacy, but the computational load is large, resulting in low information retrieval efficiency, especially in fields with high privacy requirements such as medicine and patents.

Method used

The holder's key data is obtained by calculating the privacy intersection, then concatenated with plaintext data and encrypted. The query key data is then used to decrypt the data, ensuring that only encrypted data is transmitted during data transmission, reducing the exposure of plaintext data and improving information retrieval efficiency.

Benefits of technology

While ensuring data privacy, it significantly reduces the amount of computation, improves information retrieval efficiency, avoids splitting and splicing long data items, and enhances the efficiency of data query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115422224B_ABST
    Figure CN115422224B_ABST
Patent Text Reader

Abstract

The application provides a data query method and device, computer equipment and a storage medium. In the method, a data holder splices second holder key data obtained by performing privacy intersection calculation on data items corresponding to candidate key values, and then encrypts the second holder key data by using first holder key data obtained by performing privacy intersection calculation, and sends the encrypted data to a data query party. The data query party calculates first query party key data by using key reference data obtained by performing privacy intersection calculation and a query key value, and decrypts the encrypted data by using the first query party key data, and then obtains corresponding second query party key data based on the first query party key data, so as to determine to-be-queried data items from the decrypted data by using the second query party key data. Only encrypted data is transmitted between the data holding equipment and the data query equipment, and no specific plaintext data is involved, so that the data security of both parties is protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a data query method, apparatus, computer device, and storage medium. Background Technology

[0002] Private Information Retrieval (PIR) is a strategy employed to protect the privacy of individuals on public online platforms. When a data queryer submits a data request to a data holder, the data holder is kept unaware of the specific details of the query. Currently, PIR has significant applications in fields with high privacy requirements, such as healthcare and patents.

[0003] Existing privacy information retrieval methods are based on fully homomorphic encryption and perform privacy queries by constructing polynomial interpolation. While this method involves relatively little communication between the data holder and the data queryer, it requires a huge amount of data computation and has low information retrieval efficiency. Summary of the Invention

[0004] Therefore, it is necessary to provide a data query method, apparatus, computer equipment, and storage medium to address the aforementioned technical problems and improve information retrieval efficiency.

[0005] In a first aspect, this application provides a data query method applied to a data holding device, the method comprising:

[0006] Retrieve candidate key values ​​and the corresponding data items;

[0007] The holder key data is obtained by performing privacy intersection calculation with the data query device. The holder key data includes first holder key data and second holder key data corresponding to the candidate key values.

[0008] The second holder key data and data item corresponding to the candidate key value are concatenated to obtain the plaintext data corresponding to the candidate key value;

[0009] The plaintext data is encrypted using the first holder's key data corresponding to the candidate key value to obtain the ciphertext data corresponding to the candidate key value.

[0010] The ciphertext data corresponding to the candidate key value is sent to the data query device as encrypted data. The encrypted data is used to instruct the data query device to decrypt the ciphertext data of the candidate key value using the first query key data to obtain the decrypted data, and to determine the data item to be queried from the decrypted data based on the second query key data.

[0011] The first query key data and the second query key data are obtained based on the key reference data and the query key value. The key reference data is obtained by the data query device from the first holder key data and the second holder key data in the holder key data through privacy intersection calculation with the data holder device. If the query key value is equal to the candidate key value, the first query key data is equal to the first holder key data corresponding to the candidate key value, and the second query key data is equal to the second holder key data corresponding to the candidate key value.

[0012] In some embodiments of this application, the step of obtaining the holder's key data by performing privacy intersection calculation with a data query device includes:

[0013] Obtain the common mapping function agreed upon with the data query device;

[0014] The candidate key values ​​are mapped to the first mapping data corresponding to the candidate key values ​​through a common mapping function;

[0015] Construct a first random vector corresponding to the candidate key value, and determine the first random vector as the first holder key data corresponding to the candidate key value;

[0016] Perform an XOR operation on the first mapping data corresponding to the candidate key value and the first holder key data to obtain the second holder key data corresponding to the candidate key value.

[0017] Secondly, this application provides a data query method applied to a data query device, the method comprising:

[0018] The device receives encrypted data sent by the data holding device. The encrypted data includes ciphertext data corresponding to each candidate key value. The ciphertext data corresponding to each candidate key value is obtained by encrypting the plaintext data corresponding to the candidate key value using the first holder key data corresponding to the candidate key value in the holder key data. The plaintext data corresponding to each candidate key value is obtained by concatenating the second holder key data corresponding to the candidate key value in the holder key data and the data item corresponding to the candidate key value.

[0019] Key reference data is obtained from the first and second holder key data in the holder key data by performing privacy intersection calculations with the data holding device;

[0020] Based on the key reference data and the query key value, obtain the first query party key data and the second query party key data corresponding to the query key value; wherein, if the query key value is equal to the candidate key value, the first query party key data is equal to the first holder key data corresponding to the candidate key value, and the second query party key data is equal to the second holder key data corresponding to the candidate key value.

[0021] The encrypted data of the candidate key value is decrypted using the first query party's key data to obtain the decrypted data;

[0022] The data item to be queried is determined from the decrypted data based on the second query key data.

[0023] In some embodiments of this application, the step of determining the data item to be queried from the decrypted data based on the second query key data includes:

[0024] Obtain the first data sequence of the target location in the decrypted data;

[0025] If the first data sequence matches the second query key data, the second data sequence in the decrypted data is identified as the data item to be queried.

[0026] In some embodiments of this application, the step of obtaining key reference data from the first and second holder key data in the holder key data by performing privacy intersection calculation with the data holding device includes:

[0027] Construct a second random vector;

[0028] An unintentional transmission is initiated to the data holding device via a second random vector, and key reference data is obtained based on the first and second holder key data in the holder key data.

[0029] In some embodiments of this application, the step of obtaining first query party key data and second query party key data corresponding to the query key value based on key reference data and query key value includes:

[0030] Perform an XOR operation on the second random vector and the query key value to obtain the first operation result;

[0031] Obtain the common mapping function agreed upon with the data query device, and map the first calculation result to the second mapping data through the common mapping function;

[0032] Perform an XOR operation on the key reference data and the second mapping data to obtain the first query key data corresponding to the query key value;

[0033] The query key value is mapped to third-party mapping data through a public mapping function. The third-party mapping data is then XORed with the first query key data corresponding to the query key value to obtain the second query key data corresponding to the query key value.

[0034] Thirdly, this application provides a data query method applied to a data query system, the data query system including a data holding device and a data query device connected by communication, the method comprising:

[0035] The data holding device and the data query device perform privacy intersection calculation. Through the privacy intersection calculation, the data holding device obtains the holder key data, and the data query device obtains key reference data from the first holder key data and the second holder key data in the holder key data.

[0036] The data holding device acquires candidate key values ​​and the data items corresponding to the candidate key values;

[0037] The data holding device concatenates the second holder key data and data item corresponding to the candidate key value to obtain the plaintext data corresponding to the candidate key value;

[0038] The data holding device uses the first holder key data corresponding to the candidate key value to encrypt the plaintext data, thereby obtaining the ciphertext data corresponding to the candidate key value;

[0039] The data holding device sends the ciphertext data corresponding to the candidate key value as encrypted data to the data query device;

[0040] The data query device receives encrypted data sent by the data holding device; the encrypted data includes ciphertext data corresponding to each candidate key value;

[0041] The data query device obtains the first query party key data and the second query party key data corresponding to the query key value based on the key reference data and the query key value; wherein, if the query key value is equal to the candidate key value, the first query party key data is equal to the first holder key data, and the second query party key data is equal to the second holder key data.

[0042] The data query device uses the first query party's key data to decrypt the ciphertext data of the candidate key values ​​to obtain the decrypted data;

[0043] The data query device determines the data item to be queried from the decrypted data based on the second query key data.

[0044] Fourthly, this application provides a data query device for use in a data holding device, the device comprising:

[0045] The data item acquisition module is used to acquire candidate key values ​​and the data items corresponding to the candidate key values;

[0046] The first privacy intersection calculation module is used to obtain the holder key data by performing privacy intersection calculation with the data query device. The holder key data includes the first holder key data and the second holder key data corresponding to the candidate key values.

[0047] The plaintext data acquisition module is used to concatenate the second holder key data and data item corresponding to the candidate key value to obtain the plaintext data corresponding to the candidate key value;

[0048] The data encryption module is used to encrypt plaintext data using the first holder key data corresponding to the candidate key value to obtain ciphertext data corresponding to the candidate key value;

[0049] The data sending module is used to send the ciphertext data corresponding to the candidate key value as encrypted data to the data query device. The encrypted data is used to instruct the data query device to decrypt the ciphertext data of the candidate key value using the first query key data to obtain decrypted data, and to determine the data item to be queried from the decrypted data based on the second query key data. The first query key data and the second query key data are obtained based on the key reference data and the query key value. The key reference data is obtained by the data query device from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holder device. If the query key value is equal to the candidate key value, the first query key data is equal to the first holder key data corresponding to the candidate key value, and the second query key data is equal to the second holder key data corresponding to the candidate key value.

[0050] Fifthly, this application provides a data query device for use in data query equipment, the device comprising:

[0051] The data receiving module is used to receive encrypted data sent by the data holding device. The encrypted data includes ciphertext data corresponding to each candidate key value. The ciphertext data corresponding to the candidate key value is obtained by encrypting the plaintext data corresponding to the candidate key value using the first holder key data corresponding to the candidate key value in the holder key data. The plaintext data corresponding to the candidate key value is obtained by concatenating the second holder key data corresponding to the candidate key value in the holder key data and the data item corresponding to the candidate key value.

[0052] The second privacy intersection calculation module is used to obtain key reference data from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holding device;

[0053] The key acquisition module is used to acquire the first query party key data and the second query party key data corresponding to the query key value based on the key reference data and the query key value; if the query key value is equal to the candidate key value, the first query party key data is equal to the first holder key data corresponding to the candidate key value, and the second query party key data is equal to the second holder key data corresponding to the candidate key value.

[0054] The data decryption module is used to decrypt the ciphertext data of the candidate key values ​​using the first query key data to obtain decrypted data;

[0055] The data determination module is used to determine the data item to be queried from the decrypted data based on the second query key data.

[0056] Sixthly, this application also provides a server, the server comprising:

[0057] One or more processors;

[0058] Memory; and

[0059] One or more applications, wherein the applications are stored in memory and configured to be executed by a processor to implement a data query method.

[0060] In a seventh aspect, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to execute steps in a data query method.

[0061] The aforementioned data query method, apparatus, computer equipment, and storage medium involve the data holder concatenating the data item corresponding to the candidate key value with the second holder's key data obtained after privacy intersection calculation with the data queryer. The data holder then encrypts the concatenated plaintext data using the first holder's key data obtained after privacy intersection calculation with the data queryer, and sends the encrypted data to the data queryer. The data queryer calculates the first queryer's key data using the key reference data obtained after privacy intersection calculation with the data queryer and the query key value, and uses the first queryer's key data to decrypt the encrypted data. Based on the first queryer's key data, the corresponding second queryer's key data is obtained, and the second queryer's key data is used to determine the data item to be queried from the decrypted data. The data transmitted between the data holder and the data queryer consists only of encrypted data and does not involve specific plaintext data, thus protecting both parties. Data security; furthermore, during data transmission, the encryption and decryption keys for plaintext data (i.e., the first holder's key data) between the data holding device and the data querying device are transmitted through privacy intersection calculation. The first querying key data calculated by the data querying party based on the key reference data and the query key value can only correctly decrypt the encrypted data corresponding to the candidate key value that matches the query key value, while invalidally decrypting the encrypted data corresponding to other candidate key values. That is, decrypting the encrypted data corresponding to the candidate key value that matches the query key value based on the first querying key data yields valid plaintext data, while decrypting the encrypted data corresponding to other candidate key values ​​yields garbled data. Thus, the data querying party can only obtain the data item corresponding to the query key value and cannot obtain other data items, while the data holding party cannot know the data items obtained by the data querying party, ensuring the privacy information retrieval of both parties. Attached Figure Description

[0062] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0063] Figure 1 This is a schematic diagram of a data query method in an embodiment of this application;

[0064] Figure 2 This is a flowchart illustrating the data query method in an embodiment of this application;

[0065] Figure 3 This is another flowchart illustrating the data query method in the embodiments of this application;

[0066] Figure 4 This is another flowchart illustrating the data query method in the embodiments of this application;

[0067] Figure 5 This is a schematic diagram of the data query device in the embodiments of this application;

[0068] Figure 6 This is another structural schematic diagram of the data query device in the embodiments of this application;

[0069] Figure 7 This is a schematic diagram of the structure of the computer device in the embodiments of this application. Detailed Implementation

[0070] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0071] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0072] In the description of this application, the word "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0073] The data query method provided in this application embodiment can be applied to, for example... Figure 1 The data query system shown includes a data storage device 100 corresponding to the data holder and a data query device 200. The data storage device 100 and the data query device 200 can be terminals or servers. Specifically, the terminal can be a mobile phone, tablet computer, laptop computer, etc. The server can be a standalone server or a server network or server cluster, including but not limited to computers, network hosts, single network servers, multiple network server sets, or cloud servers composed of multiple servers. The cloud server consists of a large number of computers or network servers based on cloud computing.

[0074] Those skilled in the art will understand that Figure 1 The application environment shown is merely one application scenario of the solution in this application and does not constitute a limitation on the application scenario of the solution in this application. Other application environments may include those that are more specific to this application. Figure 1 The number of computer devices shown is more or less, for example Figure 1 Only one data query device 200 is shown in the diagram. It is understood that the data query system may also include one or more other servers, which are not specified here.

[0075] It should also be noted that, Figure 1 The schematic diagram of the data query system shown is merely an example. The data query system and scenario described in this embodiment of the invention are intended to more clearly illustrate the technical solutions of this embodiment and do not constitute a limitation on the technical solutions provided by this embodiment. As those skilled in the art will know, with the evolution of data query systems and the emergence of new business scenarios, the technical solutions provided by this embodiment of the invention are also applicable to similar technical problems.

[0076] See Figure 2This application provides a data query method, which is mainly applied to the above-mentioned... Figure 1 Taking data storage device 100 as an example, the method includes steps S210 to S250, as follows:

[0077] S210, retrieve the candidate key value and the data item corresponding to the candidate key value.

[0078] Among them, the candidate key value and the corresponding data item are key-value pairs stored on the data storage device, where the key value is used to retrieve the corresponding data item.

[0079] The number of candidate key-value pairs and their corresponding data items is two or more. Specifically, the entire set of key-value pairs can be pre-divided through bucketing (e.g., hash modulo bucketing). Upon receiving a data query request from the data query device, the key-value pairs stored in a certain bucket are determined as candidate key-value pairs and their corresponding data items based on the data query request. This allows for improved data query efficiency through offline preprocessing when the data volume is large.

[0080] S220, the holder key data is obtained by performing privacy intersection calculation with the data query device, wherein the holder key data includes first holder key data and second holder key data corresponding to the candidate key values.

[0081] The holder key data, including the first holder key data and the second holder key data that correspond one-to-one with each candidate key value, is calculated by the data holder and the data query device through the Privacy Set Intersection (PSI).

[0082] Specifically, in one embodiment, the step of obtaining the holder key data by performing privacy intersection calculation with the data query device may include: obtaining a public mapping function agreed upon with the data query device; mapping the candidate key value to first mapping data corresponding to the candidate key value through the public mapping function; constructing a first random vector corresponding to the candidate key value, and determining the first random vector as the first holder key data corresponding to the candidate key value; performing an XOR operation on the first mapping data corresponding to the candidate key value and the first holder key data to obtain the second holder key data corresponding to the candidate key value.

[0083] The public mapping function is a function agreed upon in advance by the data holder and the data query device to map candidate key values ​​to other values ​​in order to protect the privacy of the data. Specifically, in one embodiment, the public mapping function can be a pseudo-random number generation function, which can map the input data to a random number sequence of a safe length; wherein, the safe length is agreed upon in advance by the data holder and the data query device, and can be represented as λ. The longer the safe length, the higher the security and anti-collision of the data during the interaction between the data holder and the data query device; the pseudo-random number is a random number sequence that follows the {0, 1} distribution calculated by a deterministic algorithm. When calculating the pseudo-random number, if the initial value and the input value used by the pseudo-random number generation function remain unchanged, then the order of the pseudo-random number will also remain unchanged. For example, the pseudo-random number generation function is represented by the following formula (1):

[0084]

[0085] In the formula, f k (·) denotes a pseudo-random number generation function; The set of all candidate key values ​​is called the message space; k is the initial value of the pseudo-random number generation function. For the same k and input value, the result is also consistent. For example, if the data holder holds data y and the data query device holds data x, then the following equation (2) holds:

[0086]

[0087] When there is only one candidate key value, the first holder key data and the second holder key data can be vectors with a length of secure length λ consisting of 0s and 1s.

[0088] When there are multiple candidate key values, the first holder key data can be a first holder key matrix, which includes n rows of random vectors of length λ consisting of 0s and 1s. Similarly, the second holder key data can be a second holder key matrix, which includes n rows of random vectors of length λ consisting of 0s and 1s. Here, n is the number of candidate key values, that is, the first holder key matrix includes first key data corresponding to each candidate key value, and the second holder key matrix includes second key data corresponding to each candidate key value. For example, the random vector in the i-th row of the first holder key matrix is ​​the first key data corresponding to the i-th candidate key value, and the random vector in the i-th row of the second holder key matrix is ​​the second key data corresponding to the i-th candidate key value, i∈[1,n].

[0089] Specifically, after mapping each candidate key value to a first mapping data of length λ using a public mapping function, for any candidate key value, the first random vector (i.e., the first key data) corresponding to the candidate key value can be XORed with the first mapping data corresponding to the candidate key value to obtain the second key data corresponding to the candidate key value. Based on the second key data corresponding to each candidate key value, the second holder key data can be obtained.

[0090] For example, suppose the data holder holds the data: (y1, v1), (y2, v2), ..., (y n ,v n ), where y i Represents candidate key values, v i This represents the data item corresponding to the candidate key value, i∈[1,n]; the data holder first randomly constructs a {0,1} n×λ The matrix R0 (i.e., the first holder's key data) includes a first random vector corresponding to each candidate key value. It should be noted that the random vector in the i-th row of matrix R0 is the first key data corresponding to the i-th candidate key value, where i ∈ [1, n]. Meanwhile, matrix R1 (i.e., the second holder's key data) can be calculated using the following formula: Similarly, the vector in the i-th row of matrix R1 is the second key data corresponding to the i-th candidate key value.

[0091] S230, concatenate the second holder key data and data item corresponding to the candidate key value to obtain the plaintext data corresponding to the candidate key value.

[0092] In this step, after obtaining the holder's key data, the data holder concatenates the second holder's key data of the candidate key values ​​and their corresponding data items to obtain the plaintext data corresponding to each candidate key value. Specifically, the concatenation of the second holder's key data and the data items can be done by placing the second holder's key data first and the data items last, or by placing the second holder's key data last and the data items first; there is no limitation on this.

[0093] For example, taking the concatenation of the second holder's key data first and the data items last as an example, the plaintext data corresponding to the candidate key value can be expressed as the following formula (3):

[0094]

[0095] Where, v′ i This represents the plaintext data corresponding to the i-th candidate key value. This represents the second key data corresponding to the i-th candidate key value in the second holder's key data, v. iThis represents the data item corresponding to the i-th candidate key value.

[0096] S240, use the first holder key data corresponding to the candidate key value to encrypt the plaintext data to obtain the ciphertext data corresponding to the candidate key value.

[0097] In this step, for any candidate key value, the plaintext data corresponding to the candidate key value is encrypted using the first key data in the first holder key data that corresponds to the candidate key value, to obtain the ciphertext data corresponding to the candidate key value.

[0098] Furthermore, specifically, the plaintext data corresponding to the candidate key value can be encrypted using the first holder's key data in a symmetric encryption manner.

[0099] S250, the ciphertext data corresponding to the candidate key value is sent as encrypted data to the data query device. The encrypted data is used to instruct the data query device to decrypt the ciphertext data of the candidate key value using the first query key data to obtain decrypted data, and to determine the data item to be queried from the decrypted data based on the second query key data. The first query key data and the second query key data are obtained based on the key reference data and the query key value. The key reference data is obtained by the data query device from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holder device. If the query key value is equal to the candidate key value, the first query key data is equal to the first holder key data corresponding to the candidate key value, and the second query key data is equal to the second holder key data corresponding to the candidate key value.

[0100] Specifically, after obtaining the ciphertext data corresponding to all candidate key values, the data holder sends the ciphertext data corresponding to all candidate key values ​​as encrypted data to the data query device.

[0101] The query key is the key held by the data querying party and is the key of the data item to be queried. The key reference data is obtained by the data querying device from the first and second holder key data in the holder key data through privacy intersection calculation with the data holding device. Based on the query key and the key reference data, the data querying device can calculate the querying party key data corresponding to each encrypted data.

[0102] Specifically, the data holder and the data queryer perform privacy intersection calculations. The data holder obtains the first and second holder key data corresponding to the candidate key values ​​through the privacy intersection calculation. The data queryer obtains key reference data through the privacy intersection calculation. If the query key value is the same as a candidate key value (i.e., the target candidate key value), the first queryer key data obtained based on the key reference data and the query key value is the same as the first holder key data corresponding to the target candidate key value, and the second queryer key data is the same as the second holder key data corresponding to the target candidate key value. The correct plaintext data can be obtained by decrypting the ciphertext data corresponding to the target candidate key value through the first queryer key data. The plaintext data includes the data items corresponding to the candidate key values ​​and the second queryer key data. Conversely, if the query key value is different from a candidate key value (i.e., the target candidate key value), the first query key data obtained based on the key reference data and the query key value is different from the first holder key data corresponding to the target candidate key value. Decrypting the ciphertext data corresponding to the target candidate key value using the first query key data yields garbled data, and the correct plaintext data cannot be obtained. Therefore, after obtaining the query key data, the data query device, using the first query key data to decrypt the ciphertext data corresponding to each candidate key value, can use the second query key data to search for the correctly decrypted data to obtain the data item of the candidate key value that matches the query key value.

[0103] In the above data query method, after obtaining the candidate key value and the corresponding data item, the holder key data is obtained by performing privacy intersection calculation with the data query device. The holder key data includes first holder key data and second holder key data corresponding to the candidate key value. The second holder key data and the data item corresponding to the candidate key value are concatenated to obtain the plaintext data corresponding to the candidate key value. The plaintext data is encrypted using the first holder key data corresponding to the candidate key value to obtain the ciphertext data corresponding to the candidate key value. The ciphertext data corresponding to the candidate key value is sent as encrypted data to the data query device. The encrypted data is used to instruct the data query device to decrypt the ciphertext data of the candidate key value using the first query key data to obtain decrypted data, and to determine the data item to be queried from the decrypted data based on the second query key data. The data holder concatenates the data item corresponding to the candidate key value with the second holder key data obtained from the privacy intersection calculation. Then, using the first holder key data obtained from the privacy intersection calculation, the concatenated plaintext data is encrypted. This encrypted data is sent to the data querying party. The data querying party calculates the first and second querying party key data using the key reference data obtained from the privacy intersection calculation and the query key value. The first querying party key data is then used to decrypt the encrypted data, and the second querying party key data is used to determine the data item to be queried from the decrypted data. The data transmitted between the data holding device and the data querying device consists only of encrypted data, not the actual plaintext data, thus protecting the data security of both parties. The key used to encrypt and decrypt the plaintext data (i.e., the first holder key data) is transmitted through the privacy intersection calculation. It can only obtain the keys corresponding to candidate keys that match the query key, and can only correctly decrypt the encrypted data corresponding to candidate keys that match the query key. It cannot correctly decrypt the encrypted data corresponding to other candidate keys. That is, decrypting the encrypted data corresponding to the candidate key that matches the query key based on the first query key data yields valid plaintext data, while decrypting the encrypted data corresponding to other candidate keys yields garbled data. After obtaining the decrypted data, the data query device further matches and searches for the data item corresponding to the query key from a large number of valid or invalid decrypted data based on the second query key data. Throughout the entire data query process, the data query device cannot obtain other data items, and the data holder cannot know the data items obtained by the data query party. The retrieval of privacy information by both parties does not require homomorphic encryption, which greatly reduces the amount of data computation and improves information retrieval efficiency.

[0104] Furthermore, existing privacy information retrieval methods based on fully homomorphic encryption require splitting long data items to construct individual interpolation polynomials, and then concatenating multiple interpolation polynomials to obtain the encrypted data corresponding to the data item. Compared to privacy information retrieval based on fully homomorphic encryption, the data query method in this application embodiment can encrypt data items of arbitrary length without splitting and concatenating the data, greatly improving information retrieval efficiency.

[0105] See Figure 3 This application provides a data query method, which is mainly applied to the above-mentioned... Figure 1 Taking data query device 200 as an example, the method includes steps S310 to S330, as follows:

[0106] S310, receive encrypted data sent by the data holding device; the encrypted data includes ciphertext data corresponding to each candidate key value; wherein, the ciphertext data corresponding to the candidate key value is obtained by encrypting the plaintext data corresponding to the candidate key value using the first holding key data corresponding to the candidate key value in the holding key data, and the plaintext data corresponding to the candidate key value is obtained by concatenating the second holding key data corresponding to the candidate key value in the holding key data and the data item corresponding to the candidate key value.

[0107] Specifically, the data query device can send a data query request to the data holding device, prompting the data holding device to send encrypted data to the data query device. The data holding device can obtain candidate key values ​​and their corresponding data items. After concatenating the second holder key data corresponding to the candidate key value (obtained through privacy intersection calculation with the data query device beforehand) and the corresponding data item to obtain the plaintext data, it uses the first holder key data (obtained through privacy intersection calculation with the data query device beforehand) to encrypt the plaintext data, obtaining the ciphertext data.

[0108] S320: Obtain key reference data from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holding device.

[0109] The key reference data is related to the first holder key data or the second holder key data in the data holding device, but the data holding device does not directly send the first holder key data or the second holder key data to the query device, and the query device does not directly obtain the first holder key data or the second holder key data in the data holding device.

[0110] Specifically, in one embodiment, the step of obtaining key reference data from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holding device includes: constructing a second random vector; initiating an unintentional transmission to the data holding device through the second random vector, and obtaining key reference data based on the first holder key data and the second holder key data in the holder key data.

[0111] In the scenario where two data holding devices perform privacy data intersection calculations, they jointly agree on a secure length and a common mapping function. For any candidate key value, the data holding device randomly generates a random vector r0 of secure length, consisting of 0s and 1s, as the first holding key data. Based on the held data, the pre-agreed common mapping function, and the random vector r0, it generates a random vector r1 as the second holding key data. The data query device randomly generates a random vector s of secure length, consisting of 0s and 1s (i.e., the second random vector). Based on the random vector s, the data query device initiates an unintentional transmission to the data holding device, obtaining key reference data from the random vectors r0 and r1. Here, unintentional transmission means that the data holding device only provides the data query device with the information it needs, rather than sending all information (such as the first or second holding key data) to the data query device.

[0112] Specifically, the key reference data can be a key reference matrix, which includes n key reference vectors of length λ, consisting of 0s and 1s, where n is the number of candidate key values. The specific value of the k-th column (k∈[1,λ]) in the key reference matrix is ​​determined based on a random vector s. If the value of the k-th column in the random vector s is 0, then the value of the k-th column in the key reference matrix is ​​the value of the k-th column of the first holder key matrix (i.e., the first holder key data) corresponding to all candidate key values. If the value of the k-th column in the random vector s is 1, then the value of the k-th column in the key reference matrix is ​​the value of the k-th column of the second holder key matrix (i.e., the second holder key data) corresponding to all candidate key values. It can be understood that the key reference vectors in the key reference matrix correspond to each candidate key value.

[0113] S330, based on the key reference data and the query key value, obtain the first query party key data and the second query party key data corresponding to the query key value; wherein, if the query key value is equal to the candidate key value, the first query party key data is equal to the first holder key data corresponding to the candidate key value, and the second query party key data is equal to the second holder key data corresponding to the candidate key value.

[0114] Among them, the query key value is the key value held by the data querying party, which is the key value of the data item to be queried.

[0115] After obtaining the key reference data, the data query device can perform logical operations based on the key reference data and the query key value to obtain the first query key data. Then, based on the first query key data, the query key value, and the common mapping function agreed upon with the data query device, it can calculate the second query key data.

[0116] Specifically, in one embodiment, the step of obtaining query key data based on key reference data and query key value includes: performing an XOR operation on a second random vector and query key value to obtain a first operation result; obtaining a common mapping function agreed upon with the data query device, and mapping the first operation result to second mapping data through the common mapping function; performing an XOR operation on the key reference data and second mapping data to obtain first query key data corresponding to the query key value; mapping the query key value to third mapping data through the common mapping function, and performing an XOR operation on the third mapping data and the first query key data corresponding to the query key value to obtain second query key data corresponding to the query key value.

[0117] As mentioned above, the key reference data can be a key reference matrix; after obtaining the second mapping data, the step of performing an XOR operation on the key reference data and the second mapping data to obtain the query key data can be as follows: for any key reference vector in the key reference matrix, perform an XOR operation on the key reference vector and the second mapping data to obtain the first query key data. Specifically, the first query key data can be calculated using the following formula (4):

[0118]

[0119] in, This represents the first query key data corresponding to the j-th query key value, calculated based on the key reference vector in the i-th row of the key reference matrix. It should be noted that this is related to x... j There are n corresponding first query key data, where n is the number of candidate key values; Q i It refers to the i-th key reference vector in the key reference matrix; x j Let be the j-th query key value, and s be the second random vector.

[0120] Similarly, after obtaining the first query key data corresponding to the query key value... Then, the query key value x can be mapped using a common mapping function. j After mapping to third-level mapping data, the third-level mapping data is matched with the query key value to the corresponding first query party key data. Perform an XOR operation to obtain the second query key data corresponding to the query key value. Specifically, the second query key data can be calculated using the following formula (5):

[0121]

[0122] in, This represents the result calculated based on the key reference vector in the i-th row of the key reference matrix, and x. j The corresponding i-th second query key data.

[0123] For a given query key, the first query key data corresponding to each key reference vector can be obtained. and the second query key data If the query key value is the same as the i-th candidate key value, then the first query party's key data... The second query key data is identical to the first holder key data corresponding to the candidate key value. The second holder key data corresponding to the candidate key value is the same, that is Then, the plaintext data corresponding to the candidate key value can be decrypted based on the first query key data; if the query key value is different from the i-th candidate key value, then the first query key data is different from the first holder key data corresponding to the candidate key value, and the second query key data is also different from the second holder key data corresponding to the candidate key value. Therefore, the first query key data can be considered... and the second query key data The data is garbled, based on the first query party's key data. Unable to decrypt the data item corresponding to the candidate key value.

[0124] S340, use the first query key data to decrypt the ciphertext data of the candidate key value to obtain the decrypted data.

[0125] Specifically, the data query device uses the first query key data to decrypt the encrypted data corresponding to each candidate key value, obtaining the decrypted data corresponding to each candidate key value. It can be understood that when the query key value is the same as a candidate key value (i.e., the target candidate key value), decrypting the encrypted data corresponding to the target candidate key value using the first query key data yields a correct decryption result. However, decrypting the encrypted data corresponding to other candidate key values ​​(excluding the target candidate key value) yields an invalid decryption result. That is, decrypting the encrypted data corresponding to the candidate key value matching the query key value using the first query key data results in the plaintext data corresponding to that candidate key value, while decrypting the encrypted data corresponding to other candidate key values ​​results in garbled data. Therefore, the data queryer can only obtain the plaintext data of the candidate key values ​​matching the query key value, and cannot obtain the plaintext data corresponding to other candidate key values. Similarly, the data holder cannot know which candidate key value the data queryer obtained the plaintext data corresponding to, thus achieving privacy information retrieval.

[0126] S350, determine the data item to be queried from the decrypted data based on the second query key data.

[0127] In this process, the data query device uses the first query key data to decrypt the encrypted data of candidate key values. If the encrypted data is correctly decrypted, the corresponding decrypted data is the plaintext data corresponding to the candidate key value that matches the query key value, which is a concatenation of the second query key data and the data item. If the encrypted data is invalidally decrypted, the corresponding decrypted data is garbled data. However, after obtaining the decrypted data, the data query device does not know which decrypted data is the correctly decrypted plaintext data and which is the invalid decrypted garbled data. Therefore, the data query device filters the correctly decrypted data (i.e., the plaintext data corresponding to the candidate key value that matches the query key value) from all the decrypted data based on the second query key data, and obtains the data item to be queried from the correctly decrypted data.

[0128] Specifically, the plaintext data corresponding to the candidate key value is formed by concatenating the second holder key data corresponding to the candidate key value with its corresponding data item. Therefore, if the decrypted data includes the second query key data, the decrypted data is the correctly decrypted data, which is the data matched by the query key value. The data other than the second query key data is the data item corresponding to the query key value (i.e., the data item to be queried). In one embodiment, the step of determining the data item to be queried from the decrypted data based on the second query key data includes: obtaining a first data sequence of the target position in the decrypted data; if the first data sequence matches the second query key data, determining the second data sequence in the decrypted data as the data item to be queried.

[0129] The target position refers to the location where the second-holder's key data is placed when concatenating the second-holder's key data with the data item. For example, if the length of the second-holder's key data is a secure length λ, and the data holder places the second-holder's key data first and the data item last during concatenation, then the target position refers to the first λ bits of the decrypted data. The first data sequence refers to the data sequence at the target position in the decrypted data, and the second data sequence refers to the data sequence outside the target position in the decrypted data.

[0130] Specifically, the data query device acquires the first data sequence of the target location and compares it with a public random number. If the first data sequence is the same as the public random number, the second query key data in the decrypted data is determined as the data item to be queried. Continuing with the example where the length of the public random number is the secure length λ and the data holder places the second holder key data first and the data item last, if the first λ bits of the decrypted data are equal to the second query key data, then the data after the λth bit in the decrypted data is the data item to be queried.

[0131] In the aforementioned data query method, the data holder concatenates the data item corresponding to the candidate key value with the second holder's key data obtained after privacy intersection calculation with the data queryer. Then, it encrypts the concatenated plaintext data using the first holder's key data obtained after privacy intersection calculation with the data queryer, and sends the encrypted data to the data queryer. The data queryer calculates the first and second queryer's key data using the key reference data obtained after privacy intersection calculation with the data queryer and the query key value. It then decrypts the encrypted data using the first queryer's key data and determines the data item to be queried from the decrypted data using the second queryer's key data. The data transmitted between the data holder and the data queryer only contains encrypted data and does not involve the actual plaintext data, thus protecting the data security of both parties. Furthermore, during data transmission... During the process, the key for encrypting and decrypting plaintext data (i.e., the first holder's key data) between the data holding device and the data querying device is transmitted through privacy intersection calculation. The first querying key data calculated by the data querying party based on the key reference data and the query key value can only correctly decrypt the encrypted data corresponding to the candidate key value that matches the query key value, while invalidally decrypting the encrypted data corresponding to other candidate key values. Therefore, decrypting the encrypted data corresponding to the candidate key value that matches the query key value based on the querying key data yields valid plaintext data, while decrypting the encrypted data corresponding to other candidate key values ​​yields garbled data. Thus, the data querying party can only obtain the data item corresponding to the query key value and cannot obtain other data items, while the data holding party cannot know the data items obtained by the data querying party, ensuring the privacy information retrieval of both parties.

[0132] See Figure 4 This application provides a data query method, applicable to, for example... Figure 1 The data query system shown includes a data holding device and a data query device connected by communication. The method includes:

[0133] S410, the data holding device and the data querying device perform privacy intersection calculation. Through the privacy intersection calculation, the data holding device obtains the holder key data, and the data querying device obtains key reference data from the first holder key data and the second holder key data in the holder key data.

[0134] S420, the data holding device acquires the candidate key value and the data item corresponding to the candidate key value;

[0135] S430, the data holding device concatenates the second holder key data and data item corresponding to the candidate key value to obtain the plaintext data corresponding to the candidate key value;

[0136] S440, the data holding device uses the first holder key data corresponding to the candidate key value to encrypt the plaintext data to obtain the ciphertext data corresponding to the candidate key value;

[0137] S450, the data holding device sends the ciphertext data corresponding to the candidate key value as encrypted data to the data query device;

[0138] S460, the data query device receives encrypted data sent by the data holding device; the encrypted data includes ciphertext data corresponding to each candidate key value;

[0139] S470, the data query device obtains the first query party key data and the second query party key data corresponding to the query key value based on the key reference data and the query key value; if the query key value is equal to the candidate key value, the first query party key data is equal to the first holder key data corresponding to the candidate key value, and the second query party key data is equal to the second holder key data corresponding to the candidate key value.

[0140] S480, the data query device uses the first query party key data to decrypt the ciphertext data of the candidate key value to obtain the decrypted data;

[0141] S490, the data query device determines the data item to be queried from the decrypted data based on the second query key data.

[0142] Specifically, assume that the data holding device holds candidate key-value pairs (y1, v1), (y2, v2), ..., (y n ,v n The data query device holds query key values ​​x1, x2, ..., x mIf x j =y i The data query device will obtain v i However, the data holding device does not know what specific data the data querying device has obtained.

[0143] The data holding device and the data query device pre-agree on a safe length λ and a pseudo-random number generation function. The larger the safe length λ, the higher the algorithm's security and collision avoidance, but correspondingly, the lower the algorithm's efficiency. The pseudo-random number generation function can be expressed as: ,in, The set of all messages is called the message space; it can be understood that for the same k and input, the result will also be consistent, i.e.

[0144] For any candidate key-value pair, the data holding device randomly generates a first random vector of length λ, consisting of 0s and 1s, thus obtaining a {0,1} vector. n×λ Matrix R0 represents the key data of the first holder. It can be understood that the random vector in the i-th row of matrix R0 represents the first key data of the i-th candidate key-value pair, where i ∈ [1, n]. This is represented as the first key data for the i-th candidate key-value pair.

[0145] The data holding device uses a common mapping function to select the candidate key value y from the candidate key-value pairs. i Mapped to the first mapping data f corresponding to the candidate key values. k (y i Then, based on the first mapping data f corresponding to the candidate key value... k (y i ) and the first key data Perform logical operations to obtain the second key data corresponding to the candidate key values. Second key data based on each candidate key value Matrix R1 is obtained, which represents the key data of the second holder. Specifically, matrix R1 can be obtained using the following formula (6):

[0146]

[0147] For candidate key-value pairs (y) in the data holding device i ,v i ), i∈[1,n], the data holding device holds the second key data The data is concatenated with each data item to obtain plaintext data corresponding to each candidate key value, and then the first key data is used. Using the key, a symmetric encryption method (such as AES) is used to encrypt the plaintext data corresponding to the candidate key value, resulting in encrypted data e. i and encrypt the data e i Send to the data query device. Specifically, encrypt the data e. i It can be obtained through the following formula (7):

[0148]

[0149] The data query device randomly generates a second random vector of length λ, consisting of 0s and 1s, where the second random vector can be represented as s∈{0,1}. λ .

[0150] The data query device initiates an unintentional transmission to the data holding device based on the second random vector, constructing key reference data. This key reference data can be represented as a matrix Q consisting of n rows, each with a secure length λ. The value of the k-th column (k∈[1,λ]) of matrix Q is determined as follows: if s k =0, then the k-th column of matrix Q takes the value of the k-th column of the first holder's key data (i.e., matrix R0). If s k =1, and the k-th column of matrix Q takes the value of the k-th column of the second holder's key data (i.e., matrix R1).

[0151] Obviously, That is, the values ​​at each position in the i-th row vector of the key reference matrix Q are determined by the second random vector and the first key data corresponding to the i-th candidate key value. Second key data Decide.

[0152] The data query device uses the key reference data Q and the query key value x. j Calculate the first query key data and the second query key data

[0153] Specifically, the first query party's key data and the second query key data The following formulas (8) and (9) can be used to calculate the results respectively:

[0154]

[0155]

[0156] in, This represents the first query key data corresponding to the j-th query key value, calculated based on the key reference vector of the i-th row. Q represents the second query key data corresponding to the j-th query key value, calculated based on the key reference vector of the i-th row. i This represents the key reference vector of the i-th row of the key reference data Q.

[0157] It is understandable that if x j =y i ,but and They are equal; the specific reasons are shown in equation (10) below:

[0158]

[0159]

[0160] And because Therefore, if x j =y i Then, regardless of the value of s, If x j ≠y i ,but The data is garbled, and the data query device cannot obtain any additional information about the data holder.

[0161] Similarly, if x j =y i ,but and equal,

[0162] The data query device calculates the first query party's key data. Then, using the first query party's key data For encrypted data e i Decryption is performed to obtain decrypted data d. i,j Specifically, the decrypted data is d. i,j The calculation can be performed using the following formula (11):

[0163]

[0164] The data query device is based on the second query key data. From all the decrypted data d i,j The data item to be queried is determined in the middle. Specifically, if the data d is decrypted... i,j The first λ bits are equal to any second query party key data. This means that the corresponding key-value pair was matched, d i,j The data after the λ-bit is the data item v. i .

[0165] Furthermore, the above data query method is illustrated by taking the example of a data holding device holding three candidate key-value pairs (y1, v1), (y2, v2), and (y3, v3), and a data query device holding query key values ​​x1 and x2.

[0166] Specifically, for any candidate key-value pair, the data holding device randomly generates a first random vector of length λ, consisting of 0s and 1s, thus obtaining the first key data corresponding to y1. The first key data corresponding to y2 And the first key data corresponding to y3 At the same time, obtain the second key data corresponding to y1. Second key data corresponding to y2 And the second key data corresponding to y3

[0167] Then, the data holding device uses the first key data. and second key data The candidate key value v1 in the candidate key-value pair is encrypted using a symmetric encryption method (such as AES) to obtain encrypted data e1; the first key data is then used. and second key data The candidate key value v2 in the candidate key-value pair is encrypted using a symmetric encryption method (such as AES) to obtain encrypted data e2; and the first key data is used. and second key data The candidate key value v3 in the candidate key-value pair is encrypted using a symmetric encryption method (such as AES) to obtain encrypted data e3; then the encrypted data e1, e2 and e3 are sent to the data query device. Specifically, the encrypted data e1, e2 and e3 can be obtained through the following formulas (12) to (14):

[0168]

[0169]

[0170]

[0171] The data query device randomly generates a second random vector of length λ, consisting of 0s and 1s, where the second random vector can be represented as s∈{0,1}. λ .

[0172] The data query device initiates an unintentional transmission to the data holding device based on the second random vector to construct key reference data. This key reference data can be a key reference matrix Q; the specific values ​​of the key reference matrix Q can be found above and will not be repeated here.

[0173] For the query key value x1, the data query device can calculate the first query key data and the second query key data corresponding to different candidate key values ​​y using the following formulas (15) to (17):

[0174]

[0175]

[0176]

[0177] Among them, Q 1 This represents the key reference vector in the first row of the key reference matrix, which consists of the first key data of candidate key value y1. Second key data Decision; similarly, Q 2 Q 3 These represent the key reference vectors in the second and third rows of the key reference matrix, respectively, which are determined by the first key data and the second key data of the corresponding candidate key values; This represents the first query key data corresponding to the query key value x1, calculated based on the key reference vector in the first row. Indicates and The corresponding second query key data; similarly, This represents the first query key data corresponding to the query key value x1, calculated based on the key reference vector in row 2. Indicates and The corresponding second query key data, This represents the first query key data corresponding to the query key value x1, calculated based on the key reference vector in row 3. Indicates and The corresponding second query key data.

[0178] Then, the data query device uses the first query party's key data. Decrypting the encrypted data e1 yields the decrypted data d. 1,1 Using the first query party's key data Decrypting the encrypted data e2 yields the decrypted data d. 2,1 Using the first query party's key data Decrypting the encrypted data e3 yields the decrypted data d. 3,1 .

[0179] Suppose x1 = y1, then, Using the first query party's key data Decrypting the encrypted data e1 yields the correct decryption result, which is: And x1≠y2, that is Using query key data Decrypting the encrypted data e2 yields garbled data, i.e. And x1≠y3, that is Using query key data Decrypting the encrypted data e3 yields garbled data, i.e.

[0180] Finally, the data query device can use the second query key data. as well as From decrypted data d 1,1 d 2,1 and d 3,1 The data item to be queried is determined in the middle.

[0181] Specifically, since x1 = 1 and but ;

[0182] Furthermore, in decrypting data d 1,1 d 2,1 and d 3,1 Among them, only That is, d 1,1 The first λ position in the middle is equal to Therefore, the data query device can be based on the second query key data. Hit decrypted data d 1,1 The first λ bits, and the second query key data as well as No decrypted data could be matched; therefore, the data query device could obtain the decrypted data d. 1,1 The data excluding the first λ bits (i.e., v1) is the data item v1 corresponding to the query key value x1.

[0183] Similarly, for the query key value x2, the data query device can calculate the first query key data and the second query key data corresponding to different candidate key values ​​y using the following formulas (18) to (20):

[0184]

[0185]

[0186]

[0187] Among them, Q 1 This represents the key reference vector in the first row of the key reference matrix, which consists of the first holder's key data for candidate key value y1. Second holder key data Decision; similarly, Q 2 Q 3 These represent the key reference vectors in the second and third rows of the key reference matrix, respectively, which are determined by the first and second holder key data of the corresponding candidate key values. This represents the first query key data corresponding to the query key value x2, calculated based on the key reference vector in the first row. Indicates and The corresponding second query key data; similarly, This represents the first query key data corresponding to the query key value x2, calculated based on the key reference vector in row 2. Indicates and The corresponding second query key data, This represents the first query key data corresponding to the query key value x2, calculated based on the key reference vector in row 3. Indicates and The corresponding second query key data.

[0188] Then, the data query device uses the first query party's key data. Decrypting the encrypted data e1 yields the decrypted data d. 1,2 Using the first query party's key data Decrypting the encrypted data e2 yields the decrypted data d. 2,2 Using the first query party's key data Decrypting the encrypted data e3 yields the decrypted data d. 3,2 .

[0189] Suppose x2 = y3, then, Using the first query party's key data Decrypting the encrypted data e1 yields garbled data, but obtaining the correct decryption result will give you the correct answer. And x2≠y2, that is Using query key data Decrypting the encrypted data e2 yields garbled data, i.e. And x2 = y3, that is Using query key data Decrypting the encrypted data e3 yields the correct decryption result, i.e.

[0190] Finally, the data query device can use the second query key data. as well as From decrypted data d 1,2 d 2,2 and d3,2 The data item to be queried is determined in the middle.

[0191] Specifically, since x2 = 3 and but ;

[0192] Furthermore, in decrypting data d 1,2 d 2,2 and d 3,2 Among them, only That is, d 3,2 The first λ position in the middle is equal to Therefore, the data query device can be based on the second query key data. Hit decrypted data d 3,2 The first λ bits, and the second query key data as well as No decrypted data could be matched; therefore, the data query device could obtain the decrypted data d. 3,2 The data excluding the first λ bits (i.e., v3) is the data item v3 corresponding to the query key value x3.

[0193] The data query device can ultimately be obtained from d 1,1 Get v1 from d 3,2 The data query device obtains v3, while the data holding device cannot obtain v2. At the same time, the data holding device cannot know whether the data query device ultimately obtains v1, v2, or v3. The data query device and the data holding device realize privacy information retrieval.

[0194] To better implement the data query method provided in the embodiments of this application, based on the data query method proposed in the embodiments of this application, this application also provides a data query device, applied to a data holding device, such as... Figure 5 As shown, the data query device 500 includes:

[0195] The data item acquisition module 510 is used to acquire candidate key values ​​and the data items corresponding to the candidate key values;

[0196] The first privacy intersection calculation module 520 is used to obtain the holder key data by performing privacy intersection calculation with the data query device. The holder key data includes the first holder key data and the second holder key data corresponding to the candidate key values.

[0197] The plaintext data acquisition module 530 is used to concatenate the second holder key data and data item corresponding to the candidate key value to obtain the plaintext data corresponding to the candidate key value;

[0198] The data encryption module 540 is used to encrypt plaintext data using the first holder key data corresponding to the candidate key value to obtain ciphertext data corresponding to the candidate key value;

[0199] The data sending module 550 is used to send the ciphertext data corresponding to the candidate key value as encrypted data to the data query device. The encrypted data is used to instruct the data query device to decrypt the ciphertext data of the candidate key value using the first query key data to obtain decrypted data, and to determine the data item to be queried from the decrypted data based on the second query key data. The first query key data and the second query key data are obtained based on the key reference data and the query key value. The key reference data is obtained by the data query device from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holder device. If the query key value is equal to the candidate key value, the first query key data is equal to the first holder key data corresponding to the candidate key value, and the second query key data is equal to the second holder key data corresponding to the candidate key value.

[0200] In some embodiments of this application, the first privacy intersection calculation module 520 is used to obtain a public mapping function agreed upon with the data query device; map candidate key values ​​to first mapping data corresponding to the candidate key values ​​through the public mapping function; construct a first random vector corresponding to the candidate key values, and determine the first random vector as the first holder key data corresponding to the candidate key values; perform an XOR operation on the first mapping data corresponding to the candidate key values ​​and the first holder key data to obtain the second holder key data corresponding to the candidate key values.

[0201] Based on the data query method proposed in the embodiments of this application, the embodiments of this application also provide a data query device, such as... Figure 6 As shown, the data query device 600 includes:

[0202] The data receiving module 610 is used to receive encrypted data sent by the data holding device; the encrypted data includes ciphertext data corresponding to each candidate key value; wherein, the ciphertext data corresponding to the candidate key value is obtained by encrypting the plaintext data corresponding to the candidate key value using the first holder key data corresponding to the candidate key value in the holder key data, and the plaintext data corresponding to the candidate key value is obtained by concatenating the second holder key data corresponding to the candidate key value in the holder key data and the data item corresponding to the candidate key value;

[0203] The second privacy intersection calculation module 620 is used to obtain key reference data from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holding device;

[0204] The key acquisition module 630 is used to acquire first query key data and second query key data corresponding to the query key value based on key reference data and query key value; if the query key value is equal to the candidate key value, the first query key data is equal to the first holder key data corresponding to the candidate key value, and the second query key data is equal to the second holder key data corresponding to the candidate key value.

[0205] Data decryption module 640 is used to decrypt the ciphertext data of candidate key values ​​using the first query key data to obtain decrypted data;

[0206] The data determination module 650 is used to determine the data item to be queried from the decrypted data based on the second query key data.

[0207] In some embodiments of this application, the data determination module 650 is used to obtain a first data sequence of the target location in the decrypted data; if the first data sequence matches the second query key data, the second data sequence in the decrypted data is determined as the data item to be queried.

[0208] In some embodiments of this application, the second privacy intersection calculation module 620 is used to construct a second random vector; initiate an unintentional transmission to the data holding device through the second random vector, and obtain key reference data based on the first holder key data and the second holder key data in the holder key data.

[0209] In some embodiments of this application, the key acquisition module 630 is used to perform an XOR operation on the second random vector and the query key value to obtain a first operation result; acquire a common mapping function agreed upon with the data query device, and map the first operation result to second mapping data through the common mapping function; perform an XOR operation on the key reference data and the second mapping data to obtain the first query key data corresponding to the query key value; map the query key value to third mapping data through the common mapping function, and perform an XOR operation on the third mapping data and the first query key data corresponding to the query key value to obtain the second query key data corresponding to the query key value.

[0210] For specific limitations regarding the data query device, please refer to the limitations on the data query method above, which will not be repeated here. Each module in the aforementioned data query device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0211] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores candidate key-value pairs and other data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a data query method.

[0212] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0213] In some embodiments of this application, a computer device is provided, including one or more processors; a memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processors using the steps of the data query method described above. The steps of the data query method here may be steps from the data query methods of the various embodiments described above.

[0214] In some embodiments of this application, a computer-readable storage medium is provided, storing a computer program that is loaded by a processor, causing the processor to execute the steps of the data query method described above. The steps of the data query method here can be the steps in the data query methods of the various embodiments described above.

[0215] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0216] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0217] The data query method, apparatus, computer device, and storage medium provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A data query method, characterized in that, Applied to a data holding device, the method includes: Retrieve candidate key values ​​and the corresponding data items; The holder key data is obtained by performing privacy intersection calculation with the data query device, wherein the holder key data includes first holder key data and second holder key data corresponding to the candidate key value; The second holder key data and data item corresponding to the candidate key value are concatenated to obtain the plaintext data corresponding to the candidate key value; The plaintext data is encrypted using the first holder key data corresponding to the candidate key value to obtain the ciphertext data corresponding to the candidate key value; The encrypted data corresponding to the candidate key value is sent to the data query device as encrypted data. The encrypted data is used to instruct the data query device to decrypt the encrypted data of the candidate key value using the first query key data to obtain decrypted data, and to determine the data item to be queried from the decrypted data based on the second query key data. The first query key data and the second query key data are obtained based on key reference data and query key value. The key reference data is obtained by the data query device from the first holder key data and the second holder key data in the holder key data through privacy intersection calculation with the data holder device. If the query key value is equal to the candidate key value, the first query key data is equal to the first holder key data corresponding to the candidate key value, and the second query key data is equal to the second holder key data corresponding to the candidate key value.

2. The method according to claim 1, characterized in that, The step of obtaining the holder's key data by performing privacy intersection calculation with the data query device includes: Obtain the common mapping function agreed upon with the data query device; The candidate key value is mapped to the first mapping data corresponding to the candidate key value through the public mapping function; Construct a first random vector corresponding to the candidate key value, and determine the first random vector as the first holder key data corresponding to the candidate key value; Perform an XOR operation on the first mapping data corresponding to the candidate key value and the first holder key data to obtain the second holder key data corresponding to the candidate key value.

3. A data query method, characterized in that, Applied to data query devices, the method includes: The system receives encrypted data sent by a data holding device; the encrypted data includes ciphertext data corresponding to each candidate key value; wherein, the ciphertext data corresponding to each candidate key value is obtained by encrypting the plaintext data corresponding to the candidate key value using the first holder key data corresponding to the candidate key value in the holder key data, and the plaintext data corresponding to each candidate key value is obtained by concatenating the second holder key data corresponding to the candidate key value in the holder key data and the data item corresponding to the candidate key value; Key reference data is obtained from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holding device; Based on the key reference data and the query key value, obtain the first query party key data and the second query party key data corresponding to the query key value; wherein, if the query key value is equal to the candidate key value, the first query party key data is equal to the first holder key data corresponding to the candidate key value, and the second query party key data is equal to the second holder key data corresponding to the candidate key value; The encrypted data of the candidate key value is decrypted using the first query key data to obtain the decrypted data; The data item to be queried is determined from the decrypted data based on the second query key data.

4. The method according to claim 3, characterized in that, The step of determining the data item to be queried from the decrypted data based on the second query key data includes: Obtain the first data sequence of the target location in the decrypted data; If the first data sequence matches the second query key data, the second data sequence in the decrypted data is determined as the data item to be queried.

5. The method according to claim 3, characterized in that, The step of obtaining key reference data from the first and second holder key data in the holder key data by performing privacy intersection calculation with the data holding device includes: Construct a second random vector; An unintentional transmission is initiated to the data holding device through the second random vector, and key reference data is obtained based on the first and second holder key data in the holder key data.

6. The method according to claim 5, characterized in that, The step of obtaining the first query key data and the second query key data corresponding to the query key value based on the key reference data and the query key value includes: Perform an XOR operation on the second random vector and the query key value to obtain the first operation result; Obtain a common mapping function agreed upon with the data query device, and map the first calculation result into second mapped data through the common mapping function; Perform an XOR operation on the key reference data and the second mapping data to obtain the first query key data corresponding to the query key value; The query key value is mapped to third mapping data using the public mapping function. The third mapping data is then XORed with the first query key data corresponding to the query key value to obtain the second query key data corresponding to the query key value.

7. A data query method, characterized in that, Applied to a data query system, the data query system including a data holding device and a data query device connected by communication, the method includes: The data holding device and the data query device perform privacy intersection calculation. Through the privacy intersection calculation, the data holding device obtains the holder key data, and the data query device obtains key reference data from the first holder key data and the second holder key data in the holder key data. The data holding device acquires candidate key values ​​and the data items corresponding to the candidate key values; The data holding device concatenates the second holder key data and data item corresponding to the candidate key value to obtain the plaintext data corresponding to the candidate key value; The data holding device uses the first holder key data corresponding to the candidate key value to encrypt the plaintext data to obtain the ciphertext data corresponding to the candidate key value; The data holding device sends the ciphertext data corresponding to the candidate key value as encrypted data to the data query device; The data query device receives encrypted data sent by the data holding device; the encrypted data includes ciphertext data corresponding to each candidate key value; The data query device obtains first query party key data and second query party key data corresponding to the query key value based on the key reference data and the query key value; wherein, if the query key value is equal to the candidate key value, the first query party key data is equal to the first holder key data corresponding to the candidate key value, and the second query party key data is equal to the second holder key data corresponding to the candidate key value. The data query device uses the first query key data to decrypt the ciphertext data of the candidate key value to obtain decrypted data; The data query device determines the data item to be queried from the decrypted data based on the second query key data.

8. A data query device, characterized in that, Applied to a data holding device, the device includes: The data item acquisition module is used to acquire candidate key values ​​and the data items corresponding to the candidate key values; The first privacy intersection calculation module is used to obtain the holder key data by performing privacy intersection calculation with the data query device, wherein the holder key data includes the first holder key data and the second holder key data corresponding to the candidate key value; The plaintext data acquisition module is used to concatenate the second holder key data and data item corresponding to the candidate key value to obtain the plaintext data corresponding to the candidate key value; The data encryption module is used to encrypt the plaintext data using the first holder key data corresponding to the candidate key value to obtain the ciphertext data corresponding to the candidate key value; A data sending module is used to send the ciphertext data corresponding to the candidate key value as encrypted data to a data query device. The encrypted data is used to instruct the data query device to decrypt the ciphertext data of the candidate key value using first query key data to obtain decrypted data, and to determine the data item to be queried from the decrypted data based on second query key data. The first and second query key data are obtained based on key reference data and the query key value. The key reference data is obtained by the data query device from the first and second holder key data in the holder key data through privacy intersection calculation with the data holder device. If the query key value is equal to the candidate key value, the first query key data is equal to the first holder key data corresponding to the candidate key value, and the second query key data is equal to the second holder key data corresponding to the candidate key value.

9. A data query device, characterized in that, Applied to a data query device, the device includes: A data receiving module is used to receive encrypted data sent by a data holding device; the encrypted data includes ciphertext data corresponding to each candidate key value; wherein, the ciphertext data corresponding to the candidate key value is obtained by encrypting the plaintext data corresponding to the candidate key value using the first holder key data corresponding to the candidate key value in the holder key data, and the plaintext data corresponding to the candidate key value is obtained by concatenating the second holder key data corresponding to the candidate key value in the holder key data and the data item corresponding to the candidate key value; The second privacy intersection calculation module is used to obtain key reference data from the first holder key data and the second holder key data in the holder key data by performing privacy intersection calculation with the data holding device; The key acquisition module is used to acquire first query party key data and second query party key data corresponding to the query key value based on the key reference data and the query key value; wherein, if the query key value is equal to the candidate key value, the first query party key data is equal to the first holder key data, and the second query party key data is equal to the second holder key data. The data decryption module is used to decrypt the ciphertext data of the candidate key value using the first query key data to obtain decrypted data; The data determination module is used to determine the data item to be queried from the decrypted data based on the second query key data.

10. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the data query method of any one of claims 1 to 7.

11. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to execute the steps of the data query method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data query method, device, system and data set processing method

    CN112328639A

  • Data query method and system and readable storage medium

    CN113434890A