Method and device for positioning keywords in database

Through the Diffi-Hermann key exchange algorithm, the encryption and decryption of keywords is solved, and the storage problem of keyword positioning in the database on lightweight devices is applied to mobile devices and other devices, and privacy protection is achieved and Efficient data processing.

CN119149566APending Publication Date: 2024-12-17ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411217044.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

In scenarios where user privacy is needed, it is difficult for the prior art to position keywords in the database on lightweight devices. Due to the huge amount of data, the client needs to store a large amount of encrypted data, which is not suitable for lightweight devices. Such as mobile devices.

Method used

By using interchangeable encryption algorithms, such as the Diffie-Hermann key exchange algorithm, the client and the server generate keys separately, encrypt and decrypt keywords, the client only stores the encryption algorithm and permutation rules, and the server side Store ciphertext data to realize keyword positioning and privacy protection.

Benefits of technology

It effectively reduces the storage overhead of the client, is suitable for lightweight devices, realizes the positioning of keywords and privacy protection in the database, and avoids the storage needs of a large amount of data on the client.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149566A_ABST
    Figure CN119149566A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for positioning keywords in a database. A specific embodiment of the method is executed by a client, and the method comprises the following steps: a preparation stage: according to a preset encryption algorithm, encrypting first ciphertexts in a first ciphertext sequence sent by a server by using a first key to obtain a second ciphertext sequence; replacing the position of each element in the second ciphertext sequence according to a first replacement rule to obtain a third ciphertext sequence, and sending the third ciphertext sequence to the server, so that the server decrypts the third ciphertext sequence to obtain a fourth ciphertext sequence; the online stage comprises the following steps: based on an encryption algorithm, performing encryption calculation on a target keyword by using a first key to obtain a ciphertext keyword, and sending the ciphertext keyword to a server; receiving first position information sent by the server for the ciphertext keyword; and replacing the plaintext sequence corresponding to the first position information based on a second replacement rule to obtain second position information in the first plaintext information sequence corresponding to the target keyword.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present specification belong to the field of secure computing technology, and more particularly, to a method and device for locating keywords in a database. Background Art

[0002] In recent years, private information retrieval (PIR) technology has developed rapidly. Through a series of encryption and protocol designs, PIR technology enables users to hide the query keywords when querying the database, and the database server cannot know the specific content of the user's query when returning the query results. When performing information retrieval, locating keywords is a basic operation of database query, which is used in many scenarios where information needs to be retrieved. However, in scenarios where user privacy needs to be protected, the process of locating keywords also needs to be encrypted and hidden. In some implementations, in order to achieve encryption and hiding of the keyword locating process, the keywords of each piece of information in the database can be encrypted and stored in the client. Due to the huge amount of information in the database, this implementation requires storing a large amount of data on the client side, which is not suitable for users using lightweight devices (e.g., mobile devices). Therefore, there is an urgent need for a method for locating keywords suitable for lightweight devices. Summary of the invention

[0003] The purpose of the present invention is to provide a method and device for locating keywords in a database, which can store data that occupies a large amount of storage overhead to a server, while the client does not need to store a large amount of data. Therefore, it is more suitable for keyword positioning of lightweight devices.

[0004] The first aspect of the present specification provides a method for locating keywords in a database, which is executed by a client, and includes: a preparation stage: according to a preset encryption algorithm, a first key is used to encrypt multiple first ciphertexts in a first ciphertext sequence sent by a server to obtain a second ciphertext sequence, wherein the first ciphertext sequence is obtained by the server using a second key to encrypt the keywords in each item of the keyword sequence according to the encryption algorithm, the multiple items in the keyword sequence correspond to multiple plaintext information in a first plaintext information sequence, each item in the keyword sequence includes the keyword in the plaintext information corresponding to the item, and the encryption algorithm is an exchangeable encryption algorithm; according to a first substitution rule, the position of each element in the second ciphertext sequence is permuted to obtain a third ciphertext sequence, and the third The ciphertext sequence is sent to the server, so that the server uses the second key to decrypt the third ciphertext sequence based on the encryption algorithm to obtain a fourth ciphertext sequence; in the online stage: based on the encryption algorithm, the target keyword is encrypted and calculated using the first key to obtain the ciphertext keyword, and the ciphertext keyword is sent to the server; the first position information sent by the server for the ciphertext keyword is received, wherein the first position information is the position information in the fourth ciphertext sequence that matches the ciphertext keyword; the plaintext sequence corresponding to the first position information is replaced based on the second replacement rule to obtain the second position information in the first plaintext information sequence corresponding to the target keyword, and the second replacement rule corresponds to the inverse operation of the first replacement rule.

[0005] The second aspect of the present specification provides another method for locating keywords in a database, which is executed by a server, including: a preparation stage: according to a preset encryption algorithm, using a second key to encrypt the keywords in each item of the keyword sequence to obtain a first ciphertext sequence, wherein the multiple items in the keyword sequence correspond to multiple plaintext information in a first plaintext information sequence, respectively, and each item in the keyword sequence includes the keyword in the plaintext information corresponding to the item, and the encryption algorithm is an exchangeable encryption algorithm; sending the first ciphertext sequence to a client; receiving a third ciphertext sequence from the client, wherein the third ciphertext sequence is obtained by the client through the following steps: based on the encryption algorithm, using the first key to encrypt the keywords in each item of the first ciphertext sequence A plurality of first ciphertexts are encrypted respectively to obtain a second ciphertext sequence, and the position of each element in the second ciphertext sequence is permuted according to a first permutation rule; based on the encryption algorithm, the third ciphertext sequence sent by the client is decrypted using the second key to obtain a fourth ciphertext sequence; in the online stage: a ciphertext keyword sent by the client is received, wherein the ciphertext keyword is obtained by encrypting and calculating a target keyword by the client based on the encryption algorithm using the first key; the ciphertext keyword is matched with each ciphertext in the fourth ciphertext sequence, and the position information corresponding to the ciphertext in the fourth ciphertext sequence that matches the ciphertext keyword is sent to the client as the first position information.

[0006] The third aspect of the present specification provides a device for locating keywords in a database, which is deployed on a client and includes: a first encryption unit, configured to, in a preparation stage: according to a preset encryption algorithm, use a first key to encrypt multiple first ciphertexts in a first ciphertext sequence sent by a server to obtain a second ciphertext sequence, wherein the first ciphertext sequence is obtained by the server using a second key to encrypt the keywords in each item of the keyword sequence according to the encryption algorithm, the multiple items in the keyword sequence correspond to multiple plaintext information in a first plaintext information sequence, each item in the keyword sequence includes the keyword in the plaintext information corresponding to the item, and the encryption algorithm is an exchangeable encryption algorithm; a first replacement unit, configured to replace the position of each element in the second ciphertext sequence according to a first replacement rule to obtain a third ciphertext sequence, and replace the third ciphertext sequence with the first replacement rule. The first ciphertext sequence is sent to the server, so that the server uses the second key to decrypt the third ciphertext sequence based on the encryption algorithm to obtain a fourth ciphertext sequence; the second encryption unit is configured to: in the online stage: based on the encryption algorithm, use the first key to encrypt and calculate the target keyword to obtain the ciphertext keyword, and send the ciphertext keyword to the server; the sending unit is configured to receive the first position information sent by the above-mentioned server for the above-mentioned ciphertext keyword, wherein the above-mentioned first position information is the position information in the above-mentioned fourth ciphertext sequence that matches the above-mentioned ciphertext keyword; the second replacement unit is configured to replace the plaintext sequence corresponding to the above-mentioned first position information based on the second replacement rule to obtain the second position information in the above-mentioned first plaintext information sequence corresponding to the above-mentioned target keyword, and the above-mentioned second replacement rule corresponds to the inverse operation of the above-mentioned first replacement rule.

[0007] The fourth aspect of the present specification provides another device for locating keywords in a database, which is deployed on a server side, and includes: an encryption calculation unit, configured to: in a preparation stage: according to a preset encryption algorithm, use a second key to encrypt the keywords in each item of the keyword sequence to obtain a first ciphertext sequence, wherein the multiple items in the keyword sequence correspond to multiple plaintext information in a first plaintext information sequence, respectively, and each item in the keyword sequence includes the keyword in the plaintext information corresponding to the item, and the encryption algorithm is an exchangeable encryption algorithm; a sequence sending unit, configured to send the above-mentioned first ciphertext sequence to a client; a sequence receiving unit, configured to receive a third ciphertext sequence from the client, and the third ciphertext sequence is obtained by the client through the following steps: based on the encryption algorithm, use the first key to encrypt the keywords in each item of the first ciphertext sequence A plurality of first ciphertexts are encrypted respectively to obtain a second ciphertext sequence, and the position of each element in the second ciphertext sequence is permuted according to a first permutation rule; a decryption unit is configured to, based on the encryption algorithm, use the second key to decrypt the third ciphertext sequence sent by the client to obtain a fourth ciphertext sequence; a ciphertext keyword receiving unit is configured to, in an online stage: receive a ciphertext keyword sent by the client, wherein the ciphertext keyword is obtained by the client encrypting and calculating a target keyword based on the encryption algorithm using the first key; a matching unit is configured to match the above ciphertext keyword with each ciphertext in the above fourth ciphertext sequence, and send the position information corresponding to the ciphertext in the above fourth ciphertext sequence that matches the above ciphertext keyword as the first position information to the above client.

[0008] A fifth aspect of the present specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method described in the first aspect or the second aspect.

[0009] A sixth aspect of the specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in the first aspect or the second aspect is implemented.

[0010] A seventh aspect of the present specification provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method described in the first aspect or the second aspect.

[0011] The method for locating keywords in a database provided by one or more embodiments of the present specification includes a preparation stage and an online stage, wherein in the preparation stage, the server can use a second key to encrypt the keywords in each item of the keyword sequence based on a preset encryption algorithm to obtain a first ciphertext sequence, wherein the multiple items in the keyword sequence correspond to the multiple plaintext information in the first plaintext information sequence. The client can use the first key to encrypt the multiple first ciphertexts in the first ciphertext sequence based on the encryption algorithm to obtain a second ciphertext sequence. Afterwards, the client can replace the positions of each element in the second ciphertext sequence according to the first replacement rule to obtain a third ciphertext sequence, and the server can use the second key to decrypt the third ciphertext sequence based on the encryption algorithm to obtain and store a fourth ciphertext sequence. In the online stage, the client can use the first key to perform encryption calculation on the target keyword based on the encryption algorithm to obtain the ciphertext keyword. The server feeds back the first position information matching the ciphertext keyword in the fourth ciphertext sequence to the client. The client replaces the plaintext sequence corresponding to the first position information based on the second replacement rule to obtain the second position information in the first plaintext information sequence corresponding to the target keyword, where the second replacement rule corresponds to the inverse operation of the first replacement rule. Therefore, in this scheme, the fourth ciphertext sequence that occupies a large amount of storage overhead is stored on the server in the preparation stage, and the client only needs to store data related to the encryption algorithm and substitution rules, without storing a large amount of data. Therefore, this scheme is a method for locating keywords that is more suitable for lightweight devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0013] Figure 1 An interactive diagram showing a method for locating keywords in a database according to one embodiment;

[0014] Figure 2 A schematic diagram of a method for locating keywords in a database in an embodiment of this specification is shown;

[0015] Figure 3 A schematic block diagram of an apparatus for locating keywords in a database according to an embodiment is shown;

[0016] Figure 4 A schematic block diagram of an apparatus for locating keywords in a database according to yet another embodiment is shown. DETAILED DESCRIPTION

[0017] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.

[0018] As mentioned above, in scenarios where user privacy needs to be protected, privacy protection is also required in the process of locating keywords. In one keyword locating technology, privacy protection of keywords is implemented based on the Diffie-Hellman KeyExchange algorithm (DH algorithm for short).

[0019] In the DH algorithm, assuming that one party uses private key a to perform DH encryption on plaintext x, it can be expressed as c = x a For the ciphertext c, we can calculate Decrypt to obtain the plaintext x corresponding to the ciphertext c, where It can represent the multiplication inverse. The DH encryption satisfies the commutativity, that is, for two encryption operations of plaintext, the order of the two encryption operations can be interchanged without affecting the encryption result. For example, for plaintext x, first use key a to encrypt plaintext x, and get x a , and then use key b to a Encrypt and get x ab , after exchanging the encryption order, encrypt the plaintext x with key b to get x b , and then use key b to a Encrypt and get x ba , due to x ab =x ba Therefore, it can be concluded that the encryption order of plaintext with different DH encryption keys does not affect the final encryption result.

[0020] In the above keyword positioning technology, assuming that the client generates a private key a through the DH algorithm, and the server generates a private key b through the DH algorithm, keyword positioning can be performed through the following steps 1) to 4), specifically:

[0021] 1) The server can use key b to perform DH encryption on the keywords corresponding to each piece of information x in the database, and send the encrypted result x b (in this case, called the query base) is sent to the client and stored by the client.

[0022] Second), the client can use key a to perform DH encryption on the keyword K to be queried and convert the ciphertext K a Here, DH encryption can be used to protect the client's interest keywords, so that the server cannot obtain the plain text of the interest keywords.

[0023] 3) The server can use the key b to receive the ciphertext K a Perform secondary encryption to obtain the encryption result K ab , and returns the encrypted result K ab to the client.

[0024] 4) The client can use key a to encrypt the received result K ab Perform DH decryption, that is, compute The result is still a ciphertext K b , this ciphertext K b It is exactly equal to the result of encrypting the keyword of interest using the server's key b. Afterwards, the client can use the ciphertext to search on the previously stored "query base" and output the search result. In this way, the search result is the location result of the keyword of interest in the server database.

[0025] From the above description, it can be seen that the above-mentioned keyword positioning technology based on the DH algorithm needs to store the "query base" on the client, and the amount of data in the server database is often huge. Therefore, a large number of "query bases" need to be stored on the client, which is obviously not suitable for application to lightweight devices (for example, mobile devices).

[0026] To this end, in an embodiment of the present specification, a method for locating keywords in a database is provided, which can store ciphertext data that occupies a large amount of storage overhead to the server, and the client only needs to store data related to the encryption algorithm and replacement rules without storing a large amount of data.

[0027] See also Figure 1 , Figure 1 An interactive diagram of a method for locating keywords in a database according to one embodiment is shown. Figure 1 The interaction diagram shown may include a client and a server. The client and the server may generate their respective keys through an exchangeable encryption algorithm. In this example, it is assumed that the key owned by the client is the first key and the key owned by the server is the second key. Figure 1 The method shown may include two stages: a preparation stage and an online stage, wherein the preparation stage may include the following S101-S109, specifically:

[0028] S101, the server may use a second key to encrypt the keyword in each item of the keyword sequence according to a preset encryption algorithm to obtain a first ciphertext sequence.

[0029] In this embodiment, a first plaintext information sequence may be stored in a database within the server, and multiple items in the above keyword sequence correspond to multiple plaintext information in the first plaintext information sequence, respectively, and each item in the above keyword sequence includes a keyword in the plaintext information corresponding to the item. Here, the above encryption algorithm may be an exchangeable encryption algorithm. As an example, an exchangeable encryption algorithm may include a DH algorithm, etc. In this example, the client and the server may generate their own keys through an exchangeable encryption algorithm, the key owned by the client is the first key, and the key owned by the server is the second key. For example, the server may use its second key to directly perform encryption calculations on the keywords in each item of the keyword sequence to obtain a first ciphertext.

[0030] In some implementations, the above step 101 may further specifically include the following steps a) and b), specifically:

[0031] Step a): The server performs hash calculation on the keywords in each item of the keyword sequence to obtain the hash calculation results of the keywords corresponding to each item.

[0032] Step b), the server uses the second key to encrypt the hash calculation results corresponding to each item to obtain a first ciphertext sequence.

[0033] Compared with directly using a key to encrypt a keyword, first performing a hash calculation on the keyword and then using the key to encrypt the hash calculation result can make the encryption result more difficult to decipher, thereby further improving the security of the keyword.

[0034] See also Figure 2 , Figure 2 FIG. 2 shows a schematic diagram of a method for locating keywords in a database in an embodiment of this specification. Figure 2 As shown, assuming that the exchangeable encryption algorithm used between the client and the server is the DH algorithm, a first plaintext information sequence is stored in the database in the server, and the n plaintext information in the first plaintext information sequence corresponds to the n items in the keyword sequence D respectively, and each item in the keyword sequence D may include the keyword in the plaintext information corresponding to the item. Among them, an item in the keyword sequence D may include one or more keywords in a corresponding plaintext information. The following description takes an item in the keyword sequence D including a keyword as an example, that is, D = [keyword1, keyword2, ...keyword n ].

[0035] exist Figure 2 In the example shown, the entire method of locating keywords can be divided into two stages: the preparation stage and the online stage. Figure 2 The preparation phase in Figure 1 S101-S109 in Figure 2 The online phase in corresponds to Figure 1 S1011-S1019 in.

[0036] exist Figure 2 In step 1 of the server, the server generates a private key b. Figure 2 In step 1 of the client, the client generates a private key a, where key a and key b both come from key space G.

[0037] exist Figure 2 In step 2 of the server, the server uses key b to encrypt the keywords in each item of keyword sequence D, and obtains the following first ciphertext sequence [B1, B2, ... B n ]:

[0038]

[0039] Here, H can represent hash calculation. That is, for each keyword keyword i Take the hash to get H(keyword i ), and then calculate the hash value H(keyword i ) to the power of b.

[0040] It can be understood that when one item of the keyword sequence D includes multiple keywords, multiple ciphertexts are obtained by encrypting the multiple keywords respectively as one item B in the first ciphertext sequence. i For example, the first item in the keyword sequence D includes multiple keywords keyword 11 and keyword 12 In the case of B1=(H(keyword 11 ) b ,H(keyword 12 ) b ).

[0041] S103, the server may send the first ciphertext sequence to the client.

[0042] Specifically, reference Figure 2 The server encrypts the keyword sequence D to obtain the first ciphertext sequence [B1, B2, ... B n ], then the first ciphertext sequence [B1, B2, ... B n ] is sent to the client.

[0043] S105: The client uses a first key to encrypt, according to a preset encryption algorithm, multiple first ciphertexts in the first ciphertext sequence sent by the server to obtain a second ciphertext sequence.

[0044] In this embodiment, the client may determine a first key based on an encryption algorithm, and use the first key to perform encryption calculations on multiple first ciphertexts in the first ciphertext sequence respectively to obtain a second ciphertext sequence.

[0045] Specifically, in Figure 2 In step 3 corresponding to the client shown in the figure, the client can use key a to encrypt the first ciphertext sequence [B1, B2, ... B n ] in multiple first ciphertexts [B1,B2,...B n ] to encrypt and obtain the second ciphertext sequence [C1,C2,…C n ]:

[0046]

[0047] S107, the client replaces the position of each element in the second ciphertext sequence according to the first replacement rule to obtain a third ciphertext sequence, and sends the third ciphertext sequence to the server.

[0048] Specifically, when performing permutation according to the first permutation rule, the client may first construct a permutation matrix corresponding to the first permutation rule. For example, assuming that the second ciphertext sequence includes 5 elements, the first permutation rule is:

[0049] [1,2,3,4,5]->[4,5,2,1,3].

[0050] The first replacement rule may represent: mapping the first position in the sequence to the fourth position, mapping the second position to the fifth position, mapping the third position to the second position, mapping the fourth position to the first position, and mapping the fifth position to the third position. Mapping the first position to the fourth position means replacing the element at the first position to the fourth position.

[0051] A permutation matrix can be used to represent the operation of rearranging or transforming rows or columns in a matrix. It can be a square binary matrix with only one 1 in each row or column and the others are 0. Specifically, a permutation matrix can be a matrix obtained by swapping some rows or columns of the identity matrix. It can be understood that the identity matrix itself is a basic permutation matrix, which does not do any processing on the matrix.

[0052] Generally speaking, for any predetermined permutation rule, a permutation matrix corresponding thereto can be constructed. That is, the mapping between positions in the sequence is regarded as a row or column transformation. Among them, when the mapping between positions in the sequence is regarded as a row transformation, the permutation matrix corresponding to the first permutation rule can be the following matrix:

[0053]

[0054] It should be understood that the permutation matrix is ​​specifically obtained through the following steps: the mapping from the 1st position to the 4th position is regarded as the transformation from the 1st row to the 4th row in the unit matrix, the mapping from the 2nd position to the 5th position is regarded as the transformation from the 2nd row to the 5th row in the unit matrix, the mapping from the 3rd position to the 2nd position is regarded as the transformation from the 3rd row to the 2nd row, the mapping from the 4th position to the 1st position is regarded as the transformation from the 4th row to the 1st row, and the mapping from the 5th position to the 3rd position is regarded as the transformation from the 3rd row to the 3rd row.

[0055] In addition, when the mapping between positions in the sequence is regarded as a column transformation, the permutation matrix corresponding to the first predetermined permutation rule may be as follows:

[0056]

[0057] Continue to see Figure 2 ,exist Figure 2 In step 2 corresponding to the client shown, the client may select a first replacement rule π. The operation of selecting the replacement rule may be performed at any time before step 4 corresponding to the client, and there is no limitation on this.

[0058] In step 4 corresponding to the client, the client performs the second ciphertext sequence [C1, C2, ... C n ] to obtain the third ciphertext sequence [C1′, C2′, … C′ n ]:

[0059]

[0060] Among them, C π(1) It can represent the first element after permutation based on the first permutation rule π. Taking the first permutation rule π as [1,2,3,4,5]->[4,5,2,1,3] and the second ciphertext sequence as [C1,C2,C3,C4,C5] as an example, after permutation, "C4" originally at the 4th position is permuted to the 1st position, so the current element C at the 1st position is π(1) is C4, and the "C3" originally at the third position is replaced to the second position, so the element C at the current second position is π(2)The element "C5" originally at the 5th position is replaced at the 3rd position, so the element C at the current 3rd position is π(3) is C5, the "C1" originally at the 1st position is replaced to the 4th position, so the current element C at the 4th position π(4) The element C2, which was originally at the second position, is replaced at the fifth position, so the element C at the fourth position is π(5) is C2.

[0061] Afterwards, the client sends the third ciphertext sequence [C1′, C2′, … C′ n ] is sent to the server.

[0062] S109, the server may receive a third ciphertext sequence from the client, and based on the encryption algorithm, use the second key to decrypt the third ciphertext sequence sent by the client to obtain a fourth ciphertext sequence.

[0063] In this embodiment, the server can use the key obtained based on the encryption algorithm to decrypt the third ciphertext sequence to obtain the fourth ciphertext sequence. Afterwards, the server can store the fourth ciphertext sequence for information retrieval in the online stage.

[0064] See also Figure 2 ,exist Figure 2 In step 4 of the server side of the example shown, the server side can use key b to encrypt the third ciphertext sequence [C1′, C2′, … C′ n ] to obtain and store the fourth ciphertext sequence [A1, A2, ... A n ]:

[0065]

[0066] Assuming D = [keyword1, keyword2, keyword3, keyword4, keyword5], according to step 2 of the server, the first ciphertext sequence [B1, B2, B3, B4, B5] is obtained:

[0067] [B1,B2,B3,B4,B5]=[H(keyword1) b ,H(keyword2) b ,H(keyword3) b ,H(keyword4) b ,H(keyword5) b ].

[0068] According to step 3, the second ciphertext sequence [C1, C2, C3, C4, C5] is obtained:

[0069] [C1,C2,C3,C4,C5]=[H(keyword1) ba ,H(keyword2) ba ,H(keyword3) ba ,H(keyword4) ba ,H(keyword5) ba ].

[0070] Taking the first permutation rule [1,2,3,4,5]->[4,5,2,1,3] as an example, according to step 4 in the client, the third ciphertext sequence [C1′,C2′,C3′,C4′,C5′] is obtained:

[0071] [C′1, C′2, C′3, C′4, C′5]=[H(keyword4) ba ,H(keyword3) ba ,H(keyword5) ba ,H(keyword1) ba ,H(keyword2) ba ].

[0072] According to step 4 on the server side, the fourth ciphertext sequence [A1, A2, A3, A4, A5] is obtained:

[0073] [A1,A2,A3,A4,A5]=[H(keyword4) a ,H(keyword3) a ,H(keyword5) a ,H(keyword1) a ,H(keyword2) a ].

[0074] Obviously, the value of the item in the fourth ciphertext sequence stored in the server is equal to the value obtained by performing hash calculation on the keyword in the item of keyword sequence D and then encrypting it using the client's key a. Based on this, in the online stage, the ciphertext keyword encrypted by the client using key a can be used to locate the keyword in the fourth ciphertext sequence.

[0075] exist Figure 1 In the method shown, the online stage may include the following S1011-S1019, specifically:

[0076] S1011, the client uses the first key to perform encryption calculation on the target keyword based on the encryption algorithm, obtains the ciphertext keyword, and sends the ciphertext keyword to the server.

[0077] In this embodiment, the client can use the first key obtained based on the encryption algorithm to encrypt the target keyword to obtain the ciphertext keyword. In the case where the first ciphertext in the first ciphertext sequence is obtained by the server directly encrypting the keyword, the client can use the first key to directly encrypt the target keyword to obtain the ciphertext keyword. Here, the target keyword can be a keyword that the user wants to retrieve information. Afterwards, the client can send the ciphertext keyword to the server.

[0078] In some implementations, when the first ciphertext in the first ciphertext sequence is obtained by the server first performing a hash calculation on a keyword and then encrypting the hash calculation result using a private key, the client can generate the ciphertext keyword by following steps 1) and 2), specifically:

[0079] Step 1), the client performs hash calculation on the target keyword to obtain the target hash calculation result.

[0080] Step 2), the client uses the first private key to encrypt the target hash calculation result to obtain the ciphertext keyword.

[0081] exist Figure 2 In step 5 corresponding to the client shown in the figure, the client may first perform a hash calculation on the target keyword keyword, and then use the key a to encrypt the hash calculation result to obtain the ciphertext keyword A. Specifically, A=H(keyword) a After that, the client sends the ciphertext keyword A to the server.

[0082] S1013, the server receives the ciphertext keyword sent by the client.

[0083] S1015, the server matches the ciphertext keyword with each ciphertext in the fourth ciphertext sequence, and sends the position information corresponding to the ciphertext in the fourth ciphertext sequence that matches the ciphertext keyword (for example, the similarity is higher than a preset threshold) as the first position information to the client.

[0084] Here, the position in the first position information is encoded as plaintext information. Specifically, the first position information is the position of the ciphertext keyword in the fourth ciphertext sequence. For example, assuming that the ciphertext keyword matches the value in the fourth item in the fourth ciphertext sequence, the first position information may include 4.

[0085] Specifically, in Figure 2 In step 6 corresponding to the server shown in the figure, the server can compare the ciphertext keyword A with the pre-stored fourth ciphertext sequence [A1, A2, ... A n], and the position information of one or more ciphertexts in the fourth ciphertext sequence that match the ciphertext keyword A is used as the first position information. That is, the first position information may include multiple position codes, that is, T = (i|A i =A}. Here, the position in the first position information is encoded as plain text information. Afterwards, the server can send the first position information to the client.

[0086] In some implementations, the server may match the ciphertext keyword with each ciphertext in the fourth ciphertext sequence; based on the matching result, the position information corresponding to the ciphertext in the fourth ciphertext sequence that is the same as the ciphertext keyword is used as the first position information.

[0087] In some implementations, each piece of plaintext information in the first plaintext information sequence may correspond to one or more keywords, and the first position information may include a set of multiple pieces of position information in the fourth ciphertext sequence that match the ciphertext keywords.

[0088] S1017, the client receives the first position information sent by the server for the ciphertext keyword.

[0089] S1019: The client replaces the plaintext sequence corresponding to the first position information based on the second replacement rule to obtain the second position information in the first plaintext information sequence corresponding to the target keyword.

[0090] Here, the second replacement rule corresponds to the inverse operation of the first replacement rule. The second position information is the real position information of the target keyword in the server database.

[0091] exist Figure 2 In step 7 corresponding to the client shown in the figure, the client can perform the following operations based on the second permutation rule π -1 , replace the plaintext sequence corresponding to the first position information to obtain the second position information in the first plaintext sequence corresponding to the target keyword keyword. Here, the second replacement rule π -1 Corresponding to the inverse operation of the first permutation rule π. Thus, the second position information can be calculated by the following formula: i′=π -1 (i), i∈T. Here, the second position information is the positioning result of the positioning keyword, and the positioning result is the real position information of the target keyword keyword in the first plaintext information sequence in the server database.

[0092] Continuing with the example of the first permutation rule π being [1,2,3,4,5]->[4,5,2,1,3], that is, the first position is mapped to the fourth position, the second position is mapped to the fifth position, the third position is mapped to the second position, the fourth position is mapped to the first position, and the fifth position is mapped to the third position.

[0093] Then, the second permutation rule π -1 It can be [4,5,2,1,3]->[1,2,3,4,5], which is used to implement the reverse operation of the first permutation rule π, that is, mapping the 4th position to the 1st position, the 5th position to the 2nd position, the 2nd position to the 3rd position, the 1st position to the 4th position, and the 3rd position to the 5th position. -1 The corresponding permutation matrix M -1 It is the inverse matrix of the permutation matrix M corresponding to the first permutation rule π, that is, the transposed matrix of the matrix M.

[0094] For example, for the above permutation matrix The second permutation rule π -1 The corresponding transposed matrix

[0095]

[0096] By the second permutation rule π -1 The second position information can be obtained by permuting the first position information. For example, assuming that the first position information i is the 4th position, that is, i=4, and the fourth ciphertext sequence includes 5 elements, then a unique hot vector [0,0,0,1,0] can be constructed with the 4th element being 1 and the other elements being 0, and then the second permutation rule π is used. -1 The corresponding permutation matrix transforms the elements in the one-hot vector [0,0,0,1,0]. Due to the second permutation rule π -1 It is used to map the 4th position to the 1st position. Therefore, after the position transformation, the second position information j is the 1st position, that is, j = 1. Specifically, the second position information j can be calculated as follows:

[0097] In some implementations, Figure 1 After the method shown locates the second location information, information retrieval can also be performed based on the second location information, which can specifically include the following steps 1) to 4), specifically:

[0098] Step 1), the client performs a private information search on the first plaintext information sequence in the server based on the second location information and the private information search technology.

[0099] In this implementation, index-based private information retrieval (PIR by index) can be used for retrieval. Here, index-based private information retrieval is a technology that allows users to secretly obtain data items corresponding to a specified index from a server database without leaking the index itself. Among them, the index may contain location information of the data item. The specific implementation method of index-based private information retrieval can rely on modern cryptographic technologies, such as homomorphic encryption (HE), oblivious transfer (OT), etc. Taking homomorphic encryption as an example, the server can use homomorphic encryption technology to encrypt each plaintext information in the first plaintext information sequence, and the encrypted information is stored on the server to form an encrypted database. Afterwards, the client can use homomorphic encryption technology to encrypt the second location information, generate an encrypted retrieval request, and send the encrypted retrieval request to the server.

[0100] Step 2), the server receives the search request sent by the client.

[0101] Step 3), the server performs a private information search on the first plaintext information sequence according to the search request, and sends the search result to the client.

[0102] Continuing with homomorphic encryption as an example, due to homomorphic encryption, the server can perform information retrieval on the encrypted database based on the encrypted retrieval request without decrypting the retrieval request to obtain the retrieval result. Here, the retrieval result is the encrypted data item in the encrypted database.

[0103] Step 4), the client receives the search result fed back by the server for the private information search.

[0104] Here, after the client receives the search results fed back by the server, it can use homomorphic encryption to decrypt the encrypted data items in the search results, thereby obtaining the final plaintext search results. Through this implementation, after locating the real location information of the target keyword in the server database, further private information retrieval can be performed based on the real location information.

[0105] According to another embodiment, a device for locating a keyword in a database is provided. The device for locating a keyword in a database may be deployed on a client.

[0106] Figure 3 FIG. 1 is a schematic block diagram of an apparatus for locating keywords in a database according to an embodiment. Figure 3As shown, the device 300 for locating keywords in a database may include: a first encryption unit 301, configured to, in the preparation stage: according to a preset encryption algorithm, use a first key to encrypt multiple first ciphertexts in a first ciphertext sequence sent by a server to obtain a second ciphertext sequence, wherein the first ciphertext sequence is obtained by the server using a second key to encrypt the keywords in each item of the keyword sequence according to the encryption algorithm, the multiple items in the keyword sequence correspond to multiple plaintext information in the first plaintext information sequence, each item in the keyword sequence includes the keyword in the plaintext information corresponding to the item, and the encryption algorithm is an exchangeable encryption algorithm; a first replacement unit 302, configured to replace the position of each element in the second ciphertext sequence according to a first replacement rule to obtain a third ciphertext sequence, and send the third ciphertext sequence to the server. , so that the server uses the second key to decrypt the third ciphertext sequence based on the encryption algorithm to obtain a fourth ciphertext sequence; the second encryption unit 303 is configured to: in the online stage: based on the encryption algorithm, use the first key to encrypt and calculate the target keyword to obtain the ciphertext keyword, and send the ciphertext keyword to the server; the sending unit 304 is configured to receive the first position information sent by the above-mentioned server for the above-mentioned ciphertext keyword, wherein the above-mentioned first position information is the position information in the above-mentioned fourth ciphertext sequence that matches the above-mentioned ciphertext keyword; the second replacement unit 305 is configured to replace the plaintext sequence corresponding to the above-mentioned first position information based on the second replacement rule to obtain the second position information in the above-mentioned first plaintext information sequence corresponding to the above-mentioned target keyword, and the above-mentioned second replacement rule corresponds to the inverse operation of the above-mentioned first replacement rule.

[0107] In some optional implementations of this embodiment, the above-mentioned device 300 also includes: a retrieval unit (not shown in the figure), configured to perform privacy information retrieval on the above-mentioned first plaintext information sequence in the above-mentioned server based on the above-mentioned second location information and privacy information retrieval technology; a result receiving unit (not shown in the figure), configured to receive the retrieval result fed back by the above-mentioned server for the privacy information retrieval.

[0108] In some optional implementations of this embodiment, the first ciphertext sequence is generated by the server in the following manner: performing hash calculations on the keywords in each item of the keyword sequence to obtain hash calculation results of the keywords corresponding to each item; and using the second key to encrypt the hash calculation results corresponding to each item to obtain the first ciphertext sequence.

[0109] In some optional implementations of this embodiment, the second encryption unit 303 is further configured to: perform hash calculation on the target keyword to obtain a target hash calculation result; and use the first key to perform encryption calculation on the target hash calculation result to obtain a ciphertext keyword.

[0110] In some optional implementations of the present embodiment, the first position information is obtained by the server in the following manner: matching the ciphertext keyword with each ciphertext in the fourth ciphertext sequence; and based on the matching result, taking the position information corresponding to the ciphertext in the fourth ciphertext sequence that is the same as the ciphertext keyword as the first position information.

[0111] In some optional implementations of this embodiment, each piece of plaintext information in the first plaintext information sequence corresponds to one or more keywords, and the first position information includes a set of multiple position information in the fourth ciphertext sequence that matches the ciphertext keywords.

[0112] According to another embodiment, another device for locating a keyword in a database is provided. The device for locating a keyword in a database may be deployed on a server.

[0113] Figure 4 FIG. 4 is a schematic block diagram of an apparatus for locating keywords in a database according to another embodiment. Figure 4As shown, the device 400 for locating keywords in a database may include: an encryption calculation unit 401, configured to, in a preparation stage: according to a preset encryption algorithm, use a second key to encrypt the keywords in each item of the keyword sequence to obtain a first ciphertext sequence, wherein the multiple items in the keyword sequence correspond to multiple plaintext information in the first plaintext information sequence, respectively, and each item in the keyword sequence includes the keyword in the plaintext information corresponding to the item, and the encryption algorithm is an exchangeable encryption algorithm; a sequence sending unit 402, configured to send the above-mentioned first ciphertext sequence to a client; a sequence receiving unit 403, configured to receive a third ciphertext sequence from the client, and the third ciphertext sequence is obtained by the client through the following steps: based on the encryption algorithm, use the first key to encrypt multiple first ciphertext sequences in the first ciphertext sequence The first ciphertext sequence is encrypted respectively to obtain a second ciphertext sequence, and the position of each element in the second ciphertext sequence is permuted according to the first permutation rule; the decryption unit 404 is configured to, based on the encryption algorithm, use the second key to decrypt the third ciphertext sequence sent by the client to obtain a fourth ciphertext sequence; the ciphertext keyword receiving unit 405 is configured to, in the online stage: receive the ciphertext keyword sent by the client, wherein the ciphertext keyword is obtained by the client encrypting and calculating the target keyword based on the encryption algorithm using the first key; the matching unit 406 is configured to match the above-mentioned ciphertext keyword with each ciphertext in the above-mentioned fourth ciphertext sequence, and send the position information corresponding to the ciphertext in the above-mentioned fourth ciphertext sequence that matches the above-mentioned ciphertext keyword as the first position information to the above-mentioned client.

[0114] In some optional implementations of the present embodiment, the device 400 further includes: a retrieval request receiving unit (not shown in the figure), configured to receive a retrieval request sent by the client, wherein the retrieval request is sent by the client based on the second location information and privacy information retrieval technology; a retrieval result sending unit (not shown in the figure), configured to perform a privacy information retrieval on the first plaintext information sequence according to the retrieval request, and send the retrieval result to the client.

[0115] In some optional implementations of this embodiment, the encryption calculation unit 401 is further configured to: perform hash calculation on the keywords in each item of the keyword sequence to obtain hash calculation results of the keywords corresponding to each item; use the second key to encrypt the hash calculation results corresponding to each item to obtain the first ciphertext sequence.

[0116] In some optional implementations of this embodiment, the above-mentioned ciphertext keyword is generated by the above-mentioned client in the following manner: performing hash calculation on the above-mentioned target keyword to obtain a target hash calculation result; using the above-mentioned first key to encrypt the above-mentioned target hash calculation result to obtain the ciphertext keyword.

[0117] In some optional implementations of this embodiment, each piece of plaintext information in the first plaintext information sequence corresponds to one or more keywords, and the first position information includes a set of multiple position information in the fourth ciphertext sequence that matches the ciphertext keywords.

[0118] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0119] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0120] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present application does not exclude that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0121] Although one or more embodiments of the present specification provide method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific order.

[0122] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more of the present specification, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0123] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0124] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0126] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0127] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0128] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0129] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0130] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0131] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction.

[0132] The above description is only an example of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. For those skilled in the art, one or more embodiments of the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims.

Claims

1. A method for locating keywords in a database, executed by a client, include: Preparation stage: according to a preset encryption algorithm, a plurality of first ciphertexts in a first ciphertext sequence sent by the server are encrypted respectively using a first key to obtain a second ciphertext sequence, wherein the first ciphertext sequence is obtained by the server using a second key to encrypt a keyword in each item of a keyword sequence according to the encryption algorithm, the plurality of items in the keyword sequence correspond to a plurality of plaintext information in the first plaintext information sequence, each item in the keyword sequence includes a keyword in the plaintext information corresponding to the item, and the encryption algorithm is an exchangeable encryption algorithm; Permuting the position of each element in the second ciphertext sequence according to the first permutation rule to obtain a third ciphertext sequence, and sending the third ciphertext sequence to the server, so that the server decrypts the third ciphertext sequence using the second key based on the encryption algorithm to obtain a fourth ciphertext sequence; Online stage: using the first key to perform encryption calculation on the target keyword to obtain a ciphertext keyword, and sending the ciphertext keyword to the server; Receiving first position information sent by the server for the ciphertext keyword, wherein the first position information is position information matching the ciphertext keyword in the fourth ciphertext sequence; The plaintext sequence corresponding to the first position information is replaced based on a second replacement rule to obtain second position information in the first plaintext information sequence corresponding to the target keyword, wherein the second replacement rule corresponds to an inverse operation of the first replacement rule.

2. The method according to claim 1, in, The method further comprises: Based on the second location information and the privacy information retrieval technology, perform privacy information retrieval on the first plaintext information sequence in the server; Receive the search result fed back by the server for the private information search.

3. The method according to claim 1, in, The first ciphertext sequence is generated by the server in the following manner: Performing hash calculations on the keywords in each item of the keyword sequence to obtain hash calculation results of the keywords corresponding to each item; The hash calculation results corresponding to each item are encrypted using the second key to obtain the first ciphertext sequence.

4. The method according to claim 3, in, The step of performing encryption calculation on the target keyword using the first key based on the encryption algorithm includes: Performing hash calculation on the target keyword to obtain a target hash calculation result; The target hash calculation result is encrypted using the first key to obtain a ciphertext keyword.

5. The method according to claim 1, in, The first location information is obtained by the server in the following manner: Matching the ciphertext keyword with each ciphertext in the fourth ciphertext sequence; According to the matching result, position information corresponding to the ciphertext identical to the ciphertext keyword in the fourth ciphertext sequence is used as the first position information.

6. The method according to claim 1, in, Each piece of plaintext information in the first plaintext information sequence corresponds to one or more keywords, and the first position information includes a set of multiple pieces of position information in the fourth ciphertext sequence that match the ciphertext keywords.

7. A method for locating a keyword in a database, executed by a server, include: Preparation stage: according to a preset encryption algorithm, the keywords in each item of the keyword sequence are encrypted using the second key to obtain a first ciphertext sequence, wherein the multiple items in the keyword sequence correspond to the multiple plaintext information in the first plaintext information sequence, and each item in the keyword sequence includes the keyword in the plaintext information corresponding to the item, and the encryption algorithm is a commutative encryption algorithm; Sending the first ciphertext sequence to the client; receiving a third ciphertext sequence from the client, wherein the third ciphertext sequence is obtained by the client through the following steps: based on the encryption algorithm, using a first key to encrypt a plurality of first ciphertexts in the first ciphertext sequence to obtain a second ciphertext sequence, and replacing a position of each element in the second ciphertext sequence according to a first replacement rule; Based on the encryption algorithm, using the second key to decrypt the third ciphertext sequence sent by the client to obtain a fourth ciphertext sequence; Online stage: receiving a ciphertext keyword sent by the client, wherein the ciphertext keyword is obtained by the client using the first key to encrypt the target keyword based on the encryption algorithm; The ciphertext keyword is matched with each ciphertext in the fourth ciphertext sequence, and position information corresponding to the ciphertext in the fourth ciphertext sequence that matches the ciphertext keyword is sent to the client as first position information.

8. The method according to claim 7, in, The method further comprises: receiving a retrieval request sent by the client, wherein the retrieval request is sent by the client based on the second location information and privacy information retrieval technology; According to the retrieval request, the first plaintext information sequence is retrieved for private information, and the retrieval result is sent to the client.

9. The method according to claim 7, in, The step of using the second key to encrypt the keyword in each item of the keyword sequence to obtain a first ciphertext sequence includes: Performing hash calculations on the keywords in each item of the keyword sequence to obtain hash calculation results of the keywords corresponding to each item; The hash calculation results corresponding to each item are encrypted using the second key to obtain the first ciphertext sequence.

10. The method according to claim 9, in, The ciphertext keyword is generated by the client in the following manner: Performing hash calculation on the target keyword to obtain a target hash calculation result; The target hash calculation result is encrypted using the first key to obtain a ciphertext keyword.

11. The method according to claim 7, in, Each piece of plaintext information in the first plaintext information sequence corresponds to one or more keywords, and the first position information includes a set of multiple pieces of position information in the fourth ciphertext sequence that match the ciphertext keywords.

12. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.

13. A computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 11 is implemented.