TEE-based network communication method, device and system

By introducing TEE into mobile devices and using its processor and storage media to perform key management and data packaging in REE, the problem of insufficient security of REE is solved and the trustworthiness of data processing and storage in network communication is achieved. The execution environment improves the security of network communications.

CN114124434BActive Publication Date: 2024-09-17ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111128221.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-26
Publication Date
2024-09-17
Estimated Expiration
2041-09-26

AI Technical Summary

Technical Problem

In the existing technology, the security of REE is weak and vulnerable to attacks, resulting in illegal takeover and forgery of data during network communication. It lacks a trusted execution environment to ensure the security of data processing and storage.

Method used

By introducing TEE into server devices and client devices, the processor and storage media in TEE are used for key management and data packaging operations to ensure that communication requests and response messages are processed in a trusted execution environment and adopt a three-way handshake mechanism. Generate and agree on symmetric keys for encrypted communication.

Benefits of technology

Processing and storing network communication data in a trusted execution environment significantly improves the security of network communication, prevents attacks and data tampering, and ensures the integrity and confidentiality of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114124434B
    Figure CN114124434B
Patent Text Reader

Abstract

The embodiments of this specification provide a network communication method, device and system based on TEE. In a network communication method, a first processor in a TEE included in a server device receives a communication request from a client device through a first socket in a REE included in the server device, and obtains a client public key from the communication request at the first processor; when the first processor determines that a symmetric key is not stored in a first storage medium in the TEE included in the server device based on the client public key, the first processor sends a request response message to the client device through the first socket, and the client device and the first processor perform a three-way handshake through the first socket to obtain a symmetric key agreed upon by the server device and the client device; and the client device and the first processor communicate through the first socket using a symmetric key.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of communication technology, and specifically, to a TEE-based network communication method, device, and system. Background Art

[0002] REE (Rich Execution Environment) is a common environment for all mobile devices. Common OS (Operating System) can be run in REE, such as Android, iOS, Linux, etc. REE can provide all the functions of the device to the upper-level APP, so REE is widely used.

[0003] Based on the universality and extensiveness of REE, network communications between devices are all performed in REE. For example, keys, certificates, random numbers, anti-replay attack data, etc. in the network communication process are all stored in REE. Data packaging operations and cryptographic operations in the network communication process are also performed in REE. Summary of the invention

[0004] In view of the above, the embodiments of this specification provide a network communication method, device and system based on TEE. Through the technical solution provided in the embodiments of this specification, it is ensured that data processing and storage in the network communication process are all carried out in a trusted execution environment, avoiding attacks on the network communication process and improving the security of network communication.

[0005] According to one aspect of an embodiment of the present specification, a TEE-based network communication method is provided, the network communication method being executed by a server device, the server device comprising a first socket in REE and a first processor and a first storage medium in TEE, the first socket being used to connect the first processor to a client device so as to enable a communication connection between the first processor and the client device; the network communication method comprising: the first processor receiving a communication request from the client device through the first socket, the communication request comprising a client public key of the client device; obtaining the client public key from the communication request at the first processor; when the first processor determines at the first processor based on the client public key that a symmetric key for communication between the server device and the client device is not stored in the first storage medium, the first processor sending a request response message to the client device through the first socket, the request response message comprising the server public key of the server device; the client device and the first processor performing a three-way handshake through the first socket to obtain a symmetric key agreed upon by the server device and the client device; and the client device and the first processor communicating through the first socket using the symmetric key.

[0006] According to another aspect of the embodiment of this specification, a TEE-based network communication method is also provided, the network communication method is executed by a client device, the client device includes a second socket based on REE and a second processor based on TEE and a second storage medium, the second socket is used to connect the second processor to the server device so that the second processor and the server device are communicated; the network communication method includes: the second processor sends a communication request to the server device through the second socket, the communication request includes the client public key of the client device; the second processor receives a request response message from the server device through the second socket, the request response message includes the server public key of the server device; the server device and the second processor perform a three-way handshake through the second socket to obtain a symmetric key agreed upon by the server device and the client device; and the server device and the second processor communicate through the second socket using the symmetric key.

[0007] According to another aspect of the embodiments of this specification, a TEE-based network communication system is also provided, and the network communication system includes: a server device for executing any of the above-mentioned network communication methods and a client device for executing any of the above-mentioned network communication methods.

[0008] According to another aspect of an embodiment of this specification, a TEE-based network communication device is also provided, the network communication device is applied to a server device, the network communication device includes a first socket based on REE and a first processor based on TEE and a first storage medium, the first socket is used to connect the first processor to a client device so that the first processor and the client device are communicated; the network communication device also includes a computer program stored on the first storage medium, and the first processor executes the computer program to implement: the first processor receives a communication request from the client device through the first socket, and the communication request includes a client public key of the client device; the client public key is obtained from the communication request at the first processor; when the first processor determines that the first storage medium does not store a symmetric key for communication between the server device and the client device based on the client public key, the first processor sends a request response message to the client device through the first socket, and the request response message includes the server public key of the server device; the client device and the first processor perform a three-way handshake through the first socket to obtain a symmetric key agreed upon by the server device and the client device; and the client device and the first processor communicate through the first socket using the symmetric key.

[0009] According to another aspect of the embodiment of this specification, a TEE-based network communication device is also provided, which is applied to a client device, and includes a second socket based on REE, a second processor based on TEE, and a second storage medium, wherein the second socket is used to connect the second processor to a server device so as to enable communication connection between the second processor and the server device; the network communication device also includes a computer program stored on the second storage medium, and the second processor executes the computer program to implement: the second processor sends a communication request to the server device through the second socket, and the communication request includes the client public key of the client device; the second processor receives a request response message from the server device through the second socket, and the request response message includes the server public key of the server device; the server device and the second processor perform a three-way handshake through the second socket to obtain a symmetric key agreed upon by the server device and the client device; and the server device and the second processor communicate through the second socket using the symmetric key.

[0010] According to another aspect of the embodiments of this specification, an electronic device is also provided, including: at least one processor; and a memory, wherein the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one processor executes the TEE-based network communication method as described above.

[0011] According to another aspect of an embodiment of this specification, a machine-readable storage medium is also provided, which stores executable instructions, and when the instructions are executed, the machine executes the TEE-based network communication method as described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] A further understanding of the nature and advantages of the embodiments of the present specification can be achieved by referring to the following drawings. In the drawings, similar components or features may have the same reference numerals.

[0013] Figure 1 A schematic diagram showing an example in which a device according to an embodiment of this specification has TEE and REE.

[0014] Figure 2 A schematic diagram showing another example in which a device according to an embodiment of this specification has TEE and REE.

[0015] Figure 3 A schematic diagram showing an example of a TEE-based network communication method according to an embodiment of this specification.

[0016] Figure 4 A schematic diagram showing an example of a three-way handshake based on TEE according to an embodiment of this specification.

[0017] Figure 5 A schematic diagram showing another example of a TEE-based network communication method according to an embodiment of this specification.

[0018] Figure 6 A schematic diagram showing another example of a TEE-based network communication method according to an embodiment of this specification.

[0019] Figure 7 A schematic diagram showing another example of a TEE-based network communication method according to an embodiment of this specification.

[0020] Figure 8 A block diagram of an example of a TEE-based network communication system according to an embodiment of this specification is shown.

[0021] Fig. 9 A block diagram of an example of a TEE-based network communication device according to an embodiment of this specification is shown.

[0022] Fig.10 A block diagram of an example of a TEE-based network communication device according to an embodiment of this specification is shown.

[0023] Fig.11 A block diagram of an electronic device for implementing a TEE-based network communication method according to an embodiment of this specification is shown.

[0024] Fig.12 A block diagram of an electronic device for implementing a TEE-based network communication method according to an embodiment of this specification is shown. DETAILED DESCRIPTION

[0025] The subject matter described herein will be discussed below with reference to example implementations. It should be understood that the discussion of these implementations is only to enable those skilled in the art to better understand and implement the subject matter described herein, and is not a limitation of the scope of protection, applicability or examples set forth in the claims. The functions and arrangements of the elements discussed may be changed without departing from the scope of protection of the embodiments of this specification. Various processes or components may be omitted, substituted or added to each example as needed. In addition, the features described relative to some examples may also be combined in other examples.

[0026] As used herein, the term "including" and its variations represent open terms, meaning "including but not limited to". The term "based on" means "based at least in part on". The terms "one embodiment" and "an embodiment" mean "at least one embodiment". The term "another embodiment" means "at least one other embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other definitions may be included below, whether explicit or implicit. Unless the context clearly indicates otherwise, the definition of a term is consistent throughout the specification.

[0027] REE (Rich Execution Environment) is a common environment for all mobile devices. Common OS (Operating System) can be run in REE, such as Android, iOS, Linux, etc. REE can provide all the functions of the device to the upper-level APP, so REE is widely used.

[0028] Based on the universality and extensiveness of REE, network communications between devices are all performed in REE. For example, keys, certificates, random numbers, and data to prevent replay attacks during network communications are all stored in REE. Data packaging operations and cryptographic operations during network communications are also performed in REE. However, the security of REE is relatively weak and vulnerable to attacks. Once REE is breached, network transmission will be illegally taken over and network communication data can be forged.

[0029] In view of the above, the embodiments of this specification provide a network communication method, device and system based on TEE. A network communication method based on TEE, the network communication method is executed by a server device, the server device includes a first socket based on REE and a first processor based on TEE and a first storage medium, the first socket is used to connect the first processor and the client device, so that the first processor and the client device are connected in communication; the network communication method includes: the first processor receives a communication request from the client device through the first socket, the communication request includes the client public key of the client device; the client public key is obtained from the communication request at the first processor; when the first processor determines that the symmetric key for communication between the server device and the client device is not stored in the first storage medium based on the client public key, the first processor sends a request response message to the client device through the first socket, the request response message includes the server public key of the server device; the client device and the first processor perform a three-way handshake through the first socket to obtain a symmetric key agreed upon by the server device and the client device; and the client device and the first processor communicate through the first socket using the symmetric key. The technical solution provided in the embodiments of this specification ensures that data processing, storage, etc. during the network communication process are all performed in a trusted execution environment, thereby avoiding attacks on the network communication process and improving the security of network communications.

[0030] The following describes in detail the TEE-based network communication method, device and system with reference to the accompanying drawings.

[0031] In the embodiments of this specification, the devices for network communication may include a server device and a client device, that is, the server device and the client device perform network communication. The hardware of the server device and the client device are configured as REE and TEE (Trusted Execution Environment), based on which the processors of the server and the client devices have TEE capabilities. In the embodiments of this specification, the processors of the server and the client devices can be shared by TEE and REE, or can be configured as TEE only.

[0032] Figure 1A schematic diagram of an example 100 of a device having TEE and REE according to an embodiment of the present specification is shown.

[0033] like Figure 1 As shown, the hardware of the device is configured as TEE and REE at the same time. In one example, the TEE in the device can be implemented based on TrustZone. TEE is isolated from REE, and TEE and REE can communicate in a specific way, for example, the specific way can include communication based on SMC instructions. Under a fast communication mechanism between TEE and REE, TEE can access the memory of REE, while REE is restricted from accessing the hardware-protected TEE memory, thereby ensuring the security of TEE.

[0034] In TEE, internal API and external API can be provided. External API can be the underlying communication interface that allows applications running in REE to access trusted application services and data, and internal API can be the interface provided by TEE to trusted applications running in TEE. Internal API can include key management, cryptographic algorithms, secure storage, secure clock resources and services, trusted UI, etc.

[0035] In one example, Figure 1 The device shown may be a server device or a client device.

[0036] Figure 2 A schematic diagram of another example 200 of a device having a TEE and a REE according to an embodiment of the present specification is shown.

[0037] like Figure 2 As shown, the device includes a socket, a processor and a storage medium. The socket is in the REE, and the processor and the storage medium are in the TEE. The processor may include at least one of a CPU, a GPU, etc., and the storage medium may include at least one of a memory, a non-volatile memory, etc. It should be noted that there may also be a processor in the REE. In this case, the processor in the device is shared by the REE and the TEE. Figure 2 The processors shown in the figure are the processors in the TEE. The processors in the REE are not shown in the figure. Figure 2 Indicated in the middle.

[0038] The socket in REE can be used as an interface for TEE to communicate with other external devices, and the socket in REE can communicate with TEE. The socket can include the destination IP address of the communication, the transport layer protocol used (for example, TCP protocol, UDP protocol, etc.) and the port number. Figure 2 When the device shown is connected to communicate with other devices, the socket in the REE in the device can be used as the external communication interface of the device. At this time, TEE can communicate with the other device through the socket in the REE.

[0039] In one example, Figure 2 The device shown may be a server device, in which case the socket in the REE is the first socket, the processor in the TEE is the first processor, and the storage medium in the TEE is the first storage medium. In this example, the first socket in the server device is used to connect the first processor to the client device so that the first processor and the client device are communicated. The destination IP address of the first socket is the IP address of the client device.

[0040] In another example, Figure 2 The device shown may be a client device, in which case the socket in the REE is the second socket, the processor in the TEE is the second processor, and the storage medium in the TEE is the second storage medium. In this example, the second socket in the client device is used to connect the second processor to the server device so that the second processor and the server device are communicated. The destination IP address of the second socket is the IP address of the server device.

[0041] Figure 3 A schematic diagram showing an example of a TEE-based network communication method according to an embodiment of this specification.

[0042] like Figure 3 As shown, at 310, the second processor may send a communication request to the server device through the second socket.

[0043] In the embodiments of this specification, the communication request may include the client public key of the client device. The client public key can be used by the server device to encrypt the sent handshake message using the client public key during the three-way handshake between the client device and the server device, so as to improve the security of the handshake message during the three-way handshake.

[0044] In one example, the communication request may include a certificate of the client device, where the certificate includes a client public key. Specifically, the certificate may bind the value of the client public key to the identity of the client device.

[0045] At the client device, the client public key or certificate can be stored in the second storage medium of the TEE, thereby ensuring the security of the client public key and certificate.

[0046] The data packaging operation for the communication request at the client device is performed in the TEE, and the packaging protocol of the data packaging is stored in the second storage medium. For the data packaging operation for the communication request, specifically, the second processor in the TEE can obtain the client public key and the packaging protocol from the second storage medium, and then the second processor can perform the data packaging operation on the client public key according to the packaging protocol to obtain a communication request including the client public key. The data packaging operation process is performed in the TEE, thereby ensuring the security of the data packaging operation and the security of the data in the data packaging.

[0047] After generating the communication request, the second processor may send the communication request to the second socket in the REE, and the second socket then sends the communication request to the server device according to the destination IP address (ie, the IP address of the server device).

[0048] The server device receives the communication request through the first socket, that is, when the communication request arrives at the server device, it first arrives at the first socket in the REE, and the communication request is received by the first socket. Then, the first socket sends the received communication request to the first processor in the TEE. In the TEE of the server device, the first processor can obtain the client public key from the communication request, and then the first processor can store the client public key in the first storage medium.

[0049] Next, in one example, at the first processor of the server device, it may be queried whether a symmetric key for communication between the server device and the client device is stored in the first storage medium based on the client public key.

[0050] The symmetric key is the key obtained after the server device and the client device have a three-way handshake. The symmetric key is used to encrypt the communication data during each communication process between the server device and the client device. Therefore, when the symmetric key exists in the server device, it can be considered that network communication has occurred between the server device and the client device. If the symmetric key can continue to be used, the symmetric key can be directly used for communication between the server device and the client device.

[0051] In this example, the manner of storing the symmetric key in the first storage medium may include a correspondence between a client public key and a symmetric key. For each correspondence, the client device corresponding to the client public key in the correspondence communicates with the server device using the symmetric key in the correspondence.

[0052] After the server device establishes a communication connection with any client device, the server device and the client device can both generate the same symmetric key, and use the generated symmetric key for communication between the server device and the client device. At the server device, the first processor can establish a correspondence between the client public key of the client device and the symmetric key, and store the established correspondence in the first storage medium.

[0053] In one example, in the case where the symmetric key has a validity period, when the symmetric key has expired, the first processor can delete the corresponding relationship of the expired symmetric key from the first storage medium. In another example, when the communication connection between the server device and the client device is interrupted, the first processor can delete the corresponding relationship of the interrupted client device from the first storage medium. When the client device needs to communicate with the server device, it re-establishes a communication connection with the server device and regenerates the symmetric key for communication between the server device and the client device.

[0054] In this example, when the symmetric key is found in the first storage medium, it can be determined that the symmetric key is stored in the first storage medium. In this case, the subsequent operations are combined with Figure 5 Let me explain in detail.

[0055] When the symmetric key is not found in the first storage medium, it can be determined that the symmetric key is not stored in the first storage medium. In this case, the operation of 320 can be continued.

[0056] At 320, the first processor may send a request response message to the client device through the first socket.

[0057] In the embodiments of this specification, the request response message may include the server public key of the server device. The server public key can be used by the client device to encrypt the sent handshake message using the server public key during the three-way handshake between the client device and the server device, so as to improve the security of the handshake message during the three-way handshake.

[0058] In one example, the request response message may include a certificate of the server device, where the certificate includes a server public key. Specifically, the certificate may bind the value of the server public key to the identity of the server device.

[0059] At the server device, the server public key or certificate can be stored in the first storage medium of the TEE, thereby ensuring the security of the server public key and certificate.

[0060] At the server device, the data packaging operation for the request response message is performed in the TEE, and the packaging protocol of the data packaging is stored in the first storage medium. For the data packaging operation for the request response message, specifically, the first processor in the TEE can obtain the server public key and the packaging protocol from the first storage medium, and then the first processor can perform a data packaging operation on the server public key according to the packaging protocol to obtain a request response message including the server public key. The data packaging operation process is performed in the TEE, thereby ensuring the security of the data packaging operation and the security of the data in the data packaging.

[0061] After generating the request response message, the first processor may send the request response message to the first socket in the REE, and the first socket then sends the communication request to the client device according to the destination IP address (ie, the IP address of the client device).

[0062] The client device receives the request response message through the second socket, that is, when the request response message arrives at the client device, it first arrives at the second socket in the REE, and the second socket receives the request response message. Then, the second socket sends the received request response message to the second processor in the TEE. In the TEE of the client device, the second processor can obtain the server public key from the request response message, and then the second processor can store the server public key in the second storage medium.

[0063] Next, when the client device and the server device each have the other's public key, a three-way handshake can be performed between the client device and the server device to generate a symmetric key at 330. The symmetric key is a key generated by consensus between the server device and the client device through the three-way handshake, so after the three-way handshake, the server device and the client device can generate the same symmetric key.

[0064] During the three-way handshake process, communication is performed between the client device and the first processor in the server device through a first socket, and communication is performed between the server device and the second processor in the client device through a second socket.

[0065] Figure 4 A schematic diagram showing an example of a three-way handshake based on TEE according to an embodiment of this specification.

[0066] like Figure 4 As shown, at 331, the client device and the server device perform the first handshake.

[0067] Specifically, at the client device, the second processor may send a first handshake message to the server device through the second socket. The first handshake message may include a first random number generated by the second processor, and the first random number is generated in the TEE, thereby ensuring the security of the first random number.

[0068] In one example, the first handshake message may also include identification information of the client device, which may uniquely represent the client device. The identification information of the client device facilitates the server device to confirm the identity of the client device. In another example, the first handshake message may also include information on a specified key generation method, which may be used to generate a symmetric key, and the specified key generation method may be a method supported by the client device. In this example, the client device sends the specified key generation method information to the server device through the first handshake message, so as to unify the method used to generate the symmetric key with the server device.

[0069] At the client device, the data packaging operation for the first handshake message is performed in the TEE, and the information carried in the first handshake message can be stored in the second storage medium. In one example, the second processor in the TEE can generate a first random number and encrypt the first random number using the server public key stored in the second storage medium. Then, the encrypted first random number is subjected to a data packaging operation according to the packaging protocol to obtain a first handshake message including the first random number. The data packaging operation process is performed in the TEE, thereby ensuring the security of the data packaging operation and the security of the data in the first handshake message.

[0070] After generating the first handshake message, the second processor may send the first handshake message to the second socket in the REE, and the second socket then sends the first handshake message to the server device according to the destination IP address.

[0071] At the server device, the first socket receives the first handshake message, and then the first socket sends the received first handshake message to the first processor in the TEE. In the TEE of the server device, the first processor can obtain the encrypted first random number from the first handshake message, and then decrypt it using the private key corresponding to the server public key to obtain the first random number, and then store the first random number in the first storage medium.

[0072] Then, at 332, the server device performs a second handshake with the client device.

[0073] Specifically, at the server device, the first processor may send a second handshake message to the client device through the first socket. The second handshake message may include a second random number generated by the first processor, and the second random number is generated in the TEE, thereby ensuring the security of the second random number.

[0074] In one example, the second handshake message may also include identification information of the server device, and the identification information may uniquely represent the server device. The identification information of the server device facilitates the client device to confirm the identity of the server device.

[0075] At the server device, the data packaging operation for the second handshake message is performed in the TEE, and the information carried in the second handshake message can be stored in the first storage medium. In one example, the first processor in the TEE can generate a second random number and encrypt the second random number using the client public key stored in the first storage medium. Then, the encrypted second random number is subjected to a data packaging operation according to the packaging protocol to obtain a second handshake message including the second random number. The data packaging operation process is performed in the TEE, thereby ensuring the security of the data packaging operation and the security of the data in the second handshake message.

[0076] After generating the second handshake message, the first processor may send the second handshake message to the first socket in the REE, and the first socket then sends the second handshake message to the server device according to the destination IP address.

[0077] At the client device, the second socket receives the second handshake message, and then the second socket sends the received second handshake message to the second processor in the TEE. In the TEE of the client device, the second processor can obtain the encrypted second random number from the second handshake message, and then decrypt it using the private key corresponding to the client public key to obtain the second random number, and then store the second random number in the second storage medium.

[0078] Next, at 333 , the client device and the server device perform a third handshake.

[0079] Specifically, at the client device, the second processor may send the first handshake message to the server device through the second socket. The third handshake message may include a third random number generated by the second processor, and the third random number is generated in the TEE, thereby ensuring the security of the third random number.

[0080] At the client device, the data packaging operation for the third handshake message is performed in the TEE, and the information carried in the third handshake message can be stored in the second storage medium. In one example, the second processor in the TEE can generate a third random number and encrypt the third random number using the server public key stored in the second storage medium. Then, the encrypted third random number is subjected to a data packaging operation according to the packaging protocol to obtain a third handshake message including the third random number. The data packaging operation process is performed in the TEE, thereby ensuring the security of the data packaging operation and the security of the data in the third handshake message.

[0081] After generating the third handshake message, the second processor may send the third handshake message to the second socket in the REE, and the second socket then sends the third handshake message to the server device according to the destination IP address.

[0082] At the server device, the first socket receives the third handshake message, and then the first socket sends the received third handshake message to the first processor in the TEE. In the TEE of the server device, the first processor can obtain the encrypted third random number from the third handshake message, and then decrypt it using the private key corresponding to the server public key to obtain the third random number, and then store the third random number in the first storage medium.

[0083] After completing the three-way handshake, the client device and the server device both have the same three random numbers: the first random number, the second random number, and the third random number. At this point, at the server device, the first processor can generate a symmetric key based on the first random number, the second random number, and the third random number in a specified key generation method. At the client device, the second processor can also generate a symmetric key based on the first random number, the second random number, and the third random number in a specified key generation method. Thus, the symmetric key generated by the first processor is the same as the symmetric key generated by the second processor.

[0084] In one example, the client device and the server device may unify the key generation method by including the specified key generation method information in the first handshake message. In another example, the specified key generation method may be pre-agreed by the server device and the client device.

[0085] In one example, after completing the three-way handshake, at 334 , the server device and the client device may also perform consistency verification on the symmetric keys generated by each, to determine that the symmetric keys generated by both the server device and the client device are the same.

[0086] In this example, the verification of the symmetric key can be initiated by the server device. Specifically, at the server device, the first processor can obtain a specified characteristic value from the first storage medium. The specified characteristic value is a value that is agreed upon by the server device and the client device and is used to verify the symmetric key. Through consensus, both the server device and the client device know the value of the specified characteristic value. In one example, the specified characteristic value is stored in both the first storage medium and the second storage medium. In addition, both the server device and the client device know the role of the specified characteristic value, which is the specified characteristic value that will be used during symmetric key verification.

[0087] Then, the first processor encrypts the specified characteristic value using the generated symmetric key, and then sends the encrypted specified characteristic value to the client device through the first socket.

[0088] At the client device, the second socket can receive the encrypted designated feature value, and then send the received designated feature value to the second processor. The second processor can use the locally generated symmetric key to decrypt the encrypted designated feature value to obtain the designated feature value sent by the server device; then, the designated feature value is compared with the designated feature value stored in the second storage medium. When the comparison is the same, it can be determined that the symmetric keys generated by the client device and the first processor are consistent.

[0089] Back to Figure 3 After the server device and the client device obtain a consensus symmetric key, the client device can communicate with the server device using the symmetric key at 340. Specifically, the client device communicates with the first processor via a first socket, and the server device communicates with the second processor via a second socket.

[0090] Taking communication data as an example, at the client device, the second processor can use a symmetric key to encrypt the communication data, and then send the encrypted communication data to the second socket, and the second socket sends the encrypted communication data to the server device according to the destination IP address.

[0091] At the server device, the first socket receives the encrypted communication data and then sends the received communication data to the first processor. The first processor decrypts the communication data using the symmetric key to obtain the communication data and stores the communication data in the first storage medium.

[0092] In one example, during the communication process between the server device and the client device, the sender can also sign the communication data, and the receiver can verify the signature of the received communication data to ensure the integrity of the communication data. In this example, the sender can encrypt and sign the communication data, and the receiver can verify the signature after receiving the communication data, and then decrypt it after the signature verification is passed to obtain the communication data.

[0093] For example, at the server device, the first processor uses a symmetric key to encrypt the communication data to be sent, and then uses the private key of the server device to sign the encrypted communication data. The first processor then sends the encrypted and signed communication data to the first socket, and the first socket sends the encrypted and signed communication data to the client device.

[0094] At the client device, after receiving the encrypted and signed communication data, the second socket sends the communication data to the second processor. The second processor uses the server public key to verify the signature of the received communication data. If the signature verification passes, it continues to decrypt using the symmetric key to obtain the communication data.

[0095] Figure 5 A schematic diagram showing another example of a TEE-based network communication method according to an embodiment of this specification.

[0096] like Figure 5 As shown, the operation of 510 is the same as the operation of 310. Please refer to the operation of 310 for details, which will not be described here again.

[0097] When the first processor determines that a symmetric key is stored in the first storage medium based on the client public key, it can be determined that the server device has communicated with the client device, and the server device and the client device may store the same symmetric key. At this time, at 520, the consistency of the symmetric key in the first storage medium and the symmetric key in the client device can be verified. The verification of the symmetric key can be initiated by the server device.

[0098] In one example, at the server device, the first processor can obtain the specified characteristic value from the first storage medium, the first processor encrypts the specified characteristic value using the symmetric key; and the first processor sends the encrypted specified characteristic value to the client device through the first socket. For details, please refer to the operation description of 334 above.

[0099] At the client device, the second processor receives the specified characteristic value encrypted by the symmetric key of the server device from the server device through the second socket, and then the second processor can obtain the symmetric key for the server device from the second storage medium.

[0100] In one acquisition method, the second storage medium stores the correspondence between the symmetric key and the IP address, and for each correspondence, the symmetric key in the correspondence is used for communication between the client device and the device corresponding to the IP address in the correspondence. In this acquisition method, the specified characteristic value sent by the server device may carry the IP address of the server device, and the second processor may obtain the corresponding symmetric key from the second storage medium according to the IP address of the server device.

[0101] In another acquisition method, the server device may also send the identification information of the server device to the client device. In one example, the first processor in the server device may package the specified feature value and the identification information into a data packet and send it to the client device. In another example, the first processor in the server device may send the specified feature value and the identification information separately.

[0102] In this acquisition method, the second storage medium stores the correspondence between the symmetric key and the identification information of the device. After receiving the identification information, the second processor can obtain the symmetric key corresponding to the identification information from the second storage medium. The obtained symmetric key is the symmetric key for the server device.

[0103] After the second processor obtains the symmetric key for the server device, it can use the obtained symmetric key to decrypt the received specified feature value. After the decryption is successful, the consistency of the decrypted specified feature value and the specified feature value in the second storage medium is verified. After the consistency check passes, it means that the symmetric key in the first storage medium is consistent with the symmetric key in the client device, and the operation of 530 can be performed.

[0104] In one example, after the symmetric key is generated, a validity period may be set, which may include time, number of communication interactions, and the like.

[0105] When it is determined based on the client public key that a symmetric key is stored in the first storage medium, the validity period of the symmetric key can be verified at the first processor to determine whether the symmetric key is within the validity period. If the symmetric key is not within the validity period, it can be determined that the symmetric key is invalid, and the client device and the server device need to perform a three-way handshake to regenerate a new symmetric key. In one example, after determining that the symmetric key is within the validity period, the consistency check of the symmetric key can be performed.

[0106] At 530, the client device and the first processor communicate with each other through the first socket using a symmetric key. For details, please refer to the operation of 340 above.

[0107] Figure 6A schematic diagram of another example 600 of a TEE-based network communication method according to an embodiment of this specification is shown.

[0108] Figure 6 The network communication method shown can be executed by a server device, which includes a first socket in REE, a first processor in TEE, and a first storage medium. The first socket is used to connect the first processor to the client device to enable communication between the first processor and the client device.

[0109] like Figure 6 As shown, at 610, the first processor receives a communication request from a client device through a first socket, where the communication request includes a client public key of the client device.

[0110] At 620, obtaining, at the first processor, a client public key from the communication request;

[0111] At 630 , the first processor queries whether the first storage medium stores a symmetric key for communication between the server device and the client device based on the client public key. If not, perform operation 640 ; if yes, perform operation 670 .

[0112] At 640 , the first processor sends a request response message to the client device through the first socket, where the request response message includes a public key of the server device.

[0113] At 650 , the client device and the first processor perform a three-way handshake via the first socket to obtain a symmetric key agreed upon by the server device and the client device.

[0114] At 660 , the client device communicates with the first processor via the first socket using a symmetric key.

[0115] In one example, the consistency of the symmetric key in the first storage medium and the symmetric key in the client device is verified at 670. When the symmetric key in the first storage medium and the symmetric key in the client device are consistent, the operation of 660 is performed.

[0116] In one example, when the first processor determines that a symmetric key is stored in the first storage medium based on the client public key, verifying the consistency of the symmetric key in the first storage medium and the symmetric key in the client device may include: when the first processor determines that a symmetric key is stored in the first storage medium based on the client public key, the first processor obtains a specified characteristic value from the first storage medium, where the specified characteristic value is a value agreed upon by the server device and the client device; at the first processor, encrypting the specified characteristic value using the symmetric key; and the first processor sends the encrypted specified characteristic value to the client device through the first socket, so that the client device verifies the specified characteristic value using the local symmetric key to determine the consistency of the symmetric keys generated by the client device and the first processor respectively.

[0117] In one example, the symmetric key is set with a validity period, and the network communication method may further include: when it is determined based on the client public key that the symmetric key is stored in the first storage medium, determining at the first processor that the symmetric key is within the validity period.

[0118] In one example, a three-way handshake between a client device and a first processor through a first socket to obtain a symmetric key agreed upon by a server device and a client device may include: the first processor receives a first handshake message from the client device through the first socket, the first handshake message including a first random number generated by the client device; the first processor sends a second handshake message to the client device through the first socket, the second handshake message including a second random number generated by the first processor; the first processor receives a third handshake message from the client device through the first socket, the third handshake message including a third random number generated by the client device; and, at the first processor, generating a symmetric key based on the first random number, the second random number and the third random number in accordance with a specified key generation method.

[0119] In an example, the first handshake message may further include information specifying a key generation method, or the specified key generation method is pre-agreed upon by the server device and the client device.

[0120] In one example, the network communication method may also include: the first processor obtains a specified characteristic value from a first storage medium, the specified characteristic value is a value agreed upon by the server device and the client device; at the first processor, the specified characteristic value is encrypted using a symmetric key; and the first processor sends the encrypted specified characteristic value to the client device through the first socket, so that the client device verifies the specified characteristic value using the locally generated symmetric key to determine that the symmetric keys generated by the client device and the first processor are consistent.

[0121] Figure 7A schematic diagram of another example 700 of a TEE-based network communication method according to an embodiment of this specification is shown.

[0122] Figure 7 The network communication method shown can be executed by a client device, which includes a second socket based on REE, a second processor based on TEE, and a second storage medium. The second socket is used to connect the second processor to the server device to enable communication between the second processor and the server device.

[0123] like Figure 7 As shown, at 710, the second processor sends a communication request to the server device through the second socket, and the communication request includes the client public key of the client device.

[0124] At 720 , the second processor receives a request response message from the server device through the second socket, where the request response message includes a public key of the server device.

[0125] At 730 , the server device and the second processor perform a three-way handshake via the second socket to obtain a symmetric key agreed upon by the server device and the client device.

[0126] At 740, the server device communicates with the second processor via the second socket using a symmetric key.

[0127] In one example, a three-way handshake between a server device and a second processor through a second socket to obtain a symmetric key agreed upon by the server device and the client device may include: the second processor sending a first handshake message to the server device through the second socket, the first handshake message including a first random number generated by the second processor; the second processor receiving a second handshake message from the server device through the second socket, the second handshake message including a second random number generated by the server device; the second processor sending a third handshake message to the server device through the second socket, the third handshake message including a third random number generated by the second processor; and, at the second processor, generating a symmetric key based on the first random number, the second random number and the third random number in accordance with a specified key generation method.

[0128] In an example, the first handshake message may further include information specifying a key generation method, or the specified key generation method is pre-agreed upon by the server device and the client device.

[0129] In one example, after a three-way handshake is performed between the server device and the second processor through the second socket to obtain a symmetric key agreed upon by the server device and the client device, it may also include: the second processor receives a specified characteristic value encrypted by the symmetric key generated by the server device from the server device through the second socket, the specified characteristic value being a value agreed upon by the server device and the client device; at the second processor, the received specified characteristic value is decrypted using the locally generated symmetric key; and when the decrypted specified characteristic value is consistent with the specified characteristic value in the second storage medium, determining that the symmetric keys generated by the server device and the second processor are consistent.

[0130] In one example, after the second processor sends a communication request to the server device through the second socket, it can also include: the second processor receives a specified feature value that has been encrypted by the symmetric key of the server device from the server device through the second socket; the second processor obtains the symmetric key for the server device from the second storage medium; at the second processor, the received specified feature value is decrypted using the obtained symmetric key; when the decryption is successful and the specified feature value obtained by the decryption is consistent with the specified feature value in the second storage medium, the server device and the second processor communicate through the second socket using the symmetric key.

[0131] Figure 8 A block diagram of an example of a TEE-based network communication system 800 according to an embodiment of this specification is shown.

[0132] like Figure 8 As shown, the network communication system 800 includes a server device 810 and a client device 820. The server device 810 can execute any operation executed by the server device in the above-mentioned network communication method, and the client device 820 can execute any operation executed by the client device in the above-mentioned network communication method.

[0133] Fig. 9 A block diagram of an example of a TEE-based network communication device 900 according to an embodiment of this specification is shown.

[0134] Fig. 9 The network communication device 900 shown can be applied to a server device. The network communication device includes a first socket based on REE, a first processor based on TEE, and a first storage medium. The first socket is used to connect the first processor with the client device to enable communication between the first processor and the client device.

[0135] like Fig. 9As shown, the network communication device 900 includes: a request receiving unit 910, a public key obtaining unit 920, a message sending unit 930, a handshake interaction unit 940 and a communication unit 950.

[0136] The request receiving unit 910 is configured as a first processor to receive a communication request from a client device through a first socket, where the communication request includes a client public key of the client device.

[0137] The public key acquisition unit 920 is configured to acquire the client public key from the communication request at the first processor.

[0138] The message sending unit 930 is configured to send a request response message to the client device through the first socket when the first processor determines at the first processor based on the client public key that the symmetric key used for communication between the server device and the client device is not stored in the first storage medium, and the request response message includes the public key of the server device.

[0139] The handshake interaction unit 940 is configured to perform a three-way handshake between the client device and the first processor through the first socket to obtain a symmetric key agreed upon by the server device and the client device.

[0140] The communication unit 950 is configured to communicate between the client device and the first processor through the first socket using a symmetric key.

[0141] In one example, the handshake interaction unit 940 can also be configured as: the first processor receives a first handshake message from the client device through the first socket, the first handshake message including a first random number generated by the client device; the first processor sends a second handshake message to the client device through the first socket, the second handshake message including a second random number generated by the first processor; the first processor receives a third handshake message from the client device through the first socket, the third handshake message including a third random number generated by the client device; and at the first processor, a symmetric key is generated based on the first random number, the second random number and the third random number according to a specified key generation method.

[0142] In one example, the network communication device 900 may also include: a feature value acquisition unit, an encryption unit, and a feature value sending unit. The feature value acquisition unit is configured so that the first processor acquires a specified feature value from the first storage medium, and the specified feature value is a value that is agreed upon by the server device and the client device; the encryption unit is configured so that the first processor uses a symmetric key to encrypt the specified feature value. The feature value sending unit is configured so that the first processor sends the encrypted specified feature value to the client device through the first socket, so that the client device verifies the specified feature value using the locally generated symmetric key to determine the consistency of the symmetric keys generated by the client device and the first processor.

[0143] In one example, the network communication device 900 may also include a consistency verification unit, which is configured to verify the consistency of the symmetric key in the first storage medium with the symmetric key in the client device when the first processor determines that a symmetric key is stored in the first storage medium based on the client public key. When the symmetric key in the first storage medium is consistent with the symmetric key in the client device, the communication unit 950 is triggered to execute an operation of communicating between the client device and the first processor through the first socket using the symmetric key.

[0144] In one example, the consistency verification unit can also be configured as follows: when the first processor determines at the first processor that a symmetric key is stored in the first storage medium based on the client public key, the first processor obtains a specified characteristic value from the first storage medium, where the specified characteristic value is a value agreed upon by the server device and the client device; at the first processor, the specified characteristic value is encrypted using the symmetric key; and the first processor sends the encrypted specified characteristic value to the client device through the first socket, so that the client device verifies the specified characteristic value using the local symmetric key to determine the consistency of the symmetric keys generated by the client device and the first processor respectively.

[0145] Fig.10 A block diagram of an example of a TEE-based network communication device 1000 according to an embodiment of this specification is shown.

[0146] Fig.10 The network communication device 1000 shown is applied to a client device, and includes a second socket based on REE, a second processor based on TEE, and a second storage medium. The second socket is used to connect the second processor to the server device to enable communication between the second processor and the server device.

[0147] like Fig.10As shown, the network communication device 1000 includes: a request sending unit 1010 , a message receiving unit 1020 , a handshake interaction unit 1030 and a communication unit 1040 .

[0148] The request sending unit 1010 is configured as a second processor to send a communication request to the server device through the second socket, and the communication request includes a client public key of the client device.

[0149] The message receiving unit 1020 is configured as a second processor to receive a request response message from the server device through the second socket, where the request response message includes a server public key of the server device.

[0150] The handshake interaction unit 1030 is configured to perform a three-way handshake between the server device and the second processor through the second socket to obtain a symmetric key agreed upon by the server device and the client device.

[0151] The communication unit 1040 is configured to communicate between the server device and the second processor through the second socket using a symmetric key.

[0152] In one example, the handshake interaction unit 1030 can also be configured as: the second processor sends a first handshake message to the server device through the second socket, and the first handshake message includes a first random number generated by the second processor; the second processor receives a second handshake message from the server device through the second socket, and the second handshake message includes a second random number generated by the server device; the second processor sends a third handshake message to the server device through the second socket, and the third handshake message includes a third random number generated by the second processor; and at the second processor, a symmetric key is generated based on the first random number, the second random number and the third random number according to a specified key generation method.

[0153] In one example, the network communication device 1000 may also include: a feature value receiving unit, a decryption unit, and a consistency determination unit. The feature value receiving unit is configured to receive a specified feature value encrypted by a symmetric key generated by the server device from the server device through the second socket by the second processor, and the specified feature value is a value agreed upon by the server device and the client device. The decryption unit is configured to decrypt the received specified feature value at the second processor using a locally generated symmetric key. The consistency determination unit is configured to determine the consistency of the symmetric keys generated by the server device and the second processor when the specified feature value obtained by decryption is consistent with the specified feature value in the second storage medium.

[0154] Reference above Figures 1 to 10 , an embodiment of a TEE-based network communication method and device according to an embodiment of this specification is described.

[0155] The TEE-based network communication device of the embodiment of this specification can be implemented by hardware, software, or a combination of hardware and software. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor of the device in which it is located reading the corresponding computer program instructions in the memory into the memory and running it. In the embodiment of this specification, the TEE-based network communication device can be implemented, for example, using an electronic device.

[0156] Fig.11 A block diagram of an electronic device 1100 for implementing a TEE-based network communication method according to an embodiment of this specification is shown.

[0157] like Fig.11 As shown, the electronic device 1100 may include at least one processor 1110, a memory (e.g., a non-volatile memory) 1120, a memory 1130, and a communication interface 1140, and the at least one processor 1110, the memory 1120, the memory 1130, and the communication interface 1140 are connected together via a bus 1150. At least one processor 1110 executes at least one computer-readable instruction stored or encoded in the memory (i.e., the above-mentioned element implemented in the form of software).

[0158] In one embodiment, computer executable instructions are stored in a memory, which when executed cause at least one processor 1110 to: receive a communication request from a client device through a first socket by a first processor, the communication request including a client public key of the client device; obtain the client public key from the communication request at the first processor; when the first processor determines at the first processor based on the client public key that a symmetric key for communication between a server device and a client device is not stored in a first storage medium, the first processor sends a request response message to the client device through the first socket, the request response message including the server public key of the server device; perform a three-way handshake between the client device and the first processor through the first socket to obtain a symmetric key agreed upon by the server device and the client device; and communicate between the client device and the first processor through the first socket using the symmetric key.

[0159] It should be understood that the computer executable instructions stored in the memory, when executed, cause at least one processor 1110 to perform the above combined operations in various embodiments of the present specification. Figure 1-10 Describes the various operations and functions.

[0160] According to one embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in the form of software), which, when executed by a machine, causes the machine to perform the above-mentioned combination of various embodiments of this specification. Figure 1-10 Describes the various operations and functions.

[0161] Fig.12 A block diagram of an electronic device 1200 for implementing a TEE-based network communication method according to an embodiment of this specification is shown.

[0162] like Fig.12 As shown, the electronic device 1200 may include at least one processor 1210, a memory (e.g., a non-volatile memory) 1220, a memory 1230, and a communication interface 1240, and the at least one processor 1210, the memory 1220, the memory 1230, and the communication interface 1240 are connected together via a bus 1250. At least one processor 1210 executes at least one computer-readable instruction stored or encoded in the memory (i.e., the above-mentioned element implemented in the form of software).

[0163] In one embodiment, computer executable instructions are stored in a memory, which when executed cause at least one processor 1210 to: the second processor sends a communication request to the server device through the second socket, the communication request including the client public key of the client device; the second processor receives a request response message from the server device through the second socket, the request response message including the server public key of the server device; the server device and the second processor perform a three-way handshake through the second socket to obtain a symmetric key agreed upon by the server device and the client device; and the server device and the second processor communicate through the second socket using the symmetric key.

[0164] It should be understood that the computer executable instructions stored in the memory, when executed, cause at least one processor 1210 to perform the above combined operations in various embodiments of the present specification. Figure 1-10 Describes the various operations and functions.

[0165] According to one embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in the form of software), which, when executed by a machine, causes the machine to perform the above-mentioned combination of various embodiments of this specification. Figure 1-10 Describes the various operations and functions.

[0166] Specifically, a system or device equipped with a readable storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer or processor of the system or device can read and execute instructions stored in the readable storage medium.

[0167] In this case, the program code itself read from the machine-readable medium can realize the function of any one of the above-mentioned embodiments, and thus the machine-readable code and the machine-readable storage medium storing the machine-readable code constitute a part of the present invention.

[0168] The computer program code required for the operation of each part of this specification can be written in any one or more programming languages, including object-oriented programming languages, such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB, NET and Python, conventional procedural programming languages ​​such as C language, Visual Basic 2003, Perl, COBOL 2002, PHP and ABAP, dynamic programming languages ​​such as Python, Ruby and Groovy, or other programming languages. The program code can be run on the user's computer, or run on the user's computer as an independent software package, or run partly on the user's computer and another part on the remote computer, or all on the remote computer or server. In the latter case, the remote computer can be connected to the user's computer through any network form, such as a local area network (LAN) or a wide area network (WAN), or connected to an external computer (e.g., via the Internet), or in a cloud computing environment, or used as a service, such as software as a service (SaaS).

[0169] Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer or a cloud via a communication network.

[0170] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0171] Not all steps and units in the above-mentioned processes and system structure diagrams are necessary, and some steps or units can be ignored according to actual needs. The execution order of each step is not fixed and can be determined according to needs. The device structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some units may be implemented by the same physical entity, or some units may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.

[0172] The term "exemplary" as used throughout this specification means "serving as an example, instance, or illustration" and does not imply "preferred" or "advantageous" over other embodiments. The detailed description includes specific details for the purpose of providing an understanding of the described techniques. However, the techniques may be implemented without these specific details. In some instances, in order to avoid obscuring the concepts of the described embodiments, well-known structures and devices are shown in block diagram form.

[0173] The optional implementation modes of the embodiments of the present specification are described in detail above in conjunction with the accompanying drawings. However, the embodiments of the present specification are not limited to the specific details in the above implementation modes. Within the technical concept of the embodiments of the present specification, various simple modifications can be made to the technical solutions of the embodiments of the present specification, and these simple modifications all belong to the protection scope of the embodiments of the present specification.

[0174] The above description of the contents of this specification is provided to enable any person of ordinary skill in the art to implement or use the contents of this specification. Various modifications to the contents of this specification will be apparent to those of ordinary skill in the art, and the general principles defined herein may be applied to other variations without departing from the scope of protection of the contents of this specification. Therefore, the contents of this specification are not limited to the examples and designs described herein, but are consistent with the widest range of principles and novel features disclosed herein.

Claims

1. A network communication method based on TEE, the network communication method is executed by a server device, the server device includes a first socket, a first processor and a first storage medium, the first socket is located in REE, and the first processor and the first storage medium are located in TEE, the first socket is used to connect the first processor with a client device, so that the first processor and the client device are communicated; The network communication method comprises: The first processor receives a communication request from the client device through the first socket, the communication request including a client public key of the client device; obtaining, at the first processor, the client public key from the communication request; When the first processor determines at the first storage medium based on the client public key that the symmetric key used for communication between the server device and the client device is not stored, the first processor sends a request response message to the client device through the first socket, the request response message including the server public key of the server device; The client device and the first processor perform a three-way handshake via the first socket to obtain a symmetric key agreed upon by the server device and the client device; and The client device communicates with the first processor via the first socket using the symmetric key, The client device includes a second socket, a second processor and a second storage medium, the second socket is located in the REE, and the second processor and the second storage medium are located in the TEE, the second socket is used to connect the second processor to the server device so that the second processor and the server device are communicated and connected, The client device and the first processor perform a three-way handshake through the first socket to obtain a symmetric key agreed upon by the server device and the client device, including: The first processor receives a first handshake message sent by the second processor through the second socket from the client device through the first socket, wherein the first handshake message includes a first random number generated by the client device; The first processor sends a second handshake message to the client device through the first socket for the second processor to receive through the second socket, the second handshake message including a second random number generated by the first processor; The first processor receives, from the client device through the first socket, a third handshake message sent by the second processor through the second socket, wherein the third handshake message includes a third random number generated by the client device; and At the first processor, the symmetric key is generated based on the first random number, the second random number, and the third random number in a specified key generation manner.

2. The network communication method according to claim 1, wherein: The first handshake message also includes information about the designated key generation method, or the designated key generation method is pre-agreed upon by the server device and the client device.

3. The network communication method according to claim 1, further comprising: The first processor obtains a specified characteristic value from the first storage medium, where the specified characteristic value is a value agreed upon by the server device and the client device; At the first processor, encrypting the specified characteristic value using the symmetric key; as well as The first processor sends the encrypted designated feature value to the client device through the first socket, so that the client device verifies the designated feature value using the locally generated symmetric key to determine whether the symmetric keys generated by the client device and the first processor are consistent.

4. The network communication method according to claim 1, further comprising: When the first processor determines that the symmetric key is stored in the first storage medium based on the client public key, verifying the consistency between the symmetric key in the first storage medium and the symmetric key in the client device; as well as When the symmetric key in the first storage medium is consistent with the symmetric key in the client device, the client device communicates with the first processor through the first socket using the symmetric key.

5. The network communication method according to claim 1, wherein: When it is determined at the first processor based on the client public key that the symmetric key is stored in the first storage medium, verifying the consistency between the symmetric key in the first storage medium and the symmetric key in the client device includes: When the first processor determines that the symmetric key is stored in the first storage medium based on the client public key, the first processor obtains a specified characteristic value from the first storage medium, where the specified characteristic value is a value agreed upon by the server device and the client device; At the first processor, encrypting the specified characteristic value using the symmetric key; and The first processor sends the encrypted designated feature value to the client device through the first socket, so that the client device verifies the designated feature value using the local symmetric key to determine the consistency of the symmetric keys generated by the client device and the first processor respectively.

6. The network communication method according to claim 4, wherein: The symmetric key sets a validity period, The network communication method further includes: When it is determined based on the client public key that the symmetric key is stored in the first storage medium, it is determined at the first processor that the symmetric key is within the validity period.

7. A network communication method based on TEE, the network communication method is performed by a client device, the client device includes a second socket, a second processor and a second storage medium, the second socket is located in the REE, and the second processor and the second storage medium are located in the TEE, the second socket is used to connect the second processor with a server device, so that the second processor and the server device are communicated; The network communication method comprises: The second processor sends a communication request to the server device through the second socket, wherein the communication request includes a client public key of the client device; The second processor receives a request response message from the server device through the second socket, wherein the request response message includes a server public key of the server device; The server device and the second processor perform a three-way handshake via the second socket to obtain a symmetric key agreed upon by the server device and the client device; and The server device and the second processor communicate with each other through the second socket using the symmetric key. The server device includes a first socket, a first processor and a first storage medium, the first socket is located in the REE, and the first processor and the first storage medium are located in the TEE, the first socket is used to connect the first processor with the client device so that the first processor and the client device are communicated with each other, The server device and the second processor perform a three-way handshake through the second socket to obtain a symmetric key agreed upon by the server device and the client device, including: The second processor sends a first handshake message to the server device through the second socket, so that the first processor receives it through the first socket, wherein the first handshake message includes a first random number generated by the second processor; The second processor receives, from the server device through the second socket, a second handshake message sent by the first processor through the first socket, where the second handshake message includes a second random number generated by the server device; The second processor sends a third handshake message to the server device through the second socket, so that the first processor receives the third handshake message through the first socket, wherein the third handshake message includes a third random number generated by the second processor; and At the second processor, the symmetric key is generated based on the first random number, the second random number, and the third random number in a specified key generation manner.

8. The network communication method according to claim 7, wherein: The first handshake message also includes information about the designated key generation method, or the designated key generation method is pre-agreed upon by the server device and the client device.

9. The network communication method according to claim 7, after performing a three-way handshake between the server device and the second processor through the second socket to obtain a symmetric key agreed upon by the server device and the client device, further comprising: The second processor receives, from the server device through the second socket, a designated characteristic value encrypted by a symmetric key generated by the server device, wherein the designated characteristic value is a value agreed upon by the server device and the client device; At the second processor, decrypting the received specified characteristic value using a locally generated symmetric key; as well as When the designated characteristic value obtained by decryption is consistent with the designated characteristic value in the second storage medium, it is determined that the symmetric keys generated by the server device and the second processor are consistent.

10. The network communication method according to claim 7, after the second processor sends a communication request to the server device through the second socket, further comprising: The second processor receives, from the server device through the second socket, a specified characteristic value that has been encrypted by a symmetric key of the server device; The second processor obtains a symmetric key for the server device from the second storage medium; At the second processor, decrypting the received specified characteristic value using the obtained symmetric key; When the decryption is successful and the designated characteristic value obtained by decryption is consistent with the designated characteristic value in the second storage medium, the server device and the second processor communicate with each other through the second socket using the symmetric key.

11. A network communication system based on TEE, the network communication system comprising: A server device for executing the network communication method as described in any one of claims 1-6 and a client device for executing the network communication method as described in any one of claims 7-10.

12. A network communication device based on TEE, the network communication device is applied to a server device, the network communication device comprises a first socket, a first processor and a first storage medium, the first socket is located in REE, and the first processor and the first storage medium are located in TEE, the first socket is used to connect the first processor with a client device, so that the first processor and the client device are communicated with each other; The network communication device further includes a computer program stored on the first storage medium, and the first processor executes the computer program to implement: The first processor receives a communication request from the client device through the first socket, the communication request including a client public key of the client device; obtaining, at the first processor, the client public key from the communication request; When the first processor determines at the first storage medium based on the client public key that the symmetric key used for communication between the server device and the client device is not stored, the first processor sends a request response message to the client device through the first socket, the request response message including the server public key of the server device; The client device and the first processor perform a three-way handshake through the first socket to obtain a symmetric key agreed upon by the server device and the client device; as well as The client device communicates with the first processor via the first socket using the symmetric key, The client device includes a second socket, a second processor and a second storage medium, the second socket is located in the REE, and the second processor and the second storage medium are located in the TEE, the second socket is used to connect the second processor to the server device so that the second processor and the server device are communicated and connected, The client device and the first processor perform a three-way handshake through the first socket to obtain a symmetric key agreed upon by the server device and the client device, including: The first processor receives a first handshake message sent by the second processor through the second socket from the client device through the first socket, wherein the first handshake message includes a first random number generated by the client device; The first processor sends a second handshake message to the client device through the first socket for the second processor to receive through the second socket, the second handshake message including a second random number generated by the first processor; The first processor receives, from the client device through the first socket, a third handshake message sent by the second processor through the second socket, wherein the third handshake message includes a third random number generated by the client device; and At the first processor, the symmetric key is generated based on the first random number, the second random number, and the third random number in a specified key generation manner.

13. A network communication device based on TEE, the network communication device is applied to a client device, the network communication device comprises a second socket, a second processor and a second storage medium, the second socket is located in REE, and the second processor and the second storage medium are located in TEE, the second socket is used to connect the second processor with a server device, so that the second processor and the server device are communicated and connected; The network communication device further includes a computer program stored on the second storage medium, and the second processor executes the computer program to implement: The second processor sends a communication request to the server device through the second socket, wherein the communication request includes a client public key of the client device; The second processor receives a request response message from the server device through the second socket, wherein the request response message includes a server public key of the server device; The server device and the second processor perform a three-way handshake via the second socket to obtain a symmetric key agreed upon by the server device and the client device; as well as The server device and the second processor communicate with each other through the second socket using the symmetric key. The server device includes a first socket, a first processor and a first storage medium, the first socket is located in the REE, and the first processor and the first storage medium are located in the TEE, the first socket is used to connect the first processor with the client device so that the first processor and the client device are communicated with each other, The server device and the second processor perform a three-way handshake through the second socket to obtain a symmetric key agreed upon by the server device and the client device, including: The second processor sends a first handshake message to the server device through the second socket, so that the first processor receives it through the first socket, wherein the first handshake message includes a first random number generated by the second processor; The second processor receives, from the server device through the second socket, a second handshake message sent by the first processor through the first socket, where the second handshake message includes a second random number generated by the server device; The second processor sends a third handshake message to the server device through the second socket, so that the first processor receives the third handshake message through the first socket, wherein the third handshake message includes a third random number generated by the second processor; and At the second processor, the symmetric key is generated based on the first random number, the second random number, and the third random number in a specified key generation manner.

14. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 6, or implements the method according to any one of claims 7 to 10.

15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 6, or implements the method according to any one of claims 7 to 10.