Data encryption method and related apparatus

By encrypting the source address and destination address of the message in network communication, only the receiving end is allowed to decrypt, which solves the problem of user privacy leakage in the existing technology and improves the security and privacy protection capabilities of network communication.

WO2024174596A1PCT designated stage expired Publication Date: 2024-08-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Application Number
PCT/CN2023/131400
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-23
Filing Date
2023-11-14
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

It is difficult for existing technologies to effectively protect user privacy in network communications. Attackers infer the user's private information by intercepting the source and destination addresses of messages, leading to privacy leaks.

Method used

By encrypting the source address and destination address of the message, only the private key of the receiving end is allowed to decrypt, ensuring that the attacker can only obtain the receiving end information and cannot determine the sending end of the message, reducing the risk of leaking user privacy.

Benefits of technology

It effectively reduces the possibility of leaking user privacy through the source and destination addresses of messages, enhances the security of network communications, and ensures the security of message reception.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023131400_29082024_PF_FP_ABST
    Figure CN2023131400_29082024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a data encryption method and a related apparatus. When a terminal device and a server perform network communication by means of an interaction packet, source addresses in a message request packet and a traffic packet for interaction between the terminal device and the server are encrypted by means of public keys of receiving ends, and real source addresses of the packets can be obtained only after decryption using private keys of the receiving ends. By encrypting the source addresses of the packets, even if an attacker acquires a packet, the attacker can only learn about a receiving end of a packet and cannot determine a sending end of the packet, so that the attacker can only obtain fragmented information and cannot concatenate the fragmented information, thereby reducing the possibility of leaking user privacy by means of the source address and destination address of the packet. Moreover, a terminal device acting as a data receiving end can also restore the real source address of the received packet using a private key of the terminal device, ensuring the security of the packet.
Need to check novelty before this filing date? Find Prior Art

Description

A data encryption method and related device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on February 23, 2023, with application number 2023102019073 and application name “A data encryption method and related device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of communications, and in particular to data encryption technology. Background Art

[0003] One mode of network communication is routing forwarding based on the destination address. Its main working principle is: after the intermediate routing node receives a message from the sender or other intermediate routing nodes, it extracts the corresponding forwarding information from the message header, such as the corresponding output port, etc. The intermediate routing node forwards the message through the port to the next hop routing node (such as the intermediate routing node or the destination) until the destination receives the message.

[0004] The security of network communications is a crucial factor in measuring internet services, client experience, and operators. Network communication security is primarily reflected in aspects such as communication security and privacy protection. In related technologies, to enhance network communication security, various security detection software and hardware are used to perform security checks on received messages, mitigating the risk of data tampering, traffic hijacking, and illegal communication access. As shown in Figure 1, when a terminal device requests data from a data storage server, the server can perform security checks on the request message or message confirmation message from the terminal device through a secure hardware platform, filtering any detected malicious messages to further enhance network communication security.

[0005] However, the relevant technologies do not fully cover the security aspects of network communications and are difficult to adapt to current privacy protection needs.

[0006] Summary of the Invention

[0007] In order to solve the above technical problems, the present application provides a data encryption method and related devices, which can reduce the possibility of leaking user privacy through the source address and destination address of the message and meet the current privacy protection needs.

[0008] The embodiments of this application disclose the following technical solutions:

[0009] On the one hand, an embodiment of the present application provides a data encryption method, which is executed by a terminal device, including:

[0010] Send a message request message to the server. The source address of the message request message includes the terminal encryption address. The terminal encryption address is obtained by encrypting the terminal address of the terminal device using the server's public key.

[0011] Receive a traffic message returned by the server in response to the message request message, where the source address of the traffic message includes the server encrypted address, which is obtained by encrypting the server address of the server using the public key of the terminal device;

[0012] Decrypt the server encrypted address using the private key of the terminal device to obtain the server pending address;

[0013] In response to the server's pending address being consistent with the server address, traffic data in the traffic message is acquired.

[0014] On the other hand, an embodiment of the present application provides a data encryption method, which is executed by a server and includes:

[0015] Receive a message request message sent by a terminal device, where the source address of the message request message includes the terminal encryption address, which is obtained by encrypting the terminal address of the terminal device using the server's public key;

[0016] Decrypt the terminal encrypted address using the server's private key to obtain the terminal address;

[0017] According to the terminal address, a traffic message returned in response to the message request message is sent to the terminal device. The source address of the traffic message includes the server encryption address, which is obtained by encrypting the server address of the server using the public key of the terminal device.

[0018] On the other hand, an embodiment of the present application provides a data encryption device, including a sending unit, an acquiring unit, a decryption unit, and a receiving unit;

[0019] A sending unit, configured to send a message request message to the server, wherein the source address of the message request message includes a terminal encryption address, which is obtained by encrypting the terminal address of the terminal device using the public key of the server;

[0020] An acquiring unit is configured to receive a traffic message returned by the server in response to the message request message, wherein the source address of the traffic message includes an encrypted server address, which is obtained by encrypting the server address of the server using the public key of the terminal device;

[0021] A decryption unit, configured to decrypt the server encrypted address using the private key of the terminal device to obtain the server pending address;

[0022] The receiving unit is configured to obtain the flow data in the flow message in response to the pending address of the server being consistent with the server address.

[0023] On the other hand, an embodiment of the present application provides a data encryption device, including an acquisition unit, a decryption unit, and a sending unit;

[0024] An acquiring unit is configured to receive a message request message sent by a terminal device, wherein 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 using a public key of a server;

[0025] A decryption unit, used to decrypt the terminal encrypted address using the server's private key to obtain the terminal address;

[0026] The sending unit is used to send a traffic message returned in response to a message request message to the terminal device according to the terminal address. The source address of the traffic message includes a server encryption address, which is obtained by encrypting the server address of the server using the public key of the terminal device.

[0027] 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 used to execute the method described in the above aspects, and the server is used to execute the method described in the above aspects.

[0028] In another aspect, an embodiment of the present application provides a computer device, comprising a processor and a memory:

[0029] The memory is used to store computer programs and transmit program codes to the processor;

[0030] The processor is configured to execute the above-described method according to instructions in the computer program.

[0031] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute the method described in the above aspects.

[0032] On the other hand, an embodiment of the present application provides a computer program product including a computer program, which, when executed on a computer device, enables the computer device to execute the method described in the above aspects.

[0033] As can be seen from the above technical solution, when a terminal device communicates with a server via interactive messages, the source addresses in the message request messages and traffic messages exchanged between them are encrypted using the public key of the receiving end. The true source address of the message can only be obtained after decryption using the receiving end's private key. The reason for concealing the source address is that a message in network communication generally carries a source address and a destination address to ensure correct forwarding. However, once an attacker intercepts a message, they can obtain this relationship between the source and destination addresses. Accordingly, they can determine when the user of the terminal device went online and what content services they accessed, thereby inferring the user's private information. Therefore, by encrypting the source address of the message, even if an attacker obtains the message, they can only know the recipient of the message, but not the sender. This means that the attacker can only obtain fragmented information and cannot piece it together, thereby reducing the possibility of leaking user privacy through the source and destination addresses of the message. Furthermore, the terminal device, as the data receiver, can also restore the true source address of the received message using its own private key, ensuring the security of message reception. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] FIG1 is a schematic diagram of a security enhancement based on security hardware assistance;

[0035] FIG2 is a schematic diagram of a data encryption scenario provided in an embodiment of the present application;

[0036] FIG3 is a schematic diagram of an attacker obtaining user privacy based on the source address and destination address;

[0037] FIG4 is a flow chart of a data encryption method provided in an embodiment of the present application;

[0038] FIG5 is a schematic diagram of a message request message provided in an embodiment of the present application;

[0039] FIG6 is a schematic diagram of a flow message provided in an embodiment of the present application;

[0040] FIG7 is a schematic diagram of a flow confirmation message provided in an embodiment of the present application;

[0041] FIG8 is a schematic diagram of a key creation message provided in an embodiment of the present application;

[0042] FIG9 is a schematic diagram of an intermediate routing node adding an intermediate shared key to a key creation message according to an embodiment of the present application;

[0043] FIG10 is a schematic diagram of a key confirmation message provided in an embodiment of the present application;

[0044] FIG11 is a schematic diagram of a traffic message with encrypted source and destination addresses provided in an embodiment of the present application;

[0045] FIG12 is a specific flow chart of a data encryption method provided in an embodiment of the present application;

[0046] FIG13 is a communication diagram of a data encryption method provided in an embodiment of the present application;

[0047] FIG14 is a device structure diagram of a data encryption device provided in an embodiment of the present application;

[0048] FIG15 is a structural diagram of another data encryption device provided in an embodiment of the present application;

[0049] FIG16 is a system structure diagram of a data encryption system provided in an embodiment of the present application;

[0050] FIG17 is a structural diagram of a terminal device provided in an embodiment of the present application;

[0051] FIG18 is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The embodiments of the present application are described below with reference to the accompanying drawings.

[0053] In the related art, network communications can be security-checked through various security detection software and hardware. As shown in FIG1 , security detection hardware can be used to perform security checks on various messages exchanged between terminal devices and data storage servers, and to filter out detected malicious messages, thereby improving the security of network communications to a certain extent. In addition, the security of network communications can also be improved from the perspective of communication protocols, mainly by encrypting the data in the message through encryption, thereby reducing the risk of data being illegally obtained, tampered with, or redirected during message forwarding. For example, based on the Transmission Control Protocol (TCP), encryption is performed 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 is proposed to encrypt the data in the message, thereby preventing malicious intermediate routing nodes from obtaining the data content in the message in the absence of a decryption key.

[0054] However, using security detection software and hardware to perform security checks on network communications, as well as encrypting data from the perspective of communication protocols, cannot improve security in the dimension of message addresses. Once an attacker intercepts a message, the attacker can obtain the source and destination addresses of the message, and then infer the terminal user's privacy information based on the relationship between the source and destination addresses, causing the user's privacy to be leaked.

[0055] To this end, an embodiment of the present application provides a data encryption method and related devices to encrypt the source address in the message exchanged between the terminal device and the server, reducing the possibility of attackers obtaining the terminal user's private information through the source address and destination address of the message, and improving the security of network communications in the dimension of the message address.

[0056] The data encryption method provided in the embodiments of the present application can be implemented by a computer device, which can be a terminal device or a server, wherein the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal can be a smartphone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a car terminal, a smart TV, etc., but is not limited to these. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0057] The data encryption method provided in 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 a storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of different types of storage devices (also called storage nodes) in the network through application software or application interfaces to work together and provide external data storage and business access functions.

[0058] Currently, storage systems utilize a storage method that creates logical volumes and allocates physical storage space for each logical volume. This physical storage space may consist of disks on a specific storage device or several storage devices. When a client stores data on a logical volume, it stores the data on a file system. The file system divides the data into multiple parts, each of which is an object. An object contains not only the data but also additional information such as the data identifier (ID) of the data entity. The file system writes each object to the physical storage space of the logical volume and records the storage location information of each object. When a client requests access to data, the file system enables the client to access the data based on the storage location information of each object.

[0059] The storage system allocates physical storage space to logical volumes by pre-dividing the physical storage space into stripes based on the estimated capacity of the objects to be stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the Redundant Array of Independent Disks (RAID) groupings. A logical volume can be understood as a stripe, thereby allocating physical storage space to the logical volume.

[0060] For example, the server in the embodiment of the present application may be a cloud server that implements cloud storage.

[0061] Figure 2 is a schematic diagram of a data encryption scenario provided by an embodiment of the present application, wherein the aforementioned computer devices are terminal devices and servers, and the terminal devices and the server can communicate over the network through interactive messages. 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, which refers to a server that can implement the functions of a content distribution network (CDN, Content Delivery Network).

[0062] When a terminal device and a server communicate over the network, the terminal device will send a message request message. A message request message refers to a request message sent by the terminal device to the server. For example, the message request message may be a request message sent by the terminal device to the server to request to obtain target content. The source address of the message request message is not directly disclosed, as shown in FIG2 . Instead, it is encrypted using the public key of the receiving end (server). Only after the server receives the message request message and decrypts it using the server's private key can the true source address of the message request message be obtained.

[0063] Correspondingly, the terminal device obtains traffic messages from the server. Traffic messages refer to messages sent by the server to the terminal device in response to the message request message. For example, the traffic message can be a message sent by the server to enable the terminal device to obtain the target content. The source address of the traffic message is not directly disclosed. As shown in Figure 2, it is also encrypted using the public key of the receiving end (terminal device). Only after the terminal device obtains the traffic message and decrypts it with the private key of the terminal device can the real source address of the traffic message be obtained.

[0064] During the process of network communication between the terminal device and the server, the reason for hiding the source addresses in the message request messages and traffic messages exchanged is that in order to achieve the correct forwarding of messages in network communication, the messages generally carry the source address and the destination address. However, once the attacker intercepts the message, the relationship between the source address and the destination address of the message can be obtained. Then, based on the relationship between the source address and the destination address, the attacker can infer the private information such as when the user of the terminal device went online and what content services were obtained. As shown in Figure 3, the attacker 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 the destination address of the message request message and the traffic message, and even make inferences such as "whether the user is at home". At the same time, if the attacker obtains the address set of a cloud service provider's server, then based on whether the address in the address set exists in the message request message or the traffic message, the attacker can determine the content service the user is obtaining. For example, the content Internet Protocol (IP) used by a cloud service provider to provide services for a short video platform The IP addresses of the HTTPS protocol are: IP1, IP2, IP3, ..., IP100. If the source or destination address of the message intercepted by the attacker contains the above IP addresses, the attacker can infer the user status of "the user is watching a short video".

[0065] In an embodiment of the present application, by encrypting the source address of the message, even if an attacker intercepts the message, he can only know the receiving end of the message and cannot determine the sending end of the message. 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 message.

[0066] At the same time, the terminal device that receives the traffic message can restore the real source address of the received traffic message through its own private key, reducing the risk of the terminal device receiving messages at will and ensuring the security of message reception.

[0067] FIG4 is a flowchart of a data encryption method provided in an embodiment of the present application. In this embodiment, computer devices are used as terminals and servers for illustration. The method includes:

[0068] S401. The terminal device sends a message request message to the server. The source address of the message request message includes a terminal encryption address. The terminal encryption address is obtained by encrypting the terminal address of the terminal device using the public key of the server.

[0069] The terminal device can communicate with the server through interactive messages. In actual applications, a server can send messages to multiple terminal devices, and a terminal can also send request messages to multiple servers. This embodiment uses a terminal device and a server to communicate over the network as an example.

[0070] The purpose of network communication between a terminal device and a server can be to allow the terminal device to obtain target content from the server. When a terminal device obtains target content from a server through interactive messages, the terminal device is the data requester and the server is the data sender. The target content is the data required by the terminal device and can be in various forms, such as text, images, videos, and live streams. Because different servers can provide different data content, before sending a message request message, the terminal device can first determine the corresponding server based on the target content and then send the corresponding message request message to the determined server.

[0071] A message request message refers to a request message sent by a terminal device to a server. In order to prevent the message request message from being intercepted by an attacker and the relationship between the source address and the destination address in the message being obtained, thereby obtaining the user's privacy information, the source address in the message request message is encrypted in this embodiment, that is, the source address in the message message is concealed, so that even if an attacker intercepts the message, he can only know the destination address of the message, but cannot determine the source address of the message. That is, after intercepting the message, the attacker only knows that a device has sent a message to the server, but does not know which device sent it, and it is difficult to infer the user's privacy information. In other words, by encrypting the source address of the message request message, the source address in the message request message can be concealed, reducing the possibility of an attacker inferring the user's privacy information through the source address and destination address of the message request message.

[0072] It should be noted that the terminal address of the terminal device can be encrypted using the server's public key to obtain the corresponding terminal encrypted address. For example, the terminal encrypted address can be obtained using the following formula: IP_sec = Enc{Key_pub_server, IP_i}

[0073] Among them, IP_sec represents the terminal encryption 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 data β using key α.

[0074] According to the above formula, the real terminal address can be encrypted by the public key of the server to obtain the corresponding terminal encrypted address. As shown in Figure 5, the terminal encrypted address can be carried in the message request message (Pkt_req), for example, it can be carried in the payload of the message request message, so that the server can determine the terminal address corresponding to the terminal device through the terminal encrypted address after obtaining the message request message, that is, the receiving end of the message request message can accurately determine the sending end of the message request message, so that in the subsequent steps, the receiving end can accurately generate a traffic message with the destination address of the sending end, thereby ensuring the security and accuracy of message transmission.

[0075] It should be noted that in order to ensure that the message request message can be accurately forwarded, the destination address of the message request message in this embodiment is not encrypted, that is, the message request message includes the server address of the server in plain text, so that the message request message can be accurately forwarded to the server based on the server address in network communication.

[0076] In order to further confuse the attacker after intercepting the message request message and further reduce the possibility of the attacker inferring the user's private information through the real source address and destination address in the message request message, in a possible implementation method, the source address of the message request message also includes a terminal hidden address, which is different from the terminal address.

[0077] The terminal hidden address refers to the virtual source address of the plaintext in the message request message. In order to hide the real source address of the message request message, the terminal hidden address is obviously different from the real terminal address of the terminal device sending the message request message. As shown in Figure 5, when the terminal address of the terminal device is IP_i, the message request message includes not only the terminal encryption address IP_sec, but also the terminal hidden address IP_j. For example, the header of the message request message can carry the terminal hidden address, where IP_i and IP_j are not the same.

[0078] Adding a hidden terminal address to a message request message can cause an attacker to be confused by the hidden terminal address in the message request message after intercepting the message request message, thereby tricking the attacker into incorrectly judging that the source address of the message request message is the hidden terminal address, thereby further reducing the possibility of the attacker obtaining the real source address and destination address through the message request message and inferring the user's private information based on this.

[0079] In addition, since the real source address of the message request message is concealed, the message format of the message request message will change. By adding the terminal hidden address to the source address of the message request message, the message request message with the encrypted source address and the message with the unencrypted source address can be kept in the same format. In the network communication between the terminal device and the server, the device used for forwarding can successfully understand the meaning of the message request message according to the format of the message request message, thereby ensuring the successful forwarding of the message request message.

[0080] S402: The server decrypts the terminal encrypted address using the server's private key to obtain the terminal address.

[0081] After the server receives the message request message sent by the terminal device, it needs to determine the source address of the message request message in order to make an accurate response to the message request message. Since the source address in the message request message is hidden, the server cannot directly obtain the source address of the message request message. It is necessary to decrypt the terminal encrypted address in the message request message 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 by using the server's public key, wherein the server's public key refers to the public key corresponding to the server, and other devices can use the server's public key to encrypt data, while the server's private key is the server's private key, which only the server has. That is, only the server can decrypt the data encrypted by the server's public key through the server's private key. Therefore, the server can decrypt the terminal encrypted address through the server's private key to obtain the terminal address. For example, the terminal address can be obtained by the following formula: IP_i=Dec{Key_pri_server,IP_sec}

[0083] Among them, 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 encryption address, and Dec{α,β} represents the decryption operation of data β using key α.

[0084] According to the above formula, the terminal encrypted address can be decrypted using the server's private key to obtain the terminal address. This terminal address is the true source address of the message request message. That is to say, after the server obtains the message request message, it determines the true source address of the message request message by decrypting the terminal encrypted address therein, laying the foundation for the server to accurately send traffic messages to the terminal address in subsequent steps.

[0085] S403. The terminal device receives a traffic message returned by the server in response to the message request message. The source address of the traffic message includes the server encryption address. The server encryption address is obtained by encrypting the server address of the server using the public key of the terminal device.

[0086] A traffic message refers to a message sent by a server to a terminal device in response to a request in a message request message. For example, when the message request message is a message from a terminal device to a server requesting the target content, the traffic message may be a message sent by the server to enable the terminal device to obtain the target content. If the target content is text required by the terminal device, the traffic message will include the data corresponding to the text. When the target content is text and pictures required by the terminal device, the traffic message will include the data corresponding to the text and pictures.

[0087] In order to prevent the attacker from intercepting the traffic message and obtaining the relationship between the source address and destination address in the message, and then obtaining the user's privacy information, the source address in the traffic message is also encrypted in this example, so that even if the attacker intercepts the message, he can only know the destination address of the message, but cannot determine the source address of the message. That is, after intercepting the message, the attacker only knows that a device has sent a message to the terminal device, but does not know which device sent it. Accordingly, it is difficult to infer the user's privacy information. In other words, by encrypting the source address of the traffic message, the source address in the traffic message is concealed, which reduces the possibility of the attacker inferring the user's privacy information through the source address and destination address of the message request message.

[0088] It should be noted that the server address can be encrypted using the public key of the terminal device to obtain the corresponding server encrypted address. For example, the server encrypted address can be obtained using the following formula: IP_sec_server = Enc{Key_pub_client, IP_m}

[0089] Among them, IP_sec_server represents the server encryption 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 data β using key α.

[0090] Through the above formula, the real server address can be encrypted by the public key of the terminal device to obtain the corresponding server encrypted address. As shown in Figure 6, the server encrypted address can be carried in the traffic message (Pkt_traffic), so that after the terminal device obtains the traffic message, even if the source address of the traffic message is hidden, the source address of the traffic message can still be determined through subsequent steps, laying the foundation for ensuring the security of message transmission.

[0091] It should be noted that in order to ensure that the traffic message can be forwarded accurately, the destination address of the traffic message in this embodiment is not encrypted, that is, the traffic message includes the terminal address of the terminal device in plain text, so that the traffic message can be accurately forwarded to the terminal device that sends the message request message based on the terminal address in network communication.

[0092] In a possible implementation, the source address of the traffic message further includes a hidden server address, which is different from the server address.

[0093] The server hidden address refers to the virtual source address of the plaintext in the traffic message. The server hidden address is different from the real server address of the server sending the traffic message. As shown in Figure 6, when the server address is IP_m, the traffic message includes not only the server encryption address IP_sec_server, but also the terminal hidden address IP_n, where IP_n and IP_m are not the same.

[0094] Adding a hidden server address to a traffic message can, on the one hand, confuse attackers with the hidden server address in the traffic message after intercepting it, further reducing the possibility of attackers obtaining the real source and destination addresses of the traffic message and inferring the user's private information based on them; on the other hand, it can ensure the message format of the traffic message, thereby ensuring the successful forwarding of the traffic message.

[0095] S404: The terminal device decrypts the server encrypted address using the private key of the terminal device to obtain the server pending address.

[0096] In order to ensure the security of message transmission, the terminal device needs to determine the source of the obtained message to reduce the possibility of the terminal device being attacked by malicious messages. Therefore, after the terminal device obtains the traffic message from the server, it needs to determine the source address of the traffic message in order to determine the source of the traffic message. Since the source address of the traffic message is hidden, the terminal device cannot directly obtain the source address of the traffic message. It is necessary to decrypt the server encrypted address in the traffic message to obtain the corresponding server pending address.

[0097] As described in S403, the server encrypted address is obtained by encrypting the public key of the terminal device, so the terminal device can decrypt the server encrypted address using the private key of the terminal device to obtain the server pending address. For example, the server pending address can be obtained by the following formula: IP_m1=Dec{Key_pri_client,IP_sec_server}

[0098] Among them, IP_m1 represents the server's pending address, Key_pri_client represents the private key of the terminal device, IP_sec_server represents the server's encrypted address, and Dec{α,β} represents the decryption operation of data β using key α.

[0099] According to the above formula, the server encrypted address can be decrypted using the private key of the terminal device to obtain the server pending address, which is the true source address of the traffic message. That is to say, after the terminal device obtains the traffic message with the hidden source address, it determines the true source address of the traffic message by decrypting the server encrypted address in the traffic message.

[0100] It should be noted that, given that traffic packets may be illegally intercepted and tampered with during transmission, the encrypted server address included in the traffic packet may also be tampered with. In this case, the server address obtained by the terminal device after decrypting the encrypted server address may not be the actual server address, that is, not the actual address encrypted by the server itself. Of course, when traffic packets are transmitted normally, the server address obtained by the terminal device after decrypting the encrypted server address in the traffic packet is the actual server address. Since the authenticity of the server address obtained by the terminal device after decrypting the encrypted server address cannot be confirmed at this time, it is first referred to as the server pending address.

[0101] S405: In response to the server's pending address being consistent with the server address, the terminal device obtains traffic data in the traffic message.

[0102] After the terminal device obtains the traffic message, it determines through S404 that the true source address of the traffic message is the server's pending address. At the same time, the destination address of the message request message sent by the terminal device is the server address of the server. When the server address and the server's pending address are consistent, it indicates that the destination address of the message request message sent by the terminal device is consistent with the true source address of the traffic message obtained by the terminal device. This indicates that the traffic message is the message returned in response to the message request message required by the terminal device, and is not a malicious or irrelevant message sent by another server. The terminal device can receive the traffic data in the traffic message, thereby enabling the terminal device to obtain the data content in the traffic message.

[0103] Since the data receiver may not be able to fully obtain the message content sent by the data sender during network communication, during the interaction between the terminal device and the server, it is necessary to determine whether the terminal device has successfully obtained the message content sent by the server.

[0104] In a possible implementation, the terminal device may further determine a message reception result for the traffic message; and send a traffic confirmation message including the message reception result to the server, where the source address of the traffic confirmation message includes the terminal encryption address.

[0105] The message reception result is used to indicate the reception status of the terminal device for the traffic message after the terminal device receives the traffic data of the traffic message, that is, the message reception result is used to reflect whether the terminal device has actually successfully received the traffic message.

[0106] It should be noted that in the actual network communication process between the terminal device and the server, the server often needs to send multiple traffic messages to respond to the request in the message request message sent by the terminal device. For example, when the message request message is to request the server to obtain video content, the server usually needs to send multiple traffic messages to achieve the complete transmission of the video content. At this time, the message reception result can be the reception status of the terminal device for the multiple traffic messages obtained by analyzing after the terminal device receives the multiple traffic messages. For example, the message reception result of the terminal device for the multiple traffic messages can be reflected based on the message number range actually received (or not received) by the terminal device. In order to enable the server to obtain the reception status of the terminal device for multiple traffic messages in a timely manner, the terminal device can periodically determine the message reception result, generate a corresponding traffic confirmation message after each determination of the message reception result, and report it to the server.

[0107] In order to enable the server to determine whether the terminal device has successfully obtained the data content sent by the server, the terminal device can send a traffic confirmation message including the message reception result to the server. The traffic confirmation message is used to indicate that the terminal device feeds back the message reception status to the server after receiving the traffic data of the traffic message.

[0108] In order to prevent the traffic confirmation message from being intercepted by an attacker and the relationship between the source address and destination address in the message, thereby obtaining the user's private 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 of an attacker inferring the user's private information through the source address and destination address of the traffic confirmation message.

[0109] When the source address of the flow confirmation message is concealed, in order to further confuse attackers and maintain the message format, the source address of the flow confirmation message may further include a concealed terminal address.

[0110] As shown in Figure 7, the traffic confirmation message (Pkt_ack) sent by the terminal device to the server may include the terminal hidden address IP_j, the terminal encryption address IP_sec and the currently received message number range Pkt_num_range, wherein the terminal hidden address is used to confuse attackers and maintain the message format of the traffic confirmation message, the terminal encryption address is used to provide the server with the 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.

[0111] It should be noted that, in order to ensure that the flow confirmation message can be accurately forwarded, the destination address of the flow confirmation message in this embodiment is not encrypted, that is, the flow confirmation message includes the server address of the server in plain text.

[0112] After obtaining the traffic data of the traffic message, the terminal device can send a traffic confirmation message including the message reception result to the server so that the server can determine the terminal device's reception status of the traffic message, thereby verifying whether the traffic message is successfully transmitted and ensuring the integrity of data transmission.

[0113] In one possible implementation, the server receives a flow confirmation message including a message reception result sent by the terminal device, where the source address of the flow confirmation message includes the terminal encryption address, and the message reception result is used to identify a reception status of the flow message by the terminal device;

[0114] When the server determines based on the message reception result that the terminal device has not received the target traffic message, the server sends the target traffic message as a traffic retransmission message to the terminal device, and the source address of the traffic retransmission message includes the server encryption address.

[0115] After the terminal device sends a traffic confirmation message to the server, the server can receive the traffic confirmation message sent by the terminal device. The traffic confirmation message includes a message reception result. The server can determine the terminal device's reception status of the target traffic message based on the message reception result.

[0116] When the server determines that the terminal device has received the target traffic message based on the message reception result, the server can determine that the target traffic message has been transmitted successfully and there is no need to retransmit the target traffic message.

[0117] When the server determines, based on the message reception result, that the terminal device has not received the target traffic message, the server can send the target traffic message as a traffic retransmission message to the terminal device. The traffic retransmission message refers to the traffic message that the terminal device has not received as identified by the message reception result. The traffic retransmission message is used to retransmit the traffic message that the terminal device has not received. In other words, when there is a traffic message that the terminal device has not received, the server can retransmit the above-mentioned unreceived traffic message as a traffic retransmission message so that the terminal device can obtain the unreceived traffic message. By having the server send the traffic retransmission message, the terminal device can obtain the unreceived target traffic message, thereby ensuring the reliability of message transmission between the terminal device and the server.

[0118] In order to prevent the relationship between the source address and destination address in the traffic retransmission message from being intercepted by an attacker during retransmission, the source address in the traffic retransmission message is also hidden. That is, the source address in the traffic retransmission message is not the server address, but the server encrypted address, thereby reducing the possibility of an attacker inferring the user's privacy information through the source address and destination address of the traffic retransmission message.

[0119] When the source address of the traffic retransmission message is concealed, in order to further confuse attackers and maintain the message format, the source address of the traffic retransmission message may further include a server concealed address.

[0120] It should be noted that, in order to ensure that the traffic retransmission message can be accurately forwarded, the destination address of the traffic retransmission message in this embodiment is not encrypted, that is, the traffic retransmission message includes the server address of the server in plain text.

[0121] After receiving the traffic confirmation message sent by the terminal device, the server can determine the terminal device's reception status of the traffic message based on the traffic confirmation message. When the terminal device does not receive the target traffic message, that is, when the terminal device does not completely receive the traffic message returned by the server, it generates a message reception result indicating that the terminal device has not successfully received the target traffic message returned in response to the message request message, and adds it to the traffic confirmation message. The server can respond to the traffic confirmation message and send a traffic retransmission message to the terminal device to achieve packet retransmission and reduce the possibility of packet loss due to the message received by the terminal device.

[0122] In one possible implementation, the terminal device receives a traffic retransmission message returned by the server in response to the traffic confirmation message. The traffic retransmission message is a traffic message that the terminal device has not received as identified by the message reception result, and the source address of the traffic retransmission message includes the server encryption address.

[0123] When the server determines, based on the traffic confirmation message, that the terminal device has unreceived traffic messages, the terminal device may obtain, from the server, a traffic retransmission message returned in response to the traffic confirmation message. The traffic retransmission message refers to a message that the terminal device has not received and needs to retransmit. The terminal device may receive the unreceived traffic messages by obtaining the traffic retransmission message. In order to prevent the attacker from intercepting the traffic retransmission message when the terminal device obtains the traffic retransmission message and obtaining the relationship between the source address and the destination address in the message, the source address in the traffic retransmission message is also concealed. When the source address of the traffic retransmission message is concealed, in order to further confuse the attacker and maintain the message format, the source address of the traffic retransmission message may also include the server concealed address.

[0124] The terminal device obtains the traffic retransmission message returned in response to the traffic confirmation message to receive the unreceived traffic message again, thereby ensuring the reliability of message transmission between the terminal device and the server.

[0125] As can be seen, when a terminal device communicates with a server network through interactive messages, the source addresses in the message request messages and traffic messages exchanged between them are encrypted using the receiving end's public key. The message's true source address can only be obtained after decryption using the receiving end's private key. The reason for hiding the source address is that messages in network communications typically carry both the source and destination addresses to ensure correct forwarding. However, if a message is intercepted by an attacker, the attacker can obtain the relationship between the source and destination addresses and determine when the terminal device user came online and what content services they accessed, thereby inferring the user's private information. Therefore, by encrypting the message's source address, even if an attacker obtains the message, they can only determine the message's recipient, not the message's sender. This means the attacker only obtains fragmented information and cannot piece it together, thus reducing the possibility of leaking user privacy through the message's source and destination addresses. Furthermore, the terminal device, as the data receiver, can also use its own private key to restore the true source address of the received message, ensuring the security of message reception.

[0126] In the aforementioned 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 related technologies is mainly forwarded based on the destination address, if the destination address of the message is modified without authorization, the message will not be forwarded correctly, which will in turn cause a decline in the user experience quality (QoE) and service quality (QoS). Therefore, the plaintext destination address will still be included in the message, so that the message can be accurately forwarded based on the destination address, ensuring the reliable implementation of message interaction between the terminal device and the server.

[0127] Although the source address of the message between the terminal device and the server is encrypted, which 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 number in the network communication process between the terminal device and the server can also be encrypted. When an attacker obtains the traffic message, he not only cannot obtain the sender of the traffic message, but also cannot obtain the receiver of the traffic message, thereby further reducing the possibility of the attacker inferring the user's privacy information through the real source address and destination address.

[0128] In one possible implementation, in S403, the terminal device receives the traffic message returned in response to the message request message. Accordingly, the server may send the traffic message returned in response to the message request message to the terminal device based on the terminal address. In terms of the server sending the traffic message returned in response to the message request message to the terminal device based on the terminal address, the data encryption method specifically includes:

[0129] S11. The server determines a traffic link from the server to the terminal device based on the terminal address. The traffic link includes N intermediate routing nodes, where N is an integer greater than or equal to 1.

[0130] S12. The server sends a traffic message returned in response to the message request message to the terminal device through N intermediate routing nodes in the traffic link.

[0131] A traffic link refers to the link between a server and a terminal device used to transmit traffic messages. During the actual message interaction between the server and the terminal device, the server usually sends multiple traffic messages to the terminal device. In order to obtain a stable link for reliably forwarding traffic messages, the server can determine the traffic link from the server to the terminal device for transmitting traffic messages based on the terminal address. The traffic link includes N intermediate routing nodes.

[0132] An intermediate routing node refers to a routing node included in a traffic link that is used to forward traffic packets. When a server sends traffic packets to a terminal device according to a traffic link, the intermediate routing node is used to forward the traffic packets until the previous-hop routing node of the terminal device successfully forwards the traffic packets to the terminal device.

[0133] In order to successfully send traffic messages from the server to the terminal device, the server can first determine the traffic link from the server to the terminal device based on the terminal address, and then accurately forward the traffic messages from the server to the terminal device through N intermediate routing nodes in the traffic link.

[0134] On the basis that the server can determine the traffic link for forwarding the traffic message based on the terminal address, the server can first send a key creation message to the terminal device based on the traffic link to obtain relevant information about the intermediate routing nodes of the traffic link. That is, in one possible implementation, the data encryption method further includes:

[0135] S21. The server generates a flow identifier and a shared key for the traffic link based on the terminal address and the server address;

[0136] S22. The server encrypts the shared key using the public key of the terminal device to obtain key-encrypted data.

[0137] 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 encryption 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 using the public key of the terminal device, and add the encrypted result to the key-encrypted data.

[0138] As mentioned above, a traffic link refers to a link between a server and a terminal device for transmitting traffic packets. Since there can be multiple links between a server and a terminal device, a traffic link can be accurately identified based on a flow ID. That is, a flow ID is identification data that uniquely identifies a traffic link. For example, the flow ID of a traffic link can be determined based on the following formula: FlowID = Hash(IP_m||IP_i||Port_server||Port_client||Protocol)

[0139] Wherein, 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 splicing operation.

[0140] According to the above formula, the flow identifier corresponding to the traffic link used to transmit traffic messages between the server and the terminal device can be determined.

[0141] The shared key for this traffic link refers to the key information calculated by the server based on the flow ID and shared with the terminal device. The shared key will be sent to the terminal device by the server after encryption, and will be used in subsequent steps to encrypt the data sent by the terminal device to the server. In other words, although the shared key is generated by the server, it is not private to the server, but is 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: Key_share = Hash(info_server||FlowID)

[0142] Among them, Key_share represents the shared key, info_server represents the server's own private information, FlowID represents the flow identifier, Hash() represents the hash operation, and || represents the splicing operation.

[0143] The above formula allows the server to calculate the shared key shared with the terminal device based on its own private information and the flow identifier.

[0144] 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 the corresponding key-encrypted data. For example, the key-encrypted data corresponding to the shared key can be obtained by the following formula: Enc_share = Enc{Key_pub_client,Key_share}

[0145] Among them, Enc_share represents key-encrypted data, Key_pub_client represents the public key of the terminal device, Key_share represents the shared key, and Enc{α,β} represents the encryption operation of data β using key α.

[0146] According to the above formula, the server can encrypt the shared key with the public key of the terminal device to obtain key-encrypted data that only the terminal device can decrypt.

[0147] After the server obtains the flow identifier and key encryption data for the traffic link, it can send the flow identifier and key encryption data to the terminal device via a key creation message. In order to prevent the key creation message from being intercepted by an attacker during forwarding and the relationship between the source address and destination address in the message is obtained, the source address in the key creation message is also concealed. That is, the source address in the key creation message is not the server address, but the server encryption address, thereby reducing the possibility of an attacker inferring the user's private information through the source address and destination address of the key creation message. When the source address of the key creation message is concealed, 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's concealed address. As shown in Figure 8, the key creation message (Pkt_key) includes the server's concealed address IP_n, the flow identifier FlowID, the server's encrypted address IP_sec_server, and the key encryption data Enc_share.

[0148] 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 terminal address of the terminal device in plain text, so that the key creation message can be accurately forwarded to the terminal device based on the terminal address in network communication.

[0149] The key creation message can be forwarded from the server to the terminal device through the intermediate routing node in the traffic link. During the forwarding process, in order to obtain the intermediate shared key shared by the intermediate routing node, the server, and the terminal device, the intermediate shared key refers to the key information calculated by the intermediate routing node based on the flow identifier and shared with the terminal device and the server. The intermediate shared key will be added to the key encryption data in the key creation message after encryption so that it can be sent to the terminal device. 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 based on the intermediate shared key. In other words, 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 the traffic link can be calculated according to the following formula: Key_share_i=Hash(Info_i||FlowID)

[0150] Among them, 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 hash operation, and || represents the splicing operation.

[0151] 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 based on its own private information and flow identifier.

[0152] After the intermediate routing node generates an intermediate shared key shared with the terminal device and the server based on the flow identifier, in order to allow only the terminal device to obtain the intermediate shared key based on the key confirmation message, the intermediate shared key can be encrypted based on 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 by the following formula: Enc_share_i=Enc{Key_pub_client,Key_share_i||IP_router_i}

[0153] Among them, 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 data β using key α, and || represents the splicing operation.

[0154] 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 through the public key of the terminal device. The intermediate shared key of each intermediate routing node in the encryption result corresponds to its IP address one by one.

[0155] 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 shown in Figure 9, Figure 9 exemplarily determines that the intermediate routing nodes in the traffic link are 3, represented by R1, R2 and R3, wherein 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), and the "+=" symbol in Figure 9 indicates that the encryption result of the intermediate shared key is embedded in the key creation message. The encryption result can be embedded in the "extension" part of the header of the key creation message. It can also be embedded in the payload, which is not limited here. Adding the encryption result to the key creation message allows the terminal device to obtain not only the shared key but also the intermediate shared key through the key creation message.

[0156] That is to say, after the server generates the flow identifier and 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. In the process of forwarding the key creation message to the terminal device through the intermediate routing node in the traffic link, the key creation message can instruct the intermediate routing node to generate an intermediate shared key based on the flow identifier, and add the encrypted intermediate shared key to the key encryption data, so that in the subsequent steps, after the terminal device obtains the key creation message, it can obtain the intermediate shared key corresponding to each intermediate routing node in the traffic link through the key encryption data in the key creation message, laying the foundation for the subsequent step in which the server encrypts the destination address in the traffic message according to the intermediate shared key, thereby improving the reliability and security of message transmission.

[0157] In one possible implementation, after the server sends a key creation message including key-encrypted data and a flow identifier to the terminal device through the traffic link in S23, the data encryption method further includes:

[0158] S31. The terminal device receives, via a traffic link with the server, a key creation message returned by the server in response to the message request message. The source address of the key creation message includes the server encryption address, and the key creation message includes key-encrypted data obtained by encrypting the public key of the terminal device.

[0159] S32. The terminal device decrypts the key-encrypted data using the terminal device's private key to obtain a shared key between the terminal device and the server, as well as N intermediate shared keys. These N intermediate shared keys correspond one-to-one to N intermediate routing nodes in the traffic link, where N is an integer greater than or equal to 1.

[0160] S33. The terminal device encrypts N intermediate shared keys using the shared key to obtain intermediate key encrypted data.

[0161] S34. The terminal device sends a key confirmation message including the intermediate key encrypted data to the server. The source address of the key confirmation message includes the terminal encryption address.

[0162] The terminal device can receive the key creation message sent by the server through 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 encrypted address in the key creation message.

[0163] As mentioned above, the key creation message includes key encryption data, which includes not only the encrypted shared key shared by the server and the terminal device, but also the encrypted intermediate shared key shared by each intermediate routing node in the traffic link and the terminal device and the server.

[0164] Since the key-encrypted data is encrypted by the public key of the terminal device, the key-encrypted data can be decrypted by the private key of the terminal device to obtain the shared key shared between the terminal device and the server, as well as the intermediate shared key corresponding to each intermediate routing node in the traffic link. For example, the shared key can be obtained by the following formula: Key_share = Dec{Key_pri_client, Enc_share}

[0165] Among them, 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 data β using key α.

[0166] The intermediate shared key can also be obtained by the following formula: Key_share_i,IP_router_i=Dec{Key_pri_client,Enc_share_i}

[0167] 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 α.

[0168] 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. In order to allow only the server to obtain the intermediate shared key, the N intermediate shared keys 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: Enc_share_server_i=Enc{Key_share,Key_share_i||IP_router_i}

[0169] 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 splicing operation.

[0170] According to the above formula, the intermediate shared key can be encrypted by the shared key to obtain the corresponding intermediate key encrypted data, in which the intermediate shared key of each intermediate routing node corresponds to its IP address one by one.

[0171] The terminal device can send a key confirmation message including intermediate key encrypted data to the server, allowing the server to obtain the intermediate shared key corresponding to each intermediate routing node in the traffic link by obtaining the key confirmation message, laying the foundation for encrypting the destination address of the traffic message according to the intermediate shared key in subsequent steps.

[0172] To prevent the key confirmation message from being intercepted by an attacker during forwarding and the relationship between the source address and destination address in the message being obtained, the source address in the key confirmation message is also concealed. That is, the source address in the key confirmation message is not the terminal address, but the terminal encrypted address, thereby reducing the possibility of an attacker inferring the user's private information through the source address and destination address of the key confirmation message. When the source address of the key confirmation message is concealed, in order to further confuse the attacker and maintain the message format, the source address of the key confirmation message can also include the terminal concealed address. As shown in Figure 10, the key confirmation message (Pkt_key_ack) includes the terminal concealed address IP_j, the terminal encrypted address IP_sec, and the intermediate key encrypted data Enc_share_server_i.

[0173] It should be noted that in order 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 in network communication.

[0174] In addition, as shown in FIG10 , the key confirmation message does not need to be forwarded from the terminal device to the server based on the above-mentioned traffic link. In other words, 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.

[0175] After obtaining the key creation message, the terminal device can use the key encryption data in the key creation message to determine the intermediate shared key corresponding to each intermediate routing node in the traffic link used to transmit the traffic message, and send a key confirmation message including the intermediate key encryption 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 the foundation for the server to encrypt the destination address of the traffic message according to the intermediate shared key in the subsequent steps, thereby improving the reliability and security of message transmission.

[0176] In one possible implementation, after the terminal device sends the key confirmation message including the data encrypted with the intermediate key to the server in S34, the data encryption method further includes:

[0177] S41. The server receives a key confirmation message returned by the terminal device in response to the key creation message. The source address of the key confirmation message includes the terminal encryption address. The key confirmation message includes intermediate key encrypted data. The intermediate key encrypted data is obtained by encrypting N intermediate shared keys using the shared key. The N intermediate shared keys correspond one-to-one to the N intermediate routing nodes.

[0178] S42. The server decrypts the intermediate key encrypted data using the shared key to obtain N intermediate shared keys.

[0179] S43. The server obtains encrypted routing information corresponding to each of 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 encrypted routing information corresponding to the i-th intermediate routing node 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 corresponding to the i-th intermediate routing node.

[0180] S44. The server adds the encrypted routing information to the traffic message. The destination address of the traffic message is obtained by encrypting the terminal address using 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.

[0181] The server can receive the key confirmation message returned by the terminal device. After receiving the key confirmation message, the server needs to determine the source address of the key confirmation message so that it can 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 hidden, the terminal encrypted address in the key confirmation message can be decrypted to determine that the real source address of the key confirmation message is the terminal address of the terminal device.

[0182] Since the key confirmation message includes the intermediate key encrypted data, as mentioned above, the intermediate key encrypted data is obtained by the terminal device using the shared key to encrypt the intermediate shared key corresponding to each intermediate routing node in the traffic link, and the shared key is the key information shared between the terminal device and the server, so the server can decrypt the intermediate key encrypted data according to the shared key to obtain the intermediate shared key corresponding to each intermediate routing node in the traffic link. For example, the intermediate shared key can be obtained by the following formula: Key_share_i,IP_router_i=Dec{Key_share,Enc_share_server_i}

[0183] 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_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 decryption operation of data β using key α.

[0184] Through the above formula, the server can decrypt the intermediate key encrypted data according to the shared key to obtain the intermediate shared key corresponding to each intermediate routing node in the traffic link.

[0185] After the server obtains the intermediate shared key corresponding to each intermediate routing node in the traffic link, the intermediate shared key can be saved so that when a traffic message based on the traffic link is subsequently generated, the saved intermediate shared key can be directly obtained to encrypt each intermediate routing node in the traffic link.

[0186] 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 message transmitted based on the traffic link, it can determine the encrypted routing information indicating the 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, thereby encrypting each intermediate routing node in the traffic link. Among them, the terminal address, which is the routing information of the next hop node of the previous hop intermediate routing node of the terminal device in the traffic link, is also encrypted by the corresponding target intermediate shared key. 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 encrypted by the corresponding intermediate shared key and used to indicate its next hop node. For example, the encrypted routing information corresponding to each intermediate routing node in the traffic link can be obtained by the following formula: Enc_routing_i=Enc{Key_share_i,IP_router_i||IP_router_i+1}

[0187] Among them, 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 data β using key α, and || represents the splicing operation.

[0188] According to the above formula, the routing 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, resulting in the corresponding encrypted routing information. By encrypting the routing information, the intermediate routing nodes in the traffic link can only obtain the routing information of the next hop node, reducing the risk of attackers obtaining the destination address of the traffic packet by hijacking the intermediate routing nodes.

[0189] When the server adds the encrypted routing information to the traffic message, 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 message, and obtain the routing information of the intermediate routing node and the routing information of the corresponding next-hop node. For example, the decrypted routing information can be obtained by the following formula: IP_router_i,IP_router_i+1=Dec{Key_share_i,Enc_routing_i}

[0190] Where, 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 data β using key α.

[0191] 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 message 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 message can be directly discarded. In other words, after 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 routing information of the intermediate routing node itself, the intermediate routing node can forward the traffic message to the next-hop node, that is, the encrypted routing information can complete the sequential forwarding of traffic messages on the traffic link.

[0192] The server can add encrypted routing information to the traffic message, so that the traffic message does not include the plaintext destination address, but instead allows each intermediate routing node in the traffic link to forward the traffic message to the next hop node in sequence according to its corresponding encrypted routing information until the traffic message is successfully forwarded to the terminal device, wherein 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, the terminal address, as the routing information of the next hop node of the previous hop intermediate routing node of the terminal device, can be encrypted in the encrypted routing information of the previous hop intermediate routing node through the target intermediate shared key, thereby realizing the encryption of the destination address in the traffic message.

[0193] In addition, the source address in the traffic message is still hidden, that is, the source address in the traffic message is not the server address, but the server encrypted address. When the source address and destination address of the traffic message are both hidden, in order to further confuse attackers and maintain the message format, the source address of the traffic message can also include the server hidden address. Correspondingly, the destination address of the traffic message can also include the terminal hidden address. As shown in Figure 11, the traffic message (Pkt_traffic) can include the server hidden address IP_n, the terminal hidden address IP_j, the server encrypted address IP_sec_server and the encrypted routing information Enc_routing_i.

[0194] After the server obtains the intermediate shared key corresponding to each intermediate routing node in the traffic link based on the key confirmation message, it can encrypt the next-hop routing information of each intermediate routing node in the traffic link based on the intermediate shared key, thereby allowing the traffic message to be accurately forwarded to the terminal device based on the encrypted routing information without including the plaintext destination address. In other words, on the basis of encrypting the source address of the traffic message, the destination address can also be encrypted by encrypting the routing information. When an attacker intercepts the traffic message, not only can they not obtain the sender of the traffic message, but they can also not obtain the receiver of the traffic message. This further reduces the possibility of the source and destination addresses in the traffic message being inferred by the attacker, and improves the security of message transmission.

[0195] Accordingly, in one possible implementation, in the traffic message returned by the terminal device in response to the message request message in S403, the data encryption method specifically includes:

[0196] The terminal device receives the traffic message returned by the server in response to the message request message through the traffic link. The destination address of the traffic message is obtained by encrypting the terminal address using 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.

[0197] When the server adds encrypted routing information to the traffic message, the intermediate routing nodes in the traffic link can decrypt the encrypted routing information, allowing the traffic message to be forwarded to the terminal device through the intermediate routing nodes in the traffic link in sequence. At this time, the traffic message does not include the plaintext terminal address. Instead, the terminal address is encrypted using the target intermediate shared key in the traffic link (the intermediate shared key corresponding to the previous hop intermediate routing node of the terminal device), so that the source address and destination address of the traffic message are both encrypted in the message to achieve anonymity.

[0198] On the basis of encrypting the source address of the traffic message, the destination address can also be encrypted through the target intermediate shared key. At this time, the traffic message can be forwarded to the terminal device in sequence according to the intermediate routing nodes in the traffic link. In other words, the traffic message can be successfully forwarded from the server to the terminal device when both the source address and the destination address are encrypted, thereby further reducing the possibility of the source address and destination address in the traffic message being inferred by attackers and improving the security of message transmission.

[0199] After receiving the key confirmation message sent by the terminal device, the server needs to decrypt the intermediate key encrypted data in the key confirmation message according to the shared key. If the server has to maintain the shared key shared with the terminal device for this purpose, this will undoubtedly increase the burden on the server. Therefore, in one possible implementation, before decrypting the intermediate key encrypted data according to the shared key in S42, the server can obtain the shared key in the following way:

[0200] The server decrypts the terminal encrypted address using the server's private key to obtain the terminal address;

[0201] The server generates a flow identifier for the traffic link based on the terminal address and server address;

[0202] The server generates a shared key using the terminal address and stream identifier.

[0203] Since the key confirmation message includes the terminal encrypted address, the terminal encrypted address can be decrypted using the server's private key to obtain the terminal address. The server can regenerate the flow ID for the traffic link based on the terminal address and the server address. For example, the flow ID of the traffic link can be determined using the following formula: FlowID = Hash(IP_m||IP_i||Port_server||Port_client||Protocol)

[0204] 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 splicing operation.

[0205] After determining the flow ID of the traffic link, the server can further determine the shared key corresponding to the terminal device based on the terminal address and flow ID. For example, the shared key for the traffic link can be calculated according to the following formula: Key_share = Hash(info_server||FlowID)

[0206] Among them, Key_share represents the shared key, info_server represents the server's own private information, FlowID represents the flow identifier, Hash() represents the hash operation, and || represents the splicing operation.

[0207] The server does not need to maintain the shared key shared with the terminal device all the time. When it is necessary to decrypt the intermediate key encrypted data in the key confirmation message based on the shared key, the server can regenerate the flow identifier and shared key corresponding to the traffic link based on the terminal address and server address, and decrypt the intermediate key encrypted data using the directly generated shared key, thereby reducing the cost of the server for maintaining the shared key.

[0208] Similarly, in order to avoid the cost of intermediate routing nodes for maintaining intermediate shared keys, in one possible implementation, the traffic message also includes a flow identifier, which is used to instruct the intermediate routing node to generate a corresponding intermediate shared key based on the flow identifier, and decrypt the encrypted routing information using the intermediate shared key to obtain the routing information of the next hop node.

[0209] When a traffic message 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 maintains the intermediate shared key for this purpose, it will obviously cause a certain cost. Therefore, the traffic message can also include a flow identifier. As shown in Figure 11, the traffic message (Pkt_traffic) can also include a flow identifier FlowID, so that the intermediate routing node can directly generate the corresponding intermediate shared key based on the flow identifier. For example, the intermediate shared key can be calculated according to the following formula: Key_share_i=Hash(Info_i||FlowID)

[0210] Among them, Key_share_i represents the intermediate shared key of the i-th intermediate routing node, info_i represents the corresponding i-th intermediate routing node's own private information, FlowID represents the flow identifier, Hash() represents the hash operation, and || represents the splicing operation.

[0211] Intermediate routing nodes do not need to maintain the intermediate shared key shared with terminal devices and servers all the time. When the encrypted routing information in the traffic message needs to be decrypted based on the intermediate shared key, the intermediate routing node can regenerate the corresponding intermediate shared key based on the flow identifier, so as to reduce the cost of the intermediate routing node for maintaining the intermediate shared key.

[0212] The following is a method embodiment to illustrate the specific process of the data encryption method in the present application in actual situations. As shown in FIG12 , the specific process of the data encryption method includes:

[0213] S1201. The terminal device sends a message request message carrying the terminal hidden address and the terminal encrypted address.

[0214] The terminal device sends a message request message to the server, which can be used to request the server to obtain the target content. The message request message does not include the plaintext terminal address, but instead carries the terminal encrypted address in the message request message, so as to achieve the concealment of the source address in the message request message by encrypting the source address. In order to further confuse attackers and maintain the message format, the message request message also carries the terminal hidden address.

[0215] S1202. The server sends a key creation message.

[0216] After receiving the message request message, the server will send a key creation message to obtain the intermediate shared key corresponding to the intermediate routing node included in the traffic link used to transmit the traffic message. The key creation message does not include the plaintext server address, but carries the server encrypted address in the key creation message, so as to hide the source address of the key creation message by encrypting the source address. In order to further confuse attackers and maintain the message format, the key creation message also carries the server hidden address.

[0217] At the same time, the key creation message also carries the shared key shared between the server and the terminal device and the flow identifier corresponding to the traffic link.

[0218] S1203, the intermediate routing node calculates the intermediate shared key, encrypts it and embeds it into the key creation message

[0219] When forwarding a key creation message, the intermediate routing node calculates the corresponding intermediate shared key using its own information and flow identification information, encrypts the calculated intermediate shared key using the public key corresponding to the destination address (terminal device), and embeds it into the key creation message so that the terminal device can obtain the intermediate shared key through the key creation message.

[0220] S1204: The terminal device decrypts the intermediate shared key, encrypts it, and sends it back to the server via a key confirmation message.

[0221] 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 encrypt the obtained intermediate shared key with the shared key shared with the server and embed it into the key confirmation message, so that the encrypted intermediate shared key can be returned to the server through the key confirmation message. Among them, the key confirmation message does not include the plaintext terminal address, but carries the terminal encrypted 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 attackers and maintain the message format, the key confirmation message also carries the terminal hidden address.

[0222] S1205 : The server decrypts to obtain an intermediate shared key, and uses the intermediate shared key to encrypt the routing information of the traffic link.

[0223] 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 intermediate routing node in the traffic link through the intermediate shared key to obtain the corresponding encrypted routing information. Adding the encrypted routing information to the traffic message can enable the traffic message to be forwarded through the routing information corresponding to each hop of the encrypted intermediate routing node carried by the traffic message without including the plaintext destination address. In other words, 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, thereby concealing both the source address and the destination address in the traffic message.

[0224] S1206: The intermediate routing node calculates the intermediate shared key and verifies the encrypted routing information in the traffic message.

[0225] After receiving the traffic message, the intermediate routing node can calculate the intermediate shared key again based on the flow identifier, 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.

[0226] S1207: The intermediate routing node verifies whether its own routing information is consistent with the decrypted routing information.

[0227] After decrypting the encrypted routing information carried in the traffic message, the intermediate routing node needs to verify whether its own routing information is consistent with the decrypted routing information.

[0228] S1208a. If the routing information of the intermediate routing node is consistent with the decrypted routing information, the traffic message may be forwarded to the next hop node to implement sequential forwarding of the traffic message in the traffic link.

[0229] S1208b: If the intermediate routing node's own routing information is inconsistent with the decrypted routing information, the intermediate routing node may discard the message.

[0230] S1209: The terminal device sends a traffic confirmation message to the server for packet retransmission.

[0231] After receiving the traffic message, the terminal device can send a traffic confirmation message to the server. The traffic confirmation message is used to allow the server to obtain the packet loss information of the terminal device, and when the terminal device loses packets, it can retransmit the lost packet data by sending the traffic message again. The traffic confirmation message does not include the plaintext terminal address, but carries the terminal encrypted address in the traffic confirmation message, so as to achieve the concealment of the source address in the traffic confirmation message by encrypting the source address. In order to further confuse attackers and maintain the message format, the traffic confirmation message also carries the terminal hidden address.

[0232] As shown in Figure 13, the above-mentioned data encryption method is adopted, and the network communication between the server and the terminal device B is taken as an example to illustrate the network communication between the server and the terminal device. The present application can realize the network communication between the terminal device B and the server by encrypting the message request message of the source address, the key creation message of the source address, the key confirmation message of the source address, the traffic message of the source address and the destination address, and the traffic confirmation message of the source address. In the message interaction process, at least one of the source address and the destination address of the message exchanged between the server and the terminal device is encrypted, and the source address and the destination address in the traffic message with the largest number are encrypted, thereby reducing the possibility of attackers obtaining user privacy through the source address and the destination address, and enhancing the security of message interaction.

[0233] Based on the embodiments corresponding to the aforementioned Figures 1-13, Figure 14 is a device structure diagram of a data encryption device provided in an embodiment of the present application. The data encryption device 1400 includes a sending unit 1401, an acquiring unit 1402, a decryption unit 1403, and a receiving unit 1404:

[0234] The sending unit 1401 is configured to send a message request message to the server. The source address of the message request message includes a terminal encryption address. The terminal encryption address is obtained by encrypting the terminal address of the terminal device using the public key of the server.

[0235] The acquiring unit 1402 is configured to receive a traffic message returned by the server in response to the message request message, wherein the source address of the traffic message includes an encrypted server address, which is obtained by encrypting the server address of the server using the public key of the terminal device;

[0236] The decryption unit 1403 is used to decrypt the server encrypted address using the private key of the terminal device to obtain the server pending address;

[0237] The receiving unit 1404 is configured to obtain the flow data in the flow message in response to the pending server address being consistent with the server address.

[0238] In one possible implementation, the source address of the message request message also includes a terminal hidden address, which is a virtual terminal address different from the terminal address; the source address of the traffic message also includes a server hidden address, which is a virtual server address different from the server address.

[0239] In a possible implementation, the sending unit 1401 is further configured to:

[0240] Receive, via the traffic link with the server, a key creation message returned by the server in response to the message request message. The source address of the key creation message includes the server encryption address, and the key creation message includes key-encrypted data obtained by encrypting the public key of the terminal device.

[0241] The key-encrypted data is decrypted using the private key of the terminal device to obtain the shared key between the terminal device and the server, as well as N intermediate shared keys. The N intermediate shared keys correspond one-to-one to the N intermediate routing nodes in the traffic link, where N is an integer greater than or equal to 1.

[0242] Encrypt N intermediate shared keys using a shared key to obtain intermediate key-encrypted data;

[0243] A key confirmation message including the intermediate key encrypted data is sent to the server, wherein the source address of the key confirmation message includes the terminal encryption address.

[0244] In one possible implementation, the acquisition unit 1402 is used to receive the traffic message returned by the server in response to the message request message through the traffic link. The destination address of the traffic message is obtained by encrypting the terminal address 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.

[0245] In a possible implementation, the sending unit 1401 is further configured to:

[0246] Determine the message receiving result for the traffic message;

[0247] A traffic confirmation message including a message reception result is sent to the server, where the source address of the traffic confirmation message includes the terminal encryption address.

[0248] In a possible implementation, the acquiring unit 1402 is further configured to:

[0249] The receiving server obtains a traffic retransmission message returned in response to the traffic confirmation message. The traffic retransmission message is a traffic message not received by the terminal device identified by the message reception result. The source address of the traffic retransmission message includes the server encryption address.

[0250] Based on the embodiments corresponding to the aforementioned Figures 1-13, Figure 15 is a device structure diagram of another data encryption device provided in an embodiment of the present application. The data encryption device 1500 includes an acquisition unit 1501, a decryption unit 1502, and a sending unit 1503;

[0251] The acquiring unit 1501 is configured to receive a message request message sent by a terminal device, wherein the source address of the message request message includes a terminal encryption address, which is obtained by encrypting the terminal address of the terminal device using the public key of the server;

[0252] The decryption unit 1502 is used to decrypt the terminal encrypted address using the server's private key to obtain the terminal address;

[0253] The sending unit 1503 is used to send a traffic message returned in response to the message request message to the terminal device according to the terminal address. The source address of the traffic message includes the server encryption address, which is obtained by encrypting the server address of the server using the public key of the terminal device.

[0254] In a possible implementation, the sending unit 1503 is configured to:

[0255] According to the terminal address, determine the traffic link from the server to the terminal device. The traffic link includes N intermediate routing nodes, where N is an integer greater than or equal to 1;

[0256] The traffic message returned in response to the message request message is sent to the terminal device through N intermediate routing nodes in the traffic link.

[0257] In a possible implementation, the sending unit 1503 is further configured to:

[0258] Generate a flow identifier and shared key for the traffic link based on the terminal address and server address;

[0259] Encrypt the shared key using the public key of the terminal device to obtain key-encrypted data;

[0260] A key creation message including key-encrypted data and a flow identifier is sent 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 N intermediate routing nodes to generate an intermediate shared key based on the flow identifier, encrypt the intermediate shared key using the public key of the terminal device, and add the encrypted result to the key-encrypted data.

[0261] In a possible implementation, the acquiring unit 1501 is further configured to:

[0262] Receive a key confirmation message returned by the terminal device in response to the key creation message. The source address of the key confirmation message includes the terminal encryption address. The key confirmation message includes intermediate key encrypted data. The intermediate key encrypted data is obtained by encrypting N intermediate shared keys using the shared key. The N intermediate shared keys correspond one-to-one to the N intermediate routing nodes.

[0263] Decrypt the intermediate key encrypted data using the shared key to obtain N intermediate shared keys;

[0264] Based on the N intermediate shared keys and the routing addresses of the N intermediate routing nodes, the encrypted routing information corresponding to each of the N intermediate routing nodes is obtained. For the i-th intermediate routing node among the N intermediate routing nodes, the encrypted routing information corresponding to the i-th intermediate routing node 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 corresponding to the i-th intermediate routing node.

[0265] The encrypted routing information is added to the traffic message. The destination address of the traffic message is obtained by encrypting the terminal address using 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.

[0266] In a possible implementation, the acquiring unit 1501 is further configured to:

[0267] Decrypt the terminal encrypted address using the server's private key to obtain the terminal address;

[0268] Generate a flow identifier for the traffic link based on the terminal address and server address;

[0269] Generate a shared key using the endpoint address and stream ID.

[0270] In one possible implementation, the traffic message also includes a flow identifier, which is used to instruct the intermediate routing node to generate a corresponding intermediate shared key based on the flow identifier, and decrypt the encrypted routing information using the intermediate shared key to obtain the routing information of the next hop node.

[0271] In one possible implementation, the sending unit 1503 is further configured to: receive a flow confirmation message including a message reception result sent by the terminal device, where the source address of the flow confirmation message includes the terminal encryption address, and the message reception result is used to identify a reception status of the flow message by the terminal device;

[0272] When it is determined based on the message reception result that the terminal device has not received the target traffic message, the target traffic message is sent to the terminal device as a traffic retransmission message, and the source address of the traffic retransmission message includes the server encryption address.

[0273] Based on the embodiments corresponding to the aforementioned Figures 1-13, Figure 16 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 used to execute the method of the aforementioned method embodiment, and the server 1602 is used to execute the method of the aforementioned method embodiment.

[0274] The embodiment of the present application further provides a computer device, which is the computer device described above and may include a terminal device or a server. The aforementioned data encryption device may be configured in the computer device. The computer device is described below with reference to the accompanying drawings.

[0275] If the computer device is a terminal device, as shown in FIG17 , an embodiment of the present application provides a terminal device, taking a mobile phone as an example:

[0276] FIG17 is a block diagram showing a partial structure of a mobile phone related to a terminal device provided in an embodiment of the present application. Referring to FIG17 , the mobile phone includes components such as 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. Those skilled in the art will appreciate that the mobile phone structure shown in FIG17 does not limit the mobile phone and may include more or fewer components than shown, or combine certain components, or arrange the components differently.

[0277] The following is a detailed introduction to the various components of the mobile phone in conjunction with Figure 17:

[0278] The RF circuit 1410 may be used for receiving and sending signals during information transmission or calls. In particular, after receiving downlink information from the base station, it is sent to the processor 1480 for processing. In addition, the designed uplink data is sent to the base station.

[0279] Memory 1420 can be used to store software programs and modules. Processor 1480 executes the various functional applications and data processing of the mobile phone by running the software programs and modules stored in memory 1420. Memory 1420 may mainly include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created based on the use of the mobile phone (such as audio data, a phone book, etc.). In addition, memory 1420 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0280] The input unit 1430 may be configured to receive input digital or character information and generate key signal input related to user settings and function control of the mobile phone. Specifically, the input unit 1430 may include a touch panel 1431 and other input devices 1432 .

[0281] The display unit 1440 may be configured 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 may include a display panel 1441 .

[0282] The mobile phone may also include at least one sensor 1450, such as a light sensor, a motion sensor, and other sensors.

[0283] The audio circuit 1460 , the speaker 1461 , and the microphone 1462 can provide an audio interface between the user and the mobile phone.

[0284] WiFi is a short-range wireless transmission technology. The mobile phone can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 1470, providing users with wireless broadband Internet access.

[0285] The processor 1480 is the control center of the mobile phone. It uses various interfaces and lines to connect various parts of the entire mobile phone. It executes various functions of the mobile phone and processes data by running or executing software programs and / or modules stored in the memory 1420 and calling data stored in the memory 1420.

[0286] The mobile phone also includes a power supply 1490 (such as a battery) for supplying power to various components.

[0287] In this embodiment, the processor 1480 included in the terminal device is also used to execute the data encryption method on the terminal device side provided in the embodiment of the present application.

[0288] If the computer device is a server, an embodiment of the present application also provides a server, as shown in Figure 18, which is a structural diagram of a server 1500 provided in an embodiment of the present application. The server 1500 may have relatively large differences 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 can be temporary storage or permanent 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. Furthermore, the central processing unit 1522 can be configured to communicate with the storage medium 1530 to execute a series of instruction operations in the storage medium 1530 on the server 1500.

[0289] The server 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input and output interfaces 1558, and / or one or more operating systems 1541, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.

[0290] The steps executed by the server in the above embodiment may be based on the server structure shown in FIG18 .

[0291] In addition, an embodiment of the present application further provides a storage medium, which is used to store a computer program, and the computer program is used to execute the method provided by the above embodiment.

[0292] An embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the method provided in the above embodiment.

[0293] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the above-mentioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the above-mentioned storage medium can be at least one of the following media: read-only memory (English: Read-only Memory, abbreviated: ROM), RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0294] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and 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, and the relevant parts can be referred to the partial description of the method embodiments. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0295] The above is only one specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Moreover, based on the implementation methods provided in the above aspects, the present application can also be further combined to provide more implementation methods. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A data encryption method, the method being executed by a terminal device, the method comprising: Sending a message request message to the server, wherein 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 using the public key of the server; Receive a traffic message returned by the server in response to the message request message, where the source address of the traffic message includes a server encryption address, where the server encryption address is obtained by encrypting the server address of the server using the public key of the terminal device; Decrypting the encrypted server address using the private key of the terminal device to obtain a pending server address; In response to the pending address of the server being consistent with the server address, traffic data in the traffic message is acquired.

2. According to the method described in claim 1, the source address of the message request message also includes a terminal hidden address, which is a virtual terminal address different from the terminal address; the source address of the traffic message also includes a server hidden address, which is a virtual server address different from the server address.

3. The method according to claim 1 or 2, further comprising: receiving, through a traffic link with the server, a key creation message returned by the server in response to the message request message, wherein the source address of the key creation message includes the server encryption address, and the key creation message includes key encryption data obtained by encrypting the public key of the terminal device; Decrypting the key-encrypted data by using the private key of the terminal device to obtain a shared key between the terminal device and the server and N intermediate shared keys, wherein the N intermediate shared keys correspond one-to-one to N intermediate routing nodes in the traffic link, where N is an integer greater than or equal to 1; Encrypting the N intermediate shared keys by using the shared key to obtain intermediate key encrypted data; A key confirmation message including the intermediate key encrypted data is sent to the server, wherein the source address of the key confirmation message includes the terminal encryption address.

4. According to the method of claim 3, the receiving the traffic message returned by the server in response to the message request message comprises: The traffic message returned by the server in response to the message request message is received through the traffic link, the destination address of the traffic message is obtained by encrypting the terminal address through the target intermediate shared key, and the target intermediate shared key is the intermediate shared key corresponding to the previous hop intermediate routing node of the terminal device in the traffic link.

5. The method according to any one of claims 1 to 4, further comprising: Determine a message receiving result for the traffic message; A flow confirmation message including the message reception result is sent to the server, wherein the source address of the flow confirmation message includes the terminal encryption address.

6. The method according to claim 5, further comprising: Receive the traffic retransmission message returned by the server in response to the traffic confirmation message, the traffic retransmission message is the traffic message not received by the terminal device as identified by the message reception result, and the source address of the traffic retransmission message includes the server encryption address.

7. A data encryption method, the method being executed by a server, the method comprising: receiving a message request message sent by a terminal device, wherein the source address of the message request message includes a terminal encryption address, The terminal encryption address is obtained by encrypting the terminal address of the terminal device using the public key of the server; Decrypting the encrypted address of the terminal using the private key of the server to obtain the terminal address; According to the terminal address, a traffic message returned in response to the message request message is sent to the terminal device, wherein 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 using the public key of the terminal device.

8. The method according to claim 7, wherein sending the traffic message returned in response to the message request message to the terminal device according to the terminal address comprises: Determine, according to the terminal address, a traffic link from the server to the terminal device, wherein the traffic link includes N intermediate routing nodes, where N is an integer greater than or equal to 1; The traffic message is sent to the terminal device through the N intermediate routing nodes in the traffic link.

9. The method according to claim 8, further comprising: 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 by using the public key of the terminal device to obtain key-encrypted data; A key creation message including the key-encrypted data and the flow identifier is sent to the terminal device through the traffic link, wherein the source address of the key creation message includes the server encryption address, and the key creation message 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 through the public key of the terminal device, and add the encryption result to the key-encrypted data.

10. The method according to claim 9, further comprising: receiving a key confirmation message returned by the terminal device in response to the key creation message, wherein the source address of the key confirmation message includes the terminal encryption address, and the key confirmation message includes intermediate key encrypted data, wherein the intermediate key encrypted data is obtained by encrypting N intermediate shared keys by using the shared key, and the N intermediate shared keys correspond one-to-one to the N intermediate routing nodes; Decrypting the intermediate key encrypted data by using 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, the encrypted routing information corresponding to each of the N intermediate routing nodes is obtained, and 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 by using the intermediate shared key corresponding to the i-th intermediate routing node; The encrypted routing information is added to the traffic message, the destination address of the traffic message is obtained by encrypting the terminal address through 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.

11. The method according to claim 10, before decrypting the intermediate key encrypted data by using the shared key to obtain the N intermediate shared keys, the method further comprises: Decrypting the encrypted address of the terminal using the private key of the server to obtain the terminal address; generating a flow identifier for the traffic link according to the terminal address and the server address; The shared key is generated by using the terminal address and the flow identifier.

12. According to the method described in any one of claims 9 to 11, the traffic message also includes a flow identifier, and the flow identifier is used to instruct the 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.

13. The method according to any one of claims 7 to 12, further comprising: receiving a flow confirmation message including a message reception result sent by the terminal device, wherein the source address of the flow confirmation message includes the terminal encryption address, and the message reception result is used to identify a reception status of the flow message by the terminal device; When it is determined based on the message reception result that the terminal device has not received the target traffic message, the target traffic message is sent to the terminal device as a traffic retransmission message, and the source address of the traffic retransmission message includes the server encryption address.

14. A data encryption device, comprising a sending unit, an acquiring unit, a decryption unit and a receiving unit; The sending unit is used to send a message request message to the server, wherein 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 through the public key of the server; The acquisition unit is configured to receive a traffic message returned by the server in response to the message request message, wherein 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 using the public key of the terminal device; The decryption unit is used to decrypt the server encrypted address by using the private key of the terminal device to obtain the server pending address; The receiving unit is used to obtain the flow data in the flow message in response to the pending address of the server being consistent with the server address.

15. A data encryption device, comprising an acquisition unit, a decryption unit, and a sending unit; The acquisition unit is used to receive a message request message sent by a terminal device, wherein 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 using the public key of the server; The decryption unit is used to decrypt the terminal encrypted address by using the private key of the server to obtain the terminal address; The sending unit is used to send a traffic message returned in response to the message request message to the terminal device according to the terminal address, wherein 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 using the public key of the terminal device.

16. A data encryption system, comprising a terminal device and a server, wherein the terminal device is used to execute the method described in any one of claims 1 to 6, and the server is used to execute the method described in any one of claims 7 to 13.

17. A computer device, comprising a processor and a memory: The memory is used to store a computer program and transmit the program code to the processor; The processor is used to execute the method of any one of claims 1-6 according to the instructions in the computer program, or to execute the method of any one of claims 7-13.

18. A computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, wherein the computer program is used to execute the method according to any one of claims 1 to 6, or execute the method according to any one of claims 7 to 13.

19. A computer program product comprising a computer program, which, when executed on a computer device, enables the computer device to execute the method according to any one of claims 1 to 6, or the method according to any one of claims 7 to 13.

Citation Information

Patent Citations

  • A data encryption method and related device

    CN118540087B

  • Message encryption transmission method, terminal and server

    CN105978798A

  • Data processing method and system based on Internet of Scenes

    CN109462594A

  • Address-free IPv6 non-public server, client and communication method

    CN110493367A

  • Message processing method, client device, server device and medium

    CN114915583A

Cited By

  • End-to-end secure communication encryption method and system

    CN119854015A