Vehicle safety diagnosis method, system, device and computer program product

By generating and encrypting seed data through the vehicle controller, and verifying it with the authentication credentials of the diagnostic equipment, the national cryptographic algorithm SM4 is used to solve the problem of excessive authorization in the existing vehicle diagnostic solution, and achieve higher security protection and anti-attack capabilities.

CN121657644APending Publication Date: 2026-03-13CHINA FAW CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In existing vehicle diagnostic solutions, diagnostic equipment can obtain the highest diagnostic authority of the vehicle controller through a single verification, which violates the principle of least privilege, resulting in low security protection levels. Furthermore, the simple algorithm is easily reverse engineered and can be easily bypassed by attackers.

Method used

When the vehicle controller determines that the target diagnostic service requested by the diagnostic device requires authentication, it generates seed data and obtains authentication credential information through SM4 encryption. The diagnostic device performs matching verification and activates the corresponding set of diagnostic services only when the authentication is successful. The high-complexity national cryptographic SM4 algorithm is used to improve the anti-attack capability.

Benefits of technology

It achieves more refined permission management, improves the security level during vehicle diagnosis, enhances the ability to resist attacks, follows the principle of least privilege, and reduces the risk of internal misoperation and external attack.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121657644A_ABST
    Figure CN121657644A_ABST
Patent Text Reader

Abstract

The invention discloses a vehicle safety diagnosis method, system and device and a computer program product, and relates to the technical field of vehicles. The method comprises the following steps: receiving a diagnosis request sent by diagnosis equipment through a diagnosis session, wherein the diagnosis request is used for requesting to execute a target diagnosis service; when it is determined that the target diagnosis service needs to be authenticated and the diagnosis session is in an unlocked state, generating seed data and sending the seed data to the diagnosis device through the diagnosis session, so that the diagnosis device performs SM4 encryption on the seed data according to a preset first key to obtain authentication credential information, and then generates a security authentication request carrying the authentication credential information; receiving a security authentication request sent by the diagnosis equipment through the diagnosis session; and when the authentication credential information is verified to be valid, setting the diagnosis session to be in an unlocked state, and activating a diagnosis service set which is pre-bound with the security authentication request and comprises a target diagnosis service. According to the invention, the safety protection level during vehicle diagnosis can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of vehicle technology, and in particular to vehicle safety diagnostic methods, systems, devices, and computer program products. Background Technology

[0002] In existing vehicle diagnostic solutions, the on-board controller typically generates seed data and sends it to the diagnostic device. The diagnostic device then processes the seed data using a pre-shared simple algorithm (such as shift, XOR, etc.) to obtain a response data, which is then sent back to the on-board controller. After the on-board controller verifies the response data, it grants the diagnostic device all diagnostic service permissions. In other words, the diagnostic device can obtain the highest diagnostic permissions from the on-board controller with just one verification. This over-authorization model violates the principle of least privilege in the field of cybersecurity, resulting in a low level of security protection during vehicle diagnostics. Summary of the Invention

[0003] The main objective of this application is to provide vehicle safety diagnostic methods, systems, devices, and computer program products, with the aim of improving the level of safety protection during vehicle diagnostics.

[0004] To achieve the above objectives, one aspect of this application proposes a vehicle safety diagnostic method applied to an on-board controller, the method comprising: Receive diagnostic requests sent by diagnostic devices through a diagnostic session, the diagnostic requests being used to request the execution of a target diagnostic service; When it is determined that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state, seed data is generated and sent to the diagnostic device through the diagnostic session, so that the diagnostic device can encrypt the seed data with SM4 according to the preset first key to obtain authentication credential information, and then generate a security authentication request carrying the authentication credential information. Receive the security authentication request sent by the diagnostic device through the diagnostic session; When verifying the validity of the authentication credential information, the diagnostic session is set to an unlocked state, and the diagnostic service set pre-bound to the security authentication request is activated, the diagnostic service set including the target diagnostic service.

[0005] In some embodiments, generating seed data and sending it to the diagnostic device via the diagnostic session includes: A random number is generated using a preset random number generator and used as the seed data; A diagnostic response message carrying the seed data is generated and sent to the diagnostic device through the diagnostic session.

[0006] In some embodiments, determining that the target diagnostic service requires authentication includes: Invoke a predefined set of critical diagnostic services, each of which is restricted to execution only after security authentication is completed; When the target diagnostic service belongs to the set of key diagnostic services, it is determined that the target diagnostic service needs to be authenticated.

[0007] In some embodiments, verifying the validity of the authentication credential information includes: The seed data is encrypted using SM4 according to the preset second key to obtain local credential information; When the authentication credential information matches the local credential information, the authentication credential information is verified to be valid.

[0008] In some embodiments, the method further includes: If multiple authentication credentials carried by multiple security authentication requests are found to be invalid after repeated verifications, a security lockout mechanism is triggered. The security lockout mechanism is used to restrict the vehicle controller to stop security authentication of the target diagnostic service within a preset time period.

[0009] To achieve the above objectives, another aspect of this application proposes a vehicle safety diagnostic method, applied to a diagnostic device, the method comprising: A diagnostic request is sent to the vehicle controller through a diagnostic session. The diagnostic request is used to request the execution of a target diagnostic service so that the vehicle controller generates seed data when it determines that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. The system receives the seed data sent by the vehicle controller through the diagnostic session, encrypts the seed data using SM4 according to a preset first key to obtain authentication credential information, and then generates a security authentication request carrying the authentication credential information. The diagnostic session sends the security authentication request to the vehicle controller, so that when the vehicle controller verifies the validity of the authentication credential information, it sets the diagnostic session to an unlocked state and activates the diagnostic service set pre-bound to the security authentication request, the diagnostic service set including the target diagnostic service.

[0010] To achieve the above objectives, another aspect of this application provides a vehicle safety diagnostic system, the system including a diagnostic device and an on-board controller, wherein a diagnostic session connection is established between the diagnostic device and the on-board controller; The diagnostic device is used to send a diagnostic request to the vehicle controller through the diagnostic session, and the diagnostic request is used to request the execution of a target diagnostic service. The vehicle controller is used to receive the diagnostic request, and when it is determined that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state, it generates seed data and sends it to the diagnostic device through the diagnostic session. The diagnostic device is also used to receive the seed data, encrypt the seed data using SM4 according to a preset first key to obtain authentication credential information, generate a security authentication request carrying the authentication credential information, and then send the security authentication request to the vehicle controller through the diagnostic session. The vehicle controller is also used to receive the security authentication request, and when verifying the validity of the authentication credential information, to set the diagnostic session to an unlocked state and activate the diagnostic service set pre-bound to the security authentication request, wherein the diagnostic service set includes the target diagnostic service.

[0011] To achieve the above objectives, another aspect of this application provides a vehicle safety diagnostic device applied to an on-board controller, the device comprising: The first receiving module is used to receive a diagnostic request sent by the diagnostic device through a diagnostic session, wherein the diagnostic request is used to request the execution of a target diagnostic service; The first processing module is used to generate seed data and send it to the diagnostic device through the diagnostic session when it is determined that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. The diagnostic device then performs SM4 encryption on the seed data according to a preset first key to obtain authentication credential information and generates a security authentication request carrying the authentication credential information. The second receiving module is used to receive the security authentication request sent by the diagnostic device through the diagnostic session; The second processing module is used to set the diagnostic session to an unlocked state when verifying the validity of the authentication credential information, and to activate the diagnostic service set pre-bound to the security authentication request, wherein the diagnostic service set includes the target diagnostic service.

[0012] To achieve the above objectives, another aspect of this application provides a vehicle safety diagnostic device, applied to diagnostic equipment, the device comprising: The first sending module is used to send a diagnostic request to the vehicle controller through a diagnostic session. The diagnostic request is used to request the execution of a target diagnostic service so that the vehicle controller generates seed data when it determines that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. The third processing module is used to receive the seed data sent by the vehicle controller through the diagnostic session, encrypt the seed data using SM4 according to the preset first key to obtain authentication credential information, and then generate a security authentication request carrying the authentication credential information. The second sending module is used to send the security authentication request to the vehicle controller through the diagnostic session, so that when the vehicle controller verifies the validity of the authentication credential information, it sets the diagnostic session to an unlocked state and activates the diagnostic service set pre-bound to the security authentication request, the diagnostic service set including the target diagnostic service.

[0013] To achieve the above objectives, another aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the vehicle safety diagnostic method described above.

[0014] The embodiments of this application include at least the following beneficial effects: When the vehicle controller determines that the target diagnostic service requested by the diagnostic device requires authentication and the diagnostic session established with the diagnostic device is in an unlocked state, it generates seed data and sends it to the diagnostic device. The diagnostic device then uses a preset first key to encrypt the seed data using SM4 to obtain authentication credential information. This encryption method can improve the anti-attack capability during vehicle diagnostic authentication. A security authentication request carrying authentication credential information is then generated. Subsequently, when the authentication credential information carried in the security authentication request sent by the diagnostic device is verified to be valid, the diagnostic session is set to an unlocked state. The security authentication request is treated as an authentication sub-service, activating the diagnostic service set containing the target diagnostic service that is pre-bound to the authentication sub-service. This enables more refined permission management, thereby improving the security protection level during vehicle diagnostics.

[0015] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0016] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a schematic diagram of the composition of a vehicle safety diagnostic system provided in one embodiment of this application; Figure 2 This is a schematic flowchart of a vehicle safety diagnostic method provided in one embodiment of this application; Figure 3 This is a flowchart illustrating a vehicle safety diagnostic method provided in another embodiment of this application; Figure 4 This is a schematic diagram illustrating the composition of a vehicle safety diagnostic device according to an embodiment of this application; Figure 5 This is a schematic diagram of the composition of a vehicle safety diagnostic device provided in another embodiment of this application. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the reference to "embodiment" herein means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. The implementation methods described in the following exemplary embodiments do not represent all implementation methods consistent with the embodiments of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.

[0018] It is understood that the terms "first," "second," etc., used in this application may be used to describe various concepts herein, but unless specifically stated otherwise, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words "if" or "when" as used herein may be interpreted as "when," "in response to a determination," or "at least one," "multiple," "each," "any," etc., as used in this application, at least one includes one, two, or more than two, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0020] In existing vehicle diagnostic solutions, the onboard controller typically generates seed data and sends it to the diagnostic device. The diagnostic device then processes this seed data using a pre-shared, simple algorithm (such as shift or XOR) to obtain a response, which is sent back to the onboard controller. After verifying the response, the onboard controller grants the diagnostic device full access to diagnostic services. This means the diagnostic device gains the highest diagnostic privileges from the onboard controller with a single verification. For example, the diagnostic device can indiscriminately access all diagnostic functions, from data reading to critical parameter rewriting, effectively treating high-risk rewriting services and low-risk reading services with equal permissions. This over-authorization model violates the principle of least privilege in cybersecurity, making low-risk access operations a springboard for attackers to gain higher-level privileges, resulting in low security levels during vehicle diagnostics. Furthermore, diagnostic devices typically use simple algorithms to calculate the response data. Once this calculation logic is reverse-engineered, attackers can easily simulate the behavior of legitimate diagnostic devices to bypass security authentication mechanisms, thereby gaining unauthorized access and control of the onboard controller.

[0021] In view of this, this application proposes a vehicle safety diagnostic method, system, device, and computer program product. This solution proposes that, when the onboard controller determines that the target diagnostic service requested by the diagnostic device requires authentication and the diagnostic session established with the diagnostic device is in an unlocked state, seed data is generated and sent to the diagnostic device. The diagnostic device then uses a preset first key to encrypt the seed data using SM4 to obtain authentication credentials. This encryption method improves the anti-attack capability during vehicle diagnostic authentication. A security authentication request carrying the authentication credentials is then generated. Subsequently, when the validity of the authentication credentials carried in the security authentication request sent by the diagnostic device is verified, the diagnostic session is set to an unlocked state. The security authentication request is treated as an authentication sub-service, activating a set of diagnostic services pre-bound to the authentication sub-service, which includes the target diagnostic service. This enables more refined access control, thereby improving the security level during vehicle diagnostics.

[0022] Please refer to Figure 1 , Figure 1 This is a schematic diagram of a vehicle safety diagnostic system provided in one embodiment of this application. The vehicle safety diagnostic system includes a diagnostic device and an on-board controller, and a diagnostic session connection is established between the diagnostic device and the on-board controller. The diagnostic session can be an extended diagnostic session 0x03.

[0023] In practical applications, the diagnostic device sends a diagnostic request to the vehicle controller through the diagnostic session. This diagnostic request requests the execution of a target diagnostic service. The vehicle controller receives the diagnostic request and, upon determining that the target diagnostic service requires authentication and that the security status of the diagnostic session is unlocked, generates seed data and sends it to the diagnostic device through the diagnostic session. The diagnostic device receives the seed data, encrypts it using SM4 according to a preset first key to obtain authentication credential information, generates a security authentication request carrying the authentication credential information, and then sends the security authentication request to the vehicle controller through the diagnostic session. The vehicle controller receives the security authentication request, and upon verifying the validity of the authentication credential information, sets the security status of the diagnostic session to unlocked and activates the diagnostic service set pre-bound to the security authentication request. This diagnostic service set includes the target diagnostic service. For example, the security authentication request can be authentication subservice 0x2702, and the set of diagnostic services pre-bound to the authentication subservice 0x2702 can include, but is not limited to, 0x2E service (i.e., write data service) and 0x22 service (i.e., read data service), and the target diagnostic service can be 0x2E service.

[0024] In some embodiments, when the vehicle controller performs the operation of determining that the target diagnostic service requires authentication, it is specifically configured to: invoke a predefined set of key diagnostic services, each of which is restricted to execution only after security authentication is completed. For example, the set of key diagnostic services may include, but is not limited to, services 0x2E (i.e., write data service), 0x31 (i.e., routine control service), 0x2F (i.e., data input / output control service), 0x10 (i.e., diagnostic session service), and 0x11 (i.e., ECU reset service). If the target diagnostic service belongs to the set of key diagnostic services, then the target diagnostic service is determined to require authentication. Furthermore, if the target diagnostic service does not belong to the set of key diagnostic services, then there is no need to trigger a security authentication mechanism; the diagnostic request can be responded to directly.

[0025] In some embodiments, when the vehicle controller performs the operation of generating seed data and sending it to the diagnostic device through the diagnostic session, it is specifically configured to: generate a random number using a preset random number generator and use it as seed data. The random number generator can be a true random number generator (TRNG) or a pseudo random number generator (CSPRNG) that conforms to security specifications to generate a random number with unpredictability, and the random number has 16 bytes; then generate a diagnostic response message (such as NRC 0x33-securityAccessDenied, etc.) carrying the seed data and send it to the diagnostic device through the diagnostic session.

[0026] In some embodiments, when the diagnostic device performs the operation of receiving the seed data and encrypting the seed data with SM4 according to the preset first key to obtain authentication credential information, it is specifically configured to: after receiving the diagnostic response message, parse the seed data from it, call the national cryptographic SM4 algorithm through the built-in security chip or software algorithm library, use the preset first key as the encryption key, encrypt the seed data with SM4-ECB, generate a ciphertext and use it as authentication credential information, and the number of bytes of the authentication credential information is also 16.

[0027] In some embodiments, when the vehicle controller performs the operation of verifying the validity of the authentication credential information, it is specifically configured to: encrypt the seed data using SM4 according to a preset second key to obtain local credential information, that is, call the national cryptographic SM4 algorithm through the built-in security chip or software algorithm library, use the preset second key as the encryption key, encrypt the seed data using SM4-ECB, generate a ciphertext and use it as the local credential information, and the number of bytes of the local credential information is also 16; if the authentication credential information is consistent with the local credential information, it can be determined by comparing the authentication credential information and the local credential information byte by byte, then the authentication credential information is verified to be valid, indicating that the preset first key in the diagnostic device is the same as the preset second key in the vehicle controller, at this time the diagnostic device is identified as a legitimate diagnostic device with access rights. Furthermore, if the authentication credential information is inconsistent with the local credential information, the authentication credential information is invalid. In this case, the security state of the diagnostic session will not be changed, nor will the set of diagnostic services pre-bound to the security authentication request be activated. Only the number of security authentication failures for the target diagnostic service will be recorded. Alternatively, a diagnostic response message carrying authentication failure information can be generated and sent to the diagnostic device through the diagnostic session, causing the diagnostic device to attempt to send other diagnostic requests or send the same diagnostic request to re-authenticate or stop sending any diagnostic requests.

[0028] It should be noted that the seed data can be encrypted using SM4-CMAC or SM4-CBC in the diagnostic equipment and vehicle controller, but it must be ensured that the diagnostic equipment and vehicle controller use the same encryption mode in the national cryptographic SM4 algorithm.

[0029] In some embodiments, the vehicle controller may also trigger a security lockout mechanism when multiple consecutive verifications of the authentication credentials carried in the received security authentication requests are invalid. This security lockout mechanism is used to restrict the vehicle controller to stop security authentication of the target diagnostic service for a preset time period to prevent brute-force attacks. Multiple security authentication requests can be understood as being generated when the diagnostic device repeatedly sends the same diagnostic request to re-authenticate, and the number of multiple security authentication requests is preferably set to 3. It is understood that the vehicle controller triggers this security lockout mechanism when the number of consecutive security authentication failures for the target diagnostic service reaches a threshold, which is preferably set to 3.

[0030] In some embodiments, after the vehicle controller determines that the target diagnostic service requires authentication, its internal security access management module intercepts the diagnostic request. Then, after activating the set of diagnostic services pre-bound to the security authentication request, the intercepted diagnostic request is allowed to continue to be executed. At this time, the diagnostic device can execute the target diagnostic service normally.

[0031] In this application, by encrypting the seed data using the highly complex and robust SM4 algorithm (a national cryptographic standard) during the security authentication process for the target diagnostic service, the anti-attack capability of vehicle diagnostic authentication can be improved, a high-strength authentication process can be achieved, and automotive-grade network security requirements can be met. By opening only a portion of the diagnostic services pre-bound to the authentication sub-services after the on-board controller passes security authentication, instead of opening all diagnostic services, the principle of least privilege can be effectively followed, which helps to reduce the risk of lateral movement due to internal misoperation and external attacks.

[0032] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a vehicle safety diagnostic method according to an embodiment of this application. It should be noted that the steps shown in the flowchart can be executed in a computer system, such as one containing a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that presented here.

[0033] This application provides a vehicle safety diagnostic method, which is applied to... Figure 1 The vehicle controller shown can be, but is not limited to, the four steps S101 to S104, as detailed below: S101. Receive a diagnostic request sent by the diagnostic device through a diagnostic session. The diagnostic request is used to request the execution of a target diagnostic service. S102. When it is determined that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state, seed data is generated and sent to the diagnostic device through the diagnostic session, so that the diagnostic device can encrypt the seed data using SM4 according to the preset first key to obtain authentication credential information, and then generate a security authentication request carrying the authentication credential information. S103. Receive the security authentication request sent by the diagnostic device through the diagnostic session; S104. When verifying the validity of the authentication credential information, set the diagnostic session to an unlocked state and activate the diagnostic service set pre-bound to the security authentication request, the diagnostic service set including the target diagnostic service.

[0034] The four steps S101 to S104 shown in this application embodiment enable more refined permission management by only opening a portion of the diagnostic services pre-bound to the security authentication request after the security authentication is passed.

[0035] In some embodiments, S102, regarding determining that the target diagnostic service requires authentication, the corresponding implementation may include, but is not limited to, invoking a predefined set of key diagnostic services, where each diagnostic service in the set is restricted to execution only after security authentication is completed; if the target diagnostic service belongs to the set of key diagnostic services, then it is determined that the target diagnostic service requires authentication. Furthermore, if the target diagnostic service does not belong to the set of key diagnostic services, then there is no need to trigger a security authentication mechanism; the diagnostic request can be responded to directly.

[0036] For example, the set of key diagnostic services may include, but is not limited to, the 0x2E service (i.e., write data service), the 0x31 service (i.e., routine control service), the 0x2F service (i.e., data input / output control service), the 0x10 service (i.e., diagnostic session service), and the 0x11 service (i.e., ECU reset service).

[0037] In some embodiments, S102, the content regarding generating seed data and sending it to the diagnostic device through the diagnostic session can be implemented in various ways, but is not limited to: generating a random number using a preset random number generator and using it as seed data. The random number generator can be a true random number generator (TRNG) or a pseudo random number generator (CSPRNG) that conforms to security specifications to generate a random number with unpredictability; then generating a diagnostic response message (such as NRC0x33-securityAccessDenied) carrying the seed data and sending it to the diagnostic device through the diagnostic session.

[0038] In some embodiments, S104, regarding the verification of the validity of the authentication credential information, the corresponding implementation may include, but is not limited to, encrypting the seed data using SM4 according to a preset second key to obtain local credential information. That is, by calling the national cryptographic SM4 algorithm through a built-in security chip or software algorithm library, using the preset second key as the encryption key, the seed data is encrypted using SM4-ECB to generate a ciphertext, which is then used as the local credential information. If it is clear that the authentication credential information is obtained by the diagnostic device calling the national cryptographic SM4 algorithm through a built-in security chip or software algorithm library, using the preset first key as the encryption key, and encrypting the seed data using SM4-ECB, if the authentication credential information is consistent with the local credential information, it can be determined by comparing the authentication credential information and the local credential information byte by byte. In this case, the authentication credential information is verified to be valid, indicating that the preset first key in the diagnostic device is the same as the preset second key in the vehicle controller. At this time, the diagnostic device is considered to be a legitimate diagnostic device with access rights. Furthermore, if the authentication credential information is inconsistent with the local credential information, the authentication credential information is invalid. In this case, the security state of the diagnostic session will not be changed, nor will the set of diagnostic services pre-bound to the security authentication request be activated. Only the number of security authentication failures for the target diagnostic service will be recorded. Alternatively, a diagnostic response message carrying authentication failure information can be generated and sent to the diagnostic device through the diagnostic session, causing the diagnostic device to attempt to send other diagnostic requests or send the same diagnostic request to re-authenticate, or stop sending any diagnostic requests. For example, the security authentication request can be authentication sub-service 0x2702, and the set of diagnostic services pre-bound to the authentication sub-service 0x2702 can include, but is not limited to, services 0x2E (i.e., write data service) and 0x22 (i.e., read data service). The target diagnostic service can be service 0x2E.

[0039] In some embodiments, the vehicle safety diagnostic method further includes: triggering a security lockout mechanism when multiple authentication credential information carried in multiple consecutive received security authentication requests are found to be invalid. This security lockout mechanism is used to restrict the vehicle controller to stop security authentication of the target diagnostic service within a preset time period to prevent brute-force attacks. The multiple security authentication requests can be understood as being generated when the diagnostic device repeatedly sends the same diagnostic request to re-authenticate, and the number of multiple security authentication requests is preferably set to 3. It is understood that the security lockout mechanism is triggered when the number of consecutive security authentication failures for the target diagnostic service reaches a threshold, which is preferably set to 3.

[0040] In some embodiments, after determining that the target diagnostic service requires authentication as mentioned in S102 above, the security access management module set inside the vehicle controller intercepts the diagnostic request. Then, after activating the set of diagnostic services pre-bound to the security authentication request as mentioned in S104 above, the intercepted diagnostic request is allowed to continue to be executed. At this time, the diagnostic device can execute the target diagnostic service normally.

[0041] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a vehicle safety diagnostic method according to another embodiment of this application. It should be noted that the steps shown in the flowchart can be executed in a computer system, such as one containing a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that described herein.

[0042] This application provides a vehicle safety diagnostic method, which is applied to... Figure 1 The diagnostic device shown can be used in a method that includes, but is not limited to, the three steps S201 to S203, as detailed below: S201. Send a diagnostic request to the vehicle controller through a diagnostic session. The diagnostic request is used to request the execution of a target diagnostic service so that the vehicle controller can generate seed data when it determines that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. S202. Receive the seed data sent by the vehicle controller through the diagnostic session, encrypt the seed data using SM4 according to the preset first key to obtain authentication credential information, and then generate a security authentication request carrying the authentication credential information. S203. Send the security authentication request to the vehicle controller through the diagnostic session, so that when the vehicle controller verifies the validity of the authentication credential information, it sets the diagnostic session to an unlocked state and activates the diagnostic service set pre-bound to the security authentication request, the diagnostic service set including the target diagnostic service.

[0043] The three steps S201 to S203 shown in this application embodiment improve the anti-attack capability of vehicle diagnostic authentication by encrypting the seed data using the highly complex and anti-cracking national cryptographic SM4 algorithm during the security authentication process of the target diagnostic service.

[0044] In some embodiments, S202, regarding receiving the seed data sent by the vehicle controller through the diagnostic session and encrypting the seed data using SM4 according to a preset first key to obtain authentication credential information, the corresponding implementation may include, but is not limited to, the following: when it is clear that the seed data is sent to the diagnostic device by the vehicle controller through the diagnostic session in the form of a diagnostic response message (such as NRC0x33-securityAccessDenied, etc.), firstly, the diagnostic response message is received and the seed data is parsed from it, and then the national cryptographic SM4 algorithm is called through the built-in security chip or software algorithm library, using the preset first key as the encryption key, to encrypt the seed data using SM4-ECB, generate a ciphertext, and use it as authentication credential information.

[0045] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the composition of a vehicle safety diagnostic device provided in one embodiment of this application. The device is applied to... Figure 1 The vehicle controller shown can achieve Figure 2 The vehicle safety diagnostic method shown may include, but is not limited to, the following devices: The first receiving module 301 is used to receive a diagnostic request sent by the diagnostic device through a diagnostic session, the diagnostic request being used to request the execution of a target diagnostic service; The first processing module 302 is used to generate seed data and send it to the diagnostic device through the diagnostic session when it is determined that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. The diagnostic device then performs SM4 encryption on the seed data according to the preset first key to obtain authentication credential information and generates a security authentication request carrying the authentication credential information. The second receiving module 303 is used to receive the security authentication request sent by the diagnostic device through the diagnostic session; The second processing module 304 is used to set the diagnostic session to an unlocked state when verifying the validity of the authentication credential information, and to activate the diagnostic service set pre-bound to the security authentication request, the diagnostic service set including the target diagnostic service.

[0046] Understandable, Figure 2 The specific implementation details in the method embodiments shown are all applicable to the embodiments of this device. The functions specifically implemented in the embodiments of this device are the same as those shown in the embodiments. Figure 2 The method embodiments shown implement the same functions, and the beneficial effects achieved by the device embodiments are the same. Figure 2 The beneficial effects achieved by the method embodiments shown are also the same.

[0047] Please refer to Figure 5 , Figure 5This is a schematic diagram of the composition of a vehicle safety diagnostic device according to another embodiment of this application. The device is applied to... Figure 1 The diagnostic equipment shown can achieve Figure 3 The vehicle safety diagnostic method shown may include, but is not limited to, the following devices: The first sending module 401 is used to send a diagnostic request to the vehicle controller through a diagnostic session. The diagnostic request is used to request the execution of a target diagnostic service so that the vehicle controller can generate seed data when it determines that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. The third processing module 402 is used to receive the seed data sent by the vehicle controller through the diagnostic session, encrypt the seed data using SM4 according to the preset first key to obtain authentication credential information, and then generate a security authentication request carrying the authentication credential information. The second sending module 403 is used to send the security authentication request to the vehicle controller through the diagnostic session, so that when the vehicle controller verifies the validity of the authentication credential information, it sets the diagnostic session to an unlocked state and activates the diagnostic service set pre-bound to the security authentication request, the diagnostic service set including the target diagnostic service.

[0048] Understandable, Figure 3 The specific implementation details in the method embodiments shown are all applicable to the embodiments of this device. The functions specifically implemented in the embodiments of this device are the same as those shown in the embodiments. Figure 3 The method embodiments shown implement the same functions, and the beneficial effects achieved by the device embodiments are the same. Figure 3 The beneficial effects achieved by the method embodiments shown are also the same.

[0049] This application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described vehicle safety diagnostic method.

[0050] It is understood that the content of the above method embodiments is applicable to this computer program product. The specific functions implemented by the embodiments of this computer program product are the same as those implemented by the above method embodiments, and the beneficial effects achieved by the embodiments of this computer program product are also the same as those achieved by the above method embodiments.

[0051] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0052] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0053] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0054] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the apparatus, can be implemented as software, firmware, hardware, and suitable combinations thereof.

[0055] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0056] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0057] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed between the devices or units may be through some interfaces, and the indirect coupling or communication connection may be electrical, mechanical, or other forms.

[0058] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0059] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0060] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0061] The preferred embodiments of this application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of this application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of this application shall be within the scope of the claims of this application.

Claims

1. A vehicle safety diagnostic method, characterized in that, Applied to an in-vehicle controller, the method includes: Receive diagnostic requests sent by diagnostic devices through a diagnostic session, the diagnostic requests being used to request the execution of a target diagnostic service; When it is determined that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state, seed data is generated and sent to the diagnostic device through the diagnostic session, so that the diagnostic device can encrypt the seed data with SM4 according to the preset first key to obtain authentication credential information, and then generate a security authentication request carrying the authentication credential information. Receive the security authentication request sent by the diagnostic device through the diagnostic session; When verifying the validity of the authentication credential information, the diagnostic session is set to an unlocked state, and the diagnostic service set pre-bound to the security authentication request is activated, the diagnostic service set including the target diagnostic service.

2. The vehicle safety diagnostic method according to claim 1, characterized in that, The process of generating seed data and sending it to the diagnostic device via the diagnostic session includes: A random number is generated using a preset random number generator and used as the seed data; A diagnostic response message carrying the seed data is generated and sent to the diagnostic device through the diagnostic session.

3. The vehicle safety diagnostic method according to claim 1, characterized in that, The determination that the target diagnostic service requires authentication includes: Invoke a predefined set of critical diagnostic services, each of which is restricted to execution only after security authentication is completed; When the target diagnostic service belongs to the set of key diagnostic services, it is determined that the target diagnostic service needs to be authenticated.

4. The vehicle safety diagnostic method according to claim 1, characterized in that, The verification of the validity of the authentication credential information includes: The seed data is encrypted using SM4 according to the preset second key to obtain local credential information; When the authentication credential information matches the local credential information, the authentication credential information is verified to be valid.

5. The vehicle safety diagnostic method according to claim 1, characterized in that, The method further includes: If multiple authentication credentials carried by multiple security authentication requests are found to be invalid after repeated verifications, a security lockout mechanism is triggered. The security lockout mechanism is used to restrict the vehicle controller to stop security authentication of the target diagnostic service within a preset time period.

6. A vehicle safety diagnostic method, characterized in that, Applied to diagnostic devices, the method includes: A diagnostic request is sent to the vehicle controller through a diagnostic session. The diagnostic request is used to request the execution of a target diagnostic service so that the vehicle controller generates seed data when it determines that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. The system receives the seed data sent by the vehicle controller through the diagnostic session, encrypts the seed data using SM4 according to a preset first key to obtain authentication credential information, and then generates a security authentication request carrying the authentication credential information. The diagnostic session sends the security authentication request to the vehicle controller, so that when the vehicle controller verifies the validity of the authentication credential information, it sets the diagnostic session to an unlocked state and activates the diagnostic service set pre-bound to the security authentication request, the diagnostic service set including the target diagnostic service.

7. A vehicle safety diagnostic system, characterized in that, The system includes a diagnostic device and an on-board controller, and a diagnostic session connection is established between the diagnostic device and the on-board controller. The diagnostic device is used to send a diagnostic request to the vehicle controller through the diagnostic session, and the diagnostic request is used to request the execution of a target diagnostic service. The vehicle controller is used to receive the diagnostic request, and when it is determined that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state, it generates seed data and sends it to the diagnostic device through the diagnostic session. The diagnostic device is also used to receive the seed data, encrypt the seed data using SM4 according to a preset first key to obtain authentication credential information, generate a security authentication request carrying the authentication credential information, and then send the security authentication request to the vehicle controller through the diagnostic session. The vehicle controller is also used to receive the security authentication request, and when verifying the validity of the authentication credential information, to set the diagnostic session to an unlocked state and activate the diagnostic service set pre-bound to the security authentication request, wherein the diagnostic service set includes the target diagnostic service.

8. A vehicle safety diagnostic device, characterized in that, Applied to an in-vehicle controller, the device includes: The first receiving module is used to receive a diagnostic request sent by the diagnostic device through a diagnostic session, wherein the diagnostic request is used to request the execution of a target diagnostic service; The first processing module is used to generate seed data and send it to the diagnostic device through the diagnostic session when it is determined that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. The diagnostic device then performs SM4 encryption on the seed data according to a preset first key to obtain authentication credential information and generates a security authentication request carrying the authentication credential information. The second receiving module is used to receive the security authentication request sent by the diagnostic device through the diagnostic session; The second processing module is used to set the diagnostic session to an unlocked state when verifying the validity of the authentication credential information, and to activate the diagnostic service set pre-bound to the security authentication request, wherein the diagnostic service set includes the target diagnostic service.

9. A vehicle safety diagnostic device, characterized in that, Applied to diagnostic equipment, the device includes: The first sending module is used to send a diagnostic request to the vehicle controller through a diagnostic session. The diagnostic request is used to request the execution of a target diagnostic service so that the vehicle controller generates seed data when it determines that the target diagnostic service requires authentication and the diagnostic session is in an unlocked state. The third processing module is used to receive the seed data sent by the vehicle controller through the diagnostic session, encrypt the seed data using SM4 according to the preset first key to obtain authentication credential information, and then generate a security authentication request carrying the authentication credential information. The second sending module is used to send the security authentication request to the vehicle controller through the diagnostic session, so that when the vehicle controller verifies the validity of the authentication credential information, it sets the diagnostic session to an unlocked state and activates the diagnostic service set pre-bound to the security authentication request, the diagnostic service set including the target diagnostic service.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the vehicle safety diagnostic method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Vehicle diagnosis method, server and computer readable storage medium

    CN111181928A

  • Vehicle safety diagnosis method and device, equipment and medium

    CN111813078A

  • Automobile diagnosis service control method and electronic control unit

    CN112327796A

  • Security authentication method and device, equipment and storage medium

    CN118296586A

  • Vehicle diagnosis method, device and equipment and storage medium

    CN118963326A