Data summation query method and device, storage medium and program product

The data summation query method encrypts query bits and verifies commitment values to prevent single-user queries, ensuring user privacy and query integrity by masking the user set, addressing privacy exposure in existing methods.

CN119203224AActive Publication Date: 2024-12-27CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +2
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411262005.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-09
Publication Date
2024-12-27
Estimated Expiration
2044-09-09

AI Technical Summary

Technical Problem

Existing data summation query methods fail to prevent user privacy exposure when a single user is queried, leading to potential privacy leaks, and existing cryptographic, differential privacy, and audit-based methods either compromise query availability or expose the query party's privacy.

Method used

A data summation query method involving a query bit set where each bit corresponds to a user, with query bits encrypted to a preset value, and a challenge ciphertext set is re-randomized to generate a commitment value set for verification, ensuring the query result is valid before returning data.

Benefits of technology

Prevents malicious single-user queries by verifying the sum of query bits against a preset restriction, maintaining user privacy and query integrity by hiding the actual user set, thus enhancing data query security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119203224A_ABST
    Figure CN119203224A_ABST
Patent Text Reader

Abstract

The invention discloses a data summation query method and device, a storage medium and a program product, and relates to the technical field of data security, the disclosed data summation query method comprises the following steps: sending a query bit set to a data storage end; receiving a challenge ciphertext set returned by the data storage end; generating a commitment value set according to a comparison result between a challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and a preset plaintext corresponding to the preset limit ciphertext; sending the commitment value set to a data storage end; and receiving a query result returned by the data storage end. According to the data summation query method and device, under the condition that the reasonable preset plaintext is set, the technical problem that how to avoid a query request for a single user, and consequently the privacy of the user is exposed can be solved, and the safety of the data summation query method is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data security technology, and in particular to a data sum query method, device, storage medium and program product. Background Art

[0002] In related technologies, in order to ensure the privacy of both parties in data query, the data query party can send a query request ciphertext to the data storage party to obtain the query result ciphertext and complete the task analysis. However, if the data query party maliciously sends a query request ciphertext for a single user, it will still lead to the leakage of the privacy of a single user in the data storage party. Therefore, how to avoid the problem of user privacy exposure caused by query requests for a single user needs to be solved urgently. Summary of the invention

[0003] The main purpose of this application is to provide a data summation query method, device, storage medium and program product, aiming to solve the technical problem of how to avoid the problem of user privacy exposure caused by query requests for a single user.

[0004] To achieve the above purpose, the present application proposes a data sum query method, which is applied to a data query end. The data sum query method includes:

[0005] Sending a query bit set to a data storage end; wherein a plurality of query bits in the query bit set correspond to a plurality of users one by one, and when the query request includes the corresponding user, the value of the query bit is a ciphertext of a first preset value;

[0006] receiving a challenge ciphertext set returned by the data storage end; the challenge ciphertext set is obtained by the data storage end re-randomizing the initial challenge ciphertext in the initial challenge ciphertext set using a corresponding first random number in the first random number set, the initial challenge ciphertext including the sum of all query bits in the query bit set;

[0007] Generate a commitment value set according to a comparison result between a challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and a preset plaintext corresponding to a preset restriction ciphertext;

[0008] Send the committed value set to the data storage end;

[0009] Receive the query result returned by the data storage end; after the data storage end verifies the commitment value set, the query result is obtained by querying the database according to the query bit set.

[0010] In one embodiment, before the step of sending the commitment value set to the data storage end, the data sum query method further includes:

[0011] Receive a first random number set and an initial challenge ciphertext set sent by a data storage terminal;

[0012] For each initial challenge ciphertext, re-randomize the initial challenge ciphertext using the corresponding first random number in the first random number set to obtain an intermediate ciphertext set;

[0013] For each intermediate ciphertext in the intermediate ciphertext set, compare the intermediate ciphertext with the corresponding challenge ciphertext in the challenge ciphertext set to obtain a first verification result;

[0014] If the first verification result is that the verification is passed, the step of sending the commitment value set to the data storage end is executed.

[0015] In one embodiment, the step of generating a commitment value set according to the comparison result between each challenge ciphertext in the challenge ciphertext set and the preset restriction ciphertext includes:

[0016] For each comparison result, calculate a first hash value between the comparison result and a corresponding second random number in the second random number set;

[0017] Obtain a commitment value set according to all first hash values;

[0018] The steps of sending the commitment value set to the data storage end include:

[0019] The commitment value set, the second random number set and each comparison result are sent to the data storage end, so that the data storage end calculates, for each comparison result, a third hash value of the comparison result and the corresponding second random number in the second random number set, and for each commitment value in the commitment value set, compares the commitment value with the corresponding third hash value to perform commitment value set verification.

[0020] In one embodiment, before the step of sending the query bit set to the data storage end, the method further includes:

[0021] Encrypting a preset plaintext corresponding to the preset restricted ciphertext using a third random number to obtain a first ciphertext;

[0022] Encrypting the preset plaintext using the fourth random number to obtain a second ciphertext;

[0023] Obtain an auxiliary random number according to the third random number, the fourth random number, and the second Hash value of the first ciphertext and the second ciphertext;

[0024] Sending the first ciphertext, the second ciphertext and the auxiliary random number to the data storage end;

[0025] Receiving a second verification result returned by the data storage end, where the second verification result is obtained by the data storage end verifying the first ciphertext or the second ciphertext according to the second hash value and the auxiliary random number;

[0026] If the second verification result is that the verification is passed, the first ciphertext or the second ciphertext is used as the preset restricted ciphertext, and the step of sending the query bit set to the data storage end is executed.

[0027] In addition, to achieve the above purpose, the present application also proposes a data sum query method, which is applied to the data storage end. The data sum query method includes:

[0028] Receive a query bit set sent by a data query end; wherein multiple query bits in the query bit set correspond to multiple users one by one, and when the query request includes the corresponding user, the value of the query bit is a ciphertext of a first preset value;

[0029] For each initial challenge ciphertext in the initial challenge ciphertext set, re-randomize the initial challenge ciphertext using a corresponding first random number in the first random number set to obtain a challenge ciphertext set; the initial challenge ciphertext includes the sum of all query bits in the query bit set;

[0030] Send the challenge ciphertext set to the data query end;

[0031] Receive and verify the commitment value set returned by the data query end; the commitment value set is generated by the data query end based on the comparison result between the challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and the preset plaintext corresponding to the preset restriction ciphertext;

[0032] If the commitment value set passes the verification, the database is queried according to the query bit set to obtain the query result.

[0033] In one embodiment, before the step of receiving the query bit set sent by the data query end, the data sum query method further includes:

[0034] Receive a first ciphertext, a second ciphertext, and an auxiliary random number sent by a data query end; the first ciphertext is obtained by the data query end by encrypting a preset plaintext corresponding to a preset restricted ciphertext using a third random number, the second ciphertext is obtained by the data query end by encrypting the preset plaintext using a fourth random number, and the auxiliary random number is obtained by the data query end according to the third random number, the fourth random number, and a second Hash value of the first ciphertext and the second ciphertext;

[0035] Encrypt the preset plaintext using the auxiliary random number to obtain the third ciphertext;

[0036] Obtaining a verification ciphertext according to the first ciphertext, the second ciphertext and the second Hash value;

[0037] Comparing the third ciphertext with the verification ciphertext to obtain a second verification result;

[0038] If the second verification result is that the verification is passed, the first ciphertext or the second ciphertext is used as the preset restricted ciphertext, and the step of receiving the query bit set sent by the data query end is executed.

[0039] In one embodiment, the step of querying a database according to a query bit set to obtain a query result includes:

[0040] For each query bit in the query bit set, query the database to obtain corresponding query data;

[0041] The query result is obtained according to all the query data and the corresponding query bits.

[0042] In addition, to achieve the above-mentioned purpose, the present application also proposes a data summation query device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data summation query method as described above.

[0043] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data summation query method as described above are implemented.

[0044] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the data summation query method as described above are implemented.

[0045] One or more technical solutions proposed in this application have at least the following technical effects:

[0046] The present application provides a data sum query method, device, storage medium and program product. First, multiple query bits in a query bit set are set to correspond to multiple users one by one. During the data query process, the value of the query bit corresponding to the user in the query request in the query bit set is set to a ciphertext of a first preset value, so that the sum of each query bit in the query bit set can represent the number of users in the query request; then, the sum of all query bits is re-randomized as a challenge ciphertext, and a commitment value set is generated according to the comparison result between the challenge plaintext corresponding to the challenge ciphertext and the preset plaintext corresponding to the preset restriction ciphertext, and verification is performed. When the commitment value set verification passes, it can be indicated that the sum of each query bit in the query bit set and the preset restriction ciphertext are matched. When the commitment value set verification fails, it can be indicated that the sum of the query bits in the query bit set corresponds to the same plaintext as the preset restriction ciphertext; thus, by comparing the challenge plaintext corresponding to each challenge ciphertext in the commitment and verification challenge ciphertext set with the preset plaintext corresponding to the preset restriction ciphertext, it can be verified whether the sum of the query bits in the query bit set corresponds to different plaintexts from the preset restriction ciphertext, thereby realizing the verification of whether the number of users in the query request is different from the preset plaintext corresponding to the preset restriction ciphertext. When a reasonable preset plaintext is set, it can be avoided that the data query end maliciously sends a query request for a single user, resulting in the exposure of the user privacy of the single user, thereby improving the security of the data summation query method. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0049] Figure 1 This is a flow chart of the first embodiment of the data sum query method of this application;

[0050] Figure 2 This is a flow chart of the second embodiment of the data sum query method of this application;

[0051] Figure 3 for Figure 2 A flowchart of a specific implementation method of the first stage;

[0052] Figure 4 for Figure 2 A flow chart of a specific implementation method of the second stage of the invention;

[0053] Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the data summation query method in the embodiment of the present application.

[0054] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0056] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0057] The main solution of the embodiment of the present application is: sending a query bit set to the data storage end; multiple query bits in the query bit set correspond to multiple users one by one, and when the corresponding user is included in the query request, the value of the query bit is a ciphertext of a first preset value; receiving a challenge ciphertext set returned by the data storage end; the challenge ciphertext set is obtained by the data storage end for each initial challenge ciphertext in the initial challenge ciphertext set by re-randomizing the initial challenge ciphertext using the corresponding first random number in the first random number set, and the initial challenge ciphertext includes the sum of all query bits in the query bit set; generating a commitment value set according to the comparison result between the challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and the preset plaintext corresponding to the preset restriction ciphertext; sending the commitment value set to the data storage end; receiving the query result returned by the data storage end; the query result is obtained by querying the database according to the query bit set after the data storage end verifies that the commitment value set has passed.

[0058] With the rapid development of information technology, the amount of user data has increased significantly. A large amount of user data is collected and stored. This type of data may be compliant for the data storage party, but it is not allowed to be leaked to the outside, such as the patient information database of the medical department and the placement database of the advertising company. At the same time, there are data query parties that need to use this type of data to participate in calculations and perform sum analysis tasks to improve efficiency and service quality, such as disease average incidence analysis and advertising profit statistics. Both data query parties and individual users who provide data hope that some private data will be hidden and kept confidential, such as salary, age, etc. However, under the requirement of privacy, there is a separation of rights between the data analysis party and the data storage party. The data analysis party can use the stored data but cannot see it, while the data storage party can use the query request of the data analysis party but cannot see it. The data analysis party hopes to hide its analysis target, such as which group to survey; the individual user who provides data hopes that his data will not be leaked during the data analysis process. Therefore, directly using the sum query service will bring serious privacy issues. On the one hand, the query request transmitted in plain text will reveal the object of analysis. On the other hand, the query of a single target will expose the privacy of individual users.

[0059] In the related art, for a database containing sensitive information of multiple users, many analysis tasks require summing up the specific data of some users. Therefore, the data query can be implemented using the sum query method. The specific data analysis party can initiate a query request containing the query target user set to the data storage party. The data storage party retrieves the privacy-sensitive value of the target user and returns it to the data analysis party after summing. Among them, there are three main methods for sum query for privacy protection: sum query method based on cryptography, sum query method based on differential privacy, and sum query method based on auditing.

[0060] Specifically, the cryptographic sum query method protects the privacy of the query process through cryptographic methods, and anonymizes or compresses the user identities in the target user set to protect the privacy of the query target. Among them, in the privacy intersection summation technology, Ion et al. in 2017 determined the intersection position under the premise of hiding the intersection through mechanisms such as exchange and realized privacy summation through additive homomorphic encryption; Tu et al. in 2023 completed secret sharing based on multi-point oblivious pseudo-random functions, and realized privacy summation through permutation matrix privacy equality test, additive homomorphic encryption and oblivious transmission. In the privacy batch sum retrieval technology, Patel et al. in 2018 realized the sum retrieval of multiple subsets of the statistical database based on additive homomorphic encryption, and multiplied the bit vector ciphertext corresponding to different subsets with the database retrieval value to obtain the query result; Mughees et al. in 2021 realized privacy batch sum retrieval based on the principle of batch privacy information retrieval. It can be seen that the cryptographic sum query method will completely blind the target user set. While ensuring the privacy of the query, it damages the availability of the query request to the data storage party and gives the query party great query freedom. However, this may cause the data query party to abuse the query right and send a single user's query request, resulting in malicious queries. Therefore, the cryptographic sum query method does not protect the query results, that is, the cryptographic sum query method only guarantees the privacy of a single query execution for the data query party, and does not consider the data leakage that may be caused during the query process, so that the data query party can intrusively set the target user set to a single user to accurately query the sensitive data of the single user, resulting in the privacy leakage of the single user.

[0061] In addition, the sum query method based on differential privacy introduces random noise in each query response based on differential privacy, so that the final query result needs to be interfered by random noise with sufficient variance, resulting in the retrieval data set being unable to be distinguished from different adjacent retrieval data sets to maintain privacy. For example, the Laplace mechanism proposed by Dwork et al. in 2006 can obtain a sum query response mechanism that satisfies differential privacy. In 2021, Xiao et al. considered the problem of answering sum queries under differential privacy under the constraints of each query accuracy, added privacy-preserving Gaussian noise to the query response, and optimized the covariance structure of the noise to meet the fine-grained accuracy requirements while reducing the privacy cost. However, the sum query method based on differential privacy adds random noise to the query results, which reduces the availability of the query results and hinders the use and understanding of the query results by the data query party. In addition, this method requires the query request to be known, and there is a privacy leakage problem for the data query party.

[0062] Finally, the audit-based sum query method records past query requests and their response results to form a log. When a new query request is received, it first checks the past query requests in the log to check whether the query request will leak the data of a single user in the statistical database. If the new query request is judged to be safe (where the data query party cannot obtain the sensitive data of a single user through the combination of the new query request and the previous query results), it responds and replies. If the new query request is judged to endanger user data, it ignores the query request. However, the audit-based sum query method requires the data storage party to clearly understand the query request set of the data query party, exposing the privacy of the query instruction of the data query party, so that the data storage party can infer its analysis task by analyzing the query request set of the data query party, which is the privacy of the data query party and may even be a commercial secret and should be hidden. Therefore, this method also has the hidden danger of privacy leakage of the data query party.

[0063] In summary, the data summation query method in the related art has the problem of how to avoid the query request for a single user, which may lead to the exposure of user privacy, and how to ensure the privacy of the data query party.

[0064] Therefore, the present application provides a solution. First, multiple query bits in a query bit set are set to correspond to multiple users one by one. During the data query process, the value of the query bit corresponding to the user in the query request in the query bit set is set to a ciphertext of a first preset value, so that the sum of each query bit in the query bit set can represent the number of users in the query request; then, the sum of all query bits is re-randomized as a challenge ciphertext, and a commitment value set is generated according to a comparison result between a challenge plaintext corresponding to the challenge ciphertext and a preset plaintext corresponding to a preset restriction ciphertext, and verification is performed. When the commitment value set verification passes, it can be indicated that the sum of each query bit in the query bit set corresponds to a different plaintext than the preset restriction ciphertext. When the commitment value set verification fails, it can be said that the sum of the query bits in the query bit set corresponds to the same plaintext as the preset restriction ciphertext; thus, by comparing the challenge plaintext corresponding to each challenge ciphertext in the commitment and verification challenge ciphertext set with the preset plaintext corresponding to the preset restriction ciphertext, it can be verified whether the sum of the query bits in the query bit set corresponds to different plaintexts from the preset restriction ciphertext, thereby realizing the verification of whether the number of users in the query request is different from the preset plaintext corresponding to the preset restriction ciphertext. When a reasonable preset plaintext is set, it can be avoided that the data query end maliciously sends a query request for a single user, resulting in the exposure of the user privacy of the single user, thereby improving the security of the data summation query method.

[0065] In addition, in the present application, the query request of the data query end is sent to the data storage end in ciphertext form, hiding the query user set of the data query end. The data storage end can only know the location ciphertext of the target user set corresponding to the query request, which cannot correspond to the actual user, and thus cannot further infer and analyze the query task of the data query end, thereby avoiding the leakage of the privacy of the query request.

[0066] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a data summing query device, etc. The following takes the data summing query device as an example to illustrate this embodiment and the following embodiments. Among them, the data summing query device may include a data query end and a data storage end.

[0067] Based on this, the present application embodiment provides a data sum query method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the data sum query method of this application.

[0068] In this embodiment, the data sum query method is applied to the data query end, and the data sum query method may include steps S100 to S500:

[0069] Step S100: sending a query bit set to a data storage end.

[0070] Among them, multiple query bits in the query bit set correspond to multiple users one by one, and when the corresponding user is included in the query request, the value of the query bit is the ciphertext of the first preset value.

[0071] It should be noted that when a query request is received, the data query end generates a query bit set according to the query request. The number of query bits in the query bit set is the same as the total number of users in the database of the data storage end, so that multiple query bits in the query bit set correspond to multiple users one by one. The value of the query bit is the ciphertext of the first preset value or the ciphertext of the second preset value, the first preset value is 1, and the second preset value is 0. In the case where the corresponding user is included in the query request, the value of the query bit is the ciphertext of the first preset value, and in the case where the corresponding user is not included in the query request, the value of the query bit is the ciphertext of the second preset value.

[0072] It can be understood that if the database at the data storage end includes the user data of m users, if each user i corresponds to a protected privacy-sensitive value d i , i = 1, 2, ..., m; data query process, involving data query end R, data storage end S, database D, row number 1, 2, ..., m, target value d1, d2, ..., d corresponding to each rowm , the query request Q and the query result q sent by the data query end. Then the data sum query method provided in this embodiment can determine a user set according to a query request The goal of this user set is to calculate the sum q of the privacy-sensitive values ​​of all users in the set; thereafter, if the query request corresponding to the user set is answerable, the data storage end will return the sum value, otherwise the query request corresponding to the user set will be rejected.

[0073] In the specific implementation, the data query end can generate an m-dimensional query bit vector b∈{0,1} according to the user set L in the query request. m Among them, the i-th bit component b i The value of is as follows:

[0074]

[0075] Then, each bit component in the m-dimensional query bit vector is encrypted to obtain a query bit set.

[0076] In this embodiment, the bit component can be encrypted using a homomorphic encryption algorithm, and the value of the query bit obtained is as follows:

[0077] b i ′=Enc pk,r (b i )

[0078] b i ′ is the ith query bit of the query bit set b′, Enc pk,r (x) represents the ciphertext obtained by encrypting the plaintext x using the public key pk and the random number r. The scheme of the homomorphic encryption algorithm may include a key generation function Gen, an encryption function Enc, a decryption function Dec, and a re-randomization function Rand. Therefore, the public key pk and the random number r are determined by the function in the homomorphic encryption algorithm.

[0079] In specific implementation, the homomorphic encryption algorithm is selected according to actual usage requirements. In one example, for the homomorphic encryption algorithm Paillier, its key generation phase randomly selects λ-bit prime numbers p and q according to the security parameter λ, calculates n=pq, and outputs the public key pk=n and the private key sk=φ(n), where φ is the Euler function, and φ(n) represents the number of numbers less than n and coprime with n. The data query end can obtain the public key pk=n and the private key sk=φ(n) during the key generation phase, encrypt the query bit vector, and send the public key to the data storage end. Specifically, in the encryption phase, Enc receives the input plaintext m∈Z n and public key pk, randomly select a random number Calculate and output the ciphertext c=Encpk,r (m) = (1 + n) m ·r n mod n 2 ; In the decryption phase, Dec receives the input ciphertext c∈Z n2 , public key pk and private key sk, calculate and output plaintext In the re-randomization phase, Rand receives the input plaintext m∈Z n and public key pk, randomly select a random number Re-randomize the ciphertext and get the result value c′=c·r n modn 2 .

[0080] Step S200: receiving a challenge ciphertext set returned by the data storage end.

[0081] The challenge ciphertext set is obtained by re-randomizing the initial challenge ciphertext in the initial challenge ciphertext set by the data storage end using the corresponding first random number in the first random number set, and the initial challenge ciphertext includes the sum of all query bits in the query bit set.

[0082] It should be noted that this embodiment uses zero-knowledge proof to verify the query bit set to determine whether the corresponding query request is answerable.

[0083] First, during the verification process, after receiving the query bit set, the data storage end determines the challenge ciphertext set based on the query bit set, and returns the challenge ciphertext set to the data query end so that the data query end can make a commitment.

[0084] In a specific implementation, the data storage end S receives the query bit set b′ and calculates each query bit b in the query bit set. i The sum of ′ and c1 is as follows:

[0085]

[0086] Among them, according to the properties of homomorphic encryption, it can be obtained that c1 is the ciphertext of the number of users corresponding to the user set in the query request.

[0087] Then, the data storage end S randomly selects k challenges from the set {0,1}, denoted as o1,…,o k , randomly select k first random numbers r1,…,r k , get the first random number set, with the first random number r j Initial challenge ciphertext Re-randomize to get the challenge ciphertext And send the k newly obtained challenge ciphertexts as the challenge ciphertext set to the data query end R. Among them, when the challenge number is 0, the initial challenge ciphertext For the preset restricted ciphertext, when the challenge number is 1, the initial challenge ciphertext For c1, the corresponding challenge ciphertext It can be generated using the following formula 4:

[0088]

[0089] Rand is a re-randomization algorithm in the homomorphic encryption algorithm. Rand(c,r) means re-randomizing the ciphertext c using a random number r.

[0090] Step S300, generating a commitment value set according to the comparison result between the challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and the preset plaintext corresponding to the preset restriction ciphertext.

[0091] Step S400, sending the commitment value set to the data storage end.

[0092] Step S500: receiving the query result returned by the data storage end.

[0093] The query result is obtained by querying the database according to the query bit set after the data storage end verifies the commitment value set.

[0094] It should be noted that after the data query end receives the challenge ciphertext set, it needs to commit to the challenge ciphertext. In the commitment stage, the data query end commits to the comparison result between the challenge plaintext corresponding to the challenge ciphertext and the preset plaintext corresponding to the preset restriction ciphertext, and returns the commitment value set to the data storage end, so that the data storage end can verify and trust whether the sum of each query bit in the query bit set corresponds to a different plaintext from the preset restriction ciphertext, and return the query result based on the verification result.

[0095] In a feasible implementation manner, step S300 may include steps A310 to A320:

[0096] Step A310: For each comparison result, calculate a first hash value between the comparison result and the corresponding second random number in the second random number set.

[0097] Step A320, obtaining a commitment value set according to all first hash values;

[0098] Correspondingly, step S400 may include step A410:

[0099] Step A410, sends the commitment value set, the second random number set and each comparison result to the data storage end, so that the data storage end calculates the third hash value of the comparison result and the corresponding second random number in the second random number set for each comparison result, and compares the commitment value with the corresponding third hash value for each commitment value in the commitment value set to perform commitment value set verification.

[0100] It should be noted that, first, the data query end can use the private key sk obtained by the homomorphic encryption algorithm to decrypt the challenge ciphertext c′ oj and preset restricted ciphertext, obtain challenge plaintext and preset plaintext, and compare challenge plaintext and preset plaintext to obtain k comparison results cmp j , j = 1, ..., k. Among them, the comparison result cmp j The value of is as follows:

[0101]

[0102] c0 is the preset restricted ciphertext, Dec is the decryption function of the homomorphic encryption algorithm, Dec sk (c) represents the plaintext obtained by decrypting the ciphertext c using the private key sk. cmp j The comparison result of the j-th challenge should be equal to the challenge number o selected for the j-th challenge. j Equal, specifically, when the challenge ciphertext and the preset restriction ciphertext correspond to different plaintexts, if o j =1, then If o j =0, then When for each j, cmp j = =o j Established; when the challenge ciphertext and the preset restricted ciphertext correspond to the same plaintext, It is not possible to have cmp for every j j = =o j Established. Therefore, the subsequent data storage end can verify cmp j = =o j , to verify whether the challenge ciphertext and the preset restricted ciphertext correspond to different plaintexts.

[0103] Then, the data query end can use the second random number set to make a commitment on the comparison result, obtain a commitment value set, and send the commitment value set to the data storage end. The commitment value set includes k commitment values ​​comm j The commitment value is the first hash value of the comparison result and the corresponding second random number in the second random number set. The commitment value can be calculated using the following formula 6:

[0104] comm j = hash(op j ||cmpj )

[0105] hash represents a collision-resistant hash function, op j is the j-th second random number in the second random number set.

[0106] Afterwards, the data storage end can verify the commitment value set based on the second random number set. The specific verification process is: the data storage end calculates the third hash value of the comparison result and the corresponding second random number in the second random number set for each comparison result, and compares the commitment value with the corresponding third hash value for each commitment value in the commitment value set.

[0107] In the specific implementation, the comparison result z′ between the commitment value and the corresponding third hash value i It can be expressed as the following formula 7:

[0108] z′ j =(Open(o j ,op j ,comm j )==accept)

[0109] Open is the reveal function of the commitment scheme used by the data query end. Usually, the reveal function corresponds to the commitment scheme of the data query end. In this embodiment, since the data query end selects a commitment scheme based on a collision-resistant hash function, the data storage end can also select a reveal scheme based on a collision-resistant hash function to calculate the comparison result cmp j After the third hash value is obtained, the third hash value is compared with the corresponding commitment value comm j Compare to verify whether the challenge ciphertext and the preset restricted ciphertext correspond to different plaintexts. The reveal function can be expressed as:

[0110]

[0111] That is, the calculation method of the third hash value is the same as the calculation method of the first hash value. The difference is that the third hash value is calculated by the data storage end based on the comparison result and the corresponding second random number, and the first hash value is calculated by the data query end based on the comparison result and the corresponding second random number.

[0112] Correspondingly, the method for the data storage end to obtain the query result may include: for each query bit in the query bit set, querying from the database to obtain the corresponding query data; and obtaining the query result according to all the query data and the corresponding query bits.

[0113] It should be noted that the data storage end S can calculate the total comparison results of k challenges. Determine whether the commitment value set has been verified based on the total comparison result. When z′=1, it means that the commitment value set has been verified. The data storage end searches the database D to obtain the value d of each row i. i , and compare it with the corresponding bit b′ in the ciphertext query vector b′ i Multiply and sum to get the query result And send it to the data query end R. When z′=0, the query result ⊥ is returned to the data query end R.

[0114] It can be understood that after receiving the query result, the data query end checks whether the query result is ⊥. If the query result is not ⊥, the private key sk is used to decrypt the query result q′ to obtain the decrypted query result q:

[0115]

[0116] In a feasible implementation, before step S400, the data sum query method may further include: receiving a first random number set and an initial challenge ciphertext set sent by the data storage end; for each initial challenge ciphertext, using the corresponding first random number in the first random number set, re-randomizing the initial challenge ciphertext to obtain an intermediate ciphertext set; for each intermediate ciphertext in the intermediate ciphertext set, comparing the intermediate ciphertext with the corresponding challenge ciphertext in the challenge ciphertext set to obtain a first verification result; if the first verification result is verification passed, executing step S400.

[0117] It should be noted that before the data query end sends the commitment value set to the data storage end, it can also verify the legitimacy of the challenge ciphertext set to verify whether the challenge ciphertext is obtained by re-randomizing the initial challenge ciphertext using the first random number. The principle of legitimacy verification is that the data query end re-randomizes each initial challenge ciphertext using the corresponding first random number to obtain an intermediate ciphertext, and verifies the legitimacy of the challenge ciphertext set by comparing the consistency of the intermediate ciphertext generated by the data query end with the challenge ciphertext generated by the data storage end.

[0118] Among them, the comparison result z between the intermediate ciphertext and the corresponding challenge ciphertext j The value of is as follows:

[0119]

[0120] The first verification result is as follows:

[0121]

[0122] z is the first verification result, Λ represents continuous XOR, j is the jth challenge, k is the number of challenges, z j is the comparison result between the jth intermediate ciphertext and the corresponding challenge ciphertext.

[0123] It is understandable that the data query end can judge z i ==1, to verify the legitimacy of the j-th challenge ciphertext. Then, when z≠1, it is determined that the challenge ciphertext set verification fails, and a ⊥ is sent to the data storage end S. When z=1, it is determined that the challenge ciphertext set verification passes, and the commitment value set and the second random number set are sent to the data storage end, so that the data storage end verifies the commitment value set.

[0124] In a feasible implementation, before step S100, the data sum query method may further include: using a third random number to encrypt a preset plaintext corresponding to a preset restricted ciphertext to obtain a first ciphertext; using a fourth random number to encrypt the preset plaintext to obtain a second ciphertext; obtaining an auxiliary random number based on the third random number, the fourth random number, and the second hash value of the first ciphertext and the second ciphertext; sending the first ciphertext, the second ciphertext and the auxiliary random number to the data storage end; receiving a second verification result returned by the data storage end, the second verification result being obtained by the data storage end by verifying the first ciphertext or the second ciphertext based on the second hash value and the auxiliary random number; if the second verification result is verification passed, the first ciphertext or the second ciphertext is used as the preset restricted ciphertext, and step S100 is executed.

[0125] It should be noted that before data query, the key and preset restricted ciphertext can be shared and verified between the data query end and the data storage end. The preset restricted ciphertext is the ciphertext corresponding to the preset plaintext. In order to prevent the data query end from maliciously sending a query request for a single user, the preset plaintext is a value of 1.

[0126] In the specific implementation, during the key sharing stage, the key generation algorithm of the homomorphic encryption algorithm can be run on the data query end to generate a public key pk and a private key sk, the public key pk is sent to the data storage end, and the private key sk is stored locally to complete the key sharing.

[0127] During the sharing and verification phase of the preset restricted ciphertext, the data query end can use the third random number E to encrypt the preset plaintext corresponding to the preset restricted ciphertext to obtain the first ciphertext M; use the fourth random number F to encrypt the preset plaintext to obtain the second ciphertext N; and use formula 10 to calculate the second hash value e; formula 10 is:

[0128] e=hash(pk||M||N)

[0129] Then, using Formula 11, the auxiliary random number Z is obtained according to the third random number, the fourth random number, and the second Hash value; Formula 11 is:

[0130] Z=E·F e

[0131] Z is the auxiliary random number, E is the third random number, F is the fourth random number, and e is the second hash value.

[0132] The first ciphertext, the second ciphertext and the auxiliary random number are sent to the data storage end, so that the data storage end verifies the first ciphertext or the second ciphertext according to the second hash value and the auxiliary random number, and determines the preset restricted ciphertext.

[0133] Correspondingly, the method for the data storage end to verify the first ciphertext or the second ciphertext may include: receiving the first ciphertext, the second ciphertext and the auxiliary random number sent by the data query end; the first ciphertext is obtained by the data query end by encrypting the preset plaintext corresponding to the preset restricted ciphertext using the third random number, the second ciphertext is obtained by the data query end by encrypting the preset plaintext using the fourth random number, and the auxiliary random number is obtained by the data query end according to the third random number, the fourth random number, and the second hash value of the first ciphertext and the second ciphertext; the preset plaintext is encrypting with the auxiliary random number to obtain the third ciphertext; according to the first ciphertext, the second ciphertext and the second hash value, a verification ciphertext is obtained; comparing the third ciphertext and the verification ciphertext to obtain a second verification result; if the second verification result is verification passed, the first ciphertext or the second ciphertext is used as the preset restricted ciphertext, and the step of receiving the query bit set sent by the data query end is executed.

[0134] It should be noted that the data storage end can verify the generation process of the first ciphertext or the second ciphertext based on the auxiliary random number, and then verify whether the plaintext corresponding to the received first ciphertext or the second ciphertext is the preset plaintext, and by comparing the verification ciphertext obtained by calculating the received ciphertext with the third ciphertext obtained by encrypting the auxiliary random number, the distribution and verification of the preset restricted ciphertext is realized, thereby achieving the purpose of sharing the preset restricted ciphertext between the data query end and the data storage end.

[0135] In a specific implementation, the data storage end can use Formula 12 to encrypt the preset plaintext using the auxiliary random number to obtain the third ciphertext v1; Formula 12 is:

[0136] v1=Enc pk,Z (1)

[0137] The verification ciphertext v2 is obtained according to the first ciphertext, the second ciphertext and the second hash value using the following formula 13; formula 13 is:

[0138]

[0139] n is a parameter of the homomorphic encryption algorithm, satisfying public key pk=n, private key sk=φ(n), and φ is the Euler function.

[0140] Among them, since v1=Enc pk,Z (1) = (1 + n)·Z n =(1+n)·(E·Fe ) n =(1+n)·E n ·F en , v2=M·F en Therefore, if v1 and v2 are equal, then c0==(1+n)·E n , that is, M is indeed the ciphertext of 1. Therefore, the data storage end can verify whether M or N is the ciphertext of 1 by comparing the values ​​of v1 and v2.

[0141] It can be understood that if the data storage end verifies that M or N is 1, the second verification result is verification passed, the first ciphertext or the second ciphertext can be used as the preset restricted ciphertext, and a successful reception signal of the preset restricted ciphertext is sent to the data query end, so that the data query end can send a query request to the data storage end; if the data storage end verifies that M or N is not 1, the second verification result is verification failed, and the data storage end can reject the query request of the data query end.

[0142] Therefore, this embodiment provides a data sum query method. By committing and verifying the comparison result between the challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and the preset plaintext corresponding to the preset restriction ciphertext, it can be verified whether the sum of each query bit in the query bit set and the preset restriction ciphertext correspond to different plaintexts, thereby realizing the verification of whether the number of users in the query request is different from the preset plaintext corresponding to the preset restriction ciphertext. When a reasonable preset plaintext is set, it can avoid the data query end maliciously sending a query request for a single user, resulting in the exposure of the user privacy of the single user, thereby improving the security of the data sum query method.

[0143] In addition, in this embodiment, the query request of the data query end is sent to the data storage end in ciphertext form, hiding the query user set of the data query end. The data storage end can only know the position ciphertext of the target user set corresponding to the query request, which cannot correspond to the actual user, and thus cannot further infer and analyze the query task of the data query end, thereby avoiding the leakage of query request privacy.

[0144] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar content as the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated later. On this basis, the data summation query method is applied to the data storage end, and the data summation query method may include: receiving a query bit set sent by the data query end; multiple query bits in the query bit set correspond to multiple users one by one, and when the corresponding user is included in the query request, the value of the query bit is a ciphertext of a first preset value; for each initial challenge ciphertext in the initial challenge ciphertext set, the initial challenge ciphertext is re-randomized using the corresponding first random number in the first random number set to obtain a challenge ciphertext set; the initial challenge ciphertext includes the sum of all query bits in the query bit set; the challenge ciphertext set is sent to the data query end; the commitment value set returned by the data query end is received and verified; the commitment value set is generated by the data query end according to the comparison result between the challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and the preset plaintext corresponding to the preset restriction ciphertext; if the commitment value set passes the verification, the database is queried according to the query bit set to obtain the query result.

[0145] In a feasible implementation manner, before the step of receiving the query bit set sent by the data query end, the data summation query method also includes: receiving a first ciphertext, a second ciphertext and an auxiliary random number sent by the data query end; the first ciphertext is obtained by the data query end by encrypting a preset plaintext corresponding to the preset restriction ciphertext using a third random number, the second ciphertext is obtained by the data query end by encrypting the preset plaintext using a fourth random number, and the auxiliary random number is obtained by the data query end based on the third random number, the fourth random number, and the second hash value of the first ciphertext and the second ciphertext; the preset plaintext is encrypting with the auxiliary random number to obtain a third ciphertext; according to the first ciphertext, the second ciphertext and the second hash value, a verification ciphertext is obtained; the third ciphertext and the verification ciphertext are compared to obtain a second verification result; if the second verification result is verification passed, the first ciphertext or the second ciphertext is used as the preset restriction ciphertext, and the step of receiving the query bit set sent by the data query end is executed.

[0146] In a feasible implementation, the step of querying the database according to the query bit set to obtain the query result includes: for each query bit in the query bit set, querying the database to obtain the corresponding query data; and obtaining the query result according to all the query data and the corresponding query bits.

[0147] It can be understood that the data summation query method provided in this embodiment is a data summation query method executed by the data storage end corresponding to the data query end in the above-mentioned embodiment 1. The data summation query method provided in this embodiment adopts the data summation query method in the above-mentioned embodiment 1, which can solve the technical problem of how to avoid the query request for a single user, resulting in the exposure of user privacy. Compared with the related art, the beneficial effect of the data summation query method provided in this embodiment is the same as the beneficial effect of the data summation query method provided in the above-mentioned embodiment 1, and the other technical features of the data summation query method executed by the data storage end in this embodiment are the same as the features disclosed in the above-mentioned embodiment 1, which will not be repeated here.

[0148] In summary, refer to Figures 2 to 4 , Figure 2 This is a flow chart of the second embodiment of the data sum query method of this application. Figure 3 for Figure 2 The flowchart of the first stage of a specific implementation method is shown in FIG. Figure 4 for Figure 2 Schematic diagram of the process of a specific implementation method of the second stage.

[0149] like Figure 2 As shown, the data sum query method provided by this embodiment may include two stages. The first stage is a homomorphic ciphertext sharing method, in which the key and the preset restricted ciphertext can be shared and verified at the data query end and the data storage end.

[0150] In the second phase, a zero-knowledge proof of unequal homomorphic ciphertexts was introduced to verify that the data query end did not send a precise query for a single user. Specifically, the data query end initiates a query request, and the data storage end uses a zero-knowledge proof to verify that the sum of the query bits in the query bit set contained in the query request corresponds to a different plaintext than the preset restricted ciphertext received in the first phase, to verify that the size of the user set in the query request of the data query end is not 1, and sends the correct query result after verification to avoid data leakage caused by precise queries.

[0151] Specifically, Figure 3As shown, the homomorphic ciphertext sharing method proposed in the first stage is a process in which the verifier receives the ciphertext c obtained by the prover using Paillier encryption on a certain public plaintext m and verifies the ciphertext, which specifically includes the following steps: the prover determines the first random number r and the second random number r′ according to n of the Paillier algorithm, uses the first random data and the Paillier homomorphic encryption public key pk to encrypt m to obtain the ciphertext c0, uses the second random number and the Paillier homomorphic encryption public key pk to encrypt m to obtain the ciphertext a, uses the hash algorithm based on the Paillier homomorphic encryption public key, the ciphertext c and a to obtain the state value e, calculates the random parameter Z based on the first random number, the second random number and the state value, and sends the Paillier homomorphic encryption public key, the ciphertext c, a and the random parameter Z to the verifier. The verifier uses the Paillier homomorphic encryption public key and the random parameter Z to encrypt m to obtain the first result v1, and calculates the second result v2=c·a based on the ciphertext c, a. e / (1+n) me , by comparing the first result with the second result, the legitimacy of the ciphertext c is verified. It can be seen that v1=Enc pk,Z (m) = (1 + n) m ·Z n =(1+n) m ·(r·r′ e ) n =(1+n) m ·r n ·r′ en , v2=c·r′ en ,The legality of the ciphertext generation process can be verified by reducing the random term.,In the first stage, the data query party uses this method to prove to the data storage party that the transmitted ciphertext is 1, that is,,set m=1.

[0152] like Figure 4 As shown, the zero-knowledge proof of inequality of homomorphic ciphertexts introduced in the second stage is used to prove to the proving party that the plaintexts corresponding to the ciphertexts c0 and c1 shared by the two parties are not equal. In this embodiment, the proving party is the data querying party, and the verifying party is the data storage party. The two ciphertexts held are the ciphertext c0 of the value 1 shared in the first stage and the sum of the components in the bit vector in the query request (that is, the ciphertext of the number of users in the user set corresponding to the query request) c1, thereby effectively realizing the detection of user requests and rejecting malicious precise queries by the data querying party. Among them, the proving party holds the Paillier homomorphic encryption public key pk=n, the private key sk=φ(n), and the verifying party holds the homomorphic encryption public key pk=n.

[0153] In addition, during the zero-knowledge proof of unequal homomorphic ciphertexts, the verifier randomly generates a challenge bit set b, uses the Paillier homomorphic encryption public key to re-randomize the corresponding ciphertexts in the challenge bit set to generate a challenge ciphertext set, sends the challenge ciphertext set to the prover, and requires the prover to guess the challenge bit by comparing the challenge ciphertext with c0. In the commitment phase, the prover decrypts the challenge ciphertext and compares it with c0, inverts the result to obtain the comparison result cmp, selects a random number op, uses a commitment scheme based on collision-resistant hashing to calculate the commitment value hash(op||cmp) of cmp, and sends the commitment value to the verifier. During this process, the verifier also sends the challenge bit and the random number used for re-randomization to the prover. The prover uses the Paillier homomorphic encryption public key to re-randomize the ciphertext corresponding to the challenge bit based on the challenge bit and this random number, and then compares it with the received challenge ciphertext to verify the legitimacy of the challenge ciphertext. After the legitimacy of the challenge ciphertext is verified, the prover sends the random parameter op to the verifier, so that the verifier reveals the commitment based on the random number op and the comparison result cmp, calculates hash(op||b) and compares it with the commitment value sent by the prover. If they are equal, the single challenge verification is passed. It can be seen that when the two ciphertexts to be verified correspond to different plaintexts, the prover can always correctly obtain the challenge bits to complete the verification. When the two ciphertexts correspond to the same plaintext, for one challenge, the probability of the prover guessing successfully is 1 / 2, and after k challenges, the probability of the prover guessing successfully is reduced to 1 / 2. k In the specific implementation, in order to reduce the number of communication rounds, the verifier and the prover respectively aggregate the challenge ciphertexts of k verification interactions into a challenge ciphertext set and then send it.

[0154] The present application provides a data summation query device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data summation query method in the above-mentioned embodiment one.

[0155] Reference below Figure 5 , which shows a schematic diagram of the structure of a data sum query device suitable for implementing the embodiment of the present application. The data sum query device in the embodiment of the present application may include but is not limited to mobile terminals such as laptop computers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions: tablet computers), etc., and fixed terminals such as desktop computers, etc. Figure 5 The data summation query device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0156] like Figure 5 As shown, the data summation query device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the data summation query device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the data summing query device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a data summing query device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0157] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0158] The data summation query device provided by the present application adopts the data summation query method in the above embodiment, which can solve the technical problem of how to avoid the query request for a single user, resulting in the exposure of user privacy. Compared with the related art, the beneficial effect of the data summation query device provided by the present application is the same as the beneficial effect of the data summation query method provided by the above embodiment, and the other technical features in the data summation query device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0159] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0160] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0161] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the data summation query method in the above-mentioned embodiment.

[0162] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0163] The computer-readable storage medium may be included in the data summing query device; or may exist independently without being assembled into the data summing query device.

[0164] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the data summation query device, the data summation query device: sends a query bit set to the data storage end; multiple query bits in the query bit set correspond to multiple users one by one, and when the corresponding user is included in the query request, the value of the query bit is a ciphertext of a first preset value; receives a challenge ciphertext set returned by the data storage end; the challenge ciphertext set is obtained by the data storage end for each initial challenge ciphertext in the initial challenge ciphertext set by re-randomizing the initial challenge ciphertext using the corresponding first random number in the first random number set, and the initial challenge ciphertext includes the sum of all query bits in the query bit set; generates a commitment value set according to the comparison result between the challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and the preset plaintext corresponding to the preset restriction ciphertext; sends the commitment value set to the data storage end; receives the query result returned by the data storage end; the query result is obtained by querying the database according to the query bit set after the data storage end verifies that the commitment value set has passed.

[0165] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0166] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0167] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0168] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned data sum query method, and can solve the technical problem of how to avoid query requests for a single user, which leads to the exposure of user privacy. Compared with the related art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the data sum query method provided in the above-mentioned embodiment, and will not be repeated here.

[0169] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned data summation query method when executed by a processor.

[0170] The computer program product provided by this application can solve the technical problem of how to avoid the exposure of user privacy due to query requests for a single user. Compared with the related art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the data summation query method provided by the above embodiment, which will not be repeated here.

[0171] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A data sum query method, characterized in that: Applied to the data query end, the data sum query method includes: Sending a query bit set to a data storage end; wherein a plurality of query bits in the query bit set correspond to a plurality of users one by one, and when the query request includes the corresponding user, the value of the query bit is a ciphertext of a first preset value; receiving a challenge ciphertext set returned by the data storage end; the challenge ciphertext set is obtained by the data storage end re-randomizing the initial challenge ciphertext in the initial challenge ciphertext set using a corresponding first random number in a first random number set, the initial challenge ciphertext including the sum of all query bits in the query bit set; Generate a commitment value set according to a comparison result between a challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and a preset plaintext corresponding to a preset restriction ciphertext; Sending the commitment value set to the data storage end; The query result returned by the data storage end is received; the query result is obtained by querying the database according to the query bit set after the data storage end verifies that the commitment value set has passed.

2. The data sum query method according to claim 1, characterized in that: Before the step of sending the commitment value set to the data storage end, the data sum query method further includes: Receive the first random number set and the initial challenge ciphertext set sent by the data storage end; For each of the initial challenge ciphertexts, re-randomize the initial challenge ciphertext using the first random number corresponding to the first random number set to obtain an intermediate ciphertext set; For each intermediate ciphertext in the intermediate ciphertext set, compare the intermediate ciphertext with the corresponding challenge ciphertext in the challenge ciphertext set to obtain a first verification result; If the first verification result is that the verification is passed, the step of sending the commitment value set to the data storage end is executed.

3. The data sum query method according to claim 1, characterized in that: The step of generating a commitment value set according to the comparison result between each challenge ciphertext in the challenge ciphertext set and the preset restriction ciphertext comprises: For each of the comparison results, calculating a first hash value of the comparison result and a corresponding second random number in the second random number set; Obtaining the commitment value set according to all the first hash values; The step of sending the commitment value set to the data storage end comprises: The commitment value set, the second random number set and each comparison result are sent to the data storage end, so that the data storage end calculates, for each comparison result, a third hash value of the comparison result and the corresponding second random number in the second random number set, and, for each commitment value in the commitment value set, compares the commitment value with the corresponding third hash value to perform verification of the commitment value set.

4. The data sum query method according to claim 1, characterized in that: Before the step of sending the query bit set to the data storage end, the method further includes: Encrypting a preset plaintext corresponding to the preset restricted ciphertext using a third random number to obtain a first ciphertext; Encrypting the preset plaintext using a fourth random number to obtain a second ciphertext; Obtain an auxiliary random number according to the third random number, the fourth random number, and a second Hash value of the first ciphertext and the second ciphertext; Sending the first ciphertext, the second ciphertext and the auxiliary random number to the data storage end; receiving a second verification result returned by the data storage end, where the second verification result is obtained by the data storage end verifying the first ciphertext or the second ciphertext according to the second hash value and the auxiliary random number; If the second verification result is that the verification is passed, the first ciphertext or the second ciphertext is used as the preset restricted ciphertext, and the step of sending the query bit set to the data storage end is performed.

5. A data sum query method, characterized in that: Applied to the data storage end, the data sum query method includes: Receive a query bit set sent by a data query end; wherein a plurality of query bits in the query bit set correspond to a plurality of users one by one, and when the query request includes the corresponding user, the value of the query bit is a ciphertext of a first preset value; For each initial challenge ciphertext in the initial challenge ciphertext set, re-randomize the initial challenge ciphertext using a corresponding first random number in the first random number set to obtain a challenge ciphertext set; the initial challenge ciphertext includes the sum of all query bits in the query bit set; Sending the challenge ciphertext set to the data query end; Receive and verify the commitment value set returned by the data query end; the commitment value set is generated by the data query end according to the comparison result between the challenge plaintext corresponding to each challenge ciphertext in the challenge ciphertext set and the preset plaintext corresponding to the preset restriction ciphertext; If the commitment value set passes the verification, the database is queried according to the query bit set to obtain a query result.

6. The data sum query method according to claim 5, characterized in that: Before the step of receiving the query bit set sent by the data query end, the data summation query method further includes: receiving a first ciphertext, a second ciphertext and an auxiliary random number sent by the data query end; the first ciphertext is obtained by the data query end by encrypting a preset plaintext corresponding to the preset restricted ciphertext using a third random number, the second ciphertext is obtained by the data query end by encrypting the preset plaintext using a fourth random number, and the auxiliary random number is obtained by the data query end according to the third random number, the fourth random number, and a second Hash value of the first ciphertext and the second ciphertext; Encrypting the preset plaintext using the auxiliary random number to obtain a third ciphertext; Obtaining a verification ciphertext according to the first ciphertext, the second ciphertext and the second Hash value; Comparing the third ciphertext with the verification ciphertext to obtain a second verification result; If the second verification result is that the verification is passed, the first ciphertext or the second ciphertext is used as the preset restricted ciphertext, and the step of receiving the query bit set sent by the data query end is performed.

7. The data sum query method according to claim 5, characterized in that: The step of querying the database according to the query bit set to obtain the query result comprises: For each query bit in the query bit set, query from the database to obtain corresponding query data; The query result is obtained according to all the query data and the corresponding query bits.

8. A data summing query device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data sum query method according to any one of claims 1 to 7.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data summation query method according to any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the data sum query method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Privacy data query method and device based on smart contract

    CN110580417A

  • Private data processing method and device, electronic equipment and readable storage medium

    CN116561789A

  • Threshold multi-keyword search method capable of resisting off-line keyword guess and subversive attack

    CN117335971A

  • Apparatus for privacy preserving text search using homomorphic encryption and method thereof

    US20240097878A1