A Ciphertext Retrieval Method and System Based on Homomorphic Encryption
By constructing an inverted index table on the server side and using homomorphic encryption computation, a method to improve data retrieval security without increasing computational complexity is realized. This solves the problems of high retrieval accuracy and high computational complexity in existing technologies, and improves the security and efficiency of data retrieval.
Patent Information
- Application Number
- CN202511535090.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-10-27
AI Technical Summary
Existing homomorphic encryption retrieval technologies suffer from high retrieval accuracy and computational complexity in commercial applications, making it difficult to improve the security of the data retrieval process without significantly increasing computational complexity.
A ciphertext retrieval method based on homomorphic encryption is adopted. By constructing an inverted index table on the server side and using homomorphic computation, the client generates ciphertext retrieval information, the server performs homomorphic computation and returns the result, and the client decrypts it, thus improving the security and efficiency of the data retrieval process.
Without increasing computational complexity, it significantly improves the security of the data retrieval process, reduces resource consumption, and can be seamlessly integrated with existing encryption protocols to meet a variety of application needs.
Smart Images

Figure CN121009583B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data security technology, and more specifically to a ciphertext retrieval method and system based on homomorphic encryption. Background Technology
[0002] With the booming development of cloud computing and data outsourcing services, data owners often need to store massive amounts of sensitive data on third-party servers (such as public clouds). However, this model brings serious privacy and security challenges. While traditional encryption technologies can protect the security of data at rest, once a retrieval or computation is needed, the data must be decrypted, thus exposing the original information and posing a significant privacy risk. To resolve this contradiction, encrypted retrieval technology has emerged, but early solutions such as keyword-based search encryption have limited functionality, cannot support complex computational logic, and are difficult to protect the client's retrieval information.
[0003] The breakthrough development of homomorphic encryption technology has changed this situation. Homomorphic encryption allows algebraic operations to be performed directly on ciphertext, and the result of the operation, after decryption, is consistent with the result of performing the same operation on the plaintext. This means that third parties can perform complex operations such as retrieval, statistics, and even machine learning on encrypted data without obtaining the plaintext, truly realizing the security paradigm of "data usable but not visible".
[0004] Currently, mainstream homomorphic encryption retrieval technologies often use polynomials for implementation, which results in high retrieval accuracy and computational complexity, making it difficult to apply in commercial fields.
[0005] Therefore, significantly improving the security of the data retrieval process without significantly increasing computational complexity is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] In view of this, the present invention provides a ciphertext retrieval method and system based on homomorphic encryption, which can significantly improve the security of the data retrieval process without significantly increasing computational complexity.
[0007] To achieve the above objectives, the present invention adopts the following technical solution:
[0008] In a first aspect, the present invention provides a ciphertext retrieval method based on homomorphic encryption, comprising the following steps:
[0009] S1. The server loads the client's user data into the trusted environment, completing the initialization process;
[0010] S2. The server performs hash calculations based on the keywords in the user data, constructs an inverted index table based on the hash values of the keywords and the sequence number of the user data, and encrypts the user data.
[0011] S3. The client encrypts the plaintext search information, generates ciphertext search information, and sends it to the server.
[0012] S4. The server uses the keyword hash value in the inverted index table as an index to extract the ciphertext retrieval information, performs homomorphic computation, obtains the ciphertext retrieval result, and returns it to the client.
[0013] S5. The client decrypts the encrypted search results.
[0014] Furthermore, S1 includes: interaction between the server and client, sending authentication information, and completing identity authentication between the two parties; the server will transfer user data. Loaded into a trusted environment, the initialization process is completed, including... Indicates the sequence number of the user data. This represents user data, assuming there is... One user data, then .
[0015] Furthermore, S2 includes:
[0016] S21. The server uses a keyword extractor to extract keywords from user data. And perform hashing Each piece of user data Each set of data can extract at least one keyword, and different user data can extract the same keyword. Assuming there are M keywords, then... ;
[0017] S22. The server constructs an inverted index table using the hash values of the keywords and the user data sequence numbers, represented as follows: In the inverted index table, the hash value of a keyword corresponds to at least one user sequence number, and the hash value... Represented using any number base;
[0018] S23. The server uses a symmetric encryption algorithm to encrypt user data one by one in a trusted environment, and saves the data to the database one by one according to the user data sequence number, so that the ciphertext and sequence number of the user data remain consistent.
[0019] Furthermore, S3 includes:
[0020] S31. The client generates the basic parameters for homomorphic encryption, including the encryption key and the decryption key;
[0021] S32. The client performs a hash calculation on the plaintext retrieval information q to obtain the hash value. and hash value Encoded as hash value in S22 Strings of the same base; construct ciphertext retrieval information Q using the encoded string as an index;
[0022] S33. The client sends the encrypted retrieval information Q to the server.
[0023] Furthermore, S4 includes:
[0024] S41. The server uses the hash values of each keyword in the inverted index table. Using each character as an index, select the ciphertext of the corresponding column in the ciphertext retrieval information Q, perform homomorphic multiplication to obtain the hash value of the corresponding keyword. Calculation results , ;
[0025] S42. Calculate the encrypted retrieval results based on the hash values of all keywords: ,in, , and This represents the ciphertext value obtained after homomorphically encrypting the numbers 1, 2, and M. This represents homomorphic addition in homomorphic computation;
[0026] S43. Extract the encrypted search results. Return to the client.
[0027] Furthermore, in S5, the client uses the decryption key to retrieve the encrypted results. Decryption is performed to obtain the plaintext search results. If the result is 0, it means that the encrypted search content does not exist in the database; if the result is not 0, it means that the encrypted search content exists in the database, and the decryption result is the row number j of the corresponding keyword hash value in the inverted index table.
[0028] Furthermore, in S5, after the client decrypts the row number j corresponding to the keyword hash value, it obtains the sequence number of the corresponding user data through j, and then obtains the user data based on the sequence number of the user data.
[0029] Secondly, the present invention provides a ciphertext retrieval system based on homomorphic encryption, which is applicable to the aforementioned ciphertext retrieval method based on homomorphic encryption, comprising:
[0030] The initialization module is used to load the client's user data into the trusted environment on the server side and complete the initialization process.
[0031] The data encryption module is used on the server side to perform hash calculations based on keywords in user data, construct an inverted index table based on the hash value of the keywords and the sequence number of the user data, and encrypt the user data.
[0032] The retrieval information encryption module is used to encrypt plaintext retrieval information on the client side, generate ciphertext retrieval information, and send it to the server side.
[0033] The encrypted retrieval module is used on the server side to extract encrypted retrieval information by using the keyword hash value in the inverted index table as an index, then performing homomorphic computation to obtain the encrypted retrieval results and returning them to the client.
[0034] The decryption module is used to decrypt the encrypted search results on the client side.
[0035] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, when the processor executes the computer program, it implements the steps of the homomorphic encryption-based ciphertext retrieval method as described above.
[0036] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the homomorphic encryption-based ciphertext retrieval method described above.
[0037] As can be seen from the above technical solution, compared with the prior art, the present invention has the following beneficial effects:
[0038] 1. Enhanced Security: The server-side uses an inverted index table to protect user data, preventing attackers from obtaining any original user data through ciphertext and the index table. The client-side uses homomorphic encryption to ensure the security of retrieval information, and the search results are only visible to the client user who performed the search.
[0039] 2. Computational efficiency and resource consumption: Compared with polynomial fitting to achieve encrypted retrieval, this scheme greatly reduces the computational complexity of encrypted text in the retrieval process.
[0040] 3. Flexibility and Compatibility: This invention can be seamlessly integrated with existing encryption protocols and systems, adapting to a variety of application needs. Whether used alone or as an enhancement to existing encryption systems, the obfuscated modulo component method can be flexibly applied to various data protection requirements. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0042] Figure 1The flowchart shows the ciphertext retrieval method based on homomorphic encryption provided by the present invention. Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] like Figure 1 As shown in the figure, an embodiment of the present invention discloses a ciphertext retrieval method based on homomorphic encryption, comprising the following steps:
[0045] S1. The server loads the client's user data into the trusted environment, completing the initialization process;
[0046] S2. The server performs hash calculations based on the keywords in the user data, constructs an inverted index table based on the hash values of the keywords and the sequence number of the user data, and encrypts the user data.
[0047] S3. The client encrypts the plaintext search information, generates ciphertext search information, and sends it to the server.
[0048] S4. The server uses the keyword hash value in the inverted index table as an index to extract the ciphertext retrieval information, performs homomorphic computation, obtains the ciphertext retrieval result, and returns it to the client.
[0049] S5. The client decrypts the encrypted search results.
[0050] The following is a further explanation of each of the above steps.
[0051] S1. Initialization Steps: The server and client interact, sending authentication information to complete the authentication process; the server then processes the user data. Loaded into a trusted environment, the initialization process is completed, including... Indicates the sequence number of the user data. This represents user data, assuming there is... One user data, then .
[0052] S2. Server-side encryption of user data:
[0053] S21. The server uses a keyword extractor to extract keywords from user data. And perform hashing Each piece of user data Each set of data can extract at least one keyword, and different user data can extract the same keyword. Assuming there are M keywords, then... ;
[0054] S22. The server constructs an inverted index table using the hash values of the keywords and the user data sequence numbers, represented as follows: In the inverted index table, the hash value of a keyword corresponds to at least one user sequence number, and the hash value... Representation is in any number base. The keywords extracted from user data corresponding to each user ID can be the same; therefore, the hash value of a keyword in the inverted index table can have multiple user IDs, and these hash values... It can be represented in any number base, which determines the encrypted retrieval information generated by the user client. Here, we can set it to hexadecimal and store it in the database as a string.
[0055] S23. The server uses a symmetric encryption algorithm to encrypt user data one by one in a trusted environment, and saves the data to the database one by one according to the user data sequence number, so that the ciphertext and sequence number of the user data remain consistent.
[0056] S3, client-side encrypted information retrieval:
[0057] S31. The client generates basic parameters for homomorphic encryption, such as selecting a homomorphic encryption algorithm, setting encryption and decryption keys, and determining the form of the ciphertext to be retrieved based on the settings in S22.
[0058] S32. The client performs a hash calculation on the plaintext retrieval information q to obtain the hash value. and hash value Encoded as hash value in S22 Strings of the same base; construct the ciphertext retrieval information Q, for example, in hexadecimal. Each character serves as an index to determine which position in the ciphertext retrieval information Q is ciphertext 1, and the remaining positions are set to ciphertext 0. The ciphertext retrieval information Q is represented as:
[0059]
[0060] The number of lines and hash value of the encrypted information Q. The string lengths are consistent, and the number of columns and the set base are consistent; here and These represent ciphertext 0 and ciphertext 1 generated using the encryption key of the homomorphic encryption algorithm. Homomorphic encryption is a probabilistic encryption, so people who do not possess the key cannot distinguish which position in Q is ciphertext 0 or ciphertext 1. It can be seen that the number of rows in Q is the same as the string length of the hash value, and the number of columns is the same as the set base.
[0061] S33. The client sends the encrypted retrieval information Q to the server.
[0062] S4. The server performs encrypted text retrieval:
[0063] S41. The server uses the hash values of each keyword in the inverted index table. Using each character as an index, select the ciphertext of the corresponding column in the ciphertext retrieval information Q, perform homomorphic multiplication to obtain the hash value of the corresponding keyword. Calculation results , .
[0064] For example, the first hash value in the inverted index table The second hash value The third hash value Then, for each character in the first hash value, the corresponding ciphertext of each line in Q is extracted, and the following calculation is performed:
[0065]
[0066] in, This represents the ciphertext value in the first row and second column of Q. This represents the ciphertext value in the second row and third column of Q. This represents the ciphertext value in the third row and second column of Q. This represents the ciphertext value in the fourth row and eleventh column of Q. This represents the ciphertext value in the fifth row and twelfth column of Q. The ciphertext values in the sixth row and eleventh column of Q are represented respectively. This represents homomorphic multiplication in homomorphic computation.
[0067] S42. Calculate the encrypted retrieval results based on the hash values of all keywords: ,in, , and This represents the ciphertext value obtained after homomorphically encrypting the numbers 1, 2, and M. This represents homomorphic addition in homomorphic computation;
[0068] S43. Extract the encrypted search results. Return to the client.
[0069] S5. Client-side decryption: The client uses the decryption key to retrieve the encrypted results. Decryption yields the plaintext search results. If the result is 0, it means the encrypted search content does not exist in the database; if the result is not 0, it means the encrypted search content exists in the database, and the decryption result is the row number j of the corresponding keyword hash value in the inverted index table. Here, j has a range of... Once the client decrypts the row number j corresponding to the keyword hash value, it obtains the sequence number of the corresponding user data through j, and then retrieves the user data based on the sequence number of the user data.
[0070] In one embodiment, the present invention also provides a ciphertext retrieval system based on homomorphic encryption, which is applicable to the above-described method and includes:
[0071] The initialization module is used to load the client's user data into the trusted environment on the server side and complete the initialization process.
[0072] The data encryption module is used on the server side to perform hash calculations based on keywords in user data, construct an inverted index table based on the hash value of the keywords and the sequence number of the user data, and encrypt the user data.
[0073] The retrieval information encryption module is used to encrypt plaintext retrieval information on the client side, generate ciphertext retrieval information, and send it to the server side.
[0074] The encrypted retrieval module is used on the server side to extract encrypted retrieval information by using the keyword hash value in the inverted index table as an index, then performing homomorphic computation to obtain the encrypted retrieval results and returning them to the client.
[0075] The decryption module is used to decrypt the encrypted search results on the client side.
[0076] In other embodiments, the present invention also provides a computer device, including: a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the processor executes the computer program, it implements the steps of the homomorphic encryption-based ciphertext retrieval method as described above.
[0077] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the homomorphic encryption-based ciphertext retrieval method described above.
[0078] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0079] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0080] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A homomorphic encryption based ciphertext retrieval method, characterized by, The method comprises the following steps: S1, the server loads the user data of the client into a trusted environment and completes an initialization process; S2, the server calculates a keyword hash value of the user data, constructs an inverted index table according to the keyword hash value and the serial number of the user data, and encrypts the user data; S2 comprises: S21, the server end uses a keyword extractor to extract keywords in the user data and do hash wherein each piece of user data can extract at least one keyword, and allows different user data to extract the same keyword, assuming there are M keywords, ; S22, the server constructs the hash value of the keyword and the user data sequence number as an inverted index table, denoted as: The hash value of a keyword in the inverted index table corresponds to at least one user sequence number, and the hash value is represented in any base. S23, the server encrypts the user data in the trusted environment using a symmetric encryption algorithm, and saves the user data into a database according to the serial number of the user data, so that the ciphertext of the user data and the serial number correspond to each other; S3, the client encrypts the plaintext search information to generate ciphertext search information and sends it to the server; S4, the server extracts the ciphertext search information using the keyword hash value in the inverted index table as an index, performs homomorphic calculation, obtains ciphertext search results, and returns them to the client; S4 comprises: S41, the server side uses each keyword hash value in the inverted index table of each character as an index, selects the ciphertext corresponding to the column in the ciphertext retrieval information Q, performs homomorphic multiplication calculation, and obtains the calculation result of the corresponding keyword hash value , ; S42, calculating the ciphertext search result according to the calculation result of all keyword hash values: wherein, , and represent ciphertext values obtained after homomorphic encryption of the numbers 1, 2 and M, represents homomorphic addition in homomorphic calculation; S43, retrieve the ciphertext result Return to the client; S5, the client decrypts the ciphertext search results.
2. The homomorphic encryption based ciphertext retrieval method according to claim 1, characterized in that, S1 comprises: The server and the client interact, send identity authentication information, and complete identity authentication of both parties; The server side loads the user data into the trusted environment, completes the initialization process, wherein, the serial number of the user data is represented, the user data is represented, assuming that there are user data, then .
3. The homomorphic encryption based ciphertext retrieval method of claim 1, wherein S3 Comprises: S31, the client generates homomorphic encryption basic parameters, including an encryption key and a decryption key; S32, the client hashes the search information q in plain text to obtain a hash value and encodes the hash value into a string in the same radix as the hash value in S22; and constructs the ciphertext search information Q using the encoded string as an index. S33, the client sends the ciphertext search information Q to the server. 4.The homomorphic encryption based ciphertext retrieval method of claim 1, wherein, In S5, the client uses the decryption key to decrypt the ciphertext search result decrypts the ciphertext search result to obtain the plaintext search result. If the result is 0, it indicates that the content of the current ciphertext search does not exist in the database. If the result is not 0, it indicates that the content of the current ciphertext search exists in the database, and the decryption result is the row number j of the corresponding keyword hash value in the inverted index table.
5. The homomorphic encryption based ciphertext retrieval method of claim 4, wherein, In S5, when the client decrypts the keyword hash value corresponding to the row number j, the serial number of the corresponding user data is obtained through j, and the user data is obtained according to the serial number of the user data.
6. A homomorphic encryption based ciphertext retrieval system, characterized by, It is applicable to the ciphertext search method based on homomorphic encryption as claimed in any one of claims 1-5, comprising: An initialization module for realizing that the server loads the user data of the client into a trusted environment and completes an initialization process; A data encryption module for calculating a keyword hash value of the user data according to the user data on the server, constructing an inverted index table according to the keyword hash value and the serial number of the user data, and encrypting the user data; A search information encryption module for encrypting the plaintext search information on the client to generate ciphertext search information and sending it to the server; A ciphertext search module for extracting the ciphertext search information using the keyword hash value in the inverted index table as an index on the server, performing homomorphic calculation, obtaining ciphertext search results, and returning them to the client; A decryption module for decrypting the ciphertext search results on the client.
7. A computer device comprising: A memory and a processor, the memory stores a computer program executable on the processor, characterized in that the processor executes the computer program to realize the steps of the ciphertext search method based on homomorphic encryption as claimed in any one of claims 1-5.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the ciphertext search method based on homomorphic encryption as claimed in any one of claims 1-5.
Citation Information
Patent Citations
Searchable encryption method for hiding search mode and access mode in e-commerce platform
CN112270006A
Keyword batch privacy information retrieval method and system based on full homomorphism
CN117520367A