Vehicle safety communication method, device, microprocessor and storage medium
Through the certification and legality detection mechanism of the vehicle OBD interface, the problem of insufficient vehicle communication security is solved, the protection of illegal equipment is realized, and the safe communication of the vehicle is ensured.
Patent Information
- Application Number
- CN202111653535.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing vehicle OBD interfaces have deficiencies in communication security and are difficult to prevent illegal equipment from accessing, which threatens vehicle safety.
Authentication is performed by receiving authentication requests from external devices, detecting the legality of the request packets, and forwarding legal request packets to the target components after passing the authentication. Virtual LAN and firewall mechanisms are used to isolate devices to prevent illegal request packets from being forwarded. .
It improves the security of vehicle communication, prevents illegal intrusion of illegal equipment, and ensures legal communication between external equipment and the vehicle.
Smart Images

Figure CN114422208B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a vehicle safety communication method, device, microprocessor and storage medium. Background Art
[0002] The external diagnostic instrument can be connected to the vehicle through the vehicle's On-Board Diagnostics (OBD) interface, and the communication between the diagnostic instrument and the vehicle is realized through the OBD interface. The communication process is mainly used for two purposes, the first is the diagnosis of the vehicle, and the second is the update of the vehicle software. Currently, all vehicles generally have an OBD interface. On the one hand, in order to meet the most basic requirements of the regulations, the communication content stipulated by the regulations only covers some standard diagnostic data related to vehicle emissions. On the other hand, in order to meet the enterprise-level vehicle diagnostic needs, each vehicle company can customize the enterprise-level diagnostic service according to the Unified Diagnostic Services (UDS) standard. The enterprise-level diagnostic service covers the transmission of diagnostic data of all components of the vehicle, offline calibration learning, vehicle configuration management, vehicle software updates and other services.
[0003] With the development of technology, the complexity of in-vehicle networks has increased. Currently, data transmission in the car can not only rely on the traditional CAN bus, but also can be achieved through Ethernet. The existing OBD interface is also compatible with these two data transmission methods. In other words, no matter whether the components in the car are connected to Ethernet or CAN bus, data can be transmitted with the components through the OBD interface.
[0004] As a vehicle's external communication interface, the OBD interface needs to be protected in terms of communication security, and many regulations also recommend protection design for the OBD interface. However, due to factors such as technology and platform, current vehicle companies do not provide good communication security protection for the OBD interface, making it difficult to prevent illegal devices from accessing the vehicle, resulting in a threat to vehicle safety. Summary of the invention
[0005] Embodiments of the present invention provide a vehicle safety communication method, device, microprocessor and storage medium to improve the safety of vehicle communication.
[0006] In a first aspect, an embodiment of the present invention provides a vehicle safety communication method, the method comprising:
[0007] receiving an authentication request sent by a first external device, and authenticating the first external device based on the authentication request;
[0008] After the authentication is passed, receiving a first request message sent by the first external device, and detecting the legitimacy of the first request message;
[0009] If the first request message is legal, determining a target component corresponding to the first request message;
[0010] Forwarding the first request message to the target component.
[0011] Optionally, the target component is a target electronic control unit ECU, and the first request message is used to request diagnostic data in the target ECU;
[0012] After forwarding the first request message to the target component, the method further includes:
[0013] Receiving the diagnostic data returned by the target ECU in response to the first request message;
[0014] The diagnostic data is returned to the first external device.
[0015] Optionally, the target component is connected to an Ethernet or a controller area network (CAN) bus inside the vehicle.
[0016] Optionally, the detecting the legitimacy of the first request message includes:
[0017] Obtaining first information to be detected in a message header of the first request message;
[0018] Obtaining a first preset legal information list;
[0019] If the first information to be detected matches any legal information in the first preset legal information list, it is determined that the first request message is legal.
[0020] Optionally, the method further comprises:
[0021] Before the authentication is passed, receiving a second request message sent by the first external device, and obtaining second information to be detected from a message header of the second request message;
[0022] Acquire a second preset legal information list, wherein the first preset legal information list includes legal information in the second preset legal information list;
[0023] If the second information to be detected matches any legal information in the second preset legal information list, the second request message is forwarded.
[0024] Optionally, the information to be detected includes at least any one of the following:
[0025] Communication protocol, TCP port, source Internet Protocol IP address, destination IP address, service identifier.
[0026] Optionally, the method is applied to a microprocessor MPU;
[0027] The MPU and various components inside the vehicle are configured in a first virtual local area network VLAN, wherein the various components inside the vehicle include the target components;
[0028] The MPU and the first external device are configured in a second VLAN.
[0029] Optionally, after the authentication is passed, the method further includes:
[0030] When it is detected that the preset firewall locking condition is met, if a third request message sent by the second external device is received, forwarding of the third request message is prohibited;
[0031] The preset firewall locking conditions include:
[0032] The first external device is unplugged; or,
[0033] The time since the last time a session hold message sent by the first external device was received exceeds a preset time.
[0034] Optionally, authenticating the first external device based on the authentication request includes:
[0035] Obtaining a random number, and sending the random number to the first external device;
[0036] Based on the random number, determining reference information;
[0037] Acquire encryption information obtained by encrypting the random number using a key by the first external device;
[0038] Decrypting the encrypted information using a locally stored key to obtain decrypted information;
[0039] If the decrypted information matches the reference information, it is determined that the first external device has passed authentication.
[0040] In a second aspect, an embodiment of the present invention provides a vehicle safety communication device, comprising:
[0041] an authentication module, configured to receive an authentication request sent by a first external device, and authenticate the first external device based on the authentication request;
[0042] A detection module, used for receiving a first request message sent by the first external device after the authentication is passed, and detecting the legitimacy of the first request message;
[0043] A forwarding module is used to determine a target component corresponding to the first request message if the first request message is legal; and forward the first request message to the target component.
[0044] Optionally, the target component is a target electronic control unit ECU, and the first request message is used to request diagnostic data in the target ECU;
[0045] The forwarding module is further used for:
[0046] Receiving the diagnostic data returned by the target ECU in response to the first request message;
[0047] The diagnostic data is returned to the first external device.
[0048] Optionally, the target component is connected to an Ethernet or a controller area network (CAN) bus inside the vehicle.
[0049] Optionally, the detection module is used to:
[0050] Obtaining first information to be detected in a message header of the first request message;
[0051] Obtaining a first preset legal information list;
[0052] If the first information to be detected matches any legal information in the first preset legal information list, it is determined that the first request message is legal.
[0053] Optionally, the detection module is further used to:
[0054] Before the authentication is passed, receiving a second request message sent by the first external device, and obtaining second information to be detected from a message header of the second request message;
[0055] Acquire a second preset legal information list, wherein the first preset legal information list includes legal information in the second preset legal information list;
[0056] If the second information to be detected matches any legal information in the second preset legal information list, the second request message is forwarded.
[0057] Optionally, the information to be detected includes at least any one of the following:
[0058] Communication protocol, TCP port, source Internet Protocol IP address, destination IP address, service identifier.
[0059] Optionally, the device is applied to a microprocessor MPU;
[0060] The MPU and various components inside the vehicle are configured in a first virtual local area network VLAN, wherein the various components inside the vehicle include the target components;
[0061] The MPU and the first external device are configured in a second VLAN.
[0062] Optionally, the forwarding module is further used to:
[0063] When it is detected that the preset firewall locking condition is met, if a third request message sent by the second external device is received, forwarding of the third request message is prohibited;
[0064] The preset firewall locking conditions include:
[0065] The first external device is unplugged; or,
[0066] The time since the last time a session hold message sent by the first external device was received exceeds a preset time.
[0067] Optionally, the authentication module is used to:
[0068] Obtaining a random number, and sending the random number to the first external device;
[0069] Based on the random number, determining reference information;
[0070] Acquire encryption information obtained by encrypting the random number using a key by the first external device;
[0071] Decrypting the encrypted information using a locally stored key to obtain decrypted information;
[0072] If the decrypted information matches the reference information, it is determined that the first external device has passed authentication.
[0073] In a third aspect, an embodiment of the present invention provides a microprocessor, comprising the vehicle safety communication device in the second aspect.
[0074] In a fourth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a microprocessor, the microprocessor can at least implement the vehicle safety communication method in the first aspect.
[0075] By adopting the present invention, when the external device and the vehicle are authenticated, the request message sent by the external device will still be filtered, illegal request messages will be shielded, and only legal request messages will be forwarded to the corresponding target components. By adopting the present invention, the external device can communicate with the vehicle, and any request message sent by the external device can be prevented from being forwarded without restriction after the authentication is passed. By adopting the present invention, the security of vehicle communication can be improved and illegal intrusion of illegal devices can be avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0077] Figure 1 A schematic diagram of a process flow of a vehicle safety communication method provided by an embodiment of the present invention;
[0078] Figure 2 A schematic diagram of a vehicle network structure provided by an embodiment of the present invention;
[0079] Figure 3 A schematic diagram of another vehicle network structure provided by an embodiment of the present invention;
[0080] Figure 4 A schematic diagram of another vehicle network structure provided by an embodiment of the present invention;
[0081] Figure 5 A schematic diagram of signaling interaction of a vehicle safety communication method provided by an embodiment of the present invention;
[0082] Figure 6 A schematic structural diagram of a vehicle safety communication device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0083] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0084] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.
[0085] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0086] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0087] Figure 1 The flowchart of a vehicle safety communication method provided by an embodiment of the present invention can be applied to a microprocessor (Micro Processor Unit, MPU) provided in a vehicle. Figure 1 As shown, the method comprises the following steps:
[0088] 101. Receive an authentication request sent by a first external device, and authenticate the first external device based on the authentication request.
[0089] 102. After the authentication is passed, receive a first request message sent by a first external device, and detect the legitimacy of the first request message.
[0090] 103. If the first request message is legal, determine a target component corresponding to the first request message.
[0091] 104. Forward the first request message to the target component.
[0092] The external device may be a diagnostic instrument. The first external device may be connected to the vehicle through an OBD interface provided in the vehicle to communicate with the vehicle. When the first external device is connected to the vehicle, it needs to be authenticated with the vehicle, and the authentication operation may prevent illegal devices from accessing the vehicle.
[0093] When the first external device is connected to the vehicle, the first external device may send an authentication request to the vehicle, and the vehicle may authenticate the first external device based on the authentication request.
[0094] Optionally, the authentication process can be implemented as follows: obtain a random number and send the random number to a first external device; determine reference information based on the random number; obtain encrypted information obtained by encrypting the random number using a key by the first external device; decrypt the encrypted information using a locally stored key to obtain decrypted information; if the decrypted information matches the reference information, it is determined that the authentication of the first external device is successful.
[0095] The authentication process can be specifically implemented by the MPU. First, the MPU can generate a random number and send the random number to the first external device. At the same time, the MPU can also use a preset encryption algorithm to perform an encryption operation on the random number to obtain reference information. Among them, the preset encryption algorithm may include a symmetric encryption algorithm, an asymmetric encryption algorithm or other encryption algorithms, which is not limited in this embodiment of the present invention.
[0096] If the first external device is a legitimate and authorized device, then a certificate is stored in the first external device, and the certificate carries a key for authentication operation. The first external device can obtain the key from the certificate, and then use a preset encryption algorithm to perform an encryption operation on the random number received from the MPU to obtain encrypted information. The first external device can send the encrypted information to the MPU.
[0097] The MPU can obtain the locally stored key and use the key to decrypt the encrypted information received from the first external device to obtain decrypted information. If the decrypted information matches the reference information, it means that the first external device is a legal and authorized device, and thus the first external device is authenticated.
[0098] After the authentication is passed, the method provided by the embodiment of the present invention may further include: when it is detected that the preset firewall locking condition is met, if a third request message sent by the second external device is received, the forwarding of the third request message is prohibited. The preset firewall locking condition includes: the first external device is unplugged; or the time since the last session hold message sent by the first external device is received exceeds the preset time.
[0099] The second external device may be the first external device or a device other than the first external device. When the first external device is unplugged, the newly connected second external device needs to be authenticated again. Specifically, the external device can connect the diagnostic activation line to the vehicle through the OBD interface, and by detecting the signal on the diagnostic activation line, it can be determined whether the external device is connected or unplugged.
[0100] In addition, after the first external device is connected to the vehicle, it needs to continuously send session maintenance messages to the MPU according to a preset period to maintain the connection. When the MPU detects that the time since the last session maintenance message sent by the first external device is received exceeds the preset time, the firewall can be set to a locked state.
[0101] The session hold message may be a Tester Present message. The preset duration may be, for example, 5 seconds.
[0102] In some optional embodiments, a firewall module may be provided in the MPU. Before the authentication is passed, the firewall is in a locked state. After the authentication is passed, the firewall may be unlocked by an unlocking instruction. It is understandable that before the authentication is passed, even if an unlocking instruction is received, the unlocking instruction will be shielded and no processing will be performed. In other words, authentication is a prerequisite for unlocking the firewall.
[0103] When the firewall is in the locked state, some routing functions of the MPU are disabled. The specific meaning of some routing functions of the MPU will be introduced later. When the firewall is in the unlocked state, the routing function of the MPU is enabled.
[0104] After the authentication is passed, the MPU receives the first request message sent by the first external device, and does not directly route any request message, but detects the legitimacy of the first request message and only routes the legitimate request message. Specifically, if the first request message is legitimate, the target component corresponding to the first request message is determined, and the first request message is forwarded to the target component.
[0105] Optionally, the target component may be a target electronic control unit (ECU). The request message may be used to request diagnostic data of the target ECU during vehicle diagnosis, or may be used to update target components that need to be updated during vehicle software update.
[0106] Among them, ECU is used to control the driving state of the vehicle and realize various functions. ECU can be divided into different types according to the different functions realized. ECU can include but not limited to engine management system, automatic transmission control unit, body control module, body electronic stability control system, battery management system, vehicle controller, intelligent gateway, TBOX (telematics box) module, etc.
[0107] Optionally, if the first request message is used to request diagnostic data of the target ECU, after forwarding the first request message to the target component, the method provided by the embodiment of the present invention may also include: receiving diagnostic data returned by the target ECU in response to the first request message; and returning the diagnostic data to the first external device.
[0108] The diagnostic data of the target ECU may be, for example, sensor data, state information of the target ECU, vehicle fault codes, etc. Maintenance personnel may locate vehicle faults based on the diagnostic data.
[0109] It should be noted that with the development of technology, the complexity of the in-vehicle network has been improved. Currently, data transmission in the car can not only rely on the traditional CAN bus, but also can be achieved through Ethernet. The existing OBD interface is also compatible with these two data transmission methods. In other words, no matter whether the components in the car are connected to Ethernet or CAN bus, data can be transmitted with the components through the OBD interface.
[0110] Based on this, there are currently two vehicle communication methods, including communication via Ethernet and communication via CAN bus. The vehicle safety communication method provided by the embodiment of the present invention is compatible with these two vehicle communication methods. The target component can be connected to the Ethernet or CAN bus inside the vehicle.
[0111] The specific implementation method of detecting the legitimacy of the first request message will be introduced below.
[0112] Optionally, the process of detecting the legality of the first request message can be implemented as follows: obtaining the first information to be detected in the message header of the first request message; obtaining a first preset legal information list; if the first information to be detected matches any legal information in the first preset legal information list, determining that the first request message is legal.
[0113] Optionally, the information to be detected may include at least one of the following: communication protocol, transmission control protocol port (TCP port), source Internet Protocol (IP) address, destination IP address, service identifier. The service may be a UDS service, and the service identifier may be represented as uds service id.
[0114] In some optional embodiments, the communication protocol may include a Diagnostic on IP (abbreviated as DoIP) protocol and a Diagnostic on CAN (abbreviated as DoCAN) protocol.
[0115] The above-mentioned information to be detected may be included in headers of different layers of the first request message, and the information to be detected may be obtained from the header of the corresponding layer for legitimacy verification.
[0116] In order to understand the process of detecting the legitimacy of the first request message, taking the scenario of detecting the legitimacy of the source IP as an example, the MPU can store a list of legal IPs, and the first external device can carry the IP of the first external device as the source IP in the first request message and send it to the MPU. The MPU can obtain the source IP from the first request message, and then check whether the source IP exists in the legal IP list. If the source IP exists in the legal IP list, it means that the source IP is legal.
[0117] Alternatively, taking the scenario of detecting the legality of the communication protocol as an example, the MPU can store a list of legal communication protocols, assuming that the list includes the DoIP protocol and the DoCAN protocol. The MPU can detect the communication protocol C used by the first request message from the header of the first request message sent by the first external device. If the communication protocol C is the DoIP protocol or the DoCAN protocol, then the communication protocol used by the first request message is legal. If the communication protocol C is a protocol other than the DoIP protocol and the DoCAN protocol, then the communication protocol used by the first request message is illegal.
[0118] It is worth noting that for the basic communication content specified by the regulations, this type of communication content only covers some standard diagnostic data related to vehicle emissions, and it does not pose a threat to the safety of the vehicle. Based on this, for this type of request message that does not pose a threat to the safety of the vehicle, the MPU can route it even if the authentication has not passed, which realizes the function of enabling the partial routing function of the MPU when the authentication has not passed. This can improve communication efficiency and avoid blocking all safe and reliable request messages.
[0119] Based on this, optionally, before authentication is passed, a second request message sent by the first external device is received, and the second information to be detected is obtained from the message header of the second request message; a second preset legal information list is obtained, and the first preset legal information list includes the legal information in the second preset legal information list; if the second information to be detected matches any legal information in the second preset legal information list, the second request message is forwarded.
[0120] It is understandable that the first preset legal information list can be considered as a large table containing more legal information, and the second preset legal information list can be considered as a small table containing less legal information. The first preset legal information list can include all the contents in the second legal information list. Before the authentication is passed, only a small part of the very safe and reliable request messages can be forwarded to the corresponding target components, and after the authentication is passed, the possibility of more request messages being forwarded can be increased.
[0121] In order to understand the process of detecting the legitimacy of the second request message, taking the scenario of detecting the legitimacy of the UDS service ID as an example, the MPU can store a list of legal UDS service IDs, assuming that the legal UDS service ID list includes 3 legal UDS service IDs: $10, $27, and $31. The first external device can carry the UDS service ID to be requested in the second request message and send it to the MPU. The MPU can obtain the UDS service ID to be requested from the second request message. If the UDS service ID to be requested is any one of $10, $27, and $31, it means that the UDS service ID to be requested is legal.
[0122] It should be noted that if Figure 2 As shown, the first external device is electrically connected to the OBD interface, the OBD interface is electrically connected to the Ethernet switch, the Ethernet switch is electrically connected to the MPU, and the MPU is connected to each ECU via Ethernet.
[0123] Actually, in the process of forwarding the first request message, the first external device first sends the first request message to the Ethernet switch through the OBD interface, and then the Ethernet switch forwards the first request message to the MPU. If the first request message is legal, the MPU finally forwards the first request message to the corresponding target ECU.
[0124] Compared with the solution of directly forwarding the first request message to the corresponding target ECU through the Ethernet switch, the technical solution provided by the embodiment of the present invention can better ensure the security of communication. Because the Ethernet switch is a network device of the second layer (i.e., the data link layer) in the Open System Interconnection Reference Model (OSI) reference model, the information to be detected mentioned above corresponds to the third layer (i.e., the network layer) and above in the OSI reference model, that is, only the network devices of the third layer or above in the OSI reference model can identify the information to be detected from the first request message.
[0125] The Ethernet switch cannot identify the information to be detected in the first request message, and thus cannot filter the first request message at the high level of the OSI reference model. As long as the external device and the vehicle are authenticated, the Ethernet switch will forward the request message sent by the external device, so the security of communication cannot be guaranteed.
[0126] The MPU can be considered as a network device at or above the third layer in the OSI reference model, which can correctly identify the information to be detected in the first request message, and filter the illegal first request message based on the information to be detected in the first request message. Therefore, the technical solution provided by the embodiment of the present invention can better ensure the security of communication.
[0127] In some optional embodiments, the Ethernet switch may be configured to isolate different components inside the vehicle from the first external device by setting up different virtual local area networks (VLANs).
[0128] Based on this, optionally, the MPU and various components inside the vehicle can be configured in the first VLAN, and the MPU and the first external device can be configured in the second VLAN. Among them, the various components inside the vehicle include the target components.
[0129] like Figure 3 As shown, the MPU and the first external device can be configured in VLAN A, and the MPU and the first external device can be configured in VLAN B.
[0130] Devices in different VLANs can be considered to be physically isolated and cannot communicate with each other. That is, the first external device cannot directly communicate with the ECUs in the vehicle except the MPU. As an intermediary, the MPU can play the role of transmitting messages or data between the first VLAN and the second VLAN. Any request message entering the first VLAN needs to be filtered by the MPU.
[0131] It should be noted that, in the embodiment of the present invention, the VLAN configuration is not changed before and after the authentication is passed. That is to say, regardless of whether the authentication is passed or not, the MPU and the components inside the vehicle are configured in the first VLAN, and the MPU and the first external device are configured in the second VLAN. In this way, the steps of changing the VLAN configuration can be saved and the network transmission efficiency can be improved. At the same time, the first external device and the components inside the vehicle except the MPU are always kept isolated from each other, preventing the first external device and the components inside the vehicle except the MPU from communicating directly without filtering through the firewall, which can further improve the security of vehicle communications.
[0132] In some optional embodiments, the vehicle's Ethernet can be divided into a main network and multiple subnets, and the main network and the multiple subnets can be connected through an Ethernet diagnostic domain controller. Assuming that the first request message is forwarded to a certain subnet, the MPU can first forward the first request message to the Ethernet diagnostic domain controller corresponding to the subnet, and then the Ethernet diagnostic domain controller forwards the first request message to the corresponding target ECU.
[0133] In addition, the Ethernet diagnostic domain controller can also be connected to the CAN bus, so that the ECU connected to the CAN bus can also exchange data with the ECU connected to the Ethernet through the Ethernet diagnostic domain controller.
[0134] The OBD interface is compatible with 4-wire standard Ethernet cables and 2-wire standard CAN buses. If the first external device needs to communicate with the vehicle via Ethernet, it can be connected to the vehicle Ethernet via a 4-wire standard Ethernet cable. If the first external device needs to communicate with the vehicle via a CAN bus, it can be connected via a 2-wire standard CAN bus.
[0135] like Figure 4 As shown, when the first external device communicates with the vehicle via the CAN bus, the first external device can also send a message to the MPU. If the message is legal, if the forwarding object corresponding to the message is an ECU connected to the MPU via the CAN bus, the MPU directly forwards the message to the corresponding ECU via the CAN bus. If the forwarding object corresponding to the message is an ECU connected to the microcontroller via the CAN bus, the MPU first forwards the message to the microcontroller, and then the microcontroller forwards the message to the corresponding ECU via the CAN bus.
[0136] In some optional embodiments, the above-mentioned MPU and single-chip microcomputer can be components in the in-vehicle diagnostic edge ECU, and the in-vehicle diagnostic edge ECU can be, for example, a smart gateway or a TBOX module. Since current smart vehicles are generally equipped with smart gateways or TBOX modules, the MPU in the smart gateway or TBOX module can be directly reused to implement the method provided in the embodiment of the present invention, which can reduce deployment costs.
[0137] In summary, Figure 5 The signaling interaction diagram of the method provided by the embodiment of the present invention is shown. The interaction process between the devices includes the following steps:
[0138] 501. The diagnostic instrument sends an authentication request to the in-vehicle diagnostic edge ECU.
[0139] 502. The in-vehicle diagnostic edge ECU returns a random number to the diagnostic instrument.
[0140] 503. The diagnostic instrument uses a symmetric encryption algorithm to perform encryption operation on the random number to obtain an encryption result. The diagnostic instrument sends the encryption result to the in-vehicle diagnostic edge ECU.
[0141] 504. The in-vehicle diagnostic edge ECU verifies the encryption result.
[0142] 505. The in-vehicle diagnostic edge ECU feeds back the verification result to the diagnostic instrument.
[0143] 506. The diagnostic instrument sends a firewall unlocking command to the diagnostic edge ECU in the vehicle.
[0144] 507. If the verification result is authentication passed, the in-vehicle diagnostic edge ECU sets the firewall to unlocked state.
[0145] 508. The diagnostic instrument sends a request message to the in-vehicle diagnostic edge ECU, and the request message is forwarded by the in-vehicle diagnostic edge ECU and sent to the corresponding ECU connected to the Ethernet or the ECU connected to the CAN bus.
[0146] 509. The diagnostic instrument is disconnected. The diagnostic edge ECU in the vehicle detects that the diagnostic instrument is disconnected and re-locks the firewall.
[0147] In addition, it should be noted that when the vehicle is on the production line, the firewall is not activated to prevent frequent opening and closing of the firewall on the production line. After the vehicle is off the production line, the firewall is activated to ensure the security of vehicle communication.
[0148] By adopting the present invention, when the external device and the vehicle are authenticated, the request message sent by the external device will still be filtered, illegal request messages will be shielded, and only legal request messages will be forwarded to the corresponding target components. By adopting the present invention, the external device can communicate with the vehicle, and any request message sent by the external device can be prevented from being forwarded without restriction after the authentication is passed. By adopting the present invention, the security of vehicle communication can be improved and illegal intrusion of illegal devices can be avoided.
[0149] The following will describe in detail one or more embodiments of the vehicle safety communication device of the present invention. Those skilled in the art will appreciate that these vehicle safety communication devices can be configured using commercially available hardware components through the steps taught in this solution.
[0150] Figure 6 A schematic diagram of the structure of a vehicle safety communication device provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, the device comprises:
[0151] The authentication module 61 is configured to receive an authentication request sent by a first external device, and authenticate the first external device based on the authentication request;
[0152] A detection module 62, configured to receive a first request message sent by the first external device after the authentication is passed, and detect the legitimacy of the first request message;
[0153] The forwarding module 63 is configured to determine a target component corresponding to the first request message if the first request message is legal; and forward the first request message to the target component.
[0154] Optionally, the target component is a target electronic control unit ECU, and the first request message is used to request diagnostic data in the target ECU;
[0155] The forwarding module 63 is further used for:
[0156] Receiving the diagnostic data returned by the target ECU in response to the first request message;
[0157] The diagnostic data is returned to the first external device.
[0158] Optionally, the target component is connected to an Ethernet or a controller area network (CAN) bus inside the vehicle.
[0159] Optionally, the detection module 62 is used to:
[0160] Obtaining first information to be detected in a message header of the first request message;
[0161] Obtaining a first preset legal information list;
[0162] If the first information to be detected matches any legal information in the first preset legal information list, it is determined that the first request message is legal.
[0163] Optionally, the detection module 62 is further configured to:
[0164] Before the authentication is passed, receiving a second request message sent by the first external device, and obtaining second information to be detected from a message header of the second request message;
[0165] Acquire a second preset legal information list, wherein the first preset legal information list includes legal information in the second preset legal information list;
[0166] If the second information to be detected matches any legal information in the second preset legal information list, the second request message is forwarded.
[0167] Optionally, the information to be detected includes at least any one of the following:
[0168] Communication protocol, TCP port, source Internet Protocol IP address, destination IP address, service identifier.
[0169] Optionally, the device is applied to a microprocessor MPU;
[0170] The MPU and various components inside the vehicle are configured in a first virtual local area network VLAN, wherein the various components inside the vehicle include the target components;
[0171] The MPU and the first external device are configured in a second VLAN.
[0172] Optionally, the forwarding module 63 is further configured to:
[0173] When it is detected that the preset firewall locking condition is met, if a third request message sent by the second external device is received, forwarding of the third request message is prohibited;
[0174] The preset firewall locking conditions include:
[0175] The first external device is unplugged; or,
[0176] The time since the last time a session hold message sent by the first external device was received exceeds a preset time.
[0177] Optionally, the authentication module 61 is used to:
[0178] Obtaining a random number, and sending the random number to the first external device;
[0179] Based on the random number, determining reference information;
[0180] Acquire encryption information obtained by encrypting the random number using a key by the first external device;
[0181] Decrypting the encrypted information using a locally stored key to obtain decrypted information;
[0182] If the decrypted information matches the reference information, it is determined that the first external device has passed authentication.
[0183] Figure 6 The device shown can perform the aforementioned Figures 1 to 5 The vehicle safety communication method provided in the illustrated embodiment, the detailed execution process and technical effects are described in the aforementioned embodiments, and will not be repeated here.
[0184] In one possible design, the above Figure 6 The structure of the vehicle safety communication device shown can be implemented as a microprocessor.
[0185] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, wherein the non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a microprocessor, the microprocessor can at least implement the above-mentioned Figures 1 to 5 The vehicle safety communication method provided in the illustrated embodiment.
[0186] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0187] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0188] The vehicle safety communication method provided in the embodiment of the present invention can be executed by a certain program / software, and the program / software can be provided by the network side. The electronic device mentioned in the above embodiment can download the program / software to a local non-volatile storage medium, and when it needs to execute the above vehicle safety communication method, the program / software is read into the memory by the CPU, and then the CPU executes the program / software to implement the vehicle safety communication method provided in the above embodiment. The execution process can refer to the above Figures 1 to 5 Instructions in .
[0189] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A vehicle safety communication method, It is characterized in that The method is applied to a microprocessor MPU, a first external device is electrically connected to an on-board automatic diagnostic system OBD interface of a vehicle, the OBD interface is electrically connected to an Ethernet switch, the Ethernet switch is electrically connected to the MPU, and the MPU is connected to each electronic control unit ECU in the vehicle through Ethernet; the MPU and each component inside the vehicle are configured in a first virtual local area network VLAN, wherein each component inside the vehicle includes a target component, and the target component is an ECU; the MPU and the first external device are configured in a second VLAN, and a firewall module is set in the MPU; The method comprises: receiving an authentication request sent by the first external device, and authenticating the first external device based on the authentication request; Before the authentication is passed, the firewall module is in a locked state. After the authentication is passed, the firewall module is unlocked through an unlocking instruction. When the firewall module is in the unlocked state, the routing function of the MPU is enabled. receiving a first request message sent by the first external device, and detecting the legitimacy of the first request message; If the first request message is legal, determining the target component corresponding to the first request message; Forwarding the first request message to the target component.
2. The method according to claim 1, It is characterized in that The first request message is used to request diagnostic data in the target ECU; After forwarding the first request message to the target component, the method further includes: Receiving the diagnostic data returned by the target ECU in response to the first request message; The diagnostic data is returned to the first external device.
3. The method according to claim 1, It is characterized in that The target components are connected to the Ethernet or controller area network (CAN) bus inside the vehicle.
4. The method according to claim 1, It is characterized in that The detecting the legitimacy of the first request message includes: Obtaining first information to be detected in a message header of the first request message; Obtaining a first preset legal information list; If the first information to be detected matches any legal information in the first preset legal information list, it is determined that the first request message is legal.
5. The method according to claim 4, It is characterized in that The method further comprises: Before the authentication is passed, receiving a second request message sent by the first external device, and obtaining second information to be detected from a message header of the second request message; Acquire a second preset legal information list, wherein the first preset legal information list includes legal information in the second preset legal information list; If the second information to be detected matches any legal information in the second preset legal information list, the second request message is forwarded.
6. The method according to claim 4 or 5, It is characterized in that The information to be detected includes at least any one of the following: Communication protocol, TCP port, source Internet Protocol IP address, destination IP address, service identifier.
7. The method according to claim 1, It is characterized in that After the authentication is passed, the method further includes: When it is detected that the preset firewall locking condition is met, if a third request message sent by the second external device is received, forwarding of the third request message is prohibited; The preset firewall locking conditions include: The first external device is unplugged; or, The time since the last time a session hold message sent by the first external device was received exceeds a preset time.
8. The method according to claim 1, It is characterized in that The authenticating the first external device based on the authentication request includes: Obtaining a random number, and sending the random number to the first external device; Based on the random number, determining reference information; Acquire encryption information obtained by encrypting the random number using a key by the first external device; Decrypting the encrypted information using the key stored locally to obtain decrypted information; If the decrypted information matches the reference information, it is determined that the first external device has passed authentication.
9. A vehicle safety communication device, It is characterized in that The device is arranged in a microprocessor MPU, a first external device is electrically connected to an on-board automatic diagnostic system OBD interface of a vehicle, the OBD interface is electrically connected to an Ethernet switch, the Ethernet switch is electrically connected to the MPU, and the MPU is connected to each electronic control unit ECU in the vehicle via Ethernet; the MPU and each component inside the vehicle are arranged in a first virtual local area network VLAN, wherein each component inside the vehicle includes a target component, and the target component is an ECU; the MPU and the first external device are arranged in a second VLAN, and a firewall module is arranged in the MPU; The device comprises: an authentication module, configured to receive an authentication request sent by the first external device, and authenticate the first external device based on the authentication request; A detection module, configured to lock the firewall module before the authentication is passed, and unlock the firewall module through an unlock instruction after the authentication is passed, wherein the routing function of the MPU is enabled when the firewall module is in the unlocked state; receive the first request message sent by the first external device, and detect the legitimacy of the first request message; A forwarding module is used to determine the target component corresponding to the first request message if the first request message is legal; and forward the first request message to the target component.
10. The device according to claim 9, It is characterized in that The first request message is used to request diagnostic data in the target ECU; The forwarding module is further used for: Receiving the diagnostic data returned by the target ECU in response to the first request message; The diagnostic data is returned to the first external device.
11. The device according to claim 9, It is characterized in that The target components are connected to the Ethernet or controller area network (CAN) bus inside the vehicle.
12. The device according to claim 9, It is characterized in that The detection module is used for: Obtaining first information to be detected in a message header of the first request message; Obtaining a first preset legal information list; If the first information to be detected matches any legal information in the first preset legal information list, it is determined that the first request message is legal.
13. The device according to claim 12, It is characterized in that The detection module is further used for: Before the authentication is passed, receiving a second request message sent by the first external device, and obtaining second information to be detected from a message header of the second request message; Acquire a second preset legal information list, wherein the first preset legal information list includes legal information in the second preset legal information list; If the second information to be detected matches any legal information in the second preset legal information list, the second request message is forwarded.
14. The device according to claim 12 or 13, It is characterized in that The information to be detected includes at least any one of the following: Communication protocol, TCP port, source Internet Protocol IP address, destination IP address, service identifier.
15. The device according to claim 9, It is characterized in that The forwarding module is further used for: When it is detected that the preset firewall locking condition is met, if a third request message sent by the second external device is received, forwarding of the third request message is prohibited; The preset firewall locking conditions include: The first external device is unplugged; or, The time since the last time a session hold message sent by the first external device was received exceeds a preset time.
16. The device according to claim 9, It is characterized in that The authentication module is used to: Obtaining a random number, and sending the random number to the first external device; Based on the random number, determining reference information; Acquire encryption information obtained by encrypting the random number using a key by the first external device; Decrypting the encrypted information using the key stored locally to obtain decrypted information; If the decrypted information matches the reference information, it is determined that the first external device has passed authentication.
17. A microprocessor, It is characterized in that A vehicle safety communication device comprising any one of claims 9-16.
18. A non-transitory machine-readable storage medium, It is characterized in that The non-transitory machine-readable storage medium stores executable codes, and when the executable codes are executed by a microprocessor, the microprocessor executes the vehicle safety communication method according to any one of claims 1 to 8.
