Lightweight fully homomorphic encryption method suitable for database encryption
By employing fully homomorphic encryption algorithms and modular computation, this method resolves the conflict between data security and efficient retrieval in database encryption, achieving efficient data security control and retrieval in open network environments. It is a lightweight fully homomorphic encryption method suitable for database encryption.
Patent Information
- Application Number
- CN202511783099.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-30
- Publication Date
- 2026-03-20
AI Technical Summary
Existing database encryption methods, while ensuring data security, cannot efficiently retrieve data, especially in multi-party data collaborations, where they cannot achieve efficient retrieval and computation of encrypted databases.
It employs a fully homomorphic encryption algorithm to generate public-private key pairs, and uses encryption and decryption modules to encrypt and decrypt keyword fields in SQL statements. It also combines addition, multiplication, and size comparison modules to perform homomorphic calculations, thereby achieving secure control and efficient retrieval of encrypted data.
It achieves efficient data security control and retrieval in encrypted databases in an open network environment with low computational overhead and high speed, meeting the needs of multi-party data collaboration.
Smart Images

Figure CN121706112A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a lightweight fully homomorphic encryption method suitable for database encryption, belonging to the field of computer information security technology. Background Technology
[0002] In today's information age, data has become the most valuable resource. For individuals, data serves as a record and record, such as photos and videos. For organizations, large amounts of data can help make better decisions; for example, travel companies can plan better routes for users. Data is an integral part of people's daily lives, and it is usually stored centrally. Many companies offer cloud storage technology, which allows users to store their data in the cloud; its essence is database storage technology. Storing personal or corporate data, especially private data, on third-party servers is not secure. The numerous data breaches in recent years have made people pay more attention to data security, and the security of databases as storage media has also received widespread attention.
[0003] Databases, as data storage media, contain massive amounts of data. Faced with various network attacks and security threats, traditional authentication mechanisms alone are no longer sufficient to protect user data security. Many scholars have begun to research methods to improve data security. Among numerous research techniques, encrypted data storage has become the most direct and effective means. Data encryption involves encrypting a meaningful plaintext sequence into a meaningless ciphertext sequence using an encryption algorithm and key. Even if an attacker obtains the ciphertext information, without the decryption key and an unknown encryption algorithm, they cannot obtain any useful information about the original data. This method greatly improves the security of user data.
[0004] Encrypted data storage can solve security issues, but as information, data is subject to random access, meaning it can be accessed by users at any time. Before encryption, data inherently possesses many attributes, such as the comparability and order of numerical data, and the presence of keywords in character data. These attributes support numerous retrieval methods for plaintext data. Encryption disrupts these original attributes, making many operations performed directly on plaintext data impossible to perform on ciphertext, thus hindering ciphertext retrieval. For users, data retrieval is an essential operation, such as retrieving personal photos from the internet or matching website passwords. Inefficient retrieval is unacceptable. Therefore, providing efficient retrieval services while ensuring user data security is of significant research importance.
[0005] In multi-party data collaborations, data providers often cannot provide detailed data but can offer statistical data. For example, Organization A has information on a freight company's fleet, while Organization B has highway data for all trucks. If they want to know the operational status of a freight company's fleet (e.g., the annual mileage of all trucks in a fleet), Organizations A and B need to conduct joint data analysis. However, Organization B cannot provide Organization A with the mileage or other data for each truck, and Organization A cannot provide Organization B with the detailed license plate numbers of the trucks in its fleet. In this scenario, an encrypted database retrieval system can be used. For instance, Organization B encrypts and stores the truck data, Organization A obtains the encrypted truck highway data, performs calculations in the encrypted space to statistically analyze the fleet's operational status, and finally decrypts the statistical results and returns them to the client. Summary of the Invention
[0006] The technical problem solved by this invention is to provide a lightweight fully homomorphic encryption method suitable for database encryption. This method has the advantages of low computational overhead, fast computation speed and easy implementation. It is a new strategy for data security control from the perspective of encrypted database in an open network environment.
[0007] To solve the above-mentioned technical problems, the present invention provides the following technical solution: A lightweight fully homomorphic encryption method suitable for database encryption includes the following steps: Step 1: Generating a Fully Homomorphic Encryption Algorithm Key: Input Security Parameters Generate a large prime number that meets the computation standard requirements and its corresponding timestamp, and generate the required public and private key pair according to the corresponding algorithm through the key generation module. This step includes generating two large prime numbers and a timestamp, and a key generation module used to generate the public and private key pair corresponding to the algorithm. The second step: Encryption and decryption using a fully homomorphic encryption algorithm: This includes a fully homomorphic data encryption module and a fully homomorphic data decryption module for data encryption and decryption operations. The fully homomorphic data encryption module encrypts the keyword fields of the user's SQL statement, using the keyword fields and the generated public key as input to the encryption module while maintaining the syntax requirements of the SQL statement. The fully homomorphic data decryption module decrypts the keyword fields of the SQL statement, using the keyword fields and the generated public key as input to the decryption module. The third step: Homomorphic computation of encrypted data: This step usually occurs after a user requests addition, multiplication, or size comparison to process the data. It includes three homomorphic computation modules: addition homomorphic module, multiplication homomorphic module, and size comparison module, which are used to process the addition, multiplication, and size comparison requests made by the user. Furthermore, the key generation module in the first step includes the following steps: For the input security parameters Random selection indivual Large prime numbers of length At the same time, get the current timestamp. Perform the following calculations: , ,in The generated random number is used for encryption and decryption calculations.
[0008] Furthermore, the fully homomorphic data encryption module in the second step includes the following steps: It accepts requests and SQL statements submitted by the application server, encrypts their key fields, and stores the key fields of the SQL statement along with the generated public key. As input to the data encryption module, do If the conditions are met, perform the following calculations: ,in This refers to SQL statements that have not been encrypted with keywords. This indicates the output of the key generation module. , This represents the SQL statement after keyword encryption.
[0009] Furthermore, the encryption process using the fully homomorphic data encryption module in the second step includes the following steps: Step X001: Obtain the user's SQL statement input and the corresponding keyword field that needs to be encrypted; Step X002: Invoke the key generation module and input security parameters. And generate the corresponding public key. private key ; Step X003: Call the random number generation module to generate the corresponding random number. ; Step X004: Input a random number r; Step X005: Input plaintext m: Step X006: Input large prime numbers p and n; Step X007: Call the encryption module to obtain ciphertext c; Step x008: Output ciphertext c.
[0010] Furthermore, the fully homomorphic data decryption module in the second step includes the following steps: Receive the SQL statement returned by the terminal server and decrypt its key fields. Then, extract the key fields from the SQL statement and the corresponding public key generated from them. As input to the data decryption module, the following calculations are performed: For the decryption result m, we have: That is, for the decryption result ,like If the result is the same as the original result, then return the result. ,like If the result is negative, then calculate and return the result. .
[0011] Furthermore, the second step of the decryption process using the fully homomorphic data decryption module includes the following steps: Step Y001: Accept the SQL statement returned by the terminal server and the key fields that need to be decrypted; Step Y002: Call the key generation module to obtain the private key. ; Step Y003: Call the random number generation module to generate the corresponding random number. ; Step Y004: Use the ciphertext c as input; Step Y005: Input a large prime number p; Step Y006: Call the decryption module to output ; Step Y007: If If the result is the same as the original result, then return the result. Step Y008: If If the result is negative, then calculate and return the result. .
[0012] Furthermore, the addition homomorphic module in the third step includes the following steps: For a request from the application server to calculate the sum of two fields in two records, the formalized syntax is as follows: For field 1 (ciphertext)... For field 2 ciphertext The following homomorphic addition equation exists: Among them, for The decryption result is proven as follows: That is, homomorphic addition exists. It meets the requirements for homomorphic addition calculation.
[0013] Furthermore, the multiplication homomorphic module in the third step includes the following steps: For a request from the application server to calculate the product of two fields in two records, the formalized syntax is as follows: For field 1 (ciphertext)... For field 2 ciphertext There exists a homomorphic multiplication equation as follows: Among them, for The decryption result is proven as follows: That is, homomorphic multiplication exists. It meets the requirements for homomorphic multiplication calculation.
[0014] Furthermore, the size comparison module in the third step includes the following steps: For a request from the application server to compare the size of two fields in two records, the following formalized syntax is used: For field 1 (ciphertext)... For field 2 ciphertext The following calculations are performed: , in The result is determined by the difference between the two ciphertexts. If true, return. The value is greater than Otherwise, return The value is greater than .
[0015] Make the following proof: In summary, the decryption result is compared with 0. If... It can be concluded that ,on the contrary .
[0016] Furthermore, the size comparison process in the third step includes the following steps: Step S001: Obtain the encrypted field requested by the user for comparison. As input; Step S002: Obtain the encrypted field requested by the user for comparison. As input; Step S003: Call the size comparison module to obtain the comparison result. ; Step S004: Compare the results Decrypt; Step S005; Determine If true, return. The value is greater than Otherwise, return The value is greater than .
[0017] Beneficial effects: This invention has the advantages of low computational overhead, fast computation speed and easy implementation. It is a new strategy for data security control from the perspective of encrypted database in an open network environment, which effectively solves the shortcomings of current data encryption. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the basic process of the present invention; Figure 2 This is a schematic diagram of the encryption process of the fully homomorphic encryption module of the present invention; Figure 3 This is a schematic diagram of the decryption process of the fully homomorphic decryption module of the present invention; Figure 4 This is a schematic diagram of the size comparison process of the size comparison module of the present invention. Detailed Implementation
[0019] The following detailed description illustrates the specific implementation method: Example 1: Basic process as attached Figure 1 As shown: A lightweight fully homomorphic encryption method suitable for database encryption, comprising the fully homomorphic encryption algorithm (part 1) and its application in database encryption (part 2): The fully homomorphic encryption algorithm part 1 consists of the following components: Key generation module 11: Input security parameters Random selection indivual Large prime numbers of length At the same time, get the current timestamp. ,calculate: , ; Encryption module 12: accepts requests and SQL statements submitted by the application server and encrypts their key fields; it also encrypts the key fields of the SQL statement and the corresponding public key generated therefrom. As input to the data encryption module, do Determine if the conditions are met, and calculate: ; Among them, homomorphic multiplication module 13: for ciphertext field 1... For field 2 ciphertext Equality exists ; Among them, homomorphic addition module 14: for ciphertext of field 1 For field 2 ciphertext Equality exists ; The decryption module 15 receives the SQL statement returned by the terminal server and decrypts its key fields. It then decrypts the key fields of the SQL statement and the corresponding public key generated from them. As input to the data decryption module, the following calculations are performed: Regarding the decryption result ,like If the result is the same as the original result, then return the result. ,like If the result is negative, then calculate and return the result. ; Application Part 2 of database encryption consists of the following components: User request module 21: Located on the application server side, it obtains the user's request and SQL statement, encodes and verifies the request, calls the key generation module 22 to generate the corresponding public and private key pair, and sends the request, SQL statement, and public and private key pair to the proxy server. Key generation module 22: Located on the application server side, responsible for generating keys; Proxy server module 23: Located on the proxy server side, it is responsible for splitting and identifying the information sent by the application server, and transmitting the corresponding data to the data encryption / decryption module 23, the terminal server 24, and the application server 21. Data encryption / decryption module 24: Located on the proxy server side, it encrypts the key fields of the SQL statements sent by the application server and sends them to the terminal server; it also decrypts the SQL statements returned by the terminal server and sends them to the application server. Instruction identification module 25: Located on the terminal server, it identifies instructions sent from the proxy server module 24 and calls the calculation module 25 as needed; Operation module 26: Located on the terminal server, it is responsible for performing operations such as homomorphic addition, homomorphic multiplication, and size comparison; like Figure 2 The diagram illustrates the encryption process of a lightweight, fully homomorphic encryption technology solution suitable for database encryption according to the present invention: Step X001: Obtain the user's SQL statement input and the corresponding keyword field that needs to be encrypted; Step X002: Invoke the key generation module and input security parameters. And generate the corresponding public key. private key ; Step X003: Call the random number generation module to generate the corresponding random number. ; Step X004: Input a random number r; Step X005: Input plaintext m: Step X006: Input large prime numbers p and n; Step X007: Call the encryption module to obtain ciphertext c; Step x008: Output ciphertext c; like Figure 3 The diagram illustrates the decryption process of a lightweight, fully homomorphic encryption technology solution suitable for database encryption according to the present invention: Step Y001: Accept the SQL statement returned by the terminal server and the key fields that need to be decrypted; Step Y002: Call the key generation module to obtain the private key. ; Step Y003: Call the random number generation module to generate the corresponding random number. ; Step Y004: Use the ciphertext c as input; Step Y005: Input a large prime number p; Step Y006: Call the decryption module to output ; Step Y007: If If the result is the same as the original result, then return the result. Step Y008: If If the result is negative, then calculate and return the result. ; like Figure 4 The diagram illustrates a size comparison process for a lightweight, fully homomorphic encryption technology solution suitable for database encryption, as described in this invention: Step S001: Obtain the encrypted field requested by the user for comparison. As input; Step S002: Obtain the encrypted field requested by the user for comparison. As input; Step S003: Call the size comparison module to obtain the comparison result. ; Step S004: Compare the results Decrypt; Step S005; Determine If true, return. The value is greater than Otherwise, return The value is greater than .
[0020] The above are merely embodiments of the present invention. Commonly known structures and characteristics of the solutions are not described in detail here. Those skilled in the art are aware of all common technical knowledge in the field prior to the application date or priority date, are aware of all existing technologies in that field, and have the ability to apply conventional experimental methods prior to that date. Those skilled in the art can, under the guidance of this application, improve and implement this solution in combination with their own capabilities. Some typical known structures or methods should not be obstacles for those skilled in the art to implement this application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the structure of the present invention. These should also be considered within the scope of protection of the present invention, and will not affect the effectiveness of the implementation of the present invention or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. A lightweight fully homomorphic encryption method suitable for database encryption, characterized in that, Includes the following steps: The first step is to generate a fully homomorphic encryption key: input security parameters to generate a large prime number that meets the computational standard requirements, obtain the current timestamp, and generate the required public and private key pair through the key generation module; The second step involves encryption and decryption using a fully homomorphic encryption algorithm: The keyword fields of the user's SQL statement are encrypted using a fully homomorphic data encryption module, and the SQL statement's keyword fields and the generated corresponding public key are then encrypted. As input to the data encryption module; The SQL statement's key fields are decrypted using a fully homomorphic data decryption module, and the key fields and their corresponding public keys are then extracted. As input to the data decryption module; The third step is homomorphic computation of encrypted data: the addition homomorphic module, multiplication homomorphic module, and size comparison module are used to process the user's addition, multiplication, and size comparison requests.
2. The lightweight fully homomorphic encryption method for database encryption according to claim 1, characterized in that, The key generation module in the first step includes the following steps: for the input security parameters Random selection indivual Large prime numbers of length At the same time, get the current timestamp. ,calculate: , ,in This is a generated random number.
3. A lightweight fully homomorphic encryption method suitable for database encryption according to claim 1, characterized in that, The second step, the fully homomorphic data encryption module, includes the following steps: accepting the request and SQL statement submitted by the application server and encrypting its key fields; and encrypting the key fields of the SQL statement and the corresponding public key generated therefrom. As input to the data encryption module, do Determine if the conditions are met, and calculate: ,in This refers to SQL statements that have not been encrypted with keywords. This indicates the output of the key generation module. , This represents the SQL statement after keyword encryption.
4. A lightweight fully homomorphic encryption method suitable for database encryption according to claim 1, characterized in that, The encryption process using the fully homomorphic data encryption module in the second step includes the following steps: Step X001: Obtain the user's SQL statement input and the corresponding keyword field that needs to be encrypted; Step X002: Invoke the key generation module and input security parameters. And generate the corresponding public key. private key ; Step X003: Call the random number generation module to generate the corresponding random number. ; Step X004: Input a random number r; Step X005: Input plaintext m: Step X006: Input large prime numbers p and n; Step X007: Call the encryption module to obtain ciphertext c; Step x008: Output ciphertext c.
5. A lightweight fully homomorphic encryption method suitable for database encryption according to claim 1, characterized in that, The second step, the fully homomorphic data decryption module, includes the following steps: receiving the SQL statement returned by the terminal server and decrypting its key fields; and then decrypting the key fields of the SQL statement and the corresponding public key generated therefrom. As input to the data decryption module, the following calculations are performed: Regarding the decryption result ,like If the result is the same as the original result, then return the result. ,like If the result is negative, then calculate and return the result. .
6. A lightweight fully homomorphic encryption method suitable for database encryption according to claim 1, characterized in that, The second step, the decryption process using the fully homomorphic data decryption module, includes the following steps: Step Y001: Accept the SQL statement returned by the terminal server and the key fields that need to be decrypted; Step Y002: Call the key generation module to obtain the private key. ; Step Y003: Call the random number generation module to generate the corresponding random number. ; Step Y004: Use the ciphertext c as input; Step Y005: Input a large prime number p; Step Y006: Call the decryption module to output ; Step Y007: If If the result is the same as the original result, then return the result. Step Y008: If If the result is negative, then calculate and return the result. .
7. A lightweight fully homomorphic encryption method suitable for database encryption according to claim 1, characterized in that: The third step, the addition homomorphic module, includes the following steps: For a request from the application server, which asks to calculate the sum of two fields in two records, for field 1 (ciphertext)... For field 2 ciphertext Then the homomorphic addition equation is: .
8. A lightweight fully homomorphic encryption method suitable for database encryption according to claim 1, characterized in that: The third step, the multiplication homomorphic module, includes the following steps: For a request from the application server, which asks to calculate the product of two fields in two records, for field 1 (ciphertext)... For field 2 ciphertext Then the homomorphic multiplication equation is: .
9. A lightweight fully homomorphic encryption method suitable for database encryption according to claim 1, characterized in that: The third step, the size comparison module, includes the following steps: For a request from the application server, which requires comparing the size of two fields in two records, for field 1 (ciphertext)... For field 2 ciphertext Then, the size comparison calculation is as follows: ,in The result is determined by the difference between the two ciphertexts. like Then return The value is greater than Otherwise, return The value is greater than .
10. A lightweight fully homomorphic encryption method suitable for database encryption according to claim 1, characterized in that: The third step of the size comparison process includes the following steps: Step S001: Obtain the encrypted field requested by the user for comparison. As input; Step S002: Obtain the encrypted field requested by the user for comparison. As input; Step S003: Call the size comparison module to obtain the comparison result. ; Step S004: Compare the results Decrypt; Step S005; Determine If true, return. The value is greater than Otherwise, return The value is greater than .