Method and device for sending ciphertext, system, storage medium, and electronic device
By concurrent multiple connection requests and a pre-generated pre-master key pair list, the problem of low performance testing of AAA server is solved, high concurrency testing with low overhead is achieved, client hardware requirements are reduced, and processing performance is improved.
Patent Information
- Application Number
- CN202110134317.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-28
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-01-28
Smart Images

Figure CN114826637B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communications, and in particular, to a method and device for sending ciphertext, a system, a storage medium, and an electronic device. Background Art
[0002] In the related technology, communication systems that use AAA (Authentication, Authorization, Accounting) servers for authentication include but are not limited to WLAN (Wireless Local Area Network), websites that use https (Hyper Text Transfer Protocol over Secure Socket Layer) protocol to communicate, systems that use SSH (Secure Shell) to communicate, and communication systems that use TLS (Transport Layer Security) / SSL (Secure Sockets Layer) encryption protocols. Summary of the invention
[0003] When performing performance stress testing on AAA servers or servers with similar functions, the authentication process usually requires too high hardware requirements on the test client, so AAA authentication is usually turned off or bypassed for testing, and stress testing on the AAA server is missing. When performing DDoS (Distributed denial of service attack) attack security testing on AAA servers, a large number of test machines are often required for testing, resulting in a waste of test resources and low test efficiency.
[0004] The embodiments of the present disclosure provide a method and device for sending ciphertext, a system, a storage medium, and an electronic device to solve the technical problem of low performance efficiency of a related technical test server.
[0005] According to one aspect of an embodiment of the present disclosure, a method for sending a ciphertext is provided, comprising: concurrently sending multiple first connection request messages to a target server, wherein each of the first connection request messages is used to establish a virtual connection link between a client and the target server; selecting multiple pairs of pre-master keys from a preset pre-master key pair list, wherein each pair of pre-master keys in the preset pre-master key pair list includes a pre-master key plaintext and a pre-master key ciphertext; after receiving a first handshake message from the target server, correspondingly sending the pre-master key ciphertexts in the multiple pairs of the pre-master keys to the target server on the multiple virtual connection links.
[0006] Furthermore, before sending a plurality of first connection request messages to the target server concurrently, the method further includes: generating the preset pre-master key pair list by preprocessing.
[0007] Further, the generation of the preset pre-master key pair list through preprocessing includes: sending a second connection request message to the target server during a first handshake process; receiving a second handshake message returned by the target server during a second handshake process, wherein the second handshake message carries a public key; and generating the preset pre-master key pair list based on the public key.
[0008] Further, generating the preset pre-master key pair list based on the public key includes: obtaining multiple groups of random numbers; generating a pre-master key plaintext for each group of random numbers, and encrypting the pre-master key plaintext with the public key to obtain a pre-master key ciphertext; saving the pre-master key plaintext and the pre-master key ciphertext in pairs to obtain the preset pre-master key pair list.
[0009] Furthermore, after selecting a plurality of pairs of pre-master keys from the preset pre-master key pair list, the method further comprises: for each virtual connection link, generating a data key using a pre-master key plaintext corresponding to the pre-master key ciphertext.
[0010] Further, the use of the pre-master key plaintext corresponding to the pre-master key ciphertext to generate the data key includes: reading a first random number and a second random number, and reading a pre-master key plaintext corresponding to the pre-master key ciphertext, wherein the first random number is the random number carried in the first connection request message, and the second random number is the random number carried in the first handshake message returned by the target server during the second handshake process of the current handshake cycle; splicing the first random number, the second random number and the pre-master key plaintext to generate the data key.
[0011] Further, the selecting of multiple pairs of pre-master keys in the preset pre-master key pair list includes: if the number of the virtual connection links is greater than the number of pre-master key pairs in the preset pre-master key pair list, cyclically reading the multiple pairs of pre-master keys in the preset pre-master key pair list until the number of pre-master key pairs retrieved is the same as the number of the virtual connection links.
[0012] According to another aspect of an embodiment of the present disclosure, a ciphertext sending device is provided, comprising: a concurrent module, used to concurrently send multiple first connection request messages to a target server, wherein each first connection request message is used to establish a virtual connection link between a client and the target server; a selection module, used to select multiple pairs of pre-master keys in a preset pre-master key pair list, wherein each pair of pre-master keys in the preset pre-master key pair list includes a pre-master key plaintext and a pre-master key ciphertext; and a sending module, used to send the pre-master key ciphertexts in the multiple pairs of the pre-master keys to the target server on the multiple virtual connection links after receiving a first handshake message from the target server.
[0013] Furthermore, the above-mentioned device also includes: a preprocessing module, which is used to generate the preset pre-master key pair list through preprocessing before the concurrent module sends multiple first connection request messages to the target server concurrently.
[0014] Further, the preprocessing module includes: a sending unit, used to send a second connection request message to the target server during the first handshake process before the selection module selects multiple pairs of pre-master keys in the preset pre-master key pair list; a receiving unit, used to receive a second handshake message returned by the target server during the second handshake process, wherein the second handshake message carries a public key; and a generating unit, used to generate the preset pre-master key pair list based on the public key.
[0015] Furthermore, the above-mentioned generation unit includes: a first generation subunit, used to generate multiple groups of random numbers during the third handshake process; a second generation subunit, used to generate a pre-master key plaintext for each group of the above-mentioned random numbers, and use the above-mentioned public key to encrypt the above-mentioned pre-master key plaintext to obtain the pre-master key ciphertext; a storage subunit, used to save the above-mentioned pre-master key plaintext and the above-mentioned pre-master key ciphertext in pairs to obtain the above-mentioned preset pre-master key pair list.
[0016] Furthermore, the above-mentioned device also includes: a generating module, which is used to generate a data key for each virtual connection link using the pre-master key plaintext corresponding to the pre-master key ciphertext after the above-mentioned selecting module selects multiple pairs of pre-master keys in the preset pre-master key pair list.
[0017] Furthermore, the above-mentioned generation module includes: a reading unit, used to read a first random number and a second random number, and read a pre-master key plaintext corresponding to the above-mentioned pre-master key ciphertext, wherein the first random number is a random number carried in the above-mentioned first connection request message, and the above-mentioned second random number is a random number carried in the first handshake message returned by the above-mentioned target server during the second handshake process of the current handshake cycle; a splicing unit, used to splice the above-mentioned first random number, the above-mentioned second random number, and the above-mentioned pre-master key plaintext to generate a data key.
[0018] Furthermore, the selection module includes: a reading unit, which is used to cyclically read the multiple pairs of pre-master keys in the preset pre-master key pair list if the number of the virtual connection links is greater than the number of pre-master key pairs in the preset pre-master key pair list until the number of pre-master key pairs retrieved is the same as the number of the virtual connection links.
[0019] According to another aspect of an embodiment of the present disclosure, a ciphertext sending system is also provided, including a server and a client, wherein the client includes a device for executing the scheme described in the above embodiment; the server is used to establish a virtual connection link with the client for each of the first connection request messages after receiving multiple first connection request messages sent by the client, and receive the pre-master key ciphertext sent by the client.
[0020] According to another aspect of an embodiment of the present disclosure, a storage medium is further provided, the storage medium including a stored program, and the above steps are executed when the program is run.
[0021] According to another aspect of an embodiment of the present disclosure, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: the memory is used to store computer programs; the processor is used to execute the steps in the above method by running the program stored in the memory.
[0022] The embodiment of the present disclosure also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.
[0023] Through the present disclosure, multiple first connection request messages are sent to the target server concurrently, multiple pairs of pre-master keys are selected from a preset pre-master key pair list, and after receiving the first handshake message of the target server, pre-master key ciphertexts in the multiple pairs of pre-master keys are correspondingly sent to the target server on multiple virtual connection links. During the handshake process, multiple pairs of pre-master keys are selected from the preset pre-master key pair list, and multiple pairs of pre-generated pre-master key plaintexts and pre-master key ciphertexts can be read simultaneously during one handshake process, which is equivalent to achieving the effect of multiple clients connecting to the target server at the same time on one client, providing a low-overhead server performance testing solution, solving the technical problem of low efficiency in testing server performance in related technologies, avoiding the steps of the client generating random numbers and encrypting the generated pre-master key ciphertext in real time during the test process, reducing the client's resource overhead, greatly improving the client's processing performance, and reducing the client's hardware requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The illustrative embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation on the present disclosure. In the drawings:
[0025] Figure 1 is a hardware structure block diagram of a computer according to an embodiment of the present disclosure;
[0026] Figure 2 is a flow chart of a method for sending ciphertext according to an embodiment of the present disclosure;
[0027] Figure 3 is an interactive schematic diagram of an embodiment of the present disclosure;
[0028] Figure 4 is a schematic diagram of concurrent testing performed in an embodiment of the present disclosure;
[0029] Figure 5 is a structural block diagram of a ciphertext sending device according to an embodiment of the present disclosure;
[0030] Figure 6 is a structural block diagram of a ciphertext sending system according to an embodiment of the present disclosure;
[0031] Figure 7 It is a structural block diagram of an electronic device implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the scheme of the present disclosure, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only embodiments of a part of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present disclosure. It should be noted that the embodiments in the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0034] Example 1
[0035] The method embodiment provided in the first embodiment of the present disclosure can be executed in a server, a computer, a mobile phone, a tablet or a similar communication device. For example, running on a computer, Figure 1 is a hardware structure block diagram of a computer according to an embodiment of the present disclosure. Figure 1 As shown, the computer may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microcontroller unit (MCU) or a programmable logic device (Field Programmable Gate Array, FPGA)) and a memory 104 for storing data. Optionally, the computer may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0036] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for sending a ciphertext in an embodiment of the present disclosure. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0037] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0038] In this embodiment, a method for sending a ciphertext is provided, which can be applied to a client. Figure 2 is a flow chart of a method for sending ciphertext according to an embodiment of the present disclosure, such as Figure 2 As shown, the process includes the following steps:
[0039] Step S202, sending multiple first connection request messages to the target server concurrently, wherein each first connection request message is used to establish a virtual connection link between the client and the target server;
[0040] Optionally, the first connection request message is a connection request message sent during the first handshake in the three-way handshake process, such as a Client hello message. By sending multiple first connection request messages concurrently, the client can simultaneously establish or maintain multiple virtual connection links with the target server.
[0041] Step S204, selecting multiple pairs of pre-master keys in the preset pre-master key pair list, wherein each pair of pre-master keys in the preset pre-master key pair list includes a pre-master key plaintext and a pre-master key ciphertext;
[0042] The preset pre-master key pair list of this embodiment is data pre-stored locally. The preset pre-master key pair list is stored according to data combinations. Each data combination is a pair of pre-master keys, including a pre-master key plaintext and a pre-master key ciphertext. The pre-master key plaintext and the pre-master key ciphertext in each data combination match each other.
[0043] Step S206, after receiving the first handshake message from the target server, the pre-master key ciphertexts in the plurality of pairs of pre-master keys are sent to the target server on the plurality of virtual connection links, wherein each virtual connection link corresponds to a pre-master key ciphertext.
[0044] Optionally, the pre-master key ciphertext is carried in a handshake confirmation message sent during the third handshake in the three-way handshake process, such as a Client key exchange message.
[0045] Through the above steps, multiple first connection request messages are sent to the target server concurrently, multiple pairs of pre-master keys are selected from the preset pre-master key pair list, and after receiving the first handshake message from the target server, the pre-master key ciphertexts in the multiple pairs of pre-master keys are correspondingly sent to the target server on the multiple virtual connection links. During the handshake process, multiple pairs of pre-master keys are selected from the preset pre-master key pair list, and multiple pairs of pre-generated pre-master key plaintexts and pre-master key ciphertexts can be read simultaneously during one handshake process, which is equivalent to achieving the effect of multiple clients connecting to the target server at the same time on one client, providing a low-overhead server performance testing solution, solving the technical problem of low efficiency in testing server performance in related technologies, avoiding the steps of the client generating random numbers and encrypting the pre-master key ciphertext in real time during the test process, reducing the client's resource overhead, greatly improving the client's processing performance, and reducing the client's hardware requirements.
[0046] Figure 3 It is an interactive diagram of an embodiment of the present disclosure. The network architecture includes a client and a server. Before the client formally establishes a network connection with the server each time, it needs to perform three interactive verifications, including a connection request message sent in the first handshake, such as Client hello, a handshake message sent in the second handshake, such as Server hello, and a handshake confirmation message sent in the third handshake, such as Client key exchange, that is, a three-way handshake. After completing the three-way handshake, the client and the server start to transmit business data. The link before the three-way handshake is completed is a virtual connection link. Among them, the server can be an AAA server, a firewall server, a security server, a business server, etc., and the client can be any business terminal that can access the network, such as a mobile phone, a computer, a test device, etc.
[0047] Based on the network architecture of this embodiment, during the three-way handshake process, each handshake will generate a random number, and finally the final key is generated by these three random numbers. The first two random numbers are exchanged in plain text. Only during the third handshake, the random number generated by the client needs to be encrypted with the server's public key and sent to the server. It is this encryption process that limits the client's processing performance and makes it difficult to initiate multiple client connection requests at the same time with high concurrency.
[0048] In one implementation of this embodiment, a preset pre-master key pair list can be generated by performing a three-way handshake process with the target server in advance. Of course, the preset pre-master key pair list can also be read from the historical connection record of the client. In one example, before selecting multiple pairs of pre-master keys in the preset pre-master key pair list, it also includes: generating the preset pre-master key pair list by preprocessing. Optionally, generating the preset pre-master key pair list by preprocessing includes:
[0049] S11, sending a second connection request message to the target server during the first handshake process;
[0050] S12, receiving a second handshake message returned by the target server during the second handshake process, wherein the second handshake message carries the public key;
[0051] S13, generating a preset pre-master key pair list based on the public key.
[0052] Optionally, generating a preset pre-master key pair list based on the public key includes: obtaining multiple groups of random numbers; generating a pre-master key plaintext for each group of random numbers, and encrypting the pre-master key plaintext with the public key to obtain a pre-master key ciphertext; saving the pre-master key plaintext and the pre-master key ciphertext in pairs to obtain a preset pre-master key pair list.
[0053] In one example, the public key carried in the second handshake message is **. When the client sends a handshake confirmation message (such as Client key exchange, client key exchange message) in the third handshake, it is necessary to generate a client random number, and generate a pre-master key based on the client random number and the client protocol version number. In this embodiment, multiple client random numbers are generated in a handshake process, and multiple plaintexts and ciphertexts of pre-master keys are generated based on the multiple client random numbers. For example, three plaintexts are generated: 111, 222, 333, and the plaintexts are encrypted with ** to generate pre-master key ciphertexts, corresponding to: aaa, bbb, ccc, and then {111, aaa}, {222, bbb}, {333, ccc} are stored locally in pairs. When the next three-way handshake is performed, such as when concurrent performance testing is performed on the target server, multiple plaintexts and ciphertexts of pre-master keys can be used simultaneously, without temporarily generating multiple client random numbers, so as to implement concurrent testing of the target server with a lower amount of resources.
[0054] In an implementation of this embodiment, after selecting multiple pairs of pre-master keys in the preset pre-master key pair list, the method further includes: for each virtual connection link, using the pre-master key plaintext corresponding to the pre-master key ciphertext to generate a data key.
[0055] In this embodiment, the data key is used to encrypt business data after the network connection between the client and the target server is established, and the encrypted data is transmitted between the client and the target server.
[0056] Based on the above implementation, generating a data key using a pre-master key plaintext corresponding to a pre-master key ciphertext includes: reading a first random number and a second random number, and reading a pre-master key plaintext corresponding to the pre-master key ciphertext, wherein the first random number is a random number carried in a first connection request message, and the second random number is a random number carried in a first handshake message returned by the target server during a second handshake in a current handshake cycle; and concatenating the first random number, the second random number, and the pre-master key plaintext to generate a data key.
[0057] In an example, the first random number and the second random number are 123 and 456 respectively. Three virtual connections are established between the client and the target server, namely link 1, link 2, and link 3. For link 1, {111, aaa} is assigned. When sending Client key exchange in the third handshake, aaa is taken out from {111, aaa} as the pre-master key ciphertext and sent to the target server. 111123456 (111+123+456) is the data key. In addition, the pre-master key ciphertext and data key of link 2 are bbb and 222123456 respectively, and the pre-master key ciphertext and data key of link 3 are ccc and 333123456 respectively.
[0058] Figure 4 It is a schematic diagram of concurrent testing of an embodiment of the present disclosure. In three concurrent virtual connection links, when the Client key exchange is sent in the third handshake, the pre-master key ciphertexts carried are aaa, bbb, ccc, respectively. The data keys spliced out locally by the test client based on the corresponding pre-master key plaintexts are 111123456, 222123456, 333123456, respectively.
[0059] On the target server side, since the first random number and the second random number are respectively stored in the Client hello message and the Server hello message in the first handshake and the second handshake process, the target server can also obtain the first random number and the second random number through the message record, and obtain the corresponding pre-master key plaintext by decrypting the pre-master key ciphertext, and then splice the same data key as the client to realize encrypted data transmission between the client and the target server.
[0060] In one implementation of the present embodiment, selecting multiple pairs of pre-master keys in a preset pre-master key pair list includes: if the number of virtual connection links is greater than the number of items in the preset pre-master key pair list, cyclically reading multiple pairs of pre-master keys in the preset pre-master key pair list until the number of pairs of pre-master keys retrieved is the same as the number of virtual connection links.
[0061] By adopting the circular reading method, the difference between the pre-master key ciphertexts used by multiple virtual links can be maximized, preventing the target server from blacklisting the client due to concurrent use of multiple identical pre-master key ciphertexts, and restoring the real business scenario to the greatest extent. Optionally, in addition to circular reading, random reading can also be used.
[0062] In an example, the number of virtual links is 5, and the number of items in the preset pre-master key pair list is 3, namely {111, aaa}, {222, bbb}, {333, ccc}. By cyclic reading, 5 pairs of pre-master keys are obtained, namely {111, aaa}, {222, bbb}, {333, ccc}, {111, aaa}, {222, bbb}.
[0063] In a test scenario of this embodiment, multiple sets of pre-generated random numbers are used, which are pre-encrypted using the public key of the server, and the random numbers and the encrypted data (pre-set pre-master key pair list) are saved. After starting the performance test, the test device cyclically uses this set of pre-processed data to interact with the server. The number of random numbers can be set to be greater than the number of historical random numbers cached by the AAA server to prevent replay attacks. The scheme of the embodiment is fully described here in conjunction with this test scenario:
[0064] In the relevant TLS three-way handshake protocol, a random number is generated during each handshake. This test scenario optimizes the process of generating pre_master_secret (pre-master key) during the third handshake (sending Client key exchange). The relevant TLS protocol stipulates that pre_master_secret consists of a 2-byte client protocol version number and a 46-byte random number generated by the client. The Server hello message sent by the server to the client contains the server's public key. The test process includes:
[0065] Step 1: Generate pre_master_secret plaintext and pre_master_secret ciphertext in pairs in advance.
[0066] In step 1.1, the test device sends a Client hello request message to the server, which includes the random number client_random generated by the test device.
[0067] In step 1.2, the server sends a Server hello message to the test device, which includes the server's public key and the random number server_random generated by the server. After the test device receives the public key in the Server hello message, it saves the public key.
[0068] In step 1.3, the test device generates a new 46-byte random number and forms a 48-byte pre_master_secret (pre-master key) with the 2-byte client protocol version number. Then, the server public key obtained in step 1.2 is used to encrypt the pre_master_secret to obtain the pre_master_secret ciphertext. The pre_master_secret plaintext and pre_master_secret ciphertext are saved in pairs, and the saved format is (pre_master_secret plaintext, pre_master_secret ciphertext).
[0069] In step 1.4, repeatedly execute step 1.3 to generate multiple pairs of (pre_master_secret plaintext, pre_master_secret ciphertext), obtain the preset pre-master key pair list, and save it locally. The specific number is set according to the test needs.
[0070] Step 2: Use the pre-generated preset pre-master key to perform a high-concurrency performance test on the list.
[0071] In step 2.1, the test device generates a large number of connection requests at high concurrency. The specific number of connections is set according to different test requirements. Each connection request continues to execute the following steps:
[0072] In step 2.2, the test device sends a Client hello request message to the server, which includes the random number generated by the test device.
[0073] In step 2.3, the server sends a Server hello message to the test device, which includes the server's public key and random number.
[0074] In step 2.4, the test device sequentially takes out a pair of (pre_master_secret plaintext, pre_master_secret ciphertext) from the preset pre-master key pair list saved in steps 1.3 and 1.4, and uses the pre_master_secret plaintext + the random number in step 2.2 + the random number in step 2.3 to generate the final data key. In addition, the test device sends the taken pre_master_secret ciphertext to the server, and after the last pair (pre_master_secret plaintext, pre_master_secret ciphertext) in the preset pre-master key pair list is taken out, it starts from the first pair again and uses it in a cycle.
[0075] After receiving the pre_master_secret ciphertext, the test server uses the private key to decrypt the pre_master_secret ciphertext to obtain the pre_master_secret plaintext, and generates a data key based on the pre_master_secret ciphertext.
[0076] In step 2.5, the test device continues to execute subsequent processes and services.
[0077] This embodiment uses pre-saved random number plaintext and server public key to generate multiple pairs of pre-master key plaintext and pre-master key ciphertext. In the subsequent handshake process, a cyclic method is used to read the pre-generated pre-master key plaintext and pre-master key ciphertext, thereby avoiding the step of real-time random number generation and encryption by the client during the test process, greatly improving the processing performance of the test device and reducing the hardware requirements of the test device.
[0078] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present disclosure.
[0079] Example 2
[0080] In this embodiment, a ciphertext sending device and system are also provided to implement the above-mentioned embodiments and preferred implementation modes, which have been described and will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0081] Figure 5 is a structural block diagram of a ciphertext sending device according to an embodiment of the present disclosure, such as Figure 5 As shown, the device includes: a concurrent module 50, a selection module 52, and a sending module 54, wherein:
[0082] A concurrent module 50, configured to concurrently send multiple first connection request messages to a target server, wherein each first connection request message is used to establish a virtual connection link between a client and the target server;
[0083] A selection module 52, configured to select a plurality of pairs of pre-master keys from a preset pre-master key pair list, wherein each pair of pre-master keys in the preset pre-master key pair list includes a pre-master key plaintext and a pre-master key ciphertext;
[0084] The sending module 54 is used to send a plurality of pairs of pre-master key ciphertexts in the pre-master key to the target server on a plurality of virtual connection links after receiving the first handshake message from the target server.
[0085] Optionally, the above-mentioned device also includes: a preprocessing module, which is used to generate the preset pre-master key pair list through preprocessing before the concurrent module sends multiple first connection request messages to the target server concurrently.
[0086] Optionally, the preprocessing module includes: a sending unit, used to send a second connection request message to the target server during the first handshake process before the selection module selects multiple pairs of pre-master keys in the preset pre-master key pair list; a receiving unit, used to receive a second handshake message returned by the target server during the second handshake process, wherein the second handshake message carries a public key; and a generating unit, used to generate the preset pre-master key pair list based on the public key.
[0087] Optionally, the above-mentioned generation unit includes: a first generation subunit, used to generate multiple groups of random numbers during the third handshake process; a second generation subunit, used to generate a pre-master key plaintext for each group of the above-mentioned random numbers, and use the above-mentioned public key to encrypt the above-mentioned pre-master key plaintext to obtain the pre-master key ciphertext; a storage subunit, used to save the above-mentioned pre-master key plaintext and the above-mentioned pre-master key ciphertext in pairs to obtain the above-mentioned preset pre-master key pair list.
[0088] Optionally, the above-mentioned device also includes: a generation module, which is used to generate a data key for each virtual connection link using the pre-master key plaintext corresponding to the pre-master key ciphertext after the above-mentioned selection module selects multiple pairs of pre-master keys in the preset pre-master key pair list.
[0089] Optionally, the above-mentioned generation module includes: a reading unit, used to read a first random number and a second random number, and read a pre-master key plaintext corresponding to the above-mentioned pre-master key ciphertext, wherein the first random number is the random number carried in the above-mentioned first connection request message, and the above-mentioned second random number is the random number carried in the first handshake message returned by the above-mentioned target server during the second handshake process of the current handshake cycle; a splicing unit, used to splice the above-mentioned first random number, the above-mentioned second random number, and the above-mentioned pre-master key plaintext to generate a data key.
[0090] Optionally, the selection module includes: a reading unit, which is used to cyclically read the multiple pairs of pre-master keys in the preset pre-master key pair list if the number of the virtual connection links is greater than the number of items in the preset pre-master key pair list until the number of pairs of pre-master keys retrieved is the same as the number of the virtual connection links.
[0091] Figure 6 is a structural block diagram of a ciphertext sending system according to an embodiment of the present disclosure, Figure 6 As shown, it includes a server 60 and a client 62, wherein the client includes the device described in the above embodiment; the server is used to establish a virtual connection link with the client for each of the first connection request messages after receiving multiple first connection request messages sent by the client, and receive the pre-master key ciphertext sent by the client.
[0092] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0093] Example 3
[0094] An embodiment of the present disclosure further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0095] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0096] S1, sending multiple first connection request messages to the target server simultaneously, wherein each of the first connection request messages is used to establish a virtual connection link between the client and the target server;
[0097] S2, selecting multiple pairs of pre-master keys from a preset pre-master key pair list, wherein each pair of pre-master keys in the preset pre-master key pair list includes a pre-master key plaintext and a pre-master key ciphertext;
[0098] S3, after receiving the first handshake message from the target server, correspondingly sending multiple pairs of pre-master key ciphertexts in the pre-master keys to the target server over multiple virtual connection links.
[0099] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0100] An embodiment of the present disclosure further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0101] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0102] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0103] S1, sending multiple first connection request messages to the target server simultaneously, wherein each of the first connection request messages is used to establish a virtual connection link between the client and the target server;
[0104] S2, selecting multiple pairs of pre-master keys from a preset pre-master key pair list, wherein each pair of pre-master keys in the preset pre-master key pair list includes a pre-master key plaintext and a pre-master key ciphertext;
[0105] S3, after receiving the first handshake message from the target server, correspondingly sending multiple pairs of pre-master key ciphertexts in the pre-master keys to the target server over multiple virtual connection links.
[0106] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0107] Figure 7 is a structural diagram of an electronic device according to an embodiment of the present disclosure, such as Figure 7 As shown, it includes a processor 71, a communication interface 72, a memory 73 and a communication bus 74, wherein the processor 71, the communication interface 72, and the memory 73 communicate with each other via the communication bus 74, the memory 73 is used to store computer programs, and the processor 71 is used to execute the programs stored in the memory 73.
[0108] The serial numbers of the above-mentioned embodiments of the present disclosure are only for description and do not represent the advantages or disadvantages of the embodiments.
[0109] In the above embodiments of the present disclosure, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0110] In the several embodiments provided in the present disclosure, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0111] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0112] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0113] If the integrated unit 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 technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0114] The above is only a preferred embodiment of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present disclosure. These improvements and modifications should also be regarded as the scope of protection of the present disclosure.
Claims
1. A method for sending ciphertext, characterized in that: include: Sending multiple first connection request messages to the target server concurrently, wherein each of the first connection request messages is used to establish a virtual connection link between the client and the target server; Selecting multiple pairs of pre-master keys from a preset pre-master key pair list, wherein each pair of pre-master keys in the preset pre-master key pair list includes a pre-master key plaintext and a pre-master key ciphertext; The selecting a plurality of pairs of pre-master keys from a preset pre-master key pair list comprises: If the number of the virtual connection links is greater than the number of pre-master key pairs in the preset pre-master key pair list, cyclically reading the multiple pairs of pre-master keys in the preset pre-master key pair list until the number of pairs of pre-master keys retrieved is the same as the number of the virtual connection links; After receiving the first handshake message from the target server, multiple pairs of pre-master key ciphertexts in the pre-master key are correspondingly sent to the target server over multiple virtual connection links.
2. The method according to claim 1, characterized in that Before sending multiple first connection request messages to the target server, the method further includes: The preset pre-master key pair list is generated through preprocessing.
3. The method according to claim 2, characterized in that The generating the preset pre-master key pair list by preprocessing comprises: Sending a second connection request message to the target server during the first handshake process; Receiving a second handshake message returned by the target server during the second handshake process, wherein the second handshake message carries a public key; The preset pre-master key pair list is generated based on the public key.
4. The method according to claim 3, characterized in that The generating the preset pre-master key pair list based on the public key comprises: Get multiple sets of random numbers; For each group of the random numbers, generate a pre-master key plaintext, and use the public key to encrypt the pre-master key plaintext to obtain a pre-master key ciphertext; The pre-master key plaintext and the pre-master key ciphertext are saved in pairs to obtain the preset pre-master key pair list.
5. The method according to claim 1, characterized in that After selecting a plurality of pairs of pre-master keys in the preset pre-master key pair list, the method further includes: For each virtual connection link, a data key is generated using the pre-master key plaintext corresponding to the pre-master key ciphertext.
6. The method according to claim 5, characterized in that The generating of the data key by using the pre-master key plaintext corresponding to the pre-master key ciphertext comprises: Reading a first random number and a second random number, and reading a pre-master key plaintext corresponding to the pre-master key ciphertext, wherein the first random number is a random number carried in the first connection request message, and the second random number is a random number carried in the first handshake message returned by the target server during the second handshake process of the current handshake cycle; The first random number, the second random number, and the pre-master key plaintext are concatenated to generate a data key.
7. A ciphertext sending device, characterized in that: include: A concurrent module, used for concurrently sending a plurality of first connection request messages to a target server, wherein each first connection request message is used for establishing a virtual connection link between a client and the target server; A selection module, configured to select a plurality of pairs of pre-master keys from a preset pre-master key pair list, wherein each pair of pre-master keys in the preset pre-master key pair list includes a pre-master key plaintext and a pre-master key ciphertext; The selecting a plurality of pairs of pre-master keys from a preset pre-master key pair list comprises: If the number of the virtual connection links is greater than the number of pre-master key pairs in the preset pre-master key pair list, cyclically reading the multiple pairs of pre-master keys in the preset pre-master key pair list until the number of pairs of pre-master keys retrieved is the same as the number of the virtual connection links; The sending module is used to send a plurality of pairs of pre-master key ciphertexts in the pre-master key to the target server on a plurality of virtual connection links after receiving the first handshake message from the target server.
8. A ciphertext sending system, characterized in that: Includes server and client, where The client comprises a device for executing any one of the method steps of claims 1 to 6; The server is used to establish a virtual connection link with the client for each of the first connection request messages after receiving multiple first connection request messages sent by the client, and receive the pre-master key ciphertext sent by the client.
9. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method steps of any one of claims 1 to 6 when running.
10. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface and the memory communicate with each other via a communication bus; wherein: Memory, used to store computer programs; A processor, configured to execute the method steps of any one of claims 1 to 6 by running a program stored in a memory.
