Data processing method, electronic device and storage medium

By constructing a dictionary tree and encrypted updated state transfer matrix, combined with secure multi-party computation and oblivious transmission protocol, the problem of privacy data leakage when the user terminal interacts with the server is solved, and a method of obtaining matching results without leaking private data is realized. , improving information security.

CN115758417BActive Publication Date: 2024-09-06CHINA FINANCIAL CERTIFICATION AUTHORITY
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202211488088.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-22
Publication Date
2024-09-06
Estimated Expiration
2042-11-22

AI Technical Summary

Technical Problem

In real business scenarios, the pattern string is stored in the server, and when the user terminal interacts with the server to obtain matching results, there is a risk of privacy data leakage. A data processing method is needed that can achieve matching results without leaking private data.

Method used

By constructing a dictionary tree and state transfer matrix, performing encrypted updates and using secure multi-party computation protocol and oblivious transmission protocol, it is ensured that the user terminal cannot know the original data of the server, and the server cannot know the selection information of the user terminal, thereby achieving matching results. Get.

Benefits of technology

It effectively improves the information security of the server and user terminals, ensures that matching results can be obtained without leaking private data, and enhances the information security of both parties.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115758417B
    Figure CN115758417B
Patent Text Reader

Abstract

The present application is about a data processing method, electronic device and storage medium. The method includes: constructing a dictionary tree based on a set of pattern strings; generating a state transfer matrix based on the dictionary tree; encrypting and updating the state transfer matrix, and sending the encrypted and updated state transfer matrix to the user terminal; encrypting the tree node attribute parameters corresponding to each tree node in the dictionary tree by a preset public key to obtain the tree node encryption parameters corresponding to each tree node; sending the tree node encryption parameters corresponding to each tree node to the user terminal; receiving the target encryption parameters fed back by the user terminal, and decrypting the target encryption parameters by a preset private key; sending the obtained target tree node label information to the user terminal. The present application scheme can ensure that the server and the user terminal obtain the matching results of the to-be-matched text and the server pattern string without leaking privacy data to each other, thereby improving the information security of both the server and the user terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of privacy protection technology, and in particular to a data processing method, an electronic device, and a storage medium. Background Art

[0002] In the related art, identifying specific keywords or content with custom rules from text information can effectively filter sensitive information in the text or the label information of the text. At present, the data structures and algorithms widely used in string matching include KMP (Knuth-Morris-Pratt), Trie tree, Aho-Corasick automaton and Wu-Manber, etc. However, in real business scenarios, the pattern string, that is, the sensitive word set or the custom rule is usually stored in the server, and the user terminal holding the text to be matched needs to interact with the server to obtain the matching result of the text content to be matched and the server pattern string. In the matching process of the text content to be matched, the risk of leakage of user terminal privacy data is often formed. Therefore, there is an urgent need for a data processing method capable of privacy protection, which can ensure that the server and the user terminal obtain the matching result of the text to be matched and the server pattern string without leaking privacy data to each other. Summary of the invention

[0003] In order to overcome the problems existing in the related art, the present application provides a data processing method, an electronic device and a storage medium. The data processing method can ensure that the server and the user terminal obtain the matching result between the text to be matched and the server pattern string without leaking privacy data to each other, thereby improving the information security of both the server and the user terminal.

[0004] The first aspect of the present application provides a data processing method, comprising:

[0005] Construct a dictionary tree based on the pattern string set, the dictionary tree includes: tree nodes and tree node attribute parameters corresponding to each tree node;

[0006] Generate state transition matrix based on dictionary tree;

[0007] Encrypting and updating the state transfer matrix, and sending the encrypted and updated state transfer matrix to the user terminal, so that the user terminal can select a target matrix element in the state transfer matrix by executing a secure multi-party computing protocol;

[0008] The tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by a preset public key to obtain the tree node encryption parameters corresponding to each tree node;

[0009] Sending the tree node encryption parameter corresponding to each tree node to the user terminal, so that the user terminal can select the target encryption parameter based on the target matrix element and by executing the oblivious transfer protocol;

[0010] Receive the target encryption parameters fed back by the user terminal, and decrypt the target encryption parameters using a preset private key to obtain the target tree node label information;

[0011] Send the target tree node label information to the user terminal.

[0012] In one implementation, encrypting and updating the state transfer matrix, and sending the encrypted and updated state transfer matrix to the user terminal, includes:

[0013] Generate h random positive integers, where h is the character length of the character string to be matched of the user terminal, and each random positive integer corresponds to a character number to be matched in the character string to be matched;

[0014] Extract one unused random positive integer from the h random positive integers, and perform a random number update on the current state transfer matrix based on the current random positive integer to obtain a random update matrix;

[0015] The random update matrix is ​​sent to the user terminal, and the matrix elements of the random update matrix are updated by matrix displacement to obtain a displacement update matrix;

[0016] The displacement update matrix is ​​used as the current state transfer matrix, and the steps of random number update, matrix transmission and matrix element displacement update are performed until h random positive integers are extracted.

[0017] In one embodiment, before encrypting the tree node attribute parameters corresponding to each tree node in the dictionary tree by using a preset public key, the following steps are included:

[0018] Get the tree node attributes corresponding to each tree node in the dictionary tree. The tree node attributes include key attributes and value attributes.

[0019] Determine the tree node state corresponding to each tree node according to the tree node attribute corresponding to each tree node, the tree node state is used to indicate whether the current tree node and the tree nodes passed before the current tree node can form a complete string;

[0020] The tree node attribute parameter corresponding to each tree node is determined according to the tree node state corresponding to each tree node.

[0021] In one embodiment, before constructing the dictionary tree based on the pattern string set, the method further includes:

[0022] If the server stores a chain pattern string, the chain pattern string is a pattern string containing a wildcard, the wildcard is used to separate each sub-pattern string in the chain pattern string, and each sub-pattern string is not a suffix substring of any other sub-pattern string, then search and delete the wildcard in the chain pattern string to obtain each sub-pattern string in the chain pattern string;

[0023] A pattern string set is formed based on each sub-pattern string in the chained pattern string.

[0024] In one implementation, if the server stores a set of pattern strings, the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by a preset public key to obtain the tree node encryption parameters corresponding to each tree node, including:

[0025] The tree node encryption parameter is the tree node vector;

[0026] The tree node attribute parameter is 0 or 1. If the tree node state corresponding to the key attribute in the current tree node is True, the tree node attribute parameter corresponding to the current tree node is 1, and the tree node attribute parameters corresponding to the remaining tree nodes are 0; if the tree node state corresponding to the key attribute in the current tree node is False, the tree node attribute parameter corresponding to the current tree node is 0, and the tree node attribute parameters corresponding to the remaining tree nodes are 0;

[0027] The tree node attribute parameters corresponding to each tree node are encrypted by a preset public key to obtain the parameter encryption value corresponding to each tree node;

[0028] A tree node vector corresponding to each tree node is formed based on the encrypted parameter value corresponding to each tree node.

[0029] In one implementation, if the server stores a chain pattern string, the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by a preset public key to obtain the tree node encryption parameters corresponding to each tree node, including:

[0030] The tree node encryption parameter is a numbered encryption value, and the numbered encryption value includes a first encryption value and a second encryption value;

[0031] Get the last character position number corresponding to the last character of each sub-pattern string in the chain pattern string;

[0032] If the suffix of the value attribute of the current tree node is consistent with the character string corresponding to any sub-pattern string, the last character position number of the current sub-pattern string is encrypted using the preset public key to obtain a first encrypted value;

[0033] If the suffix of the value attribute of the current tree node is inconsistent with the character strings corresponding to all sub-pattern strings, the value of the character position number currently being processed in the matching string plus 1 is encrypted using a preset public key to obtain a second encrypted value.

[0034] A second aspect of the present application provides a data processing method, comprising:

[0035] Receive the encrypted updated state transition matrix sent by the server;

[0036] Execute the secure multi-party computing protocol based on the encrypted updated state transfer matrix one by one, and select the target matrix element in the encrypted updated state transfer matrix;

[0037] Receiving the tree node encryption parameter corresponding to each tree node in the dictionary tree sent by the server, and selecting the target encryption parameter from the tree node encryption parameters corresponding to each tree node based on the target matrix element and by executing the oblivious transfer protocol;

[0038] Feedback the target encryption parameter to the server, so that the server feeds back corresponding target tree node label information based on the target encryption parameter;

[0039] Receive the target tree node label information sent by the server.

[0040] In one embodiment, feeding back the target encryption parameter to the server includes:

[0041] When the target encryption parameter is a tree node vector, a random positive integer k is generated. If the character number to be matched corresponding to the current tree node vector is zero, the current tree node vector is used as the original vector to be decrypted. If the character number to be matched corresponding to the current tree node vector is not zero, the current tree node vector is multiplied by the random positive integer k and then added to the same term of the historical tree node vector to obtain the first target parameter to be decrypted; the first target parameter to be decrypted is fed back to the server;

[0042] When the target encryption parameter is a numbered encryption value, the character number to be matched corresponding to the current numbered encryption value is encrypted using a preset public key to obtain the current character numbered encryption value; the current character numbered encryption value is subtracted from the current numbered encryption value to obtain the second target parameter to be decrypted; the second target parameter to be decrypted is fed back to the server.

[0043] A third aspect of the present application provides an electronic device, including:

[0044] Processor; and

[0045] A memory having executable codes stored thereon, which, when executed by the processor, causes the processor to execute the method described in the first aspect or the second aspect.

[0046] A fourth aspect of the present application provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor is caused to execute the method described in the first aspect or the second aspect.

[0047] The technical solution provided by this application may have the following beneficial effects:

[0048] A dictionary tree is constructed based on the set of pattern strings stored in the server, and then a state transfer matrix is ​​generated based on the dictionary tree. The state transfer matrix is ​​encrypted and updated, and the encrypted and updated state transfer matrix is ​​sent to the user terminal, so that the user terminal can select the target matrix element in the state transfer matrix by executing the secure multi-party computing protocol, so that the user terminal cannot know the original state transfer matrix before the server's encryption update, and the server cannot know which target matrix elements the user terminal has selected; further, the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by a preset public key, and the obtained tree node encryption parameters corresponding to each tree node are sent to the user terminal, so that the user terminal can select the target matrix element based on the target matrix element and by executing the oblivious transfer protocol The target encryption parameters are selected so that the user terminal cannot know the tree node attribute parameters corresponding to each original tree node before encryption by the server, and the server cannot know which tree node attribute parameters the user terminal has selected to process into the target encryption parameters, and then receive the target encryption parameters fed back by the user terminal, and decrypt the target encryption parameters through a preset private key to obtain the target tree node label information, and send the target tree node label information to the user terminal, so that the user terminal can determine the matching result based on the target tree node label information and the character string to be matched, to ensure that the server and the user terminal obtain the matching result between the text to be matched and the server pattern string without leaking privacy data to each other, thereby improving the information security of both the server and the user terminal.

[0049] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easily understood. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-restrictive manner, and the same or corresponding numbers represent the same or corresponding parts.

[0051] Figure 1 It is one of the flowcharts of the data processing method shown in the embodiment of the present application;

[0052] Figure 2This is the second flow chart of the data processing method shown in the embodiment of the present application;

[0053] Figure 3 This is the third flowchart of the data processing method shown in the embodiment of the present application;

[0054] Figure 4 This is the fourth flowchart of the data processing method shown in the embodiment of the present application;

[0055] Figure 5 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0056] Embodiments will now be described with reference to the accompanying drawings. It should be understood that for simplicity and clarity of explanation, reference numerals may be repeated in the accompanying drawings to indicate corresponding or similar elements where deemed appropriate. In addition, the present application sets forth many specific details in order to provide a thorough understanding of the embodiments described herein. However, it will be appreciated by those of ordinary skill in the art that the embodiments described herein may be practiced without these specific details. In other cases, well-known methods, processes, and components are not described in detail to avoid blurring the embodiments described herein. Moreover, the description should not be construed as limiting the scope of the embodiments described herein.

[0057] In real business scenarios, pattern strings, that is, sensitive word sets or customized rules, are usually stored on the server, and the user terminal holding the text to be matched needs to interact with the server to obtain the matching result between the text content to be matched and the server pattern string. In the process of matching the text content to be matched, there is often a risk of leakage of user terminal privacy data. Therefore, there is an urgent need for a data processing method that can protect privacy, which can ensure that the server and the user terminal obtain the matching result between the text to be matched and the server pattern string without leaking privacy data to each other.

[0058] In response to the above problems, an embodiment of the present application provides a data processing method that can ensure that the server and the user terminal obtain the matching results between the text to be matched and the server pattern string without leaking privacy data to each other, thereby improving the information security of both the server and the user terminal.

[0059] The technical solution of the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0060] Figure 1 It is one of the flow charts of the data processing method shown in the embodiment of the present application.

[0061] See also Figure 1 , the data processing method shown in the embodiment of the present application may include:

[0062] In step 101, a dictionary tree is constructed based on a set of pattern strings.

[0063] A dictionary tree is a trie tree or a prefix tree, which is a data structure used to quickly retrieve strings. The pattern string set is a set composed of sensitive word sets and / or keyword word sets of custom rules. The pattern string set contains several pattern strings, and each character combination in each pattern string of the pattern string set constitutes a character set. The pattern string set can be formed by pattern strings in multiple languages ​​such as English or Chinese. When processing Chinese-type strings, you can first obtain the encoding or pinyin corresponding to each character in the string, and then convert it into the corresponding bytes and form a byte sequence. Then, according to the byte sequence corresponding to each pattern string, the corresponding dictionary tree can be constructed according to the principle that each byte corresponds to an outgoing edge. When processing Chinese pattern strings, you can further improve the robustness of multi-pattern string fuzzy matching by adding wildcards to the pattern string and combining it with a dictionary tree constructed in pinyin.

[0064] The dictionary tree constructed based on the pattern string set has the following characteristics: the dictionary tree has a number of tree nodes (including the root node), and each tree node except the root node has a character in the character set; in addition, for each non-leaf node among the several tree nodes, the non-leaf node is a non-terminal node, that is, a node with child nodes, and the characters contained in all child nodes of each non-leaf node are different; furthermore, for any pattern string belonging to the pattern string set, there is a tree node among the several tree nodes that satisfies the characters passed from the root node to the tree node to form the pattern string; finally, for each leaf node among the several tree nodes, the leaf node is the terminal node, that is, a node without a child node following it, and the pattern string formed by the characters passed from the root node to the leaf node is a pattern string belonging to the pattern string set.

[0065] Each tree node will include corresponding tree node attribute parameters. In the embodiment of the present application, the tree node attribute parameters will specifically include three attributes, namely, a char attribute, a key attribute, and a value attribute. Among them, the char attribute is the character on the tree node, the key attribute is used to indicate whether the characters passed from the root node to the current tree node can be connected to form a pattern string belonging to the pattern string set, and the value attribute is used to indicate the character string formed by connecting the characters passed from the root node to the current tree node.

[0066] In the embodiment of the present application, the time complexity is The dictionary tree construction algorithm can be exemplified as follows:

[0067] First, create the root node R of the dictionary tree;

[0068] Then, for each pattern string in the pattern string set P Let v←R (that is, let the first node be the root node), for j←0,...,m i In the dictionary tree construction algorithm, j represents the character number in the pattern string. If the current tree node v has a child node u and satisfies u.char=c j , then v←u (that is, update the current tree node to the child node u); otherwise, create node u and let u.char←c j , update the key attribute and value attribute of u according to the definition given above, V(T)←V(T)∪{u}, E(T)←E(T)∪{(v,u)}, v←u (that is, the current tree node v is updated to the tree node u). In the dictionary tree construction algorithm, i represents the pattern string number in the pattern string set, and 0≤i≤k-1, k is the number of pattern strings in the pattern string set; For the pattern string p i Each character in, u.char is the char attribute of node u, V(T) is the set of all tree nodes, E(T) is the set of directed edges in the dictionary tree, (v,u) refers to the directed edge from the current node v to the node u;

[0069] Then, if j = m i , then v.key←True, v.value←p i . Among them, v.key represents the key attribute of the current node v, and v.value represents the value attribute of the current node v. It can be understood that the current value of j is equal to the pattern string p i The character number of the last character, then it can be determined that under the current tree node, the characters from the root node to the current tree node can be connected to form a pattern string belonging to the pattern string set. Therefore, at this time, the key attribute of the current tree node is updated to True, and the value attribute of the current tree node is updated to the pattern string p i .

[0070] It is understandable that the above algorithm for constructing the dictionary tree is only exemplary. In practical applications, other construction algorithms can also be selected to construct the dictionary tree, and this is not the only limitation here.

[0071] After constructing the dictionary tree, referring to the Aho-Corasick (AC) automaton algorithm, the breadth-first algorithm, i.e., the BFS algorithm, can be used to calculate the fail pointer and output array of each tree node in the dictionary tree, where the output array includes but is not limited to the current node, and the value attributes and associated description information of all nodes reachable from the current node through the fail pointer. In order to reduce the number of jumps required when the input character mismatch occurs, the next pointers associated with all characters on each node are completed. The next pointer points to the tree node to which the final jump is calculated based on the fail pointer, and the next array is generated based on the next pointers associated with all characters, where the length of the next array is the size of the character set, and next[i] indicates the number of the next tree node to be jumped to if the next input character is numbered i in the character set at the current tree node.

[0072] In step 102, a state transition matrix is ​​generated based on the dictionary tree.

[0073] Assuming that there are n tree nodes in the dictionary tree and there are m characters in the character set, each tree node in the dictionary tree is numbered from 0 to n-1 to generate a state transition matrix, where each element in the state transition matrix is ​​represented as M[i][j], M[i][j] represents the number of a child node of node j, and the character contained in the child node is numbered i in the character set, where j is greater than or equal to 0 and less than or equal to n-1, and i is greater than or equal to 0 and less than or equal to m-1. In the state transition matrix, i represents the number of each character in the character set, and j represents the number of each tree node in the dictionary tree, which is different from i and j in the exemplary description of the dictionary tree construction algorithm in step 101.

[0074] In step 103, the state transfer matrix is ​​encrypted and updated, and the encrypted and updated state transfer matrix is ​​sent to the user terminal.

[0075] Sending the encrypted updated state transfer matrix to the user terminal can prevent the user terminal from knowing the original state transfer matrix, and thus cannot infer the pattern string set stored in the server through the state transfer matrix, thereby ensuring the information security of the server.

[0076] The secure multi-party computing protocol, or MPC protocol, is a type of privacy computing technology based on cryptography, which allows data providers to collaboratively complete the calculation of a given function without leaking private data and without a trusted third party. Secure multi-party computing has the characteristics of decentralization, ensuring the security of input data and ensuring the accuracy of calculation results. The main technologies for building the MPC architecture include oblivious transfer (OT), garbled circuit (GC), secret sharing (SS), homomorphic encryption (HE) and other cryptographic algorithms.

[0077] The oblivious transfer protocol is an important part of the MPC protocol. The oblivious transfer protocol allows the data receiver to select and obtain a piece of data from the data sender's Z pieces of data, and ensures that the receiver cannot obtain the sender's other Z-1 pieces of data, and the sender cannot know which piece of data the receiver has selected. Using a 2-choose-1 oblivious transfer instance to implement a Z-choose-1 oblivious transfer instance can effectively improve the efficiency of the Z-choose-1 oblivious transfer protocol and reduce the number of required communications.

[0078] In an embodiment of the present application, the user terminal preferably executes the oblivious transfer protocol in the secure multi-party computing protocol to select a target matrix element in the state transfer matrix. At this time, the server is also unable to know which matrix element the user terminal has selected as the target matrix element in the state transfer matrix, thereby ensuring the information security of the user terminal. It is understandable that other secure multi-party computing technologies such as obfuscated circuit protocols and homomorphic encryption can also be used to achieve the same goal, and this is not the only limitation here.

[0079] In step 104, the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by using a preset public key to obtain the tree node encryption parameters corresponding to each tree node.

[0080] In an embodiment of the present application, encrypting the tree node attribute parameters corresponding to each tree node in the dictionary tree means encrypting the parameters of the key attribute or the value attribute, that is, encrypting the judgment result of whether the characters passed from the root node to the current tree node can be connected to form a pattern string belonging to the pattern string set, or encrypting the state of whether the characters passed from the root node to the current tree node can be connected to form a pattern string in the pattern string set.

[0081] In step 105, the tree node encryption parameters corresponding to each tree node are sent to the user terminal.

[0082] The user terminal cannot decrypt the tree node encryption parameters, so even if the user terminal can obtain all the characters in the pattern string set, it cannot infer the individual pattern strings in the pattern string set, which can effectively improve the information security of the server. The user terminal can select the target encryption parameters based on the target matrix elements and by executing the oblivious transfer protocol. At this time, the server cannot know which tree node attribute parameters the user terminal has selected to process into the target encryption parameters, which ensures the information security of the user terminal.

[0083] In step 106, the target encryption parameter fed back by the user terminal is received, and the target encryption parameter is decrypted by using a preset private key to obtain the target tree node label information.

[0084] The purpose of decrypting the target encrypted parameters is to find the number corresponding to the tree node whose key attribute is True or whose value attribute is equal to a pattern string in the pattern string set, so that all the label information in the output array of the tree node can be extracted. The label information contains the pattern string and the description of the pattern string, thereby obtaining the label information of the target tree node.

[0085] In step 107, the target tree node label information is sent to the user terminal. The user terminal can obtain the matching result through the target tree node label information, so as to achieve desensitization processing of the text content to be matched. In the embodiment of the present application, the text content to be matched held by the user terminal consists of the character string to be matched.

[0086] The following beneficial effects can be obtained from the above embodiments:

[0087] A dictionary tree is constructed based on the set of pattern strings stored in the server, and then a state transfer matrix is ​​generated based on the dictionary tree. The state transfer matrix is ​​encrypted and updated, and the encrypted and updated state transfer matrix is ​​sent to the user terminal, so that the user terminal can select the target matrix element in the state transfer matrix by executing the secure multi-party computing protocol, so that the user terminal cannot know the original state transfer matrix before the server's encryption update, and the server cannot know which target matrix elements the user terminal has selected; further, the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by a preset public key, and the obtained tree node encryption parameters corresponding to each tree node are sent to the user terminal, so that the user terminal can select the target matrix element based on the target matrix element and by executing the oblivious transfer protocol The target encryption parameters are selected so that the user terminal cannot know the tree node attribute parameters corresponding to each original tree node before encryption by the server, and the server cannot know which tree node attribute parameters the user terminal has selected to process into the target encryption parameters, and then receive the target encryption parameters fed back by the user terminal, and decrypt the target encryption parameters through a preset private key to obtain the target tree node label information, and send the target tree node label information to the user terminal, so that the user terminal can determine the matching result based on the target tree node label information and the character string to be matched, to ensure that the server and the user terminal obtain the matching result between the text to be matched and the server pattern string without leaking privacy data to each other, thereby improving the information security of both the server and the user terminal.

[0088] In some embodiments, if the server stores a pattern string set, the pattern string set can be directly processed. Figure 2 This is the second flow chart of the data processing method shown in the embodiment of the present application, please refer to Figure 2 , the data processing method shown in the embodiment of the present application may include:

[0089] In step 201, a dictionary tree is constructed based on the pattern string set, and a state transition matrix is ​​generated based on the dictionary tree. In the embodiment of the present application, the content of step 201 is similar to that of step 101 and step 102, and will not be described in detail here.

[0090] In step 202, the state transfer matrix is ​​encrypted and updated, and the encrypted and updated state transfer matrix is ​​sent to the user terminal.

[0091] Generate h random positive integers, where h is the character length of the character string to be matched of the user terminal, and each random positive integer corresponds to the character number to be matched in the character string to be matched. For example, assuming that the character length is 3, r0=5, r1=9, and r2=16 can be set, where r0 represents the random positive integer corresponding to the first character number to be matched, and the value of the random positive integer is 5. In actual applications, the random positive integer needs to be set according to the actual application situation, and is not uniquely limited here.

[0092] One of the unused random positive integers is extracted from the h random positive integers, and the current state transfer matrix is ​​updated with random numbers based on the current random positive integer to obtain a random update matrix. It can be understood that the current random update matrix is ​​linked to the to-be-matched character corresponding to the to-be-matched character number corresponding to the current random positive integer, that is, the current random update matrix serves the to-be-matched character that is linked. Exemplarily, the current state transfer matrix can be updated with random numbers using the following formula:

[0093] M[i][j]←(M[i][j]+r x )mod n

[0094] Among them, r x That is, x is a random positive integer, x is greater than or equal to zero and less than or equal to h-1, and n is the number of tree nodes. For example, assuming that the character length is 3, r0=5, r1=9, and r2=16 can be set. If r1 is extracted as the current random positive integer, the currently updated random update matrix serves the second character to be matched.

[0095] It is understandable that there are various ways to update random numbers. In practical applications, it is necessary to select a suitable update form according to the actual application situation, and no sole limitation is made here.

[0096] Furthermore, the random update matrix is ​​sent to the user terminal, and the matrix elements of the random update matrix are shifted to update the matrix to obtain a shift update matrix. Specifically, the matrix elements of each row in the random update matrix can be cyclically shifted to the right by r. x It can be understood that the above displacement updating method is only exemplary. In practical applications, a suitable displacement updating method needs to be selected according to the actual application situation, and is not the only limitation here.

[0097] The displacement update matrix is ​​used as the current state transfer matrix, and the above steps of random number update, matrix transmission and matrix element displacement update are repeated until h random positive integers are extracted, so that each character to be matched can correspond to a random update matrix.

[0098] In step 203, the tree node attribute corresponding to each tree node in the dictionary tree is obtained, and the tree node attribute parameter corresponding to each tree node is determined.

[0099] Specifically, the tree node attributes corresponding to each tree node in the dictionary tree are obtained. The tree node attributes include key attributes and value attributes. The tree node state corresponding to each tree node is determined according to the tree node attributes corresponding to each tree node. The tree node state is used to indicate whether the current tree node and the tree nodes passed before the current tree node can form a complete string. It can be understood that the tree node state corresponding to the key attribute is True or False, and the tree node state corresponding to the value attribute is the state of whether the constructed string is a certain pattern string in the pattern string set.

[0100] Furthermore, the tree node attribute parameters corresponding to each tree node are determined according to the tree node state corresponding to each tree node. For example, if the tree node state is True or False, the tree node attribute parameters can correspond to 1 and 0; if the tree node state is the state of whether the constructed character string is a pattern string in a pattern string set, the tree node attribute parameters can be determined by the number position of the last character of the character string.

[0101] In step 204, the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by a preset public key to obtain a tree node vector corresponding to each tree node, and the tree node vector corresponding to each tree node is sent to the user terminal.

[0102] In an embodiment of the present application, if the server stores a set of pattern strings, then the tree node encryption parameter is a tree node vector.

[0103] Specifically, if the tree node state corresponding to the key attribute in the current tree node is True, the tree node attribute parameter corresponding to the current tree node is 1, and the tree node attribute parameters corresponding to the remaining tree nodes are 0; if the tree node state corresponding to the key attribute in the current tree node is False, the tree node attribute parameter corresponding to the current tree node is 0, and the tree node attribute parameters corresponding to the remaining tree nodes are 0. The tree node attribute parameters corresponding to each tree node are encrypted by a preset public key to obtain the encrypted parameter value corresponding to each tree node, and the tree node vectors corresponding to each tree node are formed based on the encrypted parameter value corresponding to each tree node.

[0104] Exemplarily, the tree node vector can be represented by the following formula:

[0105]

[0106] in, Represents the tree node vector corresponding to the jth tree node among n tree nodes, 0≤j≤n-1, b0...bn-1 Indicates the tree node attribute parameters, Enc PK Indicates using the preset public key PK to pair b0...b n-1 The preset public key can be a public key of a semantically secure fully homomorphic encryption scheme, and accordingly, a preset private key matching the preset public key will also be generated. In practical applications, the preset public key and the preset private key can also be generated by other means, which is not the only limitation here.

[0107] Further, the tree node vector corresponding to each tree node is encrypted and updated according to the state transfer matrix to sort the updated node number, and each sorting position number corresponding to the updated node number is obtained, so that each sorting position number can be consistent with the matrix element w selected by the user terminal. x One-to-one correspondence, after sorting, the tree node vector is sent to the user terminal.

[0108] It is understandable that step 204 will be repeated with each round of changes in the tree node attribute parameters, and the total number of rounds is the character length of the string to be matched. This is because the state transfer matrix is ​​continuously updated when processing each character of the string to be matched. The update of the state transfer matrix will cause the sequence of tree node vectors formed in each round to be different.

[0109] In step 205, the target encryption parameter fed back by the user terminal is received, and the target encryption parameter is decrypted by using a preset private key to obtain the target tree node label information.

[0110] Specifically, the server can create an initial label set and set the initial label set to an empty set; further, use the preset private key to decrypt each encrypted element in the target encryption parameter. If the yth encrypted element in the target encryption parameter is a positive integer after decryption, it means that a tree node with a tree node attribute parameter of 1 is found, and the key attribute of the tree node is True, which means that the characters from the root node to the tree node can be connected to form a pattern string belonging to the pattern string set. Then, all the label information in the output array of the tree node with the initial node number y, that is, the label information of the target tree node, is added to the initial label set, and the initial label set is updated.

[0111] When all target tree node label information is added to the initial label set, the initial label set is updated, and the updated initial label set is sent to the user terminal.

[0112] If the character string held by the user terminal matches one or more pattern strings in the server, the server will know which pattern strings are successfully matched by the user terminal. Therefore, if the server is not expected to obtain the matched pattern string, only the user terminal needs to obtain the information of the matched pattern string. For example, before receiving the target encryption parameter fed back by the user terminal, the user terminal can randomly permute the encrypted elements in the target encryption parameter, so as to disrupt the random positions of the encrypted elements in the target encryption parameter and obtain a random permutation vector; further, the server receives the random permutation vector, and decrypts each encrypted element of the random permutation vector one by one through a preset private key to obtain a decryption vector; further, the server creates a position calibration vector with a length equal to the number of tree nodes n, and if the yth element in the decryption vector is a positive integer, the yth element in the position calibration vector is set to 1, and if the yth element in the decryption vector is 0, the yth element in the position calibration vector is set to 0, thereby completing the update of the position calibration vector; further, the server sends the updated position calibration vector to the user terminal, and the user side calculates a set of matching node numbers with key values ​​of True based on which positions of the elements in the position calibration vector are 1 and the position information of each encrypted element in the target encryption parameter in the random permutation vector, expressed as a set τ.

[0113] Furthermore, the server and the user terminal execute |τ| times Z choose 1 oblivious transfer protocol, or execute one Z choose |τ| oblivious transfer protocol, |τ| is the number of elements in the set τ, and Z is the total number of tree nodes. When executing the z0th oblivious transfer protocol, 0≤z0≤|τ|-1, the server acts as the sender, with L0,...,L n-1 As input, L j Indicates the label information corresponding to node j; the user terminal, as the receiver, takes the value of the z0th element in τ as input. After the z0th oblivious transfer protocol is executed, the user terminal obtains the label information of the node numbered by the z0th element in τ, and the server does not obtain any information. Therefore, the server cannot obtain the matched pattern string, while the user terminal can obtain the information of the matched pattern string, ensuring information security.

[0114] In some embodiments, if the server stores a chain pattern string, the wildcard in the chain pattern string needs to be deleted before processing can be performed. Figure 3 This is the third flow chart of the data processing method shown in the embodiment of the present application, please refer to Figure 3 , the data processing method shown in the embodiment of the present application may include:

[0115] In step 301, wildcards in the chain pattern string are searched and deleted to obtain each sub-pattern string in the chain pattern string, and a pattern string set is formed based on each sub-pattern string in the chain pattern string.

[0116] If the server stores a chain pattern string, the chain pattern string is a pattern string containing wildcards, the wildcards are used to separate the sub-pattern strings in the chain pattern string, and each sub-pattern string is not a suffix substring of any other sub-pattern string. The wildcard can be # or * or other symbols, which depends on the actual application situation and is not limited here. Then, the wildcard in the chain pattern string is searched and deleted to obtain each sub-pattern string in the chain pattern string, and a pattern string set is formed based on each sub-pattern string in the chain pattern string.

[0117] In step 302, a dictionary tree is constructed based on the pattern string set, and a state transition matrix is ​​generated based on the dictionary tree. In the embodiment of the present application, the content of step 302 is similar to that of step 101 and step 102, and will not be repeated here.

[0118] In step 303, the state transfer matrix is ​​encrypted and updated, and the encrypted and updated state transfer matrix is ​​sent to the user terminal. In the embodiment of the present application, the content of step 303 is similar to that of step 202, and will not be repeated here.

[0119] In step 304, the tree node attribute corresponding to each tree node in the dictionary tree is obtained, and the tree node attribute parameter corresponding to each tree node is determined. In the embodiment of the present application, the content of step 304 is similar to that of step 203, and will not be repeated here.

[0120] In step 305, the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by a preset public key to obtain a numbered encrypted value corresponding to each tree node, and the numbered encrypted value corresponding to each tree node is sent to the user terminal.

[0121] In an embodiment of the present application, if the server stores a chain pattern string, then the tree node encryption parameter may be a numbered encryption value, and the numbered encryption value includes a first encryption value and a second encryption value.

[0122] Specifically, the last character position number corresponding to the last character of each sub-pattern string in the chain pattern string is obtained; further, if the suffix of the value attribute of the current tree node is consistent with the character string corresponding to any sub-pattern string, the last character position number of the current sub-pattern string is encrypted by a preset public key to obtain a first encrypted value. Exemplarily, the first encrypted value can be expressed by the following formula:

[0123]

[0124] in, is the first encrypted value, d q The last character position number of the qth sub-pattern string in the chained pattern string that matches a suffix value of the value attribute of the current tree node.

[0125] If the suffix of the value attribute of the current tree node is inconsistent with the character string corresponding to all sub-pattern strings, the value of the character position number currently being processed in the matching string plus 1 is encrypted by the preset public key to obtain a second encrypted value. Exemplarily, the second encrypted value can be expressed by the following formula:

[0126]

[0127] in, is the second encrypted value, x is the character position number corresponding to the h characters in the string to be matched, and x+1 is equal to d q The purpose is to distinguish the tree nodes whose suffix of the value attribute is inconsistent with the string corresponding to all sub-pattern strings from the tree nodes whose suffix of the value attribute is consistent with the string corresponding to any sub-pattern string.

[0128] Further, the number encryption value corresponding to each tree node is encrypted according to the state transfer matrix, and the updated node number after the number of each tree node is updated is sorted to obtain each sorting position number corresponding to the updated node number, so that each sorting position number can be consistent with the matrix element w selected by the user terminal. x One-to-one correspondence, after sorting, the numbered encrypted value corresponding to a tree node is sent to the user terminal.

[0129] It can be understood that step 305 will be repeated with each round of changes in the attribute parameters of the tree node, and the total number of rounds is the character length of the string to be matched. This is because the state transfer matrix is ​​constantly updated when processing each character of the string to be matched. The update of the state transfer matrix will cause the second encrypted value formed in each round to be different.

[0130] In step 306, the target encryption parameters fed back by the user terminal are received, and the target encryption parameters are decrypted by a preset private key to obtain the target tree node label information, and then the updated initial label set is sent to the user terminal.

[0131] Specifically, the server can create an initial tag set and set the initial tag set to an empty set; further, use the preset private key to decrypt each encrypted value. If there are k0 completely equal non-negative integers in the target encryption parameter after decryption, and k0 is the number of sub-pattern strings obtained after removing the wildcard from the chain pattern string, it means that the chain pattern string matches the string to be matched successfully, and the tag information corresponding to the chain pattern string is updated to the initial tag set.

[0132] For example, suppose the chain pattern string is 22*33, where * is a wildcard. After removing the wildcard, two sub-pattern strings 22 and 33 are obtained, and a dictionary tree is constructed, where node a is the root node, node b is the node corresponding to the first 2, node c is the node corresponding to the second 2, node d is the node corresponding to the first 3, and node e is the node corresponding to the second 3. Suppose the string to be matched is 22033, and the character numbers of each character are 0, 1, 2, 3, and 4 respectively. In the matching process, first assume that the w input by the user terminal in the first round x is w0, then the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by the preset public key, and the encryption value of node a is Enc PK (0+1), because it does not match the two sub-pattern strings 22 and 33. Similarly, the encrypted values ​​of nodes b and d are also Enc PK (0+1), the value attribute of node c matches the sub-pattern string 22, and the value attribute of node e matches the sub-pattern string 33, so the encrypted values ​​of node c and node e are Enc PK (1) and Enc PK (4). Similarly, suppose that the input w of the user terminal in the second round is x is w1, then the encrypted values ​​formed by nodes a, b, c, d, and e are Enc PK (1+1), Enc PK (1+1), Enc PK (1) Enc PK (1+1) and Enc PK (4), and so on, until the fifth round when w4 is input, the encryption value calculation is completed. The encryption value generated in each round will be sent to the user terminal as the input of the oblivious transfer protocol. The server, as the sender, executes the oblivious transfer protocol together with the user terminal, so that the user terminal selects the numbered encryption value corresponding to each character to be matched, that is, the encryption value corresponding to the first 2 is Enc PK (0+1), which is equal to Enc PK (1), the encryption value corresponding to the second 2 is Enc PK (1), the encryption value corresponding to 0 is Enc PK(3), the encryption value corresponding to the first 3 is Enc PK (4) The encryption value corresponding to the second 3 is Enc PK (4). Further, the user terminal encrypts the character number to be matched corresponding to the current number encryption value by using the preset public key to obtain the current character number encryption value, namely Enc PK (0), Enc PK (1) Enc PK (2) Enc PK (3) and Enc PK (4) Subtract the current character number encryption value from the corresponding number encryption value to obtain the second target decryption parameter as the target encryption parameter, namely, Enc PK (0)-Enc PK (1) Enc PK (1)-Enc PK (1) Enc PK (2)-Enc PK (3) Enc PK (3)-Enc PK (4) and Enc PK (4)-Enc PK (4) Since the homomorphic encryption scheme is adopted, only Enc PK (1)-Enc PK (1) and Enc PK (4)-Enc PK (4) After decryption, it is a non-negative integer. The number of non-negative integers is consistent with the number of sub-pattern strings. Therefore, it can be said that the chain pattern string matches the string to be matched successfully. It can be understood that the description of the above matching process is only exemplary. In actual applications, the chain pattern string and the string to be matched are in various forms. In actual applications, it depends on the actual application situation and is not limited here. Then, the updated initial tag set is sent to the user terminal.

[0133] If the server is not expected to obtain the matching position information of the pattern string in the to-be-matched string of the user terminal, and only needs the user terminal to obtain the information of the matched pattern string, illustratively, before receiving the target encryption parameter fed back by the user terminal, the server can send the length |p| of the chained pattern string to the user terminal, create an initial tag set, and set the initial tag set to an empty set; further, the user terminal generates a random integer r', i ’ ←0,...,h-|p|,j ’ ←0,...,|p|-1, the user terminal further generates a non-zero random integer r" each time j' changes, and calculates i"=(i ’+r')mod(h-|p|+1) and is the matrix element selected by the user terminal from the random update matrix corresponding to the i"+j'th character in the string to be matched; the user terminal sets C 0 ,...,C || These target encryption parameters are fed back to the server. i' actually represents the outer loop, where h-|p|+1 rounds of sending operations are actually performed. The server uses the preset private key Decrypt one by one, if there are k0 zeros in the decrypted numbers and the initial label set is an empty set, assign the label information corresponding to the chain pattern string to the initial label set. Then send the updated initial label set to the user terminal.

[0134] In some embodiments, the service terminal also needs to cooperate with the server to obtain the final matching result. Figure 4 This is a fourth flow chart of the data processing method shown in the embodiment of the present application. Please refer to Figure 4 , the data processing method shown in the embodiment of the present application may include:

[0135] In step 401, the encrypted updated state transfer matrix sent by the server is received, the secure multi-party computing protocol is executed one by one based on the encrypted updated state transfer matrix, and the target matrix element is selected in the encrypted updated state transfer matrix.

[0136] Specifically, the server will place the character set, the number of tree nodes n, and the number of the starting node of the dictionary tree in the starting column number corresponding to the state transition matrix At the same time, the server sends the encrypted updated state transfer matrix to the user terminal as the input of the server's oblivious transfer protocol in the secure multi-party computing protocol, and the user terminal uses The calculated value of is taken as input, where when x is equal to 0, The starting column number of the starting node of the dictionary tree corresponds to the starting column number of the state transfer matrix. When x is greater than 0, is the matrix element selected by the user terminal from the random update matrix corresponding to the x-1th character in the to-be-matched string. index(S[x]) represents the number corresponding to the xth character in the to-be-matched text held by the user terminal in the character set. After the oblivious transfer protocol is executed, the user terminal obtains the encrypted updated state transfer matrix. The matrix element w at row index(S[x]) x , get the target matrix elements, meanwhile, the server cannot get any information.

[0137] In step 402, tree node encryption parameters corresponding to each tree node in the dictionary tree sent by the server are received, and target encryption parameters are selected from the tree node encryption parameters corresponding to each tree node based on the target matrix elements and by executing the oblivious transfer protocol, and the target encryption parameters are fed back to the server.

[0138] When the tree node encryption parameter is a tree node vector, the server sends the tree node vector to the user terminal as the input when the server executes the oblivious transfer protocol; the user terminal then sends w x As input, after the oblivious transfer protocol is executed, the user obtains the wth x Vector The server does not obtain any information.

[0139] Furthermore, the user terminal generates a random positive integer k. If the character number to be matched corresponding to the current tree node vector is zero, that is, when x=0, the current tree node vector is used as the original vector to be decrypted. If the character number to be matched corresponding to the current tree node vector is not zero, the current tree node vector is multiplied by the random positive integer k and then added to the same term of the historical tree node vector to obtain the first target parameter to be decrypted. The historical tree node vector is a tree node vector that already exists in the original first target parameter to be decrypted. The first target parameter to be decrypted is then fed back to the server. Exemplarily, the first target parameter to be decrypted can be represented by the following formula:

[0140]

[0141] Among them, λ C It is the first target parameter to be decrypted.

[0142] When the tree node encryption parameter is a numbered encrypted value, the server sends the numbered encrypted value to the user terminal as input when the server executes the oblivious transfer protocol; the user terminal then sends w x As input, after the oblivious transfer protocol is executed, the user side obtains the wth input of the server side. x Encrypted value The service provider does not obtain any information.

[0143] Furthermore, the user terminal encrypts the character number to be matched corresponding to the current number encryption value by using a preset public key to obtain the current character number encryption value; subtracts the current number encryption value from the current character number encryption value to obtain the second target parameter to be decrypted, and then feeds the second target parameter to be decrypted back to the server. Exemplarily, the second target parameter to be decrypted can be expressed by the following formula:

[0144]

[0145] in, is the second target parameter to be decrypted, Specifically, it can be

[0146] Thus, the user terminal feeds back the first target parameter to be decrypted and / or the second target parameter to be decrypted formed based on the target encryption parameter to the server, so that the server feeds back the corresponding target tree node label information based on the target encryption parameter.

[0147] It can be understood that step 402 will be repeatedly executed with each round of tree node encryption parameters sent by the server, and the total number of rounds is the character length of the string to be matched. This is because the state transfer matrix is ​​constantly updated and changed when processing each character of the string to be matched. From the exemplary description in step 306, it can be seen that the update of the state transfer matrix will cause the tree node encryption parameters sent by the server in each round to be different.

[0148] In step 403, target tree node label information sent by the server is received.

[0149] Since the target tree node label information includes the pattern string and the description and explanation of the pattern string, the user terminal can determine some associated information of the sensitive word through the target tree node label information, such as some description and explanation of the sensitive word.

[0150] Corresponding to the aforementioned application function implementation method embodiment, the present application also provides an electronic device for executing a data processing method and a corresponding embodiment.

[0151] Figure 5 FIG. 8 is a block diagram showing the hardware configuration of an electronic device 800 that can implement the data processing method of an embodiment of the present application. Figure 5 As shown, the electronic device 800 may include a processor 810 and a memory 820. Figure 5 In the electronic device 800, only the components related to this embodiment are shown. Therefore, it is obvious to those skilled in the art that the electronic device 800 may also include Figure 5 The components shown in the figure are different from the common components. For example: fixed-point arithmetic units.

[0152] The electronic device 800 may correspond to a computing device having various processing functions, such as functions for generating a neural network, training or learning a neural network, quantizing a floating-point neural network to a fixed-point neural network, or retraining a neural network. For example, the electronic device 800 may be implemented as various types of devices, such as a personal computer (PC), a server device, a mobile device, etc.

[0153] The processor 810 controls all functions of the electronic device 800. For example, the processor 810 controls all functions of the electronic device 800 by executing a program stored in a memory 820 on the electronic device 800. The processor 810 may be implemented by a central processing unit (CPU), a graphics processing unit (GPU), an application processor (AP), an artificial intelligence processor chip (IPU), etc. provided in the electronic device 800. However, the present application is not limited thereto.

[0154] In some embodiments, the processor 810 may include an input / output (I / O) unit 811 and a computing unit 812. The I / O unit 811 may be used to receive various data, such as a target encryption parameter sent by a user terminal. Exemplarily, the computing unit 812 may be used to decrypt the target encryption parameter received via the I / O unit 811 using a preset private key to determine the target tree node label information. This target tree node label information may be output by the I / O unit 811, for example. The output data may be provided to the memory 820 for reading and use by other devices (not shown), or may be directly provided to other devices for use.

[0155] The memory 820 is hardware for storing various data processed in the electronic device 800. For example, the memory 820 can store processed data and data to be processed in the electronic device 800. The memory 820 can store data sets involved in the data processing method that has been processed or to be processed by the processor 810, such as a set of pattern strings, etc. In addition, the memory 820 can store applications, drivers, etc. to be driven by the electronic device 800. For example: the memory 820 can store various programs related to the data processing method to be executed by the processor 810. The memory 820 can be a DRAM, but the present application is not limited thereto. The memory 820 can include at least one of a volatile memory or a non-volatile memory. The non-volatile memory can include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), a flash memory, a phase change RAM (PRAM), a magnetic RAM (MRAM), a resistive RAM (RRAM), a ferroelectric RAM (FRAM), etc. The volatile memory may include a dynamic RAM (DRAM), a static RAM (SRAM), a synchronous DRAM (SDRAM), a PRAM, an MRAM, an RRAM, a ferroelectric RAM (FeRAM), etc. In an embodiment, the memory 820 may include at least one of a hard disk drive (HDD), a solid state drive (SSD), a high-density flash memory (CF), a secure digital (SD) card, a micro secure digital (Micro-SD) card, a mini secure digital (Mini-SD) card, an extreme digital (xD) card, caches, or a memory stick.

[0156] In summary, the specific functions implemented by the memory 820 and the processor 810 of the electronic device 800 provided in the embodiments of this specification can be explained in comparison with the aforementioned embodiments in this specification, and can achieve the technical effects of the aforementioned embodiments, and will not be repeated here.

[0157] In this embodiment, the processor 810 can be implemented in any suitable manner. For example, the processor 810 can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, etc.

[0158] It should be understood that the possible terms "first" or "second" etc. in the claims, specifications and drawings disclosed in this application are used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the specifications and claims disclosed in this application indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.

[0159] It should also be understood that the terms used in this disclosure specification of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the disclosure of the present application. As used in the disclosure specification of the present application and the claims, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms. It should also be further understood that the term "and / or" used in the disclosure specification of the present application and the claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0160] Although the implementation methods of the present application are as above, the contents described are only examples adopted to facilitate the understanding of the present application, and are not intended to limit the scope and application scenarios of the present application. Any technician in the technical field described in the present application can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present application, but the scope of patent protection of the present application shall still be subject to the scope defined in the attached claims.

[0161] It should also be understood that any module, unit, component, server, computer, terminal or device that executes instructions exemplified herein may include or otherwise access computer-readable media, such as storage media, computer storage media or data storage devices (removable and / or non-removable) such as disks, optical disks or tapes. Computer storage media may include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules or other data.

Claims

1. A data processing method, characterized in that: include: Constructing a dictionary tree based on a pattern string set, the dictionary tree comprising: a tree node and a tree node attribute parameter corresponding to each tree node, wherein the tree node attribute parameter comprises a key attribute and a value attribute, wherein the key attribute is used to indicate whether the characters passed from the root node to the current tree node can be connected to form a pattern string belonging to the pattern string set, and the value attribute is used to indicate a character string formed by connecting the characters passed from the root node to the current tree node, wherein the pattern string set is a set composed of a sensitive word set and / or a keyword word set of a custom rule, and the pattern string is a character string formed by multiple languages; Generate a state transfer matrix based on the dictionary tree; The state transfer matrix is ​​encrypted and updated, and the encrypted and updated state transfer matrix is ​​sent to a user terminal, so that the user terminal can select a target matrix element in the state transfer matrix by executing a secure multi-party computing protocol; wherein the encrypted update of the state transfer matrix includes: updating the state transfer matrix based on a random update matrix and a displacement update matrix; Encrypting the tree node attribute parameters corresponding to each tree node in the dictionary tree by using a preset public key to obtain the tree node encryption parameters corresponding to each tree node; Sending a tree node encryption parameter corresponding to each tree node to the user terminal, so that the user terminal can select a target encryption parameter based on the target matrix element and by executing an oblivious transfer protocol; Receive the target encryption parameter fed back by the user terminal, and decrypt the target encryption parameter by using a preset private key to obtain target tree node label information; The target tree node label information is sent to the user terminal, so that the user terminal determines a matching result based on the target tree node label information and the character string to be matched held by the user terminal.

2. The data processing method according to claim 1, characterized in that: The step of encrypting and updating the state transfer matrix and sending the encrypted and updated state transfer matrix to the user terminal includes: Generate h random positive integers, where h is the character length of the character string to be matched of the user terminal, and each random positive integer corresponds one-to-one to the number of the character to be matched in the character string to be matched; Extracting an unused random positive integer from the h random positive integers, and performing a random number update on the current state transfer matrix based on the current random positive integer to obtain a random update matrix; Sending the random update matrix to a user terminal, and performing matrix element displacement update on the random update matrix to obtain a displacement update matrix; The displacement update matrix is ​​used as the current state transfer matrix, and the steps of random number update, matrix transmission and matrix element displacement update are performed until the h random positive integers are extracted.

3. The data processing method according to claim 2, characterized in that: Before encrypting the tree node attribute parameters corresponding to each tree node in the dictionary tree by using the preset public key, the method includes: Get the tree node attribute corresponding to each tree node in the dictionary tree, Determine the tree node state corresponding to each tree node according to the tree node attribute corresponding to each tree node, wherein the tree node state is used to indicate whether the current tree node and the tree nodes passed by before the current tree node can form a complete string; The tree node attribute parameter corresponding to each tree node is determined according to the tree node state corresponding to each tree node.

4. The data processing method according to claim 3, characterized in that: Before constructing the dictionary tree based on the pattern string set, the method further includes: If the server stores a chain pattern string, the chain pattern string is a pattern string containing a wildcard, the wildcard is used to separate each sub-pattern string in the chain pattern string, and each sub-pattern string is not a suffix substring of any other sub-pattern string, then search and delete the wildcard in the chain pattern string to obtain each sub-pattern string in the chain pattern string; The pattern string set is formed based on each sub-pattern string in the chained pattern string.

5. The data processing method according to claim 3, characterized in that: If the server stores the pattern string set, the tree node attribute parameters corresponding to each tree node in the dictionary tree are encrypted by the preset public key to obtain the tree node encryption parameters corresponding to each tree node, including: The tree node encryption parameter is a tree node vector; The tree node attribute parameter is 0 or 1. If the tree node state corresponding to the key attribute in the current tree node is True, the tree node attribute parameter corresponding to the current tree node is 1, and the tree node attribute parameters corresponding to the remaining tree nodes are 0; if the tree node state corresponding to the key attribute in the current tree node is False, the tree node attribute parameter corresponding to the current tree node is 0, and the tree node attribute parameters corresponding to the remaining tree nodes are 0; The tree node attribute parameters corresponding to each tree node are encrypted by the preset public key to obtain the parameter encryption value corresponding to each tree node; A tree node vector corresponding to each tree node is formed based on the encrypted parameter value corresponding to each tree node.

6. The data processing method according to claim 4, characterized in that: If the server stores the chain pattern string, encrypting the tree node attribute parameters corresponding to each tree node in the dictionary tree by using the preset public key to obtain the tree node encryption parameters corresponding to each tree node includes: The tree node encryption parameter is a numbered encryption value, and the numbered encryption value includes a first encryption value and a second encryption value; Obtain the last character position number corresponding to the last character of each sub-pattern string in the chain pattern string; If the suffix of the value attribute of the current tree node is consistent with the character string corresponding to any sub-pattern string, the last character position number of the current sub-pattern string is encrypted by the preset public key to obtain the first encrypted value; If the suffix of the value attribute of the current tree node is inconsistent with the character strings corresponding to all sub-pattern strings, the value of the character position number currently being processed in the to-be-matched character string plus 1 is encrypted using the preset public key to obtain the second encrypted value.

7. A data processing method, characterized in that: include: The encrypted updated state transition matrix sent by the receiving server; wherein, The encrypted updated state transition matrix is ​​a state transition matrix after the state transition matrix is ​​updated based on the random update matrix and the displacement update matrix; the state transition matrix is ​​generated based on a dictionary tree; wherein the dictionary tree is constructed based on a pattern string set, including: tree nodes and tree node attribute parameters corresponding to each tree node; the tree node attribute parameters include a key attribute and a value attribute, wherein the key attribute is used to indicate whether the characters passed from the root node to the current tree node can be connected to form a pattern string belonging to the pattern string set, and the value attribute is used to indicate the character string formed by connecting the characters passed from the root node to the current tree node, wherein the pattern string set is a set composed of a sensitive word set and / or a keyword word set of a custom rule, and the pattern string is a character string formed by multiple languages; Execute the secure multi-party computing protocol based on the encrypted updated state transfer matrix one by one, and select the target matrix element in the encrypted updated state transfer matrix; Receive the tree node encryption parameters corresponding to each tree node in the dictionary tree sent by the server, and select the target encryption parameters from the tree node encryption parameters corresponding to each tree node based on the target matrix element and by executing the oblivious transfer protocol; wherein the tree node encryption parameters are obtained by encrypting the tree node attribute parameters corresponding to each tree node in the dictionary tree by using a preset public key; Feedback the target encryption parameter to the server, so that the server feeds back corresponding target tree node label information based on the target encryption parameter; Receiving target tree node label information sent by the server; The matching result is determined based on the target tree node label information and the string to be matched.

8. The data processing method according to claim 7, characterized in that: Feeding back the target encryption parameter to the server includes: When the target encryption parameter is a tree node vector, a random positive integer k is generated. If the character number to be matched corresponding to the current tree node vector is zero, the current tree node vector is used as the original vector to be decrypted. If the character number to be matched corresponding to the current tree node vector is not zero, the current tree node vector is multiplied by the random positive integer k and then added to the same term of the historical tree node vector to obtain a first target parameter to be decrypted; the first target parameter to be decrypted is fed back to the server; wherein the tree node vector is the tree node encryption parameter, and the historical tree node vector is a tree node vector already existing in the original first target parameter to be decrypted; When the target encryption parameter is a numbered encryption value, the character number to be matched corresponding to the current numbered encryption value is encrypted by a preset public key to obtain the current character number encryption value; the current character number encryption value is subtracted from the current numbered encryption value to obtain a second target parameter to be decrypted; the second target parameter to be decrypted is fed back to the server, wherein the numbered encryption value is a tree node encryption parameter.

9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the data processing method described in any one of claims 1 to 6, or implements the steps of the data processing method described in any one of claims 7 to 8.

10. A non-transitory machine-readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, implements the steps of the data processing method described in any one of claims 1 to 6, or implements the steps of the data processing method described in any one of claims 7 to 8.

Citation Information

Patent Citations

  • Distributed attribute-based encryption method supporting fine-grit attribute revocation on lattice

    CN108880801A

  • A searchable encryption system and method based on a suffix tree

    CN109815723A

  • Privacy protection method

    CN110222527A

  • Background server security reinforcement method, system and device and medium

    CN111368306A

  • Data processing method and device

    CN112269904A