Private data query method
By setting initial private states for the server and client during the offline preprocessing stage and optimizing the query process during the online query stage, the inefficiency of privacy data query methods in large-scale privacy function scenarios is solved, and efficient privacy data query is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INST OF SOFTWARE - CHINESE ACAD OF SCI
- Filing Date
- 2025-12-04
- Publication Date
- 2026-05-12
AI Technical Summary
Existing privacy data query methods suffer from high communication and computational complexity and low efficiency in scenarios with large privacy functions or high requirements for response latency, making it difficult to meet the needs of practical applications.
In the offline preprocessing stage, the control server and client complete the main computing load and obtain the initial private state; in the online query stage, the client performs privacy data queries on the server, and uses homomorphic encryption and pseudo-random functions to generate main hints and backup hints to optimize the query process.
By reducing the main computational load in the preprocessing stage, the computational and communication complexity of the online query stage is reduced, maintaining sublinear complexity, significantly reducing real-time query latency, improving query efficiency, and meeting the needs of application scenarios with high response latency requirements.
Smart Images

Figure CN122020697A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data query technology, specifically to a method for querying private data. Background Technology
[0002] In existing technologies, clients can query data in a server database based on Private Function Evaluation (PFE). This evaluation allows the server to provide clients with private function values based on their inputs without disclosing the details of the private functions it holds, thus enabling privacy data queries. Simultaneously, it ensures that the client does not learn information other than the private function values, and the server does not learn the client's inputs or outputs. PFE is applicable in scenarios such as privacy-preserving medical diagnosis, financial risk control, confidential model inference, and confidential policy evaluation, where the private function itself (model, rule, or algorithm) has commercial or privacy value and requires confidentiality.
[0003] However, while the above methods for querying private data have broad applicability, they require transforming the privacy function into a general-purpose circuit for evaluation, resulting in a large circuit size and a sharp increase in communication and computational complexity. These methods are often inefficient and unsuitable for practical applications, especially in scenarios with large privacy functions or high latency requirements. Summary of the Invention
[0004] This application provides a privacy data query method to address the technical problem that existing privacy data query methods often suffer from high communication and computational complexity, resulting in low efficiency and difficulty in meeting practical application needs in scenarios with large privacy function sizes or high requirements for response latency.
[0005] This application provides a method for querying privacy data, including: During the offline preprocessing stage, the control server and client complete the main computing load, and obtain the first initial private state of the server and the second initial private state of the client. During the online query phase, the client, which is in the first initial private state, is controlled to perform a privacy data query on the server, which is in the second initial private state.
[0006] In one embodiment, the server's first initial private state is obtained based on the following method: The server is controlled to initialize a homomorphic encryption scheme and obtain a secret key; The server is controlled to create a query table for its own data and convert the query table into a query matrix. The server is controlled to perform block encryption on the query matrix to obtain an encrypted database; The private functions held by the server and the secret key are used as the first initial private state of the server.
[0007] In one embodiment, the client's second initial private state is obtained based on the following method: Control the client to sample the prompt key and generate a mask key; The client is controlled to perform a prompt-based initialization operation to obtain initialization parameters; The client is controlled to obtain the encrypted database of the server in a streaming download manner; For each data block in the encrypted database, the client is controlled to calculate the main hint and backup hint for the data block based on the hint key and the initialization parameters, thereby obtaining the main hint set and backup hint set of the encrypted database; The prompt key, the mask key, the main prompt set, and the backup prompt set are used as the second initial private state of the client.
[0008] In one embodiment, the initialization parameters include a prompt index, a block threshold, an additional index, and a checksum; controlling the client to perform the prompt initialization operation to obtain the initialization parameters includes: Initialize the suggestion index; the suggestion index includes a primary suggestion index and a backup suggestion index; For each of the aforementioned hint indices, a selection value for each data block in the encrypted database is generated based on the pseudo-random function corresponding to the hint key; The median of the selected values is determined as the block threshold; For each of the main hint indices, a block number is generated based on the pseudo-random function corresponding to the hint key; If the selection value corresponding to the block number is greater than or equal to the block threshold, return to the step of generating a block number based on the pseudo-random function corresponding to the prompt key, until the selection value corresponding to the block number is less than the block threshold; Based on the current block number, generate an additional index corresponding to the main prompt index; Initialize a plaintext value as the check value corresponding to the main prompt index; For each of the aforementioned backup hint indices, an empty value is used as the additional index corresponding to the backup hint index, and two plaintext values are initialized as the two check values corresponding to the backup hint index.
[0009] In one embodiment, the main hint of the data block is obtained based on the following method: For each of the main hint indices, a selection value for the data block corresponding to the main hint index in the encrypted database is generated based on the pseudo-random function corresponding to the hint key. If the selected value is less than the block threshold, the polynomial coefficients of the data block are shifted; Based on homomorphic addition, the shifted polynomial coefficients are superimposed on the check value corresponding to the main prompt index to obtain the main prompt check value; The main hint index, the block threshold, the additional index corresponding to the main hint index, and the main hint check value are determined as the main hint of the data block.
[0010] In one embodiment, the backup hint for the data block is obtained based on the following method: For each of the aforementioned backup hint indexes, a selection value for the data block corresponding to the backup hint index in the encrypted database is generated based on the pseudo-random function corresponding to the hint key. The polynomial coefficients of the data block are shifted; If the selected value is less than the block threshold, the shifted polynomial coefficients are superimposed on a check value corresponding to the backup hint index based on homomorphic addition to obtain the first backup hint check value. If the selected value is greater than or equal to the block threshold, the shifted polynomial coefficients are superimposed on another check value corresponding to the backup hint index based on homomorphic addition to obtain a second backup hint check value. The backup hint index, the block threshold, the first backup hint check value, and the second backup hint check value are determined as backup hints for the data block.
[0011] In one embodiment, controlling the client in the first initial private state to perform a privacy data query on the server in the second initial private state includes: The client is controlled to generate a query request and send the query request to the server; The server is controlled to calculate the result value based on the query request and return the result value to the client; The client is controlled to determine the final query result based on the result value; The client is controlled to update the main prompt based on unused alternative prompts.
[0012] In one embodiment, controlling the client to generate a query request includes: For the block number corresponding to the query index, a selection value for the corresponding data block in the encrypted database is generated based on the pseudo-random function corresponding to the hint key; Based on the selected values, find the target main prompt; If the search is successful, determine the real index set and the fake index set corresponding to the target main prompt; Update the real index set and the fake index set; A random mask polynomial is generated based on the pseudo-random function corresponding to the mask key. Based on homomorphic addition, the random mask polynomial is superimposed on the main prompt check value in the target main prompt to obtain the main prompt check value ciphertext; The positions of the updated real index set and the updated fake index set are randomly swapped with a preset probability. A query request is generated based on the updated real index set and the updated fake index set before and after the location swap, as well as the encrypted main prompt verification value.
[0013] In one embodiment, controlling the server to calculate the result value based on the query request includes: Based on the secret key, the ciphertext of the main prompt verification value in the query request is decrypted to obtain the plaintext polynomial; Based on the constant term of the plaintext polynomial and the private function, calculate the first plaintext result value corresponding to the updated real index set and the second plaintext result value corresponding to the updated fake index set.
[0014] In one embodiment, controlling the client to determine the final query result based on the result value includes: Based on the updated set of real indexes, the first plaintext result value is selected from the first plaintext result value and the second plaintext result value; Based on the pseudo-random function corresponding to the mask key, calculate the constant term of the random mask polynomial; Based on the constant term, the mask effect in the first plaintext result value is removed to obtain the final query result.
[0015] The privacy data query method provided in this application, in the offline preprocessing stage, controls the server and client to complete the main computational load, obtaining the server's first initial private state and the client's second initial private state. In the online query stage, the client, in the first initial private state, is controlled to perform the privacy data query while the server is in the second initial private state. This application utilizes the preprocessing stage to complete the main computational load for both the client and server, making the computation and communication complexity of the privacy function in the online query stage increase sublinearly, maintaining the sublinear complexity of the online query stage. This significantly reduces the latency of real-time queries and improves the efficiency of real-time queries while ensuring bidirectional privacy protection between the client and server. Therefore, it can meet the practical application needs in scenarios with large privacy function sizes or high requirements for response latency. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in this application 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 application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is one of the flowcharts illustrating the privacy data query method provided in the embodiments of this application; Figure 2 This is a second schematic flowchart of the privacy data query method provided in the embodiments of this application; Figure 3 This is the third flowchart illustrating the privacy data query method provided in the embodiments of this application; Figure 4 This is the fourth flowchart illustrating the privacy data query method provided in this application embodiment; Figure 5 This is the fifth flowchart illustrating the privacy data query method provided in the embodiments of this application; Figure 6 This is the sixth flowchart illustrating the privacy data query method provided in this application embodiment; Figure 7 This is the seventh flowchart illustrating the privacy data query method provided in the embodiments of this application; Figure 8 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] It should be noted that in the description of the embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. The terms "upper," "lower," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Unless otherwise expressly specified and limited, the terms "installed," "connected," and "linked" should be interpreted broadly, for example, they can be fixed connections, detachable connections, or integral connections; they can be mechanical connections or electrical connections; they can be direct connections or indirect connections through an intermediate medium; and they can be internal connections between two elements. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0020] The terms "first," "second," etc., used in this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects have an "or" relationship.
[0021] Figure 1 This is one of the flowcharts illustrating the privacy data query method provided in this application. (Refer to...) Figure 1 This application provides a method for querying privacy data, which may include: Step 101: In the offline preprocessing stage, control the server and client to complete the main computing load and obtain the server's first initial private state and the client's second initial private state; Step 102: During the online query phase, control the client in the first initial private state to perform privacy data query on the server in the second initial private state.
[0022] Assume the server has a size of The database, that is, the database includes The client wants to configure privacy functions for each data record. Perform multiple calculations, with the range from 0 to... The plaintext space of the homomorphic encryption scheme used is Then it can make , ,in, For plaintext modulus, Parameters used to ensure query accuracy.
[0023] Under the above assumptions, privacy data query can be divided into an offline preprocessing stage and an online query stage. In the offline preprocessing stage, the above assumptions can be used to control the server and client to complete their respective main computing loads and necessary interactions, so that the server and client are in an initial private state waiting for the query. Thus, after entering the online query stage, the server and client can accelerate the query process based on their respective initial private states, effectively improving real-time query efficiency.
[0024] The privacy data query method provided in this embodiment controls the server and client to complete the main computational load in the offline preprocessing stage, obtaining the server's first initial private state and the client's second initial private state. In the online query stage, the client in the first initial private state is controlled, while the server in the second initial private state performs the privacy data query. In this embodiment, by utilizing the preprocessing stage to complete the main computational load of the client and server, the computation and communication complexity of the privacy function in the online query stage both increase sublinearly, maintaining the sublinear complexity of the online query stage. This significantly reduces the latency of real-time queries and improves the efficiency of real-time queries while ensuring bidirectional privacy protection between the client and server. Therefore, it can meet the practical application needs in scenarios with large privacy function sizes or high requirements for response latency.
[0025] Figure 2 This is a second schematic flowchart of the privacy data query method provided in the embodiments of this application. (Refer to...) Figure 2 In one embodiment, step 101 may include: Step 201: The control server initializes the homomorphic encryption scheme and obtains the secret key; Step 202: The control server establishes a query table for its own data and converts the query table into a query matrix; Step 203: The control server performs block encryption on the query matrix to obtain an encrypted database; Step 204: Set the private functions and secret keys held by the server as the server's first initial private state.
[0026] In step 201, in this homomorphic encryption scheme, the secret key can be hsk, i.e., a hardware security key, used for subsequent homomorphic encryption, and the plaintext space is... .
[0027] In step 202, that is, to create a system containing... lookup table of elements and transform it into a The query matrix.
[0028] In step 203, each row of the query matrix can be encoded with coefficients and then encrypted using the secret key hsk. Each row becomes a data block, thus obtaining each data block. ciphertext These ciphertexts constitute an encrypted database.
[0029] In step 204, the private function held by the server is the privacy function. This privacy function and the secret key are used as the server's first initial private state. .
[0030] In this embodiment, a corresponding query table is established based on the database size, and privacy functions are pre-stored in tabular form. The input and output pairs are processed, and the lookup table is converted into a lookup matrix for easier block encryption. Finally, the privacy function is applied. The secret key hsk serves as the server's initial private state, allowing privacy functions to be used during subsequent query phases. It switches to a search method for fast retrieval and calculation, and obtains the decrypted query results based on the secret key hsk.
[0031] Figure 3 This is the third flowchart illustrating the privacy data query method provided in this application's embodiments. (Refer to...) Figure 3 In one embodiment, step 101 may include: Step 301: Control the client to sample the prompt key and generate the mask key; Step 302: Control the client to perform the prompted initialization operation and obtain the initialization parameters; Step 303: Control the client to obtain the server's encrypted database in a streaming download manner; Step 304: For each data block in the encrypted database, the control client calculates the main hint and backup hint for the data block based on the hint key and initialization parameters, thereby obtaining the main hint set and backup hint set of the encrypted database; Step 305: Set the prompt key, mask key, main prompt set, and backup prompt set as the client's second initial private state.
[0032] In step 301, the hint key can be represented as The mask key is used to generate prompts later and can be represented as: This is used for subsequent data queries. In step 302, the prompts can be divided into main prompts and backup prompts. The prompt initialization operation involves performing the main prompt initialization operation and the backup prompt initialization operation respectively to obtain the initialization parameters corresponding to the main prompt and the initialization parameters corresponding to the backup prompt.
[0033] In steps 303 to 304, for each data block, there is a primary hint and a backup hint. The primary hint for the data block can be obtained based on the hint key and the initialization parameters corresponding to the primary hint. Similarly, the backup hint for the data block can be obtained based on the hint key and the initialization parameters corresponding to the backup hint. It should be noted that after each data block is processed, the client can delete the processed data to reduce local storage overhead.
[0034] Perform the above operations on all data blocks to obtain the master hint set of the encrypted database. and a set of backup tips .
[0035] In step 305, for the client, its second initial private state .
[0036] It should be noted that a common reference string for the server and client can also be defined, which includes common parameters of a homomorphic encryption scheme based on RLWE (Ring Learning With Errors) for protocol initialization and subsequent calculations.
[0037] In this embodiment, the control client samples the prompt key, generates the mask key, calculates the main prompt set and the backup prompt set, and then uses the prompt key, mask key, main prompt set and backup prompt set as the client's second initial private state, which facilitates the efficient querying of private data in the server by providing these states later.
[0038] Figure 4 This is the fourth flowchart illustrating the privacy data query method provided in this application's embodiments. (Refer to...) Figure 4 In one embodiment, the initialization parameters include a hint index, a block threshold, an additional index, and a checksum; step 302 may include: Step 401: Initialize the hint index; The suggestion index includes a primary suggestion index and a secondary suggestion index; Step 402: For each hint index, generate a selection value for each data block in the encrypted database based on the pseudo-random function corresponding to the hint key; Step 403: Determine the median of the selected values as the block threshold; Step 404: For each main hint index, generate a block number based on the pseudo-random function corresponding to the hint key; Step 405: If the selection value corresponding to the block number is greater than or equal to the block threshold, return to step 404; Step 406: If the selection value corresponding to the block number is less than the block threshold, generate an additional index corresponding to the main prompt index based on the block number at this time. Step 407: Initialize a plaintext value as the checksum corresponding to the main prompt index; Step 408: For each backup hint index, use null as the additional index corresponding to the backup hint index, and initialize two plaintext values as the two check values corresponding to the backup hint index.
[0039] In step 401, the main prompt index can be initialized to... Initialize the backup hint index to ; in, , .
[0040] In step 402, the key is prompted. The corresponding pseudo-random function can be expressed as: This pseudo-random function will utilize Encrypt the input; for convenience, it can be done later. replace; Then for each hint index Each data block can be generated based on the following formula. Choice value Then the set of selected values for all data blocks can be .
[0041] In step 403, that is, in Select median As a block threshold.
[0042] In steps 404 to 406, that is, when At that time, a block number can be generated based on the following formula. : ; If the conditions are not met If the condition is met, return to step 404 to continue generating new block numbers until the condition is met. Then, the main suggestion index can be generated based on the following formula. Corresponding additional index : ; This additional index For a set that does not belong to Random index in random blocks.
[0043] In step 407, the checksum corresponding to the main prompt index can be represented as: .
[0044] In step 408, that is, when At that time, alternative prompt index Corresponding additional index It is a null value; Furthermore, the two checksums corresponding to this backup hint index can be represented as follows: .
[0045] In this embodiment, the main prompt index and its corresponding check value are initialized, the backup prompt index and its corresponding check value are initialized, and the block threshold and the additional index corresponding to the main prompt index are generated based on the pseudo-random function corresponding to the prompt key. The additional index corresponding to the backup index is set to null. Thus, the main prompt index, block threshold, additional index and check value corresponding to the main prompt, and the backup prompt index, block threshold and check value corresponding to the backup prompt can be obtained respectively, laying the foundation for the subsequent generation of the main prompt and backup prompt.
[0046] Figure 5 This is the fifth flowchart illustrating the privacy data query method provided in this application's embodiments. (Refer to...) Figure 5 In one embodiment, step 304 may include: Step 501: For each master hint index, generate a selection value for the data block corresponding to that master hint index in the encrypted database based on the pseudo-random function corresponding to the hint key; Step 502: If the selected value is less than the block threshold, shift the polynomial coefficients of the data block. Step 503: Based on homomorphic addition, the shifted polynomial coefficients are superimposed on the check value corresponding to the main prompt index to obtain the main prompt check value; Step 504: Determine the main hint index, block threshold, additional index corresponding to the main hint index, and main hint check value as the main hint for the data block.
[0047] In step 501, that is, for each main prompt index... The corresponding data block is generated based on the following formula. Choice value : ; In step 502, that is At that time, for data blocks The polynomial coefficients are shifted to obtain the shifted polynomial coefficients. ; in, This is the offset. .
[0048] In step 503, the main prompt verification value It can be obtained based on the following formula: ; in, This is a homomorphic addition operation.
[0049] In step 504, i.e., the data block The main prompt can be: ; By performing the above steps on all data blocks, you can obtain the master hint set of the encrypted database.
[0050] In this embodiment, for each master hint index, a final master hint check value is constructed through pseudo-random function encryption, coefficient shifting, and homomorphic addition. This check value is then combined with the master hint index, block threshold, and additional index corresponding to the master hint index to form the master hint. This allows the master hint to possess multiple encrypted information about the data block, enabling effective table queries of private data in subsequent operations. This significantly reduces communication and computational overhead and supports high-frequency calls to large-scale functions. Based on the lightweight encryption mechanism of homomorphic addition, the shifted coefficients are superimposed on the check value corresponding to the master hint index to obtain the master hint check value. This avoids the high computational cost of traditional FHE (Fully Homomorphic Encryption), thus maintaining high performance in large-scale table lookup scenarios.
[0051] Figure 6 This is the sixth flowchart illustrating the privacy data query method provided in this application. (Refer to...) Figure 6 In one embodiment, step 304 may include: Step 601: For each backup hint index, based on the pseudo-random function corresponding to the hint key, generate the selection value of the data block corresponding to the backup hint index in the encrypted database; Step 602: Shift the polynomial coefficients of the data block; Step 603: When the selected value is less than the block threshold, based on homomorphic addition, the shifted polynomial coefficients are superimposed on a check value corresponding to the backup hint index to obtain the first backup hint check value. Step 604: When the selected value is greater than or equal to the block threshold, based on homomorphic addition, the shifted polynomial coefficients are superimposed on another check value corresponding to the backup hint index to obtain the second backup hint check value. Step 605: Determine the backup hint index, block threshold, first backup hint check value, and second backup hint check value as the backup hint for this data block.
[0052] In step 601, that is, for each alternative hint index... The corresponding data block is generated based on the following formula. Choice value : ; In step 602, that is, for the data block The polynomial coefficients are shifted to obtain the shifted polynomial coefficients. ; in, ; In steps 603 to 604, that is At that time, the first backup prompt verification value It can be obtained based on the following formula: ; At that time, the second backup prompt verification value It can be obtained based on the following formula: ; In step 605, i.e., the data block The alternative prompts can be: ; By performing the above steps on all data blocks, you can obtain a set of alternative hints for the encrypted database.
[0053] It should be noted that an additional bit value can be appended to each primary hint and each backup hint. These bits are used to indicate whether the "less than" operator needs to be redefined as "greater than" in comparison operations. During initialization, these bits are all set to 0.
[0054] In this embodiment, for each backup hint index, a final pair of backup hint verification values is constructed through pseudo-random function encryption, coefficient shifting, and homomorphic addition. These verification values are then combined with the backup hint index and the block threshold to form a backup hint. This allows the backup hint to possess multiple encrypted information about the data block, effectively assisting in subsequent table queries of privacy data, effectively reducing communication and computational overhead, and supporting high-frequency calls to large-scale functions. Based on the lightweight encryption mechanism of homomorphic addition, the coefficient is superimposed on the verification value corresponding to the backup hint index to obtain the backup hint verification value. This avoids the high computational cost of traditional FHE, thus enabling the protocol to maintain high performance in large-scale table lookup scenarios.
[0055] Figure 7 This is the seventh flowchart illustrating the privacy data query method provided in this application. (Refer to...) Figure 7 In one embodiment, step 102 may include: Step 701: Control the client to generate a query request and send the query request to the server; Step 702: The control server calculates the result value based on the query request and returns the result value to the client; Step 703: Control the client to determine the final query result based on the result value; Step 704: Control the client to update the main prompt based on unused alternative prompts.
[0056] When the client executes the... Query (of which At this time, the client and server jointly execute the online evaluation protocol based on their current private state. Specifically, the client at the [timeframe]... The status after the query is and holds the input value of this query. The server is in the The status after the query is Both parties execute the corresponding protocol procedures based on the above state to complete the evaluation of the privacy function. For ease of explanation, where the context is clear, the following description will use the following terms: replace To elaborate.
[0057] Specifically, step 701 may include: Step 701a: For the block number corresponding to the query index, generate the selection value of the corresponding data block in the encrypted database based on the pseudo-random function corresponding to the hint key; Step 701b: Find the target main prompt based on the selected value; Step 701c: If the search is successful, determine the real index set and fake index set corresponding to the target main prompt; Step 701d: Update the real index set and the fake index set; Step 701e: Generate a random mask polynomial based on the pseudo-random function corresponding to the mask key; Step 701f: Based on homomorphic addition, the random mask polynomial is superimposed onto the main prompt check value in the target main prompt to obtain the ciphertext of the main prompt check value; Step 701g: Randomly swap the positions of the updated real index set and the updated fake index set with a preset probability; Step 701h: Based on the updated real index set and the updated fake index set before and after the location swap, as well as the ciphertext of the main hint verification value, generate a query request.
[0058] In steps 701a to 701b, the index is queried. The corresponding block number can be represented as ,in, For block numbering functions; based on After generating the selection value for the corresponding data block, you can search for the target master hint, which must meet any of the following conditions: 1. Query index ; 2. Simultaneously satisfy and ,in , .
[0059] In step 701c, if the search is successful, two empty sets are first initialized. and ; Subsequently, for : 1. If satisfied ,but ; 2. If satisfied ,but ; 3. If neither of the above two conditions is met, then .
[0060] Thus, what was obtained The actual set of indexes corresponding to the target main suggestion is obtained. The set of fake indexes corresponding to the target main prompt is constructed by randomly selecting an index from each block not covered by 𝑆.
[0061] In step 701d, the following formulas can be used to respectively... and Update: ; ; In step 701e, the mask key The corresponding pseudo-random function can be expressed as: This pseudo-random function will utilize Encrypt the input; for convenience, it can be done later. Instead, the nth coefficient of the random mask polynomial can be obtained based on the following formula. This generates the random mask polynomial. ,in, Indicates The polynomial quotient ring is a modulus.
[0062] In step 701f, the ciphertext of the main prompt verification value can be obtained based on the following formula. : ; In steps 701g to 701h, the preset probability can be set based on actual needs and is not limited here. In this embodiment, the preset probability can be set to 1 / 2, which will generate a query request. or .
[0063] It should be noted that in the event of a failed search, you can... The block is divided into two equal-sized subsets, and for each subset... In each block of the subset, an index is randomly selected to construct the set. Subsequently, a random RLWE ciphertext was independently sampled. Received query request .
[0064] Step 702 may include: Step 702a: Based on the secret key, decrypt the ciphertext of the main prompt verification value in the query request to obtain the plaintext polynomial; Step 702b: Based on the constant term of the plaintext polynomial and the private function, calculate the first plaintext result value corresponding to the updated real index set and the second plaintext result value corresponding to the updated fake index set.
[0065] In step 702a, the query request received by the server is recorded as... For The server uses its secret key hsk to encrypt RLWE text. Decryption yields the plaintext polynomial. .
[0066] In step 702b, the first plaintext result value and the second plaintext result value can be calculated based on the following formulas: ; in, , for The constant term, and: ; in, is the constant term of the random mask polynomial.
[0067] Ultimately, two plaintext results were obtained. .
[0068] Step 703 may include: Step 703a: Based on the updated real index set, select the first plaintext result value from the first plaintext result value and the second plaintext result value; Step 703b: Calculate the constant term of the random mask polynomial based on the pseudo-random function corresponding to the mask key; Step 703c: Based on the constant term, remove the masking effect from the first plaintext result value to obtain the final query result.
[0069] In step 703a, the client receives Then, based on sets Sure Which of the following is the first plaintext result value? Record this first plaintext result value as... .
[0070] In step 703b, the constant term of the random mask polynomial can be calculated based on the following formula. : ; In step 703c, the following formula can be used to remove... The masking effect in: ; but Recorded as the number The client can output the final query result of this query.
[0071] It should be noted that if the aforementioned search for the target fails, the query is considered invalid, and the client can output an empty result symbol ⊥.
[0072] In step 704, let... For unused backup suggestion indexes, the selection value is calculated based on the following formula. : ; like The client will then use the first backup prompt verification value corresponding to the backup prompt index. Updated to the second backup verification value and will Set it to 1 to redefine the comparison symbol "<" in the prompt as ">", meaning you need to select items that do not contain it. The checksum of the corresponding data block; If the target main hint is found, update the target main hint to... .
[0073] In this embodiment, on the one hand, by combining a random hint structure with an interactive mask decryption process, dual protection of privacy for both the client and server can be achieved without exposing the query index or function content. On the other hand, the hint update mechanism ensures that the system maintains distribution consistency and security after multiple rounds of queries, thereby significantly improving the scalability and practicality of privacy function computation. These two aspects enable security to be maintained after multiple queries, thus achieving multiple reusable queries. Moreover, a single preprocessing step can support multiple reusable queries, further improving online query efficiency. Experimental results show that, under the same security parameters, the online query speed of this embodiment is more than an order of magnitude faster than existing solutions, demonstrating excellent engineering feasibility and scalability.
[0074] Figure 8 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 8As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 can call a computer program stored in the memory 830 to execute the steps of a privacy data query method, such as including: During the offline preprocessing stage, the control server and client complete the main computing load, and obtain the first initial private state of the server and the second initial private state of the client. During the online query phase, the client, which is in the first initial private state, is controlled to perform a privacy data query on the server, which is in the second initial private state.
[0075] Furthermore, the logical instructions in the aforementioned memory 830 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 this application, in essence, 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 this application. 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.
[0076] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the steps of the privacy data query method provided in the above embodiments, such as including: During the offline preprocessing stage, the control server and client complete the main computing load, and obtain the first initial private state of the server and the second initial private state of the client. During the online query phase, the client, which is in the first initial private state, is controlled to perform a privacy data query on the server, which is in the second initial private state.
[0077] On the other hand, embodiments of this application also provide a non-transitory computer-readable storage medium storing a computer program thereon, the computer program being used to cause a processor to execute the steps of the privacy data query method provided in the above embodiments, for example including: During the offline preprocessing stage, the control server and client complete the main computing load, and obtain the first initial private state of the server and the second initial private state of the client. During the online query phase, the client, which is in the first initial private state, is controlled to perform a privacy data query on the server, which is in the second initial private state.
[0078] The non-transitory computer-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to magnetic memory (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical memory (e.g., CD, DVD, BD, HVD), and semiconductor memory (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).
[0079] 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.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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. Such 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 this application.
Claims
1. A method for querying private data, characterized in that, include: During the offline preprocessing stage, the control server and client complete the main computing load, and obtain the first initial private state of the server and the second initial private state of the client. During the online query phase, the client, which is in the first initial private state, is controlled to perform a privacy data query on the server, which is in the second initial private state.
2. The privacy data query method according to claim 1, characterized in that, The server's initial private state is obtained based on the following method: The server is controlled to initialize a homomorphic encryption scheme and obtain a secret key; The server is controlled to create a query table for its own data and convert the query table into a query matrix. The server is controlled to perform block encryption on the query matrix to obtain an encrypted database; The private functions held by the server and the secret key are used as the first initial private state of the server.
3. The privacy data query method according to claim 2, characterized in that, The client's second initial private state is obtained based on the following method: Control the client to sample the prompt key and generate a mask key; The client is controlled to perform a prompt-based initialization operation to obtain initialization parameters; The client is controlled to obtain the encrypted database of the server in a streaming download manner; For each data block in the encrypted database, the client is controlled to calculate the main hint and backup hint for the data block based on the hint key and the initialization parameters, thereby obtaining the main hint set and backup hint set of the encrypted database; The prompt key, the mask key, the main prompt set, and the backup prompt set are used as the second initial private state of the client.
4. The privacy data query method according to claim 3, characterized in that, The initialization parameters include a prompt index, a block threshold, an additional index, and a checksum; controlling the client to perform a prompt initialization operation to obtain the initialization parameters includes: Initialize the suggestion index; the suggestion index includes a primary suggestion index and a backup suggestion index; For each of the aforementioned hint indices, a selection value for each data block in the encrypted database is generated based on the pseudo-random function corresponding to the hint key; The median of the selected values is determined as the block threshold; For each of the main hint indices, a block number is generated based on the pseudo-random function corresponding to the hint key; If the selection value corresponding to the block number is greater than or equal to the block threshold, return to the step of generating a block number based on the pseudo-random function corresponding to the prompt key, until the selection value corresponding to the block number is less than the block threshold; Based on the current block number, generate an additional index corresponding to the main prompt index; Initialize a plaintext value as the check value corresponding to the main prompt index; For each of the aforementioned backup hint indices, an empty value is used as the additional index corresponding to the backup hint index, and two plaintext values are initialized as the two check values corresponding to the backup hint index.
5. The privacy data query method according to claim 4, characterized in that, The main hint for the data block is obtained based on the following method: For each of the main hint indices, a selection value for the data block corresponding to the main hint index in the encrypted database is generated based on the pseudo-random function corresponding to the hint key. If the selected value is less than the block threshold, the polynomial coefficients of the data block are shifted; Based on homomorphic addition, the shifted polynomial coefficients are superimposed on the check value corresponding to the main prompt index to obtain the main prompt check value; The main hint index, the block threshold, the additional index corresponding to the main hint index, and the main hint check value are determined as the main hint of the data block.
6. The privacy data query method according to claim 4, characterized in that, The backup hints for the data blocks were obtained based on the following method: For each of the aforementioned backup hint indexes, a selection value for the data block corresponding to the backup hint index in the encrypted database is generated based on the pseudo-random function corresponding to the hint key. The polynomial coefficients of the data block are shifted; If the selected value is less than the block threshold, the shifted polynomial coefficients are superimposed on a check value corresponding to the backup hint index based on homomorphic addition to obtain the first backup hint check value. If the selected value is greater than or equal to the block threshold, the shifted polynomial coefficients are superimposed on another check value corresponding to the backup hint index based on homomorphic addition to obtain a second backup hint check value. The backup hint index, the block threshold, the first backup hint check value, and the second backup hint check value are determined as backup hints for the data block.
7. The privacy data query method according to claim 5, characterized in that, The control of the client in the first initial private state, and the server performing privacy data queries in the second initial private state, includes: The client is controlled to generate a query request and send the query request to the server; The server is controlled to calculate the result value based on the query request and return the result value to the client; The client is controlled to determine the final query result based on the result value; The client is controlled to update the main prompt based on unused alternative prompts.
8. The privacy data query method according to claim 7, characterized in that, The control of the client to generate query requests includes: For the block number corresponding to the query index, a selection value for the corresponding data block in the encrypted database is generated based on the pseudo-random function corresponding to the hint key; Based on the selected values, find the target main prompt; If the search is successful, determine the real index set and the fake index set corresponding to the target main prompt; Update the real index set and the fake index set; A random mask polynomial is generated based on the pseudo-random function corresponding to the mask key. Based on homomorphic addition, the random mask polynomial is superimposed on the main prompt check value in the target main prompt to obtain the main prompt check value ciphertext; The positions of the updated real index set and the updated fake index set are randomly swapped with a preset probability. A query request is generated based on the updated real index set and the updated fake index set before and after the location swap, as well as the encrypted main prompt verification value.
9. The privacy data query method according to claim 8, characterized in that, The control of the server to calculate the result value based on the query request includes: Based on the secret key, the ciphertext of the main prompt verification value in the query request is decrypted to obtain the plaintext polynomial; Based on the constant term of the plaintext polynomial and the private function, calculate the first plaintext result value corresponding to the updated real index set and the second plaintext result value corresponding to the updated fake index set.
10. The privacy data query method according to claim 9, characterized in that, The process of controlling the client to determine the final query result based on the result value includes: Based on the updated set of real indexes, the first plaintext result value is selected from the first plaintext result value and the second plaintext result value; Based on the pseudo-random function corresponding to the mask key, calculate the constant term of the random mask polynomial; Based on the constant term, the mask effect in the first plaintext result value is removed to obtain the final query result.