Data transmission method and device
By using preset compression and encryption algorithms in data transmission, combined with the shared key generated by the key exchange mechanism, the data is divided and transmitted, solving the problem of both transmission speed and security, and achieving high-speed and secure data transmission. Especially in wireless communication environments, the latency is significantly reduced and the user experience is improved.
Patent Information
- Application Number
- CN202411257605.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2024-12-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing data transmission methods are difficult to balance between speed and security. Traditional symmetric encryption technology is fast but difficult to exchange keys, while asymmetric encryption technology is high in security but high in computing complexity, resulting in slower speed in data transmission.
The preset compression algorithm is used to compress user operation instructions, encrypt the shared key generated based on the key exchange mechanism, and divide the data into multiple small pieces for transmission, combining preset encryption and decryption algorithms to ensure data security and speed.
Improve data transmission speed and security, especially in wireless communication environments, greatly reduce transmission delay, improve user experience, and verify data integrity through verification code to prevent tampering.
Smart Images

Figure CN119094211A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a data transmission method and device. Background Art
[0002] With the development of the information age, data interaction through the network occurs frequently. During the data transmission process, there are security risks that the transmitted data may be intercepted and tampered with. Therefore, the security of data transmission is particularly important.
[0003] In traditional data encryption technology, symmetric encryption technology or asymmetric encryption technology is usually used. Symmetric encryption technology requires the data sender and receiver to agree on a key in advance, and the key is used for encryption during data transmission. Asymmetric encryption technology requires a public key and a private key. The public key is public, and the private key is held by the data receiver. The data sender uses the public key for encryption, and the data receiver uses the private key for decryption. Although symmetric encryption technology has advantages in increasing data transmission speed, the secure exchange of keys is a major challenge; and although asymmetric encryption technology has better security, it is slower in data transmission due to high computational complexity.
[0004] Therefore, how to develop a data transmission method with fast transmission speed and high security has become an urgent problem to be solved. Summary of the invention
[0005] Based on this, it is necessary to provide a data transmission method and device to address the above technical issues.
[0006] In a first aspect, the present application provides a data transmission method, which is applied to a first end. The method comprises:
[0007] In response to the received user operation instruction, compress the user operation instruction using a preset compression algorithm to obtain first data;
[0008] Using a preset encryption algorithm and a shared key, encrypt the first data to obtain second data;
[0009] dividing the second data to obtain a plurality of first data blocks;
[0010] Sending each of the first data blocks to the second end;
[0011] receiving feedback information generated by the second end in response to each of the first data blocks, and parsing the feedback information for display;
[0012] The shared key is generated by the first end and the second end based on a key exchange mechanism.
[0013] In one of the embodiments, the feedback information includes a plurality of second data blocks;
[0014] The analyzing the feedback information includes:
[0015] Combining the second data blocks according to a preset structure to obtain third data;
[0016] Decrypting the third data using a preset decryption algorithm and the shared key;
[0017] The decrypted data is used as the parsing result for display.
[0018] In one embodiment, parsing the feedback information further includes:
[0019] Verifying the integrity of the third data;
[0020] If the verification is successful, the third data are decrypted.
[0021] In one embodiment, the method for determining whether the verification is successful includes:
[0022] Obtaining a check code attached to the third data; wherein the check code is generated by the second end;
[0023] A check code of the third data is calculated based on the shared key, and if the calculated check code matches the additional check code, the verification is considered successful.
[0024] In one embodiment, the first end and the second end generate a shared key based on a key exchange mechanism, including:
[0025] The first end randomly generates a first private key, and calculates a first public key according to the first private key;
[0026] The second end randomly generates a second private key, and calculates a second public key according to the second private key;
[0027] The first end sends the first public key to the second end, so that the second end obtains a shared key based on the first public key;
[0028] The second end sends the second public key to the first end, so that the first end obtains a shared key based on the second public key.
[0029] In a second aspect, the present application further provides a data transmission method, which is applied to a second end. The method comprises:
[0030] After receiving each of the first data blocks sent by the first end, decrypt each of the first data blocks using a preset decryption algorithm and a shared key;
[0031] Reorganize all the first data blocks after decryption according to a preset structure to obtain fourth data;
[0032] Decompressing the fourth data using a preset decompression algorithm to obtain an original user operation instruction;
[0033] Execute corresponding operations based on the user operation instructions and generate execution results;
[0034] Use the preset encryption algorithm and shared key to encrypt the execution results;
[0035] The encrypted execution result is sent to the first end as feedback information.
[0036] In one embodiment, the method further comprises:
[0037] Splitting the encrypted execution result to obtain a plurality of second data blocks;
[0038] Each of the second data blocks is sent to the first end as feedback information.
[0039] In one embodiment, the method further comprises:
[0040] Using a preset verification algorithm, calculating the encrypted execution result and generating a verification code;
[0041] After combining the verification code and the encrypted execution result, the result is divided to obtain a plurality of second data blocks.
[0042] In a third aspect, the present application further provides a data transmission device, which is arranged at a first end. The device comprises:
[0043] A compression module, configured to compress the user operation instruction in response to the received user operation instruction by using a preset compression algorithm to obtain first data;
[0044] A first encryption module, configured to encrypt the first data using a preset encryption algorithm and a shared key to obtain second data; wherein the shared key is generated by the first end and the second end based on a key exchange mechanism;
[0045] A first segmentation module is used to segment the second data to obtain a plurality of first data blocks.
[0046] A first transmission module, configured to send each of the first data blocks to a second end, and receive feedback information generated by the second end in response to each of the data blocks;
[0047] The parsing module is used to parse the feedback information for display.
[0048] In a fourth aspect, the present application further provides a data transmission device, which is arranged at a second end. The device comprises:
[0049] A decryption module, configured to receive each first data block sent by the first end, and decrypt each first data block using a preset decryption algorithm and a shared key;
[0050] A combining module, used for reorganizing all the decrypted first data blocks according to a preset structure to obtain fourth data;
[0051] A decompression module, used to decompress the fourth data using a preset decompression algorithm to obtain an original user operation instruction;
[0052] An execution module, used to execute corresponding operations based on the user operation instructions and generate execution results;
[0053] A second encryption module, used to encrypt the execution result using a preset encryption algorithm and a shared key;
[0054] The second transmission module is used to send the encrypted execution result as feedback information to the first end.
[0055] In a fifth aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method steps described in any one of the first aspects are implemented.
[0056] In a sixth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method steps described in any one of the first aspects are implemented.
[0057] The above data transmission method and device have at least the following advantages:
[0058] This application uses a preset compression algorithm to compress user operation instructions, which reduces the amount of data transmitted and improves the transmission speed; uses a preset encryption algorithm and a shared key to encrypt data, which improves the security of data during transmission; divides the data into multiple small blocks before sending, further reducing the amount of data transmitted in a single time and optimizing the data transmission speed, especially in a wireless communication environment, greatly reducing transmission delays and improving user experience. . BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The drawings constituting a part of this application are used to provide a further understanding of the present invention. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0061] Figure 1 A schematic diagram of the structure of a data transmission system in one embodiment;
[0062] Figure 2 A schematic diagram of a flow chart of a data transmission method in an embodiment;
[0063] Figure 3 A schematic diagram of a flow chart of a step of parsing feedback information in an embodiment;
[0064] Figure 4 A schematic diagram of a flow chart of a step of parsing feedback information in another embodiment;
[0065] Figure 5 is a structural block diagram of a data transmission device in one embodiment;
[0066] Figure 6 A schematic diagram of a flow chart of a data transmission method in another embodiment;
[0067] Figure 7 is a structural block diagram of a data transmission device in another embodiment;
[0068] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0069] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0070] While some exemplary embodiments of the present invention have been described for the purpose of illustration, it should be understood that the present invention may be implemented in other ways not specifically shown in the drawings.
[0071] See also Figure 1In an exemplary embodiment, the present application provides a data transmission system, including a first terminal 102 and a second terminal 104. The first terminal 102 can communicate with the second terminal 104 through a wireless network and perform data exchange.
[0072] During the data interaction process, the first end 102 responds to the received user operation instruction and uses a preset compression algorithm to compress the user operation instruction to obtain the first data; uses a preset encryption algorithm and a shared key to encrypt the first data to obtain the second data; wherein the shared key is generated by the first end and the second end based on the key exchange mechanism; divides the second data to obtain multiple first data blocks; and sends each first data block to the second end 104.
[0073] The second end 104 receives each first data block sent by the first end 102, and decrypts each first data block using a preset decryption algorithm and a shared key; reorganizes all the decrypted first data blocks according to a preset structure to obtain fourth data; decompresses the fourth data using a preset decompression algorithm to obtain the original user operation instruction; performs corresponding operations based on the user operation instruction, and generates an execution result; encrypts the execution result using a preset encryption algorithm and a shared key; sends the encrypted execution result as feedback information to the first end 102; after receiving the feedback information, the first end 102 parses the feedback information and displays it to the user.
[0074] Exemplarily, the first end 102 is a smart mobile terminal with a user interaction interface, which may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The second end 104 is a smart device, which may be an IoT device, such as a smart cabinet, a smart speaker, a smart TV, a smart air conditioner, a smart car device, etc.
[0075] The above-mentioned data transmission system uses a preset compression algorithm to compress user operation instructions, thereby reducing the amount of transmitted data and improving the transmission speed; uses a preset encryption algorithm and a shared key to encrypt data, thereby improving the security of data during transmission; and divides the data into multiple small blocks before sending, thereby further reducing the amount of data transmitted in a single time and optimizing the data transmission speed, especially in a wireless communication environment, which greatly reduces transmission delays and improves user experience.
[0076] In an exemplary embodiment, the present application provides a data transmission method, which is applied to Figure 1 The first end 102 in FIG. 1 is taken as an example for explanation.
[0077] See also Figure 2 , Figure 2The following is a flow chart of a data transmission method according to the present embodiment, which specifically includes the following steps:
[0078] Step S202: In response to the received user operation instruction, a preset compression algorithm is used to compress the user operation instruction to obtain first data.
[0079] Specifically, the user operation instruction is generated based on the user's operation on the user interaction interface of the first end. Taking the first end as a smart phone and the second end as a smart cabinet as an example, it should be understood that at this time, an application for matching with the smart cabinet is installed on the smart phone. The user logs in to the application on the smart phone and selects an option in the application, such as "open the cabinet door". When the option is selected, the corresponding user operation instruction will be generated.
[0080] The preset compression algorithm is used to compress the data corresponding to the user operation instruction. Exemplarily, the GZIP (GNU Zip) compression algorithm is adopted in the embodiment of the present application. The algorithm is a combined compression method, mainly including the DEFLATE compression algorithm, and the DEFLATE compression algorithm combines two main compression technologies: LZ77 (Lempel-Ziv 1977) and Huffman coding. By dividing, compressing and encoding the data, the size of the text data can be greatly reduced and the data volume can be reduced.
[0081] Step S204: encrypt the first data using a preset encryption algorithm and a shared key to obtain second data, wherein the shared key is generated by the first end and the second end based on a key exchange mechanism.
[0082] Specifically, the key exchange mechanism means that the data sender and the data receiver can create a shared key by exchanging public keys without any prior agreement, and the shared key can be used for communication between the two.
[0083] Exemplarily, the preset encryption algorithm in the embodiment of the present application adopts the AES (Advanced Encryption Standard) encryption algorithm, wherein the AES encryption algorithm is a symmetric encryption algorithm that uses a shared key to convert data into ciphertext through byte substitution, row shifting, column mixing and adding round keys in sequence, thereby ensuring the security of transmitted data.
[0084] Step S206, dividing the second data to obtain a plurality of first data blocks.
[0085] Step S208, sending each first data block to the second end.
[0086] Specifically, in order to avoid the delay caused by transmitting a large amount of data in a single time, the embodiment of the present application divides the second data into multiple first data blocks, wherein the size of the first data block is set according to the actual transmission capacity and security requirements, and the size of each first data block should be suitable for one transmission.
[0087] The first end sends each first data block to the second end in sequence until all the first data blocks are transmitted. Correspondingly, the second end receives each first data block in sequence and accumulates them until all the first data blocks are collected and ready for subsequent processing.
[0088] Step S210: receiving feedback information generated by the second end in response to each first data block, and parsing the feedback information for display.
[0089] Specifically, each first data block is obtained by compressing, encrypting, and segmenting the user operation instruction, and the feedback information represents the execution result generated after the second end executes the user operation instruction. Taking the above user demand of "opening the cabinet door" as an example, the execution result is "cabinet door opened successfully" or "cabinet door opened failed". It should be understood that the feedback information has been encrypted by the second end. Therefore, after the first end receives the feedback information, it decrypts it into the original information and displays it to the user operation interface for the user to view. In this way, the first end and the second end complete a data interaction.
[0090] The above data transmission method compresses the user operation instructions, reduces the size of the text data, reduces the amount of data, and thus improves the speed of subsequent data transmission. Furthermore, a symmetric encryption algorithm and a shared key generated by the first end and the second end based on a key exchange mechanism are used to encrypt the compressed data, thereby ensuring the security of the data; further, the encrypted data is segmented to avoid delays caused by transmitting a large amount of data, further improving the transmission speed, and ultimately achieving secure and high-speed data transmission.
[0091] See also Figure 3 Optionally, the feedback information includes multiple second data blocks, and the parsing feedback information in step S210 includes:
[0092] Step S302: Combine the second data blocks according to a preset structure to obtain third data.
[0093] Step S304: Decrypt the third data using a preset decryption algorithm and a shared key.
[0094] Step S306: The decrypted data is used as the parsing result for display.
[0095] Specifically, in order to increase the transmission speed and avoid delays caused by a large amount of data, the second end divides the feedback information into multiple second data blocks before transmitting the feedback information to the first end, so that the second end sequentially transmits each second data block to the first end until all the second data blocks are transmitted. Correspondingly, the first end sequentially receives each second data block and accumulates them until all the second data blocks are collected.
[0096] The preset structure is the original structure of the data, and according to the original structure, all the second data blocks are sequentially merged into a complete data.
[0097] Furthermore, the preset decryption algorithm corresponds to the preset encryption algorithm, and the decryption process is the inverse process of the encryption process. At the same time, the shared key is generated by the first end and the second end based on the key exchange mechanism. The decrypted data is the original execution result, and the first end displays the execution result to the user operation interface for the user to view.
[0098] See also Figure 4 Optionally, parsing the feedback information further includes:
[0099] Step S402, verifying the integrity of the third data.
[0100] Step S404: if the verification is successful, decrypt each third data.
[0101] Specifically, in order to ensure that the data has not been tampered with during transmission and to further ensure the security of the data, the embodiment of the present application also verifies the integrity of the data. Exemplarily, the judgment method for confirming the success of the verification includes: obtaining the verification code attached to the third data; calculating the verification code of the third data based on the shared key, and if the calculated verification code matches the attached verification code, then the verification is considered successful. Among them, the verification code attached to the third data is generated by the second end.
[0102] Optionally, the first end and the second end generate a shared key based on a key exchange mechanism, including:
[0103] The first end randomly generates a first private key, and calculates a first public key based on the first private key; the second end randomly generates a second private key, and calculates a second public key based on the second private key.
[0104] The first end sends the first public key to the second end, so that the second end obtains the shared key based on the first public key; the second end sends the second public key to the first end, so that the first end obtains the shared key based on the second public key.
[0105] Specifically, this embodiment uses the Diffie-Hellman key exchange mechanism to generate a shared key. The first end randomly selects a private key a, the second end randomly selects a private key b, and selects a large prime number p and a primitive root g. Among them, the private key a is an integer between 1 and p-1, which is confidential and should not be disclosed to anyone. The private key b is also an integer between 1 and p-1, which is also confidential. The large prime number p and the primitive root g can be predefined or obtained through standards, are not confidential information, and can be publicly transmitted. Exemplarily, the private key a and the private key b are both 256 bits, and the large prime number p is 2048 bits.
[0106] The first end calculates its public key A based on the private key a, and its expression is A=g a modp; the second end calculates its public key B based on the private key b, and its expression is B=g b modp.
[0107] The first end and the second end exchange their respective public keys through a secure channel. After the first end receives the public key B, it calculates the shared key S: S = B a modp = (g b ) a modp; after receiving the public key A, the second end calculates the shared key S: S = A b modp = (g a )A Since private key a and private key b are kept secret, even if a third party intercepts public key A and public key B, they cannot calculate the shared key S, thus ensuring data security.
[0108] The above data transmission method, in response to the received user operation instruction, uses a preset compression algorithm to compress the user operation instruction, thereby reducing the amount of data transmitted, thereby increasing the data transmission speed. In addition, the present application also generates a shared key based on a key exchange mechanism in advance, and then uses a symmetric encryption algorithm and a shared key to encrypt the first data, thereby ensuring the security of the data. Furthermore, the second data is segmented and then transmitted, further reducing the amount of data transmitted in a single transmission, optimizing the data transmission speed, and ultimately achieving secure and high-speed data transmission.
[0109] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0110] Based on the same inventive concept, the embodiment of the present application also provides a data transmission device for implementing the data transmission method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data transmission device embodiments provided below can refer to the limitations on the data transmission method above, and will not be repeated here.
[0111] See also Figure 5 In an exemplary embodiment, the present application provides a data transmission device, including: a compression module, a first encryption module, a first segmentation module, a first transmission module and a parsing module, wherein:
[0112] The compression module is used to compress the user operation instruction in response to the received user operation instruction by using a preset compression algorithm to obtain the first data.
[0113] The first encryption module is used to encrypt the first data by using a preset encryption algorithm and a shared key to obtain the second data; wherein the shared key is generated by the first end and the second end based on a key exchange mechanism.
[0114] The first segmentation module is used to segment the second data to obtain a plurality of first data blocks.
[0115] The first transmission module is used to send each first data block to the second end, and receive feedback information generated by the second end in response to each data block.
[0116] The parsing module is used to parse the feedback information for display.
[0117] Optionally, the feedback information includes multiple second data blocks, and the steps of the parsing module parsing the feedback information include: combining the second data blocks according to a preset structure to obtain third data; using a preset decryption algorithm and a shared key to decrypt the third data; and using the decrypted data as a parsing result for display.
[0118] Optionally, the step of parsing the feedback information by the parsing module further includes: verifying the integrity of the third data; and decrypting each third data if the verification is successful. The judgment method for confirming the success of the verification includes: obtaining the check code attached to the third data; calculating the check code of the third data based on the shared key, and if the calculated check code matches the attached check code, then the verification is considered successful. And the check code attached to the third data is generated by the second end.
[0119] Optionally, the first end and the second end generate a shared key based on a key exchange mechanism, including: the first end randomly generates a first private key, and calculates a first public key based on the first private key; the second end randomly generates a second private key, and calculates a second public key based on the second private key; the first end sends the first public key to the second end, so that the second end obtains a shared key based on the first public key; the second end sends the second public key to the first end, so that the first end obtains a shared key based on the second public key.
[0120] The above-mentioned data transmission device, in response to the received user operation instruction, uses a preset compression algorithm to compress the user operation instruction, thereby reducing the amount of data transmitted, thereby increasing the data transmission speed. In addition, the present application also generates a shared key based on a key exchange mechanism in advance, and then uses a symmetric encryption algorithm and a shared key to encrypt the first data, thereby ensuring the security of the data. Furthermore, the second data is divided and then transmitted, which further reduces the amount of data transmitted in a single time, optimizes the data transmission speed, and finally realizes safe and high-speed data transmission.
[0121] Each module in the above data transmission device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0122] In an exemplary embodiment, the present application provides a data transmission method, which is applied to Figure 1 The second end 104 in FIG. 1 is taken as an example for explanation.
[0123] See also Figure 6 , Figure 6 The following is a flow chart of a data transmission method according to the present embodiment, which specifically includes the following steps:
[0124] Step S602: receiving each first data block sent by the first end, and decrypting each first data block using a preset decryption algorithm and a shared key.
[0125] Specifically, the preset decryption algorithm here corresponds to the preset encryption algorithm in step S204, and the decryption process is the inverse process of the encryption process. The shared key is generated by the first end and the second end based on the key exchange mechanism.
[0126] It should be noted that the second end sequentially receives the first data blocks sent by the first end through the wireless communication interface, accumulates them, and performs a decryption operation on each first data block until all the first data blocks are collected.
[0127] Step S604: reorganize all the decrypted first data blocks according to a preset structure to obtain fourth data.
[0128] Specifically, the preset structure is the original structure of the data, and according to the original structure, all the first data blocks are sequentially merged into a complete data.
[0129] Step S606: Decompress the fourth data using a preset decompression algorithm to obtain the original user operation instruction.
[0130] Specifically, the preset decompression algorithm corresponds to the preset compression algorithm in the above step S202. After decoding and verification, the fourth data can be decompressed and restored to the original user operation instruction.
[0131] Step S608: Execute corresponding operations based on the user operation instruction and generate execution results.
[0132] Step S610, using a preset encryption algorithm and a shared key to encrypt the execution result.
[0133] Step S612: Send the encrypted execution result as feedback information to the first end.
[0134] Specifically, the second end executes the user operation instruction. For example, if the user demand is "open the cabinet door", the execution result is "the cabinet door is opened successfully" or "the cabinet door is opened unsuccessfully".
[0135] To ensure data security, the embodiment of the present application adopts the AES encryption algorithm and a shared key S generated by the first and second ends based on a key exchange mechanism, and encrypts the above execution result and sends it to the first end.
[0136] In the above data transmission method, the second end decrypts, reorganizes, and decompresses each received first data block to restore it to the original user operation instruction, and executes the instruction. At the same time, the execution result is encrypted and fed back to the first end, thereby ensuring the security of data transmission.
[0137] Optionally, the data transmission method further includes:
[0138] Splitting the encrypted execution result to obtain a plurality of second data blocks;
[0139] Each second data block is sent to the first end as feedback information.
[0140] Specifically, in order to avoid delays caused by transmitting a large amount of data in a single time, the embodiment of the present application divides the encrypted execution result into multiple second data blocks, wherein the size of the second data block is set according to the actual transmission capacity and security requirements, and the size of each second data block should be suitable for one transmission.
[0141] The second end sequentially sends each second data block to the first end through the wireless communication interface until all the second data blocks are transmitted. Accordingly, the first end sequentially receives each second data block and accumulates it until all the second data blocks are collected and ready for subsequent processing.
[0142] The above data transmission method avoids the delay caused by transmitting a large amount of data by dividing the encrypted execution result into multiple small blocks, optimizes the transmission speed, and finally realizes safe and high-speed data transmission.
[0143] Optionally, the data transmission method further includes:
[0144] Use the preset verification algorithm to calculate the encrypted execution result and generate a verification code;
[0145] After the verification code and the encrypted execution result are combined, they are segmented to obtain a plurality of second data blocks.
[0146] Exemplarily, the preset verification algorithm of the present application adopts the HMAC (Hash-based Message Authentication Code) algorithm, which is a message authentication code algorithm using a key, whose input is a message and a key, and whose output is a value of fixed length, which is usually used to verify the integrity and authentication of data. By appending the generated check code to the execution result, a combined data is obtained, and the combined data is divided into multiple small blocks, and the size of each small block is suitable for one transmission.
[0147] The above data transmission method uses a symmetric encryption algorithm and a shared key to encrypt the execution results, which not only improves the transmission speed but also ensures the security of the data during the transmission process; the added checksum is used to verify the integrity of the data and prevent the data from being tampered with during the transmission process; and the block transmission further optimizes the data transmission speed, especially in a wireless communication environment, greatly reducing the transmission delay and improving the user experience.
[0148] Based on the same inventive concept, the embodiment of the present application also provides a data transmission device for implementing the data transmission method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data transmission device embodiments provided below can refer to the limitations on the data transmission method above, and will not be repeated here.
[0149] See also Figure 7 In an exemplary embodiment, the present application provides a data transmission device, including: a decryption module, a combination module, a decompression module, an execution module, a second encryption module and a second transmission module, wherein:
[0150] The decryption module is used to receive each first data block sent by the first end, and decrypt each first data block using a preset decryption algorithm and a shared key.
[0151] The combining module is used to reorganize all the decrypted first data blocks according to a preset structure to obtain fourth data.
[0152] The decompression module is used to decompress the fourth data by using a preset decompression algorithm to obtain the original user operation instruction.
[0153] The execution module is used to execute corresponding operations based on user operation instructions and generate execution results.
[0154] The second encryption module is used to encrypt the execution result by using a preset encryption algorithm and a shared key.
[0155] The second transmission module is used to send the encrypted execution result as feedback information to the first end.
[0156] Optionally, the data transmission device of the embodiment of the present application further includes: a second segmentation module.
[0157] The second segmentation module is used to segment the encrypted execution result to obtain multiple second data blocks.
[0158] The second transmission module is further used to send each second data block as feedback information to the first end.
[0159] Optionally, the data transmission device of the embodiment of the present application further includes: a verification module.
[0160] The verification module is used to use a preset verification algorithm to calculate the encrypted execution result, generate a verification code, and combine the verification code and the encrypted execution result.
[0161] The second segmentation module is further used to segment the execution result with the verification code attached into a plurality of second data blocks.
[0162] The above-mentioned data transmission device uses a symmetric encryption algorithm and a shared key to encrypt the execution results, which not only improves the transmission speed but also ensures the security of the data during the transmission process; the added check code is used to verify the integrity of the data and prevent the data from being tampered with during the transmission process; and the block transmission further optimizes the data transmission speed, especially in a wireless communication environment, greatly reducing the transmission delay and improving the user experience.
[0163] In an exemplary embodiment, the present application provides a data transmission method, which is applied to Figure 1 Taking the first end 102 and the second end 104 in FIG. 1 as an example, the method includes the following steps:
[0164] In response to the received user operation instruction, the first end compresses the user operation instruction using a preset compression algorithm to obtain first data; encrypts the first data using a preset encryption algorithm and a shared key to obtain second data; divides the second data to obtain multiple first data blocks; and sends each first data block to the second end; wherein the shared key is generated by the first end and the second end based on a key exchange mechanism.
[0165] After the second end receives each first data block sent by the first end, it decrypts each first data block using a preset decryption algorithm and a shared key; reorganizes all the decrypted first data blocks according to a preset structure to obtain fourth data; decompresses the fourth data using a preset decompression algorithm to obtain the original user operation instruction; performs corresponding operations based on the user operation instruction and generates an execution result; encrypts the execution result using a preset encryption algorithm and a shared key; and sends the encrypted execution result as feedback information to the first end.
[0166] After receiving the feedback information, the first end parses the feedback information for display.
[0167] Optionally, the first end and the second end generate a shared key based on a key exchange mechanism, including:
[0168] The first end randomly generates a first private key, and calculates a first public key based on the first private key; the second end randomly generates a second private key, and calculates a second public key based on the second private key.
[0169] The first end sends the first public key to the second end, so that the second end obtains the shared key based on the first public key; the second end sends the second public key to the first end, so that the first end obtains the shared key based on the second public key.
[0170] Optionally, after the second end encrypts the execution result, the step further includes:
[0171] The encrypted execution result is divided to obtain a plurality of second data blocks; each second data block is sent to the first end as feedback information.
[0172] Optionally, after the second end encrypts the execution result, the step further includes:
[0173] A preset verification algorithm is used to calculate the encrypted execution result and generate a verification code; the verification code and the encrypted execution result are combined and divided to obtain a plurality of second data blocks.
[0174] Optionally, when the feedback information includes multiple second data blocks, the first end parses the feedback information, including:
[0175] According to the preset structure, the second data blocks are combined to obtain the third data; the third data is decrypted using the preset decryption algorithm and the shared key; and the decrypted data is used as the parsing result for display.
[0176] Optionally, the first end parsing the feedback information further includes:
[0177] Verify the integrity of the third data; if the verification is successful, decrypt each third data. The judgment method for confirming the success of the verification includes: obtaining the verification code attached to the third data; calculating the verification code of the third data based on the shared key, if the calculated verification code matches the attached verification code, then the verification is considered successful.
[0178] The above data transmission method uses a preset compression algorithm to compress user operation instructions, thereby reducing the amount of transmitted data and improving the transmission speed; uses a preset encryption algorithm and a shared key to encrypt data, thereby improving the transmission speed while ensuring the security of the data during the transmission process; the added checksum is used to verify the integrity of the data and prevent the data from being tampered with during the transmission process; and block transmission further reduces the amount of data transmitted in a single time and optimizes the data transmission speed, especially in a wireless communication environment, greatly reducing transmission delays and improving user experience.
[0179] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a data transmission method is realized. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0180] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0181] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above data transmission method when executing the computer program.
[0182] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned data transmission method are implemented.
[0183] In an exemplary embodiment, a computer program product is provided, including a computer program, which implements the steps in the above data transmission method when executed by a processor.
[0184] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0185] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0186] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data transmission method, applied to a first end, characterized in that: The method comprises: In response to the received user operation instruction, compress the user operation instruction using a preset compression algorithm to obtain first data; Using a preset encryption algorithm and a shared key, encrypt the first data to obtain second data; dividing the second data to obtain a plurality of first data blocks; Sending each of the first data blocks to the second end; receiving feedback information generated by the second end in response to each of the first data blocks, and parsing the feedback information for display; The shared key is generated by the first end and the second end based on a key exchange mechanism.
2. The method according to claim 1, characterized in that: The feedback information includes a plurality of second data blocks; The analyzing the feedback information includes: Combining the second data blocks according to a preset structure to obtain third data; Decrypting the third data using a preset decryption algorithm and the shared key; The decrypted data is used as the parsing result for display.
3. The method according to claim 2, characterized in that The analyzing the feedback information further includes: Verifying the integrity of the third data; If the verification is successful, the third data are decrypted.
4. The method according to claim 3, characterized in that Confirm the successful verification method, including: Obtaining a check code attached to the third data; wherein the check code is generated by the second end; A check code of the third data is calculated based on the shared key, and if the calculated check code matches the additional check code, the verification is considered successful.
5. The method according to claim 1, characterized in that The first end and the second end generate a shared key based on a key exchange mechanism, including: The first end randomly generates a first private key, and calculates a first public key according to the first private key; The second end randomly generates a second private key, and calculates a second public key according to the second private key; The first end sends the first public key to the second end, so that the second end obtains a shared key based on the first public key; The second end sends the second public key to the first end, so that the first end obtains a shared key based on the second public key.
6. A data transmission method, applied to a second end, characterized in that: The method comprises: Receive each first data block sent by the first end, and decrypt each first data block using a preset decryption algorithm and a shared key; Reorganize all the first data blocks after decryption according to a preset structure to obtain fourth data; Decompressing the fourth data using a preset decompression algorithm to obtain an original user operation instruction; Execute corresponding operations based on the user operation instructions and generate execution results; Use the preset encryption algorithm and shared key to encrypt the execution results; The encrypted execution result is sent to the first end as feedback information.
7. The method according to claim 6, characterized in that The method further comprises: Splitting the encrypted execution result to obtain a plurality of second data blocks; Each of the second data blocks is sent to the first end as feedback information.
8. The method according to claim 7, characterized in that The method further comprises: Using a preset verification algorithm, calculating the encrypted execution result and generating a verification code; After combining the verification code and the encrypted execution result, the result is divided to obtain a plurality of second data blocks.
9. A data transmission device, arranged at a first end, characterized in that: The device comprises: A compression module, configured to compress the user operation instruction in response to the received user operation instruction by using a preset compression algorithm to obtain first data; A first encryption module, configured to encrypt the first data using a preset encryption algorithm and a shared key to obtain second data; wherein the shared key is generated by the first end and the second end based on a key exchange mechanism; A first segmentation module is used to segment the second data to obtain a plurality of first data blocks. A first transmission module, configured to send each of the first data blocks to a second end, and receive feedback information generated by the second end in response to each of the data blocks; The parsing module is used to parse the feedback information for display.
10. A data transmission device, arranged at a second end, characterized in that: The device comprises: A decryption module, configured to receive each first data block sent by the first end, and decrypt each first data block using a preset decryption algorithm and a shared key; A combining module, used for reorganizing all the decrypted first data blocks according to a preset structure to obtain fourth data; A decompression module, used to decompress the fourth data using a preset decompression algorithm to obtain an original user operation instruction; An execution module, used to execute corresponding operations based on the user operation instructions and generate execution results; A second encryption module, used to encrypt the execution result using a preset encryption algorithm and a shared key; The second transmission module is used to send the encrypted execution result as feedback information to the first end.
