A data encryption method and related device
By encrypting the source address of packets in network communication, the problem of difficulty in comprehensively improving network communication security and privacy protection in the prior art is solved, and the effect of reducing the risk of user privacy leakage is achieved.
Patent Information
- Application Number
- CN202310201907.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2043-02-23
AI Technical Summary
The prior art is difficult to comprehensively improve security in network communication, especially in terms of privacy protection. Attackers can infer user privacy information by intercepting the source and destination addresses of messages.
By encrypting the source address of the message, even if the attacker obtains the message, he can only know the receiver of the message, and cannot determine the sending end of the message. The specific implementation method includes that the source address in the message request message and the traffic message interacting between the terminal device and the server is encrypted by the public key of the receiving end. Only after decrypting the private key of the receiving end can the real source address of the message be obtained.
It reduces the possibility of leaking user privacy through the source and destination addresses of messages, enhances the security of network communication, so that attackers can only obtain fragmented information and cannot splice it to infer user privacy.
Smart Images

Figure CN118540087B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, and in particular, to a data encryption method and related apparatus. Background Art
[0002] One way of network communication is routing and forwarding based on the destination address. Its main working principle is as follows: After receiving a message from the sending end or other intermediate routing nodes, the intermediate routing node extracts the corresponding forwarding information from the message header, such as the corresponding output port, etc. The intermediate routing node forwards the message through this port to the next-hop routing node (such as an intermediate routing node or the destination end) until the destination end receives the message.
[0003] To improve the quality of network communication, maintaining security is an important condition for measuring Internet services, client experience, and operators. The security of network communication quality is mainly reflected in communication security and privacy protection. In related technologies, to improve security, various security detection software and hardware are mainly used to perform security detection on the received messages, and the risks of data being tampered with, traffic being hijacked, and communication being illegally obtained are excluded with a certain probability; as Figure 1 shown, when the terminal device requests data from the data storage server, the server can perform security detection on the request message or message confirmation message from the terminal user through the security hardware platform, and filter out the detected malicious messages, further improving the security of network communication.
[0004] However, the security detection dimensions of related technologies for network communication are not comprehensive enough to meet the current privacy protection requirements. Summary of the Invention
[0005] To solve the above technical problems, this application provides a data encryption method and related apparatus. By encrypting the source address of the message, even if an attacker obtains the message, they can only know the receiving end of the message and cannot determine the sending end of the message, thereby reducing the possibility of user privacy being leaked through the source address and destination address of the message.
[0006] The embodiments of this application disclose the following technical solutions:
[0007] On the one hand, the embodiments of this application provide a data encryption method, which is executed by a terminal device and includes:
[0008] Sending a message request message to a server, where the source address of the message request message includes a terminal encryption address, and the terminal encryption address is obtained by encrypting the terminal address of the terminal device with the public key of the server;
[0009] Obtain a traffic packet returned by the server for the message request packet. The source address of the traffic packet includes the server encrypted address, and the server encrypted address is obtained by encrypting the server address of the server with the public key of the terminal device;
[0010] Decrypt the server encrypted address with the private key of the terminal device to obtain the server pending address;
[0011] In response to the server pending address being consistent with the server address, receive the traffic data in the traffic packet.
[0012] On the other hand, an embodiment of the present application provides a data encryption method, which is executed by the server and includes:
[0013] Obtain a message request packet from the terminal device. The source address of the message request packet includes the terminal encrypted address, and the terminal encrypted address is obtained by encrypting the terminal address of the terminal device with the public key of the server;
[0014] Decrypt the terminal encrypted address with the private key of the server to obtain the terminal address;
[0015] According to the terminal address, send a traffic packet returned for the message request packet to the terminal device. The source address of the traffic packet includes the server encrypted address, and the server encrypted address is obtained by encrypting the server address of the server with the public key of the terminal device.
[0016] On the other hand, an embodiment of the present application provides a data encryption device, including a sending unit, an obtaining unit, a decrypting unit, and a receiving unit;
[0017] The sending unit is used to send a message request packet to the server. The source address of the message request packet includes the terminal encrypted address, and the terminal encrypted address is obtained by encrypting the terminal address of the terminal device with the public key of the server;
[0018] The obtaining unit is used to obtain a traffic packet returned by the server for the message request packet. The source address of the traffic packet includes the server encrypted address, and the server encrypted address is obtained by encrypting the server address of the server with the public key of the terminal device;
[0019] The decrypting unit is used to decrypt the server encrypted address with the private key of the terminal device to obtain the server pending address;
[0020] The receiving unit is used to receive the traffic data in the traffic packet in response to the server pending address being consistent with the server address.
[0021] On the other hand, an embodiment of the present application provides a data encryption device, including an obtaining unit, a decrypting unit, and a sending unit;
[0022] An acquisition unit, configured to acquire a message request packet from a terminal device, where the source address of the message request packet includes a terminal encrypted address, and the terminal encrypted address is obtained by encrypting the terminal address of the terminal device with the public key of the server;
[0023] A decryption unit, configured to decrypt the terminal encrypted address with the private key of the server to obtain the terminal address;
[0024] A sending unit, configured to send a traffic packet returned for the message request packet to the terminal device according to the terminal address, where the source address of the traffic packet includes a server encrypted address, and the server encrypted address is obtained by encrypting the server address of the server with the public key of the terminal device.
[0025] On the other hand, an embodiment of the present application provides a data encryption system, which includes a terminal device and a server. The terminal device is configured to execute the method described in the above aspect, and the server is configured to execute the method described in the above aspect.
[0026] On another aspect, an embodiment of the present application provides a computer device, which includes a processor and a memory:
[0027] The memory is configured to store a computer program and transmit the program code to the processor;
[0028] The processor is configured to execute the method described in the above aspect according to the instructions in the computer program.
[0029] On another aspect, an embodiment of the present application provides a computer-readable storage medium, which is configured to store a computer program, and the computer program is configured to execute the method described in the above aspect.
[0030] On another aspect, an embodiment of the present application provides a computer program product including a computer program. When it runs on a computer device, it causes the computer device to execute the method described in the above aspect.
[0031] As can be seen from the above technical solution, when the terminal device communicates with the server network through the interaction message, the source addresses in the message request message and the traffic message exchanged between them are encrypted by the public key of the receiving end, and the real source address of the message can be obtained only after being decrypted by the private key of the receiving end. The reason for hiding the source address is that since a message generally carries the source address and the destination address in network communication for correct forwarding, once the attacker intercepts and obtains the relationship between the source address and the destination address, it can be determined when the user of the terminal device goes online and what content services are obtained, thereby inferring the user's privacy information. Therefore, by encrypting the source address of the message, even if the attacker obtains the message, they can only know the receiving end of the message and cannot determine the sending end of the message, so that the attacker can only obtain fragmented information and cannot piece together the fragmented information, thereby reducing the possibility of leaking user privacy through the source address and destination address of the message. Moreover, the terminal device as the data receiving end can also restore the real source address of the received message through its own private key, ensuring the security of message reception. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0033] Figure 1 Schematic diagram of security enhancement based on secure hardware assistance;
[0034] Figure 2 Schematic diagram of a data encryption scenario provided by an embodiment of the present application;
[0035] Figure 3 Schematic diagram of an attacker obtaining user privacy based on the source address and the destination address;
[0036] Figure 4 Method flowchart of a data encryption method provided by an embodiment of the present application;
[0037] Figure 5 Schematic diagram of a message request message provided by an embodiment of the present application;
[0038] Figure 6 Schematic diagram of a traffic message provided by an embodiment of the present application;
[0039] Figure 7 Schematic diagram of a traffic confirmation message provided by an embodiment of the present application;
[0040] Figure 8 Schematic diagram of a key creation message provided by an embodiment of the present application;
[0041] Figure 9 Schematic diagram of an intermediate routing node adding an intermediate shared key to a key creation message provided by an embodiment of the present application;
[0042] Figure 10 Schematic diagram of a key confirmation message provided by an embodiment of the present application;
[0043] Figure 11 Schematic diagram of a traffic message encrypting source and destination addresses provided by an embodiment of the present application;
[0044] Figure 12 Specific flowchart of a data encryption method provided by an embodiment of the present application;
[0045] Figure 13 Communication schematic diagram of a data encryption method provided by an embodiment of the present application;
[0046] Figure 14 Device structure diagram of a data encryption device provided by an embodiment of the present application;
[0047] Figure 15 Device structure diagram of another data encryption device provided by an embodiment of the present application;
[0048] Figure 16 System structure diagram of a data encryption system provided by an embodiment of the present application;
[0049] Figure 17 Structure diagram of a terminal device provided by an embodiment of the present application;
[0050] Figure 18 Structure diagram of a server provided by an embodiment of the present application. Detailed implementation manners
[0051] The embodiments of the present application will be described below with reference to the accompanying drawings.
[0052] In the related art, various security detection software and hardware can be used to perform security detection on network communication, such as Figure 1As shown, various messages exchanged between end-users and data storage servers can be securely detected through security detection hardware, and malicious messages detected can be filtered, which improves the security of network communication to a certain extent. It is also possible to enhance the security of network communication from the perspective of communication protocols, mainly by encrypting the data in the messages to avoid the risks of the data being illegally obtained, tampered with, or redirected during the message forwarding process. For example, based on the Transmission Control Protocol (TCP), the data in the messages can be encrypted through the Secure Sockets Layer (SSL) / Transport Layer Security (TLS) protocol, or based on the User Datagram Protocol (UDP), the Quick UDP Internet Connection (QUIC) protocol can be proposed to encrypt the data in the messages, so that malicious intermediate routing nodes cannot obtain the data content in the messages without the decryption key.
[0053] However, performing security detection on network communication through security detection software and hardware or encrypting data from the perspective of communication protocols cannot enhance security in the dimension of message addresses. Once an attacker intercepts a message, the attacker can obtain the source address and destination address of the message, and then can infer the privacy information of the end-user based on the relationship between the source address and the destination address, resulting in the leakage of the user's privacy.
[0054] Therefore, the embodiments of the present application provide a data encryption method and related device, which encrypt the source address in the messages exchanged between the terminal device and the server, reducing the possibility of an attacker obtaining the privacy information of the end-user through the source address and destination address of the message, and enhancing security in the dimension of message addresses.
[0055] The data encryption method provided by the embodiments of the present application can be implemented by a computer device, which can be a terminal device or a server. Among them, the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, a smart TV, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, and the present application does not limit this.
[0056] The data encryption method provided by the embodiments of the present application can be implemented based on cloud storage. Cloud storage is a new concept extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as the storage system) refers to a storage system that combines a large number of different types of storage devices (storage devices are also called storage nodes) in the network through functions such as cluster applications, grid technology, and distributed file systems, and collaborates through application software or application interfaces to jointly provide data storage and service access functions to the outside world.
[0057] Currently, the storage method of the storage system is as follows: Create a logical volume. When creating a logical volume, physical storage space is allocated for each logical volume. This physical storage space may be composed of a certain storage device or the disks of several storage devices. The client stores data on a certain logical volume, that is, stores the data on the file system. The file system divides the data into many parts, and each part is an object. The object not only contains data but also additional information such as data identification (ID, ID entity). The file system writes each object into the physical storage space of the logical volume respectively, and the file system will record the storage location information of each object. Thus, when the client requests to access the data, the file system can enable the client to access the data according to the storage location information of each object.
[0058] The process of the storage system allocating physical storage space for a logical volume is specifically as follows: According to the capacity estimation of the objects stored in the logical volume (this estimation usually has a large margin relative to the capacity of the objects to be actually stored) and the group of the redundant array of independent disks (RAID, Redundant Array of Independent Disk), the physical storage space is pre-divided into stripes. A logical volume can be understood as a stripe, thereby allocating physical storage space for the logical volume.
[0059] For example, the server in the embodiments of the present application can be a cloud server that implements cloud storage.
[0060] Figure 2 It is a schematic diagram of a data encryption scenario provided by the embodiments of the present application. Among them, the aforementioned computer device is a terminal device and a server. The terminal device and the server can communicate through interactive messages for network communication. The server can be a cloud server that can implement cloud storage, or a non-cloud server, such as a traditional physical server, etc. The server can be a content server, and a content server refers to a server that can implement the functions of a content delivery network (CDN, Content Delivery Network).
[0061] When a network communication occurs between a terminal device and a server, the terminal device sends a message request packet. A message request packet refers to a packet used by the terminal device to send a request to the server. For example, the message request packet can be a request packet sent by the terminal device to the server to obtain target content. Among them, the source address of the message request packet is not directly disclosed. As Figure 2 shown, it is encrypted by the public key of the receiving end (server). Only after the server receives the message request packet and decrypts it with the server's private key can the true source address of the message request packet be obtained.
[0062] Correspondingly, the terminal device obtains a traffic packet from the server. A traffic packet refers to a packet sent by the server in response to the request in the message request packet. The traffic packet can be a packet sent by the server to allow the terminal device to obtain target content. Among them, the source address of the traffic packet is not directly disclosed either. As Figure 2 shown, it is also encrypted by the public key of the receiving end (terminal device). Only after the terminal device obtains the traffic packet and decrypts it with the terminal device's private key can the true source address of the traffic packet be obtained.
[0063] During the network communication between the terminal device and the server, the reason for hiding the source addresses in the message request packets and traffic packets exchanged between them is that, in order to achieve the correct forwarding of packets in network communication, a packet generally carries a source address and a destination address in network communication. However, once an attacker intercepts the packet, the relationship between the source address and the destination address of the packet can be obtained. Furthermore, the attacker can infer private information such as when the user of the terminal device goes online and what content services are obtained based on the relationship between the source address and the destination address. As Figure 3 shown, an attacker located between the terminal device and the server can obtain the information that "a certain user is surfing the Internet" based on the source address and destination address of the request packet and the traffic packet, and even make inferences such as whether the user is at home. At the same time, if the attacker obtains the address set of the server of a certain cloud service provider, based on whether the address in the address set exists in the message request packet or the traffic packet, the attacker can determine the content service that the user is obtaining. For example, the Internet Protocol (IP) addresses used by a certain cloud service provider to provide services for a short video platform are: IP1, IP2, IP3, …, IP100. Then, if the source address or destination address in the packet intercepted by the attacker has the above IP addresses, it can be inferred that the user is in the state of "watching short videos".
[0064] In this application, the source address of the encrypted message is used, so that even if an attacker intercepts the message, they can only know the receiving end of the message and cannot determine the sending end of the message. This makes the attacker only able to obtain fragmented information and thus unable to piece together the fragmented information, thereby reducing the possibility of user privacy leakage through the source address and destination address of the message.
[0065] At the same time, the terminal device, which is the receiving end of the traffic message, can also restore the true source address of the received traffic message through its own private key, reducing the danger of the terminal device randomly receiving messages and ensuring the security of message reception.
[0066] Figure 4 FIG. is a flowchart of a data encryption method provided by an embodiment of this application. In this embodiment, a computer device is used as the terminal and the server for illustration. The method includes:
[0067] S401. The terminal device sends a message request packet to the server. The source address of the message request packet includes a terminal encryption address, and the terminal encryption address is obtained by encrypting the terminal address of the terminal device with the public key of the server.
[0068] The terminal device and the server can achieve network communication by interacting with packets. In practical applications, a server can send packets to multiple terminal devices, and a terminal can also request packets from multiple servers. In this embodiment, the network communication between a terminal device and a server is taken as an example for illustration.
[0069] The purpose of the network communication between the terminal device and the server can be for the terminal device to obtain the target content from the server. When the terminal device obtains the target content from the server through the interactive packet, the terminal device is the data request end and the server is the data sending end. The target content is used to represent the data content required by the terminal device, and the target content can be various forms of data content, such as text, pictures, videos, live streams, etc. Since different servers can provide different data contents, before sending the message request packet, the terminal device can first determine the corresponding server according to the target content and then send the corresponding message request packet to the determined server.
[0070] A message request packet refers to a packet used by a terminal device to send a request to a server. To prevent an attacker from obtaining the relationship between the source address and the destination address in the message request packet after intercepting it, and thus obtaining the user's private information, the source address in the message request packet is encrypted in this embodiment, that is, the source address in the message packet is hidden, so that even if the attacker intercepts the packet, they can only know the destination address of the packet and cannot determine the source address of the packet. That is, after intercepting the packet, the attacker only knows that a device has sent a packet to the server, but does not know which device sent it, and it is naturally difficult to infer the user's private information. That is to say, by encrypting the source address of the message request packet, the source address in the message request packet can be hidden, reducing the possibility that the attacker can infer the user's private information through the source address and destination address of the message request packet.
[0071] It should be noted that the terminal address of the terminal device can be encrypted with the public key of the server to obtain the corresponding terminal encrypted address. For example, the terminal encrypted address can be obtained through the following formula:
[0072] IP_sec = Enc{Key_pub_server, IP_i}
[0073] Where IP_sec represents the terminal encrypted address, Key_pub_server represents the public key of the server, IP_i represents the terminal address of the terminal device, and Enc{α,β} represents the encryption operation of using the key α on the data β.
[0074] According to the above formula, the real terminal address can be encrypted with the public key of the server to obtain the corresponding terminal encrypted address. As Figure 5 shown, the terminal encrypted address can be carried in the message request packet (Pkt_req). For example, it can be carried in the payload of the message request packet, so that the server can determine the terminal address corresponding to the terminal device through the terminal encrypted address after obtaining the message request packet, that is, enable the receiving end of the message request packet to accurately determine the sending end of the message request packet, so that the receiving end can accurately generate a traffic packet with the destination address being the sending end in the subsequent steps, ensuring the security of packet propagation.
[0075] It should be noted that in order to ensure that the message request packet can be accurately forwarded, the destination address of the message request packet is not encrypted in this embodiment, that is, the message request packet includes the plaintext server address of the server, so that the message request packet can be accurately forwarded to the server based on the server address in network communication.
[0076] In order to further obfuscate an attacker after the attacker intercepts a message request packet and further reduce the possibility that the attacker infers the user's private information through the real source address and destination address of the message request packet, in a possible implementation, the source address of the message request packet further includes a terminal anonymity address, which is different from the terminal address.
[0077] The terminal anonymity address refers to the false source address in plain text in the message request packet. In order to be able to conceal the real source address of the message request packet, the terminal anonymity address is obviously different from the real terminal address of the terminal device that sends the message request packet. For example, Figure 5 as shown, when the terminal address of the terminal device is IP_i, the message request packet not only includes the terminal encrypted address IP_sec, but also includes the terminal anonymity address IP_j. For example, the header of the message request packet can carry the terminal anonymity address, where IP_i and IP_j are not the same.
[0078] Adding the terminal anonymity address to the message request packet can obfuscate the attacker after the attacker intercepts the message request packet, inducing the attacker to make the wrong judgment that the source address of the message request packet is the terminal anonymity address, and further reducing the possibility that the attacker infers the user's private information through the real source address and destination address of the message request packet.
[0079] In addition, since the real source address of the message request packet is concealed, this will cause the packet format of the message request packet to change. By adding the terminal anonymity address to the source address of the message request packet, the message request packet with the encrypted source address can be made to have no difference in format from the packet with the unencrypted source address, so that in the network communication between the terminal device and the server, the forwarding device can successfully understand the meaning of the message request packet according to the format of the message request packet, thereby ensuring the successful forwarding of the message request packet.
[0080] S402. The server decrypts the terminal encrypted address with the private key of the server to obtain the terminal address.
[0081] After the server obtains the message request packet from the terminal device, it needs to determine the source address of the message request packet in order to make an accurate response to the message request packet. Since the source address in the message request packet is concealed, the server cannot directly obtain the source address of the message request packet and needs to decrypt the terminal encrypted address in the message request packet to obtain the corresponding terminal address.
[0082] As described in S401, the terminal encrypted address is obtained by encrypting the terminal address of the terminal device with the public key of the server. Here, the public key of the server refers to the publicly available key corresponding to the server. Other devices can use the public key of the server to encrypt data, while the private key of the server is the privately owned key of the server. Only the server has this key, that is, only the server can decrypt the data encrypted with the public key of the server using the private key of the server. Therefore, the server can decrypt the terminal encrypted address with the private key of the server to obtain the terminal address. For example, the terminal address can be obtained through the following formula:
[0083] IP_i = Dec{Key_pri_server,IP_sec}
[0084] Wherein, IP_i represents the terminal address of the terminal device, Key_pri_server represents the private key of the server, IP_sec represents the terminal encrypted address, and Dec{α,β} represents the decryption operation of using the key α for the data β.
[0085] According to the above formula, the terminal encrypted address can be decrypted with the private key of the server to obtain the terminal address. This terminal address is the real source address of the message request packet. That is to say, after the server obtains the message request packet, it determines the real source address of the message request packet through the terminal encrypted address, laying a foundation for the server to accurately send traffic packets to this terminal address in the subsequent steps.
[0086] S403. The terminal device obtains the traffic packet returned by the server for the message request packet. The source address of the traffic packet includes the server encrypted address, and the server encrypted address is obtained by encrypting the server address of the server with the public key of the terminal device.
[0087] The traffic packet refers to the packet sent by the server in response to the request in the message request packet. For example, when the message request packet is a packet used by the terminal device to obtain the target content from the server, the traffic packet can be a packet sent by the server for the terminal device to obtain the target content. If the target content is the text required by the terminal device, the traffic packet will correspondingly include the data corresponding to the text. When the target content is the text and pictures required by the terminal device, the traffic packet will correspondingly include the data corresponding to the text and pictures.
[0088] To prevent an attacker from obtaining the relationship between the source address and the destination address in a traffic packet after intercepting it, and thus obtaining the user's privacy information, the source address in the traffic packet is also encrypted in this example. Even if the attacker intercepts the packet, they can only know the destination address of the packet and cannot determine the source address of the packet. That is, after intercepting the packet, the attacker only knows that a device has sent a packet to the terminal device, but does not know which device sent it, making it difficult to infer the user's privacy information. In other words, by encrypting the source address of the traffic packet, the source address in the traffic packet can be hidden, reducing the possibility that the attacker can infer the user's privacy information through the source address and destination address of the message request packet.
[0089] It should be noted that the server address of the server can be encrypted with the public key of the terminal device to obtain the corresponding encrypted server address. For example, the encrypted server address can be obtained through the following formula:
[0090] IP_sec_server = Enc{Key_pub_client, IP_m}
[0091] Where IP_sec_server represents the encrypted server address, Key_pub_client represents the public key of the terminal device, IP_m represents the server address, and Enc{α,β} represents the encryption operation of using the key α on the data β.
[0092] Through the above formula, the real server address can be encrypted with the public key of the terminal device to obtain the corresponding encrypted server address. As Figure 6 shown, the encrypted server address can be carried in the traffic packet (Pkt_traffic) so that the terminal device can still determine the source address of the traffic packet through subsequent steps after obtaining the traffic packet when the source address of the traffic packet is hidden, laying a foundation for ensuring the security of packet propagation.
[0093] It should be noted that to ensure the accurate forwarding of the traffic packet, the destination address of the traffic packet in this embodiment is not encrypted, that is, the traffic packet includes the plaintext terminal address of the terminal device, so that the traffic packet can be accurately forwarded to the terminal device that sends the message request packet based on the terminal address in network communication.
[0094] In a possible implementation, the source address of the traffic packet also includes a server hiding address, which is different from the server address.
[0095] The server hiding address refers to the plaintext false source address in the traffic packet, which is different from the server address of the server that sends the traffic packet. For example,Figure 6 As shown, when the server address is IP_m, the traffic packet not only includes the server encrypted address IP_sec_server, but also includes the terminal hidden address IP_n, where IP_n is different from IP_m.
[0096] Adding the server hidden address to the traffic packet can, on the one hand, confuse the attacker after intercepting the traffic packet with the server hidden address in the traffic packet, further reducing the possibility for the attacker to infer the user's privacy information through the real source and destination addresses of the traffic packet; on the other hand, it can ensure the packet format of the traffic packet, thereby ensuring the successful forwarding of the traffic packet.
[0097] S404. The terminal device decrypts the server encrypted address with the private key of the terminal device to obtain the server pending address.
[0098] To ensure the security of packet transmission, the terminal device needs to determine the source of the obtained packet to reduce the possibility of the terminal device being attacked by malicious packets. Therefore, after the terminal device obtains the traffic packet from the server, it needs to determine the source address of the traffic packet to determine the source of the traffic packet. Since the source address of the traffic packet is hidden, the terminal device cannot directly obtain the source address of the traffic packet and needs to decrypt the server encrypted address in the traffic packet to obtain the corresponding server pending address.
[0099] As described in S403, the server pending address is encrypted with the public key of the terminal device. Therefore, the terminal device can decrypt the server encrypted address with the private key of the terminal device to obtain the server pending address. For example, the server pending address can be obtained through the following formula:
[0100] IP_m 1 = Dec{Key_pri_client, IP_sec_server}
[0101] where IP_m 1 represents the server pending address, Key_pri_client represents the private key of the terminal device, IP_sec_server represents the server encrypted address, and Dec{α,β} represents the decryption operation of using the key α on the data β.
[0102] According to the above formula, the server encrypted address can be decrypted with the private key of the terminal device to obtain the server pending address, which is the real source address of the traffic packet. That is to say, after the terminal device obtains the traffic packet with the hidden source address, it determines the real source address of the traffic packet through the server encrypted address in the traffic packet.
[0103] S405. The terminal device receives the traffic data in the traffic packet in response to the pending server address being the same as the server address.
[0104] After the terminal device obtains the traffic packet, it determines through S404 that the actual source address of the traffic packet is the pending server address. At the same time, the destination address of the message request packet sent by the terminal device to the server is the server address of the server. When the server address is the same as the pending server address, it means that the destination address of the message request packet sent by the terminal device is the same as the actual source address of the traffic packet obtained by the terminal device, indicating that the traffic packet is the packet returned for the message request packet required by the terminal device, rather than a malicious packet or an irrelevant packet sent by other servers. The terminal device can receive the traffic data in the traffic packet, so that the terminal device can obtain the data content in the traffic packet.
[0105] In the process of network communication, the receiving end of the data does not necessarily be able to completely obtain the packet content sent by the sending segment of the data. Therefore, in the interaction process between the terminal device and the server, it is necessary to determine whether the terminal device has successfully obtained the packet content sent by the server.
[0106] In a possible implementation, after the terminal device receives the traffic data in the traffic packet in response to the pending server address being the same as the server address, it can also determine the packet reception result for the traffic packet; send a traffic confirmation packet including the packet reception result to the server, and the source address of the traffic confirmation packet includes the terminal encryption address.
[0107] The packet reception result is used to represent the reception status of the terminal device for the traffic packet after the terminal device receives the traffic data in the traffic packet, that is, the packet reception result is used to reflect whether the terminal device actually successfully receives the traffic packet.
[0108] It should be noted that in the actual network communication process between the terminal device and the server, for the message request packet sent by the terminal device, the server often needs to send multiple traffic packets to meet the requests in the message request packet. For example, when the message request packet is to obtain video content from the server, the server usually needs to send multiple traffic packets to achieve the complete transmission of the video. At this time, the packet reception result can be the reception status of the terminal device for the multiple traffic packets obtained after the terminal device receives the multiple traffic packets. For example, it can be reflected according to the range of packet numbers actually received (or not received) by the terminal device for the multiple traffic packets. In order to enable the server to timely obtain the reception status of the terminal device for the multiple traffic packets, the terminal device can periodically determine the packet reception result, generate a corresponding traffic confirmation packet after each determination of the packet reception result, and report it to the server.
[0109] In order for the server to determine whether the terminal device has successfully obtained the data content sent by the server, the terminal device may send a traffic confirmation message including a message reception result to the server. The traffic confirmation message is a message used by the terminal device to feedback the message reception situation to the server after receiving the traffic data of the traffic message.
[0110] In order to prevent the attacker from obtaining the relationship between the source address and the destination address in the traffic confirmation message after intercepting it, and then obtaining the user's privacy information, the source address in the traffic confirmation message is also hidden, that is, the source address in the traffic confirmation message is not the terminal address, but the terminal encrypted address, thereby reducing the possibility that the attacker infers the user's privacy information through the source address and the destination address of the traffic confirmation message.
[0111] When the source address of the traffic confirmation message is hidden, in order to further confuse the attacker and maintain the message format, the source address of the traffic confirmation message may further include a terminal hidden address.
[0112] Such as Figure 7 As shown, the traffic confirmation message (Pkt_ack) sent by the terminal device to the server may include a terminal hidden address IP_j, a terminal encrypted address IP_sec, and a currently received message number range Pkt_num_range. Among them, the terminal hidden address is used to confuse the attacker and maintain the message format of the traffic confirmation message, the terminal encrypted address is used to provide the server with an encrypted real source address that only the server can decrypt, and the currently received message number range is used to represent the message reception result of the terminal device.
[0113] It should be noted that in order to ensure that the traffic confirmation message can be accurately forwarded, the destination address of the traffic confirmation message in this embodiment is not encrypted, that is, the traffic confirmation message includes the server address of the server in plain text.
[0114] After the terminal device receives the traffic data of the traffic message, it may send a traffic confirmation message including a message reception result to the server, so that the server can determine the reception status of the terminal device for the traffic message, thereby verifying whether the traffic message is successfully transmitted.
[0115] In a possible implementation manner, the server obtains a traffic confirmation message including a message reception result from the terminal device. The source address of the traffic confirmation message includes a terminal encrypted address, and the message reception result is used to identify the reception status of the terminal device for the traffic message;
[0116] When the server determines that the terminal device has not received the target traffic packet based on the packet reception result, the server sends the target traffic packet as a traffic retransmission packet to the terminal device, and the source address of the traffic retransmission packet includes the encrypted address of the server.
[0117] After the terminal device sends a traffic confirmation packet to the server, the server can obtain the traffic confirmation packet from the terminal device. The traffic confirmation packet includes the packet reception result, and the server can determine the reception situation of the target traffic packet by the terminal device according to the packet reception result.
[0118] When the server determines that the terminal device has received the target traffic packet according to the packet reception result, the server can determine that the transmission of the target traffic packet is successful and there is no need to retransmit the target traffic packet.
[0119] When the server determines that the terminal device has not received the target traffic packet according to the packet reception result, the server can send the target traffic packet as a traffic retransmission packet to the terminal device. The traffic retransmission packet refers to the traffic packet that the terminal device has not received identified according to the packet reception result, and the traffic retransmission packet is used to retransmit the traffic packet that the terminal device has not received. That is to say, when there is a traffic packet that the terminal device has not received, the server can retransmit the above unreceived traffic packet as a traffic retransmission packet so that the terminal device can obtain the unreceived traffic packet again. By allowing the server to send the traffic retransmission packet, the terminal device can obtain the unreceived target traffic packet again to ensure the reliability of the packet transmission between the terminal device and the server.
[0120] In order to prevent the relationship between the source address and the destination address in the traffic retransmission packet from being obtained by an attacker after being intercepted during retransmission, the source address in the traffic retransmission packet is also hidden, that is, the source address in the traffic retransmission packet is not the server address either, but the encrypted address of the server, thereby reducing the possibility that the attacker can infer the user's privacy information through the source address and the destination address of the traffic retransmission packet.
[0121] When the source address of the traffic retransmission packet is hidden, in order to further confuse the attacker and maintain the packet format, the source address of the traffic retransmission packet can also include the hidden address of the server.
[0122] It should be noted that in order to ensure that the traffic retransmission packet can be accurately forwarded, the destination address of the traffic retransmission packet in this embodiment is not encrypted, that is, the traffic retransmission packet includes the server address of the server in plain text.
[0123] After receiving the traffic confirmation message sent by the terminal device, the server can determine the reception situation of the terminal device for the traffic message according to the traffic confirmation message. When the terminal device does not receive the target traffic message, it means that the terminal device does not successfully receive the target traffic message returned for the message request message, that is, the terminal device does not completely receive the traffic message returned by the server. The server can send a traffic retransmission message to the terminal device to achieve packet loss retransmission, and reduce the possibility that the terminal device does not completely receive the traffic message returned by the server for the message request message due to the terminal device not receiving the target traffic message.
[0124] In a possible implementation manner, the terminal device obtains a traffic retransmission message in response to the traffic confirmation message from the server. The traffic retransmission message is the traffic message that the terminal device does not receive as identified by the message reception result, and the source address of the traffic retransmission message includes the server encryption address.
[0125] When the server determines according to the traffic confirmation message that there are traffic messages not received by the terminal device, the terminal device can obtain a traffic retransmission message in response to the traffic confirmation message from the server. The traffic retransmission message refers to the message that needs to be retransmitted because the terminal device does not receive it. The terminal device can achieve the re-reception of the traffic message not received by obtaining the traffic retransmission message. Among them, in order to prevent the relationship between the source address and the destination address in the traffic retransmission message from being obtained by an attacker after the traffic retransmission message is intercepted when the terminal device obtains the traffic retransmission message, the source address in the traffic retransmission message is also hidden. When the source address of the traffic retransmission message is hidden, in order to further confuse the attacker and maintain the message format, the source address of the traffic retransmission message can also include the server hidden address.
[0126] The terminal device can obtain a traffic retransmission message in response to the traffic confirmation message to achieve the re-reception of the message not received, so as to ensure the reliability of the message transmission between the terminal device and the server.
[0127] It can be seen that when the terminal device communicates with the server network through interaction messages, the source addresses in the message request messages and traffic messages exchanged between them are encrypted by the public key of the receiving end, and the real source address of the message can only be obtained after being decrypted by the private key of the receiving end. The reason for hiding the source address is that since a message generally carries the source address and the destination address in network communication for correct forwarding, once the attacker intercepts and obtains the relationship between the source address and the destination address, it can be determined when the user of the terminal device goes online and what content services are obtained, thereby inferring the user's privacy information. Therefore, by encrypting the source address of the message, even if the attacker obtains the message, they can only know the receiving end of the message and cannot determine the sending end of the message, so that the attacker can only get fragmented information and cannot splice the fragmented information, thus reducing the possibility of leaking user privacy through the source address and destination address of the message. Moreover, as the terminal device acting as the data receiving end can also restore the real source address of the received message through its own private key, the security of message reception is guaranteed.
[0128] In the foregoing embodiment, the source address of the message between the terminal device and the server is encrypted, thereby reducing the possibility of leaking user privacy through the source address and destination address of the message. Since network communication in the related art is mainly forwarded based on the destination address, if the destination address of the message is modified without permission, the message cannot be correctly forwarded, which will further lead to a decline in the quality of user experience (QoE, Quality of Experience) and the quality of service (QoS, Quality of Services). Therefore, there is still a plaintext destination address in the message, so that the message can be accurately forwarded based on this destination address, ensuring the reliable implementation of the message interaction between the terminal device and the server.
[0129] Although encrypting the source address of the message between the terminal device and the server can reduce the possibility of leaking user privacy through the source address and destination address of the message to a certain extent, since the destination address in the message is not encrypted, there is still a risk of user privacy leakage. Therefore, the destination address of the traffic message with the largest quantity during the network communication process between the terminal device and the server can also be encrypted, so that when the attacker obtains the traffic message, they can neither obtain the sending end of the traffic message nor the receiving end of the traffic message, thereby further reducing the possibility that the attacker infers the user's privacy information through the real source address and destination address.
[0130] In a possible implementation, in S403, the terminal device obtains the traffic packet returned for the message request packet. Correspondingly, that is, the server can send the traffic packet returned for the message request packet to the terminal device according to the terminal address. In terms of the server sending the traffic packet returned for the message request packet to the terminal device according to the terminal address, the data encryption method specifically includes:
[0131] S11. The server determines the traffic link from the server to the terminal device according to the terminal address. The traffic link includes N intermediate routing nodes, where N≥1;
[0132] S12. The server sends the traffic packet returned for the message request packet to the terminal device through the N intermediate routing nodes in the traffic link according to the terminal address.
[0133] The traffic link refers to the link used to forward traffic packets between the server and the terminal device. In the actual process of message interaction between the server and the terminal device, since the server usually sends multiple traffic packets to the terminal device, in order to obtain a stable link for reliable forwarding of traffic packets, the server can determine the traffic link from the server to the terminal device for forwarding traffic packets according to the terminal address. Among them, the traffic link includes N intermediate routing nodes.
[0134] The intermediate routing node refers to the routing node used for traffic packet forwarding between traffic links. In the process of the server sending traffic packets to the terminal device according to the traffic link, the intermediate routing node is used to forward the traffic packet until the previous routing node of the terminal device successfully forwards the traffic packet to the terminal device.
[0135] In order to enable the traffic packet to be successfully sent from the server to the terminal device, the server can first determine the traffic link from the server to the terminal device through the terminal address, and then realize the accurate forwarding of the traffic packet from the server to the terminal device through the N intermediate routing nodes in the traffic link.
[0136] On the basis that the server can determine the traffic link for forwarding traffic packets according to the terminal address, the server can first send a key creation packet to the terminal device based on the traffic link to obtain the relevant information of the intermediate routing nodes of the traffic link. That is, in a possible implementation, the data encryption method further includes:
[0137] S21. The server generates a flow identifier and a shared key for the traffic link according to the terminal address and the server address;
[0138] S22. The server encrypts the shared key with the public key of the terminal device to obtain key-encrypted data;
[0139] S23. The server sends a key creation message including key-encrypted data and a flow identifier to the terminal device through the traffic link. The source address of the key creation message includes the server's encrypted address. The key creation message is used to instruct N intermediate routing nodes to generate an intermediate shared key based on the flow identifier, encrypt the intermediate shared key with the public key of the terminal device, and add the encryption result to the key-encrypted data.
[0140] As mentioned above, the traffic link refers to the link used to forward traffic messages between the server and the terminal device. Since there can be multiple links between the server and the terminal device, the traffic link can be accurately identified according to the flow identifier. For example, the flow identifier of the traffic link can be determined according to the following formula:
[0141] FlowID = Hash(IP_m||IP_i||Port_server||Port_client||Protocol)
[0142] Where FlowID represents the flow identifier, IP_m represents the server address of the server, IP_i represents the terminal address of the terminal device, Port_server represents the server port of the server, Port_client represents the terminal port of the terminal device, Protocol represents the communication protocol between the server and the terminal device, Hash() represents the hash operation, and || represents the concatenation operation.
[0143] According to the above formula, the flow identifier corresponding to the traffic link used to forward traffic messages between the server and the terminal device can be determined.
[0144] The shared key for this traffic link refers to the key information shared by the server with the terminal device calculated based on the flow identifier. The shared key will be encrypted by the server and sent to the terminal device, and will be used to encrypt the data sent by the terminal device to the server in subsequent steps. That is to say, although the shared key is generated by the server, it is not the private key of the server, but the key information that can be shared with the terminal device. For example, the shared key for this traffic link can be calculated according to the following formula:
[0145] Key_share = Hash(info_server||FlowID)
[0146] Where Key_share represents the shared key, info_server represents the private information of the server itself, FlowID represents the flow identifier, Hash() represents the hash operation, and || represents the concatenation operation.
[0147] According to the above formula, the server can calculate the shared key shared with the terminal device based on its own private information and the flow identifier.
[0148] After the server generates a shared key shared with the terminal device based on the flow identifier, in order to allow only the terminal device to obtain the shared key, the shared key can be encrypted according to the public key of the terminal device to obtain corresponding key encryption data. For example, the key encryption data corresponding to the shared key can be obtained through the following formula:
[0149] Enc_share = Enc{Key_pub_client, Key_share}
[0150] Where Enc_share represents the key encryption data, Key_pub_client represents the public key of the terminal device, Key_share represents the shared key, and Enc{α,β} represents encrypting data β using key α.
[0151] According to the above formula, the server can encrypt the shared key according to the public key of the terminal device to obtain key encryption data that only the terminal device can decrypt.
[0152] After the server obtains the flow identifier and key encryption data for the traffic link, the server can send the flow identifier and key encryption data to the terminal device through a key creation message. Among them, in order to prevent the relationship between the source address and the destination address in the message from being obtained by an attacker after the key creation message is intercepted during forwarding, the source address in the key creation message is also hidden, that is, the source address in the key creation message is not the server address, but the server encrypted address, thereby reducing the possibility that the attacker can infer the user's privacy information through the source address and destination address of the key creation message. When the source address of the key creation message is hidden, in order to further confuse the attacker and maintain the message format, the source address of the key creation message can also include the server hidden address. As Figure 8 shown, the key creation message (Pkt_key) includes the server hidden address, the flow identifier, the server encrypted address, and the key encryption data.
[0153] It should be noted that in order to ensure that the key creation message can be accurately forwarded, in this embodiment, the destination address of the key creation message is not encrypted, that is, the key creation message includes the plaintext terminal address of the terminal device, so that the key creation message can be accurately forwarded to the terminal device based on the terminal address during network communication.
[0154] The key creation message can be forwarded by the server to the terminal device according to the intermediate routing nodes in the traffic link. During the forwarding process, in order to obtain the intermediate shared key shared by the intermediate routing nodes, the server, and the terminal device, the intermediate shared key refers to the key information shared by the intermediate routing node with the terminal device and the server calculated according to the flow identifier. The intermediate shared key will be encrypted and added to the key encryption data in the key creation message for sending to the terminal device, and in subsequent steps, it can be sent by the terminal device to the server so that the server can encrypt the destination address of the traffic message according to the intermediate shared key. That is to say, although the intermediate shared key is generated by the intermediate routing node, it is not private to the intermediate routing node, but is key information that can be shared with the terminal device and the server. For example, the intermediate shared key for this traffic link can be calculated according to the following formula:
[0155] Key_share_i = Hash(Info_i||FlowID)
[0156] Where Key_share_i represents the intermediate shared key of the i-th intermediate routing node, info_i represents the private information of the i-th intermediate routing node, FlowID represents the flow identifier, Hash() represents the hashing operation, and || represents the concatenation operation.
[0157] According to the above formula, each intermediate routing node in the traffic link can calculate the intermediate shared key shared with the terminal device and the server according to its own private information and the flow identifier.
[0158] After the intermediate routing node generates the intermediate shared key shared with the terminal device and the server according to the flow identifier, in order to allow only the terminal device to obtain the intermediate shared key according to the key confirmation message, the intermediate shared key can be encrypted according to the public key of the terminal device to obtain the corresponding encryption result. For example, the encryption result corresponding to the intermediate shared key can be obtained through the following formula:
[0159] Enc_share_i = Enc{Key_pub_client, Key_share_i||IP_router_i}
[0160] Where Enc_share_i represents the encryption result corresponding to the intermediate shared key of the i-th intermediate routing node, Key_pub_client represents the public key of the terminal device, Key_share_i represents the intermediate shared key of the i-th intermediate routing node, IP_router_i represents the IP address of the i-th intermediate routing node, Enc{α,β} represents the encryption operation of using the key α on the data β, and || represents the concatenation operation.
[0161] According to the above formula, after each intermediate routing node in the traffic link generates an intermediate shared key, it can obtain the corresponding encryption result of the intermediate shared key through the public key of the terminal device, and the intermediate shared key of each intermediate routing node in the encryption result corresponds one-to-one with its IP address.
[0162] After the intermediate routing node obtains the encryption result corresponding to the intermediate shared key, in order to enable the terminal device to obtain the encryption result according to the key creation message, as Figure 9 shown, Figure 9 in the example, the intermediate routing nodes in the traffic link are determined to be 3, denoted as R1, R2, and R3. Among them, the encryption result (Enc_share_i) corresponding to each intermediate routing node in the traffic link can be added to the key creation message (Pkt_key). Figure 9 The "+=" symbol in the figure indicates embedding the intermediate shared key in the key creation message. The encryption result can be embedded in the "extension" part of the header of the key creation message, or it can also be embedded in the payload, which is not limited here. Adding the encryption result to the key creation message enables the terminal device in subsequent steps to obtain not only the shared key but also the intermediate shared key through the key creation message.
[0163] That is to say, after the server generates the flow identifier and the shared key for the traffic link, it can send a key creation message including key encryption data (including the encrypted shared key) and the flow identifier to the terminal device through the traffic link. During the process of forwarding the key creation message by the intermediate routing nodes in the traffic link, the key creation message can instruct the intermediate routing nodes to generate intermediate shared keys according to the flow identifier and add the encrypted intermediate shared keys to the key encryption data, so that in subsequent steps, after the terminal device obtains the key creation message, it can obtain the intermediate shared keys corresponding to each intermediate routing node in the traffic link through the key encryption data in the key creation message, laying a foundation for the subsequent step where the server can encrypt the destination address in the traffic packet according to the intermediate shared key.
[0164] In a possible implementation manner, after the server sends a key creation message including key encryption data and a flow identifier to the terminal device through the traffic link in S23, the data encryption method further includes:
[0165] S31. The terminal device obtains the key creation message returned by the server for the message request packet according to the traffic link with the server. The source address of the key creation message includes the server encryption address, and the key creation message includes key encryption data encrypted by the public key of the terminal device.
[0166] S32. The terminal device decrypts the key-encrypted data using the private key of the terminal device to obtain the shared key between the terminal device and the server, and N intermediate shared keys corresponding one-to-one to N intermediate routing nodes in the traffic link, where N ≥ 1;
[0167] S33. The terminal device encrypts the N intermediate shared keys using the shared key to obtain intermediate key-encrypted data;
[0168] S34. The terminal device sends a key confirmation message including the intermediate key-encrypted data to the server, and the source address of the key confirmation message includes the terminal encryption address.
[0169] The terminal device can obtain the key creation message sent by the server according to the traffic link. After obtaining the key creation message, it is necessary to determine the source address of the key creation message in order to make an accurate response to the key creation message. Since the source address in the key creation message is hidden, the server address of the server can be obtained by decrypting the server encryption address in the key creation message.
[0170] As mentioned above, the key creation message includes key-encrypted data, which not only includes the encrypted shared key shared by the server and the terminal device, but also includes the encrypted intermediate shared keys shared by each intermediate routing node in the traffic link with the terminal device and the server.
[0171] Since the key-encrypted data is encrypted using the public key of the terminal device, the key-encrypted data can be decrypted using the private key of the terminal device to obtain the shared key shared between the terminal device and the server, and the intermediate shared keys corresponding one-to-one to each intermediate routing node in the traffic link. For example, the shared key can be obtained through the following formula:
[0172] Key_share = Dec{Key_pri_client, Enc_share}
[0173] Where Key_share represents the shared key, Key_pri_client represents the private key of the terminal device, Enc_share represents the key-encrypted data corresponding to the shared key, and Dec{α,β} represents the decryption operation of using the key α on the data β.
[0174] The intermediate shared key can also be obtained through the following formula:
[0175] Key_share_i,IP_router_i = Dec{Key_pri_client, Enc_share_i}
[0176] Among them, Key_share_i represents the intermediate shared key of the i-th intermediate routing node, IP_router_i represents the IP address of the i-th intermediate routing node, Key_pri_client represents the private key of the terminal device, Enc_share_i represents the encryption result corresponding to the intermediate shared key of the i-th intermediate routing node, and Dec{α,β} represents the decryption operation of data β using key α.
[0177] After the terminal device obtains the intermediate shared key corresponding to each intermediate routing node in the traffic link, it needs to send the intermediate shared key to the server. To ensure that only the server can obtain the intermediate shared key, the intermediate shared key can be encrypted using the shared key between the terminal device and the server to obtain the intermediate key encrypted data. For example, the intermediate key encrypted data can be calculated according to the following formula:
[0178] Enc_share_server_i = Enc{Key_share, Key_share_i||IP_router_i}
[0179] Among them, Enc_share_server_i represents the intermediate key encrypted data of the i-th intermediate routing node, Key_share represents the shared key, Key_share_i represents the intermediate shared key of the i-th intermediate routing node, IP_router_i represents the IP address of the i-th intermediate routing node, Enc{α,β} represents the encryption operation of data β using key α, and || represents the concatenation operation.
[0180] According to the above formula, the intermediate shared key can be encrypted using the shared key to obtain the corresponding intermediate key encrypted data, and the intermediate shared key of each intermediate routing node in the intermediate key encrypted data corresponds one-to-one with its IP address.
[0181] The terminal device can send a key confirmation message including the intermediate key encrypted data to the server, so that the server can obtain the intermediate shared key corresponding to each intermediate routing node in the traffic link by obtaining the key confirmation message, laying a foundation for encrypting the destination address of the traffic packet according to the intermediate shared key in the subsequent steps.
[0182] To prevent an attacker from obtaining the relationship between the source address and the destination address in the key confirmation message after intercepting it during forwarding, the source address in the key confirmation message is also hidden, that is, the source address in the key confirmation message is not the terminal address but the terminal encryption address, thereby reducing the possibility for the attacker to infer the user's privacy information through the source address and the destination address of the key confirmation message. When the source address of the key confirmation message is hidden, to further confuse the attacker and maintain the message format, the source address of the key confirmation message may further include a terminal hidden address. As Figure 10 shown, the key confirmation message (Pkt_key_ack) includes a terminal hidden address, a terminal encryption address, and intermediate key encrypted data.
[0183] It should be noted that, to ensure that the key confirmation message can be accurately forwarded, in this embodiment, the destination address of the key confirmation message is not encrypted, that is, the key confirmation message includes the server address of the server in plain text, so that the key confirmation message can be accurately forwarded to the server based on the server address during network communication.
[0184] In addition, as Figure 10 shown, the key confirmation message does not need to be forwarded from the terminal device to the server based on the link corresponding to the traffic link. That is to say, the key confirmation message only needs to be successfully forwarded from the terminal device to the server based on the server address, and does not necessarily need to be forwarded according to the intermediate routing nodes in the traffic link.
[0185] After the terminal device obtains the key creation message, it can determine the intermediate shared key corresponding to each intermediate routing node in the traffic link for forwarding the traffic message through the key encrypted data in the key creation message, and send a key confirmation message including the intermediate key encrypted data (the intermediate shared key encrypted according to the shared key) to the server, so that the server can obtain the intermediate shared key corresponding to the intermediate routing node, laying a foundation for the server to encrypt the destination address of the traffic message according to the intermediate shared key in the subsequent steps.
[0186] In a possible implementation manner, after the terminal device sends a key confirmation message including intermediate key encrypted data to the server in S34, the data encryption method further includes:
[0187] S41. The server obtains the key confirmation message returned in response to the key creation message from the terminal device. The source address of the key confirmation message includes the terminal encryption address. The key confirmation message includes intermediate key encrypted data, and the intermediate key encrypted data is obtained by encrypting N intermediate shared keys with a shared key. The N intermediate shared keys correspond to N intermediate routing nodes one by one;
[0188] S42. The server decrypts the intermediate key encrypted data using the shared key to obtain N intermediate shared keys.
[0189] S43. The server obtains encrypted routing information corresponding to the N intermediate routing nodes based on the N intermediate shared keys and the routing addresses of the N intermediate routing nodes. For the i-th intermediate routing node among the N intermediate routing nodes, the corresponding encrypted routing information is obtained by encrypting the routing information of the i-th intermediate routing node and the routing information of the next-hop node of the i-th intermediate routing node using the intermediate shared key of the i-th intermediate routing node.
[0190] S44. The server adds the encrypted routing information to the traffic packet. The destination address of the traffic packet is the terminal address encrypted using the target intermediate shared key, and the target intermediate shared key is the intermediate shared key of the previous-hop intermediate routing node of the terminal device in the traffic link.
[0191] The server can obtain a key confirmation message returned from the terminal device. After obtaining the key confirmation message, the server needs to determine the source address of the key confirmation message so as to determine that the terminal device has successfully obtained the key creation message and returned the corresponding key confirmation message. Since the source address in the key confirmation message is concealed, the true source address of the key confirmation message can be determined as the terminal address of the terminal device by decrypting the terminal encrypted address in the key confirmation message.
[0192] Since the key confirmation message includes intermediate key encrypted data, as mentioned above, the intermediate key encrypted data is obtained by the terminal device encrypting the intermediate shared keys corresponding to each intermediate routing node in the traffic link using the shared key, and the shared key is the key information shared between the terminal device and the server. Therefore, the server can decrypt the intermediate key encrypted data using the shared key to obtain the intermediate shared keys corresponding to each intermediate routing node in the traffic link. For example, the intermediate shared key can be obtained through the following formula:
[0193] Key_share_i, IP_router_i = Dec{Key_share, Enc_share_server_i}
[0194] where Key_share_i represents the intermediate shared key of the i-th intermediate routing node, IP_router_i represents the IP address of the i-th intermediate routing node, Key_share represents the shared key, Enc_share_server_i represents the intermediate key encrypted data of the i-th intermediate routing node, and Dec{α,β} represents the operation of decrypting data β using key α.
[0195] Through the above formula, the server can decrypt the intermediate key encrypted data using the shared key to obtain the intermediate shared key corresponding to each intermediate routing node in the traffic link.
[0196] After the server obtains the intermediate shared key corresponding to each intermediate routing node in the traffic link, it can save the intermediate shared key so that when generating traffic packets forwarded based on the traffic link later, it can directly obtain the saved intermediate shared key to encrypt each intermediate routing node in the traffic link.
[0197] After the server obtains the intermediate shared key corresponding to each intermediate routing node in the traffic link, in order to encrypt the destination address of the traffic packet forwarded based on the traffic link, it can determine the encrypted routing information used to indicate its next-hop node for each intermediate routing node based on the routing information of each intermediate routing node in the traffic link, the routing information of the next-hop node, and the corresponding intermediate shared key, so as to encrypt each intermediate routing node in the traffic link. Among them, the terminal address is also encrypted by the corresponding target intermediate shared key as the routing information of the next-hop node of the previous-hop intermediate routing node of the terminal device in the traffic link. The target intermediate shared key refers to the intermediate shared key corresponding to the previous-hop intermediate routing node of the terminal device. The encrypted routing information of the intermediate routing node refers to the information data indicating its next-hop node encrypted by the corresponding intermediate shared key. For example, the encrypted routing information corresponding to each intermediate routing node in the traffic link can be obtained through the following formula:
[0198] Enc_routing_i = Enc{Key_share_i, IP_router_i||IP_router_i+1}
[0199] Where Enc_routing_i represents the encrypted routing information of the i-th intermediate routing node, Key_share_i represents the intermediate shared key of the i-th intermediate routing node, IP_router_i represents the IP address of the i-th intermediate routing node, IP_router_i+1 represents the IP address of the next-hop node of the i-th intermediate routing node, Enc{α,β} represents the encryption operation of using the key α for the data β, and || represents the concatenation operation.
[0200] According to the above formula, the information of the next-hop node of the i-th intermediate routing node can be encrypted using the intermediate shared key corresponding to the i-th intermediate routing node to obtain the corresponding encrypted routing information. Through the encrypted routing information, the intermediate routing nodes in the traffic link can only obtain the routing information of the next-hop node, reducing the risk that an attacker obtains the destination address of the traffic packet by hijacking the intermediate routing node.
[0201] When the server adds encrypted routing information to the traffic packet, each intermediate routing node in the traffic link can decrypt the encrypted routing information according to the intermediate shared key corresponding to the intermediate routing node after receiving the traffic packet, and obtain the routing information of a certain intermediate routing node and the routing information of the corresponding next-hop node. For example, the decrypted encrypted routing information can be obtained through the following formula:
[0202] IP_router_i, IP_router_i+1 = Dec{Key_share_i, Enc_routing_i}
[0203] Wherein, IP_router_i represents the IP address of the i-th intermediate routing node, IP_router_i+1 represents the IP address of the next-hop node of the i-th intermediate routing node, Key_share_i represents the intermediate shared key of the i-th intermediate routing node, Enc_routing_i represents the encrypted routing information of the i-th intermediate routing node, and Dec{α,β} represents the decryption operation of using the key α for the data β.
[0204] Through the above formula, the encrypted routing information can be decrypted according to the intermediate shared key of the i-th intermediate routing node to obtain the IP address of the i-th intermediate routing node and the IP address of the next-hop node. If the IP address of the i-th intermediate routing node matches its own IP address, the traffic packet can be forwarded to the IP address of the next-hop node; if the IP address of the i-th intermediate routing node does not match its own IP address, the traffic packet can be directly discarded. That is to say, when the intermediate routing node decrypts the encrypted routing information according to its corresponding intermediate shared key, it will obtain the routing information of a certain intermediate routing node and the routing information of the corresponding next-hop node. If the routing information of the certain intermediate routing node is consistent with the own routing information of the intermediate routing node, the intermediate routing node can forward the traffic packet to the next-hop node, that is, the traffic packet can be forwarded in sequence on the traffic link through the encrypted routing information.
[0205] The server can add encrypted routing information to the traffic packet, so that the traffic packet does not include the plaintext destination address. Instead, each intermediate routing node in the traffic link can forward the traffic packet to the next-hop node in sequence according to its corresponding encrypted routing information until the traffic packet is successfully forwarded to the terminal device. Among them, the terminal address is encrypted by the target intermediate shared key corresponding to the previous-hop intermediate routing node of the terminal device in the traffic link. Specifically, as the routing information of the next-hop node of the previous-hop intermediate routing node of the terminal device, the terminal address can be encrypted in the encrypted routing information of the previous-hop intermediate routing node through the target intermediate shared key, thus realizing the encryption of the destination address in the traffic packet.
[0206] In addition, the source address in the traffic packet is still hidden, that is, the source address in the traffic packet is not the server address but the server encrypted address. When both the source address and the destination address of the traffic packet are hidden, in order to further confuse the attacker and maintain the packet format, the source address of the traffic packet can also include the server hidden address. Correspondingly, the destination address of the traffic packet can also include the terminal hidden address. As Figure 11 shown, the traffic packet (Pkt_traffic) can include the server hidden address, the terminal hidden address, the server encrypted address, and the encrypted routing information.
[0207] After the server obtains the intermediate shared key corresponding to each intermediate routing node in the traffic link according to the key confirmation message, it can encrypt the next-hop information of each intermediate routing node in the traffic link according to the intermediate shared key, so that the traffic packet can be accurately forwarded to the terminal device according to the encrypted routing information without including the plaintext destination address. That is to say, on the basis of encrypting the source address of the traffic packet, the destination address can also be encrypted through the encrypted routing information, so that when the attacker intercepts the traffic packet, it can neither obtain the sender nor the receiver of the traffic packet, thus further reducing the possibility that the source address and the destination address in the traffic packet are inferred by the attacker.
[0208] Correspondingly, in a possible implementation manner, in S403, when the terminal device obtains the traffic packet returned for the message request packet, the data encryption method specifically includes:
[0209] The terminal device obtains the traffic packet returned for the message request packet from the server according to the traffic link. The destination address of the traffic packet is the terminal address encrypted by the target intermediate shared key, and the target intermediate shared key is the intermediate shared key of the previous-hop intermediate routing node of the terminal device in the traffic link.
[0210] When the server adds encrypted routing information to the traffic packet, the intermediate routing nodes in the traffic link can decrypt the encrypted routing information, so that the traffic packet can be forwarded to the terminal device sequentially through the traffic link. At this time, the traffic packet does not include the plaintext terminal address, but the terminal address is encrypted by the target intermediate shared key (the intermediate shared key corresponding to the previous-hop intermediate routing node of the terminal device) in the traffic link, so that the source address and destination address of the traffic packet are both hidden by being encrypted in the packet.
[0211] On the basis that the source address of the traffic packet is encrypted, the destination address can also be encrypted by the target intermediate shared key. At this time, the traffic packet can be forwarded to the terminal device sequentially according to the traffic link. That is to say, the traffic packet can be successfully forwarded from the server to the terminal device when both the source address and destination address are encrypted, thus further reducing the possibility that the source address and destination address in the traffic packet are inferred by the attacker.
[0212] After the server obtains the key confirmation packet sent by the terminal device, it needs to decrypt the intermediate key encrypted data in the key confirmation packet according to the shared key. If the server always maintains the shared key shared with the terminal device, this will undoubtedly increase the burden on the server. Therefore, in a possible implementation manner, before decrypting the intermediate key encrypted data according to the shared key in S42, the server can obtain the shared key through the following method:
[0213] The server decrypts the terminal encrypted address according to the private key of the server to obtain the terminal address;
[0214] The server generates a flow identifier for the traffic link according to the terminal address and the server address;
[0215] The server generates a shared key through the terminal address and the flow identifier.
[0216] Since the key confirmation packet includes the terminal encrypted address, the terminal encrypted address can be decrypted according to the private key of the server to obtain the terminal address. The server can generate a flow identifier for the traffic link again according to the terminal address and the server address. For example, the flow identifier of the traffic link can be determined according to the following formula:
[0217] FlowID = Hash(IP_m||IP_i||Port_server||Port_client||Protocol)
[0218] Among them, FlowID represents the flow identifier, IP_m represents the server address of the server, IP_i represents the terminal address of the terminal device, Port_server represents the server port of the server, Port_client represents the terminal port of the terminal device, Protocol represents the communication protocol between the server and the terminal device, Hash() represents the hash operation, and || represents the concatenation operation.
[0219] Based on determining the flow identifier of the traffic link, the server can determine the shared key corresponding to the terminal device again according to the terminal address and the flow identifier. For example, the shared key for this traffic link can be calculated according to the following formula:
[0220] Key_share = Hash(info_server||FlowID)
[0221] Among them, Key_share represents the shared key, info_server represents the private information of the server itself, FlowID represents the flow identifier, Hash() represents the hash operation, and || represents the concatenation operation.
[0222] The server does not need to always maintain the shared key shared with the terminal device. When it is necessary to decrypt the intermediate key encrypted data in the key confirmation message according to the shared key, the server can generate the flow identifier and the shared key corresponding to the traffic link again according to the terminal address and the server address, and decrypt the intermediate key encrypted data with the directly generated shared key, thereby reducing the cost for the server to maintain the shared key.
[0223] Similarly, in order to avoid the cost for the intermediate routing node to maintain the intermediate shared key, in a possible implementation, the traffic packet further includes a flow identifier, which is used to instruct the intermediate routing node to generate the corresponding intermediate shared key according to the flow identifier, and decrypt the encrypted routing information with the intermediate shared key to obtain the routing information of the next-hop node.
[0224] When the traffic packet includes encrypted routing information, the intermediate routing node needs to decrypt the encrypted routing information based on the corresponding intermediate shared key to obtain the routing information of the next-hop node. If the intermediate routing node always maintains the intermediate shared key for this purpose, it will obviously cause a certain cost. Therefore, the traffic packet can also include a flow identifier, such as Figure 11 As shown, the traffic packet (Pkt_traffic) can also include a flow identifier, so that the intermediate routing node can directly generate the corresponding intermediate shared key according to the flow identifier. For example, the intermediate shared key can be calculated according to the following formula:
[0225] Key_share_i = Hash(Info_i||FlowID)
[0226] Among them, Key_share_i represents the intermediate shared key of the i-th intermediate routing node, info_i represents the own private information of the corresponding i-th intermediate routing node, FlowID represents the flow identifier, Hash() represents the hashing operation, and || represents the concatenation operation.
[0227] The intermediate routing node does not need to always maintain the intermediate shared key shared with the terminal device and the server. When it is necessary to decrypt the encrypted routing information in the traffic packet according to the intermediate shared key, the intermediate routing node can regenerate the corresponding intermediate shared key according to the flow identifier, so as to reduce the cost of the intermediate routing node for maintaining the intermediate shared key.
[0228] The following uses a method embodiment to illustrate the specific process of the data encryption method in this application in actual situations, as Figure 12 shown, the specific process of this data encryption method includes:
[0229] S1201. The terminal device sends a message request packet carrying the terminal hidden address and the terminal encrypted address.
[0230] The terminal device sends a message request packet to the server. This message request packet can be used to obtain the target content from the server. Among them, the message request packet does not include the plaintext terminal address, but carries the terminal encrypted address in the message request packet, so as to hide the source address in the message request packet by encrypting the source address. And in order to further confuse the attacker and maintain the packet format, the message request packet also carries the terminal hidden address.
[0231] S1202. The server sends a key creation packet.
[0232] After obtaining the message request packet, in order to obtain the intermediate shared key corresponding to the intermediate routing node of the traffic link for forwarding the traffic packet, the server will send a key creation packet. Among them, the key creation packet does not include the plaintext server address, but carries the server encrypted address in the key creation packet, so as to hide the source address of the key creation packet by encrypting the source address. And in order to further confuse the attacker and maintain the packet format, the key creation packet also carries the server hidden address.
[0233] At the same time, the key creation packet also carries the shared key shared between the server and the terminal device and the flow identifier corresponding to the traffic link.
[0234] S1203. The intermediate routing node calculates the intermediate shared key, encrypts it and embeds it into the key creation packet
[0235] When the intermediate routing node forwards the key creation message, it calculates the corresponding intermediate shared key based on its own information and the flow identification information, and embeds the calculated intermediate shared key into the key creation message after encrypting it with the public key corresponding to the destination address (terminal device), so that the terminal device can obtain the intermediate shared key through the key creation message.
[0236] S1204. The terminal device decrypts to obtain the intermediate shared key, encrypts it, and sends it back to the server through the key confirmation message.
[0237] After obtaining the key creation message, the terminal device can decrypt the encrypted intermediate shared key information carried in the key creation message according to its own private key, and embed the obtained intermediate shared key into the key confirmation message after encrypting it with the shared key shared with the server, so that the encrypted intermediate shared key can be sent back to the server through the key confirmation message. Among them, the key confirmation message also does not include the plaintext terminal address, but carries the encrypted terminal address in the key confirmation message, so as to achieve the concealment of the source address in the key confirmation message by encrypting the source address. And in order to further confuse the attacker and maintain the message format, the key confirmation message also carries the terminal hidden address.
[0238] S1205. The server decrypts to obtain the intermediate shared key and encrypts the routing information of the traffic link with the intermediate shared key.
[0239] After receiving the key confirmation message, the server can decrypt the encrypted intermediate shared key information carried in the key confirmation message through the shared key shared with the terminal device, obtain the intermediate shared key shared with the intermediate routing node of the traffic link, and encrypt the routing information of the traffic link with the intermediate shared key to obtain the corresponding encrypted routing information. Adding this encrypted routing information to the traffic message can enable the traffic message to complete the forwarding of the traffic message through the encrypted routing information corresponding to each hop of the intermediate routing node carried in the traffic message without including the plaintext destination address. That is to say, the traffic message can encrypt the destination address through the intermediate shared key. On this basis, the traffic message can still encrypt the source address, so as to conceal both the source address and the destination address in the traffic message.
[0240] S1206. The intermediate routing node calculates the intermediate shared key and verifies the encrypted routing information in the traffic message.
[0241] After receiving the traffic message, the intermediate routing node can calculate the intermediate shared key again according to the flow identification, and use the intermediate shared key to decrypt the encrypted routing information carried in the traffic message to obtain the decrypted routing information and the routing information of the corresponding next-hop node.
[0242] S1207. The intermediate routing node verifies whether its own routing information is consistent with the decrypted routing information.
[0243] After decrypting the encrypted routing information carried in the traffic packet, the intermediate routing node needs to verify whether its own routing information is consistent with the decrypted routing information.
[0244] S1208a. If the intermediate routing node's own routing information is consistent with the decrypted routing information, the traffic packet can be forwarded to the next-hop node to achieve the sequential forwarding of the traffic packet in the traffic link.
[0245] S1208b. If the intermediate routing node's own routing information is inconsistent with the decrypted routing information, the intermediate routing node can discard the packet.
[0246] S1209. The terminal device sends a traffic confirmation packet to the server for lost packet retransmission.
[0247] After receiving the traffic packet, the terminal device can send a traffic confirmation packet to the server. The traffic confirmation packet is used to enable the server to obtain the lost packet information of the terminal device and, when the terminal device loses a packet, retransmit the lost packet data by sending the traffic packet again. The traffic confirmation packet also does not include the plaintext terminal address, but carries the encrypted terminal address in the traffic confirmation packet to hide the source address in the traffic confirmation packet by encrypting the source address. To further confuse the attacker and maintain the packet format, the traffic confirmation packet also carries the terminal hidden address.
[0248] As Figure 13 shown, taking the network communication between the server and terminal device B as an example and adopting the above data encryption method, the network communication between the server and the terminal device can be described. This application can implement the network communication between terminal device B and the server through a message request packet with the source address encrypted, a key creation packet with the source address encrypted, a key confirmation packet with the source address encrypted, a traffic packet with the source address and destination address encrypted, and a traffic confirmation packet with the source address encrypted. During the packet interaction process, at least one of the source address and destination address of the packets exchanged between the server and the terminal device is encrypted, and both the source address and destination address in the traffic packets with the largest quantity are encrypted, thereby reducing the possibility of the attacker leaking user privacy through the source address and destination address and enhancing the security of packet interaction.
[0249] Based on the foregoing Figure 1-13 corresponding embodiment, Figure 14This is the device structure diagram of a data encryption device provided by an embodiment of the present application. The data encryption device 1400 includes a sending unit 1401, an obtaining unit 1402, a decrypting unit 1403, and a receiving unit 1404:
[0250] The sending unit 1401 is configured to send a message request packet to the server. The source address of the message request packet includes a terminal encryption address, and the terminal encryption address is obtained by encrypting the terminal address of the terminal device with the public key of the server;
[0251] The obtaining unit 1402 is configured to obtain a traffic packet returned by the server for the message request packet from the server. The source address of the traffic packet includes a server encryption address, and the server encryption address is obtained by encrypting the server address of the server with the public key of the terminal device;
[0252] The decrypting unit 1403 is configured to decrypt the server encryption address with the private key of the terminal device to obtain a server pending address;
[0253] The receiving unit 1404 is configured to receive the traffic data in the traffic packet in response to the server pending address being consistent with the server address.
[0254] In a possible implementation manner, the source address of the message request packet further includes a terminal hiding address, and the terminal hiding address is different from the terminal address; the source address of the traffic packet further includes a server hiding address, and the server hiding address is different from the server address.
[0255] In a possible implementation manner, the sending unit 1401 is further configured to:
[0256] According to the traffic link with the server, obtain a key creation packet returned by the server for the message request packet. The source address of the key creation packet includes a server encryption address, and the key creation packet includes key encryption data encrypted with the public key of the terminal device;
[0257] Decrypt the key encryption data with the private key of the terminal device to obtain a shared key between the terminal device and the server, and N intermediate shared keys corresponding to N intermediate routing nodes in the traffic link, where N≥1;
[0258] Encrypt the N intermediate shared keys with the shared key to obtain intermediate key encryption data;
[0259] Send a key confirmation packet including the intermediate key encryption data to the server. The source address of the key confirmation packet includes a terminal encryption address.
[0260] In a possible implementation, the obtaining unit 1402 is configured to obtain, according to a traffic link, a traffic packet returned by a server for a message request packet, where a destination address of the traffic packet is a terminal address encrypted by a target intermediate shared key, and the target intermediate shared key is an intermediate shared key of the previous-hop intermediate routing node of the terminal device in the traffic link.
[0261] In a possible implementation, the sending unit 1401 is further configured to, after receiving traffic data in the traffic packet in response to the server pending address being consistent with the server address:
[0262] Determine a packet reception result for the traffic packet;
[0263] Send a traffic confirmation packet including the packet reception result to the server, where a source address of the traffic confirmation packet includes a terminal encrypted address.
[0264] In a possible implementation, the obtaining unit 1402 is further configured to:
[0265] Obtain a traffic retransmission packet in response to the traffic confirmation packet from the server, where the traffic retransmission packet is a traffic packet not received by the terminal device identified according to the packet reception result, and a source address of the traffic retransmission packet includes a server encrypted address.
[0266] In the foregoing Figure 1-13 Based on the corresponding embodiment, Figure 15 FIG. 1500 is a structural diagram of another data encryption device provided by an embodiment of the present application. The data encryption device 1500 includes an obtaining unit 1501, a decryption unit 1502, and a sending unit 1503;
[0267] The obtaining unit 1501 is configured to obtain a message request packet from a terminal device, where a source address of the message request packet includes a terminal encrypted address, and the terminal encrypted address is obtained by encrypting a terminal address of the terminal device with a public key of the server;
[0268] The decryption unit 1502 is configured to decrypt the terminal encrypted address with a private key of the server to obtain the terminal address;
[0269] The sending unit 1503 is configured to send a traffic packet returned for the message request packet to the terminal device according to the terminal address, where a source address of the traffic packet includes a server encrypted address, and the server encrypted address is obtained by encrypting a server address of the server with a public key of the terminal device.
[0270] In a possible implementation, the sending unit 1503 is configured to:
[0271] Determine a traffic link from the server to the terminal device according to the terminal address, where the traffic link includes N intermediate routing nodes, N≥1;
[0272] According to the terminal address, send a traffic packet returned in response to a message request packet to the terminal device through N intermediate routing nodes in the traffic link.
[0273] In a possible implementation, the sending unit 1503 is further configured to:
[0274] Generate a flow identifier and a shared key for the traffic link according to the terminal address and the server address;
[0275] Encrypt the shared key with the public key of the terminal device to obtain key-encrypted data;
[0276] Send a key creation packet including the key-encrypted data and the flow identifier to the terminal device through the traffic link. The source address of the key creation packet includes the server encryption address. The key creation packet is used to instruct the N intermediate routing nodes to generate an intermediate shared key according to the flow identifier, encrypt the intermediate shared key with the public key of the terminal device, and add the encryption result to the key-encrypted data.
[0277] In a possible implementation, the obtaining unit 1501 is further configured to:
[0278] Obtain a key confirmation packet returned in response to the key creation packet from the terminal device. The source address of the key confirmation packet includes the terminal encryption address. The key confirmation packet includes intermediate key-encrypted data, which is obtained by encrypting the shared key with N intermediate shared keys. The N intermediate shared keys correspond to the N intermediate routing nodes one by one;
[0279] Decrypt the intermediate key-encrypted data with the shared key to obtain N intermediate shared keys;
[0280] According to the N intermediate shared keys and the routing addresses of the N intermediate routing nodes, obtain encryption routing information corresponding to the N intermediate routing nodes one by one. For the i-th intermediate routing node among the N intermediate routing nodes, the corresponding encryption routing information is obtained by encrypting the routing information of the i-th intermediate routing node and the routing information of the next-hop node of the i-th intermediate routing node with the intermediate shared key of the i-th intermediate routing node;
[0281] Add the encryption routing information to the traffic packet. The destination address of the traffic packet is the terminal address encrypted with the target intermediate shared key, and the target intermediate shared key is the intermediate shared key of the previous-hop intermediate routing node of the terminal device in the traffic link.
[0282] In a possible implementation, the obtaining unit 1501 is further configured to, before decrypting the intermediate key-encrypted data with the shared key to obtain the N intermediate shared keys:
[0283] Decrypt the encrypted address of the terminal according to the private key of the server to obtain the terminal address;
[0284] Generate a flow identifier for the traffic link according to the terminal address and the server address;
[0285] Generate a shared key through the terminal address and the flow identifier.
[0286] In a possible implementation manner, the traffic packet further includes a flow identifier, and the flow identifier is used to instruct an intermediate routing node to generate a corresponding intermediate shared key according to the flow identifier, and decrypt the encrypted routing information through the intermediate shared key to obtain the routing information of the next-hop node.
[0287] In a possible implementation manner, the sending unit 1503 is further configured to: obtain a traffic acknowledgment packet including a packet reception result from the terminal device, where the source address of the traffic acknowledgment packet includes the encrypted address of the terminal, and the packet reception result is used to identify the reception status of the traffic packet by the terminal device;
[0288] When it is determined according to the packet reception result that the terminal device has not received the target traffic packet, send the target traffic packet as a traffic retransmission packet to the terminal device, where the source address of the traffic retransmission packet includes the encrypted address of the server.
[0289] In the foregoing Figure 1-13 Based on the corresponding embodiment Figure 16 FIG. 1600 is a system structure diagram of a data encryption system provided in an embodiment of the present application. The data encryption system 1600 includes a terminal device 1601 and a server 1602. The terminal device 1601 is configured to execute the method in the foregoing method embodiment, and the server 1602 is configured to execute the method in the foregoing method embodiment.
[0290] It can be seen that when the terminal device communicates with the server network through an interactive packet, the source addresses in the message request packet and the traffic packet exchanged between them are both encrypted by the public key of the receiving end, and the real source address of the packet can be obtained only after being decrypted by the private key of the receiving end. The reason for hiding the source address is that since a packet generally carries a source address and a destination address in network communication for correct forwarding, once the attacker intercepts and obtains the relationship between the source address and the destination address, it can be determined when the user of the terminal device goes online and what content services are obtained, thereby inferring the user's privacy information. Therefore, by encrypting the source address of the packet, even if the attacker obtains the packet, it can only know the receiving end of the packet and cannot determine the sending end of the packet, so that the attacker can only obtain fragmented information and cannot splice the fragmented information, thereby reducing the possibility of leaking user privacy through the source address and destination address of the packet. Moreover, the terminal device as the data receiving end can also restore the real source address of the received packet through its own private key, ensuring the security of packet reception.
[0291] The embodiments of the present application also provide a computer device, which is the computer device introduced above, and may include a terminal device or a server. The aforementioned data encryption device may be configured in the computer device. The following introduces the computer device with reference to the accompanying drawings.
[0292] If the computer device is a terminal device, please refer to Figure 17 As shown, the embodiments of the present application provide a terminal device. Taking the terminal device as a mobile phone as an example:
[0293] Figure 17 Shown is a block diagram of a part of the structure of a mobile phone related to the terminal device provided by the embodiments of the present application. Refer to Figure 17 , the mobile phone includes: a Radio Frequency (RF) circuit 1410, a memory 1420, an input unit 1430, a display unit 1440, a sensor 1450, an audio circuit 1460, a Wireless Fidelity (WiFi) module 1470, a processor 1480, and a power supply 1490 and other components. Those skilled in the art can understand that Figure 17 the structure of the mobile phone shown in
[0294] does not constitute a limitation to the mobile phone, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. Figure 17 The following specifically introduces each component of the mobile phone with reference to
[0295] The RF circuit 1410 can be used for receiving and sending signals during information reception or call processes. Specifically, after receiving the downlink information from the base station, it is given to the processor 1480 for processing; in addition, the designed uplink data is sent to the base station.
[0296] The memory 1420 can be used to store software programs and modules. The processor 1480 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1420. The memory 1420 may mainly include a program storage area and a data storage area. Among them, the program storage area may store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory 1420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0297] The input unit 1430 can be used to receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the mobile phone. Specifically, the input unit 1430 can include a touch panel 1431 and other input devices 1432.
[0298] The display unit 1440 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1440 can include a display panel 1441.
[0299] The mobile phone can also include at least one sensor 1450, such as a light sensor, a motion sensor, and other sensors.
[0300] The audio circuit 1460, the speaker 1461, and the microphone 1462 can provide an audio interface between the user and the mobile phone.
[0301] WiFi belongs to short - range wireless transmission technology. The mobile phone can help users send and receive emails, browse the web, and access streaming media through the WiFi module 1470. It provides users with wireless broadband Internet access.
[0302] The processor 1480 is the control center of the mobile phone. It connects various parts of the entire mobile phone using various interfaces and lines. By running or executing software programs and / or modules stored in the memory 1420, and by calling data stored in the memory 1420, it executes various functions of the mobile phone and processes data.
[0303] The mobile phone also includes a power supply 1490 (such as a battery) that powers each component.
[0304] In this embodiment, the processor 1480 included in the terminal device further has the following functions:
[0305] Send a message request packet to the server. The source address of the message request packet includes a terminal encrypted address, and the terminal encrypted address is obtained by encrypting the terminal address of the terminal device with the public key of the server;
[0306] Obtain a traffic packet returned by the server for the message request packet. The source address of the traffic packet includes a server encrypted address, and the server encrypted address is obtained by encrypting the server address of the server with the public key of the terminal device;
[0307] Decrypt the server encrypted address with the private key of the terminal device to obtain a server pending address;
[0308] In response to the server pending address being consistent with the server address, receive the traffic data in the traffic packet.
[0309] If the computer device is a server, the embodiment of the present application also provides a server. Please refer toFigure 18 As shown Figure 18 FIG. 1500 is a structural diagram of a server 1500 provided by an embodiment of the present application. The server 1500 may vary greatly due to different configurations or performances, and may include one or more central processing units (CPUs) 1522 (for example, one or more processors) and a memory 1532, and one or more storage media 1530 (for example, one or more mass storage devices) for storing application programs 1542 or data 1544. Among them, the memory 1532 and the storage medium 1530 may be transient storage or persistent storage. The program stored in the storage medium 1530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Further, the central processing unit 1522 may be configured to communicate with the storage medium 1530 and execute a series of instruction operations in the storage medium 1530 on the server 1500.
[0310] The server 1500 may further include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input / output interfaces 1558, and / or one or more operating systems 1541, such as Windows Server TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM and so on.
[0311] The steps performed by the server in the above embodiments may be based on Figure 18 the server structure shown.
[0312] In addition, an embodiment of the present application further provides a storage medium for storing a computer program for executing the method provided by the above embodiment.
[0313] An embodiment of the present application further provides a computer program product including instructions, which when running on a computer, causes the computer to execute the method provided by the above embodiment.
[0314] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed 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 including those of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk, optical disk, or other media that can store program codes.
[0315] It should be noted that the various embodiments in this specification are described in a progressive manner. For the parts that are the same or similar among the various embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the relevant parts, reference can be made to the partial description of the method embodiments. The device and system embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0316] As described above, this is only a specific implementation manner of the present application. However, the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered by the protection scope of the present application. Moreover, on the basis of the implementation manners provided in the above aspects of the present application, further combinations can be made to provide more implementation manners. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A data encryption method, characterized in that, the method is executed by a terminal device, and the method includes: sending a message request packet to a server for the server to decrypt the terminal encryption address through the private key of the server to obtain the terminal address, determining a traffic link from the server to the terminal device according to the terminal address, and generating a flow identifier and a shared key for the traffic link according to the terminal address and the server address. Moreover, the server encrypts the shared key through the public key of the terminal device to obtain key-encrypted data. The source address of the message request packet includes the terminal encryption address, and the terminal encryption address is obtained by encrypting the terminal address of the terminal device through the public key of the server; obtaining, through the traffic link with the server, a key creation packet returned by the server for the message request packet, where the key creation packet includes the key-encrypted data and the flow identifier. The source address of the key creation packet includes a server encryption address, and the server encryption address is obtained by encrypting the server address of the server through the public key of the terminal device. The key creation packet is used to instruct N intermediate routing nodes to generate intermediate shared keys according to the flow identifier, encrypt the intermediate shared keys through the public key of the terminal device, and add the encryption result to the key-encrypted data. The traffic link includes the N intermediate routing nodes, N≥1. Decrypting the key-encrypted data through the private key of the terminal device to obtain the shared key between the terminal device and the server, and N intermediate shared keys corresponding one by one to the N intermediate routing nodes in the traffic link, N≥1; encrypting the N intermediate shared keys through the shared key to obtain intermediate key-encrypted data; sending a key confirmation packet including the intermediate key-encrypted data to the server for the server to decrypt the intermediate key-encrypted data through the shared key to obtain the N intermediate shared keys, and obtaining encryption routing information corresponding one by one to the N intermediate routing nodes according to the N intermediate shared keys and the routing addresses of the N intermediate routing nodes. Among them, the encryption routing information corresponding to the i-th intermediate routing node among the N intermediate routing nodes is obtained by encrypting the routing information of the i-th intermediate routing node and the routing information of the next-hop node of the i-th intermediate routing node through the intermediate shared key of the i-th intermediate routing node. The server adds the encryption routing information to the traffic packet, and the destination address of the traffic packet is the terminal address encrypted through the target intermediate shared key. The target intermediate shared key is the intermediate shared key of the previous-hop intermediate routing node of the terminal device in the traffic link. The source address of the key confirmation packet includes the terminal encryption address; obtaining, through the N intermediate routing nodes in the traffic link, the traffic packet returned by the server for the message request packet, where the source address of the traffic packet includes the server encryption address; Decrypt the encrypted server address by the private key of the terminal device to obtain the pending server address; In response to the pending server address being consistent with the server address, receive the traffic data in the traffic packet.
2. The method according to claim 1, wherein, The source address of the message request packet further includes a terminal hiding address, which refers to a false source address in plain text in the message request packet, and the terminal hiding address is different from the terminal address; the source address of the traffic packet further includes a server hiding address, which refers to a false source address in plain text in the traffic packet, and the server hiding address is different from the server address.
3. The method according to claim 1, wherein, After receiving the traffic data in the traffic packet in response to the pending server address being consistent with the server address, the method further includes: Determine the packet reception result for the traffic packet; Send a traffic confirmation packet including the packet reception result to the server, and the source address of the traffic confirmation packet includes the terminal encrypted address.
4. The method according to claim 3, wherein, The method further includes: Obtain a traffic retransmission packet in response to the traffic confirmation packet from the server, the traffic retransmission packet is a traffic packet not received by the terminal device identified according to the packet reception result, and the source address of the traffic retransmission packet includes the server encrypted address.
5. A data encryption method, wherein, The method is executed by a server, and the method includes: Obtain a message request packet from a terminal device, the source address of the message request packet includes a terminal encrypted address, and the terminal encrypted address is obtained by encrypting the terminal address of the terminal device with the public key of the server; Decrypt the terminal encrypted address by the private key of the server to obtain the terminal address; determine a traffic link from the server to the terminal device according to the terminal address, and the traffic link includes N intermediate routing nodes, N≥1; Generate a flow identifier and a shared key for the traffic link according to the terminal address and the server address; Encrypt the shared key with the public key of the terminal device to obtain key encrypted data; Send a key creation message including the key-encrypted data and the flow identifier to the terminal device through the traffic link. The source address of the key creation message includes the server encryption address. The key creation message is used to instruct the N intermediate routing nodes to generate intermediate shared keys according to the flow identifier, encrypt the intermediate shared keys with the public key of the terminal device, and add the encryption result to the key-encrypted data; Obtain a key confirmation message returned in response to the key creation message from the terminal device. The source address of the key confirmation message includes the terminal encryption address. The key confirmation message includes intermediate key-encrypted data, which is obtained by encrypting the N intermediate shared keys with the shared key. The N intermediate shared keys correspond to the N intermediate routing nodes one by one; Decrypt the intermediate key-encrypted data according to the shared key to obtain the N intermediate shared keys; According to the N intermediate shared keys and the routing addresses of the N intermediate routing nodes, obtain encryption routing information corresponding to the N intermediate routing nodes one by one. For the i-th intermediate routing node among the N intermediate routing nodes, the corresponding encryption routing information is obtained by encrypting the routing information of the i-th intermediate routing node and the routing information of the next-hop node of the i-th intermediate routing node with the intermediate shared key of the i-th intermediate routing node; Add the encryption routing information to the traffic message. The destination address of the traffic message is the terminal address encrypted with the target intermediate shared key. The target intermediate shared key is the intermediate shared key of the previous-hop intermediate routing node of the terminal device in the traffic link; According to the terminal address, send the traffic message returned in response to the message request message to the terminal device through the N intermediate routing nodes in the traffic link. The source address of the traffic message includes the server encryption address, which is obtained by encrypting the server address of the server with the public key of the terminal device.
6. The method according to claim 5, wherein, Before decrypting the intermediate key-encrypted data according to the shared key to obtain the N intermediate shared keys, the method further includes: Decrypt the terminal encryption address according to the private key of the server to obtain the terminal address; Generate a flow identifier for the traffic link according to the terminal address and the server address; Generate the shared key through the terminal address and the flow identifier.
7. The method according to claim 5, wherein, The traffic message further includes the flow identifier, which is used to instruct the intermediate routing node to generate a corresponding intermediate shared key according to the flow identifier, and decrypt the encryption routing information with the intermediate shared key to obtain the routing information of the next-hop node.
8. The method according to claim 5, wherein, The method further includes: Obtain a traffic confirmation message including a message reception result from the terminal device, where the source address of the traffic confirmation message includes the terminal encryption address, and the message reception result is used to identify the reception status of the traffic message by the terminal device; When it is determined according to the message reception result that the terminal device has not received the target traffic message, send the target traffic message as a traffic retransmission message to the terminal device, where the source address of the traffic retransmission message includes the server encryption address.
9. A data encryption device Characterized in that Applied to a terminal device, the device includes a sending unit, an obtaining unit, a decrypting unit and a receiving unit; The sending unit is configured to send a message request message to a server for the server to decrypt the terminal encryption address through the private key of the server to obtain the terminal address, determine a traffic link from the server to the terminal device according to the terminal address, and generate a flow identifier and a shared key for the traffic link according to the terminal address and the server address. Moreover, the server encrypts the shared key through the public key of the terminal device to obtain key-encrypted data. The source address of the message request message includes the terminal encryption address, and the terminal encryption address is obtained by encrypting the terminal address of the terminal device through the public key of the server; The sending unit is further configured to obtain, through the traffic link with the server, a key creation message returned by the server for the message request message, where the key creation message includes the key encrypted data and the flow identifier, and the source address of the key creation message includes a server encrypted address, and the server encrypted address is obtained by encrypting the server address of the server with the public key of the terminal device; the key creation message is used to instruct N intermediate routing nodes to generate an intermediate shared key according to the flow identifier, encrypt the intermediate shared key with the public key of the terminal device, and add the encryption result to the key encrypted data, and the traffic link includes the N intermediate routing nodes, N≥1; decrypt the key encrypted data with the private key of the terminal device to obtain the shared key between the terminal device and the server, and N intermediate shared keys corresponding one by one to the N intermediate routing nodes in the traffic link, N≥1; encrypt the N intermediate shared keys with the shared key to obtain intermediate key encrypted data; send a key confirmation message including the intermediate key encrypted data to the server for the server to decrypt the intermediate key encrypted data with the shared key to obtain the N intermediate shared keys, and obtain encrypted routing information corresponding one by one to the N intermediate routing nodes according to the N intermediate shared keys and the routing addresses of the N intermediate routing nodes, where the encrypted routing information corresponding to the i-th intermediate routing node among the N intermediate routing nodes is obtained by encrypting the routing information of the i-th intermediate routing node and the routing information of the next-hop node of the i-th intermediate routing node with the intermediate shared key of the i-th intermediate routing node; the server adds the encrypted routing information to the traffic message, and the destination address of the traffic message is the terminal address encrypted with the target intermediate shared key, and the target intermediate shared key is the intermediate shared key of the previous-hop intermediate routing node of the terminal device in the traffic link, and the source address of the key confirmation message includes the terminal encrypted address; The obtaining unit is configured to obtain, through the N intermediate routing nodes in the traffic link, the traffic message returned by the server for the message request message, and the source address of the traffic message includes a server encrypted address; The decrypting unit is configured to decrypt the server encrypted address with the private key of the terminal device to obtain a server pending address; The receiving unit is configured to receive the traffic data in the traffic message in response to the server pending address being consistent with the server address.
10. The apparatus according to claim 9, wherein, The source address of the message request packet further includes a terminal hidden address, where the terminal hidden address refers to a false source address in plain text in the message request packet, and the terminal hidden address is different from the terminal address; the source address of the traffic packet further includes a server hidden address, where the server hidden address refers to a false source address in plain text in the traffic packet, and the server hidden address is different from the server address.
11. The apparatus according to claim 9, wherein, the sending unit is further configured to, after receiving the traffic data in the traffic packet in response to the server pending address being consistent with the server address, determine a packet reception result for the traffic packet; send a traffic confirmation packet including the packet reception result to the server, and the source address of the traffic confirmation packet includes the terminal encrypted address.
12. The apparatus according to claim 11, wherein, the obtaining unit is further configured to: obtain a traffic retransmission packet in response to the traffic confirmation packet from the server, where the traffic retransmission packet is a traffic packet not received by the terminal device identified according to the packet reception result, and the source address of the traffic retransmission packet includes the server encrypted address.
13. A data encryption apparatus, wherein, applied to a server, the apparatus includes an obtaining unit, a decrypting unit, and a sending unit; the obtaining unit is configured to obtain a message request packet from a terminal device, where the source address of the message request packet includes a terminal encrypted address, and the terminal encrypted address is obtained by encrypting the terminal address of the terminal device with the public key of the server; the decrypting unit is configured to decrypt the terminal encrypted address with the private key of the server to obtain the terminal address; the sending unit is configured to determine a traffic link from the server to the terminal device according to the terminal address, where the traffic link includes N intermediate routing nodes, N≥1; generate a flow identifier and a shared key for the traffic link according to the terminal address and the server address; encrypt the shared key with the public key of the terminal device to obtain key encrypted data; send a key creation packet including the key encrypted data and the flow identifier to the terminal device through the traffic link, where the source address of the key creation packet includes the server encrypted address, and the key creation packet is used to instruct the N intermediate routing nodes to generate an intermediate shared key according to the flow identifier, encrypt the intermediate shared key with the public key of the terminal device and add the encryption result to the key encrypted data; The obtaining unit is further configured to obtain, from the terminal device, a key confirmation message returned in response to the key creation message, where the source address of the key confirmation message includes the terminal encryption address, the key confirmation message includes intermediate key encryption data, and the intermediate key encryption data is obtained by encrypting N intermediate shared keys with the shared key, and the N intermediate shared keys correspond to the N intermediate routing nodes one by one; decrypt the intermediate key encryption data with the shared key to obtain the N intermediate shared keys; and obtain encrypted routing information corresponding to the N intermediate routing nodes one by one according to the N intermediate shared keys and the routing addresses of the N intermediate routing nodes. For the i-th intermediate routing node among the N intermediate routing nodes, the corresponding encrypted routing information is obtained by encrypting the routing information of the i-th intermediate routing node and the routing information of the next-hop node of the i-th intermediate routing node with the intermediate shared key of the i-th intermediate routing node. Add the encrypted routing information to a traffic message, where the destination address of the traffic message is the terminal address encrypted with a target intermediate shared key, and the target intermediate shared key is the intermediate shared key of the previous-hop intermediate routing node of the terminal device in the traffic link. The sending unit is further configured to send, according to the terminal address, the traffic message returned in response to the message request message to the terminal device through the N intermediate routing nodes in the traffic link, where the source address of the traffic message includes a server encryption address, and the server encryption address is obtained by encrypting the server address of the server with the public key of the terminal device.
14. A data encryption system Characterized in that The system includes a terminal device and a server, the terminal device is configured to execute the method according to any one of claims 1-4, and the server is configured to execute the method according to any one of claims 5-8.
15. A computer device Characterized in that The computer device includes a processor and a memory: The memory is configured to store a computer program and transmit the program code to the processor; The processor is configured to execute the method according to any one of claims 1-4 or execute the method according to any one of claims 5-8 according to the instructions in the computer program.
16. A computer-readable storage medium Characterized in that The computer-readable storage medium is configured to store a computer program, and the computer program is configured to execute the method according to any one of claims 1-4 or execute the method according to any one of claims 5-8.
17. A computer program product including a computer program, when running on a computer device, causes the computer device to execute the method according to any one of claims 1-4 or execute the method according to any one of claims 5-8.
Citation Information
Patent Citations
Source verification and path authentication method and device
CN105847034A
Concealed information sending system and sending method based on source address
CN108521331A
Message processing method, client device, server device and medium
CN114915583A
Cited By
Data encryption method and related apparatus
EP4614878A1
Data encryption method and related apparatus
WO2024174596A1