Hidden trace query method and system, terminal equipment and computer program product
Through the homomorphic secret sharing solution, encrypting the data query request and verifying the query results of multiple data providers, the problem of not being able to verify the correctness of the query results in the prior art is solved, and the privacy protection of data query and the accuracy of the results are achieved.
Patent Information
- Application Number
- CN202411814158.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-05-02
AI Technical Summary
Existing data query methods cannot verify the correctness of the query results, resulting in the queryer making incorrect judgments based on the error information.
The homomorphic secret sharing scheme is used to generate the target key, encrypt the data query request, and send the encrypted query request to multiple data providers to verify the correctness of the target query results based on the query results returned by multiple data providers.
Homomorphic secret sharing technology not only protects the privacy of the query, but also ensures the correctness of the query results and avoids incorrect judgments caused by wrong information.
Smart Images

Figure CN119918084A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data query technology, and in particular, relates to an anonymous query method, system, terminal device and computer program product. Background Art
[0002] With the rapid development of information technology, data query and acquisition have become an indispensable part of various fields. However, there is a significant problem with existing data query methods, that is, the correctness of the query results cannot be verified. The data owner or other third party may return wrong information, which can easily lead to the queryer making wrong judgments based on the wrong information. Summary of the invention
[0003] In view of this, the embodiments of the present application provide an anonymous query method, system, terminal device and computer program product to solve the problem that the existing data query method cannot verify the correctness of the query result.
[0004] A first aspect of an embodiment of the present application provides an anonymous query method, which is applied to a data requesting end, and the method includes:
[0005] Generate a target key according to a homomorphic secret sharing scheme;
[0006] Encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request;
[0007] Sending the encrypted query request to multiple data providers respectively;
[0008] Based on the multiple query results returned by the multiple data providers, a target query result is obtained, and the correctness of the target query result is verified.
[0009] In one embodiment, the target key includes a public key and a private key; the data query request includes request data and verification data; correspondingly, the encrypted query request includes encrypted request data and encrypted verification data;
[0010] The step of encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain the encrypted query request includes:
[0011] Encrypt the request data according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted request data;
[0012] And, the verification data is encrypted according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted verification data.
[0013] In one embodiment, encrypting the request data according to the homomorphic secret sharing scheme and the public key in the target key to obtain the encrypted request data includes:
[0014] Performing binary decomposition on the request data;
[0015] Each decomposed data is encrypted according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted request data.
[0016] In one embodiment, the private key includes a plurality of partial private keys, and the plurality of partial private keys are used to be sent to the plurality of data providers;
[0017] The data provider is used for:
[0018] Receiving an encrypted query request and a corresponding partial private key sent by the data requesting end;
[0019] Calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result;
[0020] The query result is returned to the data requesting end.
[0021] In one embodiment, the query result includes a partial calculation result and target verification data;
[0022] The obtaining of a target query result based on the multiple query results returned by the multiple data providers, and verifying the correctness of the target query result, includes:
[0023] Obtain a target calculation result according to the homomorphic secret sharing scheme and multiple partial calculation results in the multiple query results returned by the multiple data providers;
[0024] The correctness of the target calculation result is verified according to multiple target verification data in the multiple query results returned by the multiple data providers.
[0025] A second aspect of the embodiment of the present application further provides another anonymous query method, which is applied to multiple data providers, and the method includes:
[0026] Receive the encrypted query request and the corresponding partial private key sent by the data requester;
[0027] Calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result;
[0028] Returning the query result to the data request end, so that the data request end obtains the target query result of the encrypted query request, and verifies the correctness of the target query result;
[0029] Wherein, the data request end is used to:
[0030] Generate a target key according to a homomorphic secret sharing scheme;
[0031] Encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request;
[0032] Sending the encrypted query request to multiple data providers respectively;
[0033] Based on the multiple query results returned by the multiple data providers, a target query result is obtained, and the correctness of the target query result is verified.
[0034] In one embodiment, the encrypted query request includes encrypted request data and encrypted verification data; the step of calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result includes:
[0035] Calculate the encryption request data according to the objective function and the partial private key to obtain a partial calculation result;
[0036] According to the partial calculation result, target verification data of the encrypted verification data is obtained.
[0037] A third aspect of the embodiments of the present application provides an anonymous query system, the system comprising a data request end and a plurality of data providing ends;
[0038] The data request end is used for:
[0039] Generate a target key according to a homomorphic secret sharing scheme;
[0040] Encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request;
[0041] Sending the encrypted query request to multiple data providers respectively;
[0042] The multiple data providers are used for:
[0043] Receiving an encrypted query request and a corresponding partial private key sent by the data requesting end;
[0044] Calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result;
[0045] Returning the query result to the data requesting end;
[0046] The data request end is also used for:
[0047] Based on the multiple query results returned by the multiple data providers, a target query result is obtained, and the correctness of the target query result is verified.
[0048] A fourth aspect of the embodiments of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the terminal device is a data requesting end, the processor implements the steps of the anonymous query method as described in the first aspect of the embodiments of the present application when executing the computer program.
[0049] When the terminal device is a data provider, the processor implements the steps of the anonymous query method as described in the second aspect of the embodiment of the present application when executing the computer program.
[0050] The fifth aspect of the embodiments of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the anonymous query method as described in the first aspect or the second aspect of the embodiments of the present application.
[0051] The sixth aspect of the embodiments of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the anonymous query method as described in the first aspect or the second aspect of the embodiments of the present application.
[0052] The first aspect of the embodiment of the present application provides an anonymous query method, which is applied to a data request end, generates a target key according to a homomorphic secret sharing scheme; encrypts the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request; sends the encrypted query request to multiple data providers respectively; obtains a target query result based on multiple query results returned by multiple data providers, and verifies the correctness of the target query result. The embodiment of the present application is based on homomorphic secret sharing technology, which can not only protect the privacy of the inquirer from being leaked when querying data, but also verify the query results to ensure the correctness of the query results.
[0053] The second aspect of the embodiment of the present application provides an anonymous query method, which is applied to multiple data providers, by receiving an encrypted query request and a corresponding partial private key sent by a data request terminal; calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result; returning the query result to the data request terminal; wherein the data request terminal is used to: generate a target key according to a homomorphic secret sharing scheme; encrypt the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request; send the encrypted query request to multiple data providers respectively; obtain a target query result based on multiple query results returned by multiple data providers, and verify the correctness of the target query result. The embodiment of the present application is based on homomorphic secret sharing technology, which can not only protect the privacy of the inquirer from being leaked when querying data, but also verify the query results to ensure the correctness of the query results.
[0054] It can be understood that the beneficial effects of the third to sixth aspects mentioned above can be found in the relevant descriptions in the first or second aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0056] Figure 1 This is a flow chart of the first anonymous query method provided by the embodiment of the present application;
[0057] Figure 2 This is another flow chart of the first anonymous query method provided in the embodiment of the present application;
[0058] Figure 3 This is a flow chart of a second anonymous query method provided in an embodiment of the present application;
[0059] Figure 4 It is a schematic diagram of the structure of the anonymous query system provided in the embodiment of the present application;
[0060] Figure 5 It is a structural diagram of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0062] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0063] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0064] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. "Multiple" means "two" or "more than two".
[0065] With the rapid development of information technology, data query and acquisition have become an indispensable part of various fields. However, there is a significant problem with existing data query methods, that is, the correctness of the query results cannot be verified. The data owner or other third party may return wrong information, which can easily lead to the queryer making wrong judgments based on the wrong information.
[0066] For example, in the field of medical information query, when patients or medical researchers query research data on treatment plans for certain rare diseases, clinical trial results and other information, the accuracy of the results is related to life, health and scientific research direction. If the accuracy of the query results cannot be guaranteed, researchers may conduct research based on false data, wasting a lot of resources.
[0067] For example, when an enterprise queries the cost data, marketing data and other information of the products of other similar enterprises, if the query results are inaccurate, it may cause the enterprise to formulate wrong development strategies, affecting the survival and development of the enterprise.
[0068] Based on this, the embodiments of the present application provide an anonymous query method, system, terminal device and computer program product, which, based on homomorphic secret sharing technology, can not only protect the privacy of the inquirer from being leaked when querying data, but also verify the query results to ensure the correctness of the query results.
[0069] In the embodiment of the present application, the homomorphic secret sharing technology can be regarded as a combination of the secret sharing technology and the fully homomorphic encryption technology. For example, the data x is encrypted into the homomorphic secret sharing ciphertext C x , based on homomorphic secret sharing technology, unlimited addition operations and restricted multiplication operations can be performed on the ciphertext.
[0070] The above-mentioned secret sharing technology allows a secret (e.g., a private key) to be split into multiple shares and distributed to different parties. The original secret can only be restored when a sufficient number of parties cooperate. This mechanism ensures that a single party cannot obtain the complete secret alone, thereby enhancing security.
[0071] The fully homomorphic encryption technology described above allows arbitrarily complex calculations to be performed on encrypted data without decrypting the data; the calculation results remain encrypted, and only those with the decryption key can decrypt and obtain the final result.
[0072] Compared with secret sharing technology, the homomorphic secret sharing technology provided in the embodiment of the present application does not require the computing servers to communicate with each other, eliminating communication overhead and the threat of collusion between servers; compared with fully homomorphic encryption technology, the homomorphic secret sharing technology provided in the embodiment of the present application reduces computing overhead by introducing additional servers.
[0073] Embodiment 1
[0074] like Figure 1 As shown, the embodiment of the present application provides an anonymous query method, which is applied to a data requesting end and includes the following steps S1 to S4:
[0075] Step S1, generate a target key according to the homomorphic secret sharing scheme, and proceed to step S2.
[0076] In the application, the homomorphic secret sharing scheme includes but is not limited to the additive homomorphic secret sharing scheme and the subtractive homomorphic secret sharing scheme. In the embodiment of the present application, the selected homomorphic secret sharing scheme can be denoted as E.
[0077] In the application, the data request end includes but is not limited to mobile phones, tablets, smart wearable devices, laptops and other devices.
[0078] In the application, the target key generated by the data request end based on the homomorphic secret sharing scheme includes a public key and a private key. After the target key is generated, the public key in the target key is retained for encrypting the data query request; based on the number n of data providers, the private key is randomly divided into n parts, and each part is sent to a data provider. For example, when there are two data providers, the private key can be randomly divided into two parts, and a part of the private key is sent to each data provider. It can be understood that the number n of data providers is an integer greater than or equal to 2.
[0079] For example, there are two data providers, denoted as S1 and S2 respectively, and the private key is randomly divided into two parts, denoted as ek1 and ek2 respectively. At this time, ek1 can be sent to data provider S1 and ek2 can be sent to data provider S2, or ek1 can be sent to data provider S2 and ek2 can be sent to data provider S1, and there is no limitation here.
[0080] It should be noted that, in each data provider, a complete database is stored, denoted as DB, and DB includes N data items, which can be specifically expressed as DB=(DB1, DB2, ..., DB N ).
[0081] Step S2: Encrypt the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request, and proceed to step S3.
[0082] In one embodiment, the data query request includes request data and verification data; correspondingly, the encrypted query request includes encrypted request data and encrypted verification data.
[0083] In the application, in order to realize the verifiability of the anonymous query results, the data query request includes two parts: request data and verification data. The request data is the data entered by the user, denoted by x, which can be denoted by C after encryption. x The verification data can be a number randomly input by the user or a number randomly selected by the data requester, denoted as A. The encrypted verification data A can be denoted as C. A .
[0084] In one embodiment, step S2 specifically includes the following steps S21 and S22:
[0085] Step S21, encrypting the request data according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted request data;
[0086] Step S22: Encrypt the verification data according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted verification data.
[0087] It should be noted that there is no order of precedence between step S21 and step S22, that is, step S21 can be executed first to encrypt the request data, and then step S22 can be executed to encrypt the verification data; or step S22 can be executed first to encrypt the verification data, and then step S21 can be executed to encrypt the request data; or step S21 and step S22 can be executed at the same time, which is not limited here.
[0088] In one embodiment, step S21 specifically includes:
[0089] Performing binary decomposition on the request data;
[0090] Each decomposed data is encrypted according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted request data.
[0091] In the application, the data requester wants to query a specific data item from the data provider, but does not want to disclose the specific index (i, 0≤i≤N) of the queried data item. Therefore, the data requester can use the aforementioned homomorphic secret sharing scheme to encrypt the index (i), specifically including:
[0092] The index (i) is decomposed into binary form bin(i) = (i1,…,i logn ); For example, assuming N = 8, the binary representation of index i = 5 is bin(5) = (1, 0, 1);
[0093] Use the homomorphic secret sharing scheme and the public key to encrypt each binary item after decomposition, and finally get a set of ciphertext
[0094] Step S3: Send the encrypted query request to multiple data providers respectively, and then proceed to step S4.
[0095] In the application, the request data and verification data are encrypted to obtain encrypted request data and encrypted verification data, that is, after the data query request is encrypted to obtain an encrypted query request, the encrypted query request is sent to each data provider respectively, so that the data provider can calculate the encrypted query request and return it to the data requester after obtaining the corresponding query result.
[0096] In the application, after the target key is generated, part of the private key can be sent to the data provider first, and after obtaining the encrypted query request, the encrypted query request can be sent to the data provider. Alternatively, after obtaining the encrypted query request, the corresponding private key and the encrypted query request can be sent to the data provider together. This is just an example and is not limited to this.
[0097] In one embodiment, the data provider is used to:
[0098] Receiving an encrypted query request and a corresponding partial private key sent by the data requesting end;
[0099] Calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result;
[0100] The query result is returned to the data requesting end.
[0101] In the application, the data provider includes but is not limited to servers, cloud platforms, and other devices that can be used to provide data.
[0102] In the application, after receiving the corresponding partial private key and encrypted query request, each data provider directly calculates according to the objective function without decrypting the data, and finally obtains a calculation result and the corresponding target verification data and returns it to the data request end, so that the data request end can obtain the final query result and verify it, thereby ensuring the correctness of the query result.
[0103] Specifically, after each data provider receives the corresponding partial private key and encrypted query request, it calculates the following function:
[0104]
[0105] in, Represents the encrypted binary item, DB j Represents the jth data item in the database DB, j k Represents the binary item of the j-th data.
[0106] It should be noted that the calculation of the above function only involves the multiplication of the constant and the ciphertext ( and ), subtraction of constant and ciphertext And the multiplication of ciphertext and ciphertext (the continuous multiplication term in the above function ∏, that is, ).
[0107] Specifically, when multiplying a constant with a ciphertext, simply multiply the ciphertext by the constant. Since homomorphic secret sharing schemes usually involve large integer operations, the calculation result may be very large. Therefore, it is necessary to perform a modulo operation on the result of multiplying the ciphertext by the constant. The modulus is a public parameter in the public key. The modulo operation ensures that the result is still within the encryption space and maintains the homomorphic property.
[0108] When subtracting a constant from a ciphertext, you need to first multiply the ciphertext and the private key to get a calculated share of the ciphertext, and then multiply the constant and the share (just multiply the share by the constant). Similarly, after getting the calculation result, perform a modulus operation, and the modulus is a public parameter in the public key.
[0109] When multiplying ciphertexts, you need to first multiply the first ciphertext and the private key to obtain a calculated share of the first ciphertext, and then multiply the second ciphertext and the share. Similarly, after obtaining the calculation result, perform a modulus operation. The modulus is a public parameter in the public key.
[0110] It is understandable that each data provider can obtain a corresponding calculation result by calculating the above function. For example, the calculation result obtained by the data provider S1 can be recorded as 1. The calculation result obtained by the data provider S2 can be recorded as 2.
[0111] In the application, after each data provider obtains the corresponding calculation result, it can also compare it with the encrypted verification data C A Multiply them together to obtain the target verification data, so that the data request end can verify the final query result to ensure the accuracy of the query result. For example, the target verification data obtained by the data provider S1 can be expressed as<A·P> 1. The target verification data obtained by the data provider S2 can be expressed as<A·P> 2.
[0112] Step S4: obtaining a target query result based on the multiple query results returned by the multiple data providers, and verifying the correctness of the target query result.
[0113] In one embodiment, the query result includes partial calculation results and target verification data.
[0114] In the application, based on the query results returned by each data provider, the data requester can reconstruct the target calculation results of the requested data through the properties of the homomorphic secret sharing scheme it chooses, and verify the correctness of the target calculation results through the target verification data.
[0115] In one example, if Figure 2 As shown, step S4 specifically includes the following steps S41 and S42:
[0116] Step S41, obtaining a target calculation result according to the homomorphic secret sharing scheme and multiple partial calculation results in the multiple query results returned by the multiple data providers;
[0117] Step S42: verify the correctness of the target calculation result according to the multiple target verification data in the multiple query results returned by the multiple data providers.
[0118] In the application, taking two data providers S1 and S2 as an example, the query result returned by the data provider S1 is ( 1,<A·P> 1), the query result returned by the data provider S2 is ( 2,<A·P> 2); If the data request end uses an additive homomorphic secret sharing scheme, the reconstructed target calculation result can be expressed as DB i = 1+ 2; At this time, if A·DB i =<A·P> 1+<A·P> 2, it indicates that the target calculation result is correct, otherwise, it indicates that the target calculation result is wrong. Correspondingly, if the data request end uses a subtractive homomorphic secret sharing scheme, the reconstructed target calculation result can be expressed as DB i = 2- 1. At this time, if A·DB i =<A·P> 2-<A·P> 1, it indicates that the target calculation result is correct, otherwise, it indicates that the target calculation result is wrong.
[0119] It should be noted that in the above embodiment, two data providers are taken as an example to explain the contents of the present application. For the case where there are more than two data providers, the contents are similar to the above contents and will not be repeated here.
[0120] The embodiment of the present application is based on the selected homomorphic secret sharing scheme, which can not only realize the data anonymous query of the data request end, but also verify the correctness of the query result, thereby ensuring the correctness of the query result.
[0121] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0122] Embodiment 2
[0123] like Figure 3 As shown, the embodiment of the present application also provides another anonymous query method, which is applied to multiple data providers, including the following steps S5 to S7:
[0124] Step S5, receiving the encrypted query request and the corresponding partial private key sent by the data requesting end;
[0125] Step S6: Calculate the encrypted query request according to the target function and the partial private key to obtain a corresponding query result;
[0126] Step S7: Return the query result to the data request end, so that the data request end obtains the target query result of the encrypted query request and verifies the correctness of the target query result.
[0127] Wherein, the data request end is used to:
[0128] Generate a target key according to a homomorphic secret sharing scheme;
[0129] Encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request;
[0130] Sending the encrypted query request to multiple data providers respectively;
[0131] Based on the multiple query results returned by the multiple data providers, a target query result is obtained, and the correctness of the target query result is verified.
[0132] In the application, the number of data providers is denoted as n, where n is an integer greater than or equal to 2. In each data provider, a complete database is stored, denoted as DB, which includes N data items, which can be specifically expressed as DB = (DB1, DB2, ..., DB N ), the data queried by the data request end is the data in the database DB.
[0133] In the application, the data request end includes but is not limited to mobile phones, tablets, smart watches, laptops and other devices.
[0134] In the application, after the data request end generates a public key and a private key based on the homomorphic secret sharing scheme, the public key is retained for encrypting the data query request; based on the number n of data providers, the private key is randomly divided into n parts, and each part is sent to a data provider. For example, when there are 3 data providers, the private key can be randomly divided into three parts, and a part of the private key is sent to each data provider.
[0135] In the application, the data request end encrypts the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request; the encrypted query request is sent to each data provider respectively; each data provider calculates the encrypted query request according to the target function and part of the private key, and after obtaining the corresponding query result, returns it to the data request end.
[0136] In one embodiment, the encrypted query request includes encrypted request data and encrypted verification data; step S6 specifically includes:
[0137] Calculate the encryption request data according to the objective function and the partial private key to obtain a partial calculation result;
[0138] According to the partial calculation result, target verification data of the encrypted verification data is obtained.
[0139] In the application, each data provider directly calculates according to the target function without decrypting the data, and finally obtains a calculation result and the corresponding target verification data and returns it to the data requester, so that the data requester can obtain the final query result and verify it, thereby ensuring the correctness of the query result.
[0140] Specifically, after each data provider receives the corresponding partial private key and encrypted query request, it calculates the following function:
[0141]
[0142] in, Represents the encrypted binary item, DB j Represents the jth data item in the database DB, j k Represents the binary item of the j-th data.
[0143] It should be noted that the calculation of the above function only involves the multiplication of the constant and the ciphertext ( and ), subtraction of constant and ciphertext And the multiplication of ciphertext and ciphertext (the continuous multiplication term in the above function ∏, that is, ).
[0144] Specifically, when multiplying a constant with a ciphertext, simply multiply the ciphertext by the constant. Since homomorphic secret sharing schemes usually involve large integer operations, the calculation result may be very large. Therefore, it is necessary to perform a modulo operation on the result of multiplying the ciphertext by the constant. The modulus is a public parameter in the public key. The modulo operation ensures that the result is still within the encryption space and maintains the homomorphic property.
[0145] When subtracting a constant from a ciphertext, you need to first multiply the ciphertext and the private key to get a calculated share of the ciphertext, and then multiply the constant and the share (just multiply the share by the constant). Similarly, after getting the calculation result, perform a modulus operation, and the modulus is a public parameter in the public key.
[0146] When multiplying ciphertexts, you need to first multiply the first ciphertext and the private key to obtain a calculated share of the first ciphertext, and then multiply the second ciphertext and the share. Similarly, after obtaining the calculation result, perform a modulus operation. The modulus is a public parameter in the public key.
[0147] It is understandable that each data provider can obtain a corresponding calculation result by calculating the above function. For example, the calculation result obtained by the data provider S1 can be recorded as 1. The calculation result obtained by the data provider S2 can be recorded as 2.
[0148] In the application, after each data provider obtains the corresponding calculation result, it can also compare it with the encrypted verification data C A Multiply them together to obtain the target verification data, so that the data request end can verify the final query result to ensure the accuracy of the query result. For example, the target verification data obtained by the data provider S1 can be expressed as<A·P> 1. The target verification data obtained by the data provider S2 can be expressed as<A·P> 2.
[0149] Correspondingly, taking two data providers S1 and S2 as an example, the query result returned by the data provider S1 to the data requester is ( 1,<A·P> 1), the query result returned by the data provider S2 to the data requester is ( 2,<A·P> 2); If the data request end uses an additive homomorphic secret sharing scheme, the reconstructed target calculation result can be expressed as DB i = 1+ 2; At this time, if A·DB i =<A·P> 1+<A·P> 2, it indicates that the target calculation result is correct, otherwise, it indicates that the target calculation result is wrong. Correspondingly, if the data request end uses a subtractive homomorphic secret sharing scheme, the reconstructed target calculation result can be expressed as DB i = 2- 1. At this time, if A·DB i =<A·P> 2-<A·P> 1, it indicates that the target calculation result is correct, otherwise, it indicates that the target calculation result is wrong.
[0150] In the application, after obtaining the target calculation result and verifying its correctness, the target calculation result can also be shared with other user terminals (including but not limited to mobile phones, tablets, laptops and other devices) for other users to analyze and use. According to actual needs, the target calculation result can also be saved for subsequent call and analysis.
[0151] The embodiment of the present application provides query results based on a homomorphic secret sharing scheme to a data requesting end through multiple data providing ends, which can not only realize anonymous data query of the data requesting end, but also enable the data requesting end to verify the correctness of the query results, thereby ensuring the correctness of the query results.
[0152] It should be noted that for the parts that are not described or recorded in detail in this embodiment, reference can be made to the relevant description of the above-mentioned embodiment 1, and they will not be repeated here.
[0153] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0154] Embodiment 3
[0155] The embodiment of the present application also provides a hidden trace query system for executing the method steps in the above hidden trace query method embodiment.
[0156] like Figure 4 As shown, the anonymous query system 100 provided in the embodiment of the present application includes: a data request end 1 and multiple data provider ends, specifically data provider end 21 to data provider end 2n, where n≥2.
[0157] Among them, data request end 1 is used for:
[0158] Generate a target key according to a homomorphic secret sharing scheme;
[0159] Encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request;
[0160] Sending the encrypted query request to multiple data providers respectively;
[0161] The multiple data providers are used for:
[0162] Receiving an encrypted query request and a corresponding partial private key sent by the data requesting end;
[0163] Calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result;
[0164] Returning the query result to the data requesting end 1;
[0165] The data request end 1 is also used for:
[0166] Based on the multiple query results returned by the multiple data providers, a target query result is obtained, and the correctness of the target query result is verified.
[0167] In one embodiment, the data requesting end 1 is further used for:
[0168] Encrypt the request data according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted request data;
[0169] And, the verification data is encrypted according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted verification data.
[0170] In one embodiment, the data requesting end 1 is further used for:
[0171] Performing binary decomposition on the request data;
[0172] Each decomposed data is encrypted according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted request data.
[0173] In one embodiment, each data provider is further configured to:
[0174] Calculate the encryption request data according to the objective function and the partial private key to obtain a partial calculation result;
[0175] According to the partial calculation result, target verification data of the encrypted verification data is obtained.
[0176] In one embodiment, the data request end 1 is further used for:
[0177] Obtain a target calculation result according to the homomorphic secret sharing scheme and multiple partial calculation results in the multiple query results returned by the multiple data providers;
[0178] The correctness of the target calculation result is verified according to multiple target verification data in the multiple query results returned by the multiple data providers.
[0179] Embodiment 4
[0180] like Figure 5 As shown, the embodiment of the present application further provides a terminal device 200, including: at least one processor 201 ( Figure 5 Only one processor is shown), a memory 202, a computer program 203 stored in the memory 202 and executable on at least one processor 201, when the terminal device is a data requesting end, the processor 201 implements the method steps in the above-mentioned embodiment 1 when executing the computer program 203;
[0181] When the terminal device is a data provider, the processor 201 implements the method steps in the above-mentioned embodiment 2 when executing the computer program 203.
[0182] In the application, the terminal device may include but is not limited to a processor, a memory, Figure 5 It is only an example of a terminal device and does not constitute a limitation on the terminal device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as human-computer interaction devices, input and output devices, network access devices, etc. The network access device may include a communication module for the terminal device to communicate with the user terminal.
[0183] In applications, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. For example, the processor may be a timing controller (TCON). A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0184] In applications, the memory may be an internal storage unit of a terminal device in some embodiments, for example, a hard disk or memory of the terminal device. The memory may also be an external storage device of the terminal device in other embodiments, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the terminal device. The memory may also include both an internal storage unit of the terminal device and an external storage device. The memory is used to store operating systems, applications, boot loaders, data, and other programs, such as program codes of computer programs. The memory may also be used to temporarily store data that has been output or is to be output.
[0185] In the application, the communication module can be set as any device that can directly or indirectly perform long-distance wired or wireless communication with the user terminal according to actual needs. For example, the communication module can provide communication solutions including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth, Zigbee, mobile communication networks, global navigation satellite systems (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc., which are applied to network devices. The communication module may include an antenna, and the antenna may have only one array element or an antenna array including multiple array elements. The communication module can receive electromagnetic waves through the antenna, frequency modulate and filter the electromagnetic wave signals, and send the processed signals to the processor. The communication module can also receive the signal to be sent from the processor, frequency modulate and amplify it, and convert it into electromagnetic waves for radiation through the antenna.
[0186] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0187] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned function allocation can be completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The functional modules in the embodiment can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, the specific names of the functional modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0188] The embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0189] An embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device, the terminal device can implement the steps in the above-mentioned various method embodiments.
[0190] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include at least: any entity or device capable of carrying the computer program code to the terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0191] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0192] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0193] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules 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 devices or modules, which can be electrical, mechanical or other forms.
[0194] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0195] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for anonymous query, characterized in that: Applied to a data requesting end, the method comprises: Generate a target key according to a homomorphic secret sharing scheme; Encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request; Sending the encrypted query request to multiple data providers respectively; Based on the multiple query results returned by the multiple data providers, a target query result is obtained, and the correctness of the target query result is verified.
2. The anonymous query method according to claim 1, characterized in that: The target key includes a public key and a private key; the data query request includes request data and verification data; correspondingly, the encrypted query request includes encrypted request data and encrypted verification data; The step of encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain the encrypted query request includes: Encrypt the request data according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted request data; And, the verification data is encrypted according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted verification data.
3. The anonymous query method according to claim 2, characterized in that: The step of encrypting the request data according to the homomorphic secret sharing scheme and the public key in the target key to obtain the encrypted request data includes: Performing binary decomposition on the request data; Each decomposed data is encrypted according to the homomorphic secret sharing scheme and the public key in the target key to obtain encrypted request data.
4. The anonymous query method according to claim 3, characterized in that: The private key includes a plurality of partial private keys, and the plurality of partial private keys are used to be sent to the plurality of data providers; The data provider is used for: Receiving an encrypted query request and a corresponding partial private key sent by the data requesting end; Calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result; The query result is returned to the data requesting end.
5. The anonymous query method according to claim 4, characterized in that: The query result includes partial calculation results and target verification data; The obtaining of a target query result based on the multiple query results returned by the multiple data providers, and verifying the correctness of the target query result, includes: Obtain a target calculation result according to the homomorphic secret sharing scheme and multiple partial calculation results in the multiple query results returned by the multiple data providers; The correctness of the target calculation result is verified according to multiple target verification data in the multiple query results returned by the multiple data providers.
6. A method for anonymous query, characterized in that: Applied to multiple data providers, the method includes: Receive the encrypted query request and the corresponding partial private key sent by the data requester; Calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result; Returning the query result to the data request end, so that the data request end obtains the target query result of the encrypted query request, and verifies the correctness of the target query result; Wherein, the data request end is used to: Generate a target key according to a homomorphic secret sharing scheme; Encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request; Sending the encrypted query request to multiple data providers respectively; Based on the multiple query results returned by the multiple data providers, a target query result is obtained, and the correctness of the target query result is verified.
7. The anonymous query method according to claim 6, characterized in that: The encrypted query request includes encrypted request data and encrypted verification data; The step of calculating the encrypted query request according to the objective function and the partial private key to obtain a corresponding query result includes: Calculate the encryption request data according to the objective function and the partial private key to obtain a partial calculation result; According to the partial calculation result, target verification data of the encrypted verification data is obtained.
8. An anonymous query system, characterized in that: The system includes a data requesting end and a plurality of data providing ends; The data request end is used for: Generate a target key according to a homomorphic secret sharing scheme; Encrypting the data query request according to the homomorphic secret sharing scheme and the target key to obtain an encrypted query request; Sending the encrypted query request to multiple data providers respectively; The multiple data providers are used for: Receiving an encrypted query request and a corresponding partial private key sent by the data requesting end; Calculating the encrypted query request according to the target function and the partial private key to obtain a corresponding query result; Returning the query result to the data requesting end; The data request end is also used for: Based on the multiple query results returned by the multiple data providers, a target query result is obtained, and the correctness of the target query result is verified.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the terminal device is a data requesting end, the processor implements the steps of the anonymous query method according to any one of claims 1 to 5 when executing the computer program; When the terminal device is a data provider, the processor implements the steps of the anonymous query method as described in any one of claims 6 to 7 when executing the computer program.
10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the steps of the anonymous query method as described in any one of claims 1 to 5 or any one of 6 to 7.