Data query method and device, electronic equipment and storage medium
By performing sharding processing and homomorphic encryption processing on the business data set, the problems of low query efficiency, insufficient privacy protection and low security in the existing data query methods are solved, and efficient and secure data query is achieved.
Patent Information
- Application Number
- CN202411954792.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-04
AI Technical Summary
The existing data query methods have problems such as inefficient query efficiency, insufficient data privacy protection and low security, which are difficult to meet the high standards of data security and privacy protection in modern society.
By obtaining data query tasks, the business data set is sharded, the data query request after homomorphic encryption is obtained, the homomorphic encryption query result is determined from the sharded data, and the result is sent to the target client.
On the premise of protecting personal privacy and data security, efficient real-time query of dynamic and sensitive business data sets is realized, improving data query efficiency and security.
Smart Images

Figure CN119760187A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of information technology and data privacy protection, and in particular, to a data query method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of information technology, the importance of data is increasing day by day, and it has become a core resource driving the development of various industries. The data query method in the relevant technology usually adopts two modes: direct query or plain text query to realize the retrieval of specific information in the database. Among them, direct query refers to the query party sending a query instruction directly to the database of the data owner, requesting to retrieve specific records or data sets; plain text query refers to the query conditions or requests sent to the data server or database in an unencrypted form during the data query process. However, in the current environment of increasingly stringent privacy protection, both modes in the relevant technology have serious risks of data privacy leakage, which makes it difficult to meet the high standards of modern society for data security and privacy protection.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present disclosure provide a data query method, device, electronic device and storage medium to at least solve the technical problems of low query efficiency, insufficient data privacy protection and low security existing in the data query methods provided in the related arts.
[0005] According to one aspect of an embodiment of the present disclosure, there is provided a data query method, including: obtaining a data query task; according to the data query task, sharding a business data set to obtain sharded data; obtaining a data query request, wherein the data query request is a homomorphically encrypted request; based on the data query request, determining a query result from the sharded data, wherein the query result is homomorphically encrypted data; and sending the query result to a target client, wherein the target client is a client corresponding to the data query request.
[0006] Optionally, the data query task includes a first-level sharding parameter and a second-level sharding parameter. According to the data query task, the business data set is sharded to obtain sharded data, including: according to the first-level sharding parameters, the business data set is sharded to obtain a first-level sharding result; according to the second-level sharding parameters, the first-level sharding result is sharded to obtain a second-level sharding result; according to the first-level sharding result and the second-level sharding result, the sharding data is determined.
[0007] Optionally, the first-level sharding result is sharded according to the second-level sharding parameters to obtain the second-level sharding result, including: determining the number of second-level shards according to the second-level sharding parameters; and sharding the first-level sharding result according to the number of second-level shards to obtain the second-level sharding result.
[0008] Optionally, the data query method also includes: determining the newly added data according to a preset data update cycle; sharding the newly added data according to the first-level sharding parameters to obtain the first-level sharding results of the newly added data; sharding the newly added data sharding results according to the second-level sharding parameters to obtain the second-level sharding results of the newly added data; updating the sharded data according to the first-level sharding results of the newly added data and the second-level sharding results of the newly added data.
[0009] Optionally, based on the data query request, determining the query result from the sharded data includes: obtaining addressing data in the data query request; determining a target data set from the sharded data based on the addressing data, and sending the target data set to a target client; obtaining a query ciphertext, wherein the query ciphertext is generated by the target client based on the addressing data; and performing an inner product operation on the query ciphertext and the target data set to determine the query result.
[0010] Optionally, the addressing data includes a first index and a second index, wherein the first index corresponds to a first-level sharding parameter and the second index corresponds to a second-level sharding parameter. According to the addressing data, a target data set is determined from the sharded data, including: according to the first index, determining a data slice from the first-level sharding result; according to the second index, determining the target data set from the second-level sharding result.
[0011] According to another aspect of an embodiment of the present disclosure, a data query device is also provided, including: a first acquisition module, used to acquire a data query task; a first sharding module, used to shard a business data set according to the data query task to obtain sharded data; a second acquisition module, used to acquire a data query request, wherein the data query request is a homomorphically encrypted request; a query module, used to determine a query result from the sharded data based on the data query request, wherein the query result is homomorphically encrypted data; and a communication module, used to send the query result to a target client, wherein the target client is a client corresponding to the data query request.
[0012] Optionally, the first sharding module is also used to: shard the business data set according to the first-level sharding parameters to obtain the first-level sharding results; shard the first-level sharding results according to the second-level sharding parameters to obtain the second-level sharding results; determine the sharding data based on the first-level sharding results and the second-level sharding results.
[0013] Optionally, the first sharding module is further used to: determine the number of secondary shards according to the secondary sharding parameters; and perform sharding processing on the first-level sharding results according to the number of secondary shards to obtain the second-level sharding results.
[0014] Optionally, the data query device also includes: a determination module, used to determine the newly added data according to a preset data update cycle; a second sharding module, used to shard the newly added data according to the first-level sharding parameters to obtain the first-level sharding results of the newly added data; a third sharding module, used to shard the newly added data sharding results according to the second-level sharding parameters to obtain the second-level sharding results of the newly added data; an update module, used to update the sharded data according to the first-level sharding results of the newly added data and the second-level sharding results of the newly added data.
[0015] Optionally, the query module is also used to: obtain addressing data in the data query request; determine the target data set from the shard data based on the addressing data, and send the target data set to the target client; obtain the query ciphertext, wherein the query ciphertext is generated by the target client based on the addressing data; perform an inner product operation on the query ciphertext and the target data set to determine the query result.
[0016] Optionally, the query module is further used to: determine the data slice from the first-level sharding result according to the first index; and determine the target data set from the second-level sharding result according to the second index.
[0017] According to another aspect of the embodiments of the present disclosure, an electronic device is further provided, including: a memory storing an executable program; and a processor for running the program, wherein the data query method in each embodiment of the present disclosure is executed when the program is running.
[0018] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is further provided, the computer-readable storage medium including a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the data query method in each embodiment of the present disclosure.
[0019] According to another aspect of the embodiments of the present disclosure, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the data query method in each embodiment of the present disclosure is implemented.
[0020] In the disclosed embodiment, by obtaining a data query task, and sharding the business data set according to the data query task, and then determining the query result from the sharded data according to the data query request, and finally sending the query result to the client, the purpose of achieving efficient real-time query of dynamic and sensitive business data sets while protecting personal privacy and data security is achieved, thereby achieving the technical effect of improving data query efficiency and security, and further solving the technical problems of low query efficiency, insufficient data privacy protection, and low security existing in the data query methods provided in the relevant technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation on the present disclosure. In the drawings:
[0022] Figure 1 is a flow chart of a data query method according to one embodiment of the present disclosure;
[0023] Figure 2 is a schematic diagram of a slicing process according to one embodiment of the present disclosure;
[0024] Figure 3 It is a structural block diagram of a data query device according to one embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present disclosure, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present disclosure.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0027] The data query methods in related technologies usually use two modes, direct query or plaintext query, to retrieve specific information in the database. Among them, direct query means that the query party directly sends a query instruction to the database of the data owner, requesting to retrieve specific records or data sets; plaintext query means that during the data query process, the query conditions or requests are sent to the data server or database in an unencrypted form. However, in the current environment of increasingly stringent privacy protection, both modes in related technologies have serious risks of data privacy leakage, which makes it difficult to meet the high standards of data security and privacy protection in modern society.
[0028] Specifically, taking the flight and train ticket query system as an example, the above system usually needs to interact with the business systems of multiple ticket agents or sales agencies to integrate the flight and itinerary data scattered in various places to build a complete itinerary record of passengers. However, between airlines and ticket agencies, since itinerary data is their respective core business assets, direct data sharing and query will expose commercial secrets, resulting in the data owner being unwilling to open its database for query by the other party. How to achieve data integration and query without leaking sensitive information has become a key issue that needs to be solved urgently.
[0029] Privacy computing technology, especially privacy intersection and hidden query, provides innovative solutions to the above problems. Through complex encryption algorithms and protocols, privacy computing technology can ensure that authorized institutions or individuals will not expose their query conditions and content to the dataset owner when querying data, and the dataset owner will only return data that matches the query conditions without providing additional information, effectively protecting the privacy of the data and the security of core business data. Taking passenger itinerary inquiries as an example, when hidden queries are not implemented, the business system of the ticketing agency can clearly record the query conditions, and IT operation and maintenance personnel can access and record the personal information of the inquirer, which poses a risk of data leakage. After the implementation of hidden queries, all queries are encrypted and hidden in large-scale datasets. The data provider only knows the data blocks that are accessed, but cannot locate the specific query records, effectively ensuring the anonymity and privacy security of the query.
[0030] However, in the process of anonymous query, when dealing with large-scale data sets, in order to improve query efficiency, the data provider needs to pre-process the data, such as sharding, by dividing the data set into multiple smaller subsets so that the query conditions can directly correspond to specific data subsets, and then anonymous queries can be performed based on the subsets. However, sharding preprocessing of massive data sets consumes a lot of computing resources and time even with standard server configurations. For aviation and railways, passenger information and itinerary data are updated at a rate of thousands to hundreds of thousands per minute, causing the sharding processing results to quickly become outdated and require frequent recalculation, which seriously affects the real-time and performance of the query.
[0031] According to an embodiment of the present disclosure, a method embodiment of a data query method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0032] The method embodiment can be executed in an electronic device or a similar computing device including a memory and a processor. Taking running on a computer terminal as an example, the computer terminal may include one or more processors (processors may include but are not limited to central processing units (CPU), graphics processing units (GPU), digital signal processing (DSP) chips, microprocessors (MCU), programmable logic devices (Field Programmable Gate Array, FPGA), neural network processors (Neural-network Processor Unit, NPU), tensor processors (TensorProcessing Unit, TPU), artificial intelligence (Artificial Intelligence, AI) type processors and other processing devices) and a memory for storing data. Optionally, the above-mentioned computer terminal may also include a transmission device, an input and output device, and a display device for communication functions. It can be understood by those of ordinary skill in the art that the above-mentioned structural description is only for illustration, and it does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal may also include more or fewer components than the above-mentioned structural description, or have a configuration different from the above-mentioned structural description.
[0033] The memory can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data query method in the embodiment of the present disclosure. The processor executes various functional applications and data processing by running the computer program stored in the memory, that is, realizing the above-mentioned data query method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0034] The transmission device is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0035] The display device may be, for example, a touch screen type liquid crystal display (LCD) and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of a mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), and a user may interact with the GUI by finger contacts and / or gestures on a touch-sensitive surface, wherein the human-computer interaction functions here may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music and / or web browsing, etc. The executable instructions for executing the above human-computer interaction functions are configured / stored in a computer program product or readable storage medium executable by one or more processors.
[0036] Figure 1 is a flow chart of a data query method according to one embodiment of the present disclosure. Figure 1 As shown, the method comprises the following steps:
[0037] Step S11, obtaining a data query task;
[0038] Step S12, according to the data query task, the business data set is sliced to obtain sliced data;
[0039] Step S13, obtaining a data query request, wherein the data query request is a homomorphically encrypted request;
[0040] Step S14, based on the data query request, determining the query result from the sharded data, wherein the query result is homomorphically encrypted data;
[0041] Step S15, sending the query result to the target client, wherein the target client is the client corresponding to the data query request.
[0042] The above-mentioned data query task refers to a hidden query task initiated by an authorized client, such as a specific organization or individual, to retrieve the required information from a specific data set stored on the server. The hidden query task is a special task type that performs data query under the premise of protecting data privacy, which includes information such as the queried data set, index fields, and other accompanying fields. In the hidden whereabouts real-time query system, the core goal of the data query task is to enable the inquirer to query the required whereabouts information, while the data provider (such as airlines, railway ticketing systems, etc.) cannot know the specific query content or the identity of the inquirer during the service process, thereby ensuring the security and privacy of the entire query process.
[0043] The above-mentioned sharding process refers to the process of splitting a large data set into multiple smaller, independently managed data parts in database management and large-scale data set operations, which is used to improve data operability and query efficiency. By distributing data to different physical or logical subsets, parallel processing can be achieved while reducing the amount of data that needs to be scanned during queries. Sharding processing usually includes the following steps: full sharding, incremental sharding, data bucketing, data update, and data indexing and addressing. Sharding processing usually includes the following steps:
[0044] (1) Full Sharding: When the system is initialized or the configuration is changed, the original data set is divided into multiple subsets according to the preset index parameters. Each subset is called a data shard.
[0045] (2) Incremental sharding: During system operation, new incoming data is partitioned in real time or periodically to ensure that all data can be correctly classified and indexed to support real-time query requirements.
[0046] (3) Data bucketing: Within each data shard, data is further subdivided into smaller data blocks based on the data’s indistinguishability or hash value, called bucketing. Bucketing helps improve query positioning accuracy and processing speed.
[0047] (4) Data update: Through regular or real-time update mechanisms, new data is incorporated into existing shards or new shards are created to keep the data set up to date and support efficient query.
[0048] (5) Data indexing and addressing: Create indexes to quickly locate data shards and buckets, implement encrypted data queries, and ensure query anonymity and data security.
[0049] The above homomorphic encryption refers to a special form of encryption technology that allows data to be processed and analyzed without being directly accessed, thereby avoiding the risk of possible leakage of data during transmission and processing. When data is encrypted in the form of homomorphic encryption, operations such as addition and multiplication can be performed in the ciphertext state, and the calculation result will be decrypted to obtain a plaintext value consistent with the result obtained by performing the same operation on the plaintext data. Specifically, homomorphic encryption is divided into fully homomorphic encryption (Fully Homomorphic Encryption, FHE) and partially homomorphic encryption (Partially Homomorphic Encryption, PHE), among which FHE is the most general homomorphic encryption technology that supports all types of mathematical operations; while PHE only supports specific types of operations, such as additive homomorphic encryption and multiplicative homomorphic encryption. Additive homomorphic encryption only allows addition operations between encrypted data, while multiplicative homomorphic encryption only allows multiplication operations between encrypted data.
[0050] Exemplarily, a secure communication channel is first established between the query party and the data provider, and a public-private key pair is exchanged through a key management component. The query party uses the public key of the data provider to encrypt the query conditions to form an encrypted query request (QUERY ciphertext). During the query process, the QUERY ciphertext is sent to the data provider. The data provider uses homomorphic encryption technology to execute the query without decrypting the QUERY ciphertext, ensuring the anonymity of the query conditions. Furthermore, the query results are also returned in encrypted form, and only the query party can use its own private key to decrypt them, thereby obtaining the query results. At the same time, no plaintext information about the query results is disclosed to the data provider to protect data privacy.
[0051] For example, taking the flight query system as an example, an authorized client such as a ticket agent initiates a data query task, requesting to retrieve a business data set containing flight dynamics and passenger whereabouts. After receiving the data query task from the authorized client, the aviation system server divides the original business data set into multiple smaller, logically independent data shards according to the preset index parameters. Subsequently, the authorized client generates a homomorphically encrypted data query request, which includes encrypted query conditions, such as the identity and travel date of a specific passenger.
[0052] Furthermore, after receiving the homomorphically encrypted request from the authorized client, the server immediately locates the relevant data shards and buckets from the pre-processed shard data according to the addressing information contained in the encrypted query condition. Subsequently, by executing the calculation algorithm based on homomorphic encryption, the data query component can perform inner product calculation on the filtered data set of the target bucket without decryption to obtain the homomorphically encrypted query result.
[0053] Finally, the homomorphically encrypted query results, i.e., the passenger's flight status and whereabouts information, are sent back to the ticketing agent's client through a secure session channel. After receiving the ciphertext results, the target client uses the key that matches the query request to perform homomorphic decryption to obtain the final plaintext query results, i.e., the required specific flight information and passenger whereabouts.
[0054] Based on the above steps S11 to S15, by obtaining data query tasks, and sharding the business data set according to the data query tasks, and then determining the query results from the sharded data according to the data query request, and finally sending the query results to the client, the purpose of achieving efficient real-time query of dynamic and sensitive business data sets while protecting personal privacy and data security is achieved, thereby achieving the technical effect of improving data query efficiency and security, and further solving the technical problems of low query efficiency, insufficient data privacy protection, and low security existing in the data query methods provided in the relevant technologies.
[0055] The data query method in the embodiment of the present disclosure is further introduced below.
[0056] Optionally, in step S12, the data query task includes a primary sharding parameter and a secondary sharding parameter, and the business data set is sharded according to the data query task to obtain sharded data, including:
[0057] Step S121, sharding the business data set according to the first-level sharding parameters to obtain a first-level sharding result;
[0058] Step S122, performing sharding processing on the first-level sharding result according to the second-level sharding parameter to obtain a second-level sharding result;
[0059] Step S123, determining the shard data according to the first-level shard result and the second-level shard result.
[0060] The above-mentioned first-level sharding parameters refer to the basis or standard for the initial, coarse-grained segmentation of the original business data set. In the real-time query system of privacy computing, the first-level sharding parameters are usually highly distinguishing fields or attributes in the data set, which can effectively segment the data set into multiple logically independent subsets, each of which corresponds to a first-level sharding result.
[0061] The above-mentioned secondary sharding parameters refer to the basis or standard for further refining data segmentation based on the primary sharding structure. Secondary sharding parameters are usually used to achieve finer-grained data organization to improve the efficiency of hidden queries and the level of privacy protection. In the real-time hidden whereabouts query system based on privacy computing, the selection and application of secondary sharding parameters can ensure that even within the same primary shard, data is dispersed into different secondary shards, thereby increasing the anonymity of data queries and optimizing query performance.
[0062] For example, in a flight query system, the first-level sharding parameter can be "date" or "time". For example, if the sharding is performed by "day", the entire data set will be divided into 365 or 366 shards, each of which contains all flights and passenger whereabouts information for a certain day; in a medical data query system, the first-level sharding parameter can be "patient ID" or "diagnosis date". When the "patient ID" is used for first-level sharding, each shard will contain all medical records of different patients, so that when querying the information of a specific patient, the corresponding shard can be directly located without traversing the entire data set.
[0063] For example, in a medical data query system, the first-level sharding parameter can be "patient ID", and the second-level sharding parameter can be "diagnosis type" or "hash value of patient ID", which further refines the organizational structure of the data and improves the privacy protection strength during query.
[0064] Based on the above optional embodiments, through the primary and secondary sharding strategies, the system can not only quickly respond to a large number of real-time query requests and improve query efficiency, but also effectively protect data privacy during the query process and avoid the leakage of sensitive information, thereby meeting the dual requirements of modern data query systems for high performance and high security.
[0065] Optionally, in step S122, the first-level sharding result is sharded according to the second-level sharding parameter to obtain the second-level sharding result, including:
[0066] Step S1221, determining the number of secondary shards according to the secondary sharding parameters;
[0067] Step S1222: Slice the first-level slicing result according to the number of second-level slicings to obtain a second-level slicing result.
[0068] Exemplarily, taking the flight query system as an example, assuming that its first-level sharding parameter is "date", the data set has been divided into multiple shards by "day". The second-level sharding parameter can be "hash value of flight number" or "hash value of passenger ID". By calculating the hash value of the above fields and taking the modulus with the preset number of second-level shards, the data in each first-level shard can be further divided into multiple second-level shards. For example, if the number of second-level shards is 1000, each first-level shard will be subdivided into 1000 second-level shards, thereby ensuring that even if the flight information of the same date is queried, the data will be scattered in different second-level shards due to the different hash values of the flight number or passenger ID, which increases the indistinguishability of the data and further protects data privacy.
[0069] Based on the above optional embodiments, through secondary sharding processing, the results of primary sharding are further divided into smaller data blocks, which refines the distribution of data, makes the data more dispersed, and is not easy to be centrally analyzed or inferred, thereby enhancing the privacy protection of the data.
[0070] Figure 2 is a schematic diagram of a slicing process according to one embodiment of the present disclosure, such as Figure 2 As shown in the figure, during the sharding process, we must first filter out information irrelevant to the query task in the original business data, and then perform data partitioning and intra-partition bucketing operations.
[0071] Exemplarily, assume that the original business data contains data such as "date, identifier, information 1, information 2...", where the identifier can be a passenger ID, and "information 2" is information irrelevant to the query task. Therefore, before data sharding, it is necessary to filter out "information 2" irrelevant to the query task in the original business data. Subsequently, the filtered data is divided by day. For example, the filtered data is divided into "January 1" partitions, ..., "December 31" partitions, where each data partition contains "identifier, information 1, ..." and other information. Furthermore, for the above partitions, intra-partition bucketing is performed. For example, the "January 1" partition is divided into "bucket 1, ..., bucket N", where the information contained in each bucket includes "identifier hash value, information 1, ..." and other information.
[0072] Optionally, the data query method further includes:
[0073] Step S21, determining the newly added data according to the preset data update cycle;
[0074] Step S22, sharding the newly added data according to the primary sharding parameters to obtain the primary sharding result of the newly added data;
[0075] Step S23, sharding the newly added data sharding result according to the secondary sharding parameters to obtain the newly added data secondary sharding result;
[0076] Step S24, updating the shard data according to the primary shard result of the newly added data and the secondary shard result of the newly added data.
[0077] The above-mentioned preset data update cycle refers to the time interval set in the system, which is used to regularly check and process the new data in the business data set. Generally speaking, the shorter the preset data update cycle, the closer the result is to real-time. In the hidden whereabouts real-time query system, the role of the preset data update cycle is to ensure that the system can capture the new data in the business system (such as airline databases, railway ticketing systems, medical record systems, etc.) in a timely manner, and integrate the new data into the system's data sharding structure, thereby ensuring the real-time and accuracy of hidden queries.
[0078] Exemplarily, assuming that the preset data update cycle is set to once every 30 seconds, when the system detects new data in the business database since the last cursor position, the sharding process is immediately started to efficiently and securely integrate the new data into the current data sharding structure. Specifically, if the new data can be classified into the partition corresponding to the existing date, time or other first-level parameters, the system will perform additional bucketing processing and use the second-level sharding parameters to divide the data into a finer granularity. For example, for a flight query system, the second-level sharding parameter can be the hash value of the passenger ID. The system determines which bucket the data should be placed in by calculating the hash value of each passenger ID and performing a modulo operation with the total number of buckets.
[0079] Furthermore, when the amount of appended data exceeds the upper limit of the capacity allowed by a single bucket, the system will automatically create a new bucket and use a linked list pointer to link the original bucket with the new bucket to form an ordered bucket linked list, allowing the system to quickly locate and retrieve target data even when the amount of data grows, avoiding the degradation of query performance due to the capacity limit of a single bucket.
[0080] Based on the above optional embodiments, by setting a preset data update cycle and performing data sharding and bucketing processing, it can ensure that the hidden whereabouts real-time query system can timely capture the new data in the business database and integrate the new data into the existing data sharding structure, thereby ensuring the real-time and accuracy of the hidden query.
[0081] Optionally, in step S14, based on the data query request, determining the query result from the shard data includes:
[0082] Step S141, obtaining addressing data in the data query request;
[0083] Step S142, determining a target data set from the shard data according to the addressing data, and sending the target data set to the target client;
[0084] Step S143, obtaining a query ciphertext, wherein the query ciphertext is generated by the target client according to the addressing data;
[0085] Step S144, performing an inner product operation on the query ciphertext and the target data set to determine the query result.
[0086] The above-mentioned addressing data refers to the encrypted index information generated by the client module in the hidden whereabouts real-time query system after processing the query condition information (such as passenger ID, flight date, etc.) through homomorphic encryption technology to guide the server to locate the target data.
[0087] The query ciphertext mentioned above refers to the ciphertext generated by the client module after encrypting the specific query conditions using homomorphic encryption technology based on the public key provided by the server module. The query ciphertext can be used by the server to perform hidden query tasks without leaking the plaintext information of the query conditions.
[0088] For example, suppose the target client requests to query the flight itinerary of a specific passenger ID "T12345" on "October 1, 2023". When the server receives the query ciphertext sent by the client, it will perform an inner product operation based on homomorphic encryption with the target data set, so as to determine which data records match the flight itinerary of "T12345" on "October 1, 2023" without having to decrypt the query conditions or data set. The result of the operation will generate a new encrypted query result, which only contains the record information that matches the query conditions, but remains encrypted to continue to protect data privacy. Subsequently, this encrypted query result is sent back to the target client through a secure communication channel, and the client uses its private key to decrypt it, and finally presents the decrypted query result to the user. The whole process not only protects user privacy, but also ensures the efficiency and accuracy of the query.
[0089] For example, efficient homomorphic encryption algorithms and optimized hidden query protocols can be used to reduce computing and communication overhead and improve query real-time performance. For example, the cuckoo algorithm can be used to merge multiple queries to optimize the amount of calculation. Alternatively, parallel and distributed computing technologies can be introduced to accelerate the privacy computing process in a multi-core, multi-node environment.
[0090] Based on the above optional embodiments, by utilizing homomorphic encryption technology to process query condition information to generate addressing data and query ciphertext, and performing inner product operations in combination with the sharded data on the server side, it is possible to determine data records that match the query conditions without decrypting the query conditions and data sets, and return the query results in encrypted form, thereby protecting data privacy while ensuring the real-time and accuracy of the query.
[0091] Optionally, in step S142, the addressing data includes a first index and a second index, wherein the first index corresponds to a primary sharding parameter, and the second index corresponds to a secondary sharding parameter, and determining a target data set from the sharding data according to the addressing data includes:
[0092] Step S1421, determining a data slice from the first-level sharding result according to the first index;
[0093] Step S1422: Determine the target data set from the secondary sharding results according to the second index.
[0094] The above-mentioned first index refers to the encrypted index information generated by the client module after processing the first-level fields (such as time, location, etc.) in the query conditions through homomorphic encryption technology, which is used to indicate which specific shards or shards the server should retrieve data from.
[0095] For example, when a user wants to query flight information on October 1, 2023, the client will encrypt the date information and generate an encrypted first index. The server will locate the time slice of "October 1, 2023" based on this index, thereby narrowing the query scope to the data set of a specific date, thereby improving the efficiency and specificity of the query.
[0096] The second index mentioned above refers to the encrypted index information generated by the client module after processing the secondary fields in the query conditions (such as the hash value of the passenger ID, flight number, etc.) through homomorphic encryption technology. After the server module has located the data slice corresponding to the first index, the second index is used to further refine the query scope and determine the specific target data set.
[0097] For example, after locating the data shard of "October 1, 2023", the client will encrypt the hash value of the passenger ID (assumed to be "T12345") to generate an encrypted second index. Based on the second index, the server can determine from the data shard of that date through a modulo operation which specific bucket the target passenger data may be stored in, so that the query can be performed on specific passenger information while protecting sensitive information such as the passenger ID.
[0098] Based on the above optional embodiments, the combined use of the first index and the second index can not only effectively deal with the contradiction between data dynamics and query real-time, but also provide fast and accurate query services under the premise of protecting data privacy. It is suitable for processing massive data, high-frequency updates, and scenarios with strict requirements for privacy protection.
[0099] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present disclosure.
[0100] In the embodiments of the present disclosure, a data query device is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0101] Figure 3 is a structural block diagram of a data query device according to one embodiment of the present disclosure, such as Figure 3 As shown, the device comprises:
[0102] The first acquisition module 301 is used to acquire a data query task;
[0103] The first sharding module 302 is used to perform sharding processing on the business data set according to the data query task to obtain sharding data;
[0104] A second acquisition module 303 is used to acquire a data query request, wherein the data query request is a homomorphically encrypted request;
[0105] A query module 304 is used to determine a query result from the sharded data based on the data query request, wherein the query result is homomorphically encrypted data;
[0106] The communication module 305 is used to send the query result to the target client, wherein the target client is the client corresponding to the data query request.
[0107] Optionally, the first sharding module 302 is also used to: shard the business data set according to the first-level sharding parameters to obtain the first-level sharding results; shard the first-level sharding results according to the second-level sharding parameters to obtain the second-level sharding results; determine the sharding data according to the first-level sharding results and the second-level sharding results.
[0108] Optionally, the first sharding module 302 is further used to: determine the number of secondary shards according to the secondary sharding parameters; and perform sharding processing on the first-level sharding result according to the number of secondary shards to obtain the second-level sharding result.
[0109] Optionally, the data query device further includes:
[0110] A determination module 306, configured to determine the newly added data according to a preset data update cycle;
[0111] The second sharding module 307 is used to perform sharding processing on the newly added data according to the primary sharding parameters to obtain the primary sharding result of the newly added data;
[0112] The third sharding module 308 is used to perform sharding processing on the newly added data sharding result according to the secondary sharding parameters to obtain the newly added data secondary sharding result;
[0113] The updating module 309 is used to update the sharding data according to the primary sharding result of the newly added data and the secondary sharding result of the newly added data.
[0114] Optionally, the query module 304 is also used to: obtain addressing data in the data query request; determine the target data set from the shard data based on the addressing data, and send the target data set to the target client; obtain the query ciphertext, wherein the query ciphertext is generated by the target client based on the addressing data; perform an inner product operation on the query ciphertext and the target data set to determine the query result.
[0115] Optionally, the query module 304 is further used to: determine the data slice from the first-level sharding result according to the first index; and determine the target data set from the second-level sharding result according to the second index.
[0116] According to another aspect of the embodiments of the present disclosure, an electronic device is further provided, including: a memory storing an executable program; and a processor for running the program, wherein the data query method in each embodiment of the present disclosure is executed when the program is running.
[0117] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0118] S1, obtain data query task;
[0119] S2, according to the data query task, the business data set is segmented to obtain segmented data;
[0120] S3, obtaining a data query request, wherein the data query request is a homomorphically encrypted request;
[0121] S4, based on the data query request, determining the query result from the sharded data, wherein the query result is homomorphically encrypted data;
[0122] S5, sending the query result to the target client, where the target client is the client corresponding to the data query request.
[0123] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is further provided, the computer-readable storage medium including a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the data query method in each embodiment of the present disclosure.
[0124] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0125] S1, obtain data query task;
[0126] S2, according to the data query task, the business data set is segmented to obtain segmented data;
[0127] S3, obtaining a data query request, wherein the data query request is a homomorphically encrypted request;
[0128] S4, based on the data query request, determining the query result from the sharded data, wherein the query result is homomorphically encrypted data;
[0129] S5, sending the query result to the target client, where the target client is the client corresponding to the data query request.
[0130] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0131] According to another aspect of the embodiments of the present disclosure, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the data query method in each embodiment of the present disclosure is implemented.
[0132] Optionally, in this embodiment, the computer program product may be configured as a computer program for executing the following steps:
[0133] S1, obtain data query task;
[0134] S2, according to the data query task, the business data set is segmented to obtain segmented data;
[0135] S3, obtaining a data query request, wherein the data query request is a homomorphically encrypted request;
[0136] S4, based on the data query request, determining the query result from the sharded data, wherein the query result is homomorphically encrypted data;
[0137] S5, sending the query result to the target client, where the target client is the client corresponding to the data query request.
[0138] In the above embodiments of the present disclosure, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0139] In the several embodiments provided in the present disclosure, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0140] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0141] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0142] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0143] The above is only a preferred embodiment of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present disclosure. These improvements and modifications should also be regarded as the scope of protection of the present disclosure.
Claims
1. A data query method, characterized in that: include: Get data query tasks; According to the data query task, the business data set is sliced to obtain sliced data; Obtaining a data query request, wherein the data query request is a homomorphically encrypted request; Based on the data query request, determine a query result from the sharded data, wherein the query result is homomorphically encrypted data; The query result is sent to a target client, wherein the target client is a client corresponding to the data query request.
2. The data query method according to claim 1, characterized in that: The data query task includes a primary sharding parameter and a secondary sharding parameter. According to the data query task, the business data set is sharded to obtain sharded data, including: According to the first-level sharding parameters, the business data set is sharded to obtain a first-level sharding result; According to the secondary sharding parameters, the primary sharding result is sharded to obtain a secondary sharding result; The sharding data is determined according to the first-level sharding result and the second-level sharding result.
3. The data query method according to claim 1, characterized in that: The step of performing sharding processing on the first-level sharding result according to the second-level sharding parameter to obtain the second-level sharding result includes: Determine the number of secondary shards according to the secondary sharding parameters; The first-level sharding result is sharded according to the number of the second-level shards to obtain the second-level sharding result.
4. The data query method according to claim 2, characterized in that: Also includes: Determine the newly added data according to the preset data update cycle; According to the first-level sharding parameters, the newly added data is sharded to obtain a first-level sharding result of the newly added data; According to the secondary sharding parameters, the newly added data sharding result is sharded to obtain the newly added data secondary sharding result; The shard data is updated according to the primary sharding result of the newly added data and the secondary sharding result of the newly added data.
5. The data query method according to claim 2, characterized in that: The determining the query result from the shard data based on the data query request includes: Obtaining addressing data in the data query request; Determine a target data set from the shard data according to the addressing data, and send the target data set to the target client; Obtaining a query ciphertext, wherein the query ciphertext is generated by the target client according to the addressing data; An inner product operation is performed on the query ciphertext and the target data set to determine the query result.
6. The data query method according to claim 5, characterized in that: The addressing data includes a first index and a second index, wherein the first index corresponds to the primary sharding parameter, and the second index corresponds to the secondary sharding parameter, and determining a target data set from the sharding data according to the addressing data includes: Determine a data slice from the first-level sharding result according to the first index; According to the second index, the target data set is determined from the secondary sharding results.
7. A data query device, characterized in that: include: The first acquisition module is used to acquire data query tasks; A first sharding module, configured to perform sharding processing on the business data set according to the data query task to obtain sharded data; A second acquisition module is used to acquire a data query request, wherein the data query request is a homomorphically encrypted request; A query module, configured to determine a query result from the sharded data based on the data query request, wherein the query result is homomorphically encrypted data; A communication module is used to send the query result to a target client, wherein the target client is a client corresponding to the data query request.
8. An electronic device, characterized in that: include: A memory storing an executable program; A processor, configured to run the program, wherein the program executes the method according to any one of claims 1 to 6 when running.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is executed, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 6.