Safe wildcard pattern matching method and system with query function
Through the secure wildcard pattern matching method and the use of technologies such as the Dazed Transmission Protocol, the user terminal obtains the gene matching location and data, which solves the problem of the inability of existing technologies to obtain actual data, ensures data privacy, and meets the needs of the gene matching system.
Patent Information
- Application Number
- CN202110795419.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-14
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-07-14
AI Technical Summary
Existing standard wildcard pattern matching can only obtain matching positions, but cannot obtain actual data. It cannot meet the needs of obtaining specific information in applications such as genetic matching systems, and there is a risk of data leakage.
Using the secure wildcard pattern matching method with query function, through the confusion transmission protocol, the shared equivalent comparison protocol and the selection-shared confusion transmission protocol, the user terminal can obtain the matching position and actual data of the pattern and text, but the database terminal cannot obtain the pattern information , to ensure data privacy.
It realizes the function of the user terminal to obtain the matching location and actual data, while protecting the privacy of the database terminal, avoiding the leakage of irrelevant data, and meeting the needs of applications such as genetic matching systems.
Smart Images

Figure CN113704571B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of security wildcard pattern matching, and in particular to a security wildcard pattern matching method and system with a query function. Background Art
[0002] The statements in this section merely mention background art related to the present disclosure and do not necessarily constitute prior art.
[0003] Standard wildcard pattern matching only allows the pattern holder to obtain the position of the text substring that matches the pattern containing the wildcard, but knows nothing about the matching content of the wildcard position. In fact, in many application scenarios, the user terminal prefers to obtain the actual data of the match rather than the position or other information. Therefore, it is very necessary to extend the standard wildcard pattern matching to enable the query function (allowing the pattern holder to obtain the actual data at the matching position).
[0004] Wildcard pattern matching with query function is widely used. For example, in the gene matching system, the genome database provides gene sequence query services. Researchers hold the sequence of a potential pathogenic gene, which consists of A (adenine), G (guanine), C (cytosine), T (thymine) and N (uncertain position, usually due to missing or omitted). Researchers want to determine whether there are gene sequences matching the target sequence in the database (for example, to find susceptible people for a certain disease), and also want to obtain specific information about these gene sequences for better follow-up research. Considering the sensitivity of genetic data, researchers do not want to disclose the sequences of the potential pathogenic genes they are studying to the genome database, and the database terminal does not want to disclose other irrelevant gene sequences in the database. Summary of the invention
[0005] In order to solve the deficiencies of the prior art, the present invention provides a secure wildcard pattern matching method and system with a query function; using this patent, a user terminal holding pattern information can obtain the locations where its pattern matches the text, as well as the actual data of these locations. Through the oblivious transmission protocol, the shared equivalence comparison protocol and the select-shared oblivious transmission protocol, the database terminal cannot know the pattern information of the user terminal, and the user terminal cannot know other data information in the database.
[0006] In a first aspect, the present disclosure provides a secure wildcard pattern matching method with a query function;
[0007] Safe wildcard pattern matching methods with query capabilities, including:
[0008] The user terminal obtains the pattern character string to be queried;
[0009] The user terminal re-encodes the query pattern character string to obtain wildcard bits and common character bits;
[0010] Based on each wildcard bit, the user terminal and the database terminal execute a perplexed transmission protocol, and the user terminal obtains an output value of the perplexed transmission protocol;
[0011] Based on the output value of the oblivious transmission protocol and the common character bit, the user terminal and the database terminal execute the shared equivalence test protocol several times to obtain the output value of the shared equivalence test protocol;
[0012] Based on the output value of the shared equivalence test protocol, the database terminal and the user terminal execute the shared selection bit blind transmission protocol several times, and the user terminal obtains the position of the pattern character string to be queried in the database.
[0013] In a second aspect, the present disclosure provides a secure wildcard pattern matching system with a query function;
[0014] A secure wildcard pattern matching system with query function, including: a database terminal and a user terminal;
[0015] The user terminal obtains the pattern character string to be queried;
[0016] The user terminal re-encodes the query pattern character string to obtain wildcard bits and common character bits;
[0017] Based on each wildcard bit, the user terminal and the database terminal execute a perplexed transmission protocol, and the user terminal obtains an output value of the perplexed transmission protocol;
[0018] Based on the output value of the oblivious transmission protocol and the common character bit, the user terminal and the database terminal execute the shared equivalence test protocol several times to obtain the output value of the shared equivalence test protocol;
[0019] Based on the output value of the shared equivalence test protocol, the database terminal and the user terminal execute the shared selection bit blind transmission protocol several times, and the user terminal obtains the position of the pattern character string to be queried in the database.
[0020] Compared with the prior art, the beneficial effects of the present invention are:
[0021] By using the method described in this patent, a user terminal holding pattern information can obtain the locations where its pattern matches the text, as well as the actual data at these locations, but cannot obtain other relevant information about the text, while a database terminal holding the text cannot obtain any information about the pattern.
[0022] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings constituting a part of the present disclosure are used to provide a further understanding of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation on the present disclosure.
[0024] Figure 1 This is a flow chart of the method of the first embodiment. DETAILED DESCRIPTION
[0025] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present disclosure belongs.
[0026] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present disclosure. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] In the absence of conflict, the embodiments in the present disclosure and the features in the embodiments may be combined with each other.
[0028] In this embodiment, all data is obtained in compliance with laws and regulations and based on the consent of the user terminal, and is used legally.
[0029] Terminology explanation:
[0030] The oblivious transfer (OT) protocol is a two-party protocol. The two parties involved are the sender S and the receiver R. In a 2-choice 1 oblivious transfer protocol In the protocol, the sender S inputs 2 messages (x 0 ,x 1 ), the receiver R inputs a selection bit σ∈{0,1}, and after both parties execute the protocol, R outputs x σ . Apart from this, no additional information is disclosed.
[0031] The shared equality test (SEQ) protocol is a two-party protocol. The two parties are the sender S and the receiver R. The input of the sender S is x. 0, the input of the receiver R is x 1 After both parties execute the agreement, S outputs b 1 , R output b 2 If x 0 =x 1 ,satisfy Otherwise satisfied Here, b 1 and b 2 It is a Boolean share. Other than that, no additional information is disclosed.
[0032] Embodiment 1
[0033] This embodiment provides a safe wildcard pattern matching method with a query function;
[0034] like Figure 1 As shown in the figure, the safe wildcard pattern matching method with query function includes:
[0035] S1: The user terminal obtains the pattern character string to be queried;
[0036] S2: The user terminal re-encodes the query pattern character string to obtain wildcard bits and common character bits;
[0037] S3: Based on each wildcard bit, the user terminal and the database terminal execute a perplexed transmission protocol, and the user terminal obtains an output value of the perplexed transmission protocol;
[0038] S4: Based on the output value of the oblivious transmission protocol and the common character bit, the user terminal and the database terminal execute the shared equivalence test protocol several times to obtain the output value of the shared equivalence test protocol;
[0039] S5: Based on the output value of the shared equivalence test protocol, the database terminal and the user terminal execute the shared selection bit blind transmission protocol several times, and the user terminal obtains the position of the pattern character string to be queried in the database.
[0040] Furthermore, the database terminal is a computer terminal equipped with a database.
[0041] Furthermore, the S1: the user terminal obtains the pattern character string to be queried; specifically includes:
[0042] The database terminal inputs the text string t and the length m of the pattern string to be queried; the user terminal inputs the pattern string p to be queried and the length n of the text string; wherein, m <n。
[0043] Furthermore, the database terminal inputs a text string t and a length m of a pattern string to be queried; the user terminal inputs the pattern string p to be queried and a length n of the text string; wherein the wildcard pattern matching includes two participants, namely the database terminal and the user terminal. The database terminal holds a text string t, which is a long string and has a length of n. The user terminal holds a pattern string p to be queried, which is a short string and has a length of m. p contains a wildcard *, which can match any letter in the alphabet.
[0044] Furthermore, the step S2: the user terminal re-encodes the query pattern character string to obtain wildcard bits and common character bits; specifically includes:
[0045] The user terminal re-encodes each bit of the query pattern string p to obtain a bit pair in, Indicates a wildcard position, Represents ordinary character bits (i.e. 0 and 1).
[0046] Furthermore, the user terminal re-encodes each bit of the query pattern string p to obtain a bit pair in, Indicates a wildcard position, Indicates common character bits; specifically includes:
[0047] The user terminal U converts each bit p of the query pattern string p j Recode to j∈[m], where Represents a wildcard position, the purpose is to make the wildcard position match any letter, Represents common bits, and the purpose is to make common bits match only when they are exactly the same.
[0048] The encoding rules are as follows:
[0049] If p j =*,
[0050] If p j =0,
[0051] If p j =1,
[0052] Among them, * represents a wildcard character and can match any letter.
[0053] Furthermore, the S3: based on each wildcard bit, the user terminal and the database terminal execute a perplexed transmission protocol, and the user terminal obtains an output value of the perplexed transmission protocol; specifically includes:
[0054] The database terminal selects a random number and uses the random number to calculate each substring t of the text string t j Blind; each substring t j The length of is m, and the value range of j is 1 to n-m+1;
[0055] Based on wildcard bit For each substring t j , the database terminal and the user terminal execute a perplexed transmission protocol; after the perplexed transmission protocol is executed, the user terminal obtains the output value q of the perplexed protocol j .
[0056] Furthermore, the database terminal selects a random number and uses the random number to generate a random value for each substring t of the text string t. j Blindness was performed; specifically, it included:
[0057] Database terminal D selects a random number k j ∈{0,1} n-m+1 ,calculate where t j is the j-th substring of t with length n-m+1, Represents exclusive OR.
[0058] Furthermore, in the oblivious transmission protocol, the database terminal acts as the sender, and its input is a random number and a substring t is generated by using the current random number. j After the data is encrypted, the user terminal is the receiver, and its input is the wildcard bit After the execution of the oblivious transmission protocol is completed, the output value q of the oblivious protocol of the user terminal j .
[0059] Furthermore, for each substring t j , the database terminal and the user terminal execute a perplexed transmission protocol; after the perplexed transmission protocol is executed, the user terminal obtains the output value q of the perplexed protocol j ; Specifically include:
[0060] For each j∈[m], the database terminal D and the user terminal U execute a blind transmission protocol OT. In which, the database terminal D is the sender and its input is The user terminal U is the receiver, and its input is After the execution of the oblivious transmission protocol OT is completed, the user terminal U outputs q j .when qj =k j ;when
[0061] Further, the S4: based on the output value of the oblivious transmission protocol and the common character bit, the user terminal and the database terminal execute the shared equivalence test protocol several times to obtain the output value of the shared equivalence test protocol; specifically includes:
[0062] The database terminal generates the first matrix of m×(n-m+1) based on the blinded data; the user terminal generates the output value q based on the blinded protocol j Generate a second matrix;
[0063] Based on the first matrix and the second matrix, the database terminal and the user terminal execute the shared equivalence test protocol n-m+1 times; after the shared equivalence test protocol is executed, the database terminal outputs the output share of the database terminal in the i-th SEQ protocol User terminal U outputs the user's output share in the i-th SEQ protocol
[0064] Furthermore, the database terminal generates a first matrix of m×(n-m+1) based on the encrypted data; the user terminal generates a first matrix of m×(n-m+1) based on q j Generate a second matrix; specifically including:
[0065] The database terminal D generates an m×(n-m+1) matrix W, where the jth row of W is the vector The user terminal U generates an m×(n-m+1) matrix V, where the jth row of V is the vector in, Here, we define a function C(a)={a} n-m+1 , such as when a=1, n=6, m=3, C(a)=1111.
[0066] Furthermore, in the shared equivalence test protocol, the database terminal acts as a sender, and its input is the i-th column of the first matrix, and the user terminal acts as a receiver, and its input is the i-th column of the second matrix. After the shared equivalence test protocol is executed, the database terminal outputs the output share of the database terminal in the i-th SEQ protocol. User terminal U outputs the user's output share in the i-th SEQ protocol
[0067] Furthermore, based on the first matrix and the second matrix, the database terminal and the user terminal execute the shared equivalence test protocol n-m+1 times; after the shared equivalence test protocol is executed, the database terminal outputs the output share of the database terminal in the i-th SEQ protocol User terminal U outputs the user's output share in the i-th SEQ protocol Specifically include:
[0068] For each i∈[n-m+1], the database terminal D and the user terminal U execute a SEQ protocol. In which, the database terminal D is the sender, and its input is the i-th column of the matrix W, denoted by w i The user terminal U is the receiver, and its input is the i-th column of the matrix V, denoted as v i After the SEQ protocol is executed, the database terminal D outputs User terminal U output
[0069] Furthermore, the step S5: based on the output value of the shared equivalence test protocol, the database terminal and the user terminal execute the shared selection bit blind transmission protocol several times, and the user terminal obtains the position of the pattern string to be queried in the database; specifically includes:
[0070] The database terminal and the user terminal execute the choice-sharing oblivious transfer (CSOT) protocol. After the choice-sharing oblivious transfer (CSOT) protocol is executed, if the i-th substring t of the text string t is i If it matches the query pattern string p, the user terminal outputs the i-th substring t i The position i and the i-th substring t i .
[0071] Furthermore, in the choice-sharing oblivious transfer (CSOT) protocol, the input of the database terminal is t i , The input of the user terminal is After the execution of the Select-Shared Oblivious Transfer Protocol ends, if the i-th substring t of the text string t i If it matches the pattern string p, the user terminal outputs the i-th substring t i The position i and the i-th substring t i .
[0072] Further, the database terminal and the user terminal execute a choice-sharing oblivious transfer (CSOT) protocol for n-m+1 times; after the choice-sharing oblivious transfer (CSOT) protocol is executed, if the i-th substring t of the text string t i If it matches the pattern string p, the user terminal outputs the i-th substring t i The position i and the i-th substring t i ; Specifically include:
[0073] For each i∈[n-m+1], the database terminal D and the user terminal U perform a choice-sharing oblivious transfer (CSOT) protocol;
[0074] Among them, the input of database terminal D is t i , The input of user terminal U is After the choice-sharing oblivious transfer (CSOT) protocol is executed, if User terminal U output t i And i.
[0075] In the choice-sharing oblivious transfer (CSOT) protocol, the input of participant S is the message x and the choice bit b. 1 ∈{0,1}, the input of participant R is the selection bit b 2 ∈{0,1}; After the protocol runs, if R outputs x.
[0076] This protocol is proposed for the first time in this paper. Based on this protocol, we designed a secure wildcard pattern matching protocol with query function. The formal description of the protocol is as follows:
[0077] Input: The input of S is (x, b 1 ), the input of R is b 2 .
[0078] Output: If R outputs x, otherwise R outputs nothing.
[0079] The specific construction method of the choice-sharing oblivious transfer (CSOT) protocol is as follows:
[0080] The sender S and the receiver R execute a 2-choose-1 oblivious transmission protocol
[0081] As a 2-choose-1 transport protocol The sender, S input Among them, b 1 is the selection bit; x is the message;
[0082] As a 2-choose-1 transport protocol The receiver, R input selects bit b 2 ;
[0083] if R outputs x, otherwise R outputs 0.
[0084] In summary, in the secure wildcard pattern matching protocol with query function, the input of the database D is a text string t∈{0,1} n and m, where m is the length of the pattern string p. The input of user U is the pattern string p∈{0,1,*} m and n, where n is the length of the text string t, and * is a wildcard that can match any letter in the same position. i matches p, then user U outputs position i and t i , t i is the i-th substring of t with length m. This protocol is proposed for the first time in this invention and is formally described as follows:
[0085] Input: The input of the database terminal D is (t,m), and the input of the user terminal U is (p,n).
[0086] Output: If t i Matching with p, the user terminal U outputs position i and t i .
[0087] Embodiment 2
[0088] This embodiment provides a safe wildcard pattern matching system with query function;
[0089] A secure wildcard pattern matching system with query function, including: a database terminal and a user terminal;
[0090] The user terminal obtains the pattern character string to be queried;
[0091] The user terminal re-encodes the query pattern character string to obtain wildcard bits and common character bits;
[0092] Based on each wildcard bit, the user terminal and the database terminal execute a perplexed transmission protocol, and the user terminal obtains an output value of the perplexed transmission protocol;
[0093] Based on the output value of the oblivious transmission protocol and the common character bit, the user terminal and the database terminal execute the shared equivalence test protocol several times to obtain the output value of the shared equivalence test protocol;
[0094] Based on the output value of the shared equivalence test protocol, the database terminal and the user terminal execute the shared selection bit blind transmission protocol several times, and the user terminal obtains the position of the pattern character string to be queried in the database.
[0095] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A safe wildcard pattern matching method with query function, Its characteristics are: include: The user terminal obtains the pattern character string to be queried; The user terminal re-encodes the query pattern character string to obtain wildcard bits and common character bits; Based on each wildcard bit, the user terminal and the database terminal execute a perplexed transmission protocol, and the user terminal obtains an output value of the perplexed transmission protocol; Based on the output value of the oblivious transmission protocol and the common character bit, the user terminal and the database terminal execute the shared equivalence test protocol several times to obtain the output value of the shared equivalence test protocol; Based on the output value of the shared equivalence test protocol, the database terminal and the user terminal execute the shared selection bit blind transmission protocol several times, and the user terminal obtains the position of the pattern character string to be queried in the database.
2. The safe wildcard pattern matching method with query function as claimed in claim 1, Its characteristics are: The user terminal obtains the pattern string to be queried; specifically including: The database terminal inputs the text string t and the length m of the pattern string to be queried; the user terminal inputs the pattern string p to be queried and the length n of the text string; wherein, m <n。 3. The safe wildcard pattern matching method with query function as claimed in claim 1, Its characteristics are: The user terminal re-encodes the query pattern string to obtain wildcard bits and common character bits; specifically, the following includes: The user terminal re-encodes each bit of the query pattern string p to obtain a bit pair in, Indicates a wildcard position, Indicates an ordinary character bit.
4. The safe wildcard pattern matching method with query function as claimed in claim 3, Its characteristics are: The encoding rules are as follows: If p j =*, If p j =0, If p j =1, Among them, * represents a wildcard character and can match any letter.
5. The safe wildcard pattern matching method with query function as claimed in claim 1, Its characteristics are: Based on each wildcard bit, the user terminal and the database terminal execute a perplexed transmission protocol, and the user terminal obtains an output value of the perplexed transmission protocol; Specifically include: The database terminal selects a random number and uses the random number to calculate each substring t of the text string t j Blind; each substring t j The length of is m, and the value range of j is 1 to n-m+1; Based on wildcard bit For each substring t j , the database terminal and the user terminal execute a perplexed transmission protocol; after the perplexed transmission protocol is executed, the user terminal obtains the output value q of the perplexed protocol j .
6. The safe wildcard pattern matching method with query function as claimed in claim 5, Its characteristics are: The database terminal selects a random number and uses the random number to generate a random value for each substring t of the text string t. j Blindness was performed; specifically: Database terminal D selects a random number k j ∈{0,1} n-m+1 ,calculate where t j is the j-th substring of t with length n-m+1, Represents exclusive OR.
7. The safe wildcard pattern matching method with query function as claimed in claim 1, Its characteristics are: Based on the output value of the oblivious transmission protocol and the common character bit, the user terminal and the database terminal execute the shared equivalence test protocol several times to obtain the output value of the shared equivalence test protocol; Specifically include: The database terminal generates the first matrix of m×(n-m+1) based on the blinded data; the user terminal generates the output value q based on the blinded protocol j Generate a second matrix; Based on the first matrix and the second matrix, the database terminal and the user terminal execute the shared equivalence test protocol n-m+1 times; after the shared equivalence test protocol is executed, the database terminal outputs the output share of the database terminal in the i-th SEQ protocol User terminal U outputs the user's output share in the i-th SEQ protocol 8. The safe wildcard pattern matching method with query function as claimed in claim 1, Its characteristics are: Based on the output value of the shared equivalence test protocol, the database terminal and the user terminal execute a number of shared selection bit oblivious transmission protocols, and the user terminal obtains the position of the pattern string to be queried in the database; specifically, the following steps are included: The database terminal and the user terminal execute the oblivious transmission protocol of the shared selection bit; after the execution of the oblivious transmission protocol of the shared selection bit is completed, if the i-th substring t of the text string t i If it matches the query pattern string p, the user terminal outputs the i-th substring t i The position i and the i-th substring t i .
9. The safe wildcard pattern matching method with query function as claimed in claim 1 or 8, Its characteristics are: The specific construction method of the oblivious transmission protocol with shared selection bits: The sender S and the receiver R execute a 2-choose-1 oblivious transmission protocol As a 2-choose-1 transport protocol The sender, S input Among them, b 1 is the selection bit; x is the message; As a 2-choose-1 transport protocol The receiver, R input selects bit b 2 ; if R outputs x, otherwise R outputs 0.
10. Secure wildcard pattern matching system with query function, Its characteristics are: include: Database terminal and user terminal; The user terminal obtains the pattern character string to be queried; The user terminal re-encodes the query pattern character string to obtain wildcard bits and common character bits; Based on each wildcard bit, the user terminal and the database terminal execute a perplexed transmission protocol, and the user terminal obtains an output value of the perplexed transmission protocol; Based on the output value of the oblivious transmission protocol and the common character bit, the user terminal and the database terminal execute the shared equivalence test protocol several times to obtain the output value of the shared equivalence test protocol; Based on the output value of the shared equivalence test protocol, the database terminal and the user terminal execute the shared selection bit blind transmission protocol several times, and the user terminal obtains the position of the pattern character string to be queried in the database.
Citation Information
Patent Citations
Searchable encryption method based on wildcard character in cloud storage safety
CN107256248A
A two-party pattern matching method and device for concealing inputs
CN109359476A
