Forward-secure end-to-end encryption method, device and storage medium

By separating the key between the client front-end and the hardware key terminal, and using the ECDH algorithm to generate key pairs and perform encryption operations on the hardware key terminal, the problem of side-channel key leakage in the forward security protocol is solved, and end-to-end forward security is achieved.

CN121283771BActive Publication Date: 2026-03-20SHENZHEN ECHOSENS MEDICAL EQUIP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-05
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing forward security protocols have the risk of side-channel key leakage during network transmission, especially when the data is in plaintext during server-side processing, lacking true end-to-end encryption protection.

Method used

The system employs a key separation design involving the client front-end, WebSocket server, and hardware key terminal. Key pairs are generated using the ECDH algorithm, and encryption and decryption operations are performed on the hardware key terminal. The WebSocket server only transmits encrypted ciphertext and plaintext, thus avoiding the exposure of the private key on the server side.

Benefits of technology

This ensures that even if the service application is attacked, the private key cannot decrypt the encrypted session data at the client's front end, achieving true forward security and preventing key leakage in the side channel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121283771B_ABST
    Figure CN121283771B_ABST
Patent Text Reader

Abstract

The application relates to the field of network security and discloses a forward security end-to-end encryption method, equipment and a storage medium. The method comprises the following steps: a WebSocket server receives a hardware key handle and a hardware ECDH public key, and sends the hardware ECDH public key to a client front end; the client front end receives the hardware ECDH public key, performs deducing encryption processing on session plaintext according to a preset key derivation function, the hardware ECDH public key and a client ECDH private key, generates session data, and transmits the session data to the WebSocket server; the WebSocket server receives the session data, transmits the session data to a hardware key end based on the hardware key handle; and the hardware key end performs decryption processing on the session data based on a master key, and generates session plaintext. In the embodiment of the application, the key separation design ensures forward security and overcomes the problem that the private key can be intercepted in a side channel.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of network security, and in particular to a forward-secure end-to-end encryption method, device and storage medium. BACKGROUND

[0002] Forward security is that even if an attacker obtains the long-term private key of the server in the future, the past completed session key cannot be calculated, and the past intercepted communication data cannot be decrypted. Forward security is the default bottom line of modern encryption protocols, and forward security is mainly realized through the key exchange mechanism of "one-time one-key". The same shared key is calculated locally at both ends, and the temporary private key is immediately destroyed. Since the temporary private key does not exist after the session ends, even if the attacker obtains the long-term private key of the server in the future, the shared key of the session cannot be reconstructed, so the previously intercepted ciphertext cannot be decrypted.

[0003] However, the temporary key generation, hosting and rotation process in the prior art still relies on the terminal or server host, and the key of the server still has a risk of leakage, and lacks real end-to-end encryption protection. Data in the service end processing link is in plaintext state, and there is a risk of side channel leakage and key residue. Therefore, in view of the technical problem that the forward security of the current network transmission has a risk of key leakage in the side channel, a new technology is needed to solve the current problem. SUMMARY

[0004] The main purpose of the present application is to solve the technical problem that the forward security of the current network transmission has a risk of key leakage in the side channel.

[0005] The first aspect of the present application 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 comprising: a client front end, a WebSocket server end, and a hardware key end, the forward-secure end-to-end encryption method comprising the steps of:

[0006] establishing a WebSocket channel between the client front end and the WebSocket server end;

[0007] generating 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;

[0008] sending the client ECDH public key to the WebSocket server end based on the WebSocket channel;

[0009] The WebSocket server receives the client ECDH public key, and sends the client ECDH public key to the hardware key end;

[0010] The hardware key end receives the client 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;

[0011] According to a preset key derivation function, the hardware ECDH private key and the client ECDH public key are derived and processed to generate a master key;

[0012] 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 end;

[0013] 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;

[0014] The client front end receives the hardware ECDH public key, and performs derivation and 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, and transmits the session data to the WebSocket server end;

[0015] The WebSocket server receives the session data, and transmits the session data to the hardware key end based on the hardware key handle;

[0016] The hardware key end receives the session data, decrypts the session data based on the master key to generate session plaintext, and sends the session plaintext to the WebSocket server end.

[0017] Optionally, in the first implementation manner of the first aspect of the present application, 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:

[0018] Point multiplication processing is performed on the hardware ECDH private key and the client ECDH public key to generate point multiplication curve data;

[0019] Coordinate extraction processing is performed on the point multiplication curve data to obtain shared secret data;

[0020] The handshake hash value of the client front end and the WebSocket server end is obtained;

[0021] According to a preset key derivation function and the handshake hash value, key extraction processing is performed on the shared secret data to generate a master key.

[0022] Optionally, in a second implementation form of the first aspect of the application, the step of performing 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 comprises:

[0023] performing point multiplication processing on the hardware ECDH public key and the client ECDH private key to generate point curve data;

[0024] performing coordinate extraction processing on the curve data to obtain shared secret data;

[0025] obtaining a handshake hash value of the client front end and the WebSocket server end;

[0026] performing key extraction processing on the shared secret data according to a preset key derivation function and the handshake hash value to generate a client master key;

[0027] performing encryption processing on the session plaintext based on the client master key to generate session data.

[0028] Optionally, in a third implementation form of the first aspect of the application, the step of sending the client ECDH public key to the WebSocket server end based on the WebSocket channel comprises:

[0029] sending the client ECDH public key to the WebSocket server end based on the WebSocket channel and the TLS protocol.

[0030] Optionally, in a fourth implementation form of the first aspect of the application, the step of sending the client ECDH public key to the WebSocket server end based on the WebSocket channel and the TLS protocol comprises:

[0031] transmitting the client ECDH public key to the WebSocket server end based on the WebSocket channel and the TLS protocol by using an AES-256 encryption algorithm or an SM4 encryption algorithm.

[0032] Optionally, in a fifth implementation form of the first aspect of the application, after the step of sending the hardware ECDH public key to the client front end, the method further comprises:

[0033] the WebSocket server end judges whether a preset key update setting is triggered;

[0034] When the key update setting is triggered, a key update request is sent to the hardware key end;

[0035] 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 end;

[0036] The WebSocket server end 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;

[0037] The client front end receives the new hardware ECDH public key.

[0038] Optionally, in a sixth implementation manner of the first aspect of the present application, the key update setting comprises:

[0039] The total traffic between the WebSocket server end and the client front end exceeds a preset total threshold;

[0040] Or, the preset period transmission traffic between the WebSocket server end and the client front end exceeds a preset period monitoring threshold;

[0041] Or, the publishing duration of the hardware ECDH public key between the WebSocket server end and the client front end is greater than a preset update threshold.

[0042] Optionally, in a seventh implementation manner of the first aspect of the present application, the establishment of the WebSocket channel between the client front end and the WebSocket server end comprises the steps of:

[0043] The client front end sends a connection negotiation request to the WebSocket server end;

[0044] The WebSocket server end 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;

[0045] The client front end receives the server certificate, and establishes the WebSocket channel with the WebSocket server end based on the server certificate.

[0046] The second aspect of the present application provides a forward secure end-to-end encryption device, comprising a memory and at least one processor, the memory storing instructions, and the memory and the at least one processor being 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 described above.

[0047] The third aspect of the present application provides a computer readable storage medium, storing instructions, when running on a computer, enabling the computer to perform the forward secure end-to-end encryption method described above.

[0048] In the embodiment of the present application, by setting the WebSocket server and the hardware key server on the server respectively, the private key of the server is always not exposed in the WebSocket server, and only the hardware key server performs encryption and decryption operations, the WebSocket server can only get encrypted ciphertext and parsed plaintext, the WebSocket server cannot see the private key data, even if the service program is injected with an attack, the encrypted session data between the client front end cannot be decrypted, the key separation design ensures the forward security, overcomes the problem that the private key will be intercepted in the side channel, and solves the technical problem that the forward security of current network transmission exists the risk of key leakage in the side channel. BRIEF DESCRIPTION OF DRAWINGS

[0049] Figure 1 An embodiment of the forward secure end-to-end encryption method in the embodiment of the present application is shown in the figure;

[0050] Figure 2 An embodiment of the step 101 of the forward secure end-to-end encryption method in the embodiment of the present application is shown in the figure;

[0051] Figure 3 An embodiment of the step 106 of the forward secure end-to-end encryption method in the embodiment of the present application is shown in the figure;

[0052] Figure 4 An embodiment of the step 109 of the forward secure end-to-end encryption method in the embodiment of the present application is shown in the figure;

[0053] Figure 5 An embodiment of the forward secure end-to-end encryption device in the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0054] The embodiment of the present application provides a forward secure end-to-end encryption method, device and storage medium.

[0055] Embodiments of the present disclosure will be described below in greater detail with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be construed as being limited to the embodiments set forth herein, but rather, these embodiments are provided so that the present disclosure can be more thoroughly and completely understood. It is understood that the drawings and embodiments of the present disclosure are for exemplary purposes only and are not intended to limit the scope of protection of the present disclosure.

[0056] In the description of embodiments of the present disclosure, the term "comprising" and its conjugations should be understood to encompass the meanings of "including but not limited to", the term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. can refer to different or same objects. Other explicit and implicit definitions can also be included below.

[0057] For ease of understanding, the specific process of the embodiments of the present disclosure is described below. Please refer to Figure 1 One embodiment of the forward secure end-to-end encryption method in the embodiments of the present disclosure is applied to a forward secure end-to-end encryption system, which includes a client front end, a WebSocket server, and a hardware key end. The forward secure end-to-end encryption method includes the following steps:

[0058] 101. The client front end establishes a WebSocket channel with the WebSocket server;

[0059] In this embodiment, the WebSocket server and the hardware key end are set at the server, but the memory of the WebSocket server and the hardware data of the hardware key end are isolated, and the WebSocket server cannot view the relevant data of the hardware key end. The client front end establishes a WebSocket channel with the WebSocket server through handshaking, and subsequent data transmission between the client front end and the WebSocket server needs to be interacted through the WebSocket channel.

[0060] Specifically, please refer to Figure 2 , Figure 2 For a specific embodiment of step 101 of the forward secure end-to-end encryption method in the embodiments of the present disclosure, step 101 includes the following specific implementation:

[0061] 1011. The client front end sends a connection negotiation request to the WebSocket server;

[0062] 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;

[0063] 1013、the client front end receives the server certificate, and establishes a WebSocket channel with the WebSocket server based on the server certificate.

[0064] In steps 1011-1013, the client front end sends a connection negotiation request to the WebSocket server. The client front end 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 front end. The client front end receives the server certificate and establishes a WebSocket channel with the WebSocket server based on the server certificate. The server uses the RSA-2048 public key to encrypt the transmission of the temporary session key to the client.

[0065] 102、the client front end generates a client ECDH key pair based on a preset ECDH algorithm, wherein the client ECDH key pair includes a client ECDH private key and a client ECDH public key;

[0066] In this embodiment, the client front end generates a client ECDH key pair based on a preset ECDH algorithm. The client ECDH key pair includes 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 long-term key is leaked, it will not affect the security of the historical session.

[0067] 103、send the client ECDH public key to the WebSocket server based on the WebSocket channel;

[0068] In this embodiment, the client ECDH public key is sent from the client front end to the WebSocket server through the established WebSocket channel.

[0069] Specifically, in step 103, the following specific implementation is included:

[0070] 1031、send the client ECDH public key to the WebSocket server based on the WebSocket channel and the TLS protocol.

[0071] In step 1031, the transmission protocol of the WebSocket channel uses the TLS protocol, and the version can be TLS 1.3. The TLS protocol can prevent eavesdropping and man-in-the-middle attacks, and provides security protection for the transmission channel.

[0072] Specifically, in step 1031, the following specific implementation is included:

[0073] 10311, 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.

[0074] In step 10311, the encryption transmission algorithm set by the TLS protocol can be any one of the AES-256 encryption algorithm and the SM4 encryption algorithm. The client ECDH public key is encrypted and transmitted to the WebSocket server. Based on the characteristics of the TLS protocol, the WebSocket server will use the symmetric key to decrypt the encrypted data and obtain the client ECDH public key.

[0075] 104, the WebSocket server receives the client ECDH public key and sends the client ECDH public key to the hardware key end;

[0076] In this embodiment, after the WebSocket server receives the client ECDH public key, the client ECDH public key is forwarded to the hardware key end. The WebSocket server mainly provides communication transmission and cannot access the private key on the server or see the private key plaintext of the hardware key end.

[0077] 105, the hardware key end receives the client 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.

[0078] In this embodiment, after the hardware key end receives the client ECDH public key, a hardware ECDH key pair is generated based on the ECDH algorithm. The hardware ECDH key pair is a hardware ECDH private key and a hardware ECDH public key. The hardware ECDH private key is kept inside the hardware and will not be sent to the WebSocket server or exposed to external programs.

[0079] 106, according to a preset key derivation function, the hardware ECDH private key and the client ECDH public key are derived and processed to generate a master key;

[0080] In the embodiment, the key derivation function is consistent at the hardware key end and the client end, the shared secret data contained by the hardware ECDH private key and the client ECDH public key is extracted by using the key derivation function, the master key is extracted from the shared secret data, the master key is stored at the hardware key end, and the master key is also the basis for main encryption and decryption.

[0081] Specifically, refer to Figure 3 , Figure 3 For a specific embodiment of the 106th step of the forward secure end-to-end encryption method in the embodiment of the application, the 106th step includes the following specific implementation:

[0082] 1061, point-multiply processing is performed on the hardware ECDH private key and the client ECDH public key to generate point-multiply curve data;

[0083] 1062, coordinate extraction processing is performed on the point-multiply curve data to obtain shared secret data;

[0084] 1063, a handshake hash value of the client front end and the WebSocket server end is obtained;

[0085] 1064, according to a preset key derivation function and the handshake hash value, key extraction processing is performed on the shared secret data to generate a master key.

[0086] In the 1061st to 1064th steps, the elliptic curve satisfies: hardware ECDH private key * client ECDH public key = hardware ECDH public key * client ECDH private key, therefore, the point-multiply curve data generated by performing point-multiply processing on the hardware ECDH private key and the client ECDH public key is consistent with the point-multiply curve data obtained by the corresponding processing of the client.

[0087] The coordinate extraction is also the extraction of the same X coordinate set from the point-multiply curve data to obtain the shared secret data, and the size of the shared secret data is 32 bits.

[0088] The data obtained by performing hash processing on the handshake context of the client front end and the WebSocket server end is the handshake hash value, which ensures that different connections, different handshakes, and even the same pair of keys cannot calculate the same master key.

[0089] By using the processing rule of the key derivation function, the handshake hash value is spliced and mixed to process the key extraction, and a 32-bit master key is generated.

[0090] 107, 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 end;

[0091] In the embodiment, the hardware key end generates a hardware key handle based on the master key, which can call the master key but cannot see the master key, and subsequent encryption and decryption call the handle. The hardware key handle and the hardware ECDH public key are returned to the WebSocket server, and the WebSocket server still cannot see the plaintext.

[0092] Further, after the step 107, the following specific embodiments are further included:

[0093] 1071. The WebSocket server determines whether to trigger a preset key update setting.

[0094] 1072. When the key update setting is triggered, a key update request is sent to the hardware key end.

[0095] 1073. 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.

[0096] 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.

[0097] 1075. The client front end receives the new hardware ECDH public key.

[0098] In steps 1071-1075, a dynamic key update method is provided. The WebSocket server determines whether to trigger a preset key update setting. If the key update setting is triggered, a key update request is first sent to the hardware key end, a new pair of hardware ECDH public key and hardware ECDH private key is generated by the hardware key end, and then a new master key and a new hardware key handle are obtained by operation. The new hardware key handle and the new hardware ECDH public key are returned to the WebSocket server. The WebSocket server leaves a new hardware key handle for calling the master key, sends the new hardware ECDH public key to the client front end, the client front end receives the new hardware ECDH public key, replaces the old hardware ECDH public key with the new hardware ECDH public key, and updates the master key existing in the client.

[0099] Further, the key update setting includes:

[0100] 1071X. The total traffic between the WebSocket server and the client front end exceeds a preset total threshold.

[0101] 1071Y, or, the preset periodic transmission traffic between the WebSocket server and the client front-end exceeds the preset periodic monitoring threshold;

[0102] 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.

[0103] 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.

[0104] 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;

[0105] 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.

[0106] 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.

[0107] 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.

[0108] Specifically, refer to Figure 4 , Figure 4 is a specific embodiment of step 109 of the forward secure end-to-end encryption method in the embodiment of the application, and step 109 includes the following specific implementation:

[0109] 1091, point-multiply the hardware ECDH public key and the client ECDH private key to generate point-multiplication curve data;

[0110] 1092, perform coordinate extraction processing on the curve data to obtain shared secret data;

[0111] 1093, obtain a handshake hash value of the client front end and the WebSocket server end;

[0112] 1094, according to a preset key derivation function and the handshake hash value, perform key extraction processing on the shared secret data to generate a client master key;

[0113] 1095, based on the client master key, perform encryption processing on the session plaintext to generate session data.

[0114] In steps 1091-1095, the elliptic curve satisfies: hardware ECDH private key * client ECDH public key = hardware ECDH public key * client ECDH private key, so the point-multiplication curve data generated by point-multiplying the hardware ECDH public key and the client ECDH private key is consistent with the point-multiplication curve data obtained by the corresponding processing of the hardware key end.

[0115] The coordinate extraction is also to extract the same X coordinate set from the point-multiplication curve data to obtain the shared secret data, and the size of the shared secret data is 32 bits.

[0116] The handshake context of the client front end and the WebSocket server end is hashed to obtain the data, that is, the handshake hash value, which ensures that different connections, different handshakes, and even the same pair of keys cannot calculate the same master key.

[0117] Using the processing rules of the key derivation function, the handshake hash value is spliced and mixed to process the key extraction, and a 32-bit client master key is generated.

[0118] Finally, the client master key is used to perform encryption processing on the session plaintext to generate session data.

[0119] 110, the WebSocket server receives the session data, and based on the hardware key handle, transmits the session data to the hardware key end;

[0120] In the embodiment, the WebSocket server receives the session data, and then calls the hardware key handle to transmit the session data to the hardware key end, and the hardware key end calls the main key not exposed externally to decrypt the session data.

[0121] 111. The hardware key end receives the session data, decrypts the session data based on the main key, and generates session plaintext.

[0122] In the embodiment, the hardware key end receives the session data, and then decrypts the session data by the main key to obtain session plaintext. Then, the session plaintext is transmitted to a preset display port or the WebSocket server, so that the user can view the related session plaintext.

[0123] In the embodiment, the WebSocket server and the hardware key end are respectively arranged on the server, the private key of the server is not exposed in the WebSocket server, and the hardware key end only performs encryption and decryption operations. The WebSocket server can only obtain encrypted ciphertext and parsed plaintext, and the WebSocket server cannot see the private key data. Even if the service program is injected with an attack, the encrypted session data between the client front end cannot be decrypted, the key separation design ensures forward security, overcomes the problem that the private key is intercepted in a side channel, and solves the technical problem of the forward security existing side channel of the current network transmission.

[0124] Figure 5 is a structure schematic diagram of a forward secure end-to-end encryption device provided by the embodiment, the forward secure end-to-end encryption device 500 can have great differences due to different configurations or performances, and can include one or more than one central processing unit (CPU) 510 and a memory 520, and one or more than one storage medium 530 storing an application program 533 or data 532. The memory 520 and the storage medium 530 can be temporary storage or persistent storage. The program stored in the storage medium 530 can include one or more than one module (not shown in the figure), and each module can include a series of instruction operations in the forward secure end-to-end encryption device 500. Further, the processor 510 can be configured to communicate with the storage medium 530, and execute a series of instruction operations in the storage medium 530 on the forward secure end-to-end encryption device 500.

[0125] The forward-secure end-to-end encryption device 500 can 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, FreeBSD, etc. Those skilled in the art will appreciate that Figure 5 The illustrated forward-secure end-to-end encryption device architecture is not meant to limit the scope of forward-secure end-to-end encryption devices, which can include more or fewer components than shown, or combine certain components, or have a different arrangement of components.

[0126] The present disclosure also provides a computer readable storage medium, which can be a non-volatile computer readable storage medium, or a volatile computer readable storage medium, and the computer readable storage medium has stored therein instructions which, when executed on a computer, cause the computer to perform the steps of the forward-secure end-to-end encryption method.

[0127] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0128] Moreover, while operations can be depicted in a particular, serial order, this should not be understood as requiring or implying that such operations be performed in the particular order shown, or in sequential order, or that all illustrated operations be performed, to achieve desirable results. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, while specific implementations have been discussed, these should not be understood to suggest a limitation of the scope of the disclosure. In fact, certain features are, independently, combinable with any or all other features in each of the

[0129] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. A forward-secure end-to-end encryption method, characterized in that, 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: 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 and 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, and generates session plaintext.

2. The forward-secure end-to-end encryption method according to claim 1, characterized in that, 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 the 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 a master key.

3. The forward-secure end-to-end encryption method according to claim 1, characterized in that, The step of deriving and encrypting the session plaintext based on the 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.

4. The forward-secure end-to-end encryption method according to claim 1, characterized in that, 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.

5. The forward-secure end-to-end encryption method according to claim 4, characterized in that, The step of sending the client's ECDH public key to the WebSocket server based on the WebSocket channel and 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.

6. The forward-secure end-to-end encryption method according to claim 1, characterized in that, 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.

7. The forward-secure end-to-end encryption method according to claim 6, characterized in that, The key update settings include: 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.

8. The forward-secure end-to-end encryption method according to claim 1, characterized in that, The steps involved in establishing a WebSocket channel between the client front-end and the WebSocket server are as follows: 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 in that, The forward-secure end-to-end encryption device includes: 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 forward-secure end-to-end encryption method as described in any one of claims 1-8.

10. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by a processor, it implements the forward-secure end-to-end encryption method as described in 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