Data transmission method, device, terminal equipment and storage medium
By generating message signatures and encrypting diagnostic data in the data transmission of automotive diagnostic equipment, and using the chip identifier of the server for verification and decryption, the problem of cloud diagnostic data transmission security is solved and data integrity and security is ensured.
Patent Information
- Application Number
- CN202211278659.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-17
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2042-10-17
AI Technical Summary
When existing automotive diagnostic equipment uses cloud diagnostic functions, diagnostic data is transmitted through plain text and is easily attacked by bypasses or tampered with, lacking the security of cyber attacks.
During the data transmission process, a message signature is generated and added to the request header, the diagnostic data is encrypted, and verified and decrypted through the chip identification of the server to ensure the integrity and security of the data.
Through the dual technical guarantees of message signature and data encryption, bypass attacks and tampering of diagnostic data during transmission are avoided, and data transmission security issues between diagnostic equipment and servers are solved.
Smart Images

Figure CN115967496B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a data transmission method, apparatus, terminal equipment and storage medium. Background Art
[0002] Nowadays, automobile diagnostics are mostly completed through related diagnostic equipment. With the rapid development of diagnostic technology, diagnostic equipment gradually supports cloud diagnostic functions. In the process of using cloud diagnostic functions, diagnostic equipment will upload the collected diagnostic data to the server, and the server will receive the diagnostic data. However, currently, diagnostic data is mostly transmitted in plain text, which lacks consideration for network attacks. The diagnostic data is easily attacked by side channels or tampered with during the transmission from the diagnostic device to the server. Summary of the invention
[0003] The main purpose of the present application is to provide a data transmission method, apparatus, terminal device and storage medium, aiming to solve the security problem of diagnostic data transmission between a diagnostic device and a server.
[0004] To achieve the above object, the present application provides a data transmission method, which is applied to a target diagnostic device and includes:
[0005] Generate a message signature and add the message signature to the request header;
[0006] encrypting the target diagnostic data to obtain encrypted diagnostic data;
[0007] A data upload message including the request header and the encrypted diagnostic data is sent to the server, so that the server can verify the message signature. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data.
[0008] Optionally, the step of generating a message signature and adding the message signature to a request header includes:
[0009] Calculate a hash value of at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value;
[0010] Concatenating the first hash value, the at least one request header parameter, and the chip identifier of the target diagnostic device to obtain a concatenated string;
[0011] Performing hash value calculation on the concatenated string based on the preset hash algorithm to obtain a corresponding second hash value;
[0012] The message signature is generated based on the second hash value, and the message signature is added to the request header.
[0013] Optionally, the step of encrypting the target diagnostic data to obtain encrypted diagnostic data includes:
[0014] The target diagnostic data is encrypted using the chip identification of the target diagnostic device as an encryption key to obtain the encrypted diagnostic data.
[0015] Optionally, after the step of sending a data upload message based on the message signature and the encrypted diagnostic data to the server, the method further includes:
[0016] Receive the encrypted data upload result message fed back by the server;
[0017] Determining whether a preset condition for continuing uploading is met according to the data uploading result message;
[0018] If yes, continue uploading the diagnostic data to the server.
[0019] Optionally, the data transmission method is applied to a server, and the data transmission method includes:
[0020] Receiving a data upload message sent by a target diagnostic device, wherein the data upload message includes a request header and encrypted diagnostic data, the request header includes a message signature generated by the target diagnostic device, and the encrypted diagnostic data is obtained by the target diagnostic device encrypting the target diagnostic data;
[0021] Verifying the message signature;
[0022] If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data.
[0023] Optionally, before the step of receiving the data upload message sent by the target diagnostic device, the method further includes:
[0024] Acquire and store a chip identifier corresponding to at least one diagnostic device, wherein the at least one diagnostic device includes the target diagnostic device;
[0025] The step of verifying the message signature comprises:
[0026] Verifying the message signature based on the chip identification of the target diagnostic device;
[0027] If the verification is successful, the step of decrypting the encrypted diagnostic data to obtain the target diagnostic data includes:
[0028] If the verification is successful, the encrypted diagnostic data is decrypted using the chip identification of the target diagnostic device as a decryption key to obtain the target diagnostic data.
[0029] The embodiment of the present application further provides a data transmission device, which is applied to a target diagnostic device, and includes:
[0030] A signature generation module, configured to generate a message signature based on at least one request header parameter and a chip identifier of the target diagnostic device;
[0031] An encryption module, used for encrypting the target diagnostic data to obtain encrypted diagnostic data;
[0032] The sending module is used to send a data upload message including the message signature and the encrypted diagnostic data to the server, so that the server can verify the message signature based on the pre-stored chip identification of the target diagnostic device. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data.
[0033] The embodiment of the present application further provides a data transmission device, which is applied to a server, and includes:
[0034] A receiving module, configured to receive a data upload message sent by a target diagnostic device, wherein the data upload message includes a message signature and encrypted diagnostic data, the message signature is generated by the target diagnostic device based on at least one request header parameter and a chip identifier of the target diagnostic device, and the encrypted diagnostic data is obtained by the target diagnostic device encrypting the target diagnostic data;
[0035] A verification module, used to verify the message signature based on a pre-stored chip identification of the target diagnostic device;
[0036] The decryption module is used to decrypt the encrypted diagnostic data to obtain the target diagnostic data if the verification is passed.
[0037] An embodiment of the present application also proposes a terminal device, which includes a memory, a processor, and a data transmission program stored in the memory and executable on the processor, wherein the data transmission program implements the steps of the data transmission method described above when executed by the processor.
[0038] An embodiment of the present application further provides a computer-readable storage medium, on which a data transmission program is stored. When the data transmission program is executed by a processor, the steps of the data transmission method described above are implemented.
[0039] The data transmission method, apparatus, terminal device and storage medium proposed in the embodiment of the present application generate a message signature and add the message signature to the request header; encrypt the target diagnostic data to obtain encrypted diagnostic data; send a data upload message including the request header and the encrypted diagnostic data to the server, so that the server can verify the message signature. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data. Based on the scheme of the present application, the diagnostic device adds a message signature to the request header during the data upload process. The message signature can be used to verify the identity and data integrity. In addition, the target diagnostic data is encrypted to obtain encrypted diagnostic data, and the data upload message consisting of the request header and the encrypted diagnostic data is sent to the server. Due to the dual technical protection of message signature and data encryption, it is possible to prevent the target diagnostic data from being attacked by a side channel or tampered with during the transmission from the diagnostic device to the server, thereby solving the security problem of diagnostic data transmission between the diagnostic device and the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the data transmission device of this application belongs;
[0041] Figure 2 This is a flowchart of a first exemplary embodiment of a data transmission method of the present application;
[0042] Figure 3 This is a flow chart of a second exemplary embodiment of the data transmission method of the present application;
[0043] Figure 4 This is a flowchart of a third exemplary embodiment of the data transmission method of the present application;
[0044] Figure 5 This is a flowchart of a fourth exemplary embodiment of the data transmission method of the present application;
[0045] Figure 6 This is a flowchart of a fifth exemplary embodiment of the data transmission method of the present application;
[0046] Figure 7 This is a flowchart of a sixth exemplary embodiment of the data transmission method of the present application.
[0047] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0048] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] The main solution of the embodiment of the present application is: generate a message signature and add the message signature to the request header; encrypt the target diagnostic data to obtain encrypted diagnostic data; send a data upload message including the request header and the encrypted diagnostic data to the server for the server to verify the message signature. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data. Based on the scheme of the present application, the diagnostic device adds a message signature to the request header during the data upload process. The message signature can be used to verify the identity and data integrity. In addition, the target diagnostic data is encrypted to obtain encrypted diagnostic data, and the data upload message consisting of the request header and the encrypted diagnostic data is sent to the server. Due to the dual technical protection of message signature and data encryption, it is possible to prevent the target diagnostic data from being bypassed or tampered with during the transmission from the diagnostic device to the server, thereby solving the security problem of diagnostic data transmission between the diagnostic device and the server.
[0050] Specifically, refer to Figure 1 , Figure 1 This is a functional module diagram of the terminal device to which the data transmission device of this application belongs. The data transmission device can be a device that is independent of the terminal device and capable of data transmission, and can be carried on the terminal device in the form of hardware or software. The terminal device can be a smart mobile terminal with data processing functions such as a mobile phone or a tablet computer, or a fixed terminal device or server with data processing functions.
[0051] In this embodiment, the terminal device to which the data transmission apparatus belongs at least includes an output module 110 , a processor 120 , a memory 130 and a communication module 140 .
[0052] The memory 130 stores an operating system and a data transmission program. The data transmission device can store information such as the generated message signature, the request header with the message signature added, the encrypted diagnostic data obtained by encrypting the target diagnostic data, and the data upload message including the request header and the encrypted diagnostic data sent to the server in the memory 130. The output module 110 can be a display screen, etc. The communication module 140 can include a WIFI module, a mobile communication module, and a Bluetooth module, etc., and communicates with an external device or server through the communication module 140.
[0053] The data transmission program in the memory 130 implements the following steps when executed by the processor:
[0054] Generate a message signature and add the message signature to the request header;
[0055] encrypting the target diagnostic data to obtain encrypted diagnostic data;
[0056] A data upload message including the request header and the encrypted diagnostic data is sent to the server, so that the server can verify the message signature. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data.
[0057] Furthermore, when the data transmission program in the memory 130 is executed by the processor, the following steps are also implemented:
[0058] Calculate a hash value of at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value;
[0059] Concatenating the first hash value, the at least one request header parameter, and the chip identifier of the target diagnostic device to obtain a concatenated string;
[0060] Performing hash value calculation on the concatenated string based on the preset hash algorithm to obtain a corresponding second hash value;
[0061] The message signature is generated based on the second hash value, and the message signature is added to the request header.
[0062] Furthermore, when the data transmission program in the memory 130 is executed by the processor, the following steps are also implemented:
[0063] The target diagnostic data is encrypted using the chip identification of the target diagnostic device as an encryption key to obtain the encrypted diagnostic data.
[0064] Furthermore, when the data transmission program in the memory 130 is executed by the processor, the following steps are also implemented:
[0065] Receive the encrypted data upload result message fed back by the server;
[0066] Determining whether a preset condition for continuing uploading is met according to the data uploading result message;
[0067] If yes, continue uploading the diagnostic data to the server.
[0068] Furthermore, when the data transmission program in the memory 130 is executed by the processor, the following steps are also implemented:
[0069] Receiving a data upload message sent by a target diagnostic device, wherein the data upload message includes a request header and encrypted diagnostic data, the request header includes a message signature generated by the target diagnostic device, and the encrypted diagnostic data is obtained by the target diagnostic device encrypting the target diagnostic data;
[0070] Verifying the message signature;
[0071] If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data.
[0072] Furthermore, when the data transmission program in the memory 130 is executed by the processor, the following steps are also implemented:
[0073] Acquire and store a chip identifier corresponding to at least one diagnostic device, wherein the at least one diagnostic device includes the target diagnostic device;
[0074] Verifying the message signature based on the chip identification of the target diagnostic device;
[0075] If the verification is successful, the encrypted diagnostic data is decrypted using the chip identification of the target diagnostic device as a decryption key to obtain the target diagnostic data.
[0076] This embodiment adopts the above scheme, specifically by generating a message signature and adding the message signature to the request header; encrypting the target diagnostic data to obtain encrypted diagnostic data; sending a data upload message including the request header and the encrypted diagnostic data to the server, so that the server can verify the message signature. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data. In this embodiment, the diagnostic device adds a message signature to the request header during the data upload process. The message signature can be used to verify the identity and data integrity. In addition, the target diagnostic data is encrypted to obtain encrypted diagnostic data, and the data upload message consisting of the request header and the encrypted diagnostic data is sent to the server. Due to the dual technical protection of message signature and data encryption, the target diagnostic data can be prevented from being bypassed or tampered with during the transmission from the diagnostic device to the server, thereby solving the security problem of diagnostic data transmission between the diagnostic device and the server.
[0077] The first embodiment and the fifth implementation rules of the data transmission method of the present application involve a diagnostic device and a server, and the diagnostic device and the server exchange data based on the HTTP / HTTPS protocol (Hypertext Transfer Protocol).
[0078] Diagnostic equipment: mainly refers to equipment used in the process of automobile diagnosis, represented by automobile fault diagnostic instruments. Diagnostic equipment integrates multiple diagnostic functions, some of which require data exchange between the diagnostic equipment and the server, especially the diagnostic equipment to upload diagnostic data to the server. The data uploaded by the diagnostic equipment can be divided into two parts: the request header and the diagnostic data.
[0079] Server: mainly refers to the server or diagnostic platform that supports the diagnostic function and supports the processing and storage of diagnostic data.
[0080] Reference Figure 2The first embodiment of the data transmission method of the present application provides a flow chart, the data transmission method is applied to a target diagnostic device, and the data transmission method includes:
[0081] Step S10, generating a message signature and adding the message signature to the request header.
[0082] In the process of implementing a certain cloud diagnostic function, the target diagnostic device will obtain or generate some diagnostic data. These diagnostic data are regarded as target diagnostic data, and the target diagnostic device needs to upload the target diagnostic data to the server. Since the target diagnostic device and the server interact based on the HTTP / HTTPS protocol, the target diagnostic device needs to generate a request header for data upload. Specifically, the request header may include one or more request header parameters such as the program public key, timestamp, device serial number of the target diagnostic device, and message signature. Regarding the generation process of the message signature, a hash algorithm can be used to calculate the hash value of one or more request header parameters and the verification key, and the calculated hash value is used as the content of the message signature, and the message signature is added to the request header. Among them, the verification key can use the chip identification (that is, chip ID) of the target diagnostic device, and the target diagnostic device and the server both store the chip identification of the target diagnostic device.
[0083] Step S20, encrypting the target diagnostic data to obtain encrypted diagnostic data.
[0084] In the existing diagnostic data transmission method, the diagnostic data is transmitted in plain text, which creates the risk of being attacked and tampered with. In order to improve the security of the diagnostic data, the diagnostic data can be encrypted before transmission. Specifically, the target diagnostic device and the server store a data key, and the data key can use the chip identifier of the target diagnostic device (that is, the chip ID). Further, the target diagnostic device uses the chip identifier as the encryption key (that is, the data key) to encrypt the target diagnostic data to obtain encrypted diagnostic data. At this point, even if the encrypted diagnostic data is obtained by an attack, the attacker cannot directly use the encrypted diagnostic data.
[0085] Step S30, sending a data upload message including the request header and the encrypted diagnostic data to the server, so that the server can verify the message signature. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data.
[0086] Specifically, the data upload message is composed of a request header and encrypted diagnostic data, and the data upload message complies with the HTTP / HTTPS protocol between the target diagnostic device and the server. The target diagnostic device sends a data upload message to the server, and accordingly, the server receives the data upload message. Then, the server parses the received data upload message to obtain the request header and encrypted diagnostic data, and queries the corresponding signature verification key and decryption key (i.e., data key) from the background storage area according to the device serial number of the target diagnostic device in the request header. Here, the signature verification key and the decryption key are both the chip identifier of the target diagnostic device. The server verifies the message signature in the request header based on the signature verification key. If the verification passes, it indicates that there is no problem with the authenticity of the message. Further, the server decrypts the encrypted diagnostic data based on the chip identifier of the target diagnostic device to obtain the target diagnostic data. At this time, the server can store the target diagnostic data or process the target diagnostic data to cooperate with the implementation of the corresponding cloud diagnostic function.
[0087] This embodiment adopts the above scheme, specifically by generating a message signature and adding the message signature to the request header; encrypting the target diagnostic data to obtain encrypted diagnostic data; sending a data upload message including the request header and the encrypted diagnostic data to the server, so that the server can verify the message signature. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data. In this embodiment, the diagnostic device adds a message signature to the request header during the data upload process. The message signature can be used to verify the identity and data integrity. In addition, the target diagnostic data is encrypted to obtain encrypted diagnostic data, and the data upload message consisting of the request header and the encrypted diagnostic data is sent to the server. Due to the dual technical protection of message signature and data encryption, the target diagnostic data can be prevented from being bypassed or tampered with during the transmission from the diagnostic device to the server, thereby solving the security problem of diagnostic data transmission between the diagnostic device and the server.
[0088] Further, refer to Figure 3 The second embodiment of the data transmission method of the present application provides a flow chart based on the above Figure 2 In the embodiment shown, step S10, generating a message signature and adding the message signature to the request header for further refinement includes:
[0089] Step S101, performing hash value calculation on at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value.
[0090] The request header may include one or more request header parameters such as a program public key, a timestamp, a device serial number of a target diagnostic device, a message signature, etc. At this time, the message signature has not yet been filled with specific content. Specifically, the target diagnostic device uses a preset hash algorithm to calculate hash values for other request header parameters except the message signature, and a corresponding first hash value can be obtained.
[0091] Step S102: concatenate the first hash value, the at least one request header parameter, and the chip identifier of the target diagnostic device to obtain a concatenated string.
[0092] In order to further prevent diagnostic data from being tampered with, it is necessary to add the content of the signature verification key to the message signature. Specifically, the target diagnostic device reads its own chip identification, and splices the first hash value, other request header parameters other than the message signature, and the read chip identification based on the preset splicing rules to obtain a spliced string.
[0093] Step S103, performing hash value calculation on the concatenated character string based on the preset hash algorithm to obtain a corresponding second hash value.
[0094] Specifically, after obtaining the concatenated string, the target diagnostic device further uses a preset hash algorithm to calculate the hash value of the concatenated string to obtain the corresponding second hash value. Since the second hash value is calculated based on the request header parameters and the chip identification of the target diagnostic device, as long as the request header parameters are changed, they can be reversed through the second hash value to ensure that the content represented by the request header is not tampered with.
[0095] Step S104: Generate the message signature based on the second hash value, and add the message signature to the request header.
[0096] Specifically, after the target diagnostic device calculates the second hash value, it generates a message signature based on the content of the second hash value and adds it to the request header of the target diagnostic device's current data upload action. In this way, the request header parameters have sufficiently complete content.
[0097] This embodiment adopts the above scheme, specifically by calculating the hash value of at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value; concatenating the first hash value, the at least one request header parameter and the chip identifier of the target diagnostic device to obtain a concatenated string; calculating the hash value of the concatenated string based on the preset hash algorithm to obtain a corresponding second hash value; generating the message signature based on the second hash value, and adding the message signature to the request header. In this embodiment, the target diagnostic device performs two hash value calculations based on the preset hash algorithm, request header parameters, and the chip identifier of the target diagnostic device to obtain the final hash value as the content of the message signature. The server can verify the message signature according to the chip identifier of the target diagnostic device to ensure that the identity of the target diagnostic device is correct, and to ensure that the data upload message has not been tampered with, thereby ensuring the integrity of the diagnostic data transmission between the diagnostic device and the server.
[0098] Further, refer to Figure 4 The third embodiment of the data transmission method of the present application provides a flow chart based on the above Figure 2 In the embodiment shown, step S20, further refinement of encrypted diagnostic data obtained by encrypting the target diagnostic data includes:
[0099] Step S201: encrypt the target diagnostic data using the chip identifier of the target diagnostic device as an encryption key to obtain the encrypted diagnostic data.
[0100] In order to ensure that the target diagnostic device is not obtained and used by others during the transmission process, the target diagnostic data needs to be encrypted. First, the target diagnostic data needs to be preprocessed. Specifically, the target diagnostic data is converted into a unified string data, such as a string in JSON format. If the content of the target diagnostic data is empty, it can also be converted into a JSON empty string. Then, the target diagnostic device reads its own chip identification, uses the chip identification as the encryption key to perform AES encryption on the target diagnostic data in JSON format to obtain encrypted diagnostic data, and Base64 encodes the encrypted diagnostic data. At this time, the target diagnostic data changes from plaintext to ciphertext, and the server holding the decryption key can decrypt the encrypted diagnostic data to obtain the target diagnostic data. Even if the attacker obtains the encrypted diagnostic data during the transmission process, he cannot parse the content.
[0101] This embodiment uses the above scheme to encrypt the target diagnostic data using the chip identifier of the target diagnostic device as an encryption key to obtain the encrypted diagnostic data. In this embodiment, the target diagnostic device encrypts the target diagnostic data based on the chip identifier of the target diagnostic device and a preset encryption algorithm to obtain encrypted diagnostic data, and changes the transmission mode between the diagnostic device and the server from plaintext transmission to ciphertext transmission, effectively eliminating the risk of data leakage.
[0102] Further, refer to Figure 5 The fourth embodiment of the data transmission method of the present application provides a flow chart based on the above Figure 2 In the embodiment shown, step S30, after sending a data upload message based on the message signature and the encrypted diagnostic data to the server, further includes:
[0103] Step S001, receiving the encrypted data upload result message fed back by the server.
[0104] Specifically, after receiving the data upload message sent by the target diagnostic device, the server parses the data upload message to obtain the request header and encrypted diagnostic data. The server then verifies the message signature in the request header. If the verification passes and the encrypted diagnostic data is decrypted to obtain the target diagnostic data, it indicates that the target diagnostic data has been successfully uploaded. If the verification fails or the encrypted diagnostic data cannot be decrypted to obtain the target diagnostic data, it indicates that the target diagnostic data has been uploaded abnormally. According to the above situation, the server feeds back a data upload success message or a data upload exception message (data upload result message) to the target diagnostic device, and accordingly, the target diagnostic device receives a data upload success message or a data upload exception message.
[0105] Step S002: determine whether the preset upload continuation condition is met according to the data upload result message.
[0106] Specifically, the action of the target diagnostic device uploading diagnostic data to the server may be performed in stages. If the target diagnostic device receives a data upload success message, it indicates that the data transmission process is safe and meets the preset conditions for continuing to upload. If the target diagnostic device receives a data upload exception message, it indicates that the data transmission process may be risky and does not meet the preset conditions for continuing to upload.
[0107] Step S003: If yes, continue uploading the diagnostic data to the server.
[0108] If the target diagnostic device receives a data upload success message, the preset upload continuation condition is met. Furthermore, the target diagnostic device continues to upload other diagnostic data to the server, and continues to receive data upload result messages fed back by the server, and timely monitors whether there are security risks in the data transmission process according to the data upload result messages.
[0109] This embodiment adopts the above scheme, specifically by receiving the encrypted data upload result message fed back by the server; judging whether the preset upload continuation condition is met according to the data upload result message; if so, continuing to upload the diagnostic data to the server. In this embodiment, the server will feed back the data upload result message to the target diagnostic device according to the results of the message signature verification and data decryption. The target diagnostic device can know whether there is an abnormality in the transmission process in time according to the data upload result message, and then decide to continue or stop uploading the diagnostic data, thereby improving the security of the diagnostic data transmission process.
[0110] Reference Figure 6 The fifth embodiment of the data transmission method of the present application provides a flow chart, wherein the data transmission method is applied to a server, and the data transmission method includes:
[0111] Step A10, receiving a data upload message sent by a target diagnostic device, wherein the data upload message includes a request header and encrypted diagnostic data, the request header includes a message signature generated by the target diagnostic device, and the encrypted diagnostic data is obtained by encrypting the target diagnostic data by the target diagnostic device.
[0112] In the process of implementing a certain cloud diagnostic function, the target diagnostic device will obtain or generate some diagnostic data. These diagnostic data are regarded as target diagnostic data, and the target diagnostic device needs to upload the target diagnostic data to the server. Since the target diagnostic device and the server interact based on the HTTP / HTTPS protocol, the target diagnostic device needs to generate a request header for data upload. Specifically, the request header may include one or more request header parameters such as the program public key, timestamp, device serial number of the target diagnostic device, and message signature. Regarding the generation process of the message signature, a hash algorithm can be used to calculate the hash value of one or more request header parameters and the verification key, and the calculated hash value is used as the content of the message signature, and the message signature is added to the request header. Among them, the verification key can use the chip identification (that is, chip ID) of the target diagnostic device, and the target diagnostic device and the server both store the chip identification of the target diagnostic device.
[0113] The target diagnostic device and the server have a data key, which can be the chip identifier (that is, chip ID) of the target diagnostic device. Furthermore, the target diagnostic device uses the chip identifier as the encryption key (that is, data key) to encrypt the target diagnostic data to obtain encrypted diagnostic data. At this point, even if the encrypted diagnostic data is obtained by an attack, the attacker cannot directly use the encrypted diagnostic data.
[0114] The data upload message consists of a request header and encrypted diagnostic data. The data upload message complies with the HTTP / HTTPS protocol between the target diagnostic device and the server. The target diagnostic device sends the data upload message to the server, and the server receives the data upload message accordingly.
[0115] Step A20, verifying the message signature.
[0116] Specifically, the server parses the received data upload message to obtain the request header and encrypted diagnostic data, and queries the backend storage area for the corresponding signature verification key and decryption key (i.e., data key) according to the device serial number of the target diagnostic device in the request header. Here, the signature verification key and decryption key are both the chip identifiers of the target diagnostic device. The server verifies the message signature in the request header based on the signature verification key. If the verification is successful, it indicates that there is no problem with the authenticity of the message.
[0117] Step A30: If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data.
[0118] Specifically, further, the server decrypts the encrypted diagnostic data based on the chip identification of the target diagnostic device to obtain the target diagnostic data. At this time, the server can store the target diagnostic data or process the target diagnostic data to cooperate with the implementation of the corresponding cloud diagnostic function.
[0119] This embodiment adopts the above scheme, specifically by receiving a data upload message sent by the target diagnostic device, wherein the data upload message includes a request header and encrypted diagnostic data, the request header includes a message signature generated by the target diagnostic device, and the encrypted diagnostic data is obtained by the target diagnostic device encrypting the target diagnostic data; the message signature is verified; if the verification is passed, the encrypted diagnostic data is decrypted to obtain the target diagnostic data. In this embodiment, the diagnostic device adds a message signature to the request header during the data upload process, and the message signature can be used to verify the identity and data integrity. In addition, the target diagnostic data is encrypted to obtain encrypted diagnostic data, and the data upload message consisting of the request header and the encrypted diagnostic data is sent to the server. The server verifies the message signature of the received request header, and decrypts the encrypted diagnostic data to obtain the target diagnostic data under the condition that the verification is passed. Due to the dual technical protection of message signature and data encryption, the target diagnostic data can be prevented from being bypassed or tampered with during the transmission from the diagnostic device to the server, solving the security problem of diagnostic data transmission between the diagnostic device and the server.
[0120] Further, refer to Figure 7 The sixth embodiment of the data transmission method of the present application provides a flow chart based on the above Figure 2 In the embodiment shown, before receiving the data upload message sent by the target diagnostic device, step A10 further includes:
[0121] Step A001, obtaining and storing a chip identification corresponding to at least one diagnostic device, wherein the at least one diagnostic device includes the target diagnostic device.
[0122] Specifically, the verification process of the message signature by the server involves a signature verification key, and the decryption of the encrypted diagnostic data involves a decryption key. Without the above keys, signature verification and decryption cannot be performed. In this embodiment, the signature verification key and the decryption key (i.e., the data key) are both chip identifiers corresponding to the diagnostic device. Therefore, the server obtains the chip identifier corresponding to at least one diagnostic device, and stores the obtained chip identifier in the background storage area of the server, wherein at least one diagnostic device includes a target diagnostic device. In this way, the server has the ability to verify the signature and decrypt data of at least one diagnostic device including the target diagnostic device.
[0123] Step A20, further refining the verification of the message signature, includes:
[0124] Step A201: verify the message signature based on the chip identification of the target diagnostic device.
[0125] The server receives the data upload message uploaded by the target diagnostic device and first verifies the message signature therein. Specifically, the server confirms the target diagnostic device based on the request header parameter in the request header that can represent the device serial number, and queries and obtains the chip identification corresponding to the target diagnostic device from the background storage area based on the device serial number, and then calculates the hash value based on the chip identification of the target diagnostic device and the request header parameters, and performs a hash value verification with the message signature. If the chip identification is correct and the request header parameters have not been modified, the server can obtain a consistent result through the hash value verification, which means that the verification is successful; if the server cannot obtain a consistent result through the hash value verification, it means that the verification has failed.
[0126] Step A30, if the verification is successful, decrypting the encrypted diagnostic data to obtain the target diagnostic data for further refinement, including:
[0127] Step A301: If the verification is successful, the encrypted diagnostic data is decrypted using the chip identification of the target diagnostic device as a decryption key to obtain the target diagnostic data.
[0128] If the message signature verification is successful, it indicates that the request header parameters of the data upload message have not been tampered with and the identity is correct. Furthermore, the server uses the chip identification of the target diagnostic device as the decryption key to perform AES decryption on the encrypted diagnostic data to obtain the decrypted target diagnostic data.
[0129] After obtaining the target diagnostic data, the server will perform business processing on the target diagnostic data according to the request content of the data upload message and obtain the corresponding processing result information. Then, the server uses the chip identification of the target diagnostic device as the encryption key, encrypts the processing result information with AES, and generates a data upload result message based on the encrypted processing result information, and further feeds the data upload result message back to the target diagnostic device.
[0130] This embodiment adopts the above scheme, specifically by obtaining and storing the chip identification corresponding to at least one diagnostic device, wherein the at least one diagnostic device includes the target diagnostic device; the message signature is verified based on the chip identification of the target diagnostic device; if the verification is successful, the encrypted diagnostic data is decrypted using the chip identification of the target diagnostic device as the decryption key to obtain the target diagnostic data. In this embodiment, the server pre-stores the chip identification of at least one diagnostic device including the target diagnostic device, and uses the chip identification as the signature verification key and the data key, that is, the server has the signature verification and decryption capabilities for at least one diagnostic device. After receiving the data upload message of the target diagnostic device, the server verifies the message signature based on the chip identification of the target diagnostic device. If the verification is successful, the encrypted diagnostic data is further decrypted based on the chip identification of the target diagnostic device to obtain the target diagnostic data. Due to the dual technical protection of message signature and data encryption, the target diagnostic data can be prevented from being bypassed or tampered with during the transmission from the diagnostic device to the server, solving the security problem of diagnostic data transmission between the diagnostic device and the server.
[0131] The seventh implementation of the data transmission method of the present application: the target diagnostic device and the server exchange data based on the HTTP / HTTPS protocol. The target diagnostic device is burned with a unique device serial number when it is produced, and has corresponding chip identification (chip ID), chip version and other information. The device serial number, chip identification, chip version and other information of the target diagnostic device are uploaded to the server for storage.
[0132] The process of the target diagnostic device uploading data to the server involves two parts, one is the request header, and the other is the target diagnostic data. The request header parameters include: app-key, app-timestamp, app-sn, app-sign (program public key, timestamp, device serial number, message signature). At this time, "app-sign" (message signature) is empty. The target diagnostic device concatenates the remaining parameters in the request header except the "app-sign" parameter in the "key=value" (key-value pair) mode and puts them into the signature set; encrypts the data sent to the server with SHA256 (hash algorithm) and puts it into the signature set; puts the chip identifier of the target diagnostic device (used as a data key and signature verification key) into the signature set; sorts the signature set according to the dictionary; concatenates the sorted set into a string and then encrypts it with SHA256, and the encrypted content is put into the request header as the value of "app-sign".
[0133] For example, the value corresponding to the request header parameter app-key is "brunApp"; the corresponding value of app-timestamp is "1661153491000"; the corresponding value of app-sn is "xxxxxxxxxxxx"; the value of the sent data (app-key, app-timestamp, app-sn) after SHA256 encryption is "453556697a3a0944e040d2741d8653612a8b6bcfdde85f0afbcd4f5cdd90128a" and the chip identifier of the target diagnostic device is "yyyyyyyyyyyyyyyyyyyyyyy".
[0134] The string generated by concatenating the above data after sorting by dictionary is "453556697a3a0944e040d2741d8653612a8b6bcfdde85f0afbcd4f5cdd90128aapp-key=brunAppapp-sn=xxxxxxxxxxxxapp-timestamp=1661153491000yyyyyyyyyyyyyyyyyyyyyyy"
[0135] The signature generated by encrypting the string with SHA256 is: "8b29e7abbfcb3a3b978e6d5601fc20197c560eda479bad1ca46e0adb7366c6cf"
[0136] Then, the target diagnostic device converts the target diagnostic data parameters into a string in JSON format. If there are no parameters, an empty JSON ("{}") string is passed. Furthermore, the chip identifier of the target diagnostic device is obtained as the encryption key for the target diagnostic data, and the target diagnostic data in JSON string format is encrypted by AES to obtain encrypted diagnostic data, and the encrypted diagnostic data is Base64 encoded. Finally, the target diagnostic device sends the request header and encrypted diagnostic data to the server as a data upload message.
[0137] Accordingly, after receiving the data upload message, the server parses the data upload message to obtain the request header and encrypted diagnostic data, determines the target diagnostic device based on the "app-sn" (device serial number) in the request header, and uses "app-sn" as the query condition to obtain the chip ID corresponding to the target diagnostic device from the background query. Then, the "app-sign" (message signature) in the request header is verified based on the chip ID corresponding to the target diagnostic device. The verification process is consistent with the signature generation process.
[0138] After the message signature is verified, the server performs AES decryption on the encrypted diagnostic data based on the chip identifier corresponding to the target diagnostic device to obtain the target diagnostic data. The target diagnostic data is processed to obtain the corresponding processing result information. Then, the server uses the chip identifier of the target diagnostic device as the encryption key, performs AES encryption on the processing result information, and generates a data upload result message based on the encrypted processing result information, and further feeds the data upload result message back to the target diagnostic device.
[0139] Correspondingly, the target diagnostic device receives the data upload result message fed back by the server, and performs AES decryption on the data upload result message based on the chip identifier corresponding to the target diagnostic device to obtain the processing result information. If the processing result information indicates that the data upload is successful, it means that the data transmission process is safe and meets the preset conditions for continued uploading. The target diagnostic device continues to upload other diagnostic data to the server; if the processing result information indicates that the data upload is abnormal, it means that there may be risks in the data transmission process and the preset conditions for continued uploading are not met. The target diagnostic device stops uploading data to the server.
[0140] In this embodiment, the diagnostic device adds a message signature to the request header during the data upload process. The message signature can be used to verify identity and data integrity. In addition, the target diagnostic data is encrypted to obtain encrypted diagnostic data, and the data upload message consisting of the request header and the encrypted diagnostic data is sent to the server. The server verifies the message signature of the received request header, and decrypts the encrypted diagnostic data to obtain the target diagnostic data if the verification passes, and feeds back the result to the target diagnostic device. Due to the dual technical guarantees of message signature and data encryption, the target diagnostic data can be prevented from being attacked by side channels or tampered with during the transmission from the diagnostic device to the server, solving the security problem of diagnostic data transmission between the diagnostic device and the server.
[0141] In addition, an embodiment of the present application further provides a data transmission device, which is applied to a target diagnostic device, and the data transmission device includes:
[0142] A signature generation module, configured to generate a message signature based on at least one request header parameter and a chip identifier of the target diagnostic device;
[0143] An encryption module, used for encrypting the target diagnostic data to obtain encrypted diagnostic data;
[0144] A sending module, used for sending a data upload message including the message signature and the encrypted diagnostic data to a server, so that the server can verify the message signature based on the pre-stored chip identification of the target diagnostic device, and if the verification is successful, decrypt the encrypted diagnostic data to obtain the target diagnostic data;
[0145] The signature generation module also includes a first hash value calculation unit, a splicing unit, a second hash value calculation unit and a signature generation unit; the first hash value calculation unit is used to perform hash value calculation on at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value; the splicing unit is used to splice the first hash value, the at least one request header parameter and the chip identification of the target diagnostic device to obtain a spliced string; the second hash value calculation unit is used to perform hash value calculation on the spliced string based on the preset hash algorithm to obtain a corresponding second hash value; the signature generation unit is used to generate the message signature based on the second hash value, and add the message signature to the request header;
[0146] The encryption module further includes an encryption unit; the encryption unit is used to encrypt the target diagnostic data using the chip identification of the target diagnostic device as an encryption key to obtain the encrypted diagnostic data;
[0147] The data transmission device also includes a feedback receiving unit, a judgment unit and a data uploading unit. The feedback receiving unit is used to receive the encrypted data upload result message fed back by the server; the judgment unit is used to judge whether the preset continuation uploading condition is met according to the data upload result message; and the data uploading unit is used to continue uploading the diagnostic data to the server if so.
[0148] For the principle and implementation process of data transmission in this embodiment, please refer to the above embodiments and will not be described in detail here.
[0149] In addition, an embodiment of the present application further provides a data transmission device, which is applied to a server, and includes:
[0150] A receiving module, configured to receive a data upload message sent by a target diagnostic device, wherein the data upload message includes a message signature and encrypted diagnostic data, the message signature is generated by the target diagnostic device based on at least one request header parameter and a chip identifier of the target diagnostic device, and the encrypted diagnostic data is obtained by the target diagnostic device encrypting the target diagnostic data;
[0151] A verification module, used to verify the message signature based on a pre-stored chip identification of the target diagnostic device;
[0152] A decryption module, configured to decrypt the encrypted diagnostic data to obtain the target diagnostic data if the verification is successful;
[0153] The data transmission device also includes a storage unit; the storage unit is used to obtain and store a chip identifier corresponding to at least one diagnostic device, wherein the at least one diagnostic device includes the target diagnostic device; the verification module also includes a verification unit; the verification unit is used to verify the message signature based on the chip identifier of the target diagnostic device; the decryption module also includes a decryption unit; the decryption unit is used to decrypt the encrypted diagnostic data using the chip identifier of the target diagnostic device as a decryption key to obtain the target diagnostic data if the verification passes.
[0154] For the principle and implementation process of data transmission in this embodiment, please refer to the above embodiments and will not be described in detail here.
[0155] In addition, an embodiment of the present application also proposes a terminal device, which includes a memory, a processor, and a data transmission program stored in the memory and executable on the processor, and when the data transmission program is executed by the processor, the steps of the data transmission method described above are implemented.
[0156] Since all the technical solutions of all the aforementioned embodiments are adopted when the data transmission program is executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0157] In addition, an embodiment of the present application further proposes a computer-readable storage medium, on which a data transmission program is stored. When the data transmission program is executed by a processor, the steps of the data transmission method described above are implemented.
[0158] Since all the technical solutions of all the aforementioned embodiments are adopted when the data transmission program is executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0159] Compared with the prior art, the data transmission method, apparatus, terminal device and storage medium proposed in the embodiment of the present application generate a message signature and add the message signature to the request header; encrypt the target diagnostic data to obtain encrypted diagnostic data; send a data upload message including the request header and the encrypted diagnostic data to the server, so that the server can verify the message signature. If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data. Based on the scheme of the present application, the diagnostic device adds a message signature to the request header during the data upload process. The message signature can be used to verify the identity and data integrity. In addition, the target diagnostic data is encrypted to obtain encrypted diagnostic data, and the data upload message consisting of the request header and the encrypted diagnostic data is sent to the server. Due to the dual technical protection of message signature and data encryption, the target diagnostic data can be prevented from being attacked by a side channel or tampered with during the transmission from the diagnostic device to the server, thereby solving the security problem of diagnostic data transmission between the diagnostic device and the server.
[0160] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0161] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0162] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to execute the method of each embodiment of the present application.
[0163] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data transmission method, characterized in that: The data transmission method is applied to a target diagnostic device, and the data transmission method includes: Generate a message signature and add the message signature to the request header; encrypting the target diagnostic data to obtain encrypted diagnostic data; Sending a data upload message including the request header and the encrypted diagnostic data to the server, so that the server can verify the message signature, and if the verification is successful, decrypting the encrypted diagnostic data to obtain the target diagnostic data; The steps of generating a message signature and adding the message signature to a request header include: Perform a hash value calculation on at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value; concatenate the first hash value, the at least one request header parameter, and the chip identifier of the target diagnostic device to obtain a concatenated string; perform a hash value calculation on the concatenated string based on the preset hash algorithm to obtain a corresponding second hash value; generate the message signature based on the second hash value, and add the message signature to the request header.
2. The data transmission method according to claim 1, characterized in that: The step of encrypting the target diagnostic data to obtain encrypted diagnostic data comprises: The target diagnostic data is encrypted using the chip identification of the target diagnostic device as an encryption key to obtain the encrypted diagnostic data.
3. The data transmission method according to claim 1, characterized in that: After the step of sending a data upload message based on the message signature and the encrypted diagnostic data to the server, the method further includes: Receive the encrypted data upload result message fed back by the server; Determining whether a preset condition for continuing uploading is met according to the data uploading result message; If yes, continue uploading the diagnostic data to the server.
4. A data transmission method, characterized in that: The data transmission method is applied to the server, and the data transmission method includes: Receiving a data upload message sent by a target diagnostic device, wherein the data upload message includes a request header and encrypted diagnostic data, the request header includes a message signature generated by the target diagnostic device, and the encrypted diagnostic data is obtained by encrypting the target diagnostic data by the target diagnostic device; Verifying the message signature; If the verification is successful, the encrypted diagnostic data is decrypted to obtain the target diagnostic data; The generation process of the request header includes: Perform a hash value calculation on at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value; concatenate the first hash value, the at least one request header parameter, and the chip identifier of the target diagnostic device to obtain a concatenated string; perform a hash value calculation on the concatenated string based on the preset hash algorithm to obtain a corresponding second hash value; generate the message signature based on the second hash value, and add the message signature to the request header.
5. The data transmission method according to claim 4, characterized in that: Before the step of receiving the data upload message sent by the target diagnostic device, the method further includes: Acquire and store a chip identifier corresponding to at least one diagnostic device, wherein the at least one diagnostic device includes the target diagnostic device; The step of verifying the message signature comprises: Verifying the message signature based on the chip identification of the target diagnostic device; If the verification is successful, the step of decrypting the encrypted diagnostic data to obtain the target diagnostic data includes: If the verification is successful, the encrypted diagnostic data is decrypted using the chip identification of the target diagnostic device as a decryption key to obtain the target diagnostic data.
6. A data transmission device, characterized in that: The data transmission device is applied to a target diagnostic device, and the data transmission device comprises: A signature generation module, configured to generate a message signature based on at least one request header parameter and a chip identifier of the target diagnostic device; An encryption module, used for encrypting target diagnostic data to obtain encrypted diagnostic data; A sending module, used for sending a data upload message including the message signature and the encrypted diagnostic data to a server, so that the server can verify the message signature based on the pre-stored chip identification of the target diagnostic device, and if the verification is successful, decrypt the encrypted diagnostic data to obtain the target diagnostic data; The signature generation module is also used to calculate a hash value for at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value; concatenate the first hash value, the at least one request header parameter and the chip identifier of the target diagnostic device to obtain a concatenated string; calculate a hash value for the concatenated string based on the preset hash algorithm to obtain a corresponding second hash value; generate the message signature based on the second hash value, and add the message signature to the request header.
7. A data transmission device, characterized in that: The data transmission device is applied to the server, and the data transmission device includes: A receiving module, configured to receive a data upload message sent by a target diagnostic device, wherein the data upload message includes a message signature and encrypted diagnostic data, the message signature is generated by the target diagnostic device based on at least one request header parameter and a chip identifier of the target diagnostic device, and the encrypted diagnostic data is obtained by the target diagnostic device encrypting the target diagnostic data; A verification module, used to verify the message signature based on a pre-stored chip identification of the target diagnostic device; A decryption module, configured to decrypt the encrypted diagnostic data to obtain the target diagnostic data if the verification is successful; The generation process of the request header includes: Perform a hash value calculation on at least one request header parameter based on a preset hash algorithm to obtain a corresponding first hash value; concatenate the first hash value, the at least one request header parameter, and the chip identifier of the target diagnostic device to obtain a concatenated string; perform a hash value calculation on the concatenated string based on the preset hash algorithm to obtain a corresponding second hash value; generate the message signature based on the second hash value, and add the message signature to the request header.
8. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a data transmission program stored in the memory and executable on the processor. When the data transmission program is executed by the processor, the steps of the data transmission method as described in any one of claims 1-3 or 4-5 are implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data transmission program, and when the data transmission program is executed by the processor, the steps of the data transmission method according to any one of claims 1-3 or 4-5 are implemented.
Citation Information
Patent Citations
Data interaction method and system based on hypertext transfer protocol http
CN109150821A
API interface data communication method and device, client and storage medium
CN114614994A