A solution to TLS handshake without private key

Through the private keyless TLS handshake method, the load balancing service and dtcs server work together to process encryption operations asynchronously, solving the problem that certificate private key deployment is inconvenient for management and leakage, realizing the security management of certificate private keys and the cloud environment. Reduced risks.

CN117857095BActive Publication Date: 2024-11-26CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311651911.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2024-11-26
Estimated Expiration
2043-12-05

AI Technical Summary

Technical Problem

The deployment of certificate private keys on various servers is inconvenient to manage, which increases the risk of certificate private keys being leaked.

Method used

The private keyless TLS handshake method is adopted to work together with the load balancing service and the dtcs server to handle encryption operations asynchronously, avoid saving the certificate private key in the load balancing service, and directly obtaining the encryption results from the dtcs server.

Benefits of technology

It effectively avoids the risk of certificate private key leakage, simplifies the management process of certificate private keys, and reduces the risk of private key leakage in cloud environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117857095B_ABST
    Figure CN117857095B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of network technology, and specifically discloses a solution for TLS handshake without private key, which comprises: step S1: loading a certificate and a certificate private key when load balancing is started and checking whether they match; setting a private key-free mode, starting through a TLS protocol without the need for a user to upload a certificate private key, not loading a certificate private key when starting, and not verifying whether the certificate and the certificate private key match; step S2: in order to make encryption operations asynchronous, it is necessary to modify the load balancing service content; the present invention solves the problem that the dispersion of user private keys in a cloud environment increases the risk of certificate private key leakage. By adopting this method, users no longer need to upload certificate private keys to the cloud environment, and only need to provide encryption services in a certain Internet location that users trust and can access; on the one hand, it avoids the risk of private key leakage, and on the other hand, it is convenient for users to manage certificate private keys.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network technology, and in particular to a solution for solving a TLS handshake problem without a private key. Background Art

[0002] The keyless solution is a solution proposed by Cloudflare to solve the problems of inconvenient management of certificate private keys deployed on various servers and increased leakage of certificate private keys. More and more users are deploying services on the cloud, and the current conventional solution is to upload the certificate private key. Once the server is taken over by hackers, the certificate private key will be obtained by hackers.

[0003] OpenSSL engine mechanism OpenSSL is a multi-platform compatible access framework provided by hardware accelerator card manufacturers to facilitate their drivers to run on various platforms. Its function of replacing the default cryptographic algorithm is also often used in various software cryptographic algorithm replacement and encryption machine TLS handshake solutions. The early default cryptographic algorithm implementation has gradually been abstracted into a solution. OpenSSL engine has become a framework that spans the upper-level interface and the underlying algorithm, reducing the access loss and difficulty of alternative solutions.

[0004] OpenSSL Async mode is an asynchronous I / O mode used to abstract the non-CPU-consuming operations in the hardware accelerator card. A coroutine is responsible for calling and waiting for the hardware accelerator card to complete the operation. The coroutine in Linux C is mainly implemented using the ucontext family of functions. OpenSSL uses Async Job to save various parameters of the function runtime and the context variables of the coroutine.

[0005] Tasklet is a lower half mechanism of an interrupt handler implemented by soft interrupt. In this invention, the work of interacting with the dtcs server is performed by the processing function registered in the tasklet.

[0006] OpenSSL's support for hardware accelerators is becoming more mature. Using its engine mechanism, we can write our own dtcs engine program to realize the idea of ​​offloading private key operations to a remote encryption server (configure private keys). Using its Async mode, we can write asynchronous programs to avoid network delays in the Internet environment that cause a single TLS handshake to take too long.

[0007] DTCS (distributed crypto service): Distributed crypto service is actually a set of components, including DTCS engine and DTCS server.

[0008] dtcs engine: A distributed encryption service engine based on the OpenSSL engine mechanism. It offloads the default cryptographic algorithm to the dtcs engine. The dtcs engine does not calculate it, but sends the data to the dtcs server.

[0009] dtcs server: distributed encryption server, which performs asymmetric private key encryption on data after receiving a request;

[0010] RSA: This mainly refers to the RSA key agreement algorithm, which can enable the communicating parties to jointly negotiate a pre-master key through public key encryption and private key decryption algorithms, and then calculate the session key (and symmetric encryption key).

[0011] Tasklet mechanism: a soft interrupt mechanism, triggered by dtcs engine, which allows dtcs engine to return results immediately to avoid load balancing service blocking. We put the work of initiating requests to dtcs server service, transmitting data, getting responses, and notifying load balancing service in the tasklet handler.

[0012] TLS is an encryption protocol that provides end-to-end security for data sent between applications over the Internet.

[0013] The TLS handshake is a process that uses asymmetric cryptography to secure a connection with a server.

[0014] In order to solve the problems that certificate private keys are deployed on various servers and are inconvenient to manage, increase the leakage of certificate private keys, etc., the present invention proposes a universal TLS handshake method without private key. Summary of the invention

[0015] The purpose of the present invention is to provide a solution for TLS handshake without private key, aiming to solve the problems that the certificate private key is deployed on various servers and is inconvenient to manage, and increases the leakage of the certificate private key.

[0016] To achieve the above object, the present invention provides the following technical solution: a solution for TLS handshake without private key, the method steps are as follows:

[0017] Step S1: When the load balancing service is started, the certificate and certificate private key are loaded and checked for matching; the no-private-key mode is set, and the service is started through the TLS protocol without the user having to upload the certificate private key. The certificate private key is not loaded at startup, and the certificate and certificate private key are not verified for matching;

[0018] Step S2: Make the encryption operation asynchronous and modify the load balancing service to support OpenSSL Async mode;

[0019] Step S3: Write a dtcs engine and deploy it in the environment where the load balancing service is located. The dtcs engine registers the tasklet processing function. When the tasklet processing function is triggered, it initiates a private key encryption request to the dtcs server.

[0020] Step S4: Write a dtcs server, which is deployed by the user in an environment that the user trusts. The dtcs engine will interact with the dtcs server through the Internet.

[0021] Step S5: The client performs a TLS handshake with the load balancing service, and the load balancing service calls the method provided by OpenSSL to perform a TLS handshake with the client; this method will eventually call the RSA private key decryption algorithm implemented by the dtcs engine to replace the default RSA private key decryption algorithm;

[0022] Step S6: The RSA private key decryption algorithm implemented by the dtcs engine will trigger the tasklet processing function registered in step 3 and initiate a request to the dtcs server; and the RSA private key decryption algorithm implemented by the dtcs engine will be returned immediately;

[0023] Step S7: Based on the load balancing service supporting OpenSSL Async mode, steps S5 and S6 are performed in an ASYNC_JOB coroutine. After the coroutine obtains the return, the context switch is performed and the current task is suspended;

[0024] Step S8: The method provided by OpenSSL returns an error status code SSL_ERROR_WANT_ASYNC to the load balancing service, indicating that the current mode is Async mode, and the load balancing service continues to perform the following steps;

[0025] Step S9: the load balancing service obtains the error status code SSL_ERROR_WANT_ASYNC and registers a file descriptor associated with the TLS connection;

[0026] Step S10: The load balancing service monitors the arrival of events on the file descriptor through epoll.

[0027] Step S11: Continuing from step S6, after receiving the request of the tasklet processing function, the dtcs server searches for the corresponding certificate private key, performs RSA private key decryption operation on the data, and returns the operation result;

[0028] Step S12: After the tasklet processing function obtains the response, it writes the result into the shared memory and transmits the processing completion notification from the dtcs engine to the load balancing service through the file descriptor;

[0029] Step S13: The load balancing service detects that the state of the file descriptor has changed, and calls the method provided by OpenSSL again to make the ASYNC_JOB that was dormant in step S5 run again, and read and process data from the shared memory.

[0030] As a preferred embodiment of the present invention, the steps for starting the TLS protocol without the user uploading a certificate private key in step S1 are as follows:

[0031] Step S1.1: The client sends ClientHello to the load balancing server. The client initiates a connection request and sends the list of algorithms it supports and the client random number to the load balancing service.

[0032] Step S1.2: The load balancing service returns ServerHello, and the load balancing service sends a selected encryption algorithm and a server random number to the client;

[0033] Step S1.3: The load balancing service returns Certificate, which contains the certificate;

[0034] Step S1.4: The load balancing service returns ServerHelloDone, and the load balancing service task at this stage is completed;

[0035] Step S1.5: The client sends ClientKeyExchange;

[0036] Step S1.6: The client sends ChangeCipherSpec;

[0037] Step S1.7: The client sends Finished to verify the entire connection process;

[0038] Step S1.8: The load balancing service sends ChangeCipherSpec; the load balancing service notifies the client that subsequent messages will be encrypted and sent using the negotiated symmetric encryption key;

[0039] Step S1.9: The load balancing service sends Finished to verify the entire connection process.

[0040] As a preferred implementation scheme of the present invention, the certificate in step S1.3 includes a certificate public key.

[0041] As a preferred implementation scheme described in the present invention, the load balancing service detects whether the user has configured a private key. If the private key is configured, the TLS handshake follows the traditional process; if the user has not configured a private key and has configured the address of the dtcs server, it enters the no-private-key mode.

[0042] As a preferred implementation scheme of the present invention, the load balancing service will not store the certificate private key in any form in its environment.

[0043] As a preferred implementation scheme of the present invention, the tasklet processing function sends the uninstallation mode, key negotiation algorithm, key type and encryption data to the dtcs server, and the uninstallation mode here is the security mode.

[0044] As a preferred implementation scheme described in the present invention, the detailed steps of step S1.5 are as follows: the client generates a pre-master key through a random number generator, and then uses the load balancing certificate public key to perform public key encryption on the pre-master key, and sends the encrypted information to the load balancing service; the client calculates the master key based on the client random number, the server random number and the pre-master key, and further calculates the symmetric encryption key; after the load balancing service receives the ClientKeyExchange, it triggers the tasklet processing function, and sends the unloading mode, key negotiation algorithm, key type and encrypted data to the dtcs server service. After obtaining the data, the dtcs server uses the certificate private key to perform public key decryption on the encrypted data to obtain the pre-master key, and then calculates the master key based on the client random number, the server random number and the pre-master key, and further calculates the symmetric encryption key, and returns it to the tasklet processing function.

[0045] As a preferred implementation scheme of the present invention, in step S1.6, the client notifies the load balancing service that subsequent messages are sent encrypted using a negotiated symmetric encryption key.

[0046] As a preferred implementation scheme described in the present invention, after the load balancing service receives the ClientKeyExchange, the tasklet processing function is triggered to send the offloading mode, key negotiation algorithm, key type and encrypted data to the dtcsserver service; after the dtcs server receives the data, if the offloading mode is the security mode, the pre-master key is calculated according to the key negotiation algorithm and key type.

[0047] As a preferred implementation scheme described in the present invention, the tasklet processing function sends data to the dtcsserver through the TLS protocol. In order to avoid circular calls, the tasklet processing function needs to determine the private key type and select an algorithm suite different from the algorithm suite negotiated in step S1.2 to establish a TLS connection with the dtcs server.

[0048] Compared with the prior art, the present invention has the following beneficial effects:

[0049] The present invention solves the problem that the dispersion of user private keys in the cloud environment increases the risk of certificate private key leakage. With this method, users no longer need to upload certificate private keys to the cloud environment, and only need to provide encryption services in a certain Internet access location that users trust. On the one hand, it avoids the risk of private key leakage, and on the other hand, it is convenient for users to manage certificate private keys. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention.

[0051] Figure 1 is a flow chart of the method of the present invention;

[0052] Figure 2 An architectural diagram of components involved in the method of the present invention;

[0053] Figure 3 This is a flow chart of steps S5 to 11 of the present invention. DETAILED DESCRIPTION

[0054] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0055] See also Figure 1-3 In order to achieve the above-mentioned purpose, the present invention describes the technical scheme of the present invention in detail.

[0056] The present invention proposes a solution for TLS handshake without private key, and the steps of the method are as follows:

[0057] Step S1: When the load balancing service is started, the certificate and certificate private key are loaded and checked for matching; the no-private-key mode is set, and the service is started through the TLS protocol without the user having to upload the certificate private key. The certificate private key is not loaded at startup, and the certificate and certificate private key are not verified for matching;

[0058] Step S2: Make the encryption operation asynchronous and modify the load balancing service to support OpenSSL Async mode;

[0059] Step S3: Write a dtcs engine and deploy it in the environment where the load balancing service is located. The dtcs engine registers the tasklet processing function. When the tasklet processing function is triggered, it initiates a private key encryption request to the dtcs server.

[0060] Step S4: Write a dtcs server, which is deployed by the user in an environment that the user trusts. The dtcs engine will interact with the dtcs server through the Internet.

[0061] Step S5: The client performs a TLS handshake with the load balancer, and the load balancer calls the method provided by OpenSSL to perform a TLS handshake with the client; this method will eventually call the RSA private key decryption algorithm implemented by the dtcs engine to replace the default RSA private key decryption algorithm;

[0062] Step S6: The RSA private key decryption algorithm implemented by the dtcs engine will trigger the tasklet processing function registered in step 3 and initiate a request to the dtcs server; and the RSA private key decryption algorithm implemented by the dtcs engine will be returned immediately;

[0063] Step S7: Since the load balancing has been modified in step S2 to support OpenSSL Async mode, steps S5 and S6 are performed in an ASYNC_JOB coroutine. After the coroutine obtains the return, the context switch is performed to suspend the current task.

[0064] Step S8: Since the current task is suspended, the method provided by OpenSSL will return the error status code SSL_ERROR_WANT_ASYNC to the load balancing, indicating that the current mode is Async mode and the load balancing should continue with the following steps;

[0065] Step S9: the load balancing service obtains the error status code SSL_ERROR_WANT_ASYNC and registers a file descriptor associated with the TLS connection;

[0066] Step S10: The load balancing service monitors the arrival of events on the file descriptor through epoll.

[0067] Step S11: Continuing from step S6, after receiving the request of the tasklet processing function, the dtcs server searches for the corresponding certificate private key, performs RSA private key decryption operation on the data, and returns the operation result;

[0068] Step S12: After the tasklet processing function obtains the response, it writes the result into the shared memory and transmits the processing completion notification from the dtcs engine to the load balancing service through the file descriptor;

[0069] Step S13: The load balancing service detects that the state of the file descriptor has changed, and calls the method provided by OpenSSL again to make the ASYNC_JOB that was dormant in step S5 run again, and read and process data from the shared memory.

[0070] Furthermore, the steps for starting the TLS protocol without the user uploading the certificate private key in step S1 are as follows:

[0071] Step S1.1: The client sends ClientHello to the load balancing server. The client initiates a connection request and sends the list of algorithms it supports and the client random number to the load balancing server.

[0072] Step S1.2: The load balancer returns ServerHello, and the load balancer sends a selected encryption algorithm and a server random number to the client;

[0073] Step S1.3: The load balancer returns Certificate, which contains the certificate;

[0074] Step S1.4: The load balancing returns ServerHelloDone, and the load balancing task is completed;

[0075] Step S1.5: The client sends ClientKeyExchange;

[0076] Step S1.6: The client sends ChangeCipherSpec;

[0077] Step S1.7: The client sends Finished to verify the entire connection process;

[0078] Step S1.8: The load balancer sends ChangeCipherSpec; the load balancer notifies the client that subsequent messages will be encrypted and sent using the negotiated symmetric encryption key;

[0079] Step S1.9: The load balancer sends Finished to verify the entire connection process.

[0080] Furthermore, the certificate in step S1.3 includes a certificate public key.

[0081] Furthermore, the load balancing service detects whether the user has configured a private key. If a private key is configured, the TLS handshake follows the traditional process; if the user has not configured a private key and has configured the address of the dtcs server, it enters the no-private-key mode.

[0082] Furthermore, the load balancing service will not store the certificate private key in any form in its environment.

[0083] Furthermore, the tasklet processing function sends the uninstallation mode, key negotiation algorithm, key type and encryption data to the dtcs server, and the uninstallation mode here is the security mode.

[0084] Furthermore, the detailed steps of step S1.5 are as follows: the client generates a pre-master key through a random number generator, and then uses the load balancing certificate public key to perform public key encryption on the pre-master key, and sends the encrypted information to the load balancing; the client calculates the master key based on the client random number, the server random number and the pre-master key, and further calculates the symmetric encryption key; after the load balancing receives the ClientKeyExchange, it triggers the tasklet processing function, and sends the unloading mode, key negotiation algorithm, key type and encrypted data to the dtcs server service. After obtaining the data, the dtcs server uses the certificate private key to perform public key decryption on the encrypted data to obtain the pre-master key, and then calculates the master key based on the client random number, the server random number and the pre-master key, and further calculates the symmetric encryption key, and returns it to the tasklet processing function.

[0085] Furthermore, in step S1.6, the client notifies the load balancer that subsequent messages are sent encrypted using the negotiated symmetric encryption key.

[0086] Furthermore, after the load balancing receives the ClientKeyExchange, the tasklet processing function is triggered to send the offloading mode, key negotiation algorithm, key type and encrypted data to the dtcs server service; after the dtcs server receives the data, if the offloading mode is the security mode, the pre-master key is calculated according to the key negotiation algorithm and key type.

[0087] Furthermore, the tasklet processing function sends data to the dtcs server through the TLS protocol. In order to avoid circular calls, the tasklet processing function needs to determine the private key type, select an algorithm suite different from the algorithm suite negotiated in step S1.2, and establish a TLS connection with the dtcs server.

[0088] The embodiments are described below with reference to the accompanying drawings.

[0089] Step S1: Load the certificate and certificate private key when the load balancing starts and check whether they match. Here, a no private key mode is added, which does not load the certificate private key when starting, and does not verify whether the certificate and certificate private key match;

[0090] Step S2: Make the encryption operation asynchronous and modify the load balancing service to support OpenSSL Async mode;

[0091] Step S3: Figure 2 As shown in the dtcs engine component, you need to write a dtcs engine and deploy it in the environment where the load balancing service is located. The dtcs engine registers the tasklet processing function. When the tasklet processing function is triggered (triggered during the TLS handshake process), it initiates a private key encryption request to the dtcs server;

[0092] Step S4: Figure 2 As shown in the dtcs server component, write a dtcs server, which is deployed by the user in an environment that the user trusts. The dtcs engine will interact with the dtcs server through the Internet.

[0093] Step S5: Figure 1 As shown in the TLS handshake protocol without private key, the client performs TLS handshake with the load balancer, and the load balancer calls the method provided by OpenSSL to perform TLS handshake with the client; this method will eventually call the RSA private key decryption algorithm implemented by the dtcs engine to replace the default RSA private key decryption algorithm (see Figure 3 5.3 process);

[0094] Step S6: The RSA private key decryption algorithm implemented by the dtcs engine will trigger the tasklet processing function registered in step 3 and initiate a request to the dtcs server; and the RSA private key decryption algorithm implemented by the dtcs engine will be returned immediately (see Figure 3 (see process 5.5 in the previous section);

[0095] Step S7: Since the load balancing has been modified in step 2 to support OpenSSL Async mode, steps 5 and 6 are actually performed in an ASYNC_JOB coroutine. After the coroutine gets the return, it performs context switching and suspends the current task (see Figure 3 (see process 5.6 in the previous section);

[0096] Step S8: Since the current task is suspended, the method provided by OpenSSL will return the error status code SSL_ERROR_WANT_ASYNC to the load balancing, indicating that the current mode is Async mode and the load balancing should continue with the following steps;

[0097] Step S9: After the load balancing service obtains the error status code SSL_ERROR_WANT_ASYNC, it registers a file descriptor associated with the TLS connection (see Figure 3 5.5 and 6 of the Regulations);

[0098] Step S10: The load balancing service monitors the arrival of events on the file descriptor through epoll (see Figure 3 7 in the process).

[0099] Step S11: Continuing from step 6, after receiving the request of the tasklet processing function, the dtcs server searches for the corresponding certificate private key, performs RSA private key decryption operation on the data, and returns the operation result (see Figure 3 (process 9 in the above);

[0100] Step S12: After the tasklet processing function obtains the response, it writes the result into the shared memory and transmits the processing completion notification from the dtcs engine to the load balancing service through the file descriptor (see Figure 3 (process 10 in the above);

[0101] Step S13: The load balancing service detects that the file descriptor state has changed, and calls the method provided by OpenSSL again to make the ASYNC_JOB that was dormant in step 5 run again, read and process data from the shared memory (see Figure 3 11th process).

[0102] The processor takes out instructions from the memory one by one, analyzes the instructions, and then completes the corresponding operations according to the instruction requirements, generating a series of control commands, so that the various parts of the computer can automatically, continuously and coordinately move to become an organic whole, realize the input of programs, the input of data, and the calculation and output of results. The arithmetic operations or logical operations generated in this process are all completed by the operator; the memory includes a read-only memory (ROM), which is used to store computer programs, and a protection device is provided outside the memory.

[0103] Exemplarily, the computer program may be divided into one or more modules, one or more modules are stored in a memory and executed by a processor to implement the present invention. One or more modules may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program in a terminal device.

[0104] Those skilled in the art will understand that the description of the above service equipment is merely an example and does not constitute a limitation on the terminal equipment. It may include more or fewer components than described above, or a combination of certain components, or different components, for example, it may include input and output devices, network access devices, buses, etc.

[0105] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire user terminal.

[0106] The memory can be used to store computer programs and / or modules. The processor can realize various functions of the terminal device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as an information collection template display function, a product information release function, etc.); the data storage area can store data created according to the use of the berth status display system (such as product information collection templates corresponding to different product types, product information that different product providers need to release, etc.). In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0107] If the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the modules / units in the above-mentioned embodiment system, and can also be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can realize the functions of the above-mentioned various system embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.

[0108] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0109] The above is a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent replacement and improvement made within the principle and implementation scope of the present invention shall be included in the protection scope of the present invention.

[0110] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0111] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A solution for TLS handshake without private key, characterized in that: The method steps are as follows: Step S1: When the load balancing service is started, the certificate and certificate private key are loaded and checked for matching; the no-private-key mode is set, and the service is started through the TLS protocol without the user having to upload the certificate private key. The certificate private key is not loaded at startup, and the certificate and certificate private key are not verified for matching; Step S2: Make the encryption operation asynchronous and modify the load balancing service to support OpenSSL Async mode; Step S3: Write a dtcs engine and deploy it in the environment where the load balancing service is located. The dtcs engine registers the tasklet processing function. When the tasklet processing function is triggered, it initiates a private key encryption request to the dtcs server. Step S4: Write a dtcs server, which is deployed by the user in an environment that the user trusts. The dtcs engine will interact with the dtcs server through the Internet. Step S5: The client performs a TLS handshake with the load balancing service, and the load balancing service performs a TLS handshake with the client based on OpenSSL; the RSA private key decryption algorithm implemented by the dtcs engine is called to replace the default RSA private key decryption algorithm; Step S6: The RSA private key decryption algorithm implemented by the dtcs engine will trigger the tasklet processing function registered in step 3 and initiate a request to the dtcs server; and the RSA private key decryption algorithm implemented by the dtcs engine will be returned immediately; Step S7: Based on the load balancing service supporting OpenSSL Async mode, steps S5 and S6 are performed in an ASYNC_JOB coroutine. After the coroutine obtains the return, the context switch is performed and the current task is suspended; Step S8: Based on OpenSSL, an error status code SSL_ERROR_WANT_ASYNC is returned to the load balancing service, indicating that the current mode is Async mode, and the load balancing service continues to perform the following steps; Step S9: the load balancing service obtains the error status code SSL_ERROR_WANT_ASYNC and registers a file descriptor associated with the TLS connection; Step S10: The load balancing service monitors the arrival of events on the file descriptor through epoll. Step S11: Continuing from step S6, after receiving the request of the tasklet processing function, the dtcs server searches for the corresponding certificate private key, performs RSA private key decryption operation on the data, and returns the operation result; Step S12: After the tasklet processing function obtains the response, it writes the result into the shared memory and transmits the processing completion notification from the dtcs engine to the load balancing service through the file descriptor; Step S13: The load balancing service detects that the state of the file descriptor has changed, and based on OpenSSL, the ASYNC_JOB of step S5 is run again to read and process data from the shared memory.

2. A method for solving the TLS handshake problem without a private key according to claim 1, characterized in that: The steps for starting the TLS protocol without the user uploading a certificate private key in step S1 are as follows: Step S1.1: The client sends ClientHello to the load balancing service. The client initiates a connection request and sends the list of algorithms it supports and the client random number to the load balancing service. Step S1.2: The load balancing service returns ServerHello, and the load balancing service sends a selected encryption algorithm and a server random number to the client; Step S1.3: The load balancing service returns Certificate, which contains the certificate; Step S1.4: The load balancing service returns ServerHelloDone, and the load balancing service task at this stage is completed; Step S1.5: The client sends ClientKeyExchange; Step S1.6: The client sends ChangeCipherSpec; Step S1.7: The client sends Finished to verify the entire connection process; Step S1.8: The load balancing service sends ChangeCipherSpec; the load balancing service notifies the client that subsequent messages will be encrypted and sent using the negotiated symmetric encryption key; Step S1.9: The load balancing service sends Finished to verify the entire connection process.

3. A method for solving the TLS handshake problem without a private key according to claim 2, characterized in that: The certificate in step S1.3 includes the certificate public key.

4. A method for solving the TLS handshake problem without a private key according to claim 3, characterized in that: The load balancing service detects whether the user has configured a private key. If the user has not configured a private key and has configured the address of the dtcs server, it enters the no-private-key mode.

5. A method for solving the TLS handshake problem without a private key according to claim 4, characterized in that: The load balancing service does not store the certificate private key in any form in its environment.

6. A method for solving the TLS handshake problem without a private key according to claim 5, characterized in that: The tasklet processing function sends the uninstallation mode, key negotiation algorithm, key type and encrypted data to the dtcs server, and the uninstallation mode is a safe mode.

7. A method for solving the TLS handshake problem without a private key according to claim 6, characterized in that: Step S1.5 is as follows: the client generates a pre-master key through a random number generator, and then uses the public key of the load balancing certificate to encrypt the pre-master key, and sends the encrypted information to the load balancing service; the client calculates the master key based on the client random number, the server random number and the pre-master key, and further calculates the symmetric encryption key; After the load balancing service receives the ClientKeyExchange, it triggers the tasklet processing function and sends the offload mode, key negotiation algorithm, key type and encrypted data to the dtcs server service. After obtaining the data, the dtcs server uses the certificate private key to decrypt the encrypted data with the public key to obtain the pre-master key, and then calculates the master key based on the client random number, the server random number and the pre-master key, and further calculates the symmetric encryption key and returns it to the tasklet processing function.

8. A method for solving the TLS handshake problem without a private key according to claim 7, characterized in that: In step S1.6, the client notifies the load balancing service that subsequent messages are sent encrypted using the negotiated symmetric encryption key.

9. A method for solving the TLS handshake problem without a private key according to claim 8, characterized in that: After the load balancing service receives ClientKeyExchange, it triggers the tasklet processing function and sends the offload mode, key negotiation algorithm, key type and encrypted data to the dtcs server service; after the dtcs server receives the data, if the offload mode is the security mode, it calculates the pre-master key based on the key negotiation algorithm and key type.

10. A method for solving the TLS handshake problem without a private key according to claim 9, characterized in that: The tasklet processing function sends data to the dtcs server through the TLS protocol. The tasklet processing function determines the private key type, selects an encryption algorithm different from the encryption algorithm negotiated in step S1.2, and establishes a TLS connection with the dtcs server.