Data anonymity query method and system
By constructing and updating auxiliary Boolean matrices to generate encryption keys and utilizing the oblivious transfer protocol, the data query process is concealed, which solves the problem of balancing query privacy and efficiency in existing technologies and achieves efficient data query protection.
Patent Information
- Application Number
- CN202510962255.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-07-14
AI Technical Summary
Existing technologies make it difficult to achieve efficient data query performance while ensuring query privacy, and traditional encrypted query schemes lack sufficient query intent concealment capabilities, posing a risk of data leakage.
By constructing and updating auxiliary Boolean matrices, generating encryption keys and encrypting data, and using the oblivious transfer protocol to collaboratively generate decryption keys, the data query anonymity process is achieved, including offline preprocessing and computational optimization in the online query stage.
Significantly improve query efficiency, ensure that data service providers cannot know the query content, effectively protect query privacy, and reduce computing overhead.
Smart Images

Figure CN120448431B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a data anonymity query method and system. Background Art
[0002] In the era of big data, online data queries have become commonplace. A data queryer initiates a query request to a data service provider, which then performs the query in the database and returns the query results to the queryer.
[0003] However, when data queryers directly disclose their desired data to data service providers, there is a risk of information leakage. The data service provider may leak the query information to other devices, thereby leaking the queryer's data and posing a security risk. For example, a lending institution may query a credit bureau for a borrower's creditworthiness data. The lending institution may not want the credit bureau to know that the borrower has a loan request, otherwise the credit bureau will provide the borrower's information to other lending institutions. Therefore, the borrower's information must be protected.
[0004] In the existing technology, in order to solve the privacy protection problem, the following methods are mainly used:
[0005] 1. Fully homomorphic encryption: allows calculations to be performed directly on encrypted data, but the computational overhead is extremely high and difficult to apply in practice;
[0006] 2. Traditional encrypted query: Lightweight solutions based on Bloom filters or hash indexes lack sufficient query intent concealment capabilities, making it difficult to prevent data service providers from inferring query targets through traffic characteristics or indexes. Summary of the Invention
[0007] The embodiments of the present invention provide a data anonymity query method and system to solve the problem in the prior art that it is difficult to simultaneously ensure query privacy and efficient query performance.
[0008] To achieve the above-mentioned purpose, on the one hand, the present invention provides a data anonymity query method, which includes: S1, the data service party constructs a first auxiliary Boolean matrix for all identifiers, and randomly generates a second auxiliary Boolean matrix; the third auxiliary Boolean matrix is calculated based on the first auxiliary Boolean matrix and the second auxiliary Boolean matrix; the encryption key corresponding to each identifier data is calculated based on the second auxiliary Boolean matrix; S2, the data service party encrypts each identifier data based on the encryption key corresponding to each identifier data, and obtains the ciphertext corresponding to each identifier data; the data service party performs salted hashing on each identifier to obtain the salted hash value corresponding to each identifier; S3, the data service party performs hashing on each identifier and truncates the hash prefix to obtain the hash prefix value corresponding to each identifier; the processed data corresponding to all identifiers are grouped according to the hash prefix value to obtain multiple groups; the processed data includes the salted hash value and the ciphertext ; S4. The data query party calculates the hash prefix value of the query identifier and sends it to the data service party, so that the data service party finds the target group in all groups according to the hash prefix value of the query identifier and sends it to the data query party; S5. According to the second auxiliary Boolean matrix and the third auxiliary Boolean matrix provided by the data service party and the query identifier provided by the data query party, the data service party and the data query party collaboratively generate the element positions of the fourth auxiliary Boolean matrix of the data query party through the oblivious transfer protocol and the oblivious transfer function protocol; S6. The data query party calculates the decryption key corresponding to the query identifier data according to the element positions of the fourth auxiliary Boolean matrix; the data query party performs salted hashing on the query identifier to obtain the salted hash value corresponding to the query identifier; S7. The data query party finds the target ciphertext in the target group according to the salted hash value corresponding to the query identifier, and uses the decryption key corresponding to the query identifier data to decrypt the target ciphertext to obtain plaintext.
[0009] Optionally, S1 includes: the data service provider initializes the first auxiliary Boolean matrix as an all-1 matrix; the data service provider randomly selects a pseudo-random function seed, and sets some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier to update the first auxiliary Boolean matrix; the data service provider randomly generates a second auxiliary Boolean matrix, and generates a third auxiliary Boolean matrix by bitwise XORing the updated first auxiliary Boolean matrix and the second auxiliary Boolean matrix; the data service provider calculates the encryption key corresponding to each identification data based on the second auxiliary Boolean matrix.
[0010] Optionally, setting some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier to update the first auxiliary Boolean matrix includes: calculating the element position in the first auxiliary Boolean matrix corresponding to each identifier according to the pseudo-random function seed and each identifier, and setting the element at the element position in the first auxiliary Boolean matrix corresponding to each identifier to 0 to update the first auxiliary Boolean matrix; calculating the encryption key corresponding to each identifier data according to the second auxiliary Boolean matrix includes: extracting the element at the same position in the second auxiliary Boolean matrix according to the element position in the first auxiliary Boolean matrix corresponding to each identifier; and calculating the encryption key corresponding to each identifier data by using a hash algorithm based on the extracted elements corresponding to each identifier.
[0011] Optionally, S5 includes: the data service party inputs the second auxiliary Boolean matrix and the third auxiliary Boolean matrix, the data query party inputs a random bit string, and collaborative calculation is performed through the oblivious transfer protocol so that the data query party outputs a fourth auxiliary Boolean matrix; the data service party inputs a pseudo-random function seed, and the data query party inputs a query identifier, and collaborative calculation is performed through the oblivious transfer function protocol so that the data query party outputs the element position in the fourth auxiliary Boolean matrix corresponding to the query identifier.
[0012] Optionally, the processed data corresponding to identifiers with the same hash prefix value are grouped together.
[0013] On the other hand, the present invention provides a data anonymity query system, which includes: an encryption key calculation unit, which is used by the data service party to construct a first auxiliary Boolean matrix for all identifiers and randomly generate a second auxiliary Boolean matrix; a third auxiliary Boolean matrix is calculated based on the first auxiliary Boolean matrix and the second auxiliary Boolean matrix; an encryption key corresponding to each identification data is calculated based on the second auxiliary Boolean matrix; a processing data calculation unit, which is used by the data service party to encrypt each identification data based on the encryption key corresponding to each identification data, and obtain a ciphertext corresponding to each identification data; the data service party performs salted hashing on each identification to obtain a salted hash value corresponding to each identification; a grouping unit, which is used by the data service party to hash each identification and truncate the hash prefix to obtain a hash prefix value corresponding to each identification; grouping the processed data corresponding to all identifications according to the hash prefix value to obtain multiple groups; the processed data includes the salted hash value and the ciphertext; a query unit , used by the data query party to calculate the hash prefix value of the query identifier and send it to the data service party, so that the data service party can find the target group in all groups according to the hash prefix value of the query identifier and send it to the data query party; a position generation unit, used by the data service party and the data query party to collaboratively generate the element positions of the fourth auxiliary Boolean matrix of the data query party through the oblivious transfer protocol and the oblivious transfer function protocol according to the second auxiliary Boolean matrix and the third auxiliary Boolean matrix provided by the data service party and the query identifier provided by the data query party; a decryption key calculation unit, used by the data query party to calculate the decryption key corresponding to the query identifier data according to the element positions of the fourth auxiliary Boolean matrix; the data query party performs salted hashing on the query identifier to obtain the salted hash value corresponding to the query identifier; a decryption unit, used by the data query party to find the target ciphertext in the target group according to the salted hash value corresponding to the query identifier, and use the decryption key corresponding to the query identifier data to decrypt the target ciphertext to obtain plaintext.
[0014] Optionally, the encryption key calculation unit includes: an initialization subunit, used by the data service party to initialize the first auxiliary Boolean matrix to an all-1 matrix; an update subunit, used by the data service party to randomly select a pseudo-random function seed, and set some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier to update the first auxiliary Boolean matrix; a generation subunit, used by the data service party to randomly generate a second auxiliary Boolean matrix, and generate a third auxiliary Boolean matrix by bitwise XORing the updated first auxiliary Boolean matrix and the second auxiliary Boolean matrix; an encryption key calculation subunit, used by the data service party to calculate the encryption key corresponding to each identification data based on the second auxiliary Boolean matrix.
[0015] Optionally, setting some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier to update the first auxiliary Boolean matrix includes: calculating the element position in the first auxiliary Boolean matrix corresponding to each identifier according to the pseudo-random function seed and each identifier, and setting the element at the element position in the first auxiliary Boolean matrix corresponding to each identifier to 0 to update the first auxiliary Boolean matrix; calculating the encryption key corresponding to each identifier data according to the second auxiliary Boolean matrix includes: extracting the element at the same position in the second auxiliary Boolean matrix according to the element position in the first auxiliary Boolean matrix corresponding to each identifier; and calculating the encryption key corresponding to each identifier data by using a hash algorithm based on the extracted elements corresponding to each identifier.
[0016] Optionally, the position generation unit includes: a fourth auxiliary Boolean matrix generation subunit, which is used for the data service party to input the second auxiliary Boolean matrix and the third auxiliary Boolean matrix, and the data query party to input a random bit string, and to perform collaborative calculation through an oblivious transfer protocol so that the data query party outputs a fourth auxiliary Boolean matrix; a position generation subunit, which is used for the data service party to input a pseudo-random function seed, and the data query party to input a query identifier, and to perform collaborative calculation through an oblivious transfer function protocol so that the data query party outputs the element position in the fourth auxiliary Boolean matrix corresponding to the query identifier.
[0017] Optionally, the processed data corresponding to identifiers with the same hash prefix value are grouped together.
[0018] Beneficial effects of the present invention:
[0019] The present invention provides a data anonymity query method and system, wherein the method transfers most of the computational complexity to an offline stage, namely, calculating the encryption key corresponding to each identification data, the ciphertext corresponding to each identification data, and the salted hash value corresponding to each identification, and grouping the processed data corresponding to all identifications to obtain multiple groups; in the online query stage, decryption can be completed only through an oblivious transfer protocol, an oblivious transfer function protocol, and a decryption operation, thereby greatly improving query efficiency; through a first auxiliary Boolean matrix, a second auxiliary Boolean matrix, a third auxiliary Boolean matrix, and a fourth auxiliary Boolean matrix, it is ensured that a data service provider cannot know the specific query content of a data query party, thereby effectively protecting the query privacy. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 This is a flow chart of a data anonymity query method provided by an embodiment of the present invention;
[0021] Figure 2 is a flowchart of calculating an encryption key provided by an embodiment of the present invention;
[0022] Figure 3is a flowchart of generating element positions of a fourth auxiliary Boolean matrix provided by an embodiment of the present invention;
[0023] Figure 4 This is a structural diagram of a data anonymity query system provided by an embodiment of the present invention;
[0024] Figure 5 Schematic diagram of the structure of an encryption key calculation unit provided by an embodiment of the present invention;
[0025] Figure 6 It is a structural diagram of a position generation unit provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] To make the objectives, technical solutions, and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings. It is apparent that the embodiments described are only some, not all, of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort are intended to fall within the scope of protection of the present invention.
[0027] Figure 1 This is a flow chart of a data anonymity query method provided by an embodiment of the present invention. Figure 1 As shown, the method includes:
[0028] S1. The data service provider constructs a first auxiliary Boolean matrix for all identifiers and randomly generates a second auxiliary Boolean matrix; calculates a third auxiliary Boolean matrix based on the first and second auxiliary Boolean matrices; and calculates the encryption key corresponding to each identifier data based on the second auxiliary Boolean matrix.
[0029] The data is first pre-processed offline by the data service provider. The data service provider’s database stores N data records, each of which contains a unique identifier ( ) and its corresponding data content ( , identification data), all data records can be represented as:
[0030]
[0031] In an optional embodiment, Figure 2 is a flowchart of calculating an encryption key provided by an embodiment of the present invention; Figure 2 As shown, the S1 includes:
[0032] S11. The data service provider initializes the first auxiliary Boolean matrix to an all-1 matrix;
[0033] Define a first auxiliary Boolean matrix D with m rows and w columns, and initialize all elements of the first auxiliary Boolean matrix D to 1.
[0034] The following is an example to illustrate:
[0035] Take N = 2 (two samples), id1 = "alice", id2 = "bob", m = 4 (the matrix has 4 rows, namely the 1st, 2nd, 3rd, and 4th rows), and w = 3 (the matrix has 3 columns, namely the 1st, 2nd, and 3rd columns) as an example:
[0036] The first auxiliary Boolean matrix D =
[0037] S12. The data service provider randomly selects a pseudo-random function seed, and sets some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier, so as to update the first auxiliary Boolean matrix;
[0038] The data service provider randomly generates a pseudo-random function seed , where λ is the security parameter;
[0039] In an optional embodiment, setting some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier to update the first auxiliary Boolean matrix includes:
[0040] Calculating the element position in the first auxiliary Boolean matrix corresponding to each identifier based on the pseudorandom function seed and each identifier, and setting the element in the element position in the first auxiliary Boolean matrix corresponding to each identifier to 0 to update the first auxiliary Boolean matrix;
[0041] Specifically, for each identifier , calculate the element position in the first auxiliary Boolean matrix D , the specific calculation formula is:
[0042]
[0043] in, is the first hash function, is the second hash function, is the i-th identifier, seed is the pseudo-random function seed, is the row value corresponding to the first column of the first auxiliary Boolean matrix D for the i-th identifier, is the row value corresponding to the second column of the first auxiliary Boolean matrix D for the i-th identifier, is the row value corresponding to the wth column of the first auxiliary Boolean matrix D for the i-th identifier.
[0044] Each element at the corresponding row and column position in the first auxiliary Boolean matrix D is set to 0 to update the first auxiliary Boolean matrix.
[0045] In the above example, by calculating id1 = "alice" → element row position = (3, 1, 4);
[0046] id2 = "bob"→ element row position = (2, 4, 3);
[0047] Update the first auxiliary Boolean matrix D =
[0048] S13. The data service provider randomly generates a second auxiliary Boolean matrix, and performs bitwise XOR on the updated first auxiliary Boolean matrix and the second auxiliary Boolean matrix to generate a third auxiliary Boolean matrix.
[0049] The data service provider randomly generates a second auxiliary Boolean matrix A with m rows and w columns , k is the kth row, g is the gth column, ; Generate a third auxiliary Boolean matrix B by bitwise XORing the updated first auxiliary Boolean matrix D and the second auxiliary Boolean matrix A; wherein, .
[0050] The following is described through a specific embodiment:
[0051] The second auxiliary Boolean matrix A =
[0052] Calculate the third auxiliary Boolean matrix B=
[0053] S14. The data service provider calculates the encryption key corresponding to each identification data according to the second auxiliary Boolean matrix.
[0054] In an optional embodiment, the S14 includes:
[0055] According to the element position in the first auxiliary Boolean matrix corresponding to each identifier, extract the element at the same position in the second auxiliary Boolean matrix;
[0056] For each identifier , according to its corresponding element position in the first auxiliary Boolean matrix D , find the corresponding element position in the second auxiliary Boolean matrix A, that is , extract the element at the element position from the second auxiliary Boolean matrix A and concatenate them into a binary vector:
[0057] The encryption key corresponding to each identification data is calculated using a hash algorithm based on the elements corresponding to each extracted identification.
[0058] The binary vector corresponding to each identifier is passed through the hash function (hashlib.sha256) calculates the encryption key corresponding to each identification data, and the formula is as follows:
[0059] , is the encryption key corresponding to the i-th identification data, .
[0060] The following is described through a specific embodiment:
[0061] For the first identifier, its element row position = (3, 1, 4); take out A[3][1] = 1, A[1][2] = 1, A[4][3] = 0 from A, and splice them into "110";
[0062] For the second identifier, its element row position = (2, 4, 3); take out A[2][1] = 0, A[4][2] = 1, A[3][3] = 1 from A, and splice them into "011";
[0063] S2. The data service provider encrypts each identification data based on the encryption key corresponding to each identification data to obtain the ciphertext corresponding to each identification data; the data service provider performs salted hashing on each identification to obtain the salted hash value corresponding to each identification;
[0064] The data service provider encrypts each identification data based on the symmetric encryption algorithm (the encryption key corresponding to each identification data) , get the ciphertext corresponding to each identification data ,in, is the ciphertext corresponding to the i-th identification data, , Is the encryption algorithm function.
[0065] Data service provider based on hash algorithm , calculate each identifier The salted hash value of , is the salted hash value of the i-th identifier, .
[0066] S3. The data service provider hashes each identifier and truncates the hash prefix to obtain a hash prefix value corresponding to each identifier; grouping the processed data corresponding to all identifiers according to the hash prefix value to obtain multiple groups; the processed data includes the salted hash value and the ciphertext;
[0067] First, the data service provider is based on the hash algorithm , calculate each identifier Hash value , is the hash value of the i-th identifier, ; Then, based on the truncation function , extract each identifier Hash value prefix , is the hash prefix value corresponding to the i-th identifier, , Parameters are truncated for safety;
[0068] Group the processed data corresponding to all identifiers according to the hash prefix value to obtain multiple groups; The processed data corresponding to the same identifier are grouped together; that is, all different hash prefix values Record , as a group index; wherein the processed data includes the salted hash value and ciphertext.
[0069] According to the “grouping system with the same hash prefix value”, all processed data are divided into groups, each group contains the number of processed data , and satisfies .
[0070] That is, all grouping sets after all processed data groups:
[0071]
[0072] ,
[0073] For group j, is the group index of group j (that is, the hash prefix value), , is the number of groups, For the Group The amount of processed data; is the salted hash value of the first identifier in the jth group, is the salted hash value of the second identifier in the jth group, is the first The salted hash value of the identifier, is the ciphertext corresponding to the first identification data in the jth group, is the ciphertext corresponding to the second identification data in the jth group, is the first The ciphertext corresponding to the identification data.
[0074] The following is described through a specific embodiment:
[0075] Assume there are 10 identifiers in total, divided into 6 groups; the hash prefix values of the 1st and 2nd identifiers are the same, the hash prefix values of the 3rd and 5th identifiers are the same, and the hash prefix values of the 7th, 8th, and 9th identifiers are the same.
[0076] The processed data corresponding to the 1st and 2nd identifiers are group 1, the processed data corresponding to the 3rd and 5th identifiers are group 2, the processed data corresponding to the 4th identifier is group 3, the processed data corresponding to the 6th identifier is group 4, the processed data corresponding to the 7th, 8th, and 9th identifiers are group 5, and the processed data corresponding to the 10th identifier is group 6.
[0077] Take the first group as an example:
[0078]
[0079] For Group 1, is the group index of the first group, that is, the hash prefix value of the first and second identifiers, is the salted hash value of the first identifier in group 1, is the ciphertext corresponding to the first identification data in the first group, is the salted hash value of the second identifier in group 1, The ciphertext corresponding to the second identification data in the first group.
[0080] Once the grouping is complete, the offline preprocessing phase is complete. Next, the online query phase begins, which is performed interactively by the data query party and the data service provider:
[0081] S4. The data query party calculates the hash prefix value of the query identifier and sends it to the data service party, so that the data service party finds the target group in all groups according to the hash prefix value of the query identifier and sends it to the data query party;
[0082] In an optional embodiment, the data query party calculates the hash prefix value of the query identifier , send the hash prefix value of the query identifier To the data service provider.
[0083] Data service provider traversal , assuming there is , then the target group is ,
[0084] The processed data corresponding to the target group is recorded as :
[0085] ,
[0086] Send the processing data corresponding to the target group To the data query party.
[0087] S5. Based on the second auxiliary Boolean matrix and the third auxiliary Boolean matrix provided by the data service provider and the query identifier provided by the data query provider, the data service provider and the data query provider collaboratively generate element positions of the fourth auxiliary Boolean matrix of the data query provider through the oblivious transfer protocol and the oblivious transfer function protocol;
[0088] In an optional embodiment, Figure 3 : is a flow chart of generating element positions of a fourth auxiliary Boolean matrix provided by an embodiment of the present invention; Figure 3 As shown, the S5 includes:
[0089] S51: The data service provider inputs a second auxiliary Boolean matrix and a third auxiliary Boolean matrix, and the data query provider inputs a random bit string. Collaborative calculation is performed through the oblivious transfer protocol, so that the data query provider outputs a fourth auxiliary Boolean matrix.
[0090] Specifically,
[0091] Protocol input: The data service party acts as the sender and inputs the "homogeneous random" auxiliary matrix pair and the second auxiliary Boolean matrix A , the third auxiliary Boolean matrix B ; The data query party acts as the receiver and inputs a random bit string ;
[0092] Execution process: The data service provider and the data query provider jointly execute w times protocol (i.e., oblivious transfer protocol);
[0093] Protocol output: The data query party outputs the fourth auxiliary Boolean matrix , that is, randomly combining "homogeneous matrices" to satisfy .
[0094] S52: The data service provider inputs a pseudo-random function seed, and the data query provider inputs a query identifier, and performs collaborative calculation through an oblivious transfer function protocol, so that the data query provider outputs the element position in the fourth auxiliary Boolean matrix corresponding to the query identifier.
[0095] Specifically,
[0096] Protocol input: The data service provider, as the sender, inputs the pseudo-random function seed; the data query provider, as the receiver, inputs the query identification ID;
[0097] Execution process: The data service provider and the data query provider jointly execute the OPRF protocol (Oblivious Pseudo-Random Function protocol);
[0098] Protocol output: The data query party outputs the element position in the fourth auxiliary Boolean matrix corresponding to the query identification ID, that is, .
[0099] in, is the first hash function, is the second hash function, ID is the query identifier, seed is the pseudo-random function seed, To query the row value corresponding to the first column in the fourth auxiliary Boolean matrix C, To query the row value corresponding to the second column in the fourth auxiliary Boolean matrix C, The row value corresponding to the w-th column in the fourth auxiliary Boolean matrix C is identified by the query.
[0100] S6. The data querying party calculates the decryption key corresponding to the query identification data based on the element positions of the fourth auxiliary Boolean matrix; the data querying party performs a salted hash on the query identification to obtain a salted hash value corresponding to the query identification;
[0101] In an optional embodiment, the data querying party calculates the decryption key corresponding to the query identification data according to the element position of the fourth auxiliary Boolean matrix, including:
[0102] Extract the elements corresponding to the query identifier from the fourth auxiliary Boolean matrix C and concatenate them into a binary vector:
[0103] The binary vector corresponding to the query identifier is passed through the hash function (hashlib.sha256) calculates the decryption key corresponding to the query identification data. The formula is as follows:
[0104] , The decryption key corresponding to the query identification data.
[0105] Data query based on hash algorithm , calculate the query identifier The salted hash value of .
[0106] S7. The data querying party finds the target ciphertext in the target group according to the salted hash value corresponding to the query identifier, and decrypts the target ciphertext using the decryption key corresponding to the query identifier data to obtain the plaintext.
[0107] Specifically, the data query party processes the data based on the received target group. ,
[0108] Iterate over the salted hash values of all the identifiers contained in the target group , assuming there is , then the target ciphertext is accurately located as ;
[0109] Decrypt the query identifier based on the symmetric encryption algorithm Corresponding data The target ciphertext is: , is plain text, and DEC is the encryption algorithm function.
[0110] Figure 4 Schematic diagram of a data anonymity query system provided by an embodiment of the present invention; Figure 4 As shown, the system includes:
[0111] The encryption key calculation unit 201 is used by the data service provider to construct a first auxiliary Boolean matrix for all identifiers and randomly generate a second auxiliary Boolean matrix; calculate a third auxiliary Boolean matrix based on the first auxiliary Boolean matrix and the second auxiliary Boolean matrix; and calculate the encryption key corresponding to each identifier data based on the second auxiliary Boolean matrix;
[0112] The data processing calculation unit 202 is used for the data service provider to encrypt each identification data based on the encryption key corresponding to each identification data to obtain the ciphertext corresponding to each identification data; the data service provider performs salted hashing on each identification to obtain the salted hash value corresponding to each identification;
[0113] The grouping unit 203 is configured to hash each identifier and truncate the hash prefix to obtain a hash prefix value corresponding to each identifier; group the processed data corresponding to all identifiers according to the hash prefix value to obtain multiple groups; the processed data includes the salted hash value and the ciphertext;
[0114] Query unit 204, configured for the data query party to calculate a hash prefix value of the query identifier and send it to the data service party, so that the data service party can find the target group in all groups according to the hash prefix value of the query identifier and send it to the data query party;
[0115] A position generating unit 205 is configured to collaboratively generate element positions of a fourth auxiliary Boolean matrix of the data query party using an oblivious transfer protocol and an oblivious transfer function protocol based on the second and third auxiliary Boolean matrices provided by the data service provider and the query identifier provided by the data query party.
[0116] The decryption key calculation unit 206 is used for the data query party to calculate the decryption key corresponding to the query identifier data according to the element position of the fourth auxiliary Boolean matrix; the data query party performs a salted hash on the query identifier to obtain a salted hash value corresponding to the query identifier;
[0117] The decryption unit 207 is used for the data query party to find the target ciphertext in the target group according to the salted hash value corresponding to the query identifier, and decrypt the target ciphertext using the decryption key corresponding to the query identifier data to obtain the plaintext.
[0118] In an optional embodiment, Figure 5 Schematic diagram of the structure of the encryption key calculation unit provided by the embodiment of the present invention; Figure 5 As shown, the encryption key calculation unit 201 includes:
[0119] Initialization subunit 2011, used by the data service provider to initialize the first auxiliary Boolean matrix to an all-1 matrix;
[0120] An updating subunit 2012 is configured for the data service provider to randomly select a pseudo-random function seed, and to set some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier, so as to update the first auxiliary Boolean matrix;
[0121] The generating subunit 2013 is configured to randomly generate a second auxiliary Boolean matrix at the data service provider, and generate a third auxiliary Boolean matrix by performing bitwise XOR on the updated first auxiliary Boolean matrix and the second auxiliary Boolean matrix;
[0122] The encryption key calculation subunit 2014 is used by the data service provider to calculate the encryption key corresponding to each identification data according to the second auxiliary Boolean matrix.
[0123] In an optional embodiment, setting some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier to update the first auxiliary Boolean matrix includes:
[0124] Calculating the element position in the first auxiliary Boolean matrix corresponding to each identifier based on the pseudorandom function seed and each identifier, and setting the element in the element position in the first auxiliary Boolean matrix corresponding to each identifier to 0 to update the first auxiliary Boolean matrix;
[0125] Calculating the encryption key corresponding to each identification data according to the second auxiliary Boolean matrix includes:
[0126] According to the element position in the first auxiliary Boolean matrix corresponding to each identifier, extract the element at the same position in the second auxiliary Boolean matrix;
[0127] The encryption key corresponding to each identification data is calculated using a hash algorithm based on the elements corresponding to each extracted identification.
[0128] In an optional embodiment, Figure 6 : is a schematic diagram of the structure of the position generating unit provided in an embodiment of the present invention; Figure 6 As shown, the position generating unit 205 includes:
[0129] The fourth auxiliary Boolean matrix generating subunit 2051 is configured to receive the second and third auxiliary Boolean matrices from the data service provider and the random bit string from the data query provider, and perform collaborative calculations through the oblivious transfer protocol, so that the data query provider outputs the fourth auxiliary Boolean matrix.
[0130] The position generation subunit 2052 is used for the data service party to input a pseudo-random function seed, and the data query party to input a query identifier, and to perform collaborative calculations through the oblivious transfer function protocol so that the data query party outputs the element position in the fourth auxiliary Boolean matrix corresponding to the query identifier.
[0131] In an optional implementation, the processed data corresponding to identifiers with the same hash prefix value are grouped together.
[0132] The system of the present invention corresponds to the above method, and the specific implementation of the system will not be repeated here.
[0133] Beneficial effects of the present invention:
[0134] The present invention provides a data anonymity query method and system, wherein the method transfers most of the computational complexity to an offline stage, namely, calculating the encryption key corresponding to each identification data, the ciphertext corresponding to each identification data, and the salted hash value corresponding to each identification, and grouping the processed data corresponding to all identifications to obtain multiple groups; in the online query stage, decryption can be completed only through an oblivious transfer protocol, an oblivious transfer function protocol, and a decryption operation, thereby greatly improving query efficiency; through a first auxiliary Boolean matrix, a second auxiliary Boolean matrix, a third auxiliary Boolean matrix, and a fourth auxiliary Boolean matrix, it is ensured that a data service provider cannot know the specific query content of a data query party, thereby effectively protecting the query privacy.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A data anonymity query method, characterized in that: include: S1. The data service provider constructs a first auxiliary Boolean matrix for all identifiers and randomly generates a second auxiliary Boolean matrix; A third auxiliary Boolean matrix is calculated based on the first auxiliary Boolean matrix and the second auxiliary Boolean matrix; an encryption key corresponding to each identification data is calculated based on the second auxiliary Boolean matrix; S2. The data service provider encrypts each piece of identification data based on the encryption key corresponding to each piece of identification data to obtain the ciphertext corresponding to each piece of identification data; The data service provider performs salted hashing on each identifier to obtain the salted hash value corresponding to each identifier; S3. The data service provider hashes each identifier and truncates the hash prefix to obtain the hash prefix value corresponding to each identifier; Grouping the processed data corresponding to all identifiers according to the hash prefix value to obtain multiple groups; the processed data includes the salted hash value and the ciphertext; S4. The data query party calculates the hash prefix value of the query identifier and sends it to the data service party, so that the data service party finds the target group in all groups according to the hash prefix value of the query identifier and sends it to the data query party; S5. Based on the second auxiliary Boolean matrix and the third auxiliary Boolean matrix provided by the data service provider and the query identifier provided by the data query provider, the data service provider and the data query provider collaboratively generate element positions of the fourth auxiliary Boolean matrix of the data query provider through the oblivious transfer protocol and the oblivious transfer function protocol; S6. The data querying party calculates the decryption key corresponding to the query identification data based on the element positions of the fourth auxiliary Boolean matrix; the data querying party performs a salted hash on the query identification to obtain a salted hash value corresponding to the query identification; S7. The data querying party finds the target ciphertext in the target group according to the salted hash value corresponding to the query identifier, and decrypts the target ciphertext using the decryption key corresponding to the query identifier data to obtain the plaintext.
2. The method according to claim 1, characterized in that Said S1 comprises: The data service provider initializes the first auxiliary Boolean matrix to an all-1 matrix; The data service provider randomly selects a pseudo-random function seed, and sets some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier, so as to update the first auxiliary Boolean matrix; The data service provider randomly generates a second auxiliary Boolean matrix, and generates a third auxiliary Boolean matrix by performing bitwise XOR on the updated first auxiliary Boolean matrix and the second auxiliary Boolean matrix; The data service provider calculates the encryption key corresponding to each identification data according to the second auxiliary Boolean matrix.
3. The method according to claim 2, wherein: Setting some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier to update the first auxiliary Boolean matrix includes: Calculating the element position in the first auxiliary Boolean matrix corresponding to each identifier based on the pseudorandom function seed and each identifier, and setting the element in the element position in the first auxiliary Boolean matrix corresponding to each identifier to 0 to update the first auxiliary Boolean matrix; Calculating the encryption key corresponding to each identification data according to the second auxiliary Boolean matrix includes: According to the element position in the first auxiliary Boolean matrix corresponding to each identifier, extract the element at the same position in the second auxiliary Boolean matrix; The encryption key corresponding to each identification data is calculated using a hash algorithm based on the elements corresponding to each extracted identification.
4. The method according to claim 2, characterized in that The S5 includes: The data service party inputs the second auxiliary Boolean matrix and the third auxiliary Boolean matrix, and the data query party inputs a random bit string, and collaborative calculation is performed through the oblivious transfer protocol, so that the data query party outputs a fourth auxiliary Boolean matrix; The data service provider inputs a pseudo-random function seed, and the data query party inputs a query identifier, and performs collaborative calculation through an oblivious transfer function protocol so that the data query party outputs the element position in the fourth auxiliary Boolean matrix corresponding to the query identifier.
5. The method according to claim 1, wherein: The processed data corresponding to the identifiers with the same hash prefix value are grouped together.
6. A data anonymity query system, characterized in that: include: The encryption key calculation unit is used by the data service provider to construct a first auxiliary Boolean matrix for all identifiers and randomly generate a second auxiliary Boolean matrix; A third auxiliary Boolean matrix is obtained by calculating the first auxiliary Boolean matrix and the second auxiliary Boolean matrix; Calculate the encryption key corresponding to each identification data according to the second auxiliary Boolean matrix; The data processing calculation unit is used for the data service party to encrypt each identification data based on the encryption key corresponding to each identification data to obtain the ciphertext corresponding to each identification data; The data service provider performs salted hashing on each identifier to obtain the salted hash value corresponding to each identifier; The grouping unit is used by the data service provider to hash each identifier and truncate the hash prefix to obtain the hash prefix value corresponding to each identifier; Grouping the processed data corresponding to all identifiers according to the hash prefix value to obtain multiple groups; the processed data includes the salted hash value and the ciphertext; A query unit, configured for the data query party to calculate a hash prefix value of the query identifier and send it to the data service party, so that the data service party can find the target group in all groups according to the hash prefix value of the query identifier and send it to the data query party; a position generating unit, configured to generate, by the data service provider and the data querying party, element positions of a fourth auxiliary Boolean matrix of the data querying party in collaboration through an oblivious transfer protocol and an oblivious transfer function protocol, based on the second auxiliary Boolean matrix and the third auxiliary Boolean matrix provided by the data service provider and the query identifier provided by the data querying party; A decryption key calculation unit is used for the data query party to calculate the decryption key corresponding to the query identification data according to the element position of the fourth auxiliary Boolean matrix; the data query party performs a salted hash on the query identification to obtain a salted hash value corresponding to the query identification; The decryption unit is used for the data query party to find the target ciphertext in the target group according to the salted hash value corresponding to the query identifier, and use the decryption key corresponding to the query identifier data to decrypt the target ciphertext to obtain plaintext.
7. The system according to claim 6, characterized in that The encryption key calculation unit includes: An initialization subunit, used by the data service provider to initialize the first auxiliary Boolean matrix to an all-1 matrix; An updating subunit, configured for the data service provider to randomly select a pseudo-random function seed, and set some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier, so as to update the first auxiliary Boolean matrix; A generating subunit is used for the data service provider to randomly generate a second auxiliary Boolean matrix, and to generate a third auxiliary Boolean matrix by performing bitwise XOR on the updated first auxiliary Boolean matrix and the second auxiliary Boolean matrix; The encryption key calculation subunit is used by the data service provider to calculate the encryption key corresponding to each identification data according to the second auxiliary Boolean matrix.
8. The system according to claim 7, characterized in that: Setting some elements in the first auxiliary Boolean matrix to 0 according to the pseudo-random function seed and each identifier to update the first auxiliary Boolean matrix includes: Calculating the element position in the first auxiliary Boolean matrix corresponding to each identifier based on the pseudorandom function seed and each identifier, and setting the element in the element position in the first auxiliary Boolean matrix corresponding to each identifier to 0 to update the first auxiliary Boolean matrix; Calculating the encryption key corresponding to each identification data according to the second auxiliary Boolean matrix includes: According to the element position in the first auxiliary Boolean matrix corresponding to each identifier, extract the element at the same position in the second auxiliary Boolean matrix; The encryption key corresponding to each identification data is calculated using a hash algorithm based on the elements corresponding to each extracted identification.
9. The system according to claim 6, wherein: The position generating unit includes: The fourth auxiliary Boolean matrix generating subunit is configured to receive the second and third auxiliary Boolean matrices from the data service party and the random bit string from the data query party, and to perform collaborative calculations through the oblivious transfer protocol, so that the data query party outputs the fourth auxiliary Boolean matrix. The position generation subunit is used for the data service party to input a pseudo-random function seed, and the data query party to input a query identifier, and to perform collaborative calculations through an oblivious transfer function protocol so that the data query party outputs the element position in the fourth auxiliary Boolean matrix corresponding to the query identifier.
10. The system according to claim 6, characterized in that: The processed data corresponding to the identifiers with the same hash prefix value are grouped together.
Citation Information
Patent Citations
Sensitive data protecting method and system based on group key strategy
CN103220141A
Casual transmission method, system and device based on secret sharing and medium
CN119071089A