Database encryption field fuzzy retrieval method and device
By performing part-of-speech annotation processing on the encrypted fields in the database and generating index values, when fuzzy searching of the encrypted fields in the database, the problem of low search efficiency in the existing technology is solved, and more efficient fuzzy search is achieved.
Patent Information
- Application Number
- CN202411773990.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-15
AI Technical Summary
The prior art is less efficient when fuzzy searching of encrypted fields in a database, resulting in an increase in the length of subsequent search indexes, affecting efficiency.
By intercepting the execution statement of the database, the target encrypted fields are subject to part-of-speech annotation process, index values are generated, and intersection or union matching is performed in the database based on preset operators to improve the efficiency of fuzzy retrieval.
By generating index values and preprocessing query values, avoiding direct complex queries on encrypted data, improving retrieval efficiency, especially when processing large amounts of data, reducing computational overhead.
Smart Images

Figure CN119829641A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of network security technology, and in particular to a method and device for fuzzy retrieval of encrypted fields in a database. Background Art
[0002] For network security needs, many companies currently encrypt sensitive fields in their databases. Since encrypted data cannot be directly compared with text, encrypted fields cannot be fuzzily matched through like queries.
[0003] In the related art, the plain text content of the encrypted field is often segmented into specific lengths, and then each segmented string is encrypted separately and combined into ciphertext. When searching, the search string is also segmented and encrypted in the same way, and the generated encrypted result is fuzzy matched with the ciphertext in the database.
[0004] However, the method used in the related art will lead to an increase in the length of the subsequent encrypted field index, thereby affecting the efficiency of subsequent retrieval. How to improve the efficiency of fuzzy retrieval of encrypted fields in a database has become a problem that needs to be solved. Summary of the invention
[0005] In view of this, the present disclosure provides a method and device for fuzzy retrieval of encrypted fields in a database to solve the problem of how to improve the efficiency of fuzzy retrieval of encrypted fields in a database.
[0006] On the one hand, the present disclosure provides a method for fuzzy retrieval of encrypted fields in a database, the method comprising: intercepting an execution statement of a database, and when it is determined according to the execution statement that a target encrypted field is being inserted or updated, performing part-of-speech tagging on the target encrypted field to determine a target index value corresponding to the target encrypted field; when it is determined according to the execution statement that the target encrypted field is being queried, performing part-of-speech tagging on a to-be-queried value to determine an to-be-queried index value corresponding to the to-be-queried value; based on a preset operator, matching the target index value with the to-be-queried index value in the database to determine a fuzzy retrieval result corresponding to the to-be-queried index value in the target index value; wherein the fuzzy retrieval result is an intersection or a union.
[0007] On the other hand, the present disclosure also provides a fuzzy retrieval device for encrypted fields in a database, the device comprising: a first part-of-speech tagging module, used to intercept an execution statement of the database, and when it is determined according to the execution statement that a target encrypted field is being inserted or updated, perform part-of-speech tagging on the target encrypted field, and determine a target index value corresponding to the target encrypted field; a second part-of-speech tagging module, used to, when it is determined according to the execution statement that the target encrypted field is being queried, perform part-of-speech tagging on a value to be queried, and determine a to-be-queried index value corresponding to the to-be-queried value; a fuzzy retrieval module, used to match the target index value with the to-be-queried index value in the database based on a preset operator, and determine a fuzzy retrieval result corresponding to the to-be-queried index value in the target index value; wherein the fuzzy retrieval result is an intersection or a union.
[0008] On the other hand, the present disclosure further provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to enable a computer to implement the above-mentioned database encrypted field fuzzy retrieval method.
[0009] On the other hand, the present disclosure further provides a computer program product, including computer instructions, which are used to enable a computer to execute the above-mentioned database encrypted field fuzzy retrieval method.
[0010] Through the database encrypted field fuzzy retrieval method and device of the above-mentioned embodiment of the present invention, by annotating the target encrypted field and the value to be queried with parts of speech and generating index values, it is possible to avoid directly performing complex query operations on the encrypted data. When performing fuzzy retrieval, it is only necessary to match through the generated encrypted index value, thereby improving the retrieval efficiency, especially when a large amount of data is involved, avoiding high computing overhead.
[0011] In addition, the above-mentioned embodiments of the present disclosure support intersection or union matching of target index values and query index values based on preset operators, thereby flexibly meeting different business requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 It is a flowchart of a method for fuzzy retrieval of a database encrypted field provided by an embodiment of the present disclosure;
[0014] Figure 2It is a partial schematic diagram of a CTB part-of-speech tagging set of a database encrypted field fuzzy retrieval method provided by an embodiment of the present disclosure;
[0015] Figure 3 It is a schematic diagram of a target index value construction process of a database encrypted field fuzzy retrieval method provided by an embodiment of the present disclosure;
[0016] Figure 4 It is a schematic diagram of a fuzzy search result acquisition process of a database encrypted field fuzzy search method provided by an embodiment of the present disclosure;
[0017] Figure 5 It is a structural schematic diagram of a database encrypted field fuzzy retrieval device provided by an embodiment of the present disclosure;
[0018] Figure 6 It is a structural schematic diagram of another database encrypted field fuzzy retrieval device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] Due to network security requirements, many companies currently encrypt sensitive fields in the database. Since encrypted data cannot be directly compared with text, encrypted fields can no longer be fuzzy matched through like queries. For example, the encrypted value of "communication operation" stored in the database is "OTQ50LVZrKb3ZcxY". When searching through "communication", the encrypted value of "communication" is "NyAW0LVZ", which cannot match the record.
[0020] In the first related art, the plain text content of the encrypted field is often segmented into specific lengths, and then each segmented string is encrypted separately and combined into ciphertext. When searching, the search string is also segmented and encrypted in the same way, and the generated encrypted result is fuzzy matched with the ciphertext in the database.
[0021] In the second related technology, similar to the first related technology, the main difference is that it emphasizes the use of symmetric encryption using the Counter mode (Galois / Counter Mode, GCM) method to obtain the hash value, and the encrypted value of the field and the index value are stored in the same field, and then matched in the application layer.
[0022] The above-mentioned related technologies may have the following problems:
[0023] 1. Use a specific length to split the plaintext. For example, if the length is 2, the length of a string of length n after segmentation is 2(n-1). Taking a 4-character hash as an example, the length of the final encrypted field index is 8(n-1). This increases the length of the subsequent encrypted field index and also affects the efficiency of subsequent retrieval.
[0024] 2. A 4-character hash value is used to represent a 2-bit segment character instead of the original ciphertext, which will result in hash conflicts and inaccurate search results. If a too-long hash value is used to represent, hash conflicts can be reduced, but the encrypted field index value will be particularly long and take up space. In addition, the hash algorithm is too simple and there is a risk of reverse decryption.
[0025] 3. After using fixed-length segmentation, the retrieval result of the union may be inaccurate, resulting in limitations in system functions. Therefore, the above-mentioned related technologies only support retrieval based on intersection, and cannot support union retrieval.
[0026] To solve the above problems, various embodiments of the present disclosure provide a method for fuzzy retrieval of encrypted fields in a database, the method comprising: intercepting an execution statement of a database, and when it is determined according to the execution statement that a target encrypted field is being inserted or updated, performing part-of-speech tagging on the target encrypted field, and determining a target index value corresponding to the target encrypted field; when it is determined according to the execution statement that the target encrypted field is being queried, performing part-of-speech tagging on the queried value, and determining a to-be-queried index value corresponding to the to-be-queried value; based on a preset operator, matching the target index value with the to-be-queried index value in the database, and determining a fuzzy retrieval result corresponding to the to-be-queried index value in the target index value; wherein the fuzzy retrieval result is an intersection or a union.
[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0028] Please refer to Figure 1 , Figure 1 The following is a flow chart of a method for fuzzy retrieval of a database encrypted field provided by an embodiment of the present disclosure. The flow of the method may include the following steps:
[0029] Step S101, intercepting the execution statement of the database, when it is determined according to the execution statement that the target encrypted field is being inserted or updated, performing part-of-speech tagging on the target encrypted field to determine the target index value corresponding to the target encrypted field.
[0030] In this embodiment, the execution statement of the database may refer to an SQL statement processed by the database management system, which may include but is not limited to: insert, update, delete or query operations. Here, the interception method of the execution statement of the database may include but is not limited to: database triggers, database middleware, and application layer interception.
[0031] Part-of-speech tagging is a text data processing technology that uses a part-of-speech tagging algorithm to tag the parts of speech of words in a corpus according to their meaning and context based on a part-of-speech tagging set. The purpose of part-of-speech tagging can be to identify the grammatical role of each word, such as noun, verb, adjective, so that the system can understand the grammatical structure and meaning of the query text.
[0032] Here, the part-of-speech tag set defines all possible grammatical categories, and the part-of-speech tag set can include one of: Chinese Treebank (CTB), Peking University Corpus (PKU), 863 Project Corpus. Figure 2 As shown, Figure 2 It is a partial schematic diagram of a CTB part-of-speech tagging set of a database encrypted field fuzzy retrieval method provided by an embodiment of the present disclosure.
[0033] A part-of-speech tagging algorithm may be a specific algorithm or model for automatically assigning part-of-speech tags.
[0034] As an example, the part-of-speech tagging algorithm may include at least one of the following: hidden Markov model part-of-speech tagging, perceptron part-of-speech tagging, and deep learning part-of-speech tagging.
[0035] Step S102: when it is determined according to the execution statement that the target encrypted field is being queried, part-of-speech tagging is performed on the queried value to determine the queried index value corresponding to the queried value.
[0036] In this embodiment, the term to be searched may refer to a field or term in a search condition for retrieving an encrypted field, which is input by a user when performing a database search.
[0037] As an example, the encrypted value of "communication operation" is "OTQ50LVZrKb3ZcxY", "communication operation" is the target encrypted field, and "communication" is used for retrieval, with "communication" being the query term.
[0038] Step S103, based on a preset operator, matching the target index value with the index value to be queried in the database, and determining the fuzzy search result corresponding to the index value to be queried in the target index value.
[0039] In this embodiment, the fuzzy search result is an intersection or a union. The preset operator may include an intersection operator and a union operator.
[0040] Based on the intersection operator, retrieve all records of the target index value that contain the query index value and find their intersection, that is, only those records are returned when the target index value and the query index value have the same parts. Based on the union operator, retrieve all records in the target index value that have partial matches with the query index value, regardless of whether they are complete matches or partial matches.
[0041] Here, you can select the intersection operator or the union operator according to your needs and set it specifically. There is no limitation here.
[0042] In the database encrypted field fuzzy retrieval method and device of the above-mentioned embodiment of the present disclosure, by performing part-of-speech tagging on the encrypted field and the query field, the text data is converted into a keyword form that is easier to process, thereby improving the accuracy and flexibility of the fuzzy retrieval. This scheme generates index values so that even if the field value is encrypted, fuzzy retrieval can still be performed. This method avoids direct access to the original plaintext and speeds up the retrieval process through indexing. By generating an index for the encrypted field and preprocessing the search value according to the part-of-speech tagging, complex query operations directly on the encrypted data can be avoided, thereby improving the retrieval efficiency. The index can be generated flexibly to reduce the hash conflict problem caused by the fixed hash length, and the accuracy of the retrieval results can be ensured through precise index generation.
[0043] In a possible implementation of the above step S101, the execution statement of the database is intercepted, and when it is determined according to the execution statement that the target encrypted field is being inserted or updated, part-of-speech tagging is performed on the target encrypted field, including:
[0044] The SQL execution statement of the database is intercepted, and when it is determined according to the SQL execution statement that the database is executing an insert statement or an update statement, part-of-speech tagging is performed on the target encrypted field to determine a first part-of-speech tagging result set.
[0045] In this embodiment, the insert statement or update statement is intercepted when the database is executed, thereby capturing the SQL request containing the encrypted field. The insert statement is used to insert a new record in the database, and the update statement is used to update an existing record in the database.
[0046] As an example, the value P of the encrypted field F is subjected to part-of-speech tagging to obtain a part-of-speech tagging result set POS.
[0047] For example, assuming that the value P of the encrypted field F = "Country A will provide emergency humanitarian assistance to country B to solve country B's urgent needs such as food and medical care.", the value P is tagged with parts of speech to determine the first part-of-speech tagging result set POS = {Country A / NN, will / AD, provide / VV, emergency / JJ, / DEG, humanitarian / NN, assistance / NN, to / P, country B / NR, for solving / VV, urgent needs of / VV, country B / NR, food / NN, and / CC, medical care / NN, etc. / ETC / NN. / PU}.
[0048] In the database encrypted field fuzzy search method and device of the above embodiment of the present disclosure, by performing part-of-speech tagging on the value of the target encrypted field, the grammatical structure and lexical role in the field can be better understood, so that more accurate matching can be performed in the subsequent fuzzy search process. By performing part-of-speech tagging and encryption on the encrypted field, it is ensured that sensitive information is not exposed in plain text, thereby enhancing the privacy protection of the database.
[0049] In a possible implementation of the above step S101, determining the target index value corresponding to the target encrypted field is implemented based on the following steps:
[0050] Add corresponding target index fields for target encrypted fields in the database;
[0051] According to a preset screening criterion, the first part-of-speech tagging result set is screened to determine a second part-of-speech tagging result set;
[0052] Deduplication processing is performed on the second part-of-speech tagging result set to determine a third part-of-speech tagging result set, and AES / CFB / NoPadding encryption and string conversion are performed on at least one word in the third part-of-speech tagging result set to determine a fourth part-of-speech tagging result set;
[0053] The fourth part-of-speech tagging result set is sorted and concatenated, a target index value corresponding to the target encrypted field is determined, and the target index value is stored in a target index field corresponding to the target encrypted field.
[0054] In this embodiment, adding a corresponding target index field to the target encrypted field in the database may include: adding a target index field FIDX to the target encrypted field F in the database. The target index field FIDX may be an index field associated with the target encrypted field F, and may function to provide a processed mapping value for the encrypted field F that can be used for retrieval.
[0055] Filtering the first part-of-speech tagging result set according to preset filtering criteria to determine the second part-of-speech tagging result set may include: filtering the first part-of-speech tagging result set POS to filter out parts of speech such as nouns and verbs with obvious search features, and determining the second part-of-speech tagging result set POS2.
[0056] Here, you can set the parts of speech to be filtered out according to specific needs. The more parts of speech you filter out, the better the search effect will be, and the larger the index will be.
[0057] As an example, the first part-of-speech tagging result set POS is screened to determine the second part-of-speech tagging result set POS2 = {Country A / NN, Country B / NR, provide / VV, emergency / JJ, humanitarian / NN, aid / NN, used for / VV, solve / VV, Country B / NR, food / NN, medical / NN, urgently needed / NN}.
[0058] Performing a deduplication process on the second part-of-speech tagging result set to determine a third part-of-speech tagging result set may include:
[0059] The second part-of-speech tagging result set POS2 is deduplicated to determine a third part-of-speech tagging result set POS3.
[0060] Here, deduplication may refer to removing repeated part-of-speech tags in the second part-of-speech tagging result set POS2 to ensure that the efficiency and accuracy of the index will not be affected due to multiple occurrences of the same part-of-speech tag or word in the subsequent search process.
[0061] As an example, the second part-of-speech tagging result set POS2 is deduplicated to obtain the third part-of-speech tagging result set POS3 = {Country A / NN, Country B / NR, provide / VV, emergency / JJ, humanitarian / NN, aid / NN, used for / VV, solve / VV, food / NN, medical / NN, urgently needed / NN}.
[0062] Performing AES / CFB / NoPadding encryption and string conversion on at least one word in the third part-of-speech tagging result set to determine a fourth part-of-speech tagging result set may include: performing AES / CFB / NoPadding encryption and Base64 conversion on each word in POS3 in the third part-of-speech tagging result set to obtain a fourth part-of-speech tagging result set POS4.
[0063] Here, AES / CFB / NoPadding encryption may be an encryption method that combines an Advanced Encryption Standard (AES) algorithm, a Cipher Feedback Mode (CFB) mode, and a No Padding option.
[0064] Among them, the AES algorithm can be a symmetric encryption algorithm used to encrypt data, the CFB mode can encrypt by feeding the ciphertext as input to the encryption process, and NoPadding can mean that no padding is performed on the data during the encryption process.
[0065] Base64 conversion may refer to converting the ciphertext of each word encrypted by AES / CFB / NoPadding into a printable string form after Base64 encoding.
[0066] As an example, the fourth part-of-speech tagging result set POS4={NAwO0pxB,NQMX0YFqoo / IaMFb,Njsz0LRj,NwAE0opd,NA4Z3YtroKH caeV0,NjsX0YBR,NyAL0LB2,OBMA0YxL,ORc80Zl5,NTgY05xv,NjQG3ZZ4} is obtained.
[0067] Sorting and concatenating the fourth part-of-speech tagging result set, determining a target index value corresponding to the target encrypted field, and storing the target index value in a target index field corresponding to the target encrypted field may include:
[0068] The fourth part-of-speech tagging result set POS4 is sorted and concatenated, a target index value IDX corresponding to the target encrypted field is determined, and the target index value IDX is stored in a target index field FIDX corresponding to the target encrypted field.
[0069] As an example, the target index value IDX may be as follows:
[0070] IDX=NA4Z3YtroKHcaeV0NAwO0pxBNQMX0YFqoo / IaMFbNTgY05xvNjQ G3ZZ4NjsX0YBRNjsz0LRjNwAE0opdNyAL0LB2OBMA0YxLORc80Zl5
[0071] In the database encrypted field fuzzy retrieval method and device of the above-mentioned embodiment of the present disclosure, by using the AES / CFB / NoPadding encryption algorithm instead of the hash value to encrypt the vocabulary, the problem of inaccurate retrieval results caused by hash collision can be prevented. By encrypting the vocabulary and then sorting and splicing it, the target index value can be effectively matched with the vocabulary to be queried, so that efficient fuzzy retrieval can still be achieved under encryption conditions, which not only ensures data security but also improves retrieval accuracy. By deduplicating and sorting the part-of-speech tagging result set, the storage of duplicate data can be reduced, ensuring that the generated target index value is as compact as possible, and reducing the storage space occupied.
[0072] In a possible implementation of the above step S102, when it is determined according to the execution statement that the target encrypted field is being queried, part-of-speech tagging is performed on the query value, including:
[0073] The SQL execution statement of the database is intercepted. When it is determined according to the SQL execution statement that the database is executing a select statement, part-of-speech tagging is performed on the value to be queried in the target encrypted field to determine a first tag result set to be queried.
[0074] In this embodiment, a select statement is intercepted when the database is executed, thereby capturing SQL requests containing encrypted fields. The select statement is used to query records in the database.
[0075] As an example, assuming that the query value of the target encrypted field F is "aid from country A", the query value is tagged with parts of speech to determine the first tagged result set to be queried SPOS = {country A / NR, of / DEG, aid / NN}.
[0076] In the database encrypted field fuzzy search method and device of the above embodiment of the present disclosure, the part-of-speech tagging process can help identify useful information in the query word, thereby optimizing the effect of fuzzy search. Even if the field is encrypted, effective fuzzy search processing can still be performed based on the part-of-speech information of the plaintext query value.
[0077] In a possible implementation of the above step S102, determining the to-be-queried index value corresponding to the to-be-queried value is implemented based on the following steps:
[0078] According to the preset screening criteria, the first to-be-queried annotation result set is screened to determine the second to-be-queried annotation result set;
[0079] De-duplication processing is performed on the second annotation result set to be queried to determine a third annotation result set to be queried, and AES / CFB / NoPadding encryption and string conversion are performed on at least one word in the third annotation result set to be queried to determine a fourth annotation result set to be queried;
[0080] The fourth to-be-queried annotation result set is sorted and concatenated to determine the to-be-queried index value corresponding to the to-be-queried value.
[0081] In this embodiment, screening the first to-be-queried annotated result set according to a preset screening criterion to determine the second to-be-queried annotated result set may include:
[0082] The first to-be-queried annotation result set SPOS is screened to determine a second to-be-queried annotation result set SPOS2.
[0083] As an example, SPOS2 = {China / NR, Aid / NN}.
[0084] Deduplication processing is performed on the second to-be-queried annotated result set to determine the third to-be-queried annotated result set, which may include:
[0085] The second to-be-queried annotated result set SPOS2 is deduplicated to determine a third to-be-queried annotated result set SPOS3.
[0086] As an example, SPOS3 = {China / NR, aid / NN}.
[0087] Performing AES / CFB / NoPadding encryption and string conversion on at least one word in the third to-be-queried annotation result set to determine a fourth to-be-queried annotation result set may include:
[0088] AES / CFB / NoPadding encryption and Base64 string conversion are performed on each word in the third to-be-queried annotation result set SPOS3 to determine a fourth to-be-queried annotation result set SPOS4.
[0089] As an example, SPOS4={NAwO0pxB,NjsX0YBR}.
[0090] Sorting and concatenating the fourth to-be-queried annotation result set to determine the to-be-queried index value corresponding to the to-be-queried value may include:
[0091] The first method is used to perform concatenation processing on the sorted fourth part-of-speech tagging result set, and an intersection of at least one to-be-queried value in the fourth part-of-speech tagging result set is used as a first to-be-queried index value corresponding to the to-be-queried value;
[0092] The second method is used to concatenate the sorted fourth part-of-speech tagging result set, and the union of at least one to-be-queried value in the fourth part-of-speech tagging result set is used as the second to-be-queried index value corresponding to the to-be-queried value.
[0093] Specifically, % is used to perform splicing processing on the fourth annotation result set SPOS4 to be queried, and the intersection of each value to be queried in the fourth annotation result set SPOS4 to be queried is determined as the value to be queried SIDX corresponding to the value to be queried; & is used to perform splicing processing on the fourth annotation result set SPOS4 to be queried, and the union of each value to be queried in the fourth annotation result set SPOS4 to be queried is determined as the value to be queried SIDX corresponding to the value to be queried.
[0094] In the database encrypted field fuzzy retrieval method and device of the above embodiment of the present disclosure, by performing AES / CFB / NoPadding encryption on the query words, it is ensured that the sensitive information of the query words is protected during the storage and retrieval process. By sorting and splicing the encrypted part-of-speech tagging result set SPOS4 to form the final query index SIDX, database matching can be performed more efficiently. According to the needs, the intersection or union can be selected as the final retrieval method, which provides higher flexibility. Through the processing after encryption and part-of-speech tagging, the generated query index SIDX will not directly store the original encrypted field value, but a simplified, encrypted index value. This can effectively reduce the consumption of storage space and also speed up the query.
[0095] In a possible implementation of the above embodiment, based on a preset operator, matching the target index value with the index value to be queried in the database, and determining the fuzzy search result corresponding to the index value to be queried in the target index value includes:
[0096] Based on the like operator of the database, the target index value is matched with the first index value to be queried in the database to determine a first fuzzy search result corresponding to the first index value to be queried, where the first fuzzy search result is an intersection;
[0097] The target index value is matched with the second index value to be queried in the database to determine a second fuzzy search result corresponding to the second index value to be queried, and the second fuzzy search result is a union.
[0098] In this embodiment, based on the like operator of the database, the target index value is matched with the first index value to be queried in the database, and the first fuzzy retrieval result corresponding to the first index value to be queried is determined. The first fuzzy retrieval result is an intersection, which may include: using the first query condition, matching the target index value with the first index value to be queried in the database, and determining the first fuzzy retrieval result corresponding to the first index value to be queried.
[0099] Here, the first query condition may be select * from table where FIDX like '%NAwO0pxB%NjsX0YBR%'.
[0100] The target index value is matched with the second index value to be queried in the database, and a second fuzzy retrieval result corresponding to the second index value to be queried is determined. The second fuzzy retrieval result is a union, which may include: using a second query condition, matching the target index value with the second index value to be queried in the database, and determining a second fuzzy retrieval result corresponding to the second index value to be queried.
[0101] Here, the second query condition may be select * from table where (FIDX like'%NAwO0pxB%'or FIDX like'%NjsX0YBR%').
[0102] In the database encrypted field fuzzy retrieval method and device of the above embodiment of the present disclosure, by using the database's like operator to match the target index value and the index value to be queried, the system can use the existing index structure of the database for fast search. Using the intersection and union methods to process the query conditions respectively can more accurately filter out records that meet the conditions, reduce unnecessary database scanning and calculations, and improve the overall efficiency of retrieval.
[0103] Please refer to Figure 3 , Figure 3 The following is a flow chart of target index value construction in a database encrypted field fuzzy search method provided by an embodiment of the present disclosure. The flow chart may include the following steps:
[0104] Step S301, intercepting the insert statement or update statement of the data, and obtaining the value P of the encrypted field F;
[0105] Step S302, performing part-of-speech tagging on P to obtain POS;
[0106] Step S303, screening POS to obtain POS2;
[0107] Step S304, deduplicate POS2 to obtain POS3;
[0108] Step S305, perform AES / CFB / NoPadding encryption and character string conversion on POS3 to obtain POS4;
[0109] Step S306, sorting and concatenating POS4 to obtain a target index value IDX;
[0110] Step S307, store IDX into the FIDX field.
[0111] Please refer to Figure 4 , Figure 4 The following is a schematic diagram of a fuzzy search result acquisition process of a database encrypted field fuzzy search method provided by an embodiment of the present disclosure. The process may include the following steps:
[0112] Step S401, intercepting the select statement of the data and obtaining the value S to be retrieved in the encrypted field F;
[0113] Step S402, performing part-of-speech tagging on S to obtain SPOS;
[0114] Step S403, screening SPOS to obtain SPOS2;
[0115] Step S404, de-duplicate SPOS2 to obtain SPOS3;
[0116] Step S405, performing AES / CFB / NoPadding encryption and character string conversion on SPOS3 to obtain SPOS4;
[0117] Step S406, confirm the search method, if the search is based on the intersection, go to step S407, if the search is based on the union, go to step S408;
[0118] Here, the splicing method of SPOS4 is determined. If the first method is used for splicing, the first query condition is used for retrieval; if the second method is used for splicing, the second query condition is used for retrieval;
[0119] Step S407, select*from table where FIDX like'%NAwO0pxB%NjsX0YBR%';
[0120] Here, the first query condition is used to match the target index value with the first index value to be queried in the database to determine the first fuzzy search result corresponding to the first index value to be queried;
[0121] Step S408, select*from table where(FIDX like'%NAwO0pxB%'or FIDX like'%NjsX0YBR%');
[0122] Here, the second query condition is used to match the target index value with the second index value to be queried in the database to determine the second fuzzy search result corresponding to the second index value to be queried.
[0123] In one embodiment, a database encrypted field fuzzy search device 50 is provided, and the database encrypted field fuzzy search device 50 corresponds to the database encrypted field fuzzy search method in the above embodiment. Figure 5 As shown, the database encrypted field fuzzy search device 50 includes a first part-of-speech tagging module 501, a second part-of-speech tagging module 502 and a fuzzy search module 503, wherein each functional module is described in detail as follows:
[0124] The first part-of-speech tagging module 501 is used to intercept the execution statement of the database, and when it is determined according to the execution statement that the target encrypted field is being inserted or updated, perform part-of-speech tagging on the target encrypted field to determine the target index value corresponding to the target encrypted field;
[0125] A second part-of-speech tagging module 502 is used to perform the part-of-speech tagging process on the to-be-queried value and determine the to-be-queried index value corresponding to the to-be-queried value when it is determined according to the execution statement that the target encrypted field is being queried;
[0126] The fuzzy search module 503 is used to match the target index value with the index value to be queried in the database based on a preset operator, and determine the fuzzy search result corresponding to the index value to be queried in the target index value; wherein the fuzzy search result is an intersection or a union.
[0127] In a specific embodiment, the first part-of-speech tagging module 501 is used to intercept the SQL execution statement of the database. When it is determined according to the SQL execution statement that the database is executing an insert statement or an update statement, the target encrypted field is tagged with part-of-speech to determine a first part-of-speech tagging result set.
[0128] In a specific embodiment, the first part-of-speech tagging module 501 is used to add a corresponding target index field to the target encrypted field in the database;
[0129] According to a preset screening criterion, the first part-of-speech tagging result set is screened to determine a second part-of-speech tagging result set;
[0130] Deduplication processing is performed on the second part-of-speech tagging result set to determine a third part-of-speech tagging result set, and AES / CFB / NoPadding encryption and string conversion are performed on at least one word in the third part-of-speech tagging result set to determine a fourth part-of-speech tagging result set;
[0131] The fourth part-of-speech tagging result set is sorted and concatenated, a target index value corresponding to the target encrypted field is determined, and the target index value is stored in the target index field corresponding to the target encrypted field.
[0132] In a specific embodiment, the second part-of-speech tagging module 502 is used to intercept the SQL execution statement of the database. When it is determined that the database is executing a select statement based on the SQL execution statement, the part-of-speech tagging is performed on the value to be queried in the target encrypted field to determine the first queried tag result set.
[0133] In a specific embodiment, the second part-of-speech tagging module 502 is used to filter the first tag result set to be queried according to a preset screening criterion to determine the second tag result set to be queried;
[0134] Deduplication processing is performed on the second annotation result set to be queried to determine a third annotation result set to be queried, and AES / CFB / NoPadding encryption and string conversion are performed on at least one word in the third annotation result set to be queried to determine a fourth annotation result set to be queried;
[0135] The fourth to-be-queried annotation result set is sorted and concatenated to determine the to-be-queried index value corresponding to the to-be-queried value.
[0136] In a specific embodiment, the second part-of-speech tagging module 502 is used to perform concatenation processing on the sorted fourth part-of-speech tagging result set using the first method, and use the intersection of at least one to-be-queried value in the fourth part-of-speech tagging result set as the first to-be-queried index value corresponding to the to-be-queried value;
[0137] The sorted fourth part-of-speech tagging result set is concatenated using the second method, and a union of at least one to-be-queried value in the fourth part-of-speech tagging result set is used as a second to-be-queried index value corresponding to the to-be-queried value.
[0138] In a specific embodiment, the fuzzy search module 503 is used to match the target index value with the first index value to be queried in the database based on the like operator of the database, and determine the first fuzzy search result corresponding to the first index value to be queried, wherein the first fuzzy search result is an intersection;
[0139] The target index value is matched with a second index value to be queried in the database to determine a second fuzzy search result corresponding to the second index value to be queried, where the second fuzzy search result is a union.
[0140] It should be noted that: the database encrypted field fuzzy search device provided in the above embodiment only uses the division of the above program modules as an example to illustrate when implementing the corresponding database encrypted field fuzzy search method. In actual application, the above processing can be assigned to different program modules as needed, that is, the internal structure of the above system can be divided into different program modules to complete all or part of the above-described processing. In addition, the system provided in the above embodiment and the corresponding Figure 1 The embodiments of the method shown belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0141] The present disclosure also provides a computer device having the above Figure 5 The database encrypted field fuzzy retrieval device shown.
[0142] See also Figure 6 , Figure 6 is a schematic diagram of the structure of another database encrypted field fuzzy search device provided by the embodiment of the present disclosure, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0143] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0144] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0145] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0146] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0147] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0148] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0149] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0150] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0151] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0152] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A fuzzy retrieval method for encrypted fields in a database, characterized in that: The method comprises: Intercepting an execution statement of a database, and when it is determined according to the execution statement that a target encrypted field is being inserted or updated, performing part-of-speech tagging on the target encrypted field to determine a target index value corresponding to the target encrypted field; When it is determined according to the execution statement that the target encrypted field is being queried, performing the part-of-speech tagging process on the queried value to determine the queried index value corresponding to the queried value; Based on a preset operator, the target index value is matched with the index value to be queried in the database to determine a fuzzy search result corresponding to the index value to be queried in the target index value; wherein the fuzzy search result is an intersection or a union.
2. The method according to claim 1, characterized in that The execution statement of the intercepted database is intercepted, and when it is determined according to the execution statement that the target encrypted field is being inserted or updated, part-of-speech tagging is performed on the target encrypted field, including: An SQL execution statement of a database is intercepted, and when it is determined according to the SQL execution statement that the database is executing an insert statement or an update statement, part-of-speech tagging is performed on a target encrypted field to determine a first part-of-speech tagging result set.
3. The method according to claim 2, characterized in that Determining the target index value corresponding to the target encrypted field is achieved based on the following steps: Add corresponding target index fields for target encrypted fields in the database; According to a preset screening criterion, the first part-of-speech tagging result set is screened to determine a second part-of-speech tagging result set; Deduplication processing is performed on the second part-of-speech tagging result set to determine a third part-of-speech tagging result set, and AES / CFB / NoPadding encryption and string conversion are performed on at least one word in the third part-of-speech tagging result set to determine a fourth part-of-speech tagging result set; The fourth part-of-speech tagging result set is sorted and concatenated, a target index value corresponding to the target encrypted field is determined, and the target index value is stored in the target index field corresponding to the target encrypted field.
4. The method according to claim 1, characterized in that: When it is determined according to the execution statement that the target encrypted field is being queried, performing the part-of-speech tagging process on the query value includes: The SQL execution statement of the database is intercepted, and when it is determined according to the SQL execution statement that the database is executing a select statement, part-of-speech tagging is performed on the value to be queried in the target encrypted field to determine a first tag result set to be queried.
5. The method according to claim 4, characterized in that Determining the index value to be queried corresponding to the value to be queried is achieved based on the following steps: According to the preset screening criteria, the first set of annotation results to be queried is screened to determine the second set of annotation results to be queried; Deduplication processing is performed on the second annotation result set to be queried to determine a third annotation result set to be queried, and AES / CFB / NoPadding encryption and string conversion are performed on at least one word in the third annotation result set to be queried to determine a fourth annotation result set to be queried; The fourth to-be-queried annotation result set is sorted and concatenated to determine the to-be-queried index value corresponding to the to-be-queried value.
6. The method according to any one of claim 5, characterized in that: The step of sorting and concatenating the fourth to-be-queried annotation result set to determine the to-be-queried index value corresponding to the to-be-queried value includes: The sorted fourth part-of-speech tagging result set is concatenated using the first method, and an intersection of at least one to-be-queried value in the fourth part-of-speech tagging result set is used as a first to-be-queried index value corresponding to the to-be-queried value; The sorted fourth part-of-speech tagging result set is concatenated using the second method, and a union of at least one to-be-queried value in the fourth part-of-speech tagging result set is used as a second to-be-queried index value corresponding to the to-be-queried value.
7. The method according to any one of claim 6, characterized in that: The step of matching the target index value with the index value to be queried in the database based on a preset operator to determine a fuzzy search result corresponding to the index value to be queried in the target index value includes: Based on the like operator of the database, the target index value is matched with the first index value to be queried in the database to determine a first fuzzy search result corresponding to the first index value to be queried, where the first fuzzy search result is an intersection; The target index value is matched with a second index value to be queried in the database to determine a second fuzzy search result corresponding to the second index value to be queried, where the second fuzzy search result is a union.
8. A fuzzy search device for encrypted fields in a database, characterized in that: The device comprises: A first part-of-speech tagging module is used to intercept an execution statement of a database, and when it is determined according to the execution statement that a target encrypted field is being inserted or updated, perform part-of-speech tagging on the target encrypted field to determine a target index value corresponding to the target encrypted field; A second part-of-speech tagging module is used to perform the part-of-speech tagging process on the to-be-queried value and determine the to-be-queried index value corresponding to the to-be-queried value when it is determined according to the execution statement that the target encrypted field is being queried; A fuzzy retrieval module is used to match the target index value with the index value to be queried in the database based on a preset operator, and determine the fuzzy retrieval result corresponding to the index value to be queried in the target index value; wherein the fuzzy retrieval result is an intersection or a union.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the database encrypted field fuzzy retrieval method described in claims 1-7.
10. A computer program product, characterized in that It comprises computer instructions, and the computer instructions are used to enable a computer to execute the database encrypted field fuzzy retrieval method according to any one of claims 1 to 7.