Data transmission method and device based on request message
By performing key encryption and public key encryption on data transmission packets in non-http protocol environments, the packet is formed and transmitted to the server, the problem of data transmission security in non-http protocol environments is solved, and data is realized Safe transmission.
Patent Information
- Application Number
- CN202411709801.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-11-26
AI Technical Summary
In a non-http protocol environment, how to achieve secure data transmission, especially in internal network or local network transmission, software and hardware or technical conditions, temporary or one-time data transmission, and areas with restricted Internet connections.
By obtaining the message to be transmitted and generating the current key, the message is encrypted, and the message is ciphertext digest is generated, and the key is encrypted based on the preset public key information to generate ciphertext information. The ciphertext information, message ciphertext digest and encrypted messages are packaged to form a packet and sent to the server. After the server receives the packet, it uses the private key to decrypt the ciphertext information, verify the consistency of the ciphertext, and decrypts the content of the message to obtain the original message.
This method prevents key leakage through the dual protection mechanism of key encryption and public key encryption, improves the security of data transmission and ensures data transmission security in non-http protocol environments.
Smart Images

Figure CN119484137A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data transmission, and in particular to a data transmission method and device based on a request message. Background Art
[0002] Hypertext Transfer Protocol (English: Hypertext Transfer Protocol, abbreviated: http) is a simple request-response protocol. Generally, data can be securely transmitted to the server through the http protocol.
[0003] However, in some specific cases, data transmission cannot be performed via the http protocol, such as internal or local network transmission, hardware or software or technical conditions, temporary or one-time data transmission, and areas with limited Internet connectivity.
[0004] Therefore, how to achieve secure data transmission in a non-http protocol environment during data transmission is an urgent problem that needs to be solved. Summary of the invention
[0005] The embodiments of the present application provide a data transmission method and device based on a request message, so as to improve the security during the data transmission process.
[0006] In a first aspect, an embodiment of the present application provides a data transmission method based on a request message, including:
[0007] Get the message to be transmitted and generate the current key;
[0008] According to the current key, the message to be transmitted is encrypted to obtain a message ciphertext summary; wherein the message ciphertext summary represents summary information of the encrypted message to be transmitted;
[0009] Based on the preset public key information, encrypt the current key to obtain the ciphertext information of the current key;
[0010] The ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server.
[0011] In a second aspect, an embodiment of the present application provides a data transmission method based on a request message, including:
[0012] Receive a message package from a client; wherein the message package is used to represent the message to be transmitted and generate a current key; according to the current key, encrypt the message to be transmitted to obtain a message ciphertext summary; wherein the message ciphertext summary represents the summary information of the encrypted message to be transmitted; based on the preset public key information, encrypt the current key to obtain the ciphertext information of the current key; package the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted to obtain a message package, and send the message package to the server;
[0013] According to the preset private key information, the ciphertext information of the current key in the message packet is decrypted to obtain the current key; wherein the preset private key information corresponds to the preset public key information;
[0014] According to a preset digest encryption algorithm, the encrypted message to be transmitted is encrypted to obtain a ciphertext to be verified;
[0015] If the ciphertext to be verified is consistent with the message ciphertext digest, the encrypted message to be transmitted is decrypted according to the current key to obtain the message to be transmitted.
[0016] In a third aspect, the present application provides a data transmission device based on a request message, comprising:
[0017] An acquisition module is used to acquire the message to be transmitted and generate the current key;
[0018] A first encryption module, configured to encrypt the message to be transmitted according to the current key to obtain a message ciphertext summary; wherein the message ciphertext summary represents summary information of the encrypted message to be transmitted;
[0019] A second encryption module is used to encrypt the current key based on preset public key information to obtain ciphertext information of the current key;
[0020] The packaging module is used to package the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted to obtain a message package, and send the message package to the server.
[0021] In a fourth aspect, the present application provides a data transmission device based on a request message, comprising:
[0022] A receiving module is used to receive a message package from a client; wherein the message package is used to represent the acquisition of a message to be transmitted and generate a current key; according to the current key, the message to be transmitted is encrypted to obtain a message ciphertext summary; wherein the message ciphertext summary represents the summary information of the encrypted message to be transmitted; based on the preset public key information, the current key is encrypted to obtain the ciphertext information of the current key; the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server;
[0023] A first decryption module, configured to decrypt the ciphertext information of the current key in the message packet according to preset private key information to obtain the current key; wherein the preset private key information corresponds to the preset public key information;
[0024] A second decryption module is used to encrypt the encrypted message to be transmitted according to a preset digest encryption algorithm to obtain a ciphertext to be verified;
[0025] The verification module is used to decrypt the encrypted message to be transmitted according to the current key to obtain the message to be transmitted if the ciphertext to be verified is consistent with the message ciphertext summary.
[0026] In a fifth aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0027] The memory stores computer-executable instructions;
[0028] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0029] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-readable storage medium is stored computer execution instructions, and when the computer execution instructions are executed by a processor, they are used to implement various possible implementations of the first aspect and / or the second aspect as described above.
[0030] In a seventh aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0031] The embodiment of the present application provides a data transmission method and device based on a request message. When the client obtains the message to be transmitted, the current key is first generated; then, according to the current key, the message to be transmitted is encrypted to obtain the message content ciphertext, that is, the encrypted message to be transmitted, and according to the message content ciphertext, based on the digest encryption algorithm, the message ciphertext summary is obtained; again, based on the preset public key information, the current key is encrypted to obtain the symmetric encryption key ciphertext, and the symmetric encryption key ciphertext is obfuscated to obtain the ciphertext information of the current key; finally, the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server. This method encrypts the message with a key, and double-encrypts the key through public key and obfuscated encryption, which prevents the leakage of the key and effectively improves the security of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0033] Figure 1 A flowchart of a data transmission method based on a request message provided in this application;
[0034] Figure 2 A flowchart of a data transmission method based on a request message provided in this application;
[0035] Figure 3 A flowchart of a data transmission method based on a request message provided in this application;
[0036] Figure 4 A flowchart of a data transmission method based on a request message provided in this application;
[0037] Figure 5 An overall flow chart of a data transmission method based on a request message provided by this application;
[0038] Figure 6 A schematic diagram of the structure of a data transmission device based on a request message provided by the present application;
[0039] Figure 7 A schematic diagram of the structure of a data transmission device based on a request message provided by the present application;
[0040] Figure 8 A schematic diagram of the structure of a data transmission device based on a request message provided by the present application;
[0041] Fig. 9A schematic diagram of the structure of a data transmission device based on a request message provided by the present application;
[0042] Fig.10 A schematic diagram of the structure of a data transmission device based on a request message provided in this application.
[0043] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0044] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0045] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the relevant laws and regulations and do not violate public order and good morals.
[0046] First, the terms involved in this application are explained:
[0047] POST message: It is a request message in HTTP protocol. In HTTP protocol, the request message consists of three parts: request line, request header and request body. The POST method is used to send a data submission request to the destination server, and a specific request body is attached.
[0048] timestamp: A timestamp is a complete and verifiable data that indicates that a piece of data existed before a specific time. It is usually a sequence of characters that uniquely identifies a moment in time.
[0049] Nonce: In cryptography, nonce is the abbreviation of number once, which refers to an arbitrary or non-repeating random value that is used only once. It plays an important role in the initialization vector and cryptographic hash function in encryption technology to ensure that verification information is not reused to combat replay attacks.
[0050] Based on the description of the data transmission method in the background technology, it can be known that in the prior art, under normal circumstances, data can be securely transmitted to the server through the http protocol. To address security issues in data transmission, the data is mainly encrypted by generating a key on the server and then transmitting it to the client. However, in non-http scenarios, there is a risk of key leakage.
[0051] In addition, in some specific cases, such as internal network or local network transmission, software and hardware or technical conditions, temporary or one-time data transmission, and areas with restricted Internet connection, data transmission cannot be carried out through the HTTP protocol; secondly, if the post message content contains sensitive information or confidential content, such as user sensitive information, user authentication information (account, password), etc.; or if the post message contains submitted content that is difficult to resolve using parameterization or needs to be prevented from being scanned by security penetration tools, data transmission cannot be carried out through the HTTP protocol.
[0052] The present application provides a data transmission method based on a request message, which relates to the field of data transmission, and in particular to a data transmission method and device based on a request message, aiming to solve the above technical problems in the prior art.
[0053] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0054] Figure 1 A flowchart of a data transmission method based on a request message provided in this application, the method is applied to a client, such as Figure 1 As shown, the method includes:
[0055] S101. Obtain a message to be transmitted and generate a current key.
[0056] Exemplarily, a message represents information used for HTTP protocol interaction. A request message consists of a request line, a request header, and a request body, and is used to exchange information when making requests between systems. A key is a password or code used to encrypt and decrypt data, wherein the key is a symmetric encryption key. For example, a client is provided with an encryption module. Before transmitting an HTTP POST message, the encryption module of the transmission client first generates a 32-bit unique string, and uses the string to generate a symmetric encryption key through an AES-256 encryption algorithm. The key is generated using a "one-time, one-password" method, wherein methods for generating symmetric encryption keys include but are not limited to AES-256, etc., wherein "one-time, one-password" means that a new symmetric encryption key is generated each time a request message is transmitted.
[0057] The beneficial effect of this setting is that the key is generated in a "one-time one-password" manner on the client, which can avoid the leakage of the key and improve the security of data transmission.
[0058] S102. Encrypt the message to be transmitted according to the current key to obtain a message ciphertext summary; wherein the message ciphertext summary represents summary information of the encrypted message to be transmitted.
[0059] Exemplarily, the message ciphertext summary represents the summary information of the encrypted message to be transmitted, the current key is a symmetric encryption key, which is used to encrypt data on the client, and the encrypted message to be transmitted represents the message content ciphertext generated after the message content is encrypted using the symmetric encryption key. For example, the client is provided with an encryption module and a summary module. After obtaining the message to be transmitted, a symmetric encryption key is first generated in the encryption module of the client, and then the message content is encrypted using the key to generate a message content ciphertext. The summary module of the client generates the summary information of the ciphertext based on the generated message content ciphertext based on the preset message summary algorithm, that is, the message ciphertext summary is obtained. The summary information exists in the form of a string, which is used to encrypt the message content ciphertext. In this embodiment, the preset message summary algorithm is not specifically limited.
[0060] The beneficial effect of such a setting is that the encryption module and the summary module are used to encrypt the message, which is conducive to improving the security of data transmission and ensuring the integrity of the transmission content.
[0061] In this embodiment, the message to be transmitted is encrypted according to the current key to obtain a ciphertext summary of the message, including: encrypting the message to be transmitted according to the current key to obtain an encrypted message to be transmitted; encrypting the encrypted message to be transmitted according to a preset summary encryption algorithm to obtain a ciphertext summary of the message.
[0062] Exemplarily, the message represents information used for http protocol interaction, which is used to exchange information when making requests between various systems. The encrypted message to be transmitted is the message content ciphertext. The key is a password or code used to encrypt and decrypt data, wherein the key is a symmetric encryption key. The client is provided with an encryption module and a summary module. The encryption module is used to generate a symmetric encryption key, and use the symmetric key to encrypt the message content to generate the message content ciphertext. The summary module is used to generate summary information of the content ciphertext according to the incoming message content ciphertext, namely, the message ciphertext summary, wherein the summary information exists in the form of a string and is used to encrypt the message content ciphertext. For example, after obtaining the message to be transmitted, the current key is first used to encrypt the message content to be transmitted to generate the message content ciphertext, wherein the current key refers to the symmetric encryption key generated by the client, which is used to encrypt the message content. Then, the summary module of the client generates summary information according to the obtained message content ciphertext based on the message summary algorithm, namely, the message ciphertext summary is obtained. The message summary algorithm used to generate the string includes but is not limited to the SHA-256 algorithm, the SHA-1 algorithm, the MD5 algorithm, etc.
[0063] The beneficial effect of such a setting is that the summary module is used to generate a content ciphertext summary string, which is conducive to ensuring the integrity of the transmitted content and preventing illegal tampering.
[0064] S103: Based on the preset public key information, encrypt the current key to obtain the ciphertext information of the current key.
[0065] Exemplarily, the key is a password or code used to encrypt and decrypt data, wherein the key is a symmetric encryption key, and the public key is used to encrypt the symmetric key on the client. The client is preset with an asymmetric key generation module, a security key module and an obfuscation module. The asymmetric key generation module is located on the server and is used to generate the public-private key pair required for secure transmission. The generated private key is automatically saved on the server, and the distribution of the public key is completed through the client's numbering information, wherein the numbering information is the unique identifier of the client. The public key and the client are preset with numbering information and correspond to each other. The public key can find the corresponding client according to the numbering information and is finally saved in the security key module of the client. For example, after obtaining the message to be transmitted, the message content is encrypted based on the client's symmetric encryption key to generate a message content ciphertext, and a summary encryption algorithm is used to generate summary information of the message ciphertext, that is, a message ciphertext summary is obtained, wherein the summary information refers to a character string used to encrypt the message content ciphertext, and the symmetric encryption key is encrypted using the public key stored in the client to obtain a symmetric encryption key ciphertext. Finally, the symmetric encryption key ciphertext is obfuscated to obtain an obfuscated symmetric encryption key ciphertext, that is, the ciphertext information of the current key.
[0066] The beneficial effect of such a setting is that the key is encrypted using a public-private key pair, which helps prevent key leakage and improves the security of data transmission.
[0067] S104: Pack the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted to obtain a message package, and send the message package to the server.
[0068] Exemplarily, after the client obtains the message to be transmitted, the client first uses the generated symmetric encryption key to encrypt the message to be transmitted to obtain the message content ciphertext, that is, the encrypted message to be transmitted, and encrypts the message content ciphertext based on the digest encryption algorithm to generate summary information of the message content ciphertext, wherein the summary information refers to a string used to encrypt the message content ciphertext, that is, the message ciphertext summary, and then uses the public key stored in the client to encrypt the symmetric encryption key to obtain the symmetric encryption key ciphertext, after obfuscating the symmetric encryption key ciphertext, the ciphertext information of the current key is obtained, the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is transmitted to the server, that is, the message package may include the ciphertext of the current key. After receiving the message package, the server disassembles it and first verifies the validity of the timestamp and random number. If they are invalid, it sends the processing result information to the client. If they are valid, it first de-obfuscates the ciphertext information of the current key to obtain the symmetric encryption key ciphertext, and then uses the server's private key to decrypt the symmetric encryption key ciphertext to obtain the message ciphertext summary. It uses the summary encryption algorithm to encrypt the encrypted message to be transmitted after disassembly to obtain the ciphertext to be verified. It compares the ciphertext to be verified with the message ciphertext summary for consistency. If they are inconsistent, it sends the processing result information to the client. If they are consistent, it uses the server's current key to decrypt the encrypted message to be transmitted to finally obtain the plaintext of the message content.
[0069] The beneficial effect of such a setting is that data is encrypted using a multi-layer encryption method, thereby improving the security of data transmission.
[0070] The embodiment of the present application provides a data transmission method and device based on a request message. When the client obtains the message to be transmitted, the current key is first generated; then, according to the current key, the message to be transmitted is encrypted to obtain the message content ciphertext, that is, the encrypted message to be transmitted, and according to the message content ciphertext, based on the digest encryption algorithm, the message ciphertext summary is obtained; again, based on the preset public key information, the current key is encrypted to obtain the symmetric encryption key ciphertext, and the symmetric encryption key ciphertext is obfuscated to obtain the ciphertext information of the current key; finally, the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server. This method encrypts the message with a key, and double-encrypts the key through public key and obfuscated encryption, which prevents the leakage of the key and effectively improves the security of data transmission.
[0071] Figure 2 A flowchart of a data transmission method based on a request message provided in this application is shown in FIG. Figure 2 As shown, the method includes:
[0072] S201. Obtain a message to be transmitted and generate a current key.
[0073] This step can refer to the above step S101 and will not be described in detail.
[0074] S202. Encrypt the message to be transmitted according to the current key to obtain a message ciphertext summary; wherein the message ciphertext summary represents summary information of the encrypted message to be transmitted.
[0075] This step can refer to the above step S102 and will not be described in detail.
[0076] S203: Encrypt the current key based on the preset public key information to obtain the encrypted current key.
[0077] Exemplarily, a public key is generated on the server side, distributed to the corresponding client according to the numbering information, and stored on the client side for encrypting the symmetric encryption key generated by the client side, wherein the symmetric encryption key is the current key, and the numbering information is the unique identifier of the client. The client and the public key both contain the numbering information and correspond one to one. The client side is preset with an asymmetric key generation module and a security key module, wherein the asymmetric key generation module generates a public-private key pair required for secure transmission on the server side based on an asymmetric encryption algorithm, and the asymmetric encryption algorithm for generating the public-private key pair includes but is not limited to RSA, ECC, SM2, etc. For example, after obtaining the message to be transmitted, the message to be transmitted is encrypted by the client's current key to generate a message content ciphertext, and a summary information is generated for the message content ciphertext by a summary encryption algorithm, i.e., a message ciphertext summary is obtained, wherein the summary information refers to a string used to encrypt the message content ciphertext, and the generated symmetric encryption key is encrypted using the public key stored on the client side to obtain the symmetric encryption key ciphertext, i.e., the encrypted current key.
[0078] The beneficial effect of such a setting is that it is easy to prevent key leakage during transmission and improve the security of data transmission.
[0079] S204: Obfuscate the encrypted current key to obtain ciphertext information of the current key.
[0080] Exemplarily, the current key is a symmetric encryption key generated by the client, and the client is preset with an obfuscation module to prevent collision attacks and further ensure the security of the symmetric encryption key, wherein the obfuscation method includes but is not limited to string bit transformation, random bit insertion and subtraction, etc. The obfuscation module is divided into two categories: client obfuscation module and server obfuscation module. The client obfuscation module is used for symmetric encryption key ciphertext obfuscation processing to generate obfuscated symmetric encryption key ciphertext. For example, after the client obtains the message to be transmitted, it uses the client's symmetric encryption key to encrypt the message content to obtain the message content ciphertext, and based on the summary encryption algorithm, encrypts the message content ciphertext to generate summary information of the message content ciphertext, that is, obtains the message ciphertext summary, wherein the summary information refers to the string used to encrypt the message content ciphertext, and then uses the public key stored in the client to encrypt the current key to obtain the symmetric encryption key ciphertext, that is, the encrypted current key, and performs obfuscation encryption processing on the encrypted current key to obtain the ciphertext information of the current key.
[0081] The beneficial effect of such a setting is that it facilitates the prevention of collision attacks and further ensures the security of symmetric encryption keys.
[0082] The embodiment of the present application provides a data transmission method and device based on a request message. When the client obtains the message to be transmitted, the current key is first generated; then, according to the current key, the message to be transmitted is encrypted to obtain the message content ciphertext, that is, the encrypted message to be transmitted, and according to the message content ciphertext, based on the digest encryption algorithm, the message ciphertext summary is obtained; again, based on the preset public key information, the current key is encrypted to obtain the symmetric encryption key ciphertext, and the symmetric encryption key ciphertext is obfuscated to obtain the ciphertext information of the current key; finally, the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server. This method encrypts the message with a key, and double-encrypts the key through public key and obfuscated encryption, which prevents the leakage of the key and effectively improves the security of data transmission.
[0083] Figure 3 A flowchart of a data transmission method based on a request message provided in this application is shown in FIG. Figure 3 As shown, the method includes:
[0084] S301. Obtain a message to be transmitted and generate a current key.
[0085] This step can refer to the above step S201 and will not be described in detail.
[0086] S302. Encrypt the message to be transmitted according to the current key to obtain a message ciphertext summary; wherein the message ciphertext summary represents summary information of the encrypted message to be transmitted.
[0087] This step can refer to the above step S202 and will not be described in detail.
[0088] S303: Based on the preset public key information, encrypt the current key to obtain the ciphertext information of the current key.
[0089] This step can refer to the above step S303 and will not be described in detail.
[0090] S304: Generate a timestamp and a random number.
[0091] Exemplarily, a timestamp is a complete and verifiable data that can indicate that a piece of data existed before a certain time. It is usually a sequence of characters used to uniquely identify a certain moment in time. A random number refers to an arbitrary or non-repetitive random value that is used only once, and is used to ensure that the verification information is not reused to combat replay attacks. For example, after the client obtains the message to be transmitted, it encrypts the message to be transmitted and the current key, and finally obtains the obfuscated symmetric encryption key ciphertext, that is, the ciphertext information of the current key. Then, the timestamp and random number of this transmission are generated in the client to prevent each message content from being replayed. The system contains an anti-replay module, which is divided into two categories: a client anti-replay module and a server anti-replay module. Among them, the client anti-replay module is used to generate a timestamp (English: timestamp) and a random number (English: nonce), and the server anti-replay module is used to verify the validity of the timestamp and the random number.
[0092] The beneficial effect of such a setting is that it is easy to prevent messages from being attacked by replay and improve the security of data transmission.
[0093] S305 , the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp, and the random number are packaged to obtain a message package.
[0094] Exemplarily, after the client obtains the message to be transmitted, it first uses the symmetric encryption key generated by the client to encrypt the message to obtain the message content ciphertext, that is, the encrypted message to be transmitted, and encrypts the message content ciphertext based on the digest encryption algorithm to generate summary information of the message content ciphertext, that is, obtain the message ciphertext summary, wherein the summary information refers to the character string used to encrypt the message content ciphertext, and then uses the public key stored in the client to encrypt the symmetric encryption key to obtain the symmetric encryption key ciphertext, wherein the symmetric encryption key is the current key, and the symmetric encryption key ciphertext is obfuscated and encrypted to obtain the obfuscated symmetric encryption key ciphertext, that is, the ciphertext information of the current key. Finally, the client block generates the timestamp and random number of this transmission, and packages the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp, and the random number to obtain a message package.
[0095] The beneficial effect of such a setting is that the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp, and the random number are packaged and sent to the server, so as to improve the security of data transmission.
[0096] The embodiment of the present application provides a data transmission method and device based on a request message. When the client obtains the message to be transmitted, the current key is first generated; then, according to the current key, the message to be transmitted is encrypted to obtain the message content ciphertext, that is, the encrypted message to be transmitted, and according to the message content ciphertext, based on the digest encryption algorithm, the message ciphertext summary is obtained; again, based on the preset public key information, the current key is encrypted to obtain the symmetric encryption key ciphertext, and the symmetric encryption key ciphertext is obfuscated to obtain the ciphertext information of the current key; finally, the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server. This method encrypts the message with a key, and double-encrypts the key through public key and obfuscated encryption, which prevents the leakage of the key and effectively improves the security of data transmission.
[0097] Figure 4 A flowchart of a data transmission method based on a request message provided in this application, the method is applied to the server, such as Figure 4 As shown, the method includes:
[0098] S401, receiving a message package from a client; wherein the message package is used to represent the message to be transmitted and generate a current key; according to the current key, the message to be transmitted is encrypted to obtain a message ciphertext summary; wherein the message ciphertext summary represents the summary information of the encrypted message to be transmitted; based on the preset public key information, the current key is encrypted to obtain the ciphertext information of the current key; the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server.
[0099] Exemplarily, the message package includes the ciphertext information of the current key, the ciphertext summary of the message, the encrypted message to be transmitted, as well as a timestamp and a random number. For example, after obtaining the message to be transmitted, the client uses the current key to encrypt the message content to obtain the ciphertext of the message content, encrypts the ciphertext of the message content based on the summary encryption algorithm to obtain the ciphertext summary of the message, and uses the public key and obfuscation module stored in the client to perform double encryption on the current key to obtain the ciphertext information of the current key. Finally, the client generates the timestamp and random number of this transmission, and packages the ciphertext information of the current key, the ciphertext summary of the message, the encrypted message to be transmitted, the timestamp and the random number to obtain a message package, and transmits the message package to the server. The server then decrypts the timestamp, random number, the ciphertext information of the current key, the ciphertext summary of the message, and the encrypted message to be transmitted in turn to finally obtain the plaintext of the message content.
[0100] The beneficial effect of such a setting is that data transmission is encrypted using a multiple encryption method, which is beneficial to improving the security of the data transmission process.
[0101] S402. Decrypt the ciphertext information of the current key in the message packet according to the preset private key information to obtain the current key; wherein the preset private key information corresponds to the preset public key information.
[0102] Exemplarily, the server generates a public-private key pair for encrypting the current key, wherein the public key is distributed to the client according to the numbering information and stored on the client, wherein the numbering information is the unique identifier of the client, the public key finds the corresponding client according to the numbering information and stores it, and the private key is directly stored on the server after being generated on the server, and the private key information and the public key information correspond to each other. For example, after the client receives the message to be transmitted, after encrypting both the message and the current key, the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp and the random number are packaged to form a message package and sent to the server. After the server receives the message package, it first disassembles the message package to obtain the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp, and the random number. After verifying the validity of the timestamp and the random number, the ciphertext information of the current key is first deobfuscated to obtain the symmetric encryption key ciphertext, and the obtained symmetric encryption key ciphertext is decrypted using the private key of the server to obtain the symmetric encryption key, i.e., the current key.
[0103] The beneficial effect of such a setting is that the data can be decrypted using a public-private key pair and an obfuscation module, thereby preventing key leakage.
[0104] In this embodiment, according to the preset private key information, the ciphertext information of the current key in the message packet is decrypted to obtain the current key, including: deobfuscating the ciphertext information of the current key in the message packet to obtain the encrypted current key; decrypting the encrypted current key according to the preset private key information to obtain the current key.
[0105] Exemplarily, the message package contains the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp and the random number. An obfuscation module is preset in the system, wherein the obfuscation module is divided into a client obfuscation module and a server obfuscation module. The deobfuscation processing refers to the server performing a deobfuscation operation on the obfuscated symmetric encryption key ciphertext to obtain the symmetric encryption key ciphertext, that is, the encrypted current key. The public and private key pairs are generated on the server, wherein the public key is distributed to the client and stored according to the number. The number information is the unique identifier of the client. The public key can find the corresponding client according to the number information and is stored on the client for encrypting the current key. The private key is stored on the server for decrypting the ciphertext information of the current key received by the server. The public key and the private key are one-to-one corresponding. For example, after the server obtains the message packet, it first disassembles the message packet to obtain the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp, and the random number. After verifying the validity of the timestamp and the random number, the server performs deobfuscation processing on the ciphertext information of the current key to obtain the symmetric encryption key ciphertext, that is, the encrypted current key, and decrypts the encrypted current key based on the private key stored in the server to obtain the symmetric encryption key, that is, the current key.
[0106] The beneficial effect of such a setting is that double encryption of the key is performed, which helps prevent key leakage and improves the security of data transmission.
[0107] S403: encrypt the encrypted message to be transmitted according to a preset digest encryption algorithm to obtain a ciphertext to be verified.
[0108] Exemplarily, the ciphertext to be verified is used to verify the consistency of the message ciphertext digest obtained from the client. The client generates a content ciphertext digest string, i.e., a message ciphertext digest, based on a digest encryption algorithm according to the incoming message content ciphertext. The digest encryption algorithm for generating the digest string includes, but is not limited to, SHA-256, SHA-1, MD5, and other algorithms. For example, after obtaining the message to be transmitted, the client encrypts the message content and the current key, and finally obtains the ciphertext information of the current key, the message ciphertext digest, and the encrypted message to be transmitted. Finally, the client packages the ciphertext information of the current key, the message ciphertext digest, the encrypted message to be transmitted, the generated timestamp, and the random number, and sends them to the server in the form of a message package. After receiving the message package, the server first disassembles the message package, and after obtaining the disassembled message package, verifies the timestamp and the random number, and then uses the digest encryption algorithm on the server to encrypt the encrypted message to be transmitted obtained after disassembly, and obtains the ciphertext to be verified for verification.
[0109] The beneficial effect of such a setting is that it facilitates integrity verification of data transmitted to the server and improves the security of data transmission.
[0110] S404: If the ciphertext to be verified is consistent with the message ciphertext digest, the encrypted message to be transmitted is decrypted according to the current key to obtain the message to be transmitted.
[0111] Exemplarily, the message package is obtained by packaging and processing by the client, and the message package includes the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp and the random number. The ciphertext to be verified is obtained by encrypting the encrypted message to be transmitted obtained after the server disassembles the message package according to a preset summary encryption algorithm. The message ciphertext summary is obtained by encrypting the message by the client using the summary encryption algorithm. For example, after the server obtains the message packet sent by the client, the message packet is disassembled to obtain the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp and the random number. After the timestamp and the random number are verified to be valid, the ciphertext information of the current key is deobfuscated and private key processed to obtain the symmetric encryption key, i.e., the current key. The ciphertext to be verified is compared with the message ciphertext summary for consistency. If they are inconsistent, the result is sent to the client for feedback. If the two ciphertexts are consistent, it means that the transmitted data is complete or has not been tampered with. Then, the symmetric encryption key, i.e., the current key, sent by the client to the server is used to decrypt the encrypted message to be transmitted, obtain the message to be transmitted, and send the result to the client.
[0112] The beneficial effect of such a setting is that it facilitates integrity verification of data transmitted to the server and improves the security of data transmission.
[0113] In this embodiment, it also includes: obtaining a timestamp and a random number from the message packet; if it is determined that the timestamp and the random number are valid data, then continuing to execute decryption processing on the ciphertext information of the current key in the message packet according to the preset private key information to obtain the current key.
[0114] For example, the timestamp is used to uniquely identify the time of a certain moment, the random number is used to ensure that the verification information is not reused, the ciphertext information of the current key is obtained after the public key is encrypted and obfuscated, the private key is generated on the server side and automatically stored on the server side, and is used to decrypt the symmetric encryption key ciphertext obtained by encrypting the client's public key, wherein the public key and the private key are one-to-one corresponding. For example, after the client encrypts the message content and the current key, the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, and the generated timestamp and random number are packaged to form a message package, and sent to the server side. After the server side obtains the message package, it disassembles the message package, obtains the timestamp and random number in the message package, and first verifies the validity of the timestamp and random number. If it is invalid, the processing result and detailed information are sent to the client. If it is valid, the ciphertext information of the current key is first deobfuscated to obtain the symmetric encryption key ciphertext, and the symmetric encryption key ciphertext is decrypted using the private key to obtain the symmetric encryption key, that is, the current key.
[0115] The beneficial effect of such a setting is that setting the timestamp and random number facilitates preventing the message from being replayed and improves the security of data transmission.
[0116] In this embodiment, determining that the timestamp and the random number are valid data includes: obtaining the current time, and if the time difference between the current time and the timestamp is less than a preset difference threshold, determining that the timestamp is valid data. If the random number does not exist in a preset historical database, determining that the random number is valid data, and storing the random number in the preset historical database; wherein the preset historical database is used to store the random numbers that have been generated.
[0117] Exemplarily, a message package is obtained by the client packaging the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, as well as the timestamp and the random number. The timestamp is used to uniquely identify the time of a certain moment, and the random number is used to ensure that the verification information is not reused to combat replay attacks. A historical database is preset in the system, and the preset historical database is used to store the random numbers that have been generated. The historical database includes but is not limited to key value databases such as redis databases, memcache databases, etc., and relational databases such as mysql databases, etc. For example, after obtaining the message packet transmitted from the client to the server, the server disassembles the message packet to obtain the timestamp and the random number, and verifies the validity of the timestamp. The system has a preset time difference threshold, and obtains the current time. If the time difference between the current time and the timestamp is not within the preset time difference threshold, it indicates that the data is invalid, and the verification result information is sent to the client; if the time difference between the current time and the timestamp is within the preset time difference threshold, the timestamp is determined to be valid data, and then the validity of the random number is verified. The obtained random number is first compared with the random number in the preset historical database. If the historical database does not contain the random number, it indicates that the random number is valid data, and the ciphertext information of the current key continues to be decrypted and the random number is stored in the historical database. Otherwise, it is invalid data, and the processing result information is sent to the client.
[0118] The beneficial effect of such a setting is that the security of data is determined by judging the validity of the timestamp and the random number, thereby facilitating improving the security of data transmission.
[0119] The embodiment of the present application provides a data transmission method and device based on a request message. When the client obtains the message to be transmitted, the current key is first generated; then, according to the current key, the message to be transmitted is encrypted to obtain the message content ciphertext, that is, the encrypted message to be transmitted, and according to the message content ciphertext, based on the digest encryption algorithm, the message ciphertext summary is obtained; again, based on the preset public key information, the current key is encrypted to obtain the symmetric encryption key ciphertext, and the symmetric encryption key ciphertext is obfuscated to obtain the ciphertext information of the current key; finally, the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server. This method encrypts the message with a key, and double-encrypts the key through public key and obfuscated encryption, which prevents the leakage of the key and effectively improves the security of data transmission.
[0120] Figure 5 The overall flow chart of a data transmission method based on a request message provided by this application is as follows: Figure 5 As shown, the method specifically comprises the following steps:
[0121] S501. The encryption module generates a symmetric encryption key using a "one-time one-key" method, and uses the generated symmetric encryption key to encrypt the plain text content of the message to generate a ciphertext of the message content.
[0122] Exemplarily, the client encryption module uses a "one-time one-password" high-intensity method to generate a symmetric encryption key, and uses the key to encrypt the plaintext content of the message, where "one-time one-password" means that a new symmetric encryption key will be generated each time the client transmits a message. First, a 32-bit unique string is generated in the client, and then the string is used to generate a symmetric encryption key based on an encryption algorithm. The method for generating a symmetric encryption key includes but is not limited to the AES-256 encryption algorithm, etc. Finally, the key is used to encrypt the plaintext content of the message to generate a ciphertext of the message content.
[0123] The beneficial effect of this setting is that the key is generated directly on the client using the "one-time one-password" method, which avoids key leakage and facilitates improving the security of data transmission.
[0124] S502: The summary module generates a content ciphertext summary character string for the message content ciphertext.
[0125] Exemplarily, the message content ciphertext is obtained by encrypting the message content with the client's symmetric encryption key. The client is preset with a summary module, and the summary module is divided into two categories: client summary module and server summary module. Among them, the client's summary module is based on a summary encryption algorithm and generates a content ciphertext summary string according to the message content ciphertext. The method of generating the summary string includes but is not limited to the SHA-256 algorithm, the SHA-1 algorithm, the MD5 algorithm, etc.
[0126] The beneficial effect of such a setting is that it is easy to verify the integrity of the transmitted data and ensure the security of data transmission.
[0127] S503: The public key of the security key module encrypts the symmetric encryption key to generate a symmetric encryption key ciphertext.
[0128] Exemplarily, a security key module is preset in the system, which is divided into two categories: a client security key module and a server security key module. The client security key module is used to access the public key in the public-private key pair generated by the server, wherein the public key is distributed to the client through number information, the number information represents the unique identification of the client, and the symmetric encryption key protecting the message content is encrypted through the public key to generate a symmetric encryption key ciphertext.
[0129] The beneficial effect of such a setting is that the key is encrypted with the public key, which helps prevent the key from being leaked.
[0130] S504: The obfuscation module performs obfuscation processing on the symmetric encryption key ciphertext to generate an obfuscated symmetric encryption key ciphertext.
[0131] Exemplarily, the system is preset with an obfuscation module, which is divided into two categories: a client obfuscation module and a server obfuscation module, for the purpose of preventing collision attacks and further ensuring the security of symmetric encryption keys. The client obfuscation module is used to obfuscate the symmetric encryption key ciphertext and generate an obfuscated symmetric encryption key ciphertext.
[0132] The beneficial effect of such a setting is that the key is doubly encrypted, which makes it easier to ensure the security of the key, avoid key leakage, and improve the security of data transmission.
[0133] S505: The anti-replay module generates a timestamp and a random number for this transmission.
[0134] Exemplarily, the anti-replay module is divided into two categories: the client anti-replay module and the server anti-replay module, the purpose of which is to prevent the content of each message from being replayed. The client anti-replay module is used to generate the timestamp and random number of this transmission, and the server anti-replay module is used to verify the validity of the timestamp and random number generated by the client.
[0135] The beneficial effect of such a setting is that the data is encrypted using a timestamp and a random number, thereby facilitating improving the security of data transmission.
[0136] S506. Confusing the symmetric encryption key ciphertext, the message content ciphertext, the content ciphertext summary character string, the timestamp and the random number combination to generate a message transmission body.
[0137] S507, split out the obfuscated symmetric encryption key ciphertext, the message content ciphertext, the content ciphertext summary character string, the timestamp and the random number.
[0138] S508: The anti-replay module verifies the validity of the timestamp and the random number.
[0139] Exemplarily, after the client combines the obfuscated symmetric encryption key ciphertext, message content ciphertext, content ciphertext summary string, timestamp and random number to generate a message transmission body, it is transmitted to the server, where the obfuscated symmetric encryption key ciphertext, message content ciphertext, content ciphertext summary string, timestamp and random number are split up, and the timestamp and random number are verified using the server's anti-replay module. If the verification result is invalid, a processing result notification message is sent to the client. If it is valid, the obfuscated symmetric encryption key ciphertext is decrypted.
[0140] The beneficial effect of this setting is that the validity of the timestamp and random number can be verified, which facilitates the protection of data security.
[0141] S509: The obfuscation module de-obfuscates the obfuscated symmetric encryption key ciphertext to obtain the symmetric encryption key ciphertext.
[0142] Exemplarily, the server-side obfuscation module is used to perform an anti-obfuscation operation on the obfuscated symmetric encryption key ciphertext to obtain the symmetric encryption key ciphertext. The obfuscation methods include but are not limited to string bit transformation, random bit interpolation and subtraction values, etc. In actual use, the class library where the obfuscation method and the anti-obfuscation method are located in the obfuscation module can be updated regularly as needed. The class library where the obfuscation method is located and the class library where the anti-obfuscation method is located are uniformly updated on the server side, and the updated class library where the obfuscation method is located is distributed to the client obfuscation module through the numbering information. After the client obfuscation module receives the updated class library, it automatically implements hot update to take effect. Among them, hot update refers to updating part of the program during software operation without stopping the operation of the entire program. The numbering information represents the unique identification of the client. After the update, the class library where the anti-obfuscation method is located is directly hot-updated in the server-side anti-obfuscation module to take effect, thereby better ensuring the security of data transmission.
[0143] The beneficial effect of such a setting is that it facilitates better protection of the security of data transmission.
[0144] S510. The security key module uses the private key to decrypt the symmetric encryption key ciphertext to obtain the symmetric encryption key.
[0145] Exemplarily, the security key module is divided into two categories: the client security key module and the server security key module. The server security key module is used to access the private key in the public-private key pair generated by the server, and decrypt the specified symmetric encryption key ciphertext through the private key to obtain the symmetric encryption key. In actual use, the public-private key pair can be regularly generated by the asymmetric key generation module as needed, and the public key and private key in the generated public-private key pair are updated to the client security key module and the server security key module respectively, wherein the public key is distributed to the client through the numbering information, which represents the unique identification of the client, and the private key is automatically stored on the server after being generated on the server, thereby better improving the security of data transmission.
[0146] The beneficial effect of such a setting is that it helps to avoid the leakage of keys and better improve the security of data transmission.
[0147] S511. The summary module generates a verification content ciphertext summary string for the message content ciphertext, and determines whether the verification content ciphertext summary string is consistent with the content ciphertext summary string split out from the message transmission body.
[0148] Exemplarily, summary modules are divided into two categories: client summary modules and server summary modules. Both generate content ciphertext summary strings based on the incoming message content ciphertext, and determine whether the verification content ciphertext summary string generated by the server is consistent with the content ciphertext summary string split out from the message transmission body. If they are inconsistent, it indicates that the message content transmission is incomplete or has been illegally tampered with, and the processing result information is sent to the client. If they are consistent, the decryption module of the server continues to be used to decrypt the data.
[0149] The beneficial effect of such a setting is that it facilitates ensuring the integrity of data transmission.
[0150] S512: The server-side decryption module uses the symmetric encryption key to perform a decryption operation to obtain the plaintext content of the message.
[0151] Exemplarily, the server-side decryption module decrypts the message content ciphertext using a symmetric encryption key to obtain the message content plaintext, and the decryption module corresponds one-to-one to the encryption module of the client.
[0152] The beneficial effect of such an arrangement is that it facilitates providing security for data transmission.
[0153] Figure 6 A schematic diagram of a data transmission device based on a request message provided in this application, which is applied to a client, such as Figure 6 As shown, the device 600 provided in this embodiment includes:
[0154] The acquisition module 601 acquires the message to be transmitted and generates the current key;
[0155] The first encryption module 602 is used to encrypt the message to be transmitted according to the current key to obtain a message ciphertext summary; wherein the message ciphertext summary represents summary information of the encrypted message to be transmitted;
[0156] The second encryption module 603 encrypts the current key based on the preset public key information to obtain the ciphertext information of the current key;
[0157] The packing module 604 packs the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted to obtain a message package, and sends the message package to the server.
[0158] Figure 7 A structural diagram of a data transmission device based on a request message provided in this application, such as Figure 7As shown, the device 700 includes an acquisition module 701, a first encryption module 702, and a second encryption module 703, wherein the first encryption module 702 includes a first encryption unit 7021 and a second encryption unit 7022, the second encryption module 703 includes a third encryption unit 7031 and an obfuscation unit 7032, and the packaging module 704 includes a generation unit 7041 and a packaging unit 7042.
[0159] In one example, the first encryption module 702 includes:
[0160] The first encryption unit 7021 is used to encrypt the message to be transmitted according to the current key to obtain an encrypted message to be transmitted;
[0161] The second encryption unit 7022 is used to encrypt the encrypted message to be transmitted according to a preset digest encryption algorithm to obtain the message ciphertext digest.
[0162] In one example, the second encryption module 703 includes:
[0163] The third encryption unit 7031 is used to encrypt the current key based on the preset public key information to obtain the encrypted current key;
[0164] The obfuscation unit 7032 is used to perform obfuscation processing on the encrypted current key to obtain ciphertext information of the current key.
[0165] In one example, the packaging module 704 includes:
[0166] A generating unit 7041, used to generate a timestamp and a random number;
[0167] The packing unit 6042 is used to pack the ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp, and the random number to obtain a message package.
[0168] Figure 8 A schematic diagram of a data transmission device based on a request message provided in this application, which is applied to a server, such as Figure 8 As shown, the device 800 provided in this embodiment includes:
[0169] The receiving module 801 is used to receive a message package from a client; wherein the message package is used to represent the message to be transmitted and generate a current key; according to the current key, the message to be transmitted is encrypted to obtain a message ciphertext summary; wherein the message ciphertext summary represents the summary information of the encrypted message to be transmitted; based on the preset public key information, the current key is encrypted to obtain the ciphertext information of the current key; the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server;
[0170] The first decryption module 802 is used to decrypt the ciphertext information of the current key in the message packet according to the preset private key information to obtain the current key; wherein the preset private key information corresponds to the preset public key information;
[0171] The second decryption module 803 is used to encrypt the encrypted message to be transmitted according to a preset digest encryption algorithm to obtain a ciphertext to be verified.
[0172] The verification module 804 is used to decrypt the encrypted message to be transmitted according to the current key to obtain the message to be transmitted if the ciphertext to be verified is consistent with the message ciphertext digest.
[0173] Fig. 9 A structural diagram of a data transmission device based on a request message provided in this application, such as Fig. 9 As shown, the device 900 includes a receiving module 901, a first decryption module 902, a second decryption module 903, and a verification module 904, wherein the first decryption module 902 includes an anti-obfuscation unit 9021, a decryption unit 9022, an acquisition unit 9023, and a determination unit 9024.
[0174] In one example, the first decryption module 902 includes:
[0175] The deobfuscation unit 9021 is used to perform deobfuscation processing on the ciphertext information of the current key in the message packet to obtain the encrypted current key;
[0176] The decryption unit 9022 is used to decrypt the encrypted current key according to the preset private key information to obtain the current key.
[0177] In one example, it also includes:
[0178] An acquisition unit 9023, configured to acquire a timestamp and a random number from the message packet;
[0179] The determination unit 9024 is used to continue to execute the decryption processing of the ciphertext information of the current key in the message packet according to the preset private key information to obtain the current key if it is determined that the timestamp and the random number are valid data.
[0180] In one example, the determining unit 9024 includes:
[0181] A first determining subunit, configured to obtain a current time, and if a time difference between the current time and the timestamp is less than a preset difference threshold, determine that the timestamp is valid data;
[0182] The second determination subunit is used to determine that the random number is valid data if the random number does not exist in the preset historical database, and store the random number in the preset historical database; wherein the preset historical database is used to store the random numbers that have been generated.
[0183] The present embodiment provides a data transmission device based on a request message, which can execute the method provided by the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail in the present embodiment.
[0184] Fig.10 A schematic diagram of a data transmission device based on a request message provided in this application. Fig.10 As shown, the electronic device 1000 provided in this embodiment includes: at least one processor 1001 and a memory 1002. Optionally, the device 1000 also includes a communication component 1003. The processor 1001, the memory 1002 and the communication component 1003 are connected via a bus.
[0185] In a specific implementation process, at least one processor 1001 executes the computer-executable instructions stored in the memory 1002, so that at least one processor 1001 executes the above method.
[0186] The specific implementation process of the processor 1001 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0187] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0188] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk storage.
[0189] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0190] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0191] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0192] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0193] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0194] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as 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 an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0195] 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.
[0196] In addition, each functional unit in each embodiment of the present invention 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.
[0197] If the function 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 invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0198] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0199] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A data transmission method based on a request message, characterized in that: The method is applied to a client, and the method comprises: Get the message to be transmitted and generate the current key; According to the current key, the message to be transmitted is encrypted to obtain a message ciphertext summary; wherein the message ciphertext summary represents summary information of the encrypted message to be transmitted; Based on the preset public key information, encrypt the current key to obtain the ciphertext information of the current key; The ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, and the message package is sent to the server.
2. The method according to claim 1, characterized in that The message to be transmitted is encrypted according to the current key to obtain a message ciphertext digest, including: Encrypting the message to be transmitted according to the current key to obtain an encrypted message to be transmitted; The encrypted message to be transmitted is encrypted according to a preset digest encryption algorithm to obtain the message ciphertext digest.
3. The method according to claim 1, characterized in that Based on the preset public key information, the current key is encrypted to obtain the ciphertext information of the current key, including: Based on the preset public key information, encrypt the current key to obtain an encrypted current key; The encrypted current key is obfuscated to obtain ciphertext information of the current key.
4. The method according to claim 1, characterized in that: The ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message package, including: Generate timestamps and random numbers; The ciphertext information of the current key, the message ciphertext summary, the encrypted message to be transmitted, the timestamp, and the random number are packaged to obtain a message package.
5. A data transmission method based on a request message, characterized in that: The method is applied to the server, and the method includes: Receive a message package from a client; wherein the message package is used to represent the message to be transmitted and generate a current key; according to the current key, encrypt the message to be transmitted to obtain a message ciphertext summary; wherein the message ciphertext summary represents the summary information of the encrypted message to be transmitted; based on the preset public key information, encrypt the current key to obtain the ciphertext information of the current key; package the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted to obtain a message package, and send the message package to the server; According to the preset private key information, the ciphertext information of the current key in the message packet is decrypted to obtain the current key; wherein the preset private key information corresponds to the preset public key information; According to a preset digest encryption algorithm, the encrypted message to be transmitted is encrypted to obtain a ciphertext to be verified; If the ciphertext to be verified is consistent with the message ciphertext digest, the encrypted message to be transmitted is decrypted according to the current key to obtain the message to be transmitted.
6. The method according to claim 5, characterized in that According to the preset private key information, the ciphertext information of the current key in the message packet is decrypted to obtain the current key, including: Performing a deobfuscation process on the ciphertext information of the current key in the message packet to obtain an encrypted current key; According to the preset private key information, the encrypted current key is decrypted to obtain the current key.
7. The method according to claim 5, characterized in that Also includes: Obtaining a timestamp and a random number from the message packet; If it is determined that the timestamp and the random number are valid data, the process of decrypting the ciphertext information of the current key in the message packet according to the preset private key information is continued to obtain the current key.
8. The method according to claim 7, characterized in that Determining that the timestamp and the random number are valid data includes: The current time is obtained, and if the time difference between the current time and the timestamp is less than a preset difference threshold, the timestamp is determined to be valid data. If the random number does not exist in the preset historical database, the random number is determined to be valid data, and the random number is stored in the preset historical database; wherein the preset historical database is used to store the random numbers that have been generated.
9. A data transmission device based on a request message, characterized in that: The device is applied to a client, and comprises: The acquisition module obtains the message to be transmitted and generates the current key; The first encryption module encrypts the message to be transmitted according to the current key to obtain a message ciphertext summary; wherein the message ciphertext summary represents summary information of the encrypted message to be transmitted; The second encryption module encrypts the current key based on the preset public key information to obtain the ciphertext information of the current key; The packing module packs the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted to obtain a message package, and sends the message package to the server.
10. A data transmission device based on a request message, characterized in that: The device is applied to a server, and includes: A receiving module receives a message packet from a client; wherein the message packet is used to represent the message to be transmitted and generate a current key; according to the current key, the message to be transmitted is encrypted to obtain a message ciphertext summary; wherein the message ciphertext summary represents the summary information of the encrypted message to be transmitted; based on the preset public key information, the current key is encrypted to obtain the ciphertext information of the current key; the ciphertext information of the current key, the message ciphertext summary, and the encrypted message to be transmitted are packaged to obtain a message packet, and the message packet is sent to the server; A first decryption module, decrypting the ciphertext information of the current key in the message packet according to the preset private key information to obtain the current key; wherein the preset private key information corresponds to the preset public key information; The second decryption module encrypts the encrypted message to be transmitted according to a preset digest encryption algorithm to obtain a ciphertext to be verified; The verification module decrypts the encrypted message to be transmitted according to the current key to obtain the message to be transmitted if the ciphertext to be verified is consistent with the message ciphertext digest.
Citation Information
Patent Citations
Message transmission method and device
CN110166242A
Data transmission method, device and equipment, computer readable storage medium and product
CN114745207A
Safety authentication method and device for unmanned driving
CN115801363A
Message transmission method, message verification method, device, equipment, medium and product
CN116684102A
Information verification method and related apparatus, device, and storage medium
US20230071847A1