Search method and apparatus

By using a tree-based index based on virtual trees and a three-trapdoor search method, the problems of low efficiency and inaccurate results in wildcard search are solved, achieving efficient and accurate data search and updates, and improving data processing efficiency.

CN115269585BActive Publication Date: 2026-04-17HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2021-04-30
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing searchable encryption methods are inefficient and inaccurate when searching with wildcards, especially those based on Bloom filters, which result in low search efficiency, inaccurate wildcard search results, and a decrease in search speed as the number of features increases.

Method used

A tree-based index structure based on virtual trees is adopted, combined with a three-trapdoor search method, to gradually filter out Bloom filters that do not need comparison, thereby improving search efficiency. Furthermore, the relative positional relationship of letters is determined by extracting the interval features and AB features of keywords, thereby improving the accuracy of search results.

Benefits of technology

It significantly improves the efficiency and accuracy of wildcard searches, reduces the number of Bloom filters that need to be compared, supports data updates without regenerating the index, and improves data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115269585B_ABST
    Figure CN115269585B_ABST
Patent Text Reader

Abstract

This application relates to a search method and apparatus. The method includes: receiving three trapdoors corresponding to the content to be queried; locating a first starting point of the character existence feature layer of the tree-indexed ciphertext based on the character existence trapdoor, and searching the character existence feature layer from the first starting point to obtain a second starting node; searching the feature layer that retains relative positions from the second starting node based on the trapdoor that preserves relative positions to obtain a third starting point; and searching the Bloom filter feature layer from the third starting point based on the trapdoor of the Bloom filter to obtain a search result matching the content to be queried. By employing a tree-indexed structure based on a virtual tree, combined with a three-trapdoor search method, a large number of Bloom filters that do not need to be compared are gradually filtered out, greatly reducing the number of Bloom filters that ultimately need to be compared and improving search efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of search technology, and in particular to a search method and apparatus. Background Technology

[0002] Users have limited local storage space. With the rapid increase in data volume, users can store data on cloud servers to free up local storage space. To protect data privacy, users can encrypt data containing private information before storing it. However, the generated ciphertext is random, making it impossible for users to identify the data they need. To solve this technical problem, a searchable encryption method has been proposed. Using this method, users can search for encrypted data using keywords.

[0003] Wildcards can be used to search for incomplete keywords. Incomplete keywords can be described using two types of wildcard symbols: a single-character wildcard (represented by "_") and a multi-character wildcard (represented by "*"). A single-character wildcard represents any single character, while a multi-character wildcard represents any string of zero or more characters.

[0004] Based on the cryptographic tools used, wildcard searchable encryption methods can be divided into the following three categories: Bloom filter-based methods, hidden vector-based methods, and homomorphic encryption-based methods.

[0005] The Bloom filter-based method describes keywords using a set of features, with each keyword represented by a Bloom filter. The value of the Bloom filter for a keyword is calculated based on the set of features, and all Bloom filters are traversed during the search.

[0006] Hidden vector encryption (HVA) methods generate decryption keys based on keywords that are single-character wildcards in certain positions. The complete keyword "TURE" is then used to encrypt the encryption. Decryption is only possible if the decryption key matches the keyword used for encryption. HVA methods involve modular exponentiation or bilinear pairing operations.

[0007] Based on homomorphic encryption, a secure protocol for cutting keywords was designed. This protocol, along with nested loops, is used to determine whether each keyword ciphertext matches a keyword containing wildcards. The number of loops depends on the number of characters represented by the wildcards and the number of wildcards.

[0008] If we consider keywords as a set of features, then searching for keywords can be transformed into a Boolean search for features. Therefore, Boolean searchable encryption can also be used to achieve wildcard searchable encryption.

[0009] The following technical problems exist in related technologies: Searching using Bloom filters involves comparing each Bloom filter individually, leading to low search efficiency; wildcard search results are inaccurate because related technologies typically search based on features such as character presence, ascending order, and descending order, which are not comprehensive enough, resulting in inaccurate search results; the search speed of wildcard search methods decreases as the number of keyword features increases. In wildcard search, the more features provided by the user, and the closer the searched keyword (including wildcards) is to the complete keyword (excluding wildcards), the faster the expected search speed should be. For example, searching for complete keywords is faster. In other words, the more features the user provides for the searched keyword (including wildcards), the faster the expected search speed. However, this expectation does not apply to wildcard search methods in related technologies; when using wildcard search, the more features containing wildcards are provided, the slower the search speed. Summary of the Invention

[0010] In view of this, a search method and apparatus are proposed, which adopts a tree-based index based on virtual trees and combines it with a three-trapdoor search method to gradually filter out a large number of Bloom filters that do not need to be compared, which greatly reduces the number of Bloom filters that need to be compared in the end and improves search efficiency.

[0011] In a first aspect, embodiments of this application provide a search method applied to an electronic device. The method includes: generating a key set, an encryption algorithm, a set of pseudo-random functions, and a secure permutation function based on security parameters; generating a tree-structured index ciphertext based on each record in a plaintext dataset, the key set, the encryption algorithm, the set of pseudo-random functions, and the secure permutation function; wherein each record includes a keyword corresponding to one field or a combination of keywords from two or more fields, and the tree-structured index ciphertext includes a character existence feature layer, a feature layer preserving relative positions, and a Bloom filter feature layer; the character existence feature layer stores ciphertext data of the character existence features of the record, the feature layer preserving relative positions stores ciphertext data of the feature layer preserving relative positions of the record, and the Bloom filter feature layer stores ciphertext data of the Bloom filter feature of the record; and sending the tree-structured index ciphertext to a server, wherein the tree-structured index ciphertext is used by the server to search layer by layer in the order of the character existence feature layer, the feature layer preserving relative positions, and the Bloom filter feature layer to determine if there are any search results matching the content to be queried.

[0012] The search method according to the embodiments of this application can obtain search results more quickly, improving search efficiency. Related technologies mostly use forward and inverted indexes for their index structures. When performing wildcard searches, they can only traverse all Bloom filters for all keywords, resulting in low search efficiency. The search method of the embodiments of this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search method, to gradually filter out a large number of Bloom filters that do not need to be compared, greatly reducing the number of Bloom filters that need to be compared in the end, thus improving search efficiency.

[0013] According to the first aspect, in a first possible implementation, generating a tree-indexed ciphertext based on each record in the plaintext dataset, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function includes: establishing a tree index for each record in the plaintext dataset, wherein the tree index includes a first part storing character existence features of the record, a second part storing features that preserve relative positions, and a third part storing Bloom filter features; storing the value of the first part locally; and encrypting the first part, the second part, and the third part of the tree index according to the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the tree-indexed ciphertext.

[0014] According to the first possible implementation of the first aspect, in the second possible implementation, a tree index is built based on each record in the plaintext dataset, including: for each record, extracting features of each keyword of each record, wherein the features of each keyword include: character presence features, features preserving relative positions, and Bloom filter features; calculating a bitmap of size 26 for each record based on the character presence features of each record; calculating a bitmap of size 676 for each record based on the features preserving relative positions of each record; and calculating a bitmap of size 676 based on the Bloom filter features of each record. The Bloom filter feature is used to calculate the Bloom filter for each record; the records in the plaintext dataset are classified based on the character existence feature to obtain multiple classes of records; a tree index is built according to the multiple classes of records and the bitmap of each record, wherein the third node of the third part of the tree index stores the Bloom filter and the bitmaps of 676 and 26 corresponding to the node, the second node of the second part of the tree index stores the union of the bitmaps of 676 of the leaf nodes of the second node, and the first node of the first part of the tree index stores the union of the bitmaps of 26 of the leaf nodes of the first node.

[0015] According to the second possible implementation of the first aspect, in the third possible implementation, the first part, the second part, and the third part of the tree index are encrypted according to the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the tree index ciphertext, including:

[0016] The first part of the tree index is encrypted according to the key set and the pseudo-random function set to obtain a character existence feature layer; the first node of the character existence feature layer stores the character existence features T1 and T2 contained in the first node, wherein, The first node of the last layer of the character existence feature layer The first node of the non-last layer of the character existence feature layer Among them, A 1 A 3 As the key, A 2 A 4 A 5 For the value, e A ||1、e A ||2、e A ||3,e A ||4 indicates that the character's existence characteristic is concatenated with different numbers, f A f is a pseudo-random function related to the character existence feature. p Let v be a pseudo-random function related to the tree nodes, where v represents the path of the first node;

[0017] The second part of the tree index is encrypted using the key set, the pseudo-random function set, and the secure permutation function to obtain a feature layer that preserves relative positions. The ciphertext data stored in the second node of the feature layer that preserves relative positions is (f p (v), f p (v l ), f p (v r ), pe(B 676 ), where v l This represents the path of the left child node of the second node, v r B represents the path of the right child node of the second node. 676 This represents a bitmap with a second node of size 676, where pe represents the safe permutation function, and f... p (v) is the key, f p (v l ), f p (v r ), pe(B 676 ) is a value;

[0018] The third part of the tree index is encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the Bloom filter feature layer. The ciphertext data stored in the third node of the Bloom filter feature layer is (f p (v), f id (id rec ), c rec BF m1 BF m2 …,BF mn ), where c rec To encrypt the record rec obtained by using an encryption algorithm on the third node, BF mi A Bloom filter for recording the keyword mi of record rec, where 1 ≤ i ≤ n, n is the number of keywords in the record, and id rec =f rec (rec), where f rec f represents a pseudo-random function related to records. id This represents a pseudo-random function related to id.

[0019] In one possible implementation, the method further includes: encrypting the value of the first part to generate locally stored character existence feature layer ciphertext and sending it to the server. Since the server stores the locally stored character existence feature layer ciphertext, if the value of the first part is lost locally on the electronic device, the electronic device can download the locally stored character existence feature layer ciphertext from the server and decrypt it to obtain the value of the first part, without needing to rebuild the index of the first part, thus saving time.

[0020] In one possible implementation, the Bloom filter features include interval features, which are pairs of characters in the keywords that are separated by one character and maintain their relative positions. According to the search method of the above embodiments of this application, by extracting the interval features of keywords, the technical problem of inaccurate search results for single-character wildcards in related technologies can be solved.

[0021] The search method according to the above embodiments of this application can also solve the technical problem of inaccurate character matching between the first and last multi-character wildcard characters in related technologies. According to the search method of this application, by extracting AB-type features, the relative positional relationship of letters can be determined, thus improving the accuracy of search results.

[0022] According to the first possible implementation of the first aspect, in the fourth possible implementation, the method further includes: receiving content to be queried; determining a first starting point for querying based on the content to be queried and the value of the first part; obtaining a three-part trapdoor of the content to be queried based on the content to be queried, the first starting point, the key set, the pseudo-random function set, and the secure permutation function; and sending the three-part trapdoor to the server so that the server searches the tree-indexed ciphertext based on the three-part trapdoor to obtain the search results of the content to be queried.

[0023] According to the first aspect or any of the first to fourth possible implementations of the first aspect, in the fifth possible implementation, the method further includes: receiving content to be updated; generating update information based on the content to be updated, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function, the update information including new locally stored character existence feature layer ciphertext and index information of the content to be updated; sending the update information to the server, so that the server updates the locally stored character existence feature layer ciphertext and tree index ciphertext according to the update information. The search method of this application embodiment can update the indexed content according to user needs, supporting data updates without requiring users to regenerate the tree index ciphertext, thus improving data processing efficiency.

[0024] Secondly, embodiments of this application provide a search method applied to a server. The method includes: receiving a three-part trapdoor corresponding to content to be queried; wherein the content to be queried is a keyword corresponding to one field or a combination of keywords corresponding to multiple fields; the three-part trapdoor includes a character existence trapdoor, a trapdoor that preserves relative positions, and a Bloom filter trapdoor; the three-part trapdoor is calculated based on the content to be queried; locating a first starting point of the character existence feature layer of the tree-indexed ciphertext based on the character existence trapdoor, and searching the character existence feature layer from the first starting point to obtain a second starting node; The tree-structured index ciphertext includes the character existence feature layer, the relative position preservation feature layer, and the Bloom filter feature layer. The character existence feature layer stores ciphertext data of the recorded character existence features, the relative position preservation feature layer stores ciphertext data of the recorded relative position preservation features, and the Bloom filter feature layer stores ciphertext data of the recorded Bloom filter features. The relative position preservation feature layer is searched starting from the second starting node based on the trapdoor of the relative position preservation feature layer to obtain a third starting point. The Bloom filter feature layer is then searched starting from the third starting point based on the trapdoor of the Bloom filter to obtain search results matching the query content.

[0025] The search method according to the embodiments of this application can obtain search results more quickly, improving search efficiency. Related technologies mostly use forward and inverted indexes for their index structures. When performing wildcard searches, they can only traverse all Bloom filters for all keywords, resulting in low search efficiency. The search method of the embodiments of this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search method, to gradually filter out a large number of Bloom filters that do not need to be compared, greatly reducing the number of Bloom filters that need to be compared in the end, thus improving search efficiency.

[0026] According to the second aspect, in a first possible implementation, the method further includes: receiving update information, wherein the update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated; replacing the locally stored character existence feature layer ciphertext with the new locally stored character existence feature layer ciphertext; and updating the tree-type index ciphertext with the index information to obtain a new tree-type index ciphertext.

[0027] According to the first possible implementation of the second aspect, in the second possible implementation, the index information includes the identifier of the node to be deleted.

[0028] The process of updating the tree index ciphertext according to the index information to obtain a new tree index ciphertext includes: searching the Bloom filter feature layer of the tree index ciphertext according to the identifier of the node to be deleted, and setting the value of the node in the Bloom filter feature layer that is the same as the identifier of the node to be deleted to null.

[0029] According to the first or second possible implementation of the second aspect, in the third possible implementation, the index information includes content to be added, which includes the ciphertext of the record to be added, a Bloom filter, an encrypted record identifier, and a bitmap. Updating the tree-structured index ciphertext according to the index information to obtain a new tree-structured index ciphertext includes: selecting an update node from the feature layer that preserves the relative positions of nodes in the feature layer of the tree-structured index ciphertext based on the bitmap of the record to be added and the bitmap of the node in the feature layer that preserves the relative positions; taking the union of the bitmap of the update node and the bitmap of the record to be added as the new bitmap of the update node; and randomly selecting a node in the Bloom filter feature layer of the tree-structured index ciphertext to store the ciphertext of the record to be added, the Bloom filter, and the encrypted record identifier. The search method of this application embodiment can update the index content according to user needs, supporting data updates without requiring users to regenerate the tree-structured index ciphertext, thus improving data processing efficiency.

[0030] Thirdly, embodiments of this application provide a search device applied to an electronic device. The device includes: an initialization module for generating a key set, an encryption algorithm, a set of pseudo-random functions, and a secure permutation function based on security parameters; an encryption module for generating a tree-structured index ciphertext based on each record in a plaintext dataset, the key set, the encryption algorithm, the set of pseudo-random functions, and the secure permutation function; wherein each record includes a keyword corresponding to one field or a combination of keywords from two or more fields, and the tree-structured index ciphertext includes a character existence feature layer, a feature layer preserving relative positions, and a Bloom filter feature layer; the character existence feature layer stores ciphertext data of the character existence features of the record, the feature layer preserving relative positions stores ciphertext data of the feature layer preserving relative positions of the record, and the Bloom filter feature layer stores ciphertext data of the Bloom filter feature of the record; and a first sending module for sending the tree-structured index ciphertext to a server, wherein the tree-structured index ciphertext is used by the server to search layer by layer in the order of the character existence feature layer, the feature layer preserving relative positions, and the Bloom filter feature layer to see if there are any search results matching the content to be queried.

[0031] The search device according to the embodiments of this application can obtain search results more quickly, improving search efficiency. Related technologies mostly use forward and inverted indexes for their index structures. When performing wildcard searches, they can only traverse all Bloom filters for all keywords, resulting in low search efficiency. The search device of the embodiments of this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search, to gradually filter out a large number of Bloom filters that do not need to be compared, greatly reducing the number of Bloom filters that ultimately need to be compared, thus improving search efficiency.

[0032] According to the third aspect, in a first possible implementation, the encryption module is further configured to build a tree index for each record in the plaintext dataset, wherein the tree index includes a first part storing the character existence characteristics of the record, a second part storing the characteristics of preserving relative positions, and a third part storing the Bloom filter characteristics; the value of the first part is stored locally; and the first part, the second part, and the third part of the tree index are encrypted according to the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the tree index ciphertext.

[0033] According to the first possible implementation of the third aspect, in the second possible implementation, the encryption module is further configured to extract features of each keyword for each record, wherein the features of each keyword include: character presence features, relative position retention features, and Bloom filter features; calculate a bitmap of size 26 for each record based on the character presence features of each record; calculate a bitmap of size 676 for each record based on the relative position retention features of each record; and calculate a bitmap of size 676 based on the Bloom filter features of each record. The Bloom filter for each record is described; the records in the plaintext dataset are classified based on the character existence feature to obtain multiple categories of records; a tree index is established based on the multiple categories of records and the bitmap of each record, wherein the third node of the third part of the tree index stores the Bloom filter and the bitmaps of 676 and 26 corresponding to the node, the second node of the second part of the tree index stores the union of the bitmaps of 676 of the leaf nodes of the second node, and the first node of the first part of the tree index stores the union of the bitmaps of 26 of the leaf nodes of the first node.

[0034] According to the second possible implementation of the third aspect, in the third possible implementation, the encryption module is further used for:

[0035] The first part of the tree index is encrypted according to the key set and the pseudo-random function set to obtain a character existence feature layer; the first node of the character existence feature layer stores the character existence features T1 and T2 contained in the first node, wherein, The first node of the last layer of the character existence feature layer The first node of the non-last layer of the character existence feature layer Among them, A 1 A 3 As the key, A 2 A 4 A 4 For the value, e A ||1、e A ||2、e A ||3,e A ||4 indicates that the character's existence characteristic is concatenated with different numbers, f A f is a pseudo-random function related to the character existence feature. p Let v be a pseudo-random function related to the tree nodes, where v represents the path of the first node;

[0036] The second part of the tree index is encrypted using the key set, the pseudo-random function set, and the secure permutation function to obtain a feature layer that preserves relative positions. The ciphertext data stored in the second node of the feature layer that preserves relative positions is (f p (v), p (v l ), f p (v r ), pe(B 676 ), where v l This represents the path of the left child node of the second node, v r B represents the path of the right child node of the second node. 676 This represents a bitmap with a second node of size 676, where pe represents the safe permutation function, and f... p (v) is the key, f p (v l ), f p (v r ), pe(B 676 ) is a value;

[0037] The third part of the tree index is encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the Bloom filter feature layer. The ciphertext data stored in the third node of the Bloom filter feature layer is (f p (v), f id (id rec ), c rec BF m1 BF m2 …,BF mn ), where c rec To encrypt the record rec obtained by using an encryption algorithm on the third node, BF mi A Bloom filter for recording the keyword mi in record rec, where 1 << i << n, n is the number of keywords in the record, and id rec =f rec (rec), where f rec f represents a pseudo-random function related to records. id This represents a pseudo-random function related to id.

[0038] In one possible implementation, the device further includes: encrypting the value of the first part to generate locally stored character existence feature layer ciphertext and sending it to the server. Since the server stores the locally stored character existence feature layer ciphertext, if the value of the first part is lost locally on the electronic device, the electronic device can download the locally stored character existence feature layer ciphertext from the server and decrypt it to obtain the value of the first part, without needing to rebuild the index of the first part, thus saving time.

[0039] In one possible implementation, the Bloom filter features include interval features, which are pairs of characters in the keywords that are separated by one character and maintain their relative positions. According to the search method of the above embodiments of this application, by extracting the interval features of keywords, the technical problem of inaccurate search results for single-character wildcards in related technologies can be solved.

[0040] The search apparatus according to the above embodiments of this application can also solve the technical problem of inaccurate character matching between the first and last multi-character wildcard characters in related technologies. The search apparatus according to the embodiments of this application, by extracting AB-type features, can determine the relative positional relationship of letters, thereby improving the accuracy of search results.

[0041] According to the first possible implementation of the third aspect, in the fourth possible implementation, the apparatus further includes: a first receiving module for receiving content to be queried; a determining module for determining a first starting point for querying based on the content to be queried and the value of the first part; a trapdoor generating module for obtaining a three-part trapdoor of the content to be queried based on the content to be queried, the first starting point, the key set, the pseudo-random function set, and the secure permutation function; and a second sending module for sending the three-part trapdoor to the server, so that the server searches the tree-indexed ciphertext based on the three-part trapdoor to obtain the search results for the content to be queried.

[0042] According to the third aspect or any of the first to fourth possible implementations of the third aspect, in the fifth possible implementation, the apparatus further includes: a second receiving module, configured to receive content to be updated; an update information generation module, configured to generate update information based on the content to be updated, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function, the update information including new locally stored character existence feature layer ciphertext and index information of the content to be updated; and a third sending module, configured to send the update information to the server, so that the server updates the locally stored character existence feature layer ciphertext and tree index ciphertext according to the update information. The search method of this application embodiment can update the indexed content according to user needs, supporting data updates without requiring users to regenerate the tree index ciphertext, thereby improving data processing efficiency.

[0043] Fourthly, embodiments of this application provide a search device applied to a server. The device includes: a third receiving module, configured to receive three trapdoors corresponding to content to be queried; wherein the content to be queried is a keyword corresponding to one field or a combination of keywords corresponding to multiple fields, and the three trapdoors include a character existence trapdoor, a trapdoor preserving relative positions, and a Bloom filter trapdoor, the three trapdoors being calculated based on the content to be queried; and a first search module, configured to locate the first starting point of the character existence feature layer of the tree-indexed ciphertext based on the character existence trapdoors, and search the character existence feature layer from the first starting point to obtain a second starting node; The tree-structured index ciphertext includes a character existence feature layer, a relative position retention feature layer, and a Bloom filter feature layer. The character existence feature layer stores ciphertext data of the recorded character existence features, the relative position retention feature layer stores ciphertext data of the recorded relative position retention features, and the Bloom filter feature layer stores ciphertext data of the recorded Bloom filter features. A second search module is used to search the relative position retention feature layer starting from the second starting node based on the relative position retention trapdoor to obtain a third starting point. A third search module is used to search the Bloom filter feature layer starting from the third starting point based on the Bloom filter trapdoor to obtain search results matching the content to be queried.

[0044] The search device according to the embodiments of this application can obtain search results more quickly, improving search efficiency. Related technologies mostly use forward and inverted indexes for their index structures. When performing wildcard searches, they can only traverse all Bloom filters for all keywords, resulting in low search efficiency. The search device of the embodiments of this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search, to gradually filter out a large number of Bloom filters that do not need to be compared, greatly reducing the number of Bloom filters that ultimately need to be compared, thus improving search efficiency.

[0045] According to the fourth aspect, in a first possible implementation, the apparatus further includes: a fourth receiving module, configured to receive update information, wherein the update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated; a replacement module, configured to replace the locally stored character existence feature layer ciphertext with the new locally stored character existence feature layer ciphertext; and an update module, configured to update the tree-type index ciphertext with the index information to obtain a new tree-type index ciphertext.

[0046] According to the first possible implementation of the fourth aspect, in the second possible implementation, the index information includes the identifier of the node to be deleted, and the update module is further configured to search the Bloom filter feature layer of the tree index ciphertext according to the identifier of the node to be deleted, and set the value of the node in the Bloom filter feature layer that is the same as the identifier of the node to be deleted to null.

[0047] According to the first or second possible implementation of the fourth aspect, in the third possible implementation, the index information includes content to be added, which includes the ciphertext of the record to be added, a Bloom filter, an encrypted record identifier, and a bitmap. The update module is further configured to select an update node from the feature layer that preserves the relative positions of the nodes in the feature layer of the tree index ciphertext based on the bitmap of the record to be added and the bitmap of the node in the feature layer that preserves the relative positions of the nodes; and to take the union of the bitmap of the update node and the bitmap of the record to be added as the new bitmap of the update node. A node is randomly selected in the Bloom filter feature layer of the tree index ciphertext to store the ciphertext of the record to be added, the Bloom filter, and the encrypted record identifier. The search method of this application embodiment can update the index content according to user needs, supporting data updates without regenerating the tree index ciphertext, thus improving data processing efficiency.

[0048] Fifthly, embodiments of this application provide an electronic device that can perform one or more of the search methods described in the first aspect or various possible implementations of the first aspect.

[0049] Sixthly, embodiments of this application provide a server that can execute one or more of the search methods described in the second aspect or various possible implementations of the second aspect.

[0050] In a seventh aspect, embodiments of this application provide a computer program product including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in an electronic device, a processor in the electronic device executes one or more of the search methods described in the first aspect or various possible implementations of the first aspect.

[0051] Eighthly, embodiments of this application provide a computer program product including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a server, a processor in the server executes one or more of the search methods described in the second aspect or various possible implementations of the second aspect.

[0052] These and other aspects of this application will become more apparent in the description of the following embodiments(s). Attached Figure Description

[0053] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this application together with the specification and serve to explain the principles of this application.

[0054] Figures 1a-1d The diagram illustrates an application scenario of the search method according to some embodiments of this application.

[0055] Figure 2 A flowchart illustrating a search method according to an embodiment of this application is shown.

[0056] Figure 3 A block diagram illustrating the data flow of a search method according to an embodiment of this application is shown.

[0057] Figure 4 A flowchart illustrating a specific process according to an embodiment of this application is shown.

[0058] Figure 5 This diagram illustrates the process of creating a tree index according to an embodiment of the present application.

[0059] Figure 6 A flowchart illustrating a method for generating a three-part trapdoor according to an embodiment of this application is shown.

[0060] Figure 7a and Figure 7b Schematic diagrams of layer A of a tree index according to an embodiment of this application are shown.

[0061] Figure 8 A comparison chart of search efficiency according to an embodiment of this application is shown.

[0062] Figure 9 A block diagram illustrating the data flow of an update process according to an embodiment of this application is shown.

[0063] Figure 10 A flowchart illustrating a search method according to an embodiment of this application is shown.

[0064] Figure 11 A flowchart illustrating a search method according to an embodiment of this application is shown.

[0065] Figure 12 A schematic diagram of a search method according to an embodiment of this application is shown. Detailed Implementation

[0066] Various exemplary embodiments, features, and aspects of this application will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.

[0067] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0068] Furthermore, to better illustrate this application, numerous specific details are provided in the following detailed embodiments. Those skilled in the art should understand that this application can be implemented without certain specific details. In some instances, methods, means, components, and circuits well-known to those skilled in the art have not been described in detail in order to highlight the main points of this application.

[0069] To address the aforementioned technical problems, this application provides a search method. Figures 1a-1d The diagram illustrates an application scenario of the search method according to some embodiments of this application. For example... Figure 1a As shown, users encrypt data using electronic devices to generate ciphertext, which is then uploaded to a server for storage.

[0070] The electronic device may include at least one of the following: mobile phone, foldable electronic device, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), augmented reality (AR) device, virtual reality (VR) device, artificial intelligence (AI) device, wearable device, in-vehicle device, smart home device, or smart city device. This application does not impose any specific limitation on the type of electronic device.

[0071] The server can be a dedicated server (i.e., a physical server), a virtual host, a Virtual Private Server (VPS), a cloud server, etc. This application does not impose any special restrictions on the specific type of server.

[0072] In the embodiments of this application, data ciphertext can refer to any form of data ciphertext, such as database ciphertext, file ciphertext, etc., and this application does not limit it. Figure 1aIn the example shown, users can perform wildcard searches on their uploaded encrypted data.

[0073] Figure 1b In the example shown, user A uploads the encrypted data to a server for storage via electronic device A. User A (electronic device A) is the data owner. User B can search the encrypted data via electronic device B, and user C can search the encrypted data via electronic device C. In other words, besides the data owner, one or more other users can also perform wildcard searches on the encrypted data.

[0074] Figure 1c In the example shown, user A uploads encrypted data to a server for storage via electronic device A, and user B uploads encrypted data to the server for storage via electronic device B. The two encrypted data uploads by users A and B can form a single encrypted data set, and both users A and B are owners of this single encrypted data set. Alternatively, users A and B can be the owners of their respective uploaded encrypted data sets; this application does not limit this. User C can perform a wildcard search on the encrypted data sets uploaded by users A and B via electronic device C. That is, multiple users can upload encrypted data sets, and the encrypted data sets uploaded by multiple users are jointly owned by multiple users; alternatively, multiple users can upload encrypted data sets that they each own. Users can perform wildcard searches on the encrypted data sets uploaded by multiple users via electronic devices.

[0075] Figure 1d In the example shown, and Figure 1c Similar to the example above, users A and B upload the encrypted data to the server for storage. Multiple other users can then perform wildcard searches on the encrypted data; for example, users C and D can both perform wildcard searches on the encrypted data uploaded by users A and B.

[0076] It should be noted that, Figures 1a-1d The scenarios shown are merely examples provided in this application, and this application is not limited thereto. For cases involving multiple users, this application does not limit the number of users.

[0077] Figure 2 A flowchart illustrating a search method according to an embodiment of this application is shown. Figure 3 A block diagram illustrating the data flow of a search method according to an embodiment of this application is shown. (In conjunction with...) Figure 2 and Figure 3 The search method of this application embodiment will be described.

[0078] like Figure 2 and Figure 3 As shown, the search method in this application embodiment includes the following steps:

[0079] Step S201: The electronic device is initialized by using the Setup algorithm to output the key set K, encryption algorithm, pseudo-random function set {f} and secure permutation function pe based on the input security parameters.

[0080] The `Setup` function generates parameters for processing the plaintext dataset. The security parameter, represented by λ, indicates higher security strength. Security parameters can specify requirements for encryption algorithms, data lengths within the encryption algorithm, and so on. For example, it specifies the length of the key data in the encryption algorithm. The `Setup` function generates a series of parameters for processing the plaintext dataset. For instance, based on the security parameters, the `Setup` function can generate the aforementioned key set and select encryption algorithms, pseudo-random function sets, and secure permutation functions that satisfy the security parameters.

[0081] The key set may include multiple keys, each used to encrypt different types of data. The keys in the key set mainly include: a key for encrypting plaintext, a key for mapping features in the Bloom filter (the number of keys needs to be determined based on the keyword length), a key for a pseudo-random function related to tree nodes, a key for a pseudo-random function related to the id (keyword identifier), a key for a secure permutation function, a key for a pseudo-random function related to Type A features, and a key for encrypting partial values ​​of the tree index, etc. The encryption algorithm can be a symmetric encryption algorithm (Enc) or an asymmetric encryption algorithm. In the embodiments of this application, a symmetric encryption algorithm is used as an example to encrypt the data.

[0082] In the embodiments of this application, the pseudo-random functions in the pseudo-random function set are used to randomize the input string and output a new string. The two strings have different lengths, and the input string can be a keyword or a feature extracted based on the keyword. In the embodiments of this application, the pseudo-random function set can include two types of pseudo-random functions: one is a pseudo-random function with a key, and the other is a pseudo-random function without a key. The pseudo-random functions without a key are H1 and H2, which are collision-resistant hash functions.

[0083] In the embodiments of this application, the input to the secure permutation function is a bitmap of keywords, which contains positional features of the keywords. The secure permutation function is used to perform pseudo-random processing on the input keyword bitmap to generate a new bitmap of keywords. The positional features of the keywords can be features extracted from the keywords to represent the positional relationships of characters within the keywords, and the bitmap is generated based on these positional features.

[0084] Step S202, the electronic device generates an index: such as Figure 3As shown, the electronic device generates a tree index TBI and a partial value Pa from the input plaintext dataset, and stores the tree index TBI and the partial value Pa locally. The electronic device encrypts the tree index using a key set, a symmetric encryption algorithm, a set of pseudo-random functions, and a secure permutation function to generate tree index ciphertext, and encrypts the partial value of the tree index to generate locally stored ciphertext. The electronic device can then send the generated tree index ciphertext and the locally stored ciphertext to a server, which stores both locally.

[0085] Step S203, the electronic device generates a trapdoor: such as Figure 3 As shown, the electronic device receives the user's input keywords to be queried (such as...). Figure 3 As shown in q), a three-part trapdoor is generated based on the query keyword, key set, and partial values ​​of the tree index, and the three-part trapdoor is sent to the server.

[0086] Step S204, the server performs a search: such as Figure 3 As shown, the server obtains the search results based on the three-part trapdoor query tree index ciphertext and returns the search results to the electronic device.

[0087] For step S202, Figure 4 A flowchart illustrating a specific process according to an embodiment of this application is provided. Figure 4 As shown, the process of generating an index for an electronic device may include the following steps:

[0088] Step S2021, Electronic device extracts keyword features: For keywords in plaintext dataset, electronic device can extract keyword character existence features (hereinafter referred to as "Type A features"), features that retain relative positions (hereinafter referred to as "Type AB features"), and Bloom filter features (hereinafter referred to as "Type BF features").

[0089] Character existence features are all the characters contained in a keyword; that is, each character that makes up a keyword is a feature. Features that preserve relative position refer to the relative positions between any two characters in a keyword.

[0090] The BF-type features can include complete keywords, ascending order features, descending order features, interval features, and N-gram features. Complete keywords refer to the keywords themselves. Ascending order features are each character of the keyword and their positions in the keyword in ascending order. Descending order features are each character of the keyword and their positions in the keyword in descending order. Interval features are pairs of characters in the keyword that are separated by one character and maintain their relative positions, denoted as AB||1, where A and B represent any characters in the keyword, || is the concatenation symbol indicating the relative positional relationship between characters A and B, and 1 indicates that characters A and B are separated by one character. N-gram features represent a segment of continuous characters of length N obtained by sliding a window of length N across the keyword. In the embodiments of this application, N can be 2. For example, for the word "book," the 2-gram features could be "bo," "oo," or "ok."

[0091] Table 1 shows the types of features extracted from the keywords and corresponding examples.

[0092]

[0093] Electronic devices extract the features of keywords to obtain the A-type feature set {e A}、AB type feature set {e AB} and BF type feature set {e BF}. As in the example above, the electronic device extracts the keyword "book" to obtain the A-type feature set {e A}={b,o,k}、AB type feature set {e AB}={bo,,oo,ok}、BF type feature set {e BF}={book, b||1, 0||2, o||3, k||4...ok||1}.

[0094] For any keyword m, the electronic device can also generate a keyword bitmap based on the keyword's AB-type feature set. Generate a keyword bitmap based on the A-type characteristics of the keywords. Since there are 26 letters in the English alphabet, there are a total of 26 × 26 = 676 possible combinations of AB-type features to store. Based on the features in the AB-type feature set... Simply set the value of the corresponding bit to 1.

[0095] In embodiments of this application, the electronic device can store a bitmap of keywords in the form of a matrix. A matrix can be represented as shown in Table 2. Similarly, electronic devices can store keyword bitmaps in the form of vectors. As shown in Table 2, the row represents the first letter and the column represents the second letter. If the feature exists, it is marked as 1; otherwise, it is marked as 0.

[0096] Table 2 Bitmap

[0097] a b c d … z a 0 0 1 0 … 0 b 0 0 0 0 … 0 c 0 0 0 1 … 0 d 0 1 0 0 … 0 e 0 0 0 0 … 0 … … … … … … 0 z 0 0 0 0 … 0

[0098] Electronic devices can calculate the identifier ID of keyword m m For any keyword, calculate the id. m =f m (m), where f m This represents a pseudo-random function related to the keywords.

[0099] Step S2022, the electronic device classifies keywords: In embodiments of this application, the electronic device can classify keywords based on the presence of characters. In one possible implementation, the electronic device can divide the keyword set into several categories according to the characters contained in the keywords. For example, the electronic device can group keywords with the same characters into one category.

[0100] In one possible implementation, a function MH can be defined. j MH function j The input is bitmap B, and the output is the positions of the j-th and (j+1)-th 0s in bitmap B, i.e.: MH j (B) = P j &P j+1 The bitmap here can be a 26-bit bitmap, meaning it contains all 26 English letters (characters). By setting a 26-bit bitmap, and generating the A-type feature for each keyword 'm', the following can be achieved. In Bitmap In the keyword MH, the position corresponding to a character that exists in the keyword m is 1, and the position corresponding to a character that does not exist is 0. k The output (which can be called the keyword classification parameters) is the position of the j-th and (j+1)-th zeros, which are the j-th and (j+1)-th characters that are not present in the keyword. In other words, the function MH... j The classification parameters of the output keywords can represent characters that are not included in the keywords.

[0101] In one possible implementation, the electronic device can generate a 26-bit bitmap of keywords from the plaintext dataset. Input function MH j The keyword classification is performed based on the output classification parameters, grouping keywords with the same classification parameters into one category. Electronic devices can set j to 1, and the function MH... jThe output classification parameter indicates the positions of the first two characters that are not present in the keyword. If two keywords have the same position for the first two characters that are not present, then the two keywords are classified into the same category.

[0102] In one possible implementation, after completing a classification, the electronic device can further determine whether the proportion of keywords in each category to the total number of keywords in the plaintext dataset meets a classification threshold. This classification threshold can be a proportion or percentage, representing the upper limit of the proportion of keywords in each keyword category to the total number of keywords in the plaintext dataset.

[0103] For classes that do not meet the classification threshold, the electronic device can continue to classify the keywords of that class. j can be set to 3. In this case, the function MH... j The output classification parameter indicates the position of the third and fourth characters that are not present in the keyword. If two keywords have the same position of the third and fourth characters that are not present, then the two keywords are classified into the same category.

[0104] Repeat the above process until the number of keywords in each category meets the classification threshold.

[0105] In step S2023, the electronic device builds a tree index TBI based on the classification results and generates partial values ​​Pa of the tree index.

[0106] In the embodiments of this application, the established tree index is a virtual tree-based tree index. A virtual tree-based tree index is a logically tree-like structure, but its actual storage is in the form of a table. Storage in the form of a table can refer to storage in the form of key-value pairs (key, value). The concepts of "leaf node," "parent / child node," and "level" involved in the virtual tree-based tree index in this application are the same as their corresponding concepts in a binary tree, and will not be elaborated further.

[0107] Each node of the tree index in this application embodiment stores a value, and the stored value has three types: "character existence feature" (or "A-type feature"), "feature that preserves relative position" (or "AB-type feature"), and "Bloom filter feature" (or "BF-type feature").

[0108] In embodiments of this application, the tree index can be divided into multiple levels, with each level storing different types of features. For example, the tree index in this application embodiment may include three levels, each storing values ​​of the three types mentioned above, namely "Level A", "Level AB", and "Level BF". Each level of the tree index may include multiple sub-levels. For instance, Level AB may include multiple sub-levels, and Level A may also include multiple sub-levels. The number of sub-levels included in Level A and Level AB may be the same or different. In one possible implementation, the number of sub-levels included in Level AB may be preset.

[0109] In one possible implementation, the values ​​of nodes in different levels of the tree index are stored in different formats: level A stores them as bitmaps, level AB stores them as bitmaps, and level BF stores them as Bloom filters.

[0110] In the embodiments of this application, the electronic device can construct the tree index from bottom to top, that is, first determine the value of the leaf node of the BF layer, and then determine the value of the parent node of the child node based on the value of the child node, until a complete tree is constructed. Specifically, the method for determining the value of the parent node of a child node based on the value of the child node is as follows: the value of the parent node inherits the values ​​of its child nodes. Within the same layer (here, "same layer" refers to "layer A", "layer AB", or "layer BF"), the value of the parent node is the union of the values ​​of its child nodes; in different layers, the value of the parent node is the value extracted from the values ​​of the leaf nodes of the parent node. For example, for a node in the last layer of layer A, the value of this node can be the union of the 26-bit graphs of the keywords contained in all the corresponding BF layer nodes.

[0111] Specifically, in the tree-structured index, the leaf nodes of keywords that are grouped into the same category are adjacent. Figure 5 This diagram illustrates the process of creating a tree index according to an embodiment of this application. Figure 5 As shown, the bottom layer is the BF layer, created based on the classification results in step S2022. In the BF layer, keywords of the same category are adjacent; this proximity facilitates faster search results. In this embodiment, the BF layer is a single node. In the tree index, the key-value pairs stored in the BF layer contain the keyword's ID as the key. m The value is a bitmap containing keywords. and the corresponding Among them, id m This is obtained by inputting keywords into a pseudo-random function.

[0112] After creating the BF layer, nodes for the AB layer can be built based on the BF layer. The values ​​of the bottom-level nodes in the AB layer are derived from the values ​​of the BF layer nodes, and the values ​​of the bottom-level nodes in the AB layer are bitmaps of the two leaf nodes of the BF layer. The value of a node in layer A is the union of the bitmaps of its two child nodes. As mentioned above, the number of sub-layers in layer A and B is preset. After calculating the values ​​of the nodes in layer A and B, the values ​​of the nodes at the bottom of layer A can be calculated based on the two adjacent nodes at the top of layer A and B. The values ​​of other nodes in layer A are the union of the bitmaps of the child nodes of those other nodes.

[0113] The specific process of calculating the value of the bottommost node in layer A based on the two adjacent nodes at the top of layer A and layer B can be implemented in different ways. In one possible implementation, the electronic device can use a 26-bit bitmap of all leaf nodes of the bottommost node in layer A. Find the union of the values ​​of the lowest-level nodes in layer A. Alternatively, in another possible implementation, the electronic device can also be determined based on a 676-bit bitmap of all the leaf nodes of the lowest-level node in layer A. Calculate the values ​​of the lowest-level nodes in layer A, specifically, as mentioned above, the keyword bitmap. This can be stored as a 26x26 matrix. Based on the values ​​in the matrix, the characters containing keywords can be extracted, thus obtaining the 26-bit bitmap of the lowest-level node in layer A. Taking the example shown in Table 2, assuming all unshown parts are 0, and based on the bitmap... We can obtain three AB-type features for the keywords: ac, cd, and db. Therefore, we can extract four A-type features for the keywords: a, c, b, and d. Based on the extracted A-type features, we can obtain the 26-bit bitmap of the lowest-level node in layer A. The specific extraction process can include: the electronic device checks if there is a letter 'a'. The first row and first column are related to 'a'. If any position has a '1', it indicates the presence of 'a'. Similarly, it checks if there is a letter 'b', and so on. Ultimately, we can determine that there are four A-type features: a, c, b, and d.

[0114] In a tree index, for nodes at levels AB and A, the stored key-value pairs contain a key representing the path v (not shown in the diagram), and a value representing the union of bitmaps determined by the bitmaps of the nodes corresponding to the path. The path includes all nodes along the path from the current node to a leaf node. In one possible implementation, an empty binary tree can be built, assuming left is 0 and right is 1. All leaf nodes are incremented from 0 to 1 from left to right, representing the path v in binary. For example... Figure 5 The path of the right-hand node in the second layer of layer A is 11.

[0115] After the tree index is created, level A of the tree index can be used as part of the tree index value Pa.

[0116] Step S2024: The electronic device encrypts the tree index to generate the tree index ciphertext c.TBI Encrypting a portion of the tree index value Pa yields the locally stored ciphertext c. Pa .

[0117] Electronic devices can encrypt each keyword m in a keyword set to generate keyword ciphertext c. m Specifically: c m =Enc(k enc ,m), where k enc k represents the key corresponding to the symmetric encryption algorithm. enc ∈K.

[0118] For each keyword, the electronic device can set a Bloom filter for that keyword, calculating the Bloom filter value based on the keyword's BF type characteristics. Let's assume the keyword's Bloom filter is BF. m Randomizing the keyword identifiers yields f. id (id m ), where f id This represents a pseudo-random function related to the ID. For any BF-type feature e of the keyword... BF The following procedure can be performed: e BF and key k i Substitute the pseudo-random function f BF , BF The pseudo-random function that maps the features in the Bloom filter is a keyed pseudo-random function, and the first random value is calculated. i =f BF (k i e BF ), where 1≤i≤l, and l represents f BF The number of keys, k i ∈K; then calculate the second random value J = f based on the first random value and the keyword identifier. BF (f id (id m ), x i Set the J-th bit of the Bloom filter to 1. After calculating all the BF-type features of the keyword, the Bloom filter value BF of the keyword can be obtained. m .

[0119] In the embodiments of this application, the number of bits in the Bloom filter corresponding to each keyword can be determined based on the number of characters contained in the keyword, the false positive rate, and the number of pseudo-random functions used. In the application scenario of this application, the false positive rate can represent the probability that a negative sample is expected to be found, that is, the probability that a keyword not in the plaintext dataset is found. A higher number of bits in the Bloom filter corresponds to a lower false positive rate.

[0120] In the embodiments of this application, the size s of the Bloom filter BF should satisfy the following condition, provided that the error rate of the Bloom filter BF does not exceed er. At this point, the optimal number of hash functions is: Where L = 4c - 2, c represents the character length of the keyword, and L represents the number of elements inserted into the BF layer (that is, the number of features in the BF layer).

[0121] For example, the total keyword length is c, the forward order is c, the reverse order is c, the 2-gram is c-1, the AB||1 is c-1, the false positive is set to 0.01, and the BF size is set to [value missing] to save storage. At this point, the optimal number of hash functions can be calculated to be approximately 5.

[0122] In embodiments of this application, the electronic device can store the tree-indexed ciphertext c in the form of key-value pairs. TBI You can initialize c first. TBI Each BF layer node stores ciphertext data of (f p (v), f id (id m ), c m BF m ), where f p The pseudo-random function is related to the tree nodes, and the key of the node in the BF layer is f. p (v), the value includes f id (id m ), c m BF m Each AB layer node stores ciphertext data of (f p (v), f p (v l ), f p (v r ), pe(B 676 ), where v l This represents the path of the left child node of the current node, v r B represents the path of the right child node of the current node. 676 This represents the bitmap of the current node. The bitmap of the current node is the union of the bitmaps of the current node's child nodes. The key for the node in the AB layer is f. p (v), the value includes f p (v l ), f p (v r ), pe(B 676 ).

[0123] When storing each A-level node, the key-value pairs (ciphertext data) obtained by encrypting the A-type features contained in each node can be stored separately. Specifically, for each A-type feature e in the node... A e can be calculated A The corresponding T1 and T2.

[0124] For the last node in layer A:

[0125] Where, key is A 1 The value is A 2 ; Where, key is A 3 The value is A 4 A 5 , 0.

[0126] Among them, e A ||1、e A ||2、e A ||3 indicates that the A-type features of the keyword are concatenated with different numbers. f represents the XOR operation. A is a pseudo-random function with type A feature correlation, and is a pseudo-random function with a key.

[0127] For nodes in layer A that are not in the last layer:

[0128] Where, key is A 1 The value is A 2 ;

[0129]

[0130] Where, key is A 3 The value is A 4 A 5 .

[0131] Similarly, e A ||1、e A ||2、e A ||3,e A ||4 indicates that the A-type features of the keyword are concatenated with different numbers. f represents the XOR operation. A is a pseudo-random function with type A feature correlation, and is a pseudo-random function with a key.

[0132] After calculating the ciphertext data for each node in the tree index, storing it as key-value pairs yields the ciphertext c of the tree index. TBI .

[0133] For a subset of values ​​Pa in a tree-structured index, symmetric encryption can be performed. For example, for each node (v, B) in layer A... 26 All nodes can be organized into a table, and after symmetric encryption, the ciphertext c can be obtained and stored locally. Pa .

[0134] Electronic devices generate tree-structured index ciphertext c TBI and locally stored encrypted c Pa After that, c can be TBI and c Pa Send it to the server, the server will send c TBI and c Pa Stored locally. When the server receives a search request from an electronic device, it can use the information related to the keywords to be searched carried in the search request to... TBI The system performs a search and returns the search results to the electronic device.

[0135] In the embodiments of this application, the electronic device can generate three trapdoors as information representing the characteristics of the query keyword. Specifically, in step S203, the electronic device receives the query keyword input by the user and generates three trapdoors based on the query keyword q, the key set K, the pseudo-random function set, the secure permutation function, and the partial value Pa of the tree index. The three trapdoors are the character existence trapdoor tr. A Preserving the relative position of the trapdoor (tr) AB Bloom filter trap BF The relationship between the three trapdoors is as follows: from tr A to tr AB Then to tr BF As the granularity decreases, the features corresponding to the trapdoors become increasingly specific in their description of keywords. This allows the server to first determine the keyword's meaning based on the context of the search. A Get the first round of search results, and then use tr in the first round of search results AB The second round of search results was obtained, and finally, tr was used. BF The final search results are filtered in the second round of search results. Because c TBI Compared to existing three-part trapdoor techniques, this method employs more feature-descriptive keywords, such as features that maintain relative character positions (AB-type features), resulting in more accurate search results. Furthermore, the layered search approach using the three-part trapdoor allows for progressively narrowing the query scope, leading to higher search efficiency.

[0136] Figure 6 A flowchart illustrating a method for generating a three-part trapdoor according to an embodiment of this application is provided. In embodiments of this application, the specific process of generating a three-part trapdoor may include the following steps:

[0137] Step S2031: The electronic device extracts the features of the keyword to be queried, and obtains the A-type feature set {qe} of the keyword to be queried. A}、AB type feature set {qe AB} and BF type feature set {qe BF Electronic devices use the AB-type feature set {qe} of the keywords to be queried. AB Generate bitmap

[0138] For example, if the keyword to be queried is a keyword with wildcards, q = bo_k, then the extracted features are shown in Table 3.

[0139] Table 3

[0140]

[0141] Step S2032: Based on the partial value Pa of the tree index stored locally by the electronic device and the A-type features of the keyword to be queried, determine the first starting point s of the search. The first starting point of the search is a node located in the A layer of the tree index. Therefore, the electronic device can determine the first starting point of the search in Pa. The first starting point of the search satisfies the following conditions: the first starting point is a node that contains all A-type features of the keyword to be queried, and satisfies that only one node in the sub-layer contains the node in the largest sub-layer that contains all A-type features of the keyword to be queried; or, the first starting point of the search is the root node that contains all A-type features of the keyword to be queried.

[0142] In other words, the conditions that the first starting point must meet are: (1) the first starting point contains nodes that have all A-type features of the keyword to be queried; (2) there is only one node in the sub-layer where the first starting point is located that contains all A-type features of the keyword to be queried; (3) the number of sub-layers where the first starting point is located is the largest if the above two conditions are met; or it is the root node that meets the above two conditions.

[0143] Figure 7a and Figure 7b Schematic diagrams of Pa according to an embodiment of this application are shown respectively. Figure 7a and Figure 7b For ease of understanding, each node is represented by its Type A features. Let's assume the Type A features of the query keyword are b and c, such as... Figure 7a As shown, the node that satisfies the above conditions is node 5; that is, the first starting point is node 5. Figure 7b As shown, the node that meets the above conditions is node 2, that is, the first starting point is node 2.

[0144] Step S2033: Calculate the three-part trapdoor based on the determined first starting point and the features of the extracted keywords to be queried.

[0145] Specifically, for the BF-type feature set {qe} of the keyword to be queried BF For each BF-type feature in}, the electronic device can calculate a third random value qx. i =f BF (k i , qe BF ), where 1≤i≤l, and l represents f BF The number of keys, k i For each BF-type feature in K, multiple third random values ​​can be calculated. After calculating the third random values ​​of all BF-type features of the query keyword, tr can be obtained. BF tr BF qx is the sum of all BF-type features of the keyword to be queried i Composed of.

[0146] For the AB-type feature set {qe} of the keyword to be queried AB Electronic devices can calculate Get tr AB .

[0147] Electronic devices can calculate the trunk values ​​(tr) of all A-type features of the keyword to be queried based on the first starting point. A The method is as follows:

[0148] Reorder all Type A features and assign them different labels: e A =(e1,e2,…,e P ), where P represents the number of type A features of the keyword to be queried.

[0149] First, for the type A feature e1 labeled 1, calculate... Let i range from 1 to P-1, and calculate sequentially. And these P-1 features are grouped into a set, denoted as Finally, for the Pth feature, calculate... and Record Final Note Among them, v s This represents the path from the first starting point.

[0150] For example, assuming the query keyword is "b?ok", we can extract type A features as b, o, and k, and calculate...

[0151] The electronic device calculates tr A tr AB and tr BF You can use tr A trAB and tr BF It is sent to the server, which then performs the search.

[0152] In step S204, the server queries the tree index ciphertext c based on the three parts of the trapdoor query. TBI The system obtains search results and returns them to the electronic device.

[0153] The specific search process may include the server using a character existence trapdoor (tr) as a search criterion. A Search the tree-indexed ciphertext at the first starting point to determine the set of search starting points (second starting points) for the tree-indexed ciphertext at levels A and B.

[0154] For example, suppose node v s There are three features: b, o, and k. If node v s When it is not the last layer of layer A, the A-type features b, o, and k all have corresponding T1 and T2, that is:

[0155] The T1 and T2 of type A characteristic b are respectively:

[0156] The T1 and T2 of the type A characteristic o are respectively:

[0157] The T1 and T2 of type A feature k are respectively:

[0158] As mentioned above, for query keywords that possess type A features b, o, and k... Searching layer A of a tree-indexed ciphertext using character existence trapdoors can include the following process:

[0159] First, the server according to To perform positioning, i.e., to calculate

[0160] In this way, Using it as the key for searching, we can locate b (the first starting point).

[0161]

[0162] Thus, the value of T1 is obtained:

[0163] Then according to And the value of T1: Check if o and k exist in sequence:

[0164] Determine o: The T1 value of feature b of type A: and of Perform the XOR operation, i.e., calculate

[0165] Then according to calculate

[0166] Will Using it as the key, we can find 'o'.

[0167]

[0168] Obtain the T1 value of type A feature o:

[0169] The value of T1 for type A feature o: and of Perform the XOR operation, i.e., calculate

[0170]

[0171] Then according to calculate

[0172] Will Use it as the key to look up and get k.

[0173]

[0174] Obtain the value of T1 for type A feature k:

[0175] Then, using The T1 value of type A feature k: To determine the next node to be evaluated, the specific steps are as follows:

[0176] calculate

[0177] according to calculate Get k

[0178]

[0179] Then according to In

[0180] calculate

[0181]

[0182]

[0183] Get node v s Two child nodes v sl of and v sr of and This can be applied universally, and then the search of layer A can be completed until the set of child nodes of the last node in layer A is found as the starting point (second starting point) for the search of layer AB.

[0184] When node v s When it is the last node of layer A, k

[0185]

[0186] We can directly obtain the two child nodes f of the last level node. p (v sl ) and f p (v sr This refers to the set of two nodes from the first layer of the AB layer that serve as the starting point (second starting point) for the search of the AB layer.

[0187] After determining the set of second starting points, the server can use the trapdoor tr that preserves the relative positions. AB And the set of second starting points, determining the set of search starting points (third starting points) for the BF layer of the tree-indexed ciphertext. Starting from the second starting node, compare the pe(B) of the second starting node. 676 ) and tr AB In If the second starting node's pe(B) 676 The position 1 in ) contains tr AB of All positions in the array that are 1 are then used to determine the ciphertext (f) stored in the AB layer nodes. p (v), f p (v l ), f p (v r ), pe(B 676 This allows us to obtain the two child nodes f of the second starting node. p (v l ), f p (v r Continue comparing the child nodes of this node with their corresponding pe(B) values. 676 ) and tr AB In The search continues until the two leaf nodes of the last node in layer AB are determined and added to the set of search starting points (third starting points) of layer BF in the tree index ciphertext; otherwise (if the pe(B) of the node in layer AB is...). 676 ) and tr AB of If there is no match, stop the search for the current path.

[0188] After determining the set of third starting points, the server can retrieve f stored at the third starting points. id (id m ), and according to tr BF qx i The calculation yields qJ = f BF (f id (id m ), qx i For all qx i ∈tr BF According to qx i The calculated qJ, if the BF stored at the third starting point... m If all bits qJ are 1, then the ciphertext c stored at the third starting point can be... m Add to search results.

[0189] The search method according to the embodiments of this application can obtain search results more quickly, improving search efficiency. Related technologies mostly use forward and inverted indexes for their index structures. When performing wildcard searches, they can only traverse all Bloom filters for all keywords, resulting in low search efficiency. The search method of this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search method, to gradually filter out a large number of unnecessary Bloom filters, greatly reducing the number of Bloom filters that need to be compared and improving search efficiency. Furthermore, in related technologies, the more features of the keywords provided during the search, the more Bloom filters or files need to be compared, thus slowing down the search speed. However, in the search method of this application, the more features of the keywords provided during the search, the more Bloom filters can be filtered out based on more detailed trapdoor information using the tree-based index and the three-trapdoor search method, resulting in a faster search speed.

[0190] Figure 8 A comparison chart of search efficiency according to an embodiment of this application is shown. Figure 8 As shown, four search modes were selected for the experiment, with 10 instances of each type. The average search time was taken. Using the controlled variable method, only the search method was changed to obtain a comparison of the search time results. Figure 8As shown, Hu represents the result of the search method in the related art, TBI represents the result of the search method provided in the embodiments of this application, and Z-IDX represents the result of traversing and searching the BF layer nodes in the search method provided in the embodiments of this application. From the comparison chart of search times between the TBIS scheme, the Z-IDX scheme, and the Hu scheme, it can be seen that the TBIS scheme is much faster than both the Z-IDX scheme and the Hu scheme.

[0191] Hu's proposal is described as follows:

[0192] KeyGen (Initialization): Outputs a private key set K = {k1, k2, ..., k} based on the input security parameters. l The private key set contains l keys;

[0193] BuildIndex: Creates an index based on the private key set K and the file set. The specific method is as follows:

[0194] 1. After extracting the keyword set from the file set, build an inverted index based on the keywords, in the form of (keyword, file 1, file 2, ...);

[0195] 2. Extract four types of features from keywords: ascending order, descending order, existence, and complete keywords. Taking "cloud" as an example, the extracted features are shown in the table below:

[0196] Table 4

[0197] Feature type Features extracted using cloud as an example Ascending order c||1,l||2,o||3,u||4,d||5 Reverse order c||-5,l||-4,o||-3,u||-2,d||-1 Existence c||0,l||0,o||0,u||0,d||0 Complete keywords cloud

[0198] 3. After creating the index, setting the size of the Bloom filter, and determining the pseudo-random function f, initialize an empty Bloom filter for each keyword, and calculate p for each feature e of that keyword. i =f(k) i ,e), where 1≤i≤l, and set the value at the corresponding position in the Bloom filter to 1.

[0199] Trapdoor (Generate Trapdoors): Generates a set of trapdoors based on the search keywords (including wildcards). For example, if the search keyword is c*o*d, the corresponding feature set is {c||1,d||-1,c||0,o||0,d||0}. For each feature e, p is calculated... i =f(k) i ,e), where 1≤i≤l, output trapdoor set {p i}

[0200] SearchIndex: Based on the trapdoor set {p iThe system searches using the index to obtain search results. The cloud server checks the position in the trapdoor set of each keyword in the Bloom filter to see if it is 1. If all positions are 1, they are marked as search results, and finally, all search results are returned. Because Hu's scheme does not support single-character wildcards without specific position information, SQ-3 has no data.

[0201] The search method in this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search method, to gradually filter out a large number of Bloom filters that do not need to be compared. Compared with the search methods in related technologies, this greatly reduces the number of Bloom filters that need to be compared in the end, and improves search efficiency.

[0202] According to the search method of the above embodiments of this application, by extracting the interval features of keywords, the technical problem of inaccurate single-character wildcard search results in related technologies can be solved. Related technologies extract few feature types for keywords, thus failing to accurately characterize the queried keywords. This application, by introducing multiple types of features, such as AB-type features and AB||1-type features, can more comprehensively and accurately describe keywords, improving the problem of inaccurate wildcard search results in related technologies. For example, *a_b*, since * can represent any string of zero or more characters, it is impossible to know which character 'a' or 'b' specifically represents. Therefore, the search can only be performed based on the existence of 'a' and 'b', leading to inaccurate search results. Related technologies might yield results like *ab*, *ba*, *b_a*, *a*b*, *b*a*. However, the search method of this application, by extracting the BF-type feature ab||1, can combine existence and interval features for searching, making the search results more accurate.

[0203] The search method according to the above embodiments of this application can also solve the technical problem of inaccurate character matching between the first and last multi-character wildcard characters in related technologies. For example, if the input query term is a*d*a*b*c*, since the search can only be performed based on the existence of a, b, c, and d, it is possible to find a*d*a*b*c*, a*d*a*c*b*, a*d*b*a*c*a*, a*a*b*c*d*, a*a*b*d*c*, a*a*c*b*d*, etc. However, according to the search method of the embodiments of this application, since the AB type features are extracted, the relative positional relationship of the letters can be determined, so only results matching a*d*a*b*c* will be found.

[0204] In addition, such as Figure 8 As shown, according to the search method provided in the embodiments of this application, the more information the user provides, the faster the search, such as... Figure 8As shown in the TBI curve, SQ-1 represents a complete keyword. The progression from SQ-4 to SQ-1 indicates that users are providing more and more information, spending less and less time searching, and searching faster and faster.

[0205] The search method provided in this application embodiment allows for flexible adjustment of storage space. As shown in Table 5 below, the TBIS column represents the storage space occupied by the tree-structured index ciphertext in this application embodiment, and the Z-IDX column represents the storage space occupied by the BF layer ciphertext data of the tree-structured index ciphertext in this application embodiment. When each leaf node of the BF layer stores only one record, TBIS(10)-10W requires 32.8058MB; when each leaf node of the BF layer stores two records, the storage space required to store 10W keywords is approximately 16.4039-6.10352+12.207=22.50738MB; when each leaf node of the BF layer stores five records, the storage space required to store 10W keywords is approximately 6.56262-2.44141+12.207=16.32821MB; when each leaf node of the BF layer stores ten records, the storage space required to store 10W keywords is approximately 3.28236-1.2207+12.207=14.26866MB. In other words, for the same number of keywords, the storage space required can be flexibly adjusted by changing the number of keywords stored in the leaf nodes.

[0206] Table 5

[0207] Number of keywords TBIS(10) Z-IDX(10) 1W 3.28236 1.2207 2W 6.56262 2.44141 3W 9.84288 3.66211 4W 13.1233 4.88281 5W 16.4093 6.10352 6W 19.684 7.32422 7W 22.9648 8.54592 8W 26.2448 9.76562 9W 29.525 10.9863 10W 32.8058 12.207

[0208] In one possible implementation, the search method provided in this application embodiment can also update partial values ​​Pa and encrypted text c of the tree index based on the user-input keywords to be updated. TBI and locally stored encrypted c Pa The update process is as follows: Specifically, the electronic device can generate update information U based on the user-input keywords to be updated, and send the update information U to the server. The server can then update the tree index ciphertext c based on the update information U. TBI and locally stored encrypted c Pa .

[0209] Figure 9 A block diagram illustrating the data flow of an update process according to an embodiment of this application is shown.

[0210] In embodiments of this application, the keywords to be updated input by the user may include keywords to be deleted. d and the keyword to be added m ad ,like Figure 9As shown, the electronic device can generate update information U based on the keyword to be updated, the key set K, the encryption algorithm, the pseudo-random function set {f}, and the secure permutation function pe. The update information U may include new locally stored ciphertext nc. Pa And UI, where UI is the index information of the keywords to be updated.

[0211] Specifically, electronic devices can initialize the UI for index information that needs to be submitted to the cloud server, which is divided into deletion and addition sections.

[0212] For each keyword to be deleted in the keywords to be updated, m d Electronic devices can calculate f id (id md ), f id (id md Add to the deletion section of the UI.

[0213] For each keyword m to be added in the keywords to be updated ad Electronic devices can calculate the corresponding UI additions using the following steps:

[0214] Step S900: The electronic device extracts the features of the keywords to be added, obtaining the A-type feature set {ade}. A}, AB type feature set {ade AB} and BF type feature set {ade BF}. And generate a bitmap based on the AB type feature set.

[0215] Step S901: The electronic device determines the update path of the keyword to be added in layer A based on the partial value Pa of the locally stored tree index and the characteristics of the keyword to be added. Starting from the root node, an update node is selected in the update path, which must satisfy the following conditions: the intersection of the features of the update node and the features of the keyword to be added is the largest, or the intersection of the features of a child node of the update node and the features of the keyword to be added is the largest compared with the features of its sibling nodes. After determining the update node, the features of the keyword to be added are encrypted. Specifically, the electronic device can calculate the T corresponding to the A-type features of the keyword to be added based on the features of the keyword to be added. ad1 T ad2 Where the updating node is a non-last layer node in layer A, T ad2 The calculation methods differ; please refer to the above for details. T ad1 and T ad2 Added to the "Add" section of the UI.

[0216] In the embodiments of this application, the child nodes of an update node include child nodes or several generations of child nodes of a child node. The path formed by all update nodes is the update path.

[0217] For example, if the keyword to be added contains three type A features: b, c, and d, and the root node contains all three letters, and the two child nodes of the root node are a, b, c and c, d, e, then both child nodes have two identical letters, making it impossible to determine which one to choose. We continue to compare the two child nodes of a, b, c with the two child nodes of c, d, e, and select the path containing the child node with the larger intersection. The node on this path becomes the update node.

[0218] In step S902, the electronic device determines the update path in the local stored tree index, specifically the last node in level A and its two child nodes f in levels AB. p (v l ) and f p (v r Electronic devices can (f) p (v l ), f p (v r ), f id (id m ), c mad BF mad , Add it to the added section of the UI.

[0219] Step S903, based on the obtained UI (the T corresponding to the A-type feature of the keyword to be added) ad1 T ad2 Update Pa and encrypt to obtain nc Pa .

[0220] In embodiments of this application, the electronic device obtains nc Pa After UI, nc can be used Pa The UI is sent to the server.

[0221] The server receives the nc sent by the electronic device. Pa With the UI, you can complete the update process by following these steps:

[0222] 1. The server can store nc files. Pa Delete the original c Pa .

[0223] 2. The server can use the f in the UI. id (id md Find the tree-indexed ciphertext c TBl Set the value of the corresponding leaf node to null.

[0224] 3. The server can determine the appropriate parameters based on the UI (f) p (v l ), f p (v r ), f id (id m ), c mad BF mad , Select tree-indexed ciphertext c TBI In the AB layer and The node with the smaller Hamming distance is selected as the update node, and the update node is then updated. The value of the key-value pair pe(B) stored in the nodes of layer AB. 676 The result of the union operation is used as the new value (bitmap). That is, the server can use the two child nodes f from the AB layer determined in step S902. p (v l ) and f p (v r Begin by comparing the bitmap of the keyword to be added with the two child nodes f. p (v l ) and f p (v r The Hamming distance of the node is compared with that of its child nodes, and the node with the smallest Hamming distance in layer AB is selected as the update node. If the Hamming distances are the same, the node can be updated by further comparing the Hamming distances of its child nodes.

[0225] The Hamming distance is calculated by performing an XOR operation on the two bitmaps and counting the number of 1s in the result. The fewer 1s in the result, the smaller the Hamming distance.

[0226] It should be noted that, in one possible implementation, the server can select the update node from the feature layer that preserves the relative positions of nodes based on the bitmap of the keyword to be added in the UI and the bitmap of the node in the feature layer that preserves the relative positions of the tree-indexed ciphertext. The method of selecting the update node based on Hamming distance in step 3 above is merely an example of this application. This application can also select the update node in other ways. For example, the node with the largest intersection between the bitmap of the node in layer AB and the bitmap of the keyword to be added can be selected as the update node. If they are the same, the child nodes of that node can be further determined. That is, the server can select the two child nodes f in layer AB determined in step S902. p (v l ) and f p (v r Begin by comparing the bitmap of the keyword to be added with the two child nodes f.p (v l ) and f p (v r The size of the intersection of the nodes is determined, and the updated node is selected based on the comparison result.

[0227] 4. The server can randomly select an update path in the tree-indexed encrypted file c. TBI The leaf node of the BF layer stores f. id (id m ), c mad and BF mad That is, randomly select the node in the BF layer of the update path, and then... id (id m ), c mad and BF mad The values ​​of the key-value pairs stored in the node.

[0228] The search method in this application embodiment can update the index content according to the user's needs, and supports the user to update data without regenerating the tree index ciphertext, which can improve the efficiency of data processing.

[0229] The table below shows the number of updated keywords and the time required for electronic devices to calculate and update information U, as well as the server's update of text c based on U. TBI The table shows the relationship between the time required and the total time required. It records the time taken to update 1000, 2000, ..., 10000 keywords. The total time taken to update 1000 keywords is about 2 seconds, which is more efficient than regenerating the tree index ciphertext.

[0230] Table 6

[0231] Updated number of keywords Electronic devices(s) Server(s) Total (s) 1000 2.17848 0.0739393 2.252419 2000 4.47482 0.147802 4.622622 3000 6.80647 0.214502 7.020972 4000 9.70403 0.28632 9.99035 5000 11.2638 0.355156 11.61896 6000 13.6935 0.424715 14.11822 7000 15.9736 0.509084 16.48268 8000 18.2712 0.579845 18.85105 9000 20.7509 0.639495 21.3904 10000 23.5221 0.70534 24.22744

[0232] The search method provided in the embodiments of this application can also be applied to multi-field searches, where each field can have a different set of plaintext keywords. The process of the search method for multi-field searches is described below. The search method for multi-field searches may include the following steps:

[0233] In step S101, the electronic device is initialized by using the Setup algorithm to output the key set K, encryption algorithm, pseudo-random function set {f}, and secure permutation function pe based on the input security parameters. This process is the same as step S201 and will not be described again.

[0234] Step S102: The electronic device generates an index: Based on the input record set (each record is denoted as rec), the electronic device generates a tree index and partial values ​​of the tree index. The electronic device encrypts the tree index using a key set, a symmetric encryption algorithm, a set of pseudo-random functions, and a secure permutation function to generate tree index ciphertext, and encrypts partial values ​​of the tree index to generate locally stored ciphertext. The electronic device can send the generated tree index ciphertext and locally stored ciphertext to the server, which then stores them locally.

[0235] Step S103, Electronic device generates trapdoor: Electronic device generates a three-part trapdoor based on the user-input record to be queried, key set and partial value of tree index, and sends the three-part trapdoor to the server.

[0236] Step S104: The server performs a search: The server obtains the search results based on the three-part trapdoor query tree index ciphertext and returns the search results to the electronic device.

[0237] Specifically, for step S102, the record set may include multiple records, and each record may include two or more fields, which can be denoted as rec = (m1, m2, m3), where m1, m2, and m3 represent different fields. Each field can be a string, which consists of characters, a string of numbers, or a combination of characters and numbers. This application does not limit the specific form of each field.

[0238] Electronic devices can calculate the identifier ID of the record rec. rec For any record, calculate the id. rec =f rec (rec), where f rec This represents a pseudo-random function related to the record.

[0239] For records consisting of characters, the method for extracting the record features is the same as in step S2021, and will not be repeated here.

[0240] For records consisting of numbers, taking a mobile phone number as an example, the extracted features can include 3-gram features, the first three digits, and the complete string. Specifically, taking the mobile phone number "12345678927" as an example, the extracted features are shown in the table below, and this feature set is denoted as {e}. num}

[0241] Table 7

[0242] Feature type Taking "12345678927" as an example, the extracted features 3-gram 123,234,345,456,567,678,789,892,927 First and last three digits 123||1,927||-1 Complete mobile phone number 12345678927

[0243] For strings containing a mixture of characters and numbers, features can be extracted based on the user's search needs or specific application scenarios. For example, n-gram features can be extracted, but this application does not limit this.

[0244] Electronic devices can classify records by their primary key. The primary key can be a string of letters, with a maximum of 50 letters. The specific classification method is the same as step S2022 and will not be repeated here.

[0245] The electronic device can build a tree index TBI based on the classification results and generate partial values ​​Pa of the tree index. The specific process is the same as step S2023, and will not be repeated here.

[0246] Electronic devices can encrypt tree indexes to generate tree index ciphertext c TBI Encrypting a portion of the tree index value Pa yields the locally stored ciphertext c. Pa The specific process can be found in step S2024. In this embodiment, the differences from step S2024 include:

[0247] Electronic devices can encrypt each record rec in a record set to generate the ciphertext c of the record. rec Specifically: c rec =Enc(k enc ,rec), where k enc k represents the key corresponding to the symmetric encryption algorithm. enc ∈K.

[0248] In this embodiment, a corresponding Bloom filter can be set for each field in the record, and the value of the Bloom filter is calculated based on the feature set corresponding to each field. For fields composed of characters, refer to step S2024. For fields composed of numbers, taking the mobile phone number mentioned above as an example, assume the Bloom filter for the (numeric) field is BF. num The identifier of the record is randomized to obtain f. id (id m ), where f id This represents a pseudo-random function related to the id. For any feature e of a (numeric) field... num The following procedure can be performed: e num and key k i Substitute the pseudo-random function f BF f BF The pseudo-random function that maps features in the Bloom filter is a keyed pseudo-random function, which calculates the random value x. i =f BF (k i e num), where 1≤i≤l, and l represents f BF The number of keys, k i ∈K; then based on the random value x i Calculate the random value J = f based on the record's identifier. BF (f id (id m ), x i Set the J-th bit of the Bloom filter to 1. After calculating all the features of the field, the Bloom filter value BF of the field can be obtained. num .

[0249] Each BF layer node stores (f) p (v), f id (id m ), c m BF m1 BF m2 ...), that is, the value stored in each BF layer node includes multiple fields corresponding to Bloom filters.

[0250] Electronic devices generate tree-structured index ciphertext c TBI and locally stored encrypted c Pa After that, c can be TBI and c Pa Send it to the server, the server will send c TBI and c Pa Stored locally. When the server receives a search request from an electronic device, it can use the information related to the keywords to be searched carried in the search request to... TBI The system performs a search and returns the search results to the electronic device.

[0251] For step S103, the specific process can be found in the description of step S203. In this embodiment, the difference from step S203 is that:

[0252] Similar to the feature extraction method in step S102 above, each field needs to have its corresponding features extracted to obtain a feature set.

[0253] tr BF The qx is the characteristic of all fields of the record to be queried. i It is composed of [various elements]. For example, if the record to be queried is qrec = (m1, m2), assuming field m1 represents the name and field m2 represents the phone number, the calculation process for the third random value corresponding to field m1 can be found in step S2033 above, and the third random value corresponding to field m2 is qx. i =f BF (k i , qe num ). tr Atr AB The calculation process is the same as above.

[0254] For step S104, the specific process can be found in step S204, the difference being that for each field, the calculated qx... i The calculation yields qJ = f BF (f id (id m ), qx i The algorithm compares qJ with the Bloom filter corresponding to that field to determine if the value at position qJ of the Bloom filter for that field is 1. If the corresponding position of the Bloom filter is 1 for all fields, the ciphertext stored in that node can be used as the search result. For example, if the record to be queried is qrec = (m1, m2), for the tree index ciphertext c TBI The third starting point in the data, the Bloom filter corresponding to field m1 in the value stored at the third starting point is BF. m1 The Bloom filter corresponding to field m2 is BF. m2 The tr calculated based on m1 BF Each qx in i According to qx corresponding to m1 i and the third starting node f id (id m ) Calculation yields qJ m1 BF m1 The qJ m1 All bits are 1, and tr is calculated based on m2. BF Each qx in i According to qx corresponding to m2 i and the third starting node f id (id m ) Calculation yields qJ m2 BF m2 The qJ m2 If all bits are 1, then the ciphertext in the third starting node can be added to the search results.

[0255] In this embodiment, if the tree index ciphertext c is to be updated based on the record to be updated input by the user, TBI and locally stored encrypted c Pa For details on how to update, please refer to the text above. Figure 9 Part. With Figure 9 The differences in some embodiments are as follows:

[0256] In this embodiment, the records to be updated include records to be added and records to be deleted.

[0257] In step S902, the electronic device can (f p (v l ), f p (v r ), f id (id m ), c mad BF mad1 BF mad2 , ..., ) is added to the added section of the UI. The server can then use (f) in the UI as a reference. p (v l ), f p (v r ), f id (id m ), c mad BF mad1 BF mad2 , ..., Select tree-indexed ciphertext c TBI In the AB layer and The node with the smaller Hamming distance is selected as the update node, and the update node is updated accordingly.

[0258] The server can index the encrypted data in a tree structure. TBI The BF layer randomly selects a node to store f. id (id m ), c mad and BF mad1 BF mad2 , ...

[0259] The search method provided in the above embodiments of this application can be applied to multi-field searches, supporting users to perform wildcard searches on multiple fields simultaneously.

[0260] Based on the above embodiments of this application, this application provides a search method. Figure 10 A flowchart illustrating a search method according to an embodiment of this application is shown, such as... Figure 10 As shown, the search method provided in this application embodiment includes the following steps:

[0261] Step S110: Generate a key set, encryption algorithm, pseudo-random function set, and secure permutation function based on security parameters;

[0262] Step S111: Generate a tree-indexed ciphertext based on each record in the plaintext dataset, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function; wherein each record includes a keyword corresponding to one field or a combination of keywords from two or more fields, and the tree-indexed ciphertext includes a character existence feature layer, a feature layer that preserves relative positions, and a Bloom filter feature layer; the character existence feature layer stores the ciphertext data of the record's character existence features, the feature layer that preserves relative positions stores the ciphertext data of the record's features that preserve relative positions, and the Bloom filter feature layer stores the ciphertext data of the record's Bloom filter features.

[0263] Step S112: Send the tree index ciphertext to the server. The tree index ciphertext is used by the server to search layer by layer in the order of the character existence feature layer, the feature layer that preserves relative position, and the Bloom filter feature layer to see if there is a search result that matches the content to be queried.

[0264] In the embodiments of this application, for steps S111 and S112, an example of a record including a keyword corresponding to a field can be found above. Figure 2 and Figure 3 As mentioned in the previous section, examples of a record containing keywords corresponding to two or more fields can be found in the introduction of steps S101-S104 combined with S201-S204 above, and will not be repeated here.

[0265] The search method according to the embodiments of this application can obtain search results more quickly, improving search efficiency. Related technologies mostly use forward and inverted indexes for their index structures. When performing wildcard searches, they can only traverse all Bloom filters for all keywords, resulting in low search efficiency. The search method of the embodiments of this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search method, to gradually filter out a large number of Bloom filters that do not need to be compared, greatly reducing the number of Bloom filters that need to be compared in the end, thus improving search efficiency.

[0266] In one possible implementation, step S111, generating tree-indexed ciphertext based on each record in the plaintext dataset, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function, includes:

[0267] A tree index is built for each record in the plaintext dataset, wherein the tree index includes a first part storing the character existence features of the record, a second part storing the features that preserve relative positions, and a third part storing the features of the Bloom filter.

[0268] Save the value of the first part locally;

[0269] The first part, the second part, and the third part of the tree index are encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the ciphertext of the tree index.

[0270] In one possible implementation, a tree index is built based on each record in the plaintext dataset, including:

[0271] For each record, features of each keyword in each record are extracted. The features of each keyword include: character existence features, features that preserve relative position, and Bloom filter features.

[0272] Calculate a bitmap of size 26 for each record based on the character existence characteristics of each record;

[0273] Calculate a bitmap of size 676 for each record based on the feature of the reserved relative position of each record;

[0274] Calculate the Bloom filter for each record based on the Bloom filter characteristics of each record;

[0275] Based on the character existence characteristics, the records in the plaintext dataset are classified to obtain multiple categories of records;

[0276] Based on the multiple types of records and the bitmap of each record, a tree index is established. The third node of the third part of the tree index stores the Bloom filter corresponding to the node and the bitmaps of 676 and 26. The second node of the second part of the tree index stores the union of the bitmaps of 676 of the leaf nodes of the second node. The first node of the first part of the tree index stores the union of the bitmaps of 26 of the leaf nodes of the first node.

[0277] In one possible implementation, the first, second, and third parts of the tree index are encrypted according to the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the tree index ciphertext, including:

[0278] The first part of the tree index is encrypted according to the key set and the pseudo-random function set to obtain a character existence feature layer; the first node of the character existence feature layer stores the character existence features T1 and T2 contained in the first node, wherein, The first node of the last layer of the character existence feature layer The first node of the non-last layer of the character existence feature layer Among them, A 1 A 3 As the key, A 2 A 4 A 5 For the value, e A ||1、e A ||2、e A ||3,e A ||4 indicates that the character's existence characteristic is concatenated with different numbers, f A f is a pseudo-random function related to the character existence feature. p Let v be a pseudo-random function related to the tree nodes, where v represents the path of the first node;

[0279] The second part of the tree index is encrypted using the key set, the pseudo-random function set, and the secure permutation function to obtain a feature layer that preserves relative positions. The ciphertext data stored in the second node of the feature layer that preserves relative positions is (f p (v), f p (v l ), f p (v r ), pe(B 676 ), where v l This represents the path of the left child node of the second node, v r B represents the path of the right child node of the second node. 676 This represents a bitmap with a second node of size 676, where pe represents the safe permutation function, and f... p (v) is the key, f p (v l ), f p (v r ), pe(B 676 ) is a value;

[0280] The third part of the tree index is encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the Bloom filter feature layer. The ciphertext data stored in the third node of the Bloom filter feature layer is (f p (v), f id (id rec ), c rec BF m1 BF m2 …,BF mn ), where c rec To encrypt the record rec obtained by using an encryption algorithm on the third node, BF mi A Bloom filter for recording the keyword mi of record rec, where 1 ≤ i ≤ n, n is the number of keywords in the record, and idrec =f rec (rec), where f rec f represents a pseudo-random function related to records. id This represents a pseudo-random function related to id.

[0281] In the embodiments of this application, an example is provided where a record includes a keyword corresponding to a field. The specific process for generating the tree-indexed ciphertext can be found above. Figure 2 and Figure 3 As mentioned in the previous section, examples of a record containing keywords corresponding to two or more fields can be found in the introduction of steps S101-S104 combined with S201-S204 above, and will not be repeated here.

[0282] In one possible implementation, the method further includes:

[0283] The value of the first part is encrypted to generate a locally stored character existence feature layer ciphertext, which is then sent to the server.

[0284] The server stores the ciphertext of the character existence feature layer locally. When the value of the first part is lost locally on the electronic device, the electronic device can download the ciphertext of the character existence feature layer stored locally on the server and decrypt it to obtain the value of the first part. There is no need to rebuild the index of the first part, saving time.

[0285] In one possible implementation, the Bloom filter features include interval features, which are pairs of characters in the keywords that are separated by one character and maintain their relative positions. According to the search method of the above embodiments of this application, by extracting the interval features of keywords, the technical problem of inaccurate search results for single-character wildcards in related technologies can be solved.

[0286] The search method according to the above embodiments of this application can also solve the technical problem of inaccurate character matching between the first and last multi-character wildcard characters in related technologies. According to the search method of this application, by extracting AB-type features, the relative positional relationship of letters can be determined, thus improving the accuracy of search results.

[0287] In one possible implementation, the method further includes: receiving content to be queried, and determining a first starting point for the query based on the content to be queried and the value of the first part;

[0288] Based on the content to be queried, the key set mentioned at the first starting point, the pseudo-random function set, and the secure permutation function, three trapdoors are obtained for the content to be queried.

[0289] The three trapdoors are sent to the server so that the server can search the tree index ciphertext based on the three trapdoors to obtain the search results for the content to be queried.

[0290] For an example of a record containing a keyword corresponding to one field, please refer to the descriptions in steps S203 and S2031-S2033, which will not be repeated here. For an example of a record containing keywords corresponding to two or more fields, please refer to the introduction in steps S203 and S2031-S2033 above combined with section S103, which will not be repeated here.

[0291] In one possible implementation, the method further includes: receiving content to be updated;

[0292] Based on the content to be updated, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function, update information is generated. The update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated. The update information is then sent to the server so that the server updates the locally stored character existence feature layer ciphertext and tree index ciphertext according to the update information.

[0293] For a detailed explanation of the process, please refer to the examples above regarding the update process of a single record containing a single keyword and the update process of a record containing two or more keywords; these examples will not be repeated here. The search method of this application embodiment can update the index content according to user needs, allowing users to update data without regenerating the tree-structured index ciphertext, thus improving data processing efficiency.

[0294] This application also provides a search method, which is applied to a server. Figure 11 A flowchart illustrating a search method according to an embodiment of this application is shown. Figure 12 A schematic diagram illustrating a search method according to an embodiment of this application is shown. Figure 11 and Figure 12 As shown, the method includes:

[0295] Step S120: Receive the three trapdoors corresponding to the content to be queried;

[0296] The content to be queried is either a keyword corresponding to one field or a combination of keywords corresponding to multiple fields. The three trapdoors include a character existence trapdoor, a trapdoor that preserves relative positions, and a Bloom filter trapdoor. The three trapdoors are calculated based on the content to be queried.

[0297] Step S121: Locate the first starting point of the character existence feature layer of the tree-indexed ciphertext according to the character existence trapdoor, and search the character existence feature layer from the first starting point to obtain the second starting node; the tree-indexed ciphertext includes a character existence feature layer, a feature layer that preserves relative positions, and a Bloom filter feature layer; the character existence feature layer stores the ciphertext data of the recorded character existence features, the feature layer that preserves relative positions stores the ciphertext data of the recorded features that preserve relative positions, and the Bloom filter feature layer stores the ciphertext data of the recorded Bloom filter features.

[0298] Step S122: Based on the trapdoor that preserves the relative position, search the feature layer that preserves the relative position from the second starting node to obtain the third starting point;

[0299] Step S123: Search the Bloom filter feature layer starting from the third starting point according to the trapdoor of the Bloom filter to obtain a search result that matches the content to be queried.

[0300] The content to be queried can be a keyword or one or more records; this application does not impose any restrictions on this. The three trapdoors and the first starting point are described above and will not be repeated here.

[0301] The process of steps S121-S123 can be found in the description of steps S204 and S104 above, and will not be repeated here.

[0302] In one possible implementation, the method further includes:

[0303] Receive update information, wherein the update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated;

[0304] Replace the locally stored character existence feature layer ciphertext with the new locally stored character existence feature layer ciphertext;

[0305] The tree index ciphertext is updated based on the index information to obtain a new tree index ciphertext.

[0306] In one possible implementation, the index information includes the identifier of the node to be deleted.

[0307] The process of updating the tree index ciphertext according to the index information to obtain a new tree index ciphertext includes: searching the Bloom filter feature layer of the tree index ciphertext according to the identifier of the node to be deleted, and setting the value of the node in the Bloom filter feature layer that is the same as the identifier of the node to be deleted to null.

[0308] In one possible implementation, the index information includes content to be added, which includes the ciphertext of the record to be added, a Bloom filter, an encrypted record identifier, and a bitmap.

[0309] The tree index ciphertext is updated based on the index information to obtain a new tree index ciphertext, including:

[0310] Based on the bitmap of the record to be added and the bitmap of the node in the feature layer that preserves the relative position of the tree index ciphertext, an update node is selected from the feature layer that preserves the relative position, and the union of the bitmap of the update node and the bitmap of the record to be added is taken as the new bitmap of the update node.

[0311] In the Bloom filter feature layer of the tree-indexed ciphertext, a node is randomly selected to store the ciphertext, Bloom filter, and encrypted record identifier of the record to be added.

[0312] The update node can be selected based on the Hamming distance between the bitmap of the added record and the bitmap of the node in the feature layer of the tree index ciphertext that retains the relative position. Alternatively, the update node can be selected based on the intersection of the bitmap of the added record and the bitmap of the node in the feature layer of the tree index ciphertext that retains the relative position. For details, please refer to the example above, which will not be repeated here.

[0313] For a detailed explanation of the process, please refer to the examples above regarding the update process of a single record containing a single keyword and the update process of a record containing two or more keywords; these examples will not be repeated here. The search method of this application embodiment can update the index content according to user needs, allowing users to update data without regenerating the tree-structured index ciphertext, thus improving data processing efficiency.

[0314] This application provides a search device applied to an electronic device. The device includes: an initialization module for generating a key set, an encryption algorithm, a pseudo-random function set, and a secure permutation function based on security parameters; an encryption module for generating a tree-structured index ciphertext based on each record in a plaintext dataset, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function; wherein each record includes a keyword corresponding to one field or a combination of keywords from two or more fields, and the tree-structured index ciphertext includes a character existence feature layer, a feature layer preserving relative positions, and a Bloom filter feature layer; the character existence feature layer stores ciphertext data of the character existence features of the record, the feature layer preserving relative positions stores ciphertext data of the feature layer preserving relative positions of the record, and the Bloom filter feature layer stores ciphertext data of the Bloom filter feature of the record; and a first sending module for sending the tree-structured index ciphertext to a server, wherein the tree-structured index ciphertext is used by the server to search layer by layer in the order of the character existence feature layer, the feature layer preserving relative positions, and the Bloom filter feature layer to see if there are any search results matching the content to be queried.

[0315] The search device according to the embodiments of this application can obtain search results more quickly, improving search efficiency. Related technologies mostly use forward and inverted indexes for their index structures. When performing wildcard searches, they can only traverse all Bloom filters for all keywords, resulting in low search efficiency. The search device of the embodiments of this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search, to gradually filter out a large number of Bloom filters that do not need to be compared, greatly reducing the number of Bloom filters that ultimately need to be compared, thus improving search efficiency.

[0316] In one possible implementation, the encryption module is further configured to build a tree index for each record in the plaintext dataset, wherein the tree index includes a first part storing the character existence features of the record, a second part storing the features of preserving relative positions, and a third part storing the features of the Bloom filter; the value of the first part is stored locally; and the first part, the second part, and the third part of the tree index are encrypted according to the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the tree index ciphertext.

[0317] In one possible implementation, the encryption module is further configured to extract features of each keyword for each record, the features of each keyword including: character presence features, relative position retention features, and Bloom filter features; calculate a bitmap of size 26 for each record based on the character presence features of each record; calculate a bitmap of size 676 for each record based on the relative position retention features of each record; calculate a Bloom filter for each record based on the Bloom filter features of each record; classify the records in the plaintext dataset based on the character presence features to obtain multiple categories of records; establish the tree index based on the multiple categories of records and the bitmap of each record, wherein the third node of the third part of the tree index stores the Bloom filter and the 676 and 26 bitmaps corresponding to the node, the second node of the second part of the tree index stores the union of the 676 bitmaps of the leaf nodes of the second node, and the first node of the first part of the tree index stores the union of the 26 bitmaps of the leaf nodes of the first node.

[0318] In the embodiments of this application, in the tree index and the tree index ciphertext, the leaf nodes of a node can refer to all the leaf nodes in the path where the node is located.

[0319] In one possible implementation, the encryption module is further used for:

[0320] The first part of the tree index is encrypted according to the key set and the pseudo-random function set to obtain a character existence feature layer; the first node of the character existence feature layer stores the character existence features T1 and T2 contained in the first node, wherein, The first node of the last layer of the character existence feature layer The first node of the non-last layer of the character existence feature layer Among them, A 1 A 3 As the key, A 2 A 4 A 5 For the value, e A ||1、e A ||2、e A ||3,e A ||4 indicates that the character's existence characteristic is concatenated with different numbers, f A f is a pseudo-random function related to the character existence feature. p Let v be a pseudo-random function related to the tree nodes, where v represents the path of the first node;

[0321] The second part of the tree index is encrypted using the key set, the pseudo-random function set, and the secure permutation function to obtain a feature layer that preserves relative positions. The ciphertext data stored in the second node of the feature layer that preserves relative positions is (f p (v), f p (v l ), f p (v r ), pe(B 676 ), where v l This represents the path of the left child node of the second node, v r B represents the path of the right child node of the second node. 676 This represents a bitmap with a second node of size 676, where pe represents the safe permutation function, and f... p (v) is the key, f p (v l ), f p (v r ), pe(B 676 ) is a value;

[0322] The third part of the tree index is encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the Bloom filter feature layer. The ciphertext data stored in the third node of the Bloom filter feature layer is (f p (v), f id (id rec ), c rec BF m1 BF m2 …,BF mn ), where c rec To encrypt the record rec obtained by using an encryption algorithm on the third node, BF mi A Bloom filter for recording the keyword mi in record rec, where 1 << i << n, n is the number of keywords in the record, and id rec =f rec (rec), where f rec f represents a pseudo-random function related to records. id This represents a pseudo-random function related to id.

[0323] In one possible implementation, the device further includes: encrypting the value of the first part to generate locally stored character existence feature layer ciphertext and sending it to the server. Since the server stores the locally stored character existence feature layer ciphertext, if the value of the first part is lost locally on the electronic device, the electronic device can download the locally stored character existence feature layer ciphertext from the server and decrypt it to obtain the value of the first part, without needing to rebuild the index of the first part, thus saving time.

[0324] In one possible implementation, the Bloom filter features include interval features, which are pairs of characters in the keywords that are separated by one character and maintain their relative positions. According to the search method of the above embodiments of this application, by extracting the interval features of keywords, the technical problem of inaccurate search results for single-character wildcards in related technologies can be solved.

[0325] The search apparatus according to the above embodiments of this application can also solve the technical problem of inaccurate character matching between the first and last multi-character wildcard characters in related technologies. The search apparatus according to the embodiments of this application, by extracting AB-type features, can determine the relative positional relationship of letters, thereby improving the accuracy of search results.

[0326] In one possible implementation, the apparatus further includes: a first receiving module for receiving content to be queried; a determining module for determining a first starting point for querying based on the content to be queried and the value of the first part; a trapdoor generating module for obtaining a three-part trapdoor of the content to be queried based on the content to be queried, the first starting point, the key set, the pseudo-random function set, and the secure permutation function; and a second sending module for sending the three-part trapdoor to the server, so that the server searches the tree-indexed ciphertext based on the three-part trapdoor to obtain the search results for the content to be queried.

[0327] In one possible implementation, the apparatus further includes: a first receiving module for receiving content to be updated; an update information generation module for generating update information based on the content to be updated, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function, wherein the update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated; and a third sending module for sending the update information to the server, so that the server updates the locally stored character existence feature layer ciphertext and tree index ciphertext based on the update information. The search method of this application embodiment can update the indexed content according to user needs, supporting data updates without requiring users to regenerate the tree index ciphertext, thereby improving data processing efficiency.

[0328] This application provides a search device applied to a server. The device includes: a third receiving module for receiving three trapdoors corresponding to content to be queried; wherein the content to be queried is a keyword corresponding to one field or a combination of keywords corresponding to multiple fields, and the three trapdoors include a character existence trapdoor, a trapdoor that preserves relative positions, and a Bloom filter trapdoor, and the three trapdoors are calculated based on the content to be queried; a first search module for locating a first starting point of the character existence feature layer of the tree-indexed ciphertext based on the character existence trapdoors, and searching the character existence feature layer from the first starting point to obtain a second starting node; the tree... The index ciphertext includes a character existence feature layer, a relative position retention feature layer, and a Bloom filter feature layer. The character existence feature layer stores ciphertext data of the recorded character existence features, the relative position retention feature layer stores ciphertext data of the recorded relative position retention features, and the Bloom filter feature layer stores ciphertext data of the recorded Bloom filter features. A second search module is used to search the relative position retention feature layer from the second starting node based on the trapdoor of the relative position retention feature layer to obtain a third starting point. A third search module is used to search the Bloom filter feature layer from the third starting point based on the trapdoor of the Bloom filter to obtain search results that match the content to be queried.

[0329] The search device according to the embodiments of this application can obtain search results more quickly, improving search efficiency. Related technologies mostly use forward and inverted indexes for their index structures. When performing wildcard searches, they can only traverse all Bloom filters for all keywords, resulting in low search efficiency. The search device of the embodiments of this application uses a tree-based index based on a virtual tree, combined with a three-trapdoor search, to gradually filter out a large number of Bloom filters that do not need to be compared, greatly reducing the number of Bloom filters that ultimately need to be compared, thus improving search efficiency.

[0330] In one possible implementation, the apparatus further includes: a fourth receiving module for receiving update information, wherein the update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated; a replacement module for replacing the locally stored character existence feature layer ciphertext with the new locally stored character existence feature layer ciphertext; and an update module for updating the tree-type index ciphertext with the index information to obtain a new tree-type index ciphertext.

[0331] In one possible implementation, the index information includes the identifier of the node to be deleted. The update module is further configured to search the Bloom filter feature layer of the tree index ciphertext based on the identifier of the node to be deleted, and set the value of the node in the Bloom filter feature layer that is the same as the identifier of the node to be deleted to null.

[0332] In one possible implementation, the index information includes content to be added, which includes the ciphertext of the record to be added, a Bloom filter, an encrypted record identifier, and a bitmap. The update module is further configured to select an update node from the feature layer that preserves the relative positions of nodes in the tree-index ciphertext based on the bitmap of the record to be added and the bitmap of the node in the feature layer that preserves the relative positions of nodes; and to take the union of the bitmap of the update node and the bitmap of the record to be added as the new bitmap of the update node. A node is randomly selected in the Bloom filter feature layer of the tree-index ciphertext to store the ciphertext of the record to be added, the Bloom filter, and the encrypted record identifier. The search method of this application embodiment can update the index content according to user needs, allowing users to update data without regenerating the tree-index ciphertext, thus improving data processing efficiency.

[0333] Embodiments of this application provide a search apparatus, including: a processor and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above-described method when executing the instructions.

[0334] Embodiments of this application provide a non-volatile computer-readable storage medium storing computer program instructions thereon, which, when executed by a processor, implement the above-described method.

[0335] Embodiments of this application provide a computer program product including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the above-described method.

[0336] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), electrically programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), compact disc read-only memory (CD-ROM), digital video disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing.

[0337] The computer-readable program instructions or code described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0338] The computer program instructions used to perform the operations of this application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as "C" or similar languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state information from computer-readable program instructions. These electronic circuits can execute computer-readable program instructions to implement various aspects of this application.

[0339] Various aspects of this application are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0340] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0341] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0342] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved.

[0343] It should also be noted that each block in the block diagram and / or flowchart, as well as combinations of blocks in the block diagram and / or flowchart, can be implemented using hardware (such as circuits or ASICs (Application Specific Integrated Circuits)) that performs the corresponding function or action, or using a combination of hardware and software, such as firmware.

[0344] Although the invention has been described herein in conjunction with various embodiments, those skilled in the art will understand and implement other variations of the disclosed embodiments by reviewing the accompanying drawings, disclosure, and appended claims in carrying out the claimed invention. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.

[0345] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A search method, characterized in that, The method is applied to an electronic device, and the method includes: Generate a key set, encryption algorithm, pseudo-random function set, and secure permutation function based on security parameters; A tree-indexed ciphertext is generated based on each record in the plaintext dataset, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function. Each record includes a keyword corresponding to one field or a combination of keywords from two or more fields. The tree-indexed ciphertext includes a character existence feature layer, a relative position retention feature layer, and a Bloom filter feature layer. The character existence feature layer stores the ciphertext data of the record's character existence features; the relative position retention feature layer stores the ciphertext data of the record's relative position retention features; and the Bloom filter feature layer stores the ciphertext data of the record's Bloom filter features. The tree-structured index ciphertext is sent to the server, whereby the server searches layer by layer in the order of the character existence feature layer, the feature layer that preserves relative position, and the Bloom filter feature layer to see if there are any search results that match the content to be queried.

2. The method according to claim 1, characterized in that, Based on each record in the plaintext dataset, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function, a tree-indexed ciphertext is generated, including: A tree index is built for each record in the plaintext dataset, wherein the tree index includes a first part storing the character existence features of the record, a second part storing the features that preserve relative positions, and a third part storing the features of the Bloom filter. Save the value of the first part locally; The first part, the second part, and the third part of the tree index are encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the ciphertext of the tree index.

3. The method according to claim 2, characterized in that, The method further includes: Receive the query content. The first starting point of the query is determined based on the content to be queried and the value of the first part; Based on the content to be queried, the first starting point, the key set, the pseudo-random function set, and the secure permutation function, three trapdoors are obtained for the content to be queried. The three trapdoors are sent to the server so that the server can search the tree-structured index ciphertext based on the three trapdoors to obtain the search results for the content to be queried.

4. The method according to claim 2, characterized in that, For each record in the plaintext dataset, a tree index is built, including: For each record, the features of each keyword in each record are extracted. The features of each keyword include: character existence features, features that preserve relative position, and Bloom filter features. Calculate a bitmap of size 26 for each record based on the character existence characteristics of each record; Calculate a bitmap of size 676 for each record based on the feature of the reserved relative position of each record; Calculate the Bloom filter for each record based on the Bloom filter characteristics of each record; Based on the character existence characteristics, the records in the plaintext dataset are classified to obtain multiple categories of records; Based on the multiple types of records and the bitmap of each record, a tree index is established. The third node of the third part of the tree index stores the Bloom filter and the bitmaps of 676 and 26 corresponding to the third node. The second node of the second part of the tree index stores the union of the bitmaps of 676 of the leaf nodes of the second node. The first node of the first part of the tree index stores the union of the bitmaps of 26 of the leaf nodes of the first node.

5. The method according to claim 4, characterized in that, The first, second, and third parts of the tree index are encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the tree index ciphertext, including: The first part of the tree index is encrypted using the key set and the pseudo-random function set to obtain the character existence feature layer; the first node of the character existence feature layer stores the character existence features contained in the first node. and ,in, The first node of the last layer of the character existence feature layer The first node of the non-last layer of the character existence feature layer ;in, , As key, , , , , For value, , , , This indicates that the existence characteristic of a character is concatenated with different numbers. A pseudo-random function related to the character existence feature. For pseudo-random functions related to tree nodes, Indicates the path to the first node; The second part of the tree index is encrypted using the key set, the pseudo-random function set, and the secure permutation function to obtain the feature layer that preserves relative positions. The ciphertext data stored in the second node of the feature layer that preserves relative positions is... ,in, This represents the path of the second node. This represents the path of the left child node of the second node. This represents the path of the right child node of the second node. This represents a bitmap with a size of 676 for the second node. Represents a safe permutation function. As key, Value; The third part of the tree index is encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the Bloom filter feature layer. The ciphertext data stored in the third node of the Bloom filter feature layer is... ,in, The record obtained by encrypting the record of the third node using an encryption algorithm. The ciphertext, To record keywords for rec Bloom filter, 1 , where n is the number of keywords in the record. ,in, This represents a pseudo-random function related to the record. This represents a pseudo-random function related to id.

6. The method according to claim 4, characterized in that, The Bloom filter features include spaced features, which are pairs of characters in the keywords that are separated by one character and maintain their relative positions.

7. The method according to claim 2, characterized in that, The method further includes: The value of the first part is encrypted to generate a locally stored character existence feature layer ciphertext, which is then sent to the server.

8. The method according to any one of claims 1-6, characterized in that, The method further includes: Receive content to be updated; Based on the content to be updated, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function, update information is generated. The update information includes the new locally stored character existence feature layer ciphertext and the index information of the content to be updated. The update information is sent to the server so that the server updates the character existence feature layer ciphertext and tree index ciphertext stored locally on the server according to the update information.

9. A search method, characterized in that, The method is applied to a server, and the method includes: Receive the three-part trapdoor corresponding to the content to be queried; The content to be queried is either a keyword corresponding to one field or a combination of keywords corresponding to multiple fields. The three trapdoors include a character existence trapdoor, a trapdoor that preserves relative positions, and a Bloom filter trapdoor. The three trapdoors are calculated based on the content to be queried. The first starting point of the character existence feature layer of the tree-indexed ciphertext is located based on the character existence trapdoor, and the second starting node is obtained by searching the character existence feature layer from the first starting point; the tree-indexed ciphertext includes the character existence feature layer, the feature layer that preserves relative position, and the Bloom filter feature layer; the character existence feature layer stores the ciphertext data of the character existence features of the record, the feature layer that preserves relative position stores the ciphertext data of the record's feature that preserves relative position, and the Bloom filter feature layer stores the ciphertext data of the record's Bloom filter feature; Based on the trapdoor that preserves the relative position, search the feature layer that preserves the relative position from the second starting node to obtain the third starting point; Based on the trapdoor of the Bloom filter, the search begins from the third starting point to search the feature layer of the Bloom filter, obtaining search results that match the content to be queried.

10. The method according to claim 9, characterized in that, The method further includes: Receive update information, wherein the update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated; Replace the locally stored character existence feature layer ciphertext with the new locally stored character existence feature layer ciphertext; The tree index ciphertext is updated based on the index information to obtain a new tree index ciphertext.

11. The method according to claim 10, characterized in that, The index information includes the identifier of the node to be deleted. The process of updating the tree index ciphertext according to the index information to obtain a new tree index ciphertext includes: searching the Bloom filter feature layer of the tree index ciphertext according to the identifier of the node to be deleted, and setting the value of the node in the Bloom filter feature layer that is the same as the identifier of the node to be deleted to null.

12. The method according to claim 10 or 11, characterized in that, The index information includes the content to be added, which includes the ciphertext of the record to be added, a Bloom filter, the encrypted record identifier, and a bitmap. The tree index ciphertext is updated based on the index information to obtain a new tree index ciphertext, including: Based on the bitmap of the record to be added and the bitmap of the node in the feature layer that preserves the relative position of the tree index ciphertext, an update node is selected from the feature layer that preserves the relative position, and the union of the bitmap of the update node and the bitmap of the record to be added is taken as the new bitmap of the update node. In the Bloom filter feature layer of the tree-indexed ciphertext, a node is randomly selected to store the ciphertext, Bloom filter, and encrypted record identifier of the record to be added.

13. A search device, characterized in that, The device is used in an electronic device, and the device includes: The initialization module is used to generate a key set, encryption algorithm, pseudo-random function set, and secure permutation function based on security parameters. An encryption module is used to generate tree-indexed ciphertext based on each record in the plaintext dataset, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function; wherein each record includes a keyword corresponding to one field or a combination of keywords from two or more fields, and the tree-indexed ciphertext includes a character existence feature layer, a relative position retention feature layer, and a Bloom filter feature layer; the character existence feature layer stores the ciphertext data of the character existence features of the record, the relative position retention feature layer stores the ciphertext data of the relative position retention features of the record, and the Bloom filter feature layer stores the ciphertext data of the Bloom filter features of the record; The first sending module is used to send the tree-structured index ciphertext to the server. The tree-structured index ciphertext is used by the server to search layer by layer in the order of the character existence feature layer, the feature layer that preserves relative position, and the Bloom filter feature layer to see if there is a search result that matches the content to be queried.

14. The apparatus according to claim 13, characterized in that, The encryption module is also used for: A tree index is built for each record in the plaintext dataset, wherein the tree index includes a first part storing the character existence features of the record, a second part storing the features that preserve relative positions, and a third part storing the features of the Bloom filter. Save the value of the first part locally; The first part, the second part, and the third part of the tree index are encrypted using the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function to obtain the ciphertext of the tree index.

15. The apparatus according to claim 14, characterized in that, The device further includes: The first receiving module is used to receive the content to be queried. The determination module is used to determine the first starting point of the query based on the content to be queried and the value of the first part; The trapdoor generation module is used to obtain a three-part trapdoor of the content to be queried based on the content to be queried, the first starting point, the key set, the pseudo-random function set, and the secure permutation function; The second sending module is used to send the three trapdoors to the server, so that the server can search the tree-structured index ciphertext based on the three trapdoors to obtain the search results for the content to be queried.

16. The apparatus according to claim 14, characterized in that, The encryption module is also used for: For each record, the features of each keyword in each record are extracted. The features of each keyword include: character existence features, features that preserve relative position, and Bloom filter features. Calculate a bitmap of size 26 for each record based on the character existence characteristics of each record; Calculate a bitmap of size 676 for each record based on the feature of the reserved relative position of each record; Calculate the Bloom filter for each record based on the Bloom filter characteristics of each record; Based on the character existence characteristics, the records in the plaintext dataset are classified to obtain multiple categories of records; Based on the multiple types of records and the bitmap of each record, a tree index is established. The third node of the third part of the tree index stores the Bloom filter and the bitmaps of 676 and 26 corresponding to the node. The second node of the second part of the tree index stores the union of the bitmaps of 676 of the leaf nodes of the second node. The first node of the first part of the tree index stores the union of the bitmaps of 26 of the leaf nodes of the first node.

17. The apparatus according to claim 16, characterized in that, The Bloom filter features include spaced features, which are pairs of characters in the keywords that are separated by one character and maintain their relative positions.

18. The apparatus according to claim 14, characterized in that, The device further includes: The fourth sending module is used to encrypt the value of the first part, generate a locally stored character existence feature layer ciphertext, and send it to the server.

19. The apparatus according to any one of claims 13-18, characterized in that, The device further includes: The second receiving module is used to receive the content to be updated. The update information generation module is used to generate update information based on the content to be updated, the key set, the encryption algorithm, the pseudo-random function set, and the secure permutation function. The update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated. The third sending module is used to send the update information to the server, so that the server updates the character existence feature layer ciphertext and tree index ciphertext stored locally on the server according to the update information.

20. A search device, characterized in that, The device is used in a server, and the device includes: The third receiving module is used to receive the three trapdoors corresponding to the content to be queried; The content to be queried is either a keyword corresponding to one field or a combination of keywords corresponding to multiple fields. The three trapdoors include a character existence trapdoor, a trapdoor that preserves relative positions, and a Bloom filter trapdoor. The three trapdoors are calculated based on the content to be queried. The first search module is used to locate the first starting point of the character existence feature layer of the tree-indexed ciphertext based on the character existence trapdoor, and to search the character existence feature layer from the first starting point to obtain a second starting node; the tree-indexed ciphertext includes the character existence feature layer, the feature layer that preserves relative positions, and the Bloom filter feature layer; the character existence feature layer stores the ciphertext data of the character existence features of the record, the feature layer that preserves relative positions stores the ciphertext data of the record's features that preserve relative positions, and the Bloom filter feature layer stores the ciphertext data of the record's Bloom filter features; The second search module is used to search the feature layer of the reserved relative position based on the trapdoor with the reserved relative position from the second starting node to obtain the third starting point; The third search module is used to search the feature layer of the Bloom filter starting from the third starting point based on the trapdoor of the Bloom filter, and obtain search results that match the content to be queried.

21. The apparatus according to claim 20, characterized in that, The device further includes: The fourth receiving module is used to receive update information, wherein the update information includes new locally stored character existence feature layer ciphertext and index information of the content to be updated; The replacement module is used to replace the locally stored character existence feature layer ciphertext with the new locally stored character existence feature layer ciphertext. The update module is used to update the tree index ciphertext according to the index information to obtain a new tree index ciphertext.

22. The apparatus according to claim 21, characterized in that, The index information includes the identifier of the node to be deleted. The update module is also used to: find the Bloom filter feature layer of the tree index ciphertext based on the identifier of the node to be deleted, and set the value of the node in the Bloom filter feature layer that is the same as the identifier of the node to be deleted to null.

23. The apparatus according to claim 21 or 22, characterized in that, The index information includes the content to be added, which includes the ciphertext of the record to be added, a Bloom filter, the encrypted record identifier, and a bitmap. The update module is also used for: Based on the bitmap of the record to be added and the bitmap of the node in the feature layer that preserves the relative position of the tree index ciphertext, an update node is selected from the feature layer that preserves the relative position, and the union of the bitmap of the update node and the bitmap of the record to be added is taken as the new bitmap of the update node. In the Bloom filter feature layer of the tree-indexed ciphertext, a node is randomly selected to store the ciphertext, Bloom filter, and encrypted record identifier of the record to be added.

24. A search device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to implement the method of any one of claims 1-8 or the method of any one of claims 9-12 when executing the instructions.

25. A non-volatile computer-readable storage medium storing computer program instructions thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1-8, or the method described in any one of claims 9-12.

26. A computer program product comprising computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code, wherein when the computer-readable code is executed in a processor, it implements the method of any one of claims 1-8, or implements the method of any one of claims 9-12.

Citation Information

Patent Citations

  • Ciphertext retrieval method and equipment

    CN110019011A

  • Attribute-based wildcard character searchable encryption method

    CN111859425A