Data query method and device, electronic equipment and storage medium
By using multiple public keys and random numbers for encryption and decryption in data query scenarios, the problem of inability to effectively protect the data privacy of the query party in the prior art is solved, and an efficient and secure data query process is achieved.
Patent Information
- Application Number
- CN202411997036.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-02
AI Technical Summary
The prior art cannot effectively protect the data privacy of the query party in data query scenarios. The query party is informed of the query content by saving the correspondence between the original index and the encrypted index.
The query party receives multiple public keys sent by the query party, uses these public keys to encrypt the second random number, generates a random number ciphertext, and sends the ciphertext and associated query conditions to the query party. The query party decrypts the random numbers based on these public keys, conducts queries, and returns the encrypted query result set to the query party. The queryer uses the second random number corresponding to the target query condition to decrypt the target encryption result set to obtain the actual query result set.
By using multiple public keys and random numbers, the security of data queries is improved, the data privacy of the query party is protected, and the computing efficiency is improved, reducing the computational amount of the decryption process.
Smart Images

Figure CN119918087A_ABST
Abstract
Description
Background Art
[0002] In a data query scenario, the querying party may need to obtain query information but may not want the queried party to know the content of its query.
[0003] In related technologies, in order to protect the data privacy of the querying party, the querying party generates a set of asymmetric encrypted public keys and passes the public keys to the queried party. The queried party uses the public keys to encrypt each piece of data in the database and the corresponding original index to obtain the encrypted index and ciphertext data. When the querying party needs to query data, the public key is used to encrypt the original index of the data to be queried, and the encrypted index is sent to the queried party. The queried party returns the ciphertext data corresponding to the encrypted index to the querying party, and the querying party then uses the private key to decrypt the ciphertext data to obtain the data to be queried.
[0004] However, if the queried party saves the correspondence between the original index and the encrypted index after obtaining the encrypted index and ciphertext data, the corresponding original index can be found through the encrypted index sent by the querying party, and then the query content of the querying party can be known. Therefore, based on the above method, the data privacy of the querying party cannot be effectively protected. Summary of the invention
[0005] Embodiments of the present application provide a data query method, device, electronic device, and storage medium to ensure the data privacy of the querying party.
[0006] The first data query method provided in the embodiment of the present application is applied to the querying party, including:
[0007] Receive N public keys sent by the queried party, each public key is constructed by the queried party based on the task identifier of the target query task and a first random number generated, and N is a positive integer;
[0008] Encrypting N second random numbers generated based on the N public keys respectively to obtain N random number ciphertexts, and sending the N random number ciphertexts and query conditions associated with the N random number ciphertexts to the queried party;
[0009] Receive N encrypted result sets returned by the queried party, each encrypted result set is obtained by the queried party encrypting a query result set based on an obtained second random number, the query result set is obtained by querying a target data set using a query condition, and the obtained second random number is obtained by decrypting a random number ciphertext associated with the query condition;
[0010] Based on the second random number corresponding to the target query condition in each query condition, the target encrypted result set among the N encrypted result sets is decrypted to obtain a query result set corresponding to the target encrypted result set, wherein the target encrypted result set is obtained based on the target query condition.
[0011] Optionally, the target query condition includes query fields and field range information, and each query condition also includes each mask query condition;
[0012] Get each mask query condition as follows:
[0013] Modify the field range information to obtain modified field range information;
[0014] The mask query condition is obtained based on the query field and the modified field range information.
[0015] Optionally, before receiving the N public keys sent by the queried party, the method further includes:
[0016] Sending task information of the target query task to the queried party, the task information including the identity of the querying party and the data set identifier of the target data set, the identity and the data set identifier being used by the queried party to determine whether to allow the querying party to query the target data set.
[0017] The second data query method provided in the embodiment of the present application is applied to the queried party, including:
[0018] Based on the task identifier of the target query task and the N first random numbers generated, construct N public keys and a private key corresponding to each public key, and send the N public keys to the querying party, where N is a positive integer;
[0019] Receiving N random number ciphertexts returned by the querying party, and query conditions associated with each of the N random number ciphertexts, wherein each random number ciphertext is obtained by encrypting a second random number generated by the querying party based on a received public key;
[0020] Decrypting the N random number ciphertexts based on the private keys corresponding to the N public keys respectively to obtain N second random numbers, and querying the target data set based on the query conditions respectively to obtain query result sets;
[0021] Based on the N second random numbers, the corresponding query result sets are encrypted respectively to obtain N encrypted result sets, and the N encrypted result sets are returned to the querying party, so that the querying party decrypts the target encrypted result set among the N encrypted result sets based on the second random number corresponding to the target query condition in each query condition to obtain a query result set corresponding to the target encrypted result set, and the target encrypted result set is obtained based on the target query condition.
[0022] Optionally, before constructing N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the generated N first random numbers, the method further includes:
[0023] Receiving task information of the target query task sent by the query party, the task information including the identity of the query party and the data set identifier of the target data set;
[0024] Based on the identity identifier and the data set identifier, it is determined that the querying party is allowed to query the target data set.
[0025] Optionally, the step of constructing N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the N first random numbers generated includes:
[0026] For the N first random numbers, perform the following operations respectively:
[0027] Based on a first random number and the task identifier, and a pre-generated third random number, a public key and a private key corresponding to the public key are constructed.
[0028] The first data query device provided in the embodiment of the present application is applied to a querying party, including:
[0029] A first receiving unit, configured to receive N public keys sent by a queried party, each public key being constructed by the queried party based on a task identifier of a target query task and a first random number generated, and N being a positive integer;
[0030] an encryption unit, configured to encrypt N second random numbers generated based on the N public key pairs respectively to obtain N random number ciphertexts, and send the N random number ciphertexts and query conditions associated with the N random number ciphertexts to the queried party;
[0031] A second receiving unit is used to receive N encrypted result sets returned by the queried party, each encrypted result set is obtained by the queried party encrypting a query result set based on an obtained second random number, the query result set is obtained by querying a target data set using a query condition, and the obtained second random number is obtained by decrypting a random number ciphertext associated with the query condition;
[0032] A decryption unit is used to decrypt a target encrypted result set among the N encrypted result sets based on a second random number corresponding to a target query condition in each query condition, and obtain a query result set corresponding to the target encrypted result set, wherein the target encrypted result set is obtained based on the target query condition.
[0033] Optionally, the target query condition includes query fields and field range information, and each query condition also includes each mask query condition;
[0034] The encryption unit is also used to obtain each mask query condition in the following manner:
[0035] Modify the field range information to obtain modified field range information;
[0036] The mask query condition is obtained based on the query field and the modified field range information.
[0037] Optionally, before receiving the N public keys sent by the queried party, the apparatus further includes a sending unit, configured to:
[0038] Sending task information of the target query task to the queried party, the task information including the identity of the querying party and the data set identifier of the target data set, the identity and the data set identifier being used by the queried party to determine whether to allow the querying party to query the target data set.
[0039] The second data query device provided in the embodiment of the present application is applied to the queried party, including:
[0040] A construction unit, configured to construct N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the generated N first random numbers, and send the N public keys to the querying party, where N is a positive integer;
[0041] A receiving unit, configured to receive N random number ciphertexts returned by the querying party and query conditions associated with the N random number ciphertexts, each of which is obtained by encrypting a second random number generated by the querying party based on a received public key;
[0042] a decryption unit, configured to decrypt the N random number ciphertexts based on the private keys corresponding to the N public keys to obtain N second random numbers, and to query the target data set based on the query conditions to obtain query result sets;
[0043] A sending unit is used to encrypt the corresponding query result sets based on the N second random numbers respectively to obtain N encrypted result sets, and return the N encrypted result sets to the query party, so that the query party can decrypt the target encrypted result set among the N encrypted result sets based on the second random number corresponding to the target query condition in each query condition to obtain the query result set corresponding to the target encrypted result set, and the target encrypted result set is obtained based on the target query condition.
[0044] Optionally, before constructing N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the N first random numbers generated, the device further includes a determination unit for
[0045] Receiving task information of the target query task sent by the query party, the task information including the identity of the query party and the data set identifier of the target data set;
[0046] Based on the identity identifier and the data set identifier, it is determined that the querying party is allowed to query the target data set.
[0047] Optionally, the construction unit is specifically used for:
[0048] For the N first random numbers, perform the following operations respectively:
[0049] Based on a first random number and the task identifier, and a pre-generated third random number, a public key and a private key corresponding to the public key are constructed.
[0050] An electronic device provided by an embodiment of the present application includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the above-mentioned data query methods.
[0051] An embodiment of the present application provides a computer-readable storage medium, which includes a computer program. When the computer program is executed on an electronic device, the computer program is used to enable the electronic device to execute the steps of any one of the above-mentioned data query methods.
[0052] An embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of any one of the above-mentioned data query methods.
[0053] The beneficial effects of this application are as follows:
[0054] The embodiment of the present application provides a data query method, device, electronic device and storage medium. The querying party receives N public keys sent by the queried party, encrypts the second random number with the public key, and then sends the N random number ciphertexts and the associated query conditions to the queried party. After the queried party queries and encrypts the query result set according to each query condition, the N encrypted result sets are returned to the querying party. The querying party decrypts the target encrypted result set based on the second random number corresponding to the target query condition, and the query result set to be queried can be obtained. Based on the above method, data query is performed. On the one hand, the queried party uses the task identifier of the query task and the first random number to construct a public key, which can improve the security of data query and improve the computing efficiency. On the other hand, the querying party sends multiple query conditions to the queried party to prevent the queried party from knowing the specific query content of the querying party, and protects the data privacy of the querying party. The querying party knows the content it wants to query, and only needs to use the second random number corresponding to the target query condition to decrypt the target encrypted result set, which can reduce the computational amount of the decryption process and improve data query efficiency.
[0055] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0057] Figure 1 An optional schematic diagram of an application scenario in an embodiment of the present application;
[0058] Figure 2 This is a flowchart of the implementation of the first data query method in the embodiment of the present application;
[0059] Figure 3 This is a flowchart of the implementation of the second data query method in the embodiment of the present application;
[0060] Figure 4 Schematic diagram of the interactive process of the data query method in the embodiment of the present application;
[0061] Figure 5 This is a schematic diagram of the structure of a data query device in an embodiment of the present application;
[0062] Figure 6 A schematic diagram of the structure of a data query device in an embodiment of the present application;
[0063] Figure 7 A schematic diagram of a hardware structure of an electronic device to which an embodiment of the present application is applied;
[0064] Figure 8 The present invention is a schematic diagram of the hardware structure of another electronic device to which the embodiments of the present application are applied. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.
[0066] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.
[0067] The data query method in the embodiment of the present application can be applied to a data query system, such as Figure 1 As shown, it is a schematic diagram of an application scenario of an embodiment of the present application. The data query system includes a terminal device 110 and a server 120. Figure 1 In the example, the querying party is a terminal device and the queried party is a server.
[0068] In the embodiments of the present application, the terminal device includes but is not limited to mobile phones, tablet computers, laptop computers, desktop computers, e-book readers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals and other devices; a client related to data query can be installed on the terminal device, which can be software (such as a browser, data query software, etc.), or a web page, a small program, etc. The server is a background server corresponding to the software or web page, small program, etc., or a server specifically used for data query, which is not specifically limited in the present application. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0069] It should be noted that the data query method in the embodiment of the present application can be executed by an electronic device, which can be a server or a terminal device, that is, the method can be executed by the server or the terminal device alone, or can be executed by the server and the terminal device together.
[0070] In an optional implementation, the terminal device and the server may communicate via a communication network.
[0071] In an optional implementation, the communication network is a wired network or a wireless network.
[0072] It should be noted that Figure 1 The figure is only an example. In fact, the number of terminal devices and servers is not limited and is not specifically limited in the embodiments of the present application.
[0073] The following describes the data query method provided by the exemplary embodiment of the present application in combination with the application scenarios described above and with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation of the present application is not limited in this regard.
[0074] like Figure 2 As shown, it is an implementation flow chart of the first data query method provided in the embodiment of the present application, which is applied to the querying party. The specific implementation process of the method includes the following steps S21-S24:
[0075] S21: The querying party receives N public keys sent by the queried party;
[0076] Among them, each public key is constructed by the queried party based on the task identifier of the target query task and the first random number generated. Specifically, as the initiator of the target query task, the query party must first generate the task parameters of the target query task, including: task number, timestamp, name of the dataset to be queried (dataset identifier of the target dataset), query field set, query logic, and query strength.
[0077] The query logic is used to limit the specific range in the query field, so it can also be called field range information. For example, if the query field is age, the query logic can be greater than 20 years old, or less than 50 years old. The query strength, that is, N, is a positive integer. The query fields in the query field set can be: taxpayer identification number, taxpayer company name, taxpayer address, tax amount, ID number, age, etc., which are not specifically limited here. The query logic can be: equal to, greater than, less than, greater than or equal to, less than or equal to, etc.
[0078] Optionally, before step S21, the inquirer sends task information of the target query task to the queried party; the queried party receives the task information of the target query task sent by the inquirer, where the task information includes the identity of the inquirer and the dataset identifier of the target dataset; based on the identity and the dataset identifier, the queried party determines that the inquirer is allowed to query the target dataset.
[0079] Specifically, the queried party needs to confirm whether the querying party is allowed to query the data in the target data set. For example, the data set identifier of the target data set is "data set 1", and users with the identity identifier of administrator are allowed to access it. If the queried party receives the task information and the task information includes: ordinary user, data set 1, the identity of the querying party is an ordinary user and is not allowed to access data set 1. The queried party returns a prompt message of denied access to the querying party; if the queried party receives the task information and the task information includes: administrator, data set 1, the identity of the querying party is an administrator and is allowed to access data set 1. The queried party will perform the operation of generating public and private keys.
[0080] Optionally, the queried party generates N public keys and a private key corresponding to each public key through the following steps:
[0081] For the N first random numbers, perform the following operations respectively:
[0082] Based on a first random number and a task identifier, as well as a pre-generated third random number, a public key and a private key corresponding to the public key are constructed.
[0083] For example, the first random number is 5468, the task identifier is 3210, the third random number is 17, the public key is 54683210, and the private key is 5468321017. In the embodiment of the present application, a public-private key pair (also referred to as a user public-private key) can be generated based on the public-key encryption mechanism based on the identifier of the domestic cryptographic algorithm SM9. The queried party first generates a pair of master public-private keys, including the master private key sk (the third random number) and the system public key P public , taking N as 3 as an example, the queried party generates 3 first random numbers, and for each first random number M i , generate the identifier Wi, the encoding format of Wi is:
[0084] Wi=M i @TS.Tid
[0085] Among them, M i is the first random number, TS is the timestamp, Tid is the task number, and the task identifier is composed of the timestamp and task number in the task parameters of the target query task. For example, the timestamp is 20241120, the task number is 008, and the first random number M i is 1100, then W1 is 1100@20241120.008.
[0086] In SM9, "identifier" can be a semantic string, such as ID number, email address, etc. Here, Mi@TS.Tid can be used as the identifier. public The public key is constructed based on the master private key sk and the identifier Wi, and the private key corresponding to the public key is constructed based on the master private key sk and the identifier Wi.
[0087] In the embodiment of the present application, the cross-domain multi-party participation and audit / confirmation mechanism of the anonymous query is combined to complete the pre-calculation process in parallel and optimize the task execution efficiency. The SM9 domestic public key encryption algorithm based on identification is adopted, and the timestamp + task number is used as the public and private identification to optimize the execution efficiency of each anonymous query task and ensure the anti-attack capability of malicious tasks to steal private keys.
[0088] After the queried party generates three public keys, it sends a confirmation message to the querying party. The confirmation message includes the three public keys, for example, W1, W2, and W3 are sent to the querying party.
[0089] S22: The querying party encrypts N second random numbers generated based on the N public keys respectively to obtain N random number ciphertexts, and sends the N random number ciphertexts and the query conditions associated with the N random number ciphertexts to the queried party;
[0090] Specifically, after receiving the confirmation message, the query party generates each query condition Qi, which includes a real query condition and N-1 mask query conditions. The real query condition can be called the target query condition, which is the query condition of the data that the query party wants to query for this query task. At the same time, for data privacy, the query party is prevented from knowing the target query condition. The target query condition is determined based on the query field and query logic. For example, if the query field is age and the query logic is greater than 20, then the target query condition is age greater than 20.
[0091] From the above content, we can know that the size of N determines the number of generated public and private keys, the number of random numbers, and the number of query conditions. The larger the value of N, the higher the data security. At the same time, more computing resources are required, and the computing efficiency will be reduced accordingly. The smaller the value of N, the lower the data security will be. At the same time, fewer computing resources are required, and the computing efficiency will be improved accordingly. Therefore, the querying party can flexibly configure the size of N based on the actual security, resources, time sensitivity and other actual conditions, ensure data security, and reasonably use computing resources to improve computing and transmission efficiency.
[0092] Optionally, the target query condition includes query fields and field range information (query logic), and each mask query condition is obtained as follows:
[0093] The field range information is modified to obtain the modified field range information; based on the query field and the modified field range information, a mask query condition is obtained.
[0094] For example, the query field is age, the field range information is less than 30, the target query condition is age less than 30, and the field range information is changed to greater than 25, then the mask condition is age greater than 25.
[0095] The querying party also generates N second random numbers Ri, and uses the received N public keys Wi to encrypt the N second random numbers in sequence to obtain N random number ciphertexts Ri'. For example, the second random numbers include: R1, R2, R3, R1 is encrypted using W1 to obtain R1', R2 is encrypted using W2 to obtain R2', and R3 is encrypted using W3 to obtain R3'.
[0096] Optionally, adopt the domestic cryptographic algorithm SM9, use N public keys Wi to encrypt N second random numbers, and generate random number ciphertext Ri':
[0097] R i '=SM9(Ri,Wi)
[0098] The query condition associated with each random number ciphertext is determined according to the position of the second random number corresponding to the random number ciphertext in each second random number. For example, the second random numbers include: R1, R2, R3, and the random numbers are: R1', R2', R3', respectively. The query conditions are: Q1, Q2, Q3, then R1' is associated with Q1, R2' is associated with Q2, and R3' is associated with Q3. It should be noted that the target query condition can be any one of Q1, Q2, and Q3. The embodiment of the present application does not limit the position of the target query condition in each query condition.
[0099] The embodiment of the present application is based on a domestic cryptographic algorithm, and implements a minimized privacy protection mechanism for data query in the scenario of cross-domain data security sharing. It has fast response speed and relatively low resource requirements. The use of domestic cryptographic algorithms can better meet the current requirements of government affairs, finance and other fields for the security compliance of cryptographic algorithms for cross-domain data sharing.
[0100] Optionally, the queried party receives N random number ciphertexts returned by the querying party, and the query conditions associated with each of the N random number ciphertexts, and decrypts the N random number ciphertexts based on the private keys corresponding to the public keys to obtain N second random numbers, and queries the target data set based on each query condition to obtain each query result set; the queried party encrypts the corresponding query result sets based on the N second random numbers to obtain N encrypted result sets, and returns the N encrypted result sets to the querying party.
[0101] Specifically, R1', R2', and R3' are obtained by encryption using W1, W2, and W3, respectively. The private keys corresponding to W1, W2, and W3 can be used to decrypt R1', R2', and R3' to obtain the second random numbers R1, R2, and R3. The target data set is queried according to the query conditions Q1, Q2, and Q3 to obtain the query result sets f1, f2, and f3, and then the query result set f1 is encrypted using the second random number R1 to obtain the encrypted result set f1', the query result set f2 is encrypted using the second random number R2 to obtain the encrypted result set f2', the query result set f3 is encrypted using the second random number R3 to obtain the encrypted result set f3', and the encrypted result sets f1', f2', and f3' are returned to the querying party.
[0102] Optionally, in order to increase encryption efficiency, the query result set may be encrypted based on the second random number using the Chinese remainder theorem to obtain an encrypted result set.
[0103] S23: The querying party receives N encrypted result sets returned by the queried party;
[0104] Each encrypted result set is obtained by the queried party encrypting the query result set based on the obtained second random number, the query result set is obtained by querying the target data set using the query condition, and the obtained second random number is obtained by decrypting the random number ciphertext associated with the query condition;
[0105] S24: The querying party decrypts a target encrypted result set among the N encrypted result sets based on a second random number corresponding to a target query condition in each query condition, and obtains a query result set corresponding to the target encrypted result set.
[0106] Among them, the target encrypted result set is obtained based on the target query condition. For example, if the target query condition is Q1, the corresponding second random number is R1 and the target encrypted result set is f1'. If the target query condition is Q2, the corresponding second random number is R2 and the target encrypted result set is f2'. N encrypted result sets are sent in sequence, and the querying party knows which query condition is the target query condition. Therefore, the querying party does not need to decrypt each encrypted result set, but only needs to decrypt the target decrypted result set. For example, if the target query condition is Q1, use the first second random number R1 to decrypt the first target encrypted result set, and the query result set obtained is the data that the querying party wants to query for this query task.
[0107] Optionally, in order to speed up decryption efficiency, the querying party uses the second random number and the Chinese remainder theorem to decrypt the encrypted result set to obtain the query result set corresponding to the target encrypted result set.
[0108] In the embodiment of the present application, the user can independently and flexibly configure the anonymous query strength N according to the actual situation of the participating parties, such as security, resources, and time sensitivity, and use a combination of random numbers and the Chinese remainder theorem to complete data set encryption and decryption, thereby ensuring data security while improving computing and transmission efficiency.
[0109] In an embodiment of the present application, the querying party receives N public keys sent by the queried party, encrypts the second random number using the public key, and then sends the N random number ciphertexts and the associated query conditions to the queried party. After the queried party queries and encrypts the query result set according to each query condition, the N encrypted result sets are returned to the querying party. The querying party decrypts the target encrypted result set based on the second random number corresponding to the target query condition, and can obtain the desired query result set. Based on the above method, data query is performed. On the one hand, the queried party uses the task identifier of the query task and the first random number to construct a public key, which can improve the security of data query and improve computing efficiency. On the other hand, the querying party sends multiple query conditions to the queried party to prevent the queried party from knowing the specific query content of the querying party, thereby protecting the data privacy of the querying party. The querying party knows the content it wants to query, and only needs to use the second random number corresponding to the target query condition to decrypt the target encrypted result set, which can reduce the amount of computation in the decryption process and improve data query efficiency.
[0110] The following is a detailed introduction to the encryption and decryption process based on SM9:
[0111] The queried party first establishes system parameters. For example, select an elliptic curve E(Fq), where Fq is a finite field, G1 is an additive cyclic group on the elliptic curve, and the generator is P. At the same time, select a bilinear map e: G1×G1→G2 (G2 is a multiplicative cyclic group isomorphic to G1), and determine the hash functions H1: {0,1}*→G1* and H2: {0,1}*→(0,1) n Then, choose a random number As the master private key, the system public key Ppublic = sP is calculated, the system parameters (including elliptic curve parameters, bilinear mapping, generators, system public key and hash function, etc.) are made public, and the master private key is kept secret by the queried party.
[0112] Taking label W1 as an example, calculate Q ID =H1(W1), private key d ID =sQ ID , when the querying party uses W1 to encrypt R1, it selects a random number Calculate C1 = rP. Then calculate (e(r ID , Ppublic)), here means XOR operation. The encrypted ciphertext is (C1, C2) (random number ciphertext). The querying party sends the random number ciphertext to the queried party, who (who has the private key d ID )calculate (e(d ID , C1)), thereby recovering R1.
[0113] like Figure 3 As shown, it is an implementation flow chart of the second data query method provided in the embodiment of the present application, which is applied to the queried party. The specific implementation flow of the method includes the following steps S31-S34:
[0114] S31: The queried party constructs N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the N first random numbers generated, and sends the N public keys to the querying party;
[0115] Wherein, N is a positive integer;
[0116] S32: The queried party receives the N random number ciphertexts returned by the querying party, and the query conditions associated with each of the N random number ciphertexts;
[0117] Each random number ciphertext is obtained by encrypting the generated second random number by the querying party based on the received public key;
[0118] S33: The queried party decrypts the N random number ciphertexts based on the private keys corresponding to the N public keys to obtain N second random numbers, and queries the target data set based on each query condition to obtain each query result set;
[0119] S34: The queried party encrypts the corresponding query result sets based on the N second random numbers respectively to obtain N encrypted result sets, and returns the N encrypted result sets to the querying party, so that the querying party decrypts the target encrypted result set among the N encrypted result sets based on the second random numbers corresponding to the target query conditions in each query condition to obtain the query result set corresponding to the target encrypted result set.
[0120] The target encrypted result set is obtained based on the target query condition. The specific steps performed by the queried party in the data query refer to the above embodiment and will not be described in detail here.
[0121] In an embodiment of the present application, the querying party receives N public keys sent by the queried party, encrypts the second random number using the public key, and then sends the N random number ciphertexts and the associated query conditions to the queried party. After the queried party queries and encrypts the query result set according to each query condition, the N encrypted result sets are returned to the querying party. The querying party decrypts the target encrypted result set based on the second random number corresponding to the target query condition, and can obtain the desired query result set. Based on the above method, data query is performed. On the one hand, the queried party uses the task identifier of the query task and the first random number to construct a public key, which can improve the security of data query and improve computing efficiency. On the other hand, the querying party sends multiple query conditions to the queried party to prevent the queried party from knowing the specific query content of the querying party, thereby protecting the data privacy of the querying party. The querying party knows the content it wants to query, and only needs to use the second random number corresponding to the target query condition to decrypt the target encrypted result set, which can reduce the amount of computation in the decryption process and improve data query efficiency.
[0122] like Figure 4 FIG. 1 is a schematic diagram of an interaction process of a data query method in an embodiment of the present application, which is used to show the interaction process between a querying party and a queried party, and includes the following steps:
[0123] S401: The querying party sends task information of the target query task to the queried party;
[0124] S402: The queried party determines to allow the querying party to query the target dataset based on the identity identifier and dataset identifier included in the task information;
[0125] S403: The queried party constructs N public keys based on the task identifier and the N first random numbers generated;
[0126] S404: The queried party sends N public keys to the querying party;
[0127] S405: The querying party encrypts the N second random numbers generated based on the N public keys respectively to obtain N random number ciphertexts;
[0128] S406: The querying party sends the N random number ciphertexts and the query conditions associated with the N random number ciphertexts to the queried party;
[0129] S407: The queried party queries the target data set based on each query condition to obtain each query result set, and encrypts the corresponding query result set based on N second random numbers obtained by decrypting the N random number ciphertexts to obtain N encrypted result sets;
[0130] S408: The queried party returns N encrypted result sets to the querying party;
[0131] S409: The querying party decrypts a target encrypted result set among the N encrypted result sets based on a second random number corresponding to a target query condition in each query condition, and obtains a query result set corresponding to the target encrypted result set.
[0132] Based on the same inventive concept, the present application embodiment provides a first data query device. Figure 5 As shown, it is a schematic diagram of the structure of a data query device 500, which may include:
[0133] The first receiving unit 501 is used to receive N public keys sent by the queried party, each public key is constructed by the queried party based on the task identifier of the target query task and a first random number generated, and N is a positive integer;
[0134] The encryption unit 502 is used to encrypt N second random numbers generated based on the N public key pairs respectively to obtain N random number ciphertexts, and send the N random number ciphertexts and the query conditions associated with the N random number ciphertexts to the queried party;
[0135] The second receiving unit 503 is used to receive N encrypted result sets returned by the queried party, each encrypted result set is obtained by the queried party encrypting a query result set based on the obtained second random number, the query result set is obtained by querying the target data set using the query condition, and the obtained second random number is obtained by decrypting a random number ciphertext associated with the query condition;
[0136] The decryption unit 504 is used to decrypt the target encrypted result set among the N encrypted result sets based on the second random number corresponding to the target query condition in each query condition, and obtain the query result set corresponding to the target encrypted result set, where the target encrypted result set is obtained based on the target query condition.
[0137] Optionally, the target query condition includes query fields and field range information, and each query condition also includes each mask query condition;
[0138] The encryption unit 502 is further configured to obtain each mask query condition in the following manner:
[0139] Modify the field range information to obtain the modified field range information;
[0140] A mask query condition is obtained based on the query field and the modified field range information.
[0141] Optionally, before receiving the N public keys sent by the queried party, the apparatus further includes a sending unit 505, configured to:
[0142] The task information of the target query task is sent to the queried party, the task information including the identity of the query party and the dataset identifier of the target dataset, the identity and dataset identifier are used by the queried party to determine whether to allow the query party to query the target dataset.
[0143] Based on the same inventive concept, the present application embodiment provides a second data query device. Figure 6 As shown, it is a schematic diagram of the structure of a data query device 600, which may include:
[0144] A construction unit 601 is used to construct N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the generated N first random numbers, and send the N public keys to the querying party, where N is a positive integer;
[0145] The receiving unit 602 is used to receive N random number ciphertexts returned by the querying party and query conditions associated with each of the N random number ciphertexts, where each random number ciphertext is obtained by encrypting a second random number generated by the querying party based on a received public key;
[0146] The decryption unit 603 is used to decrypt the N random number ciphertexts based on the private keys corresponding to the N public keys to obtain N second random numbers, and to query the target data set based on each query condition to obtain each query result set;
[0147] The sending unit 604 is used to encrypt the corresponding query result sets based on N second random numbers, obtain N encrypted result sets, and return the N encrypted result sets to the query party, so that the query party can decrypt the target encrypted result set among the N encrypted result sets based on the second random number corresponding to the target query condition in each query condition, and obtain the query result set corresponding to the target encrypted result set, and the target encrypted result set is obtained based on the target query condition.
[0148] Optionally, before constructing N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the generated N first random numbers, the device further includes a determining unit 605 for
[0149] Receive task information of the target query task sent by the query party, where the task information includes the identity of the query party and the dataset identifier of the target dataset;
[0150] Based on the identity identifier and the data set identifier, it is determined that the querying party is allowed to query the target data set.
[0151] Optionally, the construction unit 601 is specifically used for:
[0152] For the N first random numbers, perform the following operations respectively:
[0153] Based on a first random number and a task identifier, as well as a pre-generated third random number, a public key and a private key corresponding to the public key are constructed.
[0154] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.
[0155] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0156] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.
[0157] Based on the same inventive concept as the above method embodiment, an electronic device is also provided in the embodiment of the present application. In one embodiment, the electronic device may be a server, such as Figure 1 In this embodiment, the structure of the electronic device can be as follows: Figure 7 As shown, it includes a memory 701 , a communication module 703 and one or more processors 702 .
[0158] The memory 701 is used to store computer programs executed by the processor 702. The memory 701 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.
[0159] The memory 701 may be a volatile memory, such as a random-access memory (RAM); the memory 701 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 701 may be any other medium that can be used to carry or store a desired computer program in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 701 may be a combination of the above memories.
[0160] The processor 702 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 702 is used to implement the above data query method when calling the computer program stored in the memory 701.
[0161] The communication module 703 is used to communicate with terminal devices and other servers.
[0162] The specific connection medium between the memory 701, the communication module 703 and the processor 702 is not limited in the embodiment of the present application. Figure 7 In the embodiment, the memory 701 and the processor 702 are connected via a bus 704. The bus 704 is connected to the processor 702 via a bus 704. Figure 7 The connections between the other components are only for illustration and are not intended to be limiting. The bus 704 can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Figure 7 The diagram shows that only one thick line is used, but this does not mean that there is only one bus or only one type of bus.
[0163] The memory 701 stores a computer storage medium, and the computer storage medium stores computer executable instructions, and the computer executable instructions are used to implement the data query method of the embodiment of the present application. The processor 702 is used to execute the above-mentioned data query method, such as Figure 2 Or as shown in 3.
[0164] In another embodiment, the electronic device may also be other electronic devices, such as Figure 1 In this embodiment, the structure of the electronic device can be as follows: Figure 8 As shown, it includes: a communication component 810, a memory 820, a display unit 830, a camera 840, a sensor 850, an audio circuit 860, a Bluetooth module 870, a processor 880 and other components.
[0165] The communication component 810 is used to communicate with the server. In some embodiments, a wireless fidelity (WiFi) module may be included. The WiFi module belongs to a short-range wireless transmission technology. The electronic device can help the user to send and receive information through the WiFi module.
[0166] The memory 820 can be used to store software programs and data. The processor 880 executes various functions and data processing of the terminal device by running the software programs or data stored in the memory 820. The memory 820 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The memory 820 stores an operating system that enables the terminal device to run. In the present application, the memory 820 can store an operating system and various application programs, and can also store a computer program for executing the data query method of the embodiment of the present application.
[0167] The display unit 830 can also be used to display information input by the user or information provided to the user and a graphical user interface (GUI) of various menus of the terminal device. Specifically, the display unit 830 may include a display screen 832 disposed on the front of the terminal device. The display screen 832 may be configured in the form of a liquid crystal display, a light emitting diode, etc. The display unit 830 may be used to display the data query user interface in the embodiment of the present application, etc.
[0168] The display unit 830 can also be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal device. Specifically, the display unit 830 may include a touch screen 831 arranged on the front of the terminal device, which can collect user touch operations on or near it, such as clicking a button, dragging a scroll box, etc.
[0169] The touch screen 831 can be covered on the display screen 832, or the touch screen 831 and the display screen 832 can be integrated to realize the input and output functions of the terminal device, and the integrated display screen can be referred to as a touch display screen. In this application, the display unit 830 can display the application and the corresponding operation steps.
[0170] The camera 840 can be used to capture still images, and users can post comments on the images taken by the camera 840 through the application. The camera 840 can be one or more. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the processor 880 to convert it into a digital image signal.
[0171] The terminal device may further include at least one sensor 850, such as an acceleration sensor 851, a distance sensor 852, a fingerprint sensor 853, and a temperature sensor 854. The terminal device may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, a light sensor, and a motion sensor.
[0172] The audio circuit 860, the speaker 861, and the microphone 862 can provide an audio interface between the user and the terminal device. The audio circuit 860 can transmit the electrical signal converted from the received audio data to the speaker 861, which is converted into a sound signal for output. The terminal device can also be equipped with a volume button for adjusting the volume of the sound signal. On the other hand, the microphone 862 converts the collected sound signal into an electrical signal, which is received by the audio circuit 860 and converted into audio data, and then the audio data is output to the communication component 810 to be sent to, for example, another terminal device, or the audio data is output to the memory 820 for further processing.
[0173] The Bluetooth module 870 is used to exchange information with other Bluetooth devices having Bluetooth modules through the Bluetooth protocol. For example, the terminal device can establish a Bluetooth connection with a wearable electronic device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module 870 to exchange data.
[0174] The processor 880 is the control center of the terminal device. It uses various interfaces and lines to connect various parts of the entire terminal. It executes various functions of the terminal device and processes data by running or executing software programs stored in the memory 820 and calling data stored in the memory 820. In some embodiments, the processor 880 may include one or more processing units; the processor 880 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor 880. In the present application, the processor 880 can run the operating system, application programs, user interface display and touch response, as well as the data query method of the embodiment of the present application. In addition, the processor 880 is coupled to the display unit 830.
[0175] In some possible implementations, various aspects of the data query method provided by the present application may also be implemented in the form of a program product, which includes a computer program. When the program product is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of the data query method according to various exemplary implementations of the present application described above in this specification. For example, the electronic device may execute the following steps: Figure 2 or Figure 3 Follow the steps shown in .
[0176] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0177] The program product of the embodiment of the present application may adopt a portable compact disk read-only memory (CD-ROM) and include a computer program, and can be run on an electronic device. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which can be used by or in combination with a command execution system, apparatus, or device.
[0178] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein a readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.
[0179] The computer program embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0180] Computer programs for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The computer program may be executed entirely on the user electronic device, partially on the user device, as a separate software package, partially on the user electronic device and partially on a remote electronic device, or entirely on a remote electronic device or server. In the case of a remote electronic device, the remote electronic device may be connected to the user electronic device via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external electronic device (e.g., via the Internet using an Internet service provider).
[0181] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.
[0182] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0183] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain a computer-usable computer program.
[0184] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program commands. These computer program commands can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the commands executed by the processor of the computer or other programmable data processing device generate commands for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0185] These computer program commands may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the commands stored in the computer readable memory produce an article of manufacture comprising a command device, the command device implementing the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0186] These computer program commands can also be loaded onto a computer or other programmable data processing device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the commands executed on the computer or other programmable device provide the instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0187] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0188] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A data query method, characterized in that: Applied to the querying party, the method comprises: Receive N public keys sent by the queried party, each public key is constructed by the queried party based on the task identifier of the target query task and a first random number generated, and N is a positive integer; Encrypting N second random numbers generated based on the N public keys respectively to obtain N random number ciphertexts, and sending the N random number ciphertexts and query conditions associated with the N random number ciphertexts to the queried party; Receive N encrypted result sets returned by the queried party, each encrypted result set is obtained by the queried party encrypting a query result set based on an obtained second random number, the query result set is obtained by querying a target data set using a query condition, and the obtained second random number is obtained by decrypting a random number ciphertext associated with the query condition; Based on the second random number corresponding to the target query condition in each query condition, the target encrypted result set among the N encrypted result sets is decrypted to obtain a query result set corresponding to the target encrypted result set, wherein the target encrypted result set is obtained based on the target query condition.
2. The method according to claim 1, characterized in that The target query condition includes query fields and field range information, and each query condition also includes each mask query condition; Get each mask query condition as follows: Modify the field range information to obtain modified field range information; The mask query condition is obtained based on the query field and the modified field range information.
3. The method according to any one of claims 1 to 2, characterized in that: Before receiving the N public keys sent by the queried party, the method further includes: Sending task information of the target query task to the queried party, the task information including the identity of the querying party and the data set identifier of the target data set, the identity and the data set identifier being used by the queried party to determine whether to allow the querying party to query the target data set.
4. A data query method, characterized in that: Applied to the queried party, the method comprises: Based on the task identifier of the target query task and the N first random numbers generated, construct N public keys and a private key corresponding to each public key, and send the N public keys to the querying party, where N is a positive integer; Receiving N random number ciphertexts returned by the querying party, and query conditions associated with each of the N random number ciphertexts, wherein each random number ciphertext is obtained by encrypting a second random number generated by the querying party based on a received public key; Decrypting the N random number ciphertexts based on the private keys corresponding to the N public keys respectively to obtain N second random numbers, and querying the target data set based on each query condition respectively to obtain each query result set; Based on the N second random numbers, the corresponding query result sets are encrypted respectively to obtain N encrypted result sets, and the N encrypted result sets are returned to the querying party, so that the querying party decrypts the target encrypted result set among the N encrypted result sets based on the second random number corresponding to the target query condition in each query condition to obtain a query result set corresponding to the target encrypted result set, and the target encrypted result set is obtained based on the target query condition.
5. The method according to claim 4, characterized in that Before constructing N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the N first random numbers generated, the method further includes: Receiving task information of the target query task sent by the query party, the task information including the identity of the query party and the data set identifier of the target data set; Based on the identity identifier and the data set identifier, it is determined that the querying party is allowed to query the target data set.
6. The method according to any one of claims 4 to 5, characterized in that: The step of constructing N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the N first random numbers generated includes: For the N first random numbers, perform the following operations respectively: Based on the first random number and the task identifier, and a pre-generated third random number, a public key and a private key corresponding to the public key are constructed.
7. A data query device, characterized in that: Applicable to the inquiring party, including: A first receiving unit, configured to receive N public keys sent by a queried party, each public key being constructed by the queried party based on a task identifier of a target query task and a first random number generated, and N being a positive integer; an encryption unit, configured to encrypt N second random numbers generated based on the N public key pairs respectively to obtain N random number ciphertexts, and send the N random number ciphertexts and query conditions associated with the N random number ciphertexts to the queried party; A second receiving unit is used to receive N encrypted result sets returned by the queried party, each encrypted result set is obtained by the queried party encrypting a query result set based on an obtained second random number, the query result set is obtained by querying a target data set using a query condition, and the obtained second random number is obtained by decrypting a random number ciphertext associated with the query condition; A decryption unit is used to decrypt a target encrypted result set among the N encrypted result sets based on a second random number corresponding to a target query condition in each query condition, and obtain a query result set corresponding to the target encrypted result set, wherein the target encrypted result set is obtained based on the target query condition.
8. A data query device, characterized in that: Applicable to the queried party, including: A construction unit, configured to construct N public keys and a private key corresponding to each public key based on the task identifier of the target query task and the generated N first random numbers, and send the N public keys to the querying party, where N is a positive integer; A receiving unit, configured to receive N random number ciphertexts returned by the querying party and query conditions associated with the N random number ciphertexts, each of which is obtained by encrypting a second random number generated by the querying party based on a received public key; a decryption unit, configured to decrypt the N random number ciphertexts based on the private keys corresponding to the N public keys to obtain N second random numbers, and to query the target data set based on the query conditions to obtain query result sets; A sending unit is used to encrypt the corresponding query result sets based on the N second random numbers respectively to obtain N encrypted result sets, and return the N encrypted result sets to the query party, so that the query party can decrypt the target encrypted result set among the N encrypted result sets based on the second random number corresponding to the target query condition in each query condition to obtain the query result set corresponding to the target encrypted result set, and the target encrypted result set is obtained based on the target query condition.
9. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: It includes a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of any method described in claims 1 to 6.