Message transmission method, device and system and vehicle
By introducing a check value comparison mechanism in the gateway and allowing the sender to directly transmit messages through physical lines when the check values are inconsistent, the problem of high message discard rate during communication between ECUs in different network segments is solved, and the accuracy and security of transmission are improved.
Patent Information
- Application Number
- CN202510102941.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-02
AI Technical Summary
When communicating between ECUs in different network segments, if the verification values of encrypted messages are inconsistent when the gateway forwards signals, the packet will be discarded, resulting in the loss of important information such as vehicle speed signals and range. How to effectively reduce the packet drop rate has become a technical problem.
By introducing a verification mechanism of the first and second verification values in the gateway, if the two verification values are inconsistent, a notification message is sent to the sender, so that the sender can directly send the encrypted message to the receiver through the physical line, avoiding the gateway from discarding the message.
It improves the accuracy and reliability of message transmission, reduces the packet drop rate, ensures the confidentiality of the original message, and enhances the security of message transmission.
Smart Images

Figure CN119922002A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and more specifically, to a message transmission method, device, system and vehicle in the field of communications. Background Art
[0002] At present, when ECUs (Electronic Control Units) located in different network segments communicate with each other, a gateway is usually required to forward the signal. After the sender ECU sends the encrypted message and the check value to the gateway, the gateway will regenerate a check value based on the received encrypted message for comparison. If the two check values match, the gateway will forward the encrypted message to the receiver ECU; but if the two check values do not match, the gateway will directly discard the encrypted message, which will cause the loss of important information in the message, such as vehicle speed signal and mileage.
[0003] Therefore, how to effectively reduce the discard rate of messages has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The present application provides a message transmission method, device, system, vehicle and storage medium, which can effectively reduce the discard rate during message transmission.
[0005] In a first aspect, a message transmission method is provided, which is applied to a gateway, wherein the gateway is used to connect a sender and a receiver located in different network segments, and the sender and the receiver are connected via a physical line, and the method comprises: receiving a first encrypted message and a first verification value sent by the sender; wherein the first encrypted message is obtained by the sender encrypting the original message using the sender's public key; the first verification value is generated by the sender processing the first encrypted message using a preset algorithm; based on the first encrypted message and the preset algorithm, a second verification value is generated; and when the first verification value and the second verification value are inconsistent, a first notification message is sent to the sender to instruct the sender to send the first encrypted message to the receiver via the physical line.
[0006] The above technical solution effectively improves the accuracy and reliability of the message transmission process by introducing a verification mechanism of the first verification value and the second verification value. When sending the first encrypted message, the sender will also generate and send the first verification value. The first verification value is generated by the sender processing the first encrypted message with a preset algorithm. After receiving the first encrypted message, the gateway will generate a second verification value based on the same preset algorithm and compare it with the received first verification value. If the first verification value and the second verification value are inconsistent, the gateway will not immediately discard the first encrypted message, but send a first notification message to the sender, so that the sender directly sends the first encrypted message to the receiver through the physical line between the sender and the receiver. This message transmission method not only ensures that the receiver can still receive the correct encrypted message and improves the reliability of message transmission, but also prevents the loss of information in the message and reduces the message discard rate. At the same time, since the first encrypted message is encrypted by the sender using the sender's public key, the confidentiality of the original message is also guaranteed, further enhancing the security of message transmission.
[0007] In combination with the first aspect, in some possible implementations, when the first verification value and the second verification value are inconsistent, sending a first notification message to the sender includes: if the first verification value and the second verification value are inconsistent, sending a second notification message to the sender to instruct the sender to generate a third verification value based on the first encrypted message and the preset algorithm; receiving the third verification value sent by the sender, and comparing the third verification value with the second verification value; and when the third verification value and the second verification value are inconsistent, sending the first notification message to the sender.
[0008] In the above technical solution, when it is verified that the first check value and the second check value are inconsistent, a secondary verification method can be selected to confirm whether the inconsistency of the check values is caused by an accidental error of the gateway, by sending a second notification message to the sender, instructing the sender to regenerate a third check value based on the same first encrypted message and the preset algorithm, and send the third check value back to the gateway. The gateway compares the received third check value with the previously generated second check value. If the third check value is still inconsistent with the second check value at this time, it can be confirmed that the failure of the first verification is not caused by an accidental error of the gateway, but a problem with the transmission link between the sender and the gateway. Therefore, at this time, the gateway sends a first notification message to the sender, so that the sender directly sends the first encrypted message to the receiver through the physical line between the sender and the receiver, and no longer passes through the gateway; selecting the secondary verification mechanism can not only improve the accuracy of message transmission, but also reduce the false alarm rate caused by accidental errors, thereby improving the reliability of message transmission.
[0009] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, when the third verification value and the second verification value are inconsistent, sending the first notification message to the sender includes: if the third verification value and the second verification value are inconsistent, sending a third notification message to the sender to instruct the sender to determine whether the sender's public key has been tampered with and obtain a judgment result; receiving the judgment result sent by the sender; if it is determined based on the judgment result that the sender's public key has not been tampered with, sending the first notification message to the sender.
[0010] In the above technical solution, when it is verified that the third check value and the second check value are inconsistent, it can be determined that the two check failures are not caused by an accidental error of the gateway, but a problem with the transmission link between the sender and the gateway. Therefore, the gateway can send a third notification message to the sender, so that the sender can perform a self-check to determine whether the sender's public key has been tampered with. If the sender's public key has been tampered with, there are problems with the first encrypted message and the first check value. After the sender completes the self-check, it will send the judgment result back to the gateway. The gateway will determine the subsequent message transmission method based on the received judgment result. If it is determined that the sender's public key has not been tampered with, it means that the gateway has a problem when calculating the check value. Therefore, at this time, the gateway sends a first notification message to the sender, so that the sender directly sends the first encrypted message to the receiver through the physical line between the sender and the receiver, and no longer passes through the gateway for verification; by introducing a self-check mechanism, the accuracy and security of message transmission can be ensured, and the sender directly sends the first encrypted message to the receiver through the physical line, which can reduce a certain message discard rate.
[0011] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, after receiving the judgment result sent by the sender, the method also includes: if it is determined based on the judgment result that the public key of the sender has been tampered with, sending a fourth notification message to the sender to instruct the sender to send the original message; receiving the original message sent by the sender; encrypting the original message according to the public key of the gateway to obtain a second encrypted message; generating a fourth verification value based on the second encrypted message and the preset algorithm; sending the second encrypted message and the fourth verification value to the receiver, so that the receiver can generate a fifth verification value based on the second encrypted message and the preset algorithm, and retaining the second encrypted message when the fourth verification value is consistent with the fifth verification value.
[0012] In the above technical solution, if it is determined that the sender's public key has been tampered with, the sender's public key cannot be used for encryption at this time. Therefore, the gateway will send a fourth notification message to the sender, so that the sender sends the original message to the gateway, and the original message is encrypted by the gateway's public key to obtain a second encrypted message. At this time, the gateway can directly send the second encrypted message to the receiver. However, in order to ensure the accuracy of message transmission, the same verification mechanism as above can be introduced between the gateway and the receiver. The gateway uses a preset algorithm to generate a fourth verification value for the second encrypted message, and sends the second encrypted message and the fourth verification value together to the receiver. The receiver uses a preset algorithm to process the received second encrypted message and generates a fifth verification value. If the fourth verification value and the fifth verification value are consistent, the second encrypted message is retained. The above-mentioned encryption using the gateway's public key and the introduction of a verification mechanism between the gateway and the receiver can further enhance the security of message transmission.
[0013] In combination with the first aspect and the above-mentioned implementation manner, in some possible implementation manners, if the first verification value and the second verification value are consistent, the first encrypted message is sent to the recipient.
[0014] In combination with the first aspect and the above implementations, in some possible implementations, the sender and the receiver are different electronic control units in a vehicle.
[0015] In combination with the first aspect and the above implementations, in some possible implementations, different electronic control units in the vehicle are connected via hard wires or via CAN lines.
[0016] In a second aspect, a message transmission device is provided, which is applied to a gateway, wherein the gateway is used to connect a sender and a receiver located in different network segments, and the sender and the receiver are connected through a physical line. The device includes: a receiving module, used to receive a first encrypted message and a first verification value sent by the sender; wherein the first encrypted message is obtained by the sender encrypting the original message using the sender's public key; the first verification value is generated by the sender after processing the first encrypted message using a preset algorithm; a generating module, used to generate a second verification value based on the first encrypted message and the preset algorithm; and a sending module, used to send a first notification message to the sender when the first verification value and the second verification value are inconsistent, to instruct the sender to send the first encrypted message to the receiver through the physical line.
[0017] In combination with the second aspect, in certain implementations of the second aspect, the sending module is specifically used to: when the first verification value and the second verification value are inconsistent, send a first notification message to the sender, including: if the first verification value and the second verification value are inconsistent, send a second notification message to the sender to instruct the sender to generate a third verification value based on the first encrypted message and the preset algorithm; receive the third verification value sent by the sender, and compare the third verification value with the second verification value; when the third verification value and the second verification value are inconsistent, send the first notification message to the sender.
[0018] In combination with the second aspect and the above-mentioned implementation methods, in some implementation methods of the second aspect, the sending module is specifically used to: when the third verification value and the second verification value are inconsistent, send the first notification message to the sender, including: if the third verification value and the second verification value are inconsistent, send a third notification message to the sender to instruct the sender to determine whether the sender's public key has been tampered with and obtain a judgment result; receive the judgment result sent by the sender; if it is determined based on the judgment result that the sender's public key has not been tampered with, send the first notification message to the sender.
[0019] In combination with the second aspect and the above-mentioned implementation methods, in some implementation methods of the second aspect, the sending module is specifically used to: after receiving the judgment result sent by the sender, the method also includes: if it is determined based on the judgment result that the public key of the sender has been tampered with, sending a fourth notification message to the sender to instruct the sender to send the original message; receiving the original message sent by the sender; encrypting the original message according to the public key of the gateway to obtain a second encrypted message; generating a fourth verification value based on the second encrypted message and the preset algorithm; sending the second encrypted message and the fourth verification value to the receiver, so that the receiver can generate a fifth verification value based on the second encrypted message and the preset algorithm, and retaining the second encrypted message when the fourth verification value is consistent with the fifth verification value.
[0020] In combination with the second aspect and the above-mentioned implementation manner, in some implementation manners of the second aspect, the sending module is further specifically used to: if the first verification value and the second verification value are consistent, then send the first encrypted message to the recipient.
[0021] In combination with the second aspect and the above-mentioned implementations, in some implementations of the second aspect, the sender and the receiver are different electronic control units in the vehicle.
[0022] In combination with the second aspect and the above implementations, in some implementations of the second aspect, different electronic control units in the vehicle are connected via hard wires or via CAN lines.
[0023] According to a third aspect, a message transmission system is provided, which includes a sender, a receiver and a gateway, wherein the gateway is used to connect the sender and the receiver located in different network segments, and the sender and the receiver are connected through a physical line; the sender is used to encrypt the original message using the sender's public key to obtain a first encrypted message, generate a first verification value after processing the first encrypted message using a preset algorithm, and send the first encrypted message and the first verification value to the gateway; the gateway is used to receive the first encrypted message and the first verification value; generate a second verification value based on the first encrypted message and the preset algorithm; and send a first notification message to the sender when it is determined that the first verification value and the second verification value are inconsistent; the sender is also used to send the first encrypted message to the receiver through the physical line after receiving the first notification message; the receiver is used to receive the first encrypted message.
[0024] In a fourth aspect, a vehicle is provided, comprising a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, so that the vehicle executes the method in the first aspect or any possible implementation of the first aspect.
[0025] In a fifth aspect, a computer program product is provided, which includes: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0026] In a sixth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of a message transmission provided in an embodiment of the present application;
[0028] Figure 2 It is a schematic diagram of another message transmission provided in an embodiment of the present application;
[0029] Figure 3 It is a schematic flow chart of a message transmission method provided in an embodiment of the present application;
[0030] Figure 4 is a schematic flow chart of another message transmission method provided in an embodiment of the present application;
[0031] Figure 5 It is an interactive flow chart of message transmission provided by an embodiment of the present application;
[0032] Figure 6 It is a structural schematic diagram of a message transmission device provided in an embodiment of the present application;
[0033] Figure 7 It is a structural schematic diagram of a vehicle provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The technical solution in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0035] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0036] To facilitate understanding of the embodiments of the present application, the technical terms involved in the embodiments of the present application are first explained below.
[0037] ECU (Electronic Control Unit) is an intelligent control device in a vehicle that is responsible for monitoring and controlling the operation of various sensors and actuators.
[0038] IBC (Integrated Brake Control) is an advanced brake control system that integrates electronic stability control system, vacuum booster and its related electrical components, sensors, switches, electronic controllers and other components to achieve more efficient and safer brake control.
[0039] GW (Gateway) is a network device used to connect different network segments to achieve data exchange and communication between different network segments.
[0040] HUT (Head Unit, in-vehicle infotainment system) is usually responsible for vehicle information display, navigation, entertainment and other functions, and communicates and exchanges data with other ECUs in the vehicle.
[0041] TCU (Transmission Control Unit) is used to detect data such as vehicle speed and adjust the transmission for gear shifting based on the above data.
[0042] TBOX (Telematics BOX, remote communication terminal) is a key component of intelligent connected vehicles, providing Internet services for vehicle computers, etc.
[0043] The current existing network bus topology adopts a master-slave structure, which consists of a gateway as a signal forwarder and multiple ECUs distributed in various CAN network segments. The gateway, as the master device, is responsible for receiving, processing and forwarding signals from different ECUs. Each ECU, as a slave device, is distributed on different CAN network segments and is responsible for sending signals to the gateway through the CAN bus.
[0044] When ECUs in the same network segment communicate with each other, the sending ECU can directly send signals to the receiving ECU. Figure 1 As shown, Figure 1 This is a schematic diagram of a message transmission provided by an embodiment of the present application, which includes three ECUs, namely HUT, TBOX and TCU. Among them, HUT and TBOX are located in the same network segment, while HUT and TCU are located in different network segments, and TBOX and TCU are also located in different network segments. Taking the sending ECU as TBOX and the receiving ECU as HUT as an example, when TBOX sends a signal to HUT, since TBOX and HUT are located in the same network segment, TBOX and HUT can communicate directly.
[0045] However, when ECUs located in different network segments communicate with each other, a gateway is usually required to forward the signal. Figure 2 As shown, Figure 2 This is a schematic diagram of another message transmission provided by an embodiment of the present application, which includes three ECUs, namely HUT, TBOX and TCU. Among them, HUT and TBOX are located in the same network segment, while HUT and TCU are located in different network segments, and TBOX and TCU are also located in different network segments. Taking the sending ECU as HUT and the receiving ECU as TCU as an example, when HUT sends a signal to TCU, since HUT and TCU are located in different network segments, HUT and TCU cannot communicate directly. When communicating between HUT and TCU, HUT needs to send the signal to GW first, and GW forwards the signal to TCU.
[0046] It should be understood that in the present application, ECU is not limited to the above-mentioned HUT, TCU and TBOX. ECU can also be various ECUs such as brake control unit (BCU), body control module (BCM), suspension control unit (SCU), etc. In the present application, only HUT, TCU and TBOX are described as examples.
[0047] In the prior art, the above signal may include an encrypted message and a check value. When the sender ECU sends the encrypted message and the check value to the gateway, the gateway will regenerate a check value based on the received encrypted message for comparison. If the two check values match, the gateway will forward the encrypted message to the receiver ECU; but if the two check values do not match, the gateway will directly discard the encrypted message, which will cause the loss of important information in the message, such as the vehicle speed signal and the mileage. Therefore, how to effectively reduce the discard rate of messages has become a technical problem that needs to be solved urgently.
[0048] In order to at least solve the above-mentioned technical problems, an embodiment of the present application provides a message transmission method, which is applied to a gateway and can effectively reduce the discard rate during message transmission.
[0049] Figure 3 It is a schematic flowchart of a message transmission method provided in an embodiment of the present application.
[0050] For example, Figure 3 As shown, the method 300 includes:
[0051] Step 301, receiving a first encrypted message and a first check value sent by a sender, wherein the first encrypted message is obtained by the sender encrypting the original message using the sender's public key, and the first check value is generated by the sender processing the first encrypted message using a preset algorithm;
[0052] Step 302, generating a second check value based on the first encrypted message and a preset algorithm;
[0053] Step 303: When the first check value and the second check value are inconsistent, a first notification message is sent to the sender to instruct the sender to send the first encrypted message to the receiver through a physical line.
[0054] In the embodiment of the present application, by introducing the verification mechanism of the first verification value and the second verification value, the accuracy and reliability of the message transmission process are effectively improved. When sending the first encrypted message, the sender will also generate and send the first verification value. The first verification value is generated by the sender processing the first encrypted message with a preset algorithm. After receiving the first encrypted message, the gateway will generate a second verification value based on the same preset algorithm and compare it with the received first verification value. If the first verification value and the second verification value are inconsistent, the gateway will not immediately discard the first encrypted message, but send a first notification message to the sender, so that the sender directly sends the first encrypted message to the receiver through the physical line between the sender and the receiver. This message transmission method not only ensures that the receiver can still receive the correct encrypted message and improves the reliability of message transmission, but also prevents the loss of information in the message and reduces the message discard rate. At the same time, since the first encrypted message is encrypted by the sender using the sender's public key, the confidentiality of the original message is also guaranteed, further enhancing the security of message transmission.
[0055] Below Figure 3 The implementation method of each step in the illustrated embodiment is specifically described.
[0056] For 301, it can be understood that the above-mentioned sender can be an ECU in a vehicle, such as IBC, and the above-mentioned original message can include functional signals such as vehicle speed and cruising range. The above-mentioned first encrypted message is obtained after the sender encrypts the above-mentioned functional signal using the sender's public key. The above-mentioned sender's public key can be used to encrypt the original message to obtain an encrypted message, and can also be used to decrypt the encrypted message to obtain the original message.
[0057] The above-mentioned preset algorithm is essentially a preset verification algorithm, which is used to generate a first verification value based on the first encrypted message. The above-mentioned preset algorithm can be an algorithm for generating a HASH value, that is, the above-mentioned first verification value can be a HASH value. The above-mentioned preset algorithm can be AES128, and the embodiment of the present application does not limit this.
[0058] After obtaining the first encrypted message and the first verification value, the sender attaches the first verification value to the end of the first encrypted message and sends them together to the gateway.
[0059] As for 302, it can be understood that after receiving the above-mentioned first encrypted message and the first verification value, the gateway processes the first encrypted message using the same preset algorithm as the above-mentioned sender to generate a second verification value; the above-mentioned second verification value can also be a HASH value.
[0060] As for 303, it can be understood that the above-mentioned receiver can also be an ECU in a vehicle, such as a HUT, and the sender and the receiver are connected via a physical line.
[0061] In some embodiments, different electronic control units in a vehicle are connected by hardwire or by CAN lines.
[0062] It is understandable that the electronic control units located in different network segments can be connected via hard wires or CAN lines so that the electronic control units located in different network segments can communicate directly with each other.
[0063] The above-mentioned hard-wire connection is to directly connect electronic devices through physical wires to achieve signal transmission. Hard-wire connection transmits high and low level signals, with fast transmission speed, stable signal, and not easily interfered. It is suitable for long-distance transmission and large-capacity data transmission, and is often used in scenarios with high real-time requirements, such as: engine control, braking system, etc.
[0064] The above-mentioned CAN (Controller Area Network) connection is a serial communication protocol widely used in automotive electronic control systems, allowing multiple devices to communicate in real time by sharing a communication line. CAN connection transmits data, has high data transmission efficiency, strong anti-interference ability, and strong flexibility, and is often used in the fields of body control systems, chassis control systems, etc.
[0065] The first notification message is used to notify the sender to send the first encrypted message to the receiver via a physical line.
[0066] The gateway verifies whether the received first verification value is consistent with the generated second verification value. If the first verification value is inconsistent with the second verification value, there may be a problem in the gateway calculating the second verification value. Therefore, the gateway sends a first notification message to the sender, so that the sender sends the first encrypted message to the receiver directly through the physical line without passing through the gateway.
[0067] In some embodiments, if the first check value and the second check value are inconsistent, the sender may also directly send the original message to the receiver through the above-mentioned physical line.
[0068] In some embodiments, the implementation method of the above-mentioned step 303 includes: if the first verification value and the second verification value are inconsistent, sending a second notification message to the sender to instruct the sender to generate and send a third verification value based on the first encrypted message and a preset algorithm; receiving the third verification value sent by the sender, and comparing the third verification value with the second verification value; when the third verification value and the second verification value are inconsistent, sending a first notification message to the sender.
[0069] It can be understood that the above-mentioned second verification value is generated after the gateway uses a preset algorithm to process the first encrypted message, and the above-mentioned third verification value is generated after the sender uses a preset algorithm to process the first encrypted message. The second verification value and the third verification value can both be HSAH values, and the above-mentioned second notification message is used to notify the sender to generate the third verification value.
[0070] When the first verification value and the second verification value are inconsistent, it may be caused by an accidental error in the gateway's calculation of the second verification value. Therefore, the gateway needs to send a second notification message to the sender, so that the sender recalculates the verification value for verification, that is, the third verification value, and sends the third verification value to the gateway. The gateway again verifies whether the third verification value and the second verification value are consistent.
[0071] If the third check value and the second check value are still inconsistent, it can be determined that it is not caused by an accidental error in the gateway's calculation of the second check value, but by a problem in the transmission link between the sender and the gateway. Therefore, the gateway sends a first notification message to the sender, causing the sender to discard the check value, which may include the first check value and the third check value, and directly send the first encrypted message to the receiver through a physical line without passing through the gateway.
[0072] In some embodiments, when the third verification value and the second verification value are inconsistent, a first notification message is sent to the sender, including: if the third verification value and the second verification value are inconsistent, a third notification message is sent to the sender to instruct the sender to determine whether the sender's public key has been tampered with and obtain a judgment result; receive the judgment result sent by the sender; if it is determined based on the judgment result that the sender's public key has not been tampered with, then a first notification message is sent to the sender.
[0073] It can be understood that the third notification message is used to notify the sender to determine whether the sender's public key has been tampered with, and the determination result includes whether the sender's public key has been tampered with or not.
[0074] If the third check value and the second check value are still inconsistent, it can be determined that it is not caused by an accidental error in the gateway's calculation of the second check value, but by a problem in the transmission link between the sender and the gateway. At this time, the gateway can send a third notification message to the sender, so that the sender can perform a self-check to check whether the sender's public key has been tampered with, obtain a judgment result, and send the judgment result to the gateway; the gateway determines how to handle the first encrypted message based on the judgment result.
[0075] The above-mentioned method of checking whether the sender's public key has been tampered with may include: Under normal circumstances, the public keys of all ECUs are distributed in two areas, namely the general area and the non-general area. If the public key of a certain ECU has been used, the public key of the ECU will be stored in the general area. If the public key of a certain ECU has not been used, the public key of the ECU will be stored in the non-general area. If the sender's public key cannot be found in the general area, it means that when the original message is encrypted, the pre-set sender's public key is not used, that is, the sender's public key has been tampered with; if the sender's public key can be found in the general area, it means that when the original message is encrypted, the pre-set sender's public key is used, that is, the sender's public key has not been tampered with.
[0076] If the judgment result is that the sender's public key has not been tampered with, it means that there is no problem with the sender, that is, there is a problem with the gateway when calculating the second verification value. Therefore, the first verification value and the third verification value generated by the sender are directly discarded, and the sender is notified to send the first encrypted message directly to the receiver through the physical line without passing through the gateway.
[0077] In some embodiments, after receiving the judgment result sent by the sender, the method also includes: if it is determined based on the judgment result that the sender's public key has been tampered with, sending a fourth notification message to the sender to instruct the sender to send the original message; receiving the original message sent by the sender; encrypting the original message according to the public key of the gateway to obtain a second encrypted message; generating a fourth verification value based on the second encrypted message and a preset algorithm; sending the second encrypted message and the fourth verification value to the receiver, so that the receiver can generate a fifth verification value based on the second encrypted message and the preset algorithm, and retaining the second encrypted message when the fourth verification value and the fifth verification value are consistent.
[0078] It can be understood that the above-mentioned fourth notification message is used to notify the sender to send the original message to the gateway, and the above-mentioned second encrypted message is obtained after the gateway encrypts the above-mentioned original message using the gateway's public key. The above-mentioned gateway's public key can be used to encrypt the original message to obtain an encrypted message, and can also be used to decrypt the encrypted message to obtain the original message, and it is exactly the same as the public key of the sender. On the basis that the sender's public key is exactly the same as the gateway's public key, the above-mentioned first encrypted message and the second encrypted message are also exactly the same.
[0079] The fourth verification value is generated after the gateway processes the second encrypted message using a preset algorithm, and the fifth verification value is generated after the receiver processes the second encrypted message using a preset algorithm.
[0080] If the judgment result is that the sender's public key has been tampered with, it means that there was a problem when the sender received the first encrypted message, and there was a problem with the generated first check value. Therefore, the sender's key cannot be used to encrypt the original message. Instead, the original message is sent directly to the gateway, and the original message is encrypted according to the gateway's public key to obtain the second encrypted message.
[0081] In the process of sending the second encrypted message to the recipient, a direct sending method may be adopted, or the same verification method as above may be adopted. The verification method is specifically introduced below:
[0082] After receiving the second encrypted message, the gateway uses a preset algorithm to process the second encrypted message to generate a fourth verification value, and attaches the fourth verification value to the end of the second encrypted message and sends them together to the receiver; the receiver uses a preset algorithm to process the received second encrypted message to generate a fifth verification value. If the fourth verification value is consistent with the fifth verification value, the second encrypted message is retained; if the fourth verification value is inconsistent with the fifth verification value, the second encrypted message is discarded.
[0083] In some embodiments, if the first verification value and the second verification value are consistent, the first encrypted message is sent to the recipient.
[0084] It can be understood that if the first verification value and the second verification value are consistent during the first verification, the gateway can directly send the first encrypted message to the recipient, or it can use the same verification method as mentioned above. If the verification is successful, the first encrypted message is retained; if the verification fails, the first encrypted message is discarded.
[0085] The following is a more specific introduction to the embodiment of the present application by taking the sender as IBC and the receiver as HUT as an example:
[0086] Figure 4 It is a schematic flowchart of another message transmission method provided in an embodiment of the present application.
[0087] For example, Figure 4 As shown, the method 400 includes:
[0088] In step 401, IBC, GW, and HUT all issue the same secondary certificate through the same root certificate, and the public key in the secondary certificate is the same.
[0089] It is understandable that the root certificate is also called a self-signed certificate or a certificate issued by a CA (Certificate Authority). The root certificate is used to verify the authenticity of other certificates. In the certificate chain, each level of certificate is issued and signed by the previous level of certificate, and can ultimately be traced back to the root certificate. By verifying each level of signature in the certificate chain, the authenticity and non-tampering of the entire certificate chain can be ensured.
[0090] The secondary certificate is a certificate signed and issued by the primary root certificate, which ensures the authenticity of the secondary certificate and its association with the root certificate. The secondary certificate can also be used to issue subordinate certificates, thus forming a certificate chain.
[0091] The public key in the secondary certificate is a key element of encrypted communication and is used to encrypt the original message. Since IBC, GW, and HUT all issue secondary certificates through the same root certificate, the public keys in the secondary certificates of IBC, GW, and HUT are exactly the same. If the original messages are exactly the same, the encrypted messages are also exactly the same.
[0092] Step 402: The IBC encrypts the original message using the public key of the IBC to obtain a first encrypted message, processes the obtained first encrypted message using a preset algorithm to generate a first check value, and sends the first encrypted message and the first check value to the GW.
[0093] Step 403: After receiving the first encrypted message and the first check value, the GW processes the first encrypted message using a preset algorithm to generate a second check value, and verifies whether the first check value is consistent with the second check value.
[0094] Step 404: If the first check value is inconsistent with the second check value, the IBC processes the first encrypted message using a preset algorithm to generate a third check value, and sends it to the GW. The GW verifies whether the third check value is consistent with the second check value.
[0095] Step 405: If the third check value is inconsistent with the first check value, the IBC checks whether the public key of the IBC has been tampered with. If yes, step 407 is executed, otherwise, step 406 is continued.
[0096] Step 406: If the public key of the IBC has not been tampered with, the first encrypted message is sent to the HUT.
[0097] Step 407: If the public key of the IBC is tampered with, the IBC directly sends the original message to the GW, and the GW encrypts the original message according to the public key of the GW to generate a second encrypted message, and processes the second encrypted message using a preset algorithm to generate a fourth check value, and sends the second encrypted message and the fourth check value to the HUT.
[0098] Figure 5 It is an interactive flow chart of message transmission provided in an embodiment of the present application.
[0099] Among them, the IBC and HUT are connected through physical lines.
[0100] For example, Figure 5 As shown, the method 500 includes:
[0101] Step 501: The IBC encrypts the original message using the public key of the IBC to obtain a first encrypted message, and processes the first encrypted message using a preset algorithm to generate a second check value.
[0102] Step 502: The IBC sends a first encrypted message and a first check value to the GW.
[0103] Step 503: After receiving the first encrypted message, the GW processes the first encrypted message using a preset algorithm to generate a second verification value.
[0104] Step 504: GW determines whether the first check value and the second check value are consistent. If yes, step 506 is executed; otherwise, step 505 is continued.
[0105] Step 505: GW sends a second notification message to IBC.
[0106] It is understandable that after executing step 505, step 507 needs to be executed.
[0107] Step 506: The GW sends a first encrypted message to the HUT.
[0108] It can be understood that when the GW determines that the first verification value and the second verification value are consistent, after the HUT receives the first encrypted message, it uses the public key of the HUT to decrypt the first encrypted message to obtain the original message, and the process ends after obtaining the original message.
[0109] Step 507: The IBC processes the first encrypted message using a preset algorithm to generate a third check value.
[0110] Step 508: The IBC sends a third verification value to the GW.
[0111] Step 509: After receiving the third check value, the GW determines whether the third check value is consistent with the first check value. If yes, step 511 is executed; otherwise, step 510 is continued.
[0112] Step 510: The GW sends a third notification message to the IBC.
[0113] It is understandable that after executing step 510, step 512 needs to be executed.
[0114] Step 511: GW sends a first encrypted message to HUT.
[0115] It can be understood that when GW determines that the third verification value is consistent with the second verification value, after HUT receives the first encrypted message, it uses the public key of HUT to decrypt the first encrypted message to obtain the original message. The process ends after obtaining the original message.
[0116] Step 512, the IBC determines whether the public key of the IBC has been tampered with.
[0117] Step 513: IBC sends the determination result to GW.
[0118] It should be understood that after executing step 513, one of step 514 and step 517 is selected for execution based on the judgment result.
[0119] Step 514: The IBC determines based on the determination result that the public key of the IBC has not been tampered with.
[0120] Step 515: GW sends first notification information to IBC.
[0121] Step 516: The GW sends a first encrypted message to the HUT through a physical line.
[0122] It is understandable that, when GW determines that the public key of IBC has not been tampered with, after HUT receives the first encrypted message, it uses the public key of HUT to decrypt the first encrypted message to obtain the original message, and the process ends after obtaining the original message.
[0123] Step 517: The IBC determines, based on the determination result, that the public key of the IBC has been tampered with.
[0124] Step 518: GW sends fourth notification information to IBC.
[0125] Step 519: The IBC sends the original message to the GW.
[0126] Step 520: The GW encrypts the original message according to the public key of the GW to obtain a second encrypted message.
[0127] Step 521: The GW processes the second encrypted message using a preset algorithm to generate a fourth check value.
[0128] Step 522: The GW sends the second encrypted message and the fourth check value to the HUT.
[0129] Step 523: The HUT processes the second encrypted message using a preset algorithm to generate a fifth check value.
[0130] In step 524, the HUT determines whether the fourth check value and the fifth check value are consistent. If yes, the HUT executes step 525, otherwise, the HUT executes step 526.
[0131] Step 525: The HUT retains the second encrypted message.
[0132] After the HUT receives the second encrypted message, it uses the public key of the HUT to decrypt the second encrypted message to obtain the original message.
[0133] Step 526: The HUT discards the second encrypted message.
[0134] In summary, the message transmission method provided in the embodiment of the present application has the following beneficial effects:
[0135] First, add a direct signal sending method between the sender and the receiver. When the secondary verification at the gateway still fails, the encrypted message is not directly discarded. Instead, the subsequent processing method of the encrypted message is determined by judging whether the sender's public key has been tampered with. This can reduce the message discard rate to a certain extent.
[0136] Second, after the second verification still fails, it can be determined that the two verification failures are not caused by accidental errors of the gateway, but by problems in the transmission link between the sender and the gateway. At this time, the sender can be notified to perform a self-check to determine whether the sender's public key has been tampered with. If the sender's public key has not been tampered with, it means that there is a problem when the gateway calculates the verification value. In order to ensure the accuracy and security of subsequent message transmission, the sender directly sends the encrypted message to the receiver through the physical line between the sender and the receiver, and no longer passes through the gateway; the introduction of the above-mentioned self-check mechanism can ensure the accuracy and security of message transmission, and the sender directly sends the first encrypted message to the receiver through the physical line, which can reduce a certain message discard rate.
[0137] Figure 6 It is a structural diagram of a message transmission device provided in an embodiment of the present application.
[0138] For example, Figure 6 As shown, the device 600 includes:
[0139] The receiving module 601 is used to receive a first encrypted message and a first verification value sent by a sender; wherein the first encrypted message is obtained by the sender encrypting the original message using the sender's public key; the first verification value is generated by the sender processing the first encrypted message using a preset algorithm.
[0140] The generating module 602 is used to generate a second verification value based on the first encrypted message and a preset algorithm.
[0141] The sending module 603 is used to send a first notification message to the sender when the first check value and the second check value are inconsistent, so as to instruct the sender to send the first encrypted message to the receiver through the physical line.
[0142] In one possible implementation, the sending module is specifically used to: send a first notification message to the sender when the first verification value and the second verification value are inconsistent, including: if the first verification value and the second verification value are inconsistent, sending a second notification message to the sender to instruct the sender to generate a third verification value based on the first encrypted message and a preset algorithm; receiving the third verification value sent by the sender, and comparing the third verification value with the second verification value; and sending a first notification message to the sender when the third verification value and the second verification value are inconsistent.
[0143] In one possible implementation, the sending module is specifically used to: when the third verification value and the second verification value are inconsistent, send a first notification message to the sender, including: if the third verification value and the second verification value are inconsistent, send a third notification message to the sender to instruct the sender to determine whether the sender's public key has been tampered with and obtain a judgment result; receive the judgment result sent by the sender; if it is determined based on the judgment result that the sender's public key has not been tampered with, send a first notification message to the sender.
[0144] In one possible implementation, the sending module is specifically used to: after receiving the judgment result sent by the sender, the method also includes: if it is determined based on the judgment result that the sender's public key has been tampered with, sending a fourth notification message to the sender to instruct the sender to send the original message; receiving the original message sent by the sender; encrypting the original message according to the public key of the gateway to obtain a second encrypted message; generating a fourth verification value based on the second encrypted message and a preset algorithm; sending the second encrypted message and the fourth verification value to the receiver, so that the receiver can generate a fifth verification value based on the second encrypted message and the preset algorithm, and retaining the second encrypted message when the fourth verification value and the fifth verification value are consistent.
[0145] In a possible implementation, the sending module is further specifically configured to: if the first verification value and the second verification value are consistent, send the first encrypted message to a receiver.
[0146] In a possible implementation, the sender and the receiver are different electronic control units in the vehicle.
[0147] In one possible implementation, different electronic control units in a vehicle are connected via hard wires or via CAN lines.
[0148] An embodiment of the present application also provides a message transmission system, which includes a sender, a receiver and a gateway, the gateway is used to connect the sender and the receiver located in different network segments, and the sender and the receiver are connected through a physical line; the sender is used to encrypt the original message using the sender's public key to obtain a first encrypted message, generate a first verification value after processing the first encrypted message using a preset algorithm, and send the first encrypted message and the first verification value to the gateway; the gateway is used to receive the first encrypted message and the first verification value; based on the first encrypted message and the preset algorithm, generate a second verification value; when it is determined that the first verification value and the second verification value are inconsistent, send a first notification message to the sender; the sender is also used to send the first encrypted message to the receiver through a physical line after receiving the first notification message; the receiver is used to receive the first encrypted message.
[0149] It is not difficult to find that the embodiment of the present application is an embodiment of the message transmission system corresponding to the embodiment of the above-mentioned message transmission method, which can be implemented in conjunction with the embodiment of the above-mentioned message transmission method. The relevant technical details and technical effects mentioned in the embodiment of the above-mentioned message transmission method are also applicable to the embodiment of the message transmission system. In order to avoid repetition, they will not be repeated here.
[0150] Figure 7 It is a structural schematic diagram of a vehicle provided in an embodiment of the present application.
[0151] For example, Figure 7 As shown, the vehicle 700 includes: a memory 701 and a processor 702, wherein the memory 701 stores an executable program code 7011, and the processor 702 is used to call and execute the executable program code 7011 to perform a message transmission method.
[0152] In addition, an embodiment of the present application also protects a device, which may include a memory and a processor, wherein the memory stores an executable program code, and the processor is used to call and execute the executable program code to execute a message transmission method provided by an embodiment of the present application.
[0153] In this embodiment, the functional modules of the device can be divided according to the above method example. For example, each functional module can be corresponded, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0154] In the case of dividing each functional module according to each function, the device may also include a receiving module, a generating module and a sending module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0155] It should be understood that the device provided in this embodiment is used to execute the above-mentioned message transmission method, and thus can achieve the same effect as the above-mentioned implementation method.
[0156] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is applied to a vehicle, the processing module may be used to control and manage the actions of the vehicle. The storage module may be used to support the vehicle in executing related program codes, etc.
[0157] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits shown in conjunction with the disclosure of the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.
[0158] In addition, the device provided in the embodiments of the present application may specifically be a chip, component or module, and the chip may include a connected processor and memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a message transmission method provided in the above embodiments.
[0159] This embodiment also provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is executed on a computer, the computer executes the above-mentioned related method steps to implement a message transmission method provided in the above embodiment.
[0160] This embodiment also provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the above-mentioned related steps to implement a message transmission method provided by the above embodiment.
[0161] Among them, the device, computer-readable storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.
[0162] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0163] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0164] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A message transmission method, characterized in that: Applied to a gateway, the gateway is used to connect a sender and a receiver located in different network segments, the sender and the receiver are connected via a physical line, the method comprises: Receive a first encrypted message and a first check value sent by the sender; wherein the first encrypted message is obtained by the sender encrypting the original message using the sender's public key; and the first check value is generated by the sender processing the first encrypted message using a preset algorithm; Generate a second verification value based on the first encrypted message and the preset algorithm; In the case that the first verification value and the second verification value are inconsistent, a first notification message is sent to the sender to instruct the sender to send the first encrypted message to the receiver through the physical line.
2. The method according to claim 1, characterized in that: The sending a first notification message to the sender when the first check value and the second check value are inconsistent includes: If the first verification value and the second verification value are inconsistent, sending a second notification message to the sender to instruct the sender to generate a third verification value based on the first encrypted message and the preset algorithm; receiving the third verification value sent by the sender, and comparing the third verification value with the second verification value; When the third verification value is inconsistent with the second verification value, the first notification message is sent to the sender.
3. The method according to claim 2, characterized in that When the third check value and the second check value are inconsistent, sending the first notification message to the sender includes: If the third check value is inconsistent with the second check value, a third notification message is sent to the sender to instruct the sender to determine whether the sender's public key has been tampered with, and obtain a determination result; receiving the determination result sent by the sender; If it is determined based on the judgment result that the public key of the sender has not been tampered with, the first notification message is sent to the sender.
4. The method according to claim 3, characterized in that After receiving the determination result sent by the sender, the method further includes: If it is determined based on the judgment result that the public key of the sender has been tampered with, sending a fourth notification message to the sender to instruct the sender to send the original message; Receiving the original message sent by the sender; Encrypt the original message according to the public key of the gateway to obtain a second encrypted message; Generate a fourth check value based on the second encrypted message and the preset algorithm; The second encrypted message and the fourth verification value are sent to the receiver, so that the receiver generates a fifth verification value based on the second encrypted message and the preset algorithm, and retains the second encrypted message when the fourth verification value is consistent with the fifth verification value.
5. The method according to claim 1, characterized in that The method further comprises: If the first verification value is consistent with the second verification value, the first encrypted message is sent to the recipient.
6. The method according to any one of claims 1 to 5, characterized in that: The sender and the receiver are different electronic control units in a vehicle.
7. The method according to claim 6, characterized in that The different electronic control units in the vehicle are connected either by hard-wired connections or by CAN lines.
8. A message transmission system, characterized in that: The system includes a sender, a receiver and a gateway, wherein the gateway is used to connect the sender and the receiver located in different network segments, and the sender and the receiver are connected via a physical line; The sender is configured to encrypt the original message using the public key of the sender to obtain a first encrypted message, process the first encrypted message using a preset algorithm to generate a first check value, and send the first encrypted message and the first check value to the gateway; The gateway is used to receive the first encrypted message and the first check value; Generate a second verification value based on the first encrypted message and the preset algorithm; When it is determined that the first verification value and the second verification value are inconsistent, sending a first notification message to the sender; The sender is further configured to send the first encrypted message to the receiver through the physical line after receiving the first notification message; The receiver is used to receive the first encrypted message.
9. A message transmission device, characterized in that: Applied to a gateway, the gateway is used to connect a sender and a receiver located in different network segments, the sender and the receiver are connected via a physical line, and the device includes: A receiving module, configured to receive a first encrypted message and a first check value sent by the sender; wherein the first encrypted message is obtained by the sender encrypting the original message using the sender's public key; and the first check value is generated by the sender processing the first encrypted message using a preset algorithm; A generating module, configured to generate a second check value based on the first encrypted message and the preset algorithm; A sending module is used to send a first notification message to the sender when the first check value and the second check value are inconsistent, so as to instruct the sender to send the first encrypted message to the receiver through the physical line.
10. A vehicle, characterized in that: The vehicle comprises: A memory for storing executable program codes; A processor, configured to call and run the executable program code from the memory, so that the vehicle executes the method according to any one of claims 1 to 7.