A method for improving the security of diagnostic services
By using a mobile phone system containing the public diagnostic ID of the target ECU network segment and encrypted dynamic diagnostic ID in the automotive diagnostic service, the problem of low data security in the existing automotive diagnostic service is solved, and higher data security and vehicle communication security are achieved.
Patent Information
- Application Number
- CN202411697626.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-08
AI Technical Summary
The data security of existing automotive diagnostic services is low, which can easily lead to safety data leakage and may cause safety accidents while the vehicle is driving.
The diagnostic device sends requested data containing the common diagnostic ID of the network segment where the target ECU is located to the CAN bus for handshake, and generates an encrypted dynamic diagnostic ID to complete the secure handshake and communication between the ECU and the diagnostic device.
Improves the security of data in diagnostic services, prevents unauthorized data access, reduces the risk of security data leakage, and enhances the communication security of vehicles while driving.
Smart Images

Figure CN119788312A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of automobile diagnosis, in particular to a method for improving the safety of diagnosis services. Background Art
[0002] With the rapid development of intelligent connected vehicles, vehicle networking functions are becoming more and more common. Against this background, automobile information security is receiving more and more attention from industry insiders.
[0003] At present, the diagnostic service based on UDS (Unified Diagnostic Services) in the vehicle network architecture is becoming increasingly important as a key protocol for vehicle network communication.
[0004] The diagnostic service mainly involves the diagnostic instrument sending a diagnostic request to the target ECU, and obtaining the current and historical status by obtaining the diagnostic response data of the target ECU. The data format of the diagnostic request and response consists of the diagnostic request or response CAN ID, data length, and data part. The CAN ID of the diagnostic request and response remains unchanged throughout the life cycle of the ECU, and the diagnostic request and response format meets the standard ISO 14229 protocol. Therefore, the data security of the diagnostic service is not high. Knowing the diagnostic ID, it is easy to obtain relevant information about the vehicle, which can easily cause the leakage of security data. In addition, such services may also cause safety accidents when the vehicle communicates and controls while driving.
[0005] Therefore, it is necessary to design a method to improve the security of diagnostic services in order to improve the security of data of automobile diagnostic services. Summary of the invention
[0006] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method for improving the security of diagnostic services, so as to improve the security of data of automobile diagnostic services.
[0007] In order to achieve the above object, the present invention is a method for improving the security of diagnostic services, comprising the following steps: Step 1: The diagnostic instrument sends a handshake request to the CAN bus, and uses the request data containing the public diagnostic ID of the network segment where the target ECU is located to request a handshake with the target ECU. The request data is 0xAB 0xCD Data2 Data3 Data4Data5 Data6 Data7, AB is the network segment ID where the target ECU is located, CD is the number of the target ECU, Data2 is a system random number, and in Data3-Data7, 2 bytes of data are valid data, and the rest of the data are random filling data.
[0008] Step 2: After the target ECU obtains the request data, it parses the received request data and determines whether the handshake request matches itself. If not, it ends. If it matches, the target ECU verifies based on the received data and the system random number sent by the diagnostic instrument. If the verification fails, it ends. If the verification succeeds, proceed to step 3.
[0009] Step 3: The target ECU generates confirmation handshake information data and dynamic diagnostic ID encrypted data, and sends the dynamic diagnostic ID to the diagnostic instrument, which subsequently uses the dynamic diagnostic ID for diagnostic services.
[0010] Step 4: If the target ECU does not receive any diagnostic service within the specified time after sending the dynamic diagnostic ID or the interval between two diagnostic services is greater than the specified time, the target ECU will automatically disconnect the current connection. If the subsequent diagnostic instrument needs to communicate with the target ECU again, it needs to re-establish the connection.
[0011] In step 1, the location of valid data in Data3-Data7 is specifically confirmed as follows: Step 1a, add the 8-byte diagnostic number of the target ECU, the high byte of the added value is A1B1, and the low byte of the added value is A2B2; Step 2a, set the system random number XY; Step 3a, calculate A1B1 * =A1B1+X,A2B2 * =A2B2+Y; Step 3b, according to A1B1 * The value determines the specific location where the valid data A1B1 is stored: if A1B1 * The low bit of the value is 0-2, so A1B1 is placed at the position of Data3. * The low digit of the value is 3-5, so A1B1 is placed at the position of Data4. * The low digit of the value is 6-8, so A1B1 is placed at the position of Data5. * The low digits of the value are 9-11, so A1B1 is placed at the position of Data6. * The low digit of the value is 12-15, so A1B1 is placed at Data7; Step 4a, according to A2B2 * The value determines the specific location where the valid data A2B2 is stored: if A2B2 * The low bit of the value is 0-2, so A2B2 is placed at the position of Data3. * The low digit of the value is 3-5, so A2B2 is placed at the position of Data4. * The low digit of the value is 6-8, so A2B2 is placed at the position of Data5. *The low digits of the value are 9-11, so A2B2 is placed at the position of Data6. * The low order of the value is 12-15, so A2B2 is placed at the position of Data7; Step 5a, determine whether A1B1 and A2B2 are placed at the same position, if not, then end; if so, A1B1 is placed at the current position, and A2B2 is placed at the byte adjacent to A1B1.
[0012] In step 2, the target ECU determines whether the handshake request matches itself as follows: determine in sequence whether the network segment ID, ECU number and handshake data match the target ECU.
[0013] The handshake data is Data2-Data7 in the request data.
[0014] In the step 3, the steps for generating encrypted data of the dynamic diagnostic ID are as follows: Step 1b, perform an XOR operation on the three padding bit data except the valid data in Data3-Data7 to obtain MN, take the high byte M of MN, if M is 0-5, remove the first data; if M is 6-10, remove the second data; if M is 11-15, remove the third value; Step 2b, add the value and the value in the diagnostic number of the ECU corresponding to the low bit of the value to obtain the final value of the dynamic diagnostic ID, if the low bit is 0-1, take Data0 in the ECU diagnostic number; if the low bit is 2-3, take Data1 in the ECU diagnostic number, and so on.
[0015] In the step 4, the prescribed time is 5s to 10s.
[0016] Compared with the prior art, the present invention uses request data containing the public diagnostic ID of the network segment where the target ECU is located and an encrypted dynamic diagnostic ID to complete the handshake, response and communication between the ECU and the diagnostic instrument, thereby improving the security of data in the diagnostic service. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a schematic diagram of the vehicle network.
[0018] Figure 2 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0019] The present invention will now be further described with reference to the accompanying drawings.
[0020] See also Figure 1 There will be multiple network segments in the vehicle network depending on the ECU functions and communication rates. If ECUs in different network segments need to interact with each other, the gateway will mainly forward the data.
[0021] See also Figure 2 The present invention is a method for improving the security of diagnostic services, comprising the following steps: Step 1: The diagnostic instrument sends a handshake request to the CAN bus, and uses the request data containing the public diagnostic ID of the network segment where the target ECU is located to request a handshake with the target ECU.
[0022] The request data is 0xAB 0xCD Data2 Data3 Data4 Data5 Data6 Data7, AB is the network segment ID of the target ECU, CD is the number of the target ECU, Data2 is the system random number, and in Data3-Data7, 2 bytes of data are valid data, and the rest of the data are random filling data.
[0023] In Data3-Data7, the location of valid data is confirmed according to the following steps: Step 1a, add the 8-byte diagnostic number of the target ECU, the high byte of the added value is A1B1, and the low byte of the added value is A2B2; Step 2a, set the system random number XY; Step 3a, calculate A1B1 * =A1B1+X,A2B2 * =A2B2+Y; Step 3b, according to A1B1 * The value determines the specific location where the valid data A1B1 is stored: if A1B1 * The low bit of the value is 0-2, so A1B1 is placed at the position of Data3. * The low digit of the value is 3-5, so A1B1 is placed at the position of Data4. * The low digit of the value is 6-8, so A1B1 is placed at the position of Data5. * The low digits of the value are 9-11, so A1B1 is placed at the position of Data6. * The low digit of the value is 12-15, so A1B1 is placed at Data7; Step 4a, according to A2B2 * The value determines the specific location where the valid data A2B2 is stored: if A2B2 * The low bit of the value is 0-2, so A2B2 is placed at the position of Data3. * The low digit of the value is 3-5, so A2B2 is placed at the position of Data4. * The low digit of the value is 6-8, so A2B2 is placed at the position of Data5. * The low digits of the value are 9-11, so A2B2 is placed at the position of Data6. *The low order of the value is 12-15, so A2B2 is placed at the position of Data7; Step 5a, determine whether A1B1 and A2B2 are placed at the same position, if not, then end; if so, A1B1 is placed at the current position, and A2B2 is placed at the byte adjacent to A1B1.
[0024] If the target ECU diagnostic number is 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF, the calculated added value is 0x7F8, the high byte of the added value is 0x07, that is, A1B1 is 0x07, the low byte of the added value is 0xF8, that is, A2B2 is 0xF8, set the system random number to 0x78, that is, X is 0x07, Y is 0x08, calculate A1B1 * =A1B1+X=0x07+0x07=0x0E, A2B2 * =A2B2+Y=0xF8+0x08=0x00. A1B1 * The low bit of the value is 14, so A1B1 is placed at Data7, A2B2 * If the low bit of the value is 0, A2B2 is placed at the position of Data3.
[0025] Step 2: After the target ECU obtains the request data, it parses the received request data and determines whether the handshake request matches itself, and then determines whether the network segment ID, ECU number and handshake data match the target ECU, where the handshake data is Data2-Data7 in the request data. If it does not match, it ends. If it matches, the target ECU verifies the received data and the system random number sent by the diagnostic instrument. If the verification fails, it ends. If the verification succeeds, it continues to step 3.
[0026] Step 3: The target ECU generates confirmation handshake information data and dynamic diagnostic ID encrypted data, and sends the dynamic diagnostic ID to the diagnostic instrument, which subsequently uses the dynamic diagnostic ID for diagnostic services.
[0027] The steps for generating encrypted data of dynamic diagnostic ID are as follows: Step 1b, perform XOR operation on the three padding bits in Data3-Data7 except the valid data to obtain MN, take the high byte M of MN, if M is 0-5, remove the first data; if M is 6-10, remove the second data; if M is 11-15, remove the third value; Step 2b, add the value and the value in the diagnostic number of the ECU corresponding to the low bit of the value to obtain the final value of the dynamic diagnostic ID. If the low bit is 0-1, take Data0 in the ECU diagnostic number; if the low bit is 2-3, take Data1 in the ECU diagnostic number, and so on.
[0028] Step 4: If the target ECU does not receive any diagnostic service within the specified time after sending the dynamic diagnostic ID or the interval between two diagnostic services is greater than the specified time, the target ECU will automatically disconnect the current connection. If the subsequent diagnostic instrument needs to communicate with the target ECU again, it needs to re-establish the connection. The specified time is 5s~10s.
[0029] When multiple frames of communication are required for diagnosis, the dynamic ID of the next continuous frame will be added after each continuous frame.
[0030] The present invention uses request data containing a public diagnostic ID of a network segment where a target ECU is located and an encrypted dynamic diagnostic ID to complete handshake, response, and communication between the ECU and the diagnostic instrument, thereby improving the security of data in the diagnostic service.
Claims
1. A method for improving the security of diagnostic services, characterized in that: The steps include: Step 1: The diagnostic instrument sends a handshake request to the CAN bus, and uses the request data containing the public diagnostic ID of the network segment where the target ECU is located to request a handshake with the target ECU. The request data is 0xAB 0xCD Data2 Data3 Data4 Data5Data6 Data7, where AB is the network segment ID of the target ECU, CD is the number of the target ECU, Data2 is a system random number, and in Data3-Data7, 2 bytes of data are valid data, and the rest of the data are random filling data; Step 2: After the target ECU obtains the request data, it parses the received request data and determines whether the handshake request matches itself. If not, the process ends. If it matches, the target ECU verifies the received data and the system random number sent by the diagnostic instrument. If the verification fails, the process ends. If the verification succeeds, the process continues to step 3. Step 3: The target ECU generates confirmation handshake information data and dynamic diagnostic ID encrypted data, and sends the dynamic diagnostic ID to the diagnostic instrument, which subsequently uses the dynamic diagnostic ID for diagnostic services; Step 4: If the target ECU does not receive any diagnostic service within the specified time after sending the dynamic diagnostic ID or the interval between two diagnostic services is greater than the specified time, the target ECU will automatically disconnect the current connection. If the subsequent diagnostic instrument needs to communicate with the target ECU again, it needs to re-establish the connection.
2. A method for improving the security of diagnostic services according to claim 1, characterized in that: In step 1, the location of valid data in Data3-Data7 is specifically confirmed as follows: Step 1a, add the 8-byte diagnostic number of the target ECU, the high byte of the added value is A1B1, and the low byte of the added value is A2B2; Step 2a, set the system random number XY; Step 3a, calculate A1B1 * =A1B1+X,A2B2 * =A2B2+Y; Step 3b, according to A1B1 * The value determines the specific location where the valid data A1B1 is stored: if A1B1 * The low bit of the value is 0-2, so A1B1 is placed at the position of Data3. * The low digit of the value is 3-5, so A1B1 is placed at the position of Data4. * The low digit of the value is 6-8, so A1B1 is placed at the position of Data5. * The low digits of the value are 9-11, so A1B1 is placed at the position of Data6. * The low digit of the value is 12-15, so A1B1 is placed at Data7; Step 4a, according to A2B2 * The value determines the specific location where the valid data A2B2 is stored: if A2B2 * The low bit of the value is 0-2, so A2B2 is placed at the position of Data3. * The low digit of the value is 3-5, so A2B2 is placed at the position of Data4. * The low digit of the value is 6-8, so A2B2 is placed at the position of Data5. * The low digits of the value are 9-11, so A2B2 is placed at the position of Data6. * The low order of the value is 12-15, so A2B2 is placed at the position of Data7; Step 5a, determine whether A1B1 and A2B2 are placed at the same position, if not, then end; if so, A1B1 is placed at the current position, and A2B2 is placed at the byte adjacent to A1B1.
3. A method for improving the security of diagnostic services according to claim 1, characterized in that: In step 2, the target ECU determines whether the handshake request matches itself as follows: determine in sequence whether the network segment ID, ECU number and handshake data match the target ECU.
4. A method for improving the security of diagnostic services according to claim 3, characterized in that: The handshake data is Data2-Data7 in the request data.
5. A method for improving the security of diagnostic services according to claim 1, characterized in that: In the step 3, the steps for generating encrypted data of the dynamic diagnostic ID are as follows: Step 1b, perform an XOR operation on the three padding bit data except the valid data in Data3-Data7 to obtain MN, take the high byte M of MN, if M is 0-5, remove the first data; if M is 6-10, remove the second data; if M is 11-15, remove the third value; Step 2b, add the value and the value in the diagnostic number of the ECU corresponding to the low bit of the value to obtain the final value of the dynamic diagnostic ID, if the low bit is 0-1, take Data0 in the ECU diagnostic number; if the low bit is 2-3, take Data1 in the ECU diagnostic number, and so on.
6. A method for improving the security of diagnostic services according to claim 1, characterized in that: In the step 4, the prescribed time is 5s to 10s.