Location privacy protection method and system based on homomorphic encryption
Through homomorphic encryption, the location data is encrypted into digital matrix ciphertext, combined with GPU parallel computing, the limitations of location privacy protection in the existing technology are solved, safe and efficient location information query is achieved, and user privacy protection and data security are improved.
Patent Information
- Application Number
- CN202510512136.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-04-23
AI Technical Summary
When protecting user location privacy, the prior art has the limitations of K-anonymity in sparse areas, the introduction of noise in differential privacy affects data accuracy and obfuscation processing is easily reversely analyzed, and it is difficult to effectively protect user location information security while ensuring data practicality.
The homomorphic encryption method is used to encrypt the location data into a ciphertext of a digital matrix, passed to the server through a byte stream, perform matching calculations with the database, and matrix operations are performed on the encrypted data to ensure that the user's location information is not leaked, and efficiency is improved in combination with GPU parallel computing.
It realizes data matching and query without exposing user location information, ensures user privacy and security, improves data security and query efficiency, avoids the defects of traditional methods, and is suitable for a variety of location privacy protection scenarios.
Smart Images

Figure CN120433975A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and more particularly to a location privacy protection method and system based on homomorphic encryption. Background Art
[0002] Currently, with the rapid development of information technology and mobile internet, location-based services (LBS) have been widely used in daily life, such as map navigation, ride-sharing, and nearby search. However, LBS services require users to provide precise location information. While this brings convenience, it also poses a serious threat to user location privacy. Once user location information is maliciously collected, leaked, or abused, it not only infringes on the user's privacy rights but may also be used for illegal activities such as tracking and theft, posing a security risk. Traditional location privacy protection methods such as K-anonymity, obfuscation, and differential privacy can reduce the risk of privacy leakage to a certain extent, but these methods have obvious limitations: K-anonymity is not effective in sparse areas, differential privacy introduces noise that affects data accuracy, and obfuscation is easily cracked by reverse analysis.
[0003] Therefore, how to effectively protect the security of users' location information while ensuring the practicality of data is an urgent problem that needs to be solved in the current technical field. Summary of the Invention
[0004] In view of this, the present invention provides a location privacy protection method and system based on homomorphic encryption. The present invention can complete data matching and query without exposing user location information, thereby ensuring user privacy security.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] In a first aspect, the present invention provides a location privacy protection method based on homomorphic encryption, the method comprising the following steps:
[0007] S1. The client homomorphically encrypts the location data into a ciphertext of a digital matrix;
[0008] S2, the client transmits the digital matrix ciphertext to the server through byte stream;
[0009] S3. The server matches the obtained ciphertext with the matrix in the database;
[0010] S4. The database sends the matching results to the client.
[0011] Furthermore, the method further comprises:
[0012] S5. The client displays the matching results visually.
[0013] Furthermore, in S1, a string is first defined as a key, and public and private keys are created based on it. The client passes the location data and public key as parameters to the plaintext to ciphertext interface, and uses the homomorphic encryption library to perform homomorphic encryption into the ciphertext of the digital matrix. The encryption process includes:
[0014] Preprocess the position data, convert the existing floating point numbers into integers, and initialize the random number generator and magnification;
[0015] Initialize the module base group pointer, scramble the module base group array using random numbers and magnification factors, and directly store the real module component value;
[0016] According to the specific message value, a plaintext matrix of the corresponding position index is generated and encrypted, and the result is stored in the ciphertext matrix.
[0017] Furthermore, in S2, the client creates a socket connection to the server according to the set server address and port, performs serialization operations on the ciphertext objects in the ciphertext matrix, stores the results in a byte stream, and transmits them to the server via the byte stream. The specific process includes:
[0018] Create a character array byte stream to store serialized data;
[0019] Use forced type conversion to convert the SID object memory size, SID value, magnification order, precision order, array size and array value in the ciphertext into pointer types and store them into the byte stream;
[0020] The byte stream transmission is completed through the socket and the ciphertext is delivered to the server.
[0021] Furthermore, in S3, after receiving the ciphertext data, the server performs a deserialization operation on the data, and restores the original value to generate a ciphertext matrix according to the scale of each ciphertext serialization length being a preset byte; the database generates data within a preset range, and matches the matrix in the database with the received ciphertext matrix and performs an encryption operation; wherein the matching and encryption operation includes:
[0022] If it is the first row of data, it is directly stored in the result ciphertext; otherwise, the ciphertext multiplication operation is performed, and the blind multiplication operation is realized by performing element-by-element multiplication of the values of the two encrypted texts on the modulus basis and taking the result under the modulus, and the obtained result is stored in the decrypted information.
[0023] Furthermore, GPU parallel computing is used for matching and encryption operations.
[0024] In a second aspect, the present invention further provides a location privacy protection system based on homomorphic encryption, which is applied to the above-mentioned location privacy protection method based on homomorphic encryption. The system includes: a client and a server, wherein:
[0025] The client is used to homomorphically encrypt the location data into a ciphertext of a digital matrix and transmit the ciphertext of the digital matrix to the server via a byte stream;
[0026] The server is used to match the obtained ciphertext with the matrix in the database and send the matching result to the client.
[0027] In a third aspect, an embodiment of the present invention further provides an electronic device comprising a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned location privacy protection method based on homomorphic encryption.
[0028] As can be seen from the above technical solutions, the present invention provides a location privacy protection method and system based on homomorphic encryption. Compared with the existing technology, the present invention has at least the following beneficial effects:
[0029] 1. The present invention can complete data matching and query without exposing user location information, ensuring user privacy and security.
[0030] 2. This invention provides a new solution for location privacy protection. By combining data information with homomorphic encryption and adopting a matrix approach, calculations and matching can be performed directly on encrypted data without decrypting the data. This allows for secure comparisons without leaking any information, fully protecting the privacy information of the client and server, making private data available but invisible. The server does not need to access plaintext data, greatly improving the security of user data.
[0031] 3. In the blind multiplication operation of the database, the present invention performs ciphertext matching operations on all matrices and uses matrix multiplication to perform calculations, thereby ensuring the reliability and usability of the output results.
[0032] 4. This invention utilizes GPU parallel computing for matrix multiplication and ciphertext operations, enabling the simultaneous processing of large amounts of data. This significantly improves efficiency by performing simultaneous operations on multiple matrices or ciphertexts, significantly enhancing server operational efficiency. Furthermore, combined with efficient search algorithms and ciphertext matching mechanisms, it facilitates secure and accurate location information query services while maintaining computational efficiency.
[0033] 5. The present invention uses a homomorphic encryption scheme to securely calculate location information. It is easy to use and promote, can be applied to various location privacy protections, and can continuously expand system functions.
[0034] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the accompanying drawings.
[0035] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0037] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.
[0038] Figure 1 A flowchart of a location privacy protection method based on homomorphic encryption provided in an embodiment of the present invention.
[0039] Figure 2 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0041] In describing the present invention, it should be noted that some processes described in this specification and accompanying drawings include multiple operations that appear in a specific order. However, it should be understood that these operations may be performed in a different order than the order in which they appear, or may be performed in parallel. Furthermore, the use of various sequence numbers is for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0042] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention as claimed, but rather merely represents selected embodiments of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort shall fall within the scope of protection of the present invention.
[0043] See also Figure 1 As shown, an embodiment of the present invention provides a location privacy protection method based on homomorphic encryption, which mainly includes the following steps:
[0044] S1. The client homomorphically encrypts the current position into a ciphertext of a digital matrix;
[0045] S2, the client transmits the digital matrix ciphertext to the server through the byte stream;
[0046] S3. The server matches the obtained ciphertext with the matrix in the database;
[0047] S4. The database sends the matching results to the client.
[0048] In one embodiment, the method further comprises:
[0049] S5. The client displays the matching results visually.
[0050] Overall, this invention focuses on the privacy of location information. Therefore, we won't specifically describe the encryption and decryption algorithms, but rather the data security techniques used at each step in the client-server matching process. Therefore, the core of this solution is to perform matrix matching between the encrypted location information and all stored data, ensuring that valid information is output without leaking the user's location.
[0051] The specific implementation of the method of the present invention is described in detail below:
[0052] S1. The client homomorphically encrypts the current position into a ciphertext of a digital matrix; specifically:
[0053] The user defines a string as a key in advance and creates public and private keys based on it. The client passes the user-input data and public key as parameters to the ConvertToCipherText (plaintext to ciphertext) interface and encrypts it using the homomorphic encryption library. Specifically, the input data is first preprocessed, that is, it is expanded by 10^6 times, so that any floating-point numbers that may exist are converted into integers, which facilitates the subsequent completion of modular operations, and initializes the random number generator and magnification factor; secondly, the module basis group pointer is initialized, and the module basis group array is obfuscated with random numbers and magnification factors, and the true modular component value is directly stored; finally, according to the specific message value, the plaintext matrix of the corresponding position index is generated and encrypted, and the result is stored in the cipherMatrix (ciphertext matrix). For example, if 0512 is input, the plaintext matrix corresponding to the cipherMatrix is:
[0054]
[0055] S2. The client transmits the digital matrix ciphertext to the server via a byte stream; this includes the following steps:
[0056] The client connects to the server using a socket interface based on the pre-set server address and port. It then serializes the Ciphertext object in the cipherMatrix, storing the result in a byte stream. serialize() is a member function of the CipherText class. Specifically, it first creates a character array byte stream to store the serialized data. It then uses reinterpret_cast to convert the memory size, sid value, order (magnification order), level (precision order), array size, and array value of the Ciphertext object to pointer types, stores them in a byte stream, and finally passes them to the socket for byte stream transmission. The socket function creates a socket, specifies the IPv4 protocol, stream sockets, and TCP for data transmission. It stores the server address, specifies the host and port number, and attempts to complete the data connection using the connect() function.
[0057] S3. The server matches the obtained ciphertext with the matrix in the database; this includes the following steps:
[0058] After receiving the data, the server performs a deserialization operation on the data, restores the original value according to the scale of 1564 bytes of serialization length of each Ciphertext, and then generates a 4*10 cipherMatrix. The database generates data in the range of (0,10000), initializes a timer to evaluate the performance indicators of retrieval in the database, and performs a matchAndEncrypt operation on the data records in the database and the received cipherMatrix records. Specifically, if it is the first row of data, due to the special nature of matrix multiplication, it can be directly stored in resultCipher (result ciphertext). Otherwise, a BlindMul (ciphertext multiplication) operation is required. Here, the blind multiplication operation is implemented by performing element-by-element multiplication of the values of the two encrypted texts on the modulus basis and taking the result under the modulus. The result obtained by matchAndEncrypt is stored in resultinfo (decrypted information), which is the result to be sent to the client.
[0059] S4. The database sends the matching results to the client:
[0060] Since the resultinfo data itself is of string type, there is no need to perform serialization operations and it can be directly handed over to the socket for forwarding.
[0061] S5. The client displays the matching results visually:
[0062] The client initializes the byte stream to receive data, uses the public key to decrypt the matching result, and converts the result into a character type for output.
[0063] From the description of the above embodiments, those skilled in the art can know that: the present invention proposes a location privacy protection method based on homomorphic encryption, which aims to resolve the contradiction between privacy protection and data practicality in the prior art. In the present invention, the location information is directly encrypted and calculated through fully homomorphic encryption, without relying on virtual user groups, and efficient privacy protection can also be achieved in sparse areas; it avoids the problem of decreased data accuracy caused by the introduction of noise in traditional methods, and ensures the integrity and practicality of the data. At the same time, the irreversibility of fully homomorphic encryption is utilized to fundamentally eliminate the possibility of reverse analysis and enhance security. Furthermore, by optimizing the encryption and calculation processes, the present invention takes into account both real-time and scalability, can meet the high-efficiency requirements in large-scale application scenarios, and has wide applicability and superior performance.
[0064] Furthermore, an embodiment of the present invention also provides a location privacy protection system based on homomorphic encryption, which is applied to the location privacy protection method based on homomorphic encryption described in the above embodiment to perform location privacy protection. The system includes: a client and a server, wherein:
[0065] The client is used to homomorphically encrypt the location data into a ciphertext of a digital matrix and transmit the ciphertext of the digital matrix to the server via a byte stream;
[0066] The server is used to match the obtained ciphertext with the matrix in the database and send the matching result to the client.
[0067] In this system, a four-digit number is input. The client converts the number into an encryption matrix using convertToCipherText, serializes the encryption matrix into a byte sequence, and transmits it over a TCP socket. The server receives the encryption matrix using a byte stream, deserializes it, performs a blind multiplication match with the database, and sends the result (resultInfo) to the client, which then receives and outputs it.
[0068] The embodiment of the present invention provides a location privacy protection system based on homomorphic encryption, the implementation principle and technical effects of which are the same as those of the aforementioned method embodiment. For the sake of brief description, for parts not mentioned in this embodiment, please refer to the corresponding content in the aforementioned method embodiment, and no further details will be given here.
[0069] Further, refer to Figure 2 As shown, an embodiment of the present invention also provides an electronic device that can execute the above-mentioned method and system for location privacy protection. The electronic device may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10.
[0070] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor 10 is the control core (Control Unit) of the electronic device, which uses various interfaces and lines to connect the various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11, and calls the data stored in the memory 11 to perform various functions of the electronic device and process data.
[0071] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, devices, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0072] It should be noted that the word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer.
[0073] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0074] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art who can easily conceive of changes or substitutions within the technical scope disclosed in the present invention should be covered by the scope of protection of the present invention.
Claims
1. A location privacy protection method based on homomorphic encryption, characterized in that: The method comprises the following steps: S1. The client homomorphically encrypts the location data into a ciphertext of a digital matrix; S2, the client transmits the digital matrix ciphertext to the server through byte stream; S3. The server matches the obtained ciphertext with the matrix in the database; S4. The database sends the matching results to the client.
2. A location privacy protection method based on homomorphic encryption according to claim 1, characterized in that: The method further includes: S5. The client displays the matching results visually.
3. A location privacy protection method based on homomorphic encryption according to claim 1, characterized in that: In S1, a string is first defined as a key, and public and private keys are created based on it. The client passes the location data and public key as parameters to the plaintext-to-ciphertext interface, and uses the homomorphic encryption library to perform homomorphic encryption into the ciphertext of the digital matrix. The encryption process includes: Preprocess the position data, convert the existing floating point numbers into integers, and initialize the random number generator and magnification; Initialize the module base group pointer, scramble the module base group array using random numbers and magnification factors, and directly store the real module component value; According to the specific message value, a plaintext matrix of the corresponding position index is generated and encrypted, and the result is stored in the ciphertext matrix.
4. A location privacy protection method based on homomorphic encryption according to claim 3, characterized in that: In S2, the client creates a socket connection to the server based on the set server address and port, serializes the ciphertext object in the ciphertext matrix, stores the result in a byte stream, and transmits it to the server via the byte stream. The specific process includes: Create a character array byte stream to store serialized data; Use forced type conversion to convert the SID object memory size, SID value, magnification order, precision order, array size and array value in the ciphertext into pointer types and store them into the byte stream; The byte stream transmission is completed through the socket and the ciphertext is delivered to the server.
5. A location privacy protection method based on homomorphic encryption according to claim 4, characterized in that: In S3, after receiving the ciphertext data, the server performs a deserialization operation on the data, and restores the original value to generate a ciphertext matrix according to the scale of each ciphertext serialization length being a preset byte; The database generates data within a preset range, and performs an operation of matching and encrypting the matrix in the database with the received ciphertext matrix; wherein the matching and encryption operation includes: If it is the first row of data, it is directly stored in the result ciphertext; otherwise, the ciphertext multiplication operation is performed, and the blind multiplication operation is realized by performing element-by-element multiplication of the values of the two encrypted texts on the modulus basis and taking the result under the modulus, and the obtained result is stored in the decrypted information.
6. A location privacy protection method based on homomorphic encryption according to claim 5, characterized in that: GPU parallel computing is used for matching and encryption operations.
7. A location privacy protection system based on homomorphic encryption, characterized in that: When applied, a location privacy protection method based on homomorphic encryption according to any one of claims 1 to 6 is executed, and the system includes: a client and a server, wherein: The client is used to homomorphically encrypt the location data into a ciphertext of a digital matrix and transmit the ciphertext of the digital matrix to the server via a byte stream; The server is used to match the obtained ciphertext with the matrix in the database and send the matching result to the client.
8. An electronic device, characterized in that: It includes a processor and a memory, the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement a location privacy protection method based on homomorphic encryption as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Fully homomorphic encryption method supporting floating-point number operation in cloud computing environment
CN115801224A
Secure outsourcing calculation method and device using fully homomorphic encryption under machine learning
CN118101158A
Privacy protection machine learning method and device based on homomorphic encryption and secure outsourcing matrix
CN118249980A
Location data protection method and system based on searchable encryption
CN118643538A
Encrypted data query processing method and electronic device
CN119759953A