Data query method and apparatus
By constructing and encrypting a data query index set, and transmitting only small batches of data query results, the performance issues caused by full dataset encryption and decryption in existing technologies are resolved. This achieves both security and efficiency in hidden queries, improving the effectiveness of hidden queries.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2023-02-10
- Publication Date
- 2026-07-07
AI Technical Summary
Existing covert query methods require transmitting the entire dataset for encryption and decryption, resulting in high performance overhead and performance issues in business scenarios.
A data index set with a preset number of data query indexes is constructed and encrypted using an encryption key. Only a small batch of data query results are transmitted, and the data provider decrypts them to obtain the query results.
It reduces the amount of data computation and transmission, improves data query efficiency, and achieves both security and efficiency in hidden queries.
Smart Images

Figure CN116244307B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and specifically to a data query method and apparatus. Background Technology
[0002] With the rapid development of big data and artificial intelligence in recent years, data security and compliance have become a focal point. Traditional data circulation methods can no longer meet compliance requirements. Achieving reliable data circulation is the foundation for promoting the market-based allocation of data elements. For data queries and interactions between terminals, privacy protection should be implemented, meaning that the data provider does not know the specific query information or the data items retrieved by the data querying party during the query process, thus achieving anonymous querying.
[0003] Existing covert query methods require transmitting the entire dataset to the querying party, and also encrypting and decrypting the entire dataset. The encryption / decryption of the entire dataset and the large amount of data transmission incur significant performance overhead, posing performance issues when used in business scenarios. Summary of the Invention
[0004] This invention provides a data query method and apparatus to solve the problem of hidden query methods in the prior art, which use the full dataset data transmission method. Due to the encryption and decryption of the full dataset and the large amount of data transmission, the performance overhead is large, resulting in low performance when used in business scenarios.
[0005] In a first aspect, the present invention provides a data query method, comprising:
[0006] Construct a data index set with a predetermined number of data query indexes, wherein the data index set includes the data query index of the data to be queried;
[0007] The system receives a query key assigned by the data provider, encrypts the data index set based on the query key, and sends the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and retrieve the query result set corresponding to each data query index in the data index set.
[0008] Receive the query result set sent by the data provider, and determine the query result of the data to be queried from the query result set.
[0009] In one embodiment, before receiving the query result set sent by the data provider, the method further includes:
[0010] Receive the public key set of all data from the data provider, and encrypt the data index set based on the public key set to obtain the encrypted data index set;
[0011] The encrypted data index set is sent to the data provider, so that the data provider can decrypt the encrypted data index set based on the private key set of the full data to obtain the query result set corresponding to each data query index in the data index set.
[0012] In one embodiment, the data index set is encrypted based on the public key set to obtain an encrypted data index set, including:
[0013] Based on each data query index in the data index set, the encryption key corresponding to each data query index is determined from the public key set;
[0014] Based on the encryption key, the corresponding data query index in the data index set is encrypted to obtain the encrypted data index set.
[0015] Secondly, the present invention also provides a data query method, comprising:
[0016] A query key is assigned to the data query terminal so that the data query terminal can encrypt the data index set based on the query key to obtain encrypted ciphertext information. The data index set is constructed based on a preset number of data query indexes and includes the data query index of the data to be queried.
[0017] Receive encrypted information from the data query terminal, decrypt the encrypted information to obtain the data index set, and obtain the query result set corresponding to each data query index in the data index set;
[0018] The query result set is sent to the data query terminal so that the data query terminal can determine the query result of the data to be queried from the query result set.
[0019] In one embodiment, sending the query result set to the data query terminal includes:
[0020] Based on a symmetric encryption algorithm, the query result set is encrypted and sent to the data query terminal, so that the data query terminal can decrypt the encrypted query result set to obtain the query result set and determine the query result of the data to be queried from the query result set.
[0021] In one embodiment, obtaining the query result set corresponding to each data query index in the data index set includes:
[0022] Send the public key set of the full data to the data query terminal so that the data query terminal can encrypt the data index set based on the public key set to obtain the encrypted data index set;
[0023] Receive the encrypted data index set;
[0024] Based on the private key set of the full data, the encrypted data index set is decrypted to obtain the query results corresponding to each data query index in the data index set.
[0025] Thirdly, the present invention also provides a data query device, comprising:
[0026] The construction module is used to construct a data index set containing a preset number of data query indexes, wherein the data index set includes the data query indexes of the data to be queried;
[0027] An encryption module is used to receive a query key allocated by a data provider, encrypt the data index set based on the query key, and send the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and retrieve the query result set corresponding to each data query index in the data index set.
[0028] The query module is used to receive the query result set sent by the data provider and determine the query result of the data to be queried from the query result set.
[0029] Fourthly, the present invention also provides a data query device, comprising:
[0030] An encryption module is used to allocate a query key to the data query terminal, so that the data query terminal can encrypt the data index set based on the query key to obtain encrypted ciphertext information. The data index set is constructed based on a preset number of data query indexes, and the data index set includes the data query index of the data to be queried.
[0031] The decryption module is used to receive ciphertext information from the data query terminal, decrypt the ciphertext information to obtain the data index set, and obtain the query result set corresponding to each data query index in the data index set.
[0032] The query module is used to send the query result set to the data query terminal so that the data query terminal can determine the query result of the data to be queried from the query result set.
[0033] Fifthly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement any of the above-described data query methods.
[0034] In a sixth aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the above-described data query methods.
[0035] The data query method and apparatus provided by this invention construct a data index set with a preset number of data query indexes, encrypt the data index set, and send it to the data provider. After decryption, the data provider obtains the query results corresponding to each data query index in the data index set, thus achieving hidden querying of the data to be queried. In implementing hidden querying, the data provider does not need to provide a query of the full dataset; it only needs to obtain a small batch of a preset number of data query results containing the data to be queried, reducing the amount of data computation and data transmission, and improving data query efficiency. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0037] Figure 1 This is a schematic diagram of the hidden query process provided by the present invention;
[0038] Figure 2 This is one of the flowcharts illustrating the data query method provided in an embodiment of the present invention;
[0039] Figure 3 A second schematic flowchart of the data query method provided in an embodiment of the present invention;
[0040] Figure 4 A flowchart illustrating the data query method provided in the embodiments of the present invention;
[0041] Figure 5 This is one of the structural schematic diagrams of the data query device provided in the embodiments of the present invention;
[0042] Figure 6 This is a second schematic diagram of the structure of the data query device provided in an embodiment of the present invention;
[0043] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0045] PIR (Private Information Retrieval) is a practical technique in secure multi-party computation used to protect user query privacy. Its purpose is to ensure that when a user submits a query request to the server (data source), the query is completed without the user's query information being leaked. In other words, throughout the entire query process, the server is unaware of the user's specific query information or the data items retrieved.
[0046] Oblivious Transfer (OT) is a secure two-party communication protocol frequently used in cryptography and is a fundamental protocol in cryptography. In this protocol, the sender and receiver communicate. After the protocol is completed, the receiver can obtain the information it wants, but cannot obtain any other information from the sender. The sender is unaware of which specific message the receiver has received.
[0047] The hidden lookup of data in related methods, based on the PIR implementation process of unintentional transmission, is as follows: Figure 1 The schematic diagram of the hidden query process provided by this invention is shown.
[0048] Step 110: The data provider possesses the complete dataset {m1, m2…m}. n The public key set {pk1, pk2, ..., pk} of the dataset is generated using the RSA encryption algorithm. n The private key set {sk1, sk2, ... sk} is made public to the data query client. n The data is stored by the client, and the data query client initiates a data query request to the data provider. i (i = 1, 2, ..., n).
[0049] Step 120: The data query terminal generates a random number r locally and uses the public key set {pk1, pk2, ..., pk} publicly disclosed by the data provider. n The encrypted ciphertext information c = Enc(pk) i ,r).
[0050] Step 130: The data query terminal sends the encrypted information to the data provider terminal.
[0051] In step 140, the data provider decrypts the ciphertext c using the private key set, obtaining b. After decryption, the data provider obtains only random numbers, unable to distinguish between r and b, and therefore unable to crack the private key set or deduce the data required by the data query end.
[0052] Step 150: The data provider connects an r and n-1 b with the dataset {m1, m2…m n After performing an XOR operation, we obtain the dataset M.
[0053] Step 160: The data provider sends the anonymized dataset M to the data query provider.
[0054] Step 170: The data query terminal XORs the de-identified dataset with the previously generated random number r again to obtain m, and the remaining m... i The result after XORing with b is a random number, making it impossible to deduce data information other than the request.
[0055] Covert queries based on the original OT protocol require transmitting the public key of the entire dataset to the data querying party, and also require encryption and decryption of the entire dataset. Therefore, the amount of encryption / decryption and data transmission is large, resulting in significant performance overhead and performance issues when used in business scenarios.
[0056] To address the shortcomings of related methods, this invention provides a data query method. Figure 2 This is one of the flowcharts illustrating the data query method provided in this embodiment of the invention. (Refer to...) Figure 2 The data query method provided in this embodiment of the invention includes the following steps:
[0057] Step 210: Construct a data index set with a preset number of data query indexes, wherein the data index set includes the data query index of the data to be queried;
[0058] Step 220: Receive the query key assigned by the data provider, encrypt the data index set based on the query key, and send the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and obtain the query result set corresponding to each data query index in the data index set.
[0059] Step 230: Receive the query result set sent by the data provider, and determine the query result of the data to be queried from the query result set.
[0060] The execution subject of the data query method provided in this embodiment of the invention can be a data query terminal. The following describes the technical solution of the invention in detail by taking the execution of the data query method provided in this embodiment of the invention by a data query terminal.
[0061] Specifically, in step 210, after determining the data to be queried, a data index set of a preset number of data query indexes is constructed. This data index set contains the data query indexes for the data to be queried.
[0062] Optionally, the data query index in the constructed data index set can be the primary key ID of the data. Based on the primary key IDs of a preset number of data, a data index set of a preset number n is constructed as {mid1, mid2, ..., mid}. n}
[0063] The data query client is the data query requester. The data query client sends a data query request to the data provider. After receiving the data query request from the data query client, the data provider returns the query results of the data to be queried in the data query request.
[0064] Optionally, when constructing the data index set, a data index set containing small batches of data query indexes can be built. A preset number of data query indexes can be set as needed. In implementing hidden queries, the data provider does not need to provide a query of the full dataset; only a small batch of data query results containing the data to be queried are required. This reduces the amount of data computation and data transmission, improving data transmission efficiency.
[0065] In step 220, the query key allocated by the data provider is received. This query key is the allocation request the data query client makes to the data provider. Upon receiving the allocation request, the data provider sends the allocated query key. After receiving the allocated query key, the data query client encrypts the data index set based on the query key. The encrypted ciphertext is then sent to the data provider. The data provider decrypts the received ciphertext, retrieves the data index set, and obtains the query result set corresponding to each data query index within the data index set.
[0066] After constructing the data index set, it is encrypted using the assigned query key, and the encrypted information is sent to the data provider. The data provider decrypts the data index set to obtain the data index set and retrieves the query result set corresponding to each data query index within it. After obtaining the query result set, it is returned to the data query end for subsequent retrieval of query results for the data to be queried.
[0067] Optionally, based on the query key, the data index set can be encrypted using AES (Advanced Encryption Standard) to obtain the encrypted ciphertext information. Upon receiving the ciphertext information, the data provider decrypts it using AES based on the query key to obtain the data index set.
[0068] Encrypting the data query index using a query key enables covert data transmission between the data query client and the data provider. All data transmitted between the data query client and the data provider is encrypted, ensuring secure data transmission.
[0069] In step 230, the system receives a query result set consisting of the query results corresponding to each data query index in the data index set sent by the data provider in step 220, and determines the query result of the data to be queried from the query result set.
[0070] The data index set contains the data query indexes of the data to be queried. After obtaining the query results corresponding to each data query index in the data index set, the query results of the data to be queried can be determined from the query result set based on the data query index of the data to be queried.
[0071] Understandably, the transmission of encrypted data index sets between the data query end and the data provider end can protect privacy during data query and interaction. That is, during the query process, the data provider end cannot know the specific query information or the data items retrieved by the data query end, which can realize the hidden query of the data to be queried and ensure the security of data query.
[0072] The data query method provided in this invention constructs a data index set with a preset number of data query indexes, encrypts the data index set, and sends it to the data provider. The data provider decrypts the data and obtains the query results corresponding to each data query index in the data index set, thus achieving hidden querying of the data to be queried. In implementing hidden querying, the data provider does not need to provide a query of the entire dataset; it only needs to obtain a small batch of a preset number of data query results containing the data to be queried, reducing the amount of data computation and data transmission, and improving data query efficiency.
[0073] In one embodiment, before receiving the query result set sent by the data provider, the method further includes: receiving the public key set of all data in the data provider; encrypting the data index set based on the public key set to obtain an encrypted data index set; and sending the encrypted data index set to the data provider so that the data provider can decrypt the encrypted data index set based on the private key set of all data to obtain a query result set corresponding to each data query index in the data index set.
[0074] When the data index set is sent from the data query end to the data provider end, the data index set needs to be encrypted. The data provider end possesses the full dataset M{m1,m2…m nThe full dataset M is the data stored in the data provider, containing all data corresponding to each data query index in the data index set. The public key set {pk1, pk2, ..., pk} of the full dataset M is generated using the asymmetric encryption algorithm RSA. n The private key set {sk1, sk1, ..., sk11} corresponding to the full dataset is stored in the database of the data provider.
[0075] Based on the generated public key set, the data index set is encrypted to obtain an encrypted data index set. This encrypted data index set is then sent to the data provider. The data provider decrypts the encrypted data index set using its private key set to obtain the corresponding data query result set, thus achieving anonymous data transmission between the data query end and the data provider.
[0076] The data query method provided in this embodiment of the invention encrypts the data index set during the transmission between the data provider and the data query end using a public key set and a private key set generated by the data provider, thereby achieving the covert transmission of the data index set between the data query end and the data provider.
[0077] In one embodiment, encrypting the data index set based on the public key set to obtain an encrypted data index set includes: determining an encryption key corresponding to each data query index from the public key set based on each data query index in the data index set; and encrypting the corresponding data query index in the data index set based on the encryption key to obtain an encrypted data index set.
[0078] After obtaining the public key set, which contains the encryption keys for all data from the data provider, the public key set is filtered during the encryption of the data index set to determine the encryption keys corresponding to each data query index contained within the data index set.
[0079] Based on the encryption key corresponding to each data query index, each data query index in the data index set is encrypted to obtain the encrypted data index set.
[0080] Optionally, after obtaining the public key set from the data provider, a subset of the public key set can be obtained based on the data query indices contained in the data index set. For example, if the data index set is m{mid1, mid2, ..., mid1}, filtering the public key set of the entire dataset according to the data query indices in the data index set, and determining the encryption key corresponding to each data query index from the public key set, the resulting subset of the public key set would be 2pk1, pk2, ..., pk n When encrypting the data index set later, the subset {pk1, pk2, ... pk} is directly encrypted.n The data is sent to the data query terminal, where the data index set is encrypted.
[0081] Then, query the public key of dataset m by primary key in the full dataset M to obtain the RSA public key set {pk1, pk2, ..., pk} of dataset m. n The dataset is then sent to the data query client, which stores the dataset and retrieves the sequence number.
[0082] The data query method provided in this embodiment of the invention filters the public key set corresponding to the full dataset through the data query index in the data index set, and encrypts each data query index in the data index set based on the encryption key corresponding to each data query index, thereby obtaining an encrypted data index set and realizing the encryption process of the data index set.
[0083] Figure 3 This is the second flowchart illustrating the data query method provided in this embodiment of the invention. (Refer to...) Figure 3 The data query method provided in this embodiment of the invention includes the following steps:
[0084] Step 310: Assign a query key to the data query terminal so that the data query terminal can encrypt the data index set based on the query key to obtain encrypted ciphertext information. The data index set is constructed based on a preset number of data query indexes and includes the data query index of the data to be queried.
[0085] Step 320: Receive encrypted information from the data query terminal, decrypt the encrypted information to obtain the data index set, and obtain the query result set corresponding to each data query index in the data index set;
[0086] Step 330: Send the query result set to the data query terminal so that the data query terminal can determine the query result of the data to be queried from the query result set.
[0087] The data query method provided in this embodiment of the invention can be executed by a data provider. The following describes the technical solution of the invention in detail by taking the execution of the data query method provided in this embodiment of the invention by a data provider.
[0088] Specifically, in step 310, a query key is allocated to the data query client. This query key is the allocation request the data query client submits to the data provider. Upon receiving the allocation request, the data provider sends the allocated query key. After receiving the allocated query key, the data query client encrypts the data index set based on the query key to obtain the encrypted ciphertext information. The data index set is constructed based on a preset number of data query indexes and includes the data query indexes of the data to be queried.
[0089] After determining the data to be queried, a data index set of a predetermined number of data query indexes is constructed based on the data query endpoint. This data index set contains the data query indexes for the data to be queried.
[0090] Optionally, the data query index in the constructed data index set can be the primary key ID of the data. Based on the primary key IDs of a preset number of data, a data index set of a preset number n is constructed as {mid1, mid2, ..., mid}. n}
[0091] The data query client is the data query requester. The data query client sends a data query request to the data provider. After receiving the data query request from the data query client, the data provider returns the query results of the data to be queried in the data query request.
[0092] Optionally, when building a data index set on the data query side, a data index set containing small batches of data query indexes can be constructed. A preset number of data query indexes can be set as needed. In implementing hidden queries, the data provider does not need to provide a query of the full dataset; only a small batch of data query results containing the data to be queried are required. This reduces the amount of data computation and data transmission, improving data transmission efficiency.
[0093] Optionally, based on the query key, the data index set can be encrypted using AES (Advanced Encryption Standard) to obtain the encrypted ciphertext information. Upon receiving the ciphertext information, the data provider decrypts it using AES based on the query key to obtain the data index set.
[0094] Encrypting the data query index using a query key enables covert data transmission between the data query client and the data provider. All data transmitted between the data query client and the data provider is encrypted, ensuring secure data transmission.
[0095] In step 320, the encrypted information sent by the data query terminal is received, and the received encrypted information is decrypted to obtain a data index set. Based on the data index set, the query result set corresponding to each data query index in the data index set is obtained.
[0096] The encrypted information is decrypted to obtain a data index set, and the query result set corresponding to each data query index in the data index set is retrieved. After obtaining the query result set, the query result set can be returned to the data query terminal for subsequent retrieval of query results for the data to be queried.
[0097] In step 330, after obtaining the query result set, the obtained query result set is sent to the data query terminal. After receiving the query result set, the data query terminal determines the query result for the data to be queried from the query result set.
[0098] The query result set is composed of the query results corresponding to each data query index in the data index set sent by the data provider, and the query result of the data to be queried is determined from the query result set.
[0099] The data index set contains the data query indexes of the data to be queried. After obtaining the query results corresponding to each data query index in the data index set, the query results of the data to be queried can be determined from the query result set based on the data query index of the data to be queried.
[0100] Understandably, the transmission of encrypted data index sets between the data query end and the data provider end can protect privacy during data query and interaction. That is, during the query process, the data provider end cannot know the specific query information or the data items retrieved by the data query end, which can realize the hidden query of the data to be queried and ensure the security of data query.
[0101] The data query method provided in this invention constructs a data index set with a preset number of data query indexes, encrypts the data index set, and sends it to the data provider. The data provider decrypts the data and obtains the query results corresponding to each data query index in the data index set, thus achieving hidden querying of the data to be queried. In implementing hidden querying, the data provider does not need to provide a query of the entire dataset; it only needs to obtain a small batch of a preset number of data query results containing the data to be queried, reducing the amount of data computation and data transmission, and improving data query efficiency.
[0102] In one embodiment, sending the query result set to the data query terminal includes: encrypting the query result set based on a symmetric encryption algorithm, and sending the encrypted query result set to the data query terminal, so that the data query terminal can decrypt the encrypted query result set to obtain the query result set, and determine the query result of the data to be queried from the query result set.
[0103] During the transmission of the query result set between the data query end and the data provider end, the query result set is encrypted. Based on a symmetric encryption algorithm, the query result set is encrypted, and then sent to the data query end.
[0104] After receiving the encrypted query result set, the data query terminal decrypts it to retrieve the content. Once the query result set is obtained, the query result for the data to be queried is determined from it.
[0105] The data query method provided in this invention achieves secure data transmission of the data index set between the data query end and the data provider end by encrypting the transmission of the query result set using a symmetric encryption algorithm after obtaining the query result set.
[0106] In one embodiment, obtaining the query result set corresponding to each data query index in the data index set includes: sending the public key set of the full data to the data query terminal, so that the data query terminal encrypts the data index set based on the public key set to obtain an encrypted data index set; receiving the encrypted data index set; and decrypting the encrypted data index set based on the private key set of the full data to obtain the query result corresponding to each data query index in the data index set.
[0107] When the data index set is sent from the data query end to the data provider end, the data index set needs to be encrypted. The data provider end possesses the full dataset M{m1,m2…m n The full dataset M is the data stored in the data provider, containing all data corresponding to each data query index in the data index set. The public key set {pk1, pk2, ..., pk} of the full dataset M is generated using the asymmetric encryption algorithm RSA. n}, and the private key set {sk1, sk2, ... sk} corresponding to the full dataset. n Stored in the database of the data provider.
[0108] Based on the generated public key set, the data index set is encrypted to obtain an encrypted data index set. The data provider receives the encrypted data index set and decrypts it based on the private key set, thus achieving covert transmission of the data index set between the data query end and the data provider.
[0109] The data query method provided in this embodiment of the invention encrypts the data index set during the transmission between the data provider and the data query end using a public key set and a private key set generated by the data provider, thereby achieving the covert transmission of the data index set between the data query end and the data provider.
[0110] The following is a flowchart illustrating a data query method provided in an embodiment of the present invention. Figure 4 For example, the technical solution provided by the embodiments of the present invention is illustrated below:
[0111] Step 401: The data query terminal requests a query key from the data provider.
[0112] Step 402: The data provider uses the AES symmetric encryption algorithm to generate a query key. i ,storage;
[0113] Step 403, the data provider will query the key. i Send to the data query terminal;
[0114] Step 404, the data query terminal plans to retrieve the data m to be retrieved. i Construct a data index set. Given data m... i The primary key id is used as the index for data queries. A mini-batch data index set {mid1, mid2, ..., mid} of length n is constructed. n}, where mid i This is the primary key of the data to be retrieved; the rest is data randomly constructed according to the primary key ID rule. Use the query key. i The data index set is encrypted to obtain ciphertext information;
[0115] Step 405: Send the encrypted information to the data provider.
[0116] Step 406, the data provider uses the query key. i The encrypted information is decrypted to obtain the data index set {mid1, mid2, ..., mid}. n};
[0117] Step 407: The data provider possesses the complete dataset M{m1,m2…m n}, using the asymmetric encryption algorithm RSA, generate the public key set {pk1, pk2, ..., pk} of dataset M.n}, and the corresponding private key set {sk1, sk2, ... sk n Based on the data index set, the public key set {pk1, pk2, ..., pk} corresponding to the full dataset is... n} Filter to obtain a subset of the public key set corresponding to the data index set;
[0118] Step 408: The data provider sends a subset of the obtained public key set to the data queryer.
[0119] Step 409: The data query terminal receives a subset of the public key set sent by the data provider.
[0120] Step 410: The data query terminal encrypts the data index set based on a subset of the public key set to obtain the encrypted data index set;
[0121] Step 411: Send the encrypted data index set to the data provider.
[0122] Step 412: The data provider decrypts the data based on the private key set to obtain the data query result set;
[0123] Step 413: Encrypt the data query result set based on the AES encryption algorithm;
[0124] Step 414: Send the encrypted data query result set to the data query terminal;
[0125] Step 415: Decrypt the encrypted data query result set and obtain the query result of the data to be queried based on the data query index of the data to be queried.
[0126] Figure 5 This is one of the structural schematic diagrams of a data query device provided in an embodiment of the present invention. (Refer to...) Figure 5 The data query device provided in this embodiment of the invention includes:
[0127] The construction module 510 is used to construct a data index set of a preset number of data query indexes, wherein the data index set includes the data query index of the data to be queried;
[0128] The encryption module 520 is used to receive a query key allocated by the data provider, encrypt the data index set based on the query key, and send the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and obtain the query result set corresponding to each data query index in the data index set.
[0129] The query module 530 is used to receive the query result set sent by the data provider and determine the query result of the data to be queried from the query result set.
[0130] The data query device provided in this invention constructs a data index set with a preset number of data query indexes, encrypts the data index set, and sends it to the data provider. The data provider decrypts the data and obtains the query results corresponding to each data query index in the data index set, thus achieving hidden querying of the data to be queried. In implementing hidden querying, the data provider does not need to provide a query of the entire dataset; it only needs to obtain a small batch of a preset number of data query results containing the data to be queried, reducing the amount of data computation and data transmission, and improving data query efficiency.
[0131] In one embodiment, the query module 530 is specifically used for:
[0132] Before receiving the query result set sent by the data provider, the method further includes:
[0133] Receive the public key set of all data from the data provider, and encrypt the data index set based on the public key set to obtain the encrypted data index set;
[0134] The encrypted data index set is sent to the data provider, so that the data provider can decrypt the encrypted data index set based on the private key set of the full data to obtain the query result set corresponding to each data query index in the data index set.
[0135] In one embodiment, the query module 530 is further specifically used for:
[0136] The data index set is encrypted based on the public key set to obtain an encrypted data index set, including:
[0137] Based on each data query index in the data index set, the encryption key corresponding to each data query index is determined from the public key set;
[0138] Based on the encryption key, the corresponding data query index in the data index set is encrypted to obtain the encrypted data index set.
[0139] Figure 6 This is a second schematic diagram of the structure of the data query device provided in an embodiment of the present invention. (Refer to...) Figure 6 The data query device provided in this embodiment of the invention includes:
[0140] The encryption module 610 is used to allocate a query key to the data query terminal so that the data query terminal can encrypt the data index set based on the query key to obtain encrypted ciphertext information. The data index set is constructed based on a preset number of data query indexes and includes the data query index of the data to be queried.
[0141] The decryption module 620 is used to receive ciphertext information from the data query terminal, decrypt the ciphertext information to obtain the data index set, and obtain the query result set corresponding to each data query index in the data index set.
[0142] The query module 630 is used to send the query result set to the data query terminal so that the data query terminal can determine the query result of the data to be queried from the query result set.
[0143] The data query method provided in this invention constructs a data index set with a preset number of data query indexes, encrypts the data index set, and sends it to the data provider. The data provider decrypts the data and obtains the query results corresponding to each data query index in the data index set, thus achieving hidden querying of the data to be queried. In implementing hidden querying, the data provider does not need to provide a query of the entire dataset; it only needs to obtain a small batch of a preset number of data query results containing the data to be queried, reducing the amount of data computation and data transmission, and improving data query efficiency.
[0144] In one embodiment, the decryption module 620 is specifically used for:
[0145] Obtain the query result set corresponding to each data query index in the data index set, including:
[0146] Send the public key set of the full data to the data query terminal so that the data query terminal can encrypt the data index set based on the public key set to obtain the encrypted data index set;
[0147] Receive the encrypted data index set;
[0148] Based on the private key set of the full data, the encrypted data index set is decrypted to obtain the query results corresponding to each data query index in the data index set.
[0149] The present invention also provides an electronic device, such as... Figure 7As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communication interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute data query methods, such as:
[0150] Construct a data index set with a predetermined number of data query indexes, wherein the data index set includes the data query index of the data to be queried;
[0151] The system receives a query key assigned by the data provider, encrypts the data index set based on the query key, and sends the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and retrieve the query result set corresponding to each data query index in the data index set.
[0152] Receive the query result set sent by the data provider, and determine the query result of the data to be queried from the query result set.
[0153] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0154] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, which, when executed by a computer, enable the computer to execute the data query methods provided in the above-described method embodiments, for example including:
[0155] Construct a data index set with a predetermined number of data query indexes, wherein the data index set includes the data query index of the data to be queried;
[0156] The system receives a query key assigned by the data provider, encrypts the data index set based on the query key, and sends the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and retrieve the query result set corresponding to each data query index in the data index set.
[0157] Receive the query result set sent by the data provider, and determine the query result of the data to be queried from the query result set.
[0158] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data query methods provided in the above-described method embodiments, for example including:
[0159] Construct a data index set with a predetermined number of data query indexes, wherein the data index set includes the data query index of the data to be queried;
[0160] The system receives a query key assigned by the data provider, encrypts the data index set based on the query key, and sends the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and retrieve the query result set corresponding to each data query index in the data index set.
[0161] Receive the query result set sent by the data provider, and determine the query result of the data to be queried from the query result set.
[0162] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0163] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0164] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data query method, characterized in that, include: Construct a data index set with a predetermined number of data query indexes, wherein the data index set includes the data query index of the data to be queried; The data index set is constructed based on the data query index of the data to be queried and multiple randomly generated data query indexes; the preset number is less than the total amount of data in the data provider; the multiple randomly generated data query indexes are data randomly constructed according to the primary key rules of the data to be queried; The system receives a query key assigned by the data provider, encrypts the data index set based on the query key, and sends the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and retrieve the query result set corresponding to each data query index in the data index set. The query key is a key generated by the data provider using a symmetric encryption algorithm; Receive the set of query results sent by the data provider, and determine the query result of the data to be queried from the set of query results; Before receiving the query result set sent by the data provider, the method further includes: Receive the public key set of all data from the data provider, and encrypt the data index set based on the public key set to obtain the encrypted data index set; The encrypted data index set is sent to the data provider, so that the data provider can decrypt the encrypted data index set based on the private key set of the full data to obtain the query result set corresponding to each data query index in the data index set.
2. The data query method according to claim 1, characterized in that, The step of encrypting the data index set based on the public key set to obtain the encrypted data index set includes: Based on each data query index in the data index set, the encryption key corresponding to each data query index is determined from the public key set; Based on the encryption key, the corresponding data query index in the data index set is encrypted to obtain the encrypted data index set.
3. A data query method, characterized in that, include: A query key is assigned to the data query terminal so that the data query terminal can encrypt the data index set based on the query key to obtain encrypted ciphertext information. The data index set is constructed based on a preset number of data query indexes, and includes the data query index of the data to be queried. The data index set is constructed based on the data query index of the data to be queried and multiple randomly generated data query indexes. The preset number is less than the total amount of data in the data provider. The multiple randomly generated data query indexes are data randomly constructed according to the primary key rules of the data to be queried. The query key is a key generated using a symmetric encryption algorithm; Receive encrypted information from the data query terminal, decrypt the encrypted information to obtain the data index set, and obtain the query result set corresponding to each data query index in the data index set; The query result set is sent to the data query terminal so that the data query terminal can determine the query result of the data to be queried from the query result set; The step of obtaining the query result set corresponding to each data query index in the data index set includes: Send the public key set of the full data to the data query terminal so that the data query terminal can encrypt the data index set based on the public key set to obtain the encrypted data index set; Receive the encrypted data index set; Based on the private key set of the full data, the encrypted data index set is decrypted to obtain the query results corresponding to each data query index in the data index set.
4. The data query method according to claim 3, characterized in that, Sending the query result set to the data query terminal includes: Based on a symmetric encryption algorithm, the query result set is encrypted and sent to the data query terminal, so that the data query terminal can decrypt the encrypted query result set to obtain the query result set and determine the query result of the data to be queried from the query result set.
5. A data query device, characterized in that, include: The construction module is used to construct a data index set containing a preset number of data query indexes, wherein the data index set includes the data query indexes of the data to be queried; The data index set is constructed based on the data query index of the data to be queried and multiple randomly generated data query indexes; the preset number is less than the total amount of data in the data provider; the multiple randomly generated data query indexes are data randomly constructed according to the primary key rules of the data to be queried; An encryption module is used to receive a query key allocated by a data provider, encrypt the data index set based on the query key, and send the encrypted ciphertext information to the data provider so that the data provider can decrypt the ciphertext information to obtain the data index set and retrieve the query result set corresponding to each data query index in the data index set. The query key is a key generated by the data provider using a symmetric encryption algorithm; The query module is used to receive the query result set sent by the data provider and determine the query result of the data to be queried from the query result set; Before receiving the query result set sent by the data provider, the method further includes: Receive the public key set of all data from the data provider, and encrypt the data index set based on the public key set to obtain the encrypted data index set; The encrypted data index set is sent to the data provider, so that the data provider can decrypt the encrypted data index set based on the private key set of the full data to obtain the query result set corresponding to each data query index in the data index set.
6. A data query device, characterized in that, include: An encryption module is used to allocate a query key to the data query terminal, enabling the data query terminal to encrypt the data index set based on the query key to obtain encrypted ciphertext information. The data index set is constructed based on a preset number of data query indexes, including the data query index of the data to be queried. The data index set is constructed based on the data query index of the data to be queried and multiple randomly generated data query indexes. The preset number is less than the total amount of data in the data provider. The multiple randomly generated data query indexes are data randomly constructed according to the primary key rules of the data to be queried. The query key is a key generated using a symmetric encryption algorithm; The decryption module is used to receive ciphertext information from the data query terminal, decrypt the ciphertext information to obtain the data index set, and obtain the query result set corresponding to each data query index in the data index set. The query module is used to send the query result set to the data query terminal, so that the data query terminal can determine the query result of the data to be queried from the query result set; The step of obtaining the query result set corresponding to each data query index in the data index set includes: Send the public key set of the full data to the data query terminal so that the data query terminal can encrypt the data index set based on the public key set to obtain the encrypted data index set; Receive the encrypted data index set; Based on the private key set of the full data, the encrypted data index set is decrypted to obtain the query results corresponding to each data query index in the data index set.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the data query method as described in claim 1 or 2, or the data query method as described in claim 3 or 4.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data query method as described in claim 1 or 2, or the data query method as described in claim 3 or 4.