Forward security end-to-end encryption method and device and storage medium
By separating the keys in the client front-end, WebSocket server, and hardware key terminal, the problem of side-channel key leakage in forward security is solved, ensuring that even if the server is attacked, the session data cannot be decrypted, thus achieving end-to-end encryption security.
Patent Information
- Application Number
- CN202511823113.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2045-12-05
AI Technical Summary
In existing technologies, forward-secure network transmission is subject to the risk of side-channel key leakage, and the server-side key is also subject to leakage, lacking true end-to-end encryption protection.
The system employs a key separation design involving the client front-end, WebSocket server, and hardware key terminal. The client's ECDH public key is transmitted via the WebSocket channel, the hardware key terminal generates the master key and performs encryption and decryption operations, and the WebSocket server only transmits encrypted ciphertext and plaintext, thus avoiding the exposure of the private key on the server side.
It ensures forward security by preventing session data decryption even if the service program is attacked, solves the problem of key leakage in the side channel, and provides true end-to-end encryption protection.
Smart Images

Figure CN121283771A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network security, and more particularly to a forward-secure end-to-end encryption method, device, and storage medium. Background Technology
[0002] Forward security ensures that even if an attacker later obtains the server's long-term private key, they cannot deduce the key used in past sessions and therefore cannot decrypt previously intercepted communication data. Forward security is the default baseline for modern encryption protocols. It is primarily implemented through a "one-time pad" key exchange mechanism, where both ends calculate the same shared key locally and immediately destroy the temporary private key. Because the temporary private key is lost after the session ends, even if an attacker later obtains the server's long-term private key, they cannot reconstruct the shared key for that session and thus cannot decrypt previously intercepted ciphertext.
[0003] However, existing technologies for generating, managing, and rotating temporary keys still rely on terminal or server main memory, leaving the server-side keys vulnerable to leakage and lacking true end-to-end encryption. Data is processed in plaintext on the server side, posing risks of side-channel leakage and key residue. Therefore, a new technology is needed to address the technical problem of side-channel key leakage risks in current network transmission forward security. Summary of the Invention
[0004] The main objective of this invention is to solve the technical problem of the risk of key leakage in the side channel of current network transmission forward security.
[0005] The first aspect of this invention provides a forward-secure end-to-end encryption method, which is applied to a forward-secure end-to-end encryption system. The forward-secure end-to-end encryption system includes: a client front-end, a WebSocket server, and a hardware key terminal. The forward-secure end-to-end encryption method includes the following steps: The client front-end establishes a WebSocket channel with the WebSocket server; The client front end generates a client ECDH key pair according to a preset ECDH algorithm, wherein the client ECDH key pair includes: a client ECDH private key and a client ECDH public key; Based on the WebSocket channel, the client's ECDH public key is sent to the WebSocket server; The WebSocket server receives the client's ECDH public key and sends the client's ECDH public key to the hardware key terminal; The hardware key terminal receives the client's ECDH public key and generates a hardware ECDH key pair according to a preset ECDH algorithm. The hardware ECDH key pair includes a hardware ECDH private key and a hardware ECDH public key. Based on a preset key derivation function, the hardware ECDH private key and the client ECDH public key are deduced and processed to generate a master key; Based on the master key, a hardware key handle is generated, and the hardware key handle and the hardware ECDH public key are sent to the WebSocket server. The WebSocket server receives the hardware key handle and the hardware ECDH public key, and sends the hardware ECDH public key to the client front end; The client front end receives the hardware ECDH public key, and performs derivation encryption processing on the session plaintext according to the preset key derivation function, the hardware ECDH public key, and the client ECDH private key to generate session data, and transmits the session data to the WebSocket server; The WebSocket server receives the session data and, based on the hardware key handle, transmits the session data to the hardware key terminal. The hardware key terminal receives the session data, decrypts the session data based on the master key, generates session plaintext, and sends the session plaintext to the WebSocket server.
[0006] Optionally, in a first implementation of the first aspect of the present invention, the step of deriving and processing the hardware ECDH private key and the client ECDH public key according to a preset key derivation function to generate a master key includes: The hardware ECDH private key and the client ECDH public key are multiplied together to generate a multiplication curve data. The dot product curve data is processed by coordinate extraction to obtain shared secret data; Obtain the handshake hash value between the client frontend and the WebSocket server; Based on the preset key derivation function and the handshake hash value, the shared secret data is processed to extract the key and generate the master key.
[0007] Optionally, in a second implementation of the first aspect of the present invention, the step of performing derivation encryption processing on the session plaintext based on a preset key derivation function, the hardware ECDH public key, and the client ECDH private key to generate session data includes: The hardware ECDH public key and the client ECDH private key are multiplied together to generate a multiplication curve data. The curve data is processed by coordinate extraction to obtain shared secret data; Obtain the handshake hash value between the client frontend and the WebSocket server; Based on the preset key derivation function and the handshake hash value, the shared secret data is subjected to key extraction processing to generate the client master key; Based on the client master key, the plaintext of the session is encrypted to generate session data.
[0008] Optionally, in a third implementation of the first aspect of the present invention, the step of sending the client's ECDH public key to the WebSocket server based on the WebSocket channel includes: Based on the WebSocket channel and TLS protocol, the client's ECDH public key is sent to the WebSocket server.
[0009] Optionally, in a fourth implementation of the first aspect of the present invention, the step of sending the client's ECDH public key to the WebSocket server based on the WebSocket channel and the TLS protocol includes: Based on the WebSocket channel and TLS protocol, the client's ECDH public key is transmitted to the WebSocket server using either the AES-256 encryption algorithm or the SM4 encryption algorithm.
[0010] Optionally, in a fifth implementation of the first aspect of the present invention, after the step of sending the hardware ECDH public key to the client front end, the method further includes: The WebSocket server determines whether to trigger the preset key update setting; When the key update setting is triggered, a key update request is sent to the hardware key terminal; The hardware key terminal receives the key update request, generates a new master key, a new hardware ECDH public key, and a new hardware key handle, and sends the new hardware ECDH public key and the new hardware key handle to the WebSocket server. The WebSocket server receives the new hardware ECDH public key and the new hardware key handle, and sends the new hardware ECDH public key to the client front end; The client front end receives the new hardware ECDH public key.
[0011] Optionally, in a sixth implementation of the first aspect of the present invention, the key update setting includes: The total transmission traffic between the WebSocket server and the client front-end exceeds a preset total threshold. Alternatively, the pre-set periodic transmission traffic between the WebSocket server and the client front-end exceeds a pre-set periodic monitoring threshold; Alternatively, the duration of the publication of the hardware ECDH public key between the WebSocket server and the client front-end exceeds a preset update threshold.
[0012] Optionally, in the seventh implementation of the first aspect of the present invention, the establishment of a WebSocket channel between the client front-end and the WebSocket server includes the following steps: The client front-end sends a connection negotiation request to the WebSocket server; The WebSocket server receives the connection negotiation request, generates a server certificate based on the connection negotiation request, and sends the server certificate to the client front end; The client front end receives the server certificate and establishes a WebSocket channel with the WebSocket server based on the server certificate.
[0013] A second aspect of the present invention provides a forward-secure end-to-end encryption device, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; the at least one processor invokes the instructions in the memory to cause the forward-secure end-to-end encryption device to perform the aforementioned forward-secure end-to-end encryption method.
[0014] A third aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the aforementioned forward-secure end-to-end encryption method.
[0015] In this embodiment of the invention, by setting up a WebSocket server and a hardware key terminal on the server respectively, the server's private key is never exposed in the WebSocket server. Only the hardware key terminal performs encryption and decryption operations. The WebSocket server can only obtain the encrypted ciphertext and the parsed plaintext. The WebSocket server cannot see the private key data. Even if the service program is injected with an attack, it cannot decrypt the encrypted session data between the server and the client front end. The key separation design ensures forward security, overcomes the problem of private key interception in the side channel, and solves the technical problem of the risk of key leakage in the side channel of current network transmission forward security. Attached Figure Description
[0016] Figure 1This is a schematic diagram of an embodiment of the forward-secure end-to-end encryption method in this invention; Figure 2 This is a schematic diagram of a specific embodiment of step 101 of the forward-secure end-to-end encryption method in this invention. Figure 3 This is a schematic diagram of a specific embodiment of the 106 steps of the forward-secure end-to-end encryption method in this invention. Figure 4 This is a schematic diagram of a specific embodiment of the 109 steps of the forward-secure end-to-end encryption method in this invention. Figure 5 This is a schematic diagram of one embodiment of a forward-secure end-to-end encryption device according to an embodiment of the present invention. Detailed Implementation
[0017] This invention provides a forward-secure end-to-end encryption method, device, and storage medium.
[0018] The embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the accompanying drawings and embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.
[0019] In the description of the embodiments disclosed in this invention, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0020] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 This invention provides an embodiment of a forward-secure end-to-end encryption method. The forward-secure end-to-end encryption method is applied to a forward-secure end-to-end encryption system, which includes: a client front-end, a WebSocket server, and a hardware key terminal. The forward-secure end-to-end encryption method includes the following steps: 101. The client front-end establishes a WebSocket channel with the WebSocket server; In this embodiment, the WebSocket server and the hardware key are located on the server. However, the memory of the WebSocket server and the hardware data of the hardware key are isolated. The WebSocket server cannot view the relevant data of the hardware key. The client front-end and the WebSocket server establish a WebSocket channel through a handshake. Subsequent data transmission between the client front-end and the WebSocket server needs to be carried out through the WebSocket channel.
[0021] For details, please refer to Figure 2 , Figure 2 This is a schematic diagram of a specific embodiment of step 101 of the forward-secure end-to-end encryption method in this invention. Step 101 includes the following specific implementation methods: 1011. The client front-end sends a connection negotiation request to the WebSocket server; 1012. The WebSocket server receives the connection negotiation request, generates a server certificate based on the connection negotiation request, and sends the server certificate to the client front end; 1013. The client front end receives the server certificate and establishes a WebSocket channel with the WebSocket server based on the server certificate.
[0022] In steps 1011-1013, the client frontend sends a connection negotiation request to the WebSocket server. The client frontend can send a connection negotiation request based on the TLS protocol to the WebSocket server. The WebSocket server receives the connection negotiation request, generates a server certificate containing an RSA-2048 public key based on the connection negotiation request, and sends the server certificate to the client frontend. The client frontend receives the server certificate, establishes a WebSocket channel with the WebSocket server based on the server certificate, and the server uses the RSA-2048 public key to encrypt the temporary session key and transmit it to the client.
[0023] 102. The client front end generates a client ECDH key pair according to a preset ECDH algorithm, wherein the client ECDH key pair includes: a client ECDH private key and a client ECDH public key; In this embodiment, the client front end generates a client ECDH key pair according to the preset ECDH algorithm. The client ECDH key pair contains two keys: a client ECDH private key and a client ECDH public key. The ECDH algorithm is the elliptic curve Diffie-Hellman algorithm, which can ensure that even if the key is leaked over a long period of time, it will not affect the security of historical sessions.
[0024] 103. Based on the WebSocket channel, send the client's ECDH public key to the WebSocket server; In this embodiment, the client's ECDH public key is sent from the client's front end to the WebSocket server through the established WebSocket channel.
[0025] Specifically, step 103 includes the following specific implementation methods: 1031. Based on the WebSocket channel and TLS protocol, send the client's ECDH public key to the WebSocket server.
[0026] In step 1031, the WebSocket channel uses the TLS protocol, which can be version TLS 1.3. The TLS protocol can prevent eavesdropping and man-in-the-middle attacks, providing security for the transmission channel.
[0027] Specifically, step 1031 includes the following specific implementation methods: 10311. Based on the WebSocket channel and TLS protocol, the client's ECDH public key is transmitted to the WebSocket server using the AES-256 encryption algorithm or the SM4 encryption algorithm.
[0028] In step 10311, the encryption algorithm set by the TLS protocol can be either AES-256 or SM4. The client's ECDH public key is encrypted and transmitted to the WebSocket server. Based on the characteristics of the TLS protocol, the WebSocket server will decrypt the received encrypted data using its symmetric key to obtain the client's ECDH public key.
[0029] 104. The WebSocket server receives the client's ECDH public key and sends the client's ECDH public key to the hardware key terminal; In this embodiment, after the WebSocket server receives the client's ECDH public key, it forwards the client's ECDH public key to the hardware key terminal. The WebSocket server mainly provides communication transmission and does not access the private key on the server side, nor can it see the plaintext of the private key on the hardware key terminal.
[0030] 105. The hardware key terminal receives the client's ECDH public key and generates a hardware ECDH key pair according to a preset ECDH algorithm, wherein the hardware ECDH key pair includes: a hardware ECDH private key and a hardware ECDH public key. In this embodiment, after receiving the client's ECDH public key, the hardware key terminal generates a hardware ECDH key pair based on the ECDH algorithm. The hardware ECDH key pair consists of a hardware ECDH private key and a hardware ECDH public key. The hardware ECDH private key will remain inside the hardware and will not be sent to the WebSocket server or exposed to external programs.
[0031] 106. Based on the preset key derivation function, derive and process the hardware ECDH private key and the client ECDH public key to generate the master key; In this embodiment, the key derivation function is consistent on both the hardware key terminal and the client. The key derivation function is used to extract the shared secret data contained in the hardware ECDH private key and the client ECDH public key. The master key is extracted from the shared secret data and stored on the hardware key terminal. The master key is also the basis for the main encryption and decryption.
[0032] For details, please refer to Figure 3 , Figure 3 This is a schematic diagram of a specific embodiment of the 106 steps of the forward-secure end-to-end encryption method in this invention. The 106 steps include the following specific implementation methods: 1061. Perform a dot product operation between the hardware ECDH private key and the client ECDH public key to generate dot product curve data; 1062. Perform coordinate extraction processing on the dot product curve data to obtain shared secret data; 1063. Obtain the handshake hash value between the client frontend and the WebSocket server; 1064. Based on the preset key derivation function and the handshake hash value, perform key extraction processing on the shared secret data to generate a master key.
[0033] In steps 1061-1064, the elliptic curve satisfies: hardware ECDH private key * client ECDH public key = hardware ECDH public key * client ECDH private key. Therefore, performing a dot product operation on the hardware ECDH private key and the client ECDH public key generates a dot product curve that is consistent with the dot product curve data obtained by the corresponding processing on the client side.
[0034] Coordinate extraction also involves extracting the same X-coordinate from the dot product curve data to obtain shared secret data, which is 32 bits in size.
[0035] The data obtained from the handshake context between the client front-end and the WebSocket server is hashed, that is, the handshake hash value, to ensure that different connections, different handshakes, and even the same pair of keys cannot calculate the same master key.
[0036] Using the processing rules of the key derivation function, the key derivation function is concatenated with the handshake hash value, mixed and processed to extract the key, generating a 32-bit master key.
[0037] 107. Based on the master key, generate a hardware key handle, and send the hardware key handle and the hardware ECDH public key to the WebSocket server; In this embodiment, the hardware key terminal generates a hardware key handle based on the master key, which can retrieve the master key but cannot be seen by it. Subsequent encryption and decryption use this handle. The hardware key handle and the hardware ECDH public key are returned to the WebSocket server, but the plaintext is still not visible to the WebSocket server.
[0038] Furthermore, following step 107, the following specific implementation methods are also included: 1071. The WebSocket server determines whether to trigger the preset key update setting; 1072. When the key update setting is triggered, a key update request is sent to the hardware key terminal; 1073. The hardware key terminal receives the key update request, generates a new master key, a new hardware ECDH public key, and a new hardware key handle, and sends the new hardware ECDH public key and the new hardware key handle to the WebSocket server. 1074. The WebSocket server receives the new hardware ECDH public key and the new hardware key handle, and sends the new hardware ECDH public key to the client front end; 1075. The client front end receives the new hardware ECDH public key.
[0039] In steps 1071-1075, a dynamic key update method is provided, whereby the WebSocket server determines whether a preset key update setting has been triggered. If the key update setting is triggered, a key update request is first sent to the hardware key terminal, which generates a new pair of hardware ECDH public and private keys. After computation, a new master key and a new hardware key handle are obtained. The new hardware key handle and the new hardware ECDH public key are then returned to the WebSocket server. The WebSocket server then retains the new hardware key handle for calling the master key and sends the new hardware ECDH public key to the client frontend. The client frontend receives the new hardware ECDH public key, replaces the old hardware ECDH public key with the new one, and updates the master key existing on the client.
[0040] Furthermore, the key update settings include: 1071X, The total transmission traffic between the WebSocket server and the client front-end exceeds a preset total threshold; 1071Y, or, the preset periodic transmission traffic between the WebSocket server and the client front-end exceeds the preset periodic monitoring threshold; 1071Z, or, the duration of publishing the hardware ECDH public key between the WebSocket server and the client front-end exceeds a preset update threshold.
[0041] In steps 1071X-1071Z, the three key conditions are evaluated in parallel; a key update is triggered as long as any one of them is met. The key update is triggered if the total transmission traffic between the WebSocket server and client exceeds a preset threshold of 10MB. It is also triggered if the transmission traffic between the WebSocket server and client exceeds a periodic monitoring threshold of 3MB within 10 seconds. Finally, it is triggered if the publication duration of the WebSocket server and client hardware ECDH public key exceeds the update threshold of 24 hours.
[0042] 108. The WebSocket server receives the hardware key handle and the hardware ECDH public key, and sends the hardware ECDH public key to the client front end; In this embodiment, the WebSocket server receives the hardware key handle and the hardware ECDH public key. Based on the TLS protocol, it encrypts the hardware ECDH public key using either the AES-256 or SM4 encryption algorithm and sends it to the client front end, while the hardware key handle remains in the WebSocket server.
[0043] 109. The client front end receives the hardware ECDH public key, and performs derivation encryption processing on the session plaintext according to the preset key derivation function, the hardware ECDH public key, and the client ECDH private key to generate session data, and transmits the session data to the WebSocket server. In this embodiment, the client front-end receives the hardware ECDH public key. Based on the same key derivation function as the hardware key terminal, it calculates the hardware ECDH public key and the client ECDH private key, and then performs derivation encryption on the plaintext session data to be sent, generating session data. Finally, based on the TLS protocol, it encrypts the session data using either the AES-256 or SM4 algorithm, and then transmits it to the WebSocket server via the WebSocket channel. The WebSocket server receives the encrypted session data through the WebSocket channel, and decrypts it using either the AES-256 or SM4 algorithm to obtain the plaintext session data.
[0044] For details, please refer to Figure 4 , Figure 4 This is a schematic diagram of a specific embodiment of the forward-secure end-to-end encryption method according to an embodiment of the present invention. The 109 steps include the following specific implementation methods: 1091. Perform a dot product operation between the hardware ECDH public key and the client ECDH private key to generate dot product curve data; 1092. Perform coordinate extraction processing on the curve data to obtain shared secret data; 1093. Obtain the handshake hash value between the client frontend and the WebSocket server; 1094. Based on the preset key derivation function and the handshake hash value, perform key extraction processing on the shared secret data to generate the client master key; 1095. Based on the client master key, encrypt the plaintext of the session to generate session data.
[0045] In steps 1091-1095, the elliptic curve satisfies: hardware ECDH private key * client ECDH public key = hardware ECDH public key * client ECDH private key. Therefore, performing a dot product operation on the hardware ECDH public key and the client ECDH private key generates a dot product curve that is consistent with the dot product curve data obtained by the corresponding processing at the hardware key end.
[0046] Coordinate extraction also involves extracting the same X-coordinate from the dot product curve data to obtain shared secret data, which is 32 bits in size.
[0047] The data obtained from the handshake context between the client front-end and the WebSocket server is hashed, that is, the handshake hash value, to ensure that different connections, different handshakes, and even the same pair of keys cannot calculate the same master key.
[0048] Using the processing rules of the key derivation function, the key derivation function concatenates the handshake hash value, performs mixing and key extraction, and generates a 32-bit client master key.
[0049] Finally, the client master key is used to encrypt the plaintext of the session to generate session data.
[0050] 110. The WebSocket server receives the session data and, based on the hardware key handle, transmits the session data to the hardware key terminal; In this embodiment, the WebSocket server receives session data, then calls the hardware key handle to transfer the session data to the hardware key terminal, which then calls the master key (which is not publicly displayed) to decrypt the session data.
[0051] 111. The hardware key terminal receives the session data, and based on the master key, decrypts the session data to generate session plaintext.
[0052] In this embodiment, the hardware key terminal receives session data and then decrypts the session data using the master key to obtain the session plaintext. The session plaintext is then transmitted to a preset display port or a WebSocket server so that the user can view the relevant session plaintext.
[0053] In this embodiment of the invention, by setting up a WebSocket server and a hardware key terminal on the server respectively, the server's private key is never exposed in the WebSocket server. Only the hardware key terminal performs encryption and decryption operations. The WebSocket server can only obtain the encrypted ciphertext and the parsed plaintext. The WebSocket server cannot see the private key data. Even if the service program is injected with an attack, it cannot decrypt the encrypted session data between the server and the client front end. The key separation design ensures forward security, overcomes the problem of private key interception in the side channel, and solves the technical problem of the risk of key leakage in the side channel of current network transmission forward security.
[0054] Figure 5This is a schematic diagram of a forward-secure end-to-end encryption device 500 provided in an embodiment of the present invention. The forward-secure end-to-end encryption device 500 can vary significantly due to different configurations or performance characteristics. It may include one or more central processing units (CPUs) 510 and memory 520, and one or more storage media 530 for storing application programs 533 or data 532. The memory 520 and storage media 530 can be temporary or persistent storage. The program stored in the storage media 530 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the forward-secure end-to-end encryption device 500. Furthermore, the processor 510 may be configured to communicate with the storage media 530 and execute the series of instruction operations in the storage media 530 on the forward-secure end-to-end encryption device 500.
[0055] The forward-secure end-to-end encryption device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input / output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, Free BSD, etc. Those skilled in the art will understand that... Figure 5 The illustrated forward-secure end-to-end encryption device architecture does not constitute a limitation on forward-secure end-to-end encryption devices, which may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0056] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of the forward-secure end-to-end encryption method.
[0057] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0058] Furthermore, although the operations are described in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.
[0059] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method of forward-secure end-to-end encryption, characterized by, The forward secure end-to-end encryption method is applied to a forward secure end-to-end encryption system, and the forward secure end-to-end encryption system comprises a client front end, a WebSocket server end and a hardware key end. The client front end establishes a WebSocket channel with the WebSocket server end. The client front end generates a client ECDH key pair according to a preset ECDH algorithm, wherein the client ECDH key pair comprises a client ECDH private key and a client ECDH public key. The client ECDH public key is sent to the WebSocket server end based on the WebSocket channel. The WebSocket server end receives the client ECDH public key and sends the client ECDH public key to the hardware key end. The hardware key end receives the client ECDH public key, generates a hardware ECDH key pair according to a preset ECDH algorithm, wherein the hardware ECDH key pair comprises a hardware ECDH private key and a hardware ECDH public key. A master key is derived from the hardware ECDH private key and the client ECDH public key according to a preset key derivation function. A hardware key handle is generated based on the master key, and the hardware key handle and the hardware ECDH public key are sent to the WebSocket server end. The WebSocket server end receives the hardware key handle and the hardware ECDH public key, and sends the hardware ECDH public key to the client front end. The client front end receives the hardware ECDH public key, performs derivation encryption processing on session plaintext according to a preset key derivation function, the hardware ECDH public key and the client ECDH private key, generates session data, and transmits the session data to the WebSocket server end. The WebSocket server end receives the session data, and transmits the session data to the hardware key end based on the hardware key handle. The hardware key end receives the session data, and performs decryption processing on the session data based on the master key to generate session plaintext.
2. The forward secure end-to-end encryption method of claim 1, wherein, The step of deriving the master key from the hardware ECDH private key and the client ECDH public key according to a preset key derivation function comprises: Point multiplication processing is performed on the hardware ECDH private key and the client ECDH public key to generate point curve data. Coordinate extraction processing is performed on the point curve data to obtain shared secret data. A handshake hash value of the client front end and the WebSocket server end is obtained. The shared secret data is subjected to key extraction processing according to a preset key derivation function and the handshake hash value to generate a master key.
3. The forward secure end-to-end encryption method of claim 1, wherein, The step of performing derivation encryption processing on session plaintext according to a preset key derivation function, the hardware ECDH public key and the client ECDH private key to generate session data comprises: Point-multiply the hardware ECDH public key with the client ECDH private key to generate point-multiply curve data; Coordinate extraction is performed on the curve data to obtain shared secret data; Obtain the handshake hash value of the client front end and the WebSocket server; According to the preset key derivation function and the handshake hash value, the shared secret data is subjected to key extraction processing to generate a client master key; Based on the client master key, the session plaintext is encrypted to generate session data.
4. The forward secure end-to-end encryption method of claim 1, wherein, The step of sending the client ECDH public key to the WebSocket server based on the WebSocket channel includes: Based on the WebSocket channel and the TLS protocol, the client ECDH public key is sent to the WebSocket server.
5. The forward secure end-to-end encryption method of claim 4, wherein, The step of sending the client ECDH public key to the WebSocket server based on the WebSocket channel and the TLS protocol includes: Based on the WebSocket channel and the TLS protocol, the client ECDH public key is transmitted to the WebSocket server using the AES-256 encryption algorithm or the SM4 encryption algorithm.
6. The forward secure end-to-end encryption method of claim 1, wherein, After the step of sending the hardware ECDH public key to the client front end, it further includes: The WebSocket server determines whether a preset key update setting is triggered; When the key update setting is triggered, a key update request is sent to the hardware key end; The hardware key end receives the key update request, generates a new master key, a new hardware ECDH public key, and a new hardware key handle, and sends the new hardware ECDH public key and the new hardware key handle to the WebSocket server; The WebSocket server receives the new hardware ECDH public key and the new hardware key handle, and sends the new hardware ECDH public key to the client front end; The client front end receives the new hardware ECDH public key.
7. The forward secure end-to-end encryption method of claim 6, wherein, The key update setting includes: The total traffic between the WebSocket server and the client front end exceeds a preset total threshold; Or, the preset period transmission traffic between the WebSocket server and the client front end exceeds a preset period monitoring threshold; Or, the publication duration of the hardware ECDH public key between the WebSocket server and the client front end is greater than a preset update threshold.
8. The forward secure end-to-end encryption method of claim 1, wherein, The client front end and the WebSocket server establish a WebSocket channel, including the steps of: The client front end sends a connection negotiation request to the WebSocket server; The WebSocket server receives the connection negotiation request, generates a server certificate based on the connection negotiation request, and sends the server certificate to the client front end; The client front end receives the server certificate and establishes a WebSocket channel with the WebSocket server based on the server certificate.
9. A forward-secure end-to-end encryption device, characterized by The forward-secure end-to-end encryption device comprises a memory and at least one processor, the memory has instructions stored therein, and the memory and the at least one processor are interconnected by a line; The at least one processor invokes the instructions in the memory to enable the forward-secure end-to-end encryption device to perform the forward-secure end-to-end encryption method according to any one of claims 1-8.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program, when executed by a processor, implements the forward-secure end-to-end encryption method according to any one of claims 1-8.
Citation Information
Patent Citations
Classified downloading method and device for front-end logs and storage medium
CN120881062A
Encryption transmission method and device, equipment and storage medium
CN121000418A
Systems and methods for establishing a secure digital network environment
WO2024073843A1