Fuzzy search method, device and equipment for fully-encrypted database and medium

Through the construction mode of custom target indexes, the target index is constructed using preset parameter sets to realize fuzzy search of a fully dense database, solving the problem of exposure of the correspondence between plain text and cipher text, and improving security and search efficiency.

CN120371897APending Publication Date: 2025-07-25CETC CYBERSPACE SECURITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510522360.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

When fuzzy search is implemented on a fully-secret database, the existing technology is prone to expose the correspondence between plain text and cipher text, difficult to resist statistical attacks, and insufficient security.

Method used

By customizing the construction mode of the target index through the preset parameter set, the target index is constructed to ambiguous the correspondence between plaintext and ciphertext, the ciphertext index is used for preliminary search, and the plaintext index is used for precise positioning to achieve fuzzy search.

Benefits of technology

It improves the security of data search, reduces the probability of false positive data, enhances the applicability and flexibility of the solution, and maintains efficient fuzzy search performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371897A_ABST
    Figure CN120371897A_ABST
Patent Text Reader

Abstract

The invention discloses a fuzzy search method, device and equipment oriented to a fully-encrypted database and a medium, and relates to the technical field of data security, and the method comprises the following steps: encrypting an initial plaintext field to obtain an initial encrypted field; extracting a first target character feature from the initial encryption field, and constructing a target index based on the dynamic parameter set and the first target character feature; obtaining a second target character feature corresponding to the query target, and searching each target index based on the second target character feature to determine a target encrypted field related to the query target; and decrypting each target encrypted field to obtain a corresponding first target plaintext field, and performing fuzzy search on each first target plaintext field again to obtain a second target plaintext field corresponding to the query target. The construction mode of the target index is self-defined through the preset parameter set, and the target index is constructed according to the preset parameter set, so that the corresponding relationship between the plaintext and the ciphertext is fuzzified, and the security during data search is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data security, and particularly to a fuzzy search method, device, equipment and medium for a fully homomorphic encrypted database. Background Art

[0002] With the improvement of data security awareness, more and more data is encrypted and stored to protect sensitive information from unauthorized access. However, after data encryption, traditional plaintext SQL search methods are no longer applicable.

[0003] Currently, the method for implementing fuzzy search on a fully homomorphic encrypted database is to first screen a part of the tuples that may meet the fuzzy search conditions on the ciphertext, and then perform decryption and plaintext retrieval. Related solutions often have security problems such as being prone to exposing the correspondence between plaintext and ciphertext and being difficult to resist statistical attacks. Therefore, how to implement high-security fuzzy search on encrypted data has become an urgent technical problem to be solved. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a fuzzy search method, device, equipment and medium for a fully homomorphic encrypted database, which can customize the construction mode of the target index through a preset parameter set, construct the target index according to the preset parameter set, blur the correspondence between plaintext and ciphertext, and improve the security during data search. The specific solutions are as follows:

[0005] In the first aspect, the present application provides a fuzzy search method for a fully homomorphic encrypted database, including:

[0006] Encrypt the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to the initial plaintext fields;

[0007] Extract the first target character features from each of the initial encrypted fields respectively, and construct the target indexes corresponding to the initial plaintext fields respectively based on the preset parameter sets corresponding to the initial encrypted fields respectively and the first target character features; wherein, the preset parameter set is used to determine the number of the first target character features extracted from the initial encrypted fields and the length of the target index;

[0008] Obtain the first SQL query statement input by the user, obtain the second target character features corresponding to the query target in the first SQL query statement, and perform a fuzzy search on each of the target indexes based on the second target character features to determine the target encrypted fields related to the query target in each of the initial encrypted fields;

[0009] Decrypt each of the target encrypted fields to obtain the corresponding first target plaintext fields, and use the first SQL query statement to perform a fuzzy search on each of the first target plaintext fields to obtain the second target plaintext fields corresponding to the query target.

[0010] Optionally, the encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to the initial plaintext fields includes:

[0011] Perform a preliminary encryption on each of the initial plaintext fields in the target database according to the target symmetric encryption algorithm to obtain the data to be encoded corresponding to each of the initial plaintext fields;

[0012] Encode each of the data to be encoded using the target encoding algorithm to obtain the initial encrypted fields corresponding to the initial plaintext fields.

[0013] Optionally, the encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to the initial plaintext fields includes:

[0014] Select the target encryption granularity corresponding to the initial plaintext field according to the target business scenario, and encrypt the initial plaintext field in the target database according to the target encryption granularity to obtain the initial encrypted fields corresponding to each of the initial plaintext fields; wherein, the target encryption granularity includes an encryption granularity at the single-character level and an encryption granularity at the word-segmentation level.

[0015] Optionally, the constructing the target index corresponding to each of the initial plaintext fields based on the preset parameter set corresponding to each of the initial encrypted fields and each of the first target character features includes:

[0016] Connect each of the first target character features corresponding to any one initial encrypted field to obtain the corresponding target string;

[0017] Add the target encoding characters at the target positions in the target string according to the preset parameter set corresponding to the any one initial encrypted field to obtain each of the target indexes corresponding to each of the initial plaintext fields; wherein, the target encoding characters are any characters in the character set corresponding to the target encoding algorithm.

[0018] Optionally, the obtaining the second target character features corresponding to the query target in the first SQL query statement and performing a fuzzy search on each of the target indexes based on the second target character features includes:

[0019] Determine the query target in the first SQL query statement, determine the target ciphertext corresponding to the query target from each of the initial encrypted fields, and extract the second target character feature corresponding to the query target from the target ciphertext;

[0020] Generate a second SQL query statement according to the second target character feature, and perform a fuzzy search on each of the target indexes using the second SQL query statement.

[0021] Optionally, the fuzzy search on each of the target indexes based on the second target character feature includes:

[0022] If the preset parameter set corresponding to the second target character feature indicates that the target length of the target index corresponding to the second target character feature is a fixed value, generate the second SQL query statement according to the target length and the second target character feature, and perform a fuzzy search on each of the target indexes using the second SQL query statement.

[0023] In a second aspect, the present application provides a fuzzy search device for a fully homomorphic encrypted database, including:

[0024] A field encryption module for encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to each of the initial plaintext fields;

[0025] An index construction module for respectively extracting first target character features from each of the initial encrypted fields, and constructing target indexes corresponding to each of the initial plaintext fields based on the preset parameter sets respectively corresponding to each of the initial encrypted fields and each of the first target character features; wherein, the preset parameter set is used to determine the number of the first target character features extracted from the initial encrypted fields and the length of the target index;

[0026] A first data search module for obtaining the first SQL query statement input by the user, obtaining the second target character feature corresponding to the query target in the first SQL query statement, and performing a fuzzy search on each of the target indexes based on the second target character feature to determine the target encrypted fields related to the query target in each of the initial encrypted fields;

[0027] A second data search module for decrypting each of the target encrypted fields to obtain the corresponding first target plaintext fields, and performing a fuzzy search on each of the first target plaintext fields using the first SQL query statement to obtain the second target plaintext fields corresponding to the query target.

[0028] Optionally, the fuzzy search device for a fully homomorphic encrypted database further includes:

[0029] An encryption granularity selection module, configured to select a target encryption granularity corresponding to the initial plaintext field according to a target business scenario, and encrypt the initial plaintext field in the target database according to the target encryption granularity to obtain the initial encryption fields corresponding to the respective initial plaintext fields; wherein the target encryption granularity includes a single-character-level encryption granularity and a word-segmentation-level encryption granularity.

[0030] In a third aspect, the present application provides an electronic device, including:

[0031] A memory, configured to store a computer program;

[0032] A processor, configured to execute the computer program to implement the foregoing fuzzy search method for a fully encrypted state database.

[0033] In a fourth aspect, the present application provides a computer-readable storage medium, configured to store a computer program, and when the computer program is executed by a processor, the foregoing fuzzy search method for a fully encrypted state database is implemented.

[0034] In the present application, first, the initial plaintext fields in the target database are encrypted to obtain the initial encryption fields corresponding to the respective initial plaintext fields, then first target character features are respectively extracted from the respective initial encryption fields, and target indexes corresponding to the respective initial plaintext fields are constructed based on the preset parameter sets respectively corresponding to the respective initial encryption fields and the respective first target character features; wherein the preset parameter set is used to determine the number of the first target character features extracted from the initial encryption field and the length of the target index. Then, a first SQL query statement input by a user is obtained, second target character features corresponding to a query target in the first SQL query statement are obtained, and fuzzy search is performed on the respective target indexes based on the second target character features to determine the target encryption fields related to the query target in the respective initial encryption fields. Finally, the respective target encryption fields are decrypted to obtain corresponding first target plaintext fields, and fuzzy search is performed on the respective first target plaintext fields by using the first SQL query statement to obtain second target plaintext fields corresponding to the query target. Thus, it can be seen that the present application customizes the construction mode of the target index through the preset parameter set, and constructs the target index corresponding to the plaintext data according to the preset parameter set, so that different target indexes can be generated for the same plaintext data, thereby obscuring the corresponding relationship between the plaintext and the ciphertext and improving the security when performing fuzzy search on the ciphertext data; by constructing the target index by using different first target character features and different target index lengths, the present solution can flexibly adapt to the security requirements in different scenarios, enhancing the applicability and flexibility of the solution. Description of the Drawings

[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.

[0036] Figure 1 Flowchart of a fuzzy search method for a fully homomorphic encrypted database disclosed in this application;

[0037] Figure 2 Structural schematic diagram of a fuzzy search device for a fully homomorphic encrypted database disclosed in this application;

[0038] Figure 3 Structural diagram of an electronic device disclosed in this application. Detailed implementation manners

[0039] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0040] Currently, the method of implementing fuzzy search on a fully homomorphic encrypted database has problems such as easily exposing the correspondence between plaintext and ciphertext and being difficult to resist statistical attacks. For this reason, this application provides a fuzzy search method for a fully homomorphic encrypted database, which can customize the construction mode of the target index through a preset parameter set and construct the target index according to the preset parameter set, obscuring the correspondence between plaintext and ciphertext and improving the security during data search.

[0041] See Figure 1 As shown, the embodiments of the present invention disclose a fuzzy search method for a fully homomorphic encrypted database, including:

[0042] Step S11: Encrypt the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to each of the initial plaintext fields.

[0043] This embodiment designs a fuzzy search method for a fully homomorphic encrypted database, aiming to improve search efficiency and ensure data security. The search process adopts a two-stage method: First, perform a preliminary fuzzy search on the ciphertext, using the homomorphic index and the native wildcard search ability of SQL to quickly filter out a record set that roughly matches the query condition (i.e., the query target); Second, only decrypt a small amount of the filtered record set and perform an accurate SQL fuzzy search on the plaintext.

[0044] In this embodiment, in order to reuse the fuzzy search ability of SQL on ciphertext, additional encrypted indexes (i.e., target indexes) are constructed to assist in locating tuples that meet the conditions. In index construction, both word granularity and single-character granularity are supported, depending on the specific application scenario. The following takes the single-character encryption granularity as an example for illustration: In this embodiment, it is first necessary to encrypt each plaintext field in the database and obtain the corresponding target index according to the corresponding encrypted field. Among them, the process of encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to the initial plaintext fields may specifically include: preliminarily encrypting each initial plaintext field in the target database according to the target symmetric encryption algorithm to obtain the data to be encoded corresponding to each initial plaintext field; encoding each data to be encoded using the target encoding algorithm to obtain the initial encrypted field corresponding to the initial plaintext field; specifically, first select appropriate encryption parameters according to the attribute column to be encrypted (i.e., the initial plaintext field), and the encryption uses target symmetric encryption algorithms such as AES (Advanced Encryption Standard), SM4 (a block algorithm), etc., and the encoding uses base64 (i.e., the target encoding algorithm).

[0045] It should be noted that this embodiment can select either single-character encryption granularity or word-segmentation encryption granularity, mainly according to the business scenario; correspondingly, the process of encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to the initial plaintext fields may specifically include: selecting the target encryption granularity corresponding to the initial plaintext field according to the target business scenario, and encrypting the initial plaintext fields in the target database according to the target encryption granularity to obtain the initial encrypted fields corresponding to each initial plaintext field respectively; among them, the target encryption granularity includes single-character-level encryption granularity and word-segmentation-level encryption granularity. By configuring the encryption granularity of the data according to the requirements, it can better adapt to the scenario of fuzzy search for any character in the database SQL. For example, it is crucial for some requirements such as searching for those starting with "Wang" in the name field.

[0046] Step S12: Extract the first target character features from each of the initial encrypted fields respectively, and construct the target index corresponding to each of the initial plaintext fields based on the preset parameter set corresponding to each of the initial encrypted fields and each of the first target character features; where the preset parameter set is used to determine the number of the first target character features extracted from the initial encrypted field and the length of the target index.

[0047] In this embodiment, after obtaining the initial encrypted fields corresponding to the initial plaintext fields in the target database (i.e., the fully encrypted database), it is also necessary to obtain the target index corresponding to each initial plaintext field according to the above initial encrypted fields. The process of constructing the target index corresponding to each initial plaintext field based on the preset parameter set corresponding to each initial encrypted field and each first target character feature may specifically include: concatenating each first target character feature corresponding to any initial encrypted field to obtain a corresponding target string; adding a target encoding character at a target position in the target string according to the preset parameter set corresponding to any initial encrypted field to obtain each target index corresponding to each initial plaintext field; where the target encoding character is any character in the character set corresponding to the target encoding algorithm.

[0048] Specifically, it is first necessary to construct a parameter set corresponding to the initialization ciphertext , where represents the number of consecutive characters in the feature extraction process, and total_length represents the total length after single-character encryption.

[0049] For the plaintext to be encrypted (i.e., the initial plaintext field) , where single character is the result after symmetric encryption and base64 encoding. Next, according to the above parameter set, data features DF (i.e., the first target character features) are extracted from for and the target index is constructed.

[0050] For example, {2, 3, 8} means extracting consecutive two-character features such as from and three-character features such as (i.e., the first target character features, the extraction positions are arbitrary but need to be unified). In the string composed of AB and CDE (i.e., the target string), random encoding characters (i.e., the target encoding characters) taken from the base64 character set are inserted at the position . The number of characters inserted in each is indefinite, but a ciphertext string with a total length of 8 characters is formed. If the above parameter set is {1, 2, 1, [6, 10]}, it means that the total length range of the inserted characters in is controlled within the interval range [6, 10], that is, the length can be any one of 6, 7, 8, 9, 10. Finally, all The target index INDEX corresponding to the plaintext M can be obtained by splicing. By inserting characters at different positions and using the parameter set to constrain the generated index length, in the same dataset, the length of the index after single-character encryption is indefinite, and the overall length after field encryption is also indefinite, which increases the difficulty for attackers to analyze the ciphertext. It can be understood that The mode of also has certain advantages and can be selected in some scenarios.

[0051] Step S13: Obtain the first SQL query statement input by the user, obtain the second target character feature corresponding to the query target in the first SQL query statement, and perform a fuzzy search on each of the target indexes based on the second target character feature to determine the target encrypted fields related to the query target in each of the initial encrypted fields.

[0052] In this embodiment, the process of obtaining the second target character feature corresponding to the query target in the first SQL query statement and performing a fuzzy search on each of the target indexes based on the second target character feature may specifically include: determining the query target in the first SQL query statement, and determining the target ciphertext corresponding to the query target from each of the initial encrypted fields, and extracting the second target character feature corresponding to the query target from the target ciphertext; generating a second SQL query statement according to the second target character feature, and performing a fuzzy search on each of the target indexes by using the second SQL query statement; specifically, when the search condition is "where field name LIKE 'c%'" (i.e., the first SQL query statement), first perform a character feature extraction process on c (i.e., the query target) to obtain the corresponding DF (i.e., the second target character feature), and then use "where INDEX LIKE '%DF%'" for the first-stage search, so as to finally decrypt it in the search set of the first stage, and then execute the second-stage plaintext SQL to accurately locate the tuples that meet the fuzzy search conditions.

[0053] In this embodiment, the process of performing fuzzy search on each target index based on the second target character feature may specifically include: If the preset parameter set corresponding to the second target character feature indicates that the target length of the target index corresponding to the second target character feature is a fixed value, a second SQL query statement is generated according to the target length and the second target character feature, and the second SQL query statement is used to perform fuzzy search on each target index; specifically, if total_length is set to a fixed value in the parameter selection stage, the substring search capability of the database can be used to further reduce the false positive probability, and the above ciphertext search condition can be changed to "where substring(INDEX,1,total_length) LIKE '%DF%' (i.e., the second SQL query statement)". If the search condition is "where field name LIKE '%c'", the search condition in the first stage can be defined as "where right(INDEX, total_length) LIKE '%DF%'". More complexly, if the search condition is "where field name LIKE '_c%'", the search condition in the first stage is defined as "where substring(INDEX,total_length + 1,total_length) LIKE '%DF%'". By performing preliminary fuzzy search on the index, a batch of encrypted fields corresponding to the query conditions can be screened out, avoiding the situation of decrypting all encrypted fields and then performing data screening, thereby reducing the data calculation amount and improving the fuzzy search efficiency.

[0054] Step S14: Decrypt each of the target encrypted fields to obtain the corresponding first target plaintext fields, and use the first SQL query statement to perform fuzzy search on each of the first target plaintext fields to obtain the second target plaintext fields corresponding to the query target.

[0055] In this embodiment, among the target encrypted fields obtained by performing fuzzy search in the first stage using the index, executing the second-stage plaintext SQL can accurately locate the tuples that meet the fuzzy search conditions (i.e., the second target plaintext fields).

[0056] In a specific implementation manner, a dataset of 310,000 records is selected for testing, the encryption parameter set is selected as {2, 3, 8}, and the SM4 encryption algorithm is used. The following table is a comparison table of the plaintext and ciphertext before and after encryption. It can be found that the ciphertexts encrypted from the same plaintext are different, which has good security.

[0057] Table 1 Comparison Table of Plaintext and Ciphertext of Database Encrypted Fields

[0058] When performing a fuzzy search, the plaintext SQL submitted is "select * from plain_table where customer name LIKE'B City%'". When performing a first-stage ciphertext fuzzy search, the encrypted SQL is converted to "select * from cipher_table where customer name LIKE '%Sa%g / k%Lo%nt6%uH%GN5%'". The amount of data that needs to be decrypted in the second stage can be directly located from the total data of 30w+, which is 64334, while the actual number of tuples that meet the plaintext fuzzy search conditions is 63829. If the encrypted SQL is "select * from cipher_table where substring (customer name, 1, 24) LIKE '%Sa%g / k%Lo%nt6%uH%GN5%'", the amount of data located is 63829, that is, there is no false positive data.

[0059] Similarly, the plaintext SQL "select * from plain_table where customer name LIKE '%tumor__'" is converted into the ciphertext SQL "select * from cipher_0307 where substring(customer name, LENGTH(customer name)-23, 8) LIKE '%mm%vtn%'". There are no false positives in the 1404 data selected.

[0060] After fuzzy search tests on various SQL modes (including %, _, single-word matching, word matching, and sentence matching), it can be found that this method has a good dense fuzzy retrieval effect. It is mainly reflected in that on the one hand, it will not miss any data and can detect all tuples that meet the fuzzy search conditions. On the other hand, it will greatly reduce the probability of false positive data, that is, more than 98% of the tuples in the first stage of data meet the plaintext fuzzy search conditions.

[0061] It can be seen that the present application effectively controls the expansion multiple of the index by supporting custom index length and encryption mode in the index generation stage, while effectively hiding the characteristics and correspondence between plaintext and index, ensuring that the data remains highly secure in the encrypted state; through custom encryption word segmentation granularity, custom ciphertext length and encryption mode, the scheme can flexibly adapt to security requirements in different scenarios, enhancing the applicability and flexibility of the scheme; by using the index for a first-stage ciphertext search and a second-stage plaintext search, there is no need to decrypt all ciphertexts before searching, so that fuzzy search can remain efficient even in the ciphertext state.

[0062] See also Figure 2As shown in the figure, an embodiment of the present invention discloses a fuzzy search device for a fully homomorphic database, including:

[0063] A field encryption module 11, configured to encrypt initial plain text fields in a target database to obtain initial encrypted fields corresponding to the respective initial plain text fields;

[0064] An index construction module 12, configured to respectively extract first target character features from the respective initial encrypted fields, and construct target indexes corresponding to the respective initial plain text fields based on a preset parameter set corresponding to each of the initial encrypted fields and each of the first target character features; wherein, the preset parameter set is used to determine the number of the first target character features extracted from the initial encrypted fields and the length of the target indexes;

[0065] A first data search module 13, configured to obtain a first SQL query statement input by a user, obtain second target character features corresponding to a query target in the first SQL query statement, and perform a fuzzy search on each of the target indexes based on the second target character features to determine target encrypted fields related to the query target in the respective initial encrypted fields;

[0066] A second data search module 14, configured to decrypt each of the target encrypted fields to obtain corresponding first target plain text fields, and perform a fuzzy search on each of the first target plain text fields by using the first SQL query statement to obtain second target plain text fields corresponding to the query target.

[0067] It can be seen that the present application customizes the construction mode of the target index through the preset parameter set, and constructs the target index corresponding to the plain text data according to the preset parameter set, which can generate different target indexes for the same plain text data, thereby obscuring the correspondence between the plain text and the cipher text, and improving the security when performing a fuzzy search on the cipher text data; by constructing the target index by using different first target character features and different target index lengths, the present solution can flexibly adapt to the security requirements in different scenarios, enhancing the applicability and flexibility of the solution.

[0068] In some specific embodiments, the field encryption module 11 may specifically include:

[0069] A field encryption unit, configured to perform preliminary encryption on each of the initial plain text fields in the target database according to a target symmetric encryption algorithm to obtain to-be-encoded data corresponding to each of the initial plain text fields;

[0070] A data encoding unit, configured to encode each of the to-be-encoded data by using a target encoding algorithm to obtain the initial encrypted fields corresponding to the initial plain text fields.

[0071] In some specific embodiments, the field encryption module 11 may specifically include:

[0072] An encryption granularity selection unit, configured to select a target encryption granularity corresponding to the initial plaintext field according to a target service scenario, and encrypt the initial plaintext field in the target database according to the target encryption granularity to obtain the initial encrypted fields respectively corresponding to the initial plaintext fields; wherein, the target encryption granularity includes an encryption granularity at the single-character level and an encryption granularity at the word-segmentation level.

[0073] In some specific embodiments, the index construction module 12 may specifically include:

[0074] A string acquisition unit, configured to concatenate the first target character features corresponding to any one of the initial encrypted fields to obtain a corresponding target string;

[0075] A character addition unit, configured to add a target encoded character at a target position in the target string according to the preset parameter set corresponding to any one of the initial encrypted fields to obtain the target indexes respectively corresponding to the initial plaintext fields; wherein, the target encoded character is any character in the character set corresponding to the target encoding algorithm.

[0076] In some specific embodiments, the first data search module 13 may specifically include:

[0077] A character feature extraction unit, configured to determine a query target in the first SQL query statement, determine a target ciphertext corresponding to the query target from the initial encrypted fields, and extract the second target character features corresponding to the query target from the target ciphertext;

[0078] A first data search unit, configured to generate a second SQL query statement according to the second target character features, and perform a fuzzy search on the target indexes by using the second SQL query statement.

[0079] In some specific embodiments, the first data search module 13 may specifically include:

[0080] A second data search unit, configured to, if the preset parameter set corresponding to the second target character features indicates that a target length of the target index corresponding to the second target character features is a fixed value, generate the second SQL query statement according to the target length and the second target character features, and perform a fuzzy search on the target indexes by using the second SQL query statement.

[0081] Furthermore, an embodiment of the present application also discloses an electronic device, Figure 3It is a structural diagram of an electronic device 20 shown according to an exemplary embodiment. The content in the figure should not be considered as any limitation on the scope of use of this application.

[0082] Figure 3 This is a schematic structural diagram of an electronic device 20 provided by an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the fuzzy search method for a fully encrypted database disclosed in any of the foregoing embodiments. Additionally, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0083] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of this application, and specific limitations are not imposed here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application requirements, and specific limitations are not imposed here.

[0084] In addition, as a carrier for resource storage, the memory 22 can be a read-only memory, a random access memory, a magnetic disk, or an optical disc, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0085] Among them, the operating system 221 is used to manage and control each hardware device and the computer program 222 on the electronic device 20, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the fuzzy search method for a fully encrypted database executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.

[0086] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the fuzzy search method for a fully encrypted database disclosed above. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details are not repeated here.

[0087] In this specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method section.

[0088] Those skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0089] The steps of the methods or algorithms described in combination with the embodiments disclosed in this article can be directly implemented by hardware, software modules executed by a processor, or a combination of both. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0090] Finally, it should also be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including an..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

[0091] The technical solutions provided in this application have been introduced in detail above. Specific examples are used in this article to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to this application.

Claims

1. A fuzzy search method for a fully encrypted database, characterized in that Including: Encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to the respective initial plaintext fields; Extracting first target character features from the respective initial encrypted fields, and constructing target indexes corresponding to the respective initial plaintext fields based on the preset parameter sets respectively corresponding to the respective initial encrypted fields and the respective first target character features; wherein, the preset parameter set is used to determine the number of the first target character features extracted from the initial encrypted fields and the length of the target indexes; Obtaining a first SQL query statement input by a user, obtaining second target character features corresponding to a query target in the first SQL query statement, and performing a fuzzy search on the respective target indexes based on the second target character features to determine target encrypted fields related to the query target in the respective initial encrypted fields; Decrypting the respective target encrypted fields to obtain corresponding first target plaintext fields, and performing a fuzzy search on the respective first target plaintext fields using the first SQL query statement to obtain second target plaintext fields corresponding to the query target.

2. The fuzzy search method for a fully homomorphic encrypted database according to claim 1, wherein The encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to the respective initial plaintext fields includes: Preliminarily encrypting the respective initial plaintext fields in the target database according to a target symmetric encryption algorithm to obtain encoded data to be encoded respectively corresponding to the respective initial plaintext fields; Encoding the respective encoded data to be encoded using a target encoding algorithm to obtain the initial encrypted fields corresponding to the initial plaintext fields.

3. The fuzzy search method for a fully encrypted database according to claim 1, wherein The encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to the respective initial plaintext fields includes: Selecting a target encryption granularity corresponding to the initial plaintext field according to a target business scenario, and encrypting the initial plaintext fields in the target database according to the target encryption granularity to obtain the initial encrypted fields respectively corresponding to the respective initial plaintext fields; wherein, the target encryption granularity includes an encryption granularity at the single-character level and an encryption granularity at the word-segmentation level.

4. The fuzzy search method for a fully encrypted database according to claim 2, characterized in that, The constructing the target indexes corresponding to the respective initial plaintext fields based on the preset parameter sets respectively corresponding to the respective initial encrypted fields and the respective first target character features includes: Connecting the respective first target character features corresponding to any one of the initial encrypted fields to obtain a corresponding target string; Adding target encoding characters at target positions in the target string according to the preset parameter set corresponding to the any one of the initial encrypted fields to obtain the respective target indexes corresponding to the respective initial plaintext fields; wherein, the target encoding characters are any characters in the character set corresponding to the target encoding algorithm.

5. The fuzzy search method for a fully encrypted database according to claim 2, wherein The obtaining the second target character features corresponding to the query target in the first SQL query statement and performing a fuzzy search on the respective target indexes based on the second target character features includes: Determine the query target in the first SQL query statement, determine the target ciphertext corresponding to the query target from each of the initial encrypted fields, and extract the second target character feature corresponding to the query target from the target ciphertext; Generate a second SQL query statement based on the second target character feature, and perform a fuzzy search on each of the target indexes using the second SQL query statement.

6. The fuzzy search method for a fully homomorphic encrypted database according to claim 4, wherein The fuzzy search on each of the target indexes based on the second target character feature includes: If the preset parameter set corresponding to the second target character feature indicates that the target length of the target index corresponding to the second target character feature is a fixed value, generate the second SQL query statement based on the target length and the second target character feature, and perform a fuzzy search on each of the target indexes using the second SQL query statement.

7. A fuzzy search device for a fully encrypted database, characterized in that Includes: A field encryption module for encrypting the initial plaintext fields in the target database to obtain the initial encrypted fields corresponding to each of the initial plaintext fields; An index construction module for respectively extracting the first target character features from each of the initial encrypted fields, and constructing the target indexes corresponding to each of the initial plaintext fields based on the preset parameter sets respectively corresponding to each of the initial encrypted fields and each of the first target character features; wherein, the preset parameter set is used to determine the number of the first target character features extracted from the initial encrypted field and the length of the target index. A first data search module for obtaining the first SQL query statement input by the user, obtaining the second target character feature corresponding to the query target in the first SQL query statement, and performing a fuzzy search on each of the target indexes based on the second target character feature to determine the target encrypted fields related to the query target in each of the initial encrypted fields. A second data search module for decrypting each of the target encrypted fields to obtain the corresponding first target plaintext fields, and performing a fuzzy search on each of the first target plaintext fields using the first SQL query statement to obtain the second target plaintext fields corresponding to the query target.

8. The fuzzy search device for a fully encrypted database according to claim 7, characterized in that, Further includes: An encryption granularity selection module for selecting the target encryption granularity corresponding to the initial plaintext field according to the target business scenario, and encrypting the initial plaintext fields in the target database according to the target encryption granularity to obtain the initial encrypted fields respectively corresponding to each of the initial plaintext fields; wherein, the target encryption granularity includes the encryption granularity at the single-character level and the encryption granularity at the word-segmentation level.

9. An electronic device, characterized in that, Includes: A memory for storing a computer program; A processor for executing the computer program to implement the fuzzy search method for a fully encrypted database according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, For storing a computer program, the computer program, when executed by the processor, implements the fuzzy search method for a fully encrypted database according to any one of claims 1 to 6.