Method and device for vehicle unified diagnosis service, upper computer and server
By using APCE two-way identity authentication and digest information verification, the problem of insufficient security of UDS is solved, and secure authentication of UDS information exchange is achieved to prevent attacks and ensure the security of vehicle systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-05
- Publication Date
- 2026-03-10
AI Technical Summary
The existing Unified Diagnostic Service (UDS) lacks an effective security authentication mechanism during information exchange. Attackers can use forged information to launch attacks, causing vehicles to malfunction unexpectedly and resulting in incalculable losses.
The APCE two-way authentication service is used for authentication, a shared key value is generated, and a digest information is generated based on the freshness value and the message authentication code key. This digest information is then added to the message information and sent to enable the receiver to verify the identity.
By employing two-way authentication and digest information verification, the security of UDS is enhanced, preventing attacks based on forged information and ensuring the normal operation of the vehicle system.
Smart Images

Figure CN121644081A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of unified diagnostic service, in particular to a method and device for vehicle unified diagnostic service, an upper computer and a server. BACKGROUND
[0002] Unified diagnostic service (UDS) is a standardized protocol of vehicle based on an upper computer-server model, the upper computer is usually a diagnostic instrument or a test computer, and the server usually refers to an electronic control unit (ECU) in the vehicle.
[0003] The current UDS does not have an authentication information operation for overall information, if an attacker sends some UDS instructions to the vehicle CAN bus through part of the information such as fault codes and the like, the risk is relatively large, if the UDS interaction information has a digest scheme, the attacker can also replay the information with a correct digest value to the bus in advance to obtain the desired information or send other attack behaviors. For example, when the vehicle is offline at the end of life (EOL), the attacker sends some attack instructions according to the stolen diagnostic list and the like, so that the EOL routine is performed according to an unexpected process, and the loss is incalculable.
[0004] Therefore, a method capable of effectively improving the security of unified diagnostic service is urgently needed. SUMMARY
[0005] The present application provides a method and device for vehicle unified diagnostic service, an upper computer and a server to at least solve the technical problem of effectively improving the security of unified diagnostic service.
[0006] According to a first aspect of the embodiments of the present application, a method for vehicle unified diagnostic service is provided, the method comprising: authenticating using an APCE bidirectional identity authentication service; after successful authentication, performing secret key negotiation to generate a shared secret key value; generating a freshness value and a message authentication code secret key based on the shared secret key value; when a session is performed, generating digest information based on the freshness value and the message authentication code secret key, adding the digest information to the message information for sending, so that the receiver verifies the sender according to the digest information.
[0007] Optionally, when the session is performed, the digest information is generated based on the freshness value and the message authentication code secret key, and the digest information is added to the message information for sending, comprising: when it is determined that information needs to be sent, increasing the freshness value by a set value to update the freshness value; Based on the updated freshness value and the message authentication code key, a digest information is generated using the first MAC algorithm; The summary information is added to the message information before transmission; Upon receiving the message information, the local freshness value is obtained, the freshness is increased by a set value, and a comparison value is generated; Based on the comparison value and the message authentication code key, a first digest information is generated using a first MAC algorithm. Compare the summary information with the first summary information; When the comparison results are consistent, it is determined that the sender's verification is successful, and the local freshness value is increased by a set value to update the freshness value.
[0008] Optionally, the first MAC algorithm includes: HMAC or AES-CMAC.
[0009] Optionally, the summary information is generated using the following formula: MAC (High-order diagnostic identifier | Low-order diagnostic identifier | Message information | Freshness value).
[0010] Optionally, the APCE two-way authentication service is service 29.
[0011] Optionally, generating the freshness value and message authentication code key based on the shared key value includes: Based on the shared key value, a freshness value and a message authentication code key are derived through MGF1 or AES_MP.
[0012] Optionally, the method further includes: During a session, if no feedback is received from the other party within a set time after sending a message, the authentication success status is cancelled.
[0013] On the other hand, an apparatus for a unified diagnostic service for vehicles is also provided, the apparatus being used to perform the method provided in the embodiments of the present invention, the apparatus comprising: The authentication module is used for authentication using the APCE two-way authentication service; The first generation module is used to negotiate the key and generate a shared key value after successful authentication. The second generation module is used to generate a freshness value and a message authentication code key based on the shared key value; The verification module is used to generate digest information based on the freshness value and the message authentication code key during a session, and add the digest information to the message information for transmission, so that the receiver can verify the sender based on the digest information.
[0014] On the other hand, a host computer is also provided, the host computer comprising: First processor; A first memory stores a first computer-readable instruction, which, when executed by the first processor, implements the method provided in the embodiments of the present invention.
[0015] On the other hand, a server is also provided, the server comprising: Second processor; A second memory stores a second computer-readable instruction, which, when executed by a second processor, implements the method provided in the embodiments of the present invention.
[0016] In this embodiment, the host computer and the server use APCE two-way authentication service. After successful authentication, they negotiate a shared key and generate a freshness value and a message authentication code key based on the shared key. In subsequent sessions, the freshness value and the message authentication code key generate digest information, which is then added to the message information for transmission. Since the message information includes not only the original message information but also the digest information, the receiver can verify the sender based on the digest information, thereby effectively improving the security of the unified diagnostic service. Attached Figure Description
[0017] Figure 1 This is a schematic flowchart of a method for providing unified vehicle diagnostic services according to an embodiment of this application; Figure 2 This is a schematic diagram of the interaction flow of a method for unified vehicle diagnostic services provided in an embodiment of this application; Figure 3 This is a schematic diagram of a process for message information interaction based on freshness value and message authentication code key provided in an embodiment of this application; Figure 4 This is a schematic diagram of a device structure for a unified vehicle diagnostic service provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a host computer provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0018] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0019] It should be noted that the terms "first," "second," etc., in the specification, claims, 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 non-exclusive inclusion; for example, a process, method, system, product, or apparatus 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 apparatus.
[0020] According to an embodiment of this application, a method embodiment for a unified vehicle diagnostic service is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as 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 shown here.
[0021] This application provides a method, apparatus, host computer, and server for unified vehicle diagnostic services, to at least address the technical problem of effectively improving the security of unified diagnostic services.
[0022] According to the first aspect of the embodiments of this application, such as Figure 1 As shown, a method for a unified vehicle diagnostic service is provided, the method comprising: S101. Use APCE two-way authentication service for authentication; S102. After successful authentication, perform key negotiation and generate a shared key value; S103. Generate a freshness value and a message authentication code key based on the shared key value; S104. During a session, a digest is generated based on the freshness value and the message authentication code key. The digest is then added to the message information and sent so that the receiver can verify the sender based on the digest.
[0023] In this embodiment of the invention, the executor of the method can be a host computer or a server. Before establishing a session, the host computer and the server authenticate each other through the APCE two-way authentication service. After successful authentication, they negotiate a key to generate a shared key value. In some implementations, key negotiation can be performed using a key exchange protocol (Diffie-Hellman, DH) or an elliptic curve Diffie–Hellman key exchange (ECDH).
[0024] The interactive flow of a method for unified vehicle diagnostic services provided in this embodiment of the invention is as follows: Figure 2 As shown in the diagram. The client and server use the $29 service for mutual authentication. After successful authentication, they use DH / ECDH to negotiate a key, recording the negotiated shared key as Ks. Figure 2 Step 9 in the middle means calculating the data sharing key, see the DH / ECDH protocol for details. Figure 2 Step 10 means deriving the MAC (Message Authentication Code) key and a random 8-byte freshness value based on the shared key. The derivation method can be selected (such as MGF1, AES_MP, etc.). Figure 2 Steps 11-17 are used to verify the integrity and consistency of the negotiated key. Figure 2 Step 18 means that before each message is sent, the client increments its local freshness value by a set value, updates the freshness value, and then generates a digest based on the updated freshness value. In some implementations, the digest is calculated using MAC (high-order diagnostic identifier | low-order diagnostic identifier | original message information | freshness value), that is, MAC is calculated based on the high-order diagnostic identifier, low-order diagnostic identifier, original message information, and freshness value using a first MAC algorithm, which can be HMAC or AES-CMAC. The calculation is performed based on the message authentication code key.
[0025] Figure 2 Step 19 means that the sent message information is: Original message information | MAC (high-order diagnostic identifier | low-order diagnostic identifier | original message information | freshness value), where MAC (high-order diagnostic identifier | low-order diagnostic identifier | original message information | freshness value) is the digest information. Figure 2Step 20 means that after the server receives the message information, it obtains the local freshness value, increases the freshness value by a set value, generates a comparison value, and generates a first digest information using the first MAC algorithm based on the comparison value and the message authentication code key. The digest information in the received message information is then compared with the first digest information. When the comparison result is consistent, the sender's verification is confirmed, and the local freshness value is increased by the set value to update the freshness value. The server then sends a response message to the client. Before sending, the local freshness value also needs to be increased by the set value, a digest information is generated based on the updated freshness value, and then the digest information is added to the message information before sending.
[0026] In practical applications, certain services can be protected through the unified vehicle diagnostics service provided in this embodiment of the invention (such as $2E), while other services can be verified without protection through the unified vehicle diagnostics service provided in this embodiment of the invention (such as $3E). During UDS security authentication, the data format, length, timing logic, and other specifications fully comply with the UDS protocol standard, and not merely the frame format of the underlying CAN bus.
[0027] Optional, such as Figure 3 As shown, during a session, generating digest information based on the freshness value and the message authentication code key, and adding the digest information to the message information for transmission includes: S301. When it is determined that information needs to be sent, the freshness value is increased by a set value to update the freshness value.
[0028] S302. Generate digest information using the first MAC algorithm based on the updated freshness value and the message authentication code key.
[0029] S303. Add the summary information to the message information and send it.
[0030] S304. After receiving the message information, obtain the local freshness value, increase the freshness by a set value, and generate a comparison value.
[0031] S305. Generate a first digest information using a first MAC algorithm based on the comparison value and the message authentication code key.
[0032] S306. Compare the summary information with the first summary information.
[0033] S307. When the comparison results are consistent, it is determined that the sender's verification is successful, and the local freshness value is increased by a set value to update the freshness value.
[0034] Optionally, the first MAC algorithm includes: HMAC or AES-CMAC.
[0035] Optionally, the summary information is generated using the following formula: MAC (High-order diagnostic identifier | Low-order diagnostic identifier | Message information | Freshness value).
[0036] Optionally, the APCE two-way authentication service is service 29.
[0037] Optionally, generating the freshness value and message authentication code key based on the shared key value includes: Based on the shared key value, a freshness value and a message authentication code key are derived through MGF1 or AES_MP.
[0038] Optionally, the method further includes: During a session, if no feedback is received from the other party within a set time after sending a message, the authentication success status is cancelled.
[0039] In this embodiment, the host computer and the server use APCE two-way authentication service. After successful unlocking, they negotiate a shared key and generate a freshness value and a message authentication code key based on the shared key. In subsequent sessions, the freshness value and the message authentication code key generate digest information, which is then added to the message information for transmission. Since the message information includes not only the original message information but also the digest information, the receiver can verify the sender based on the digest information, thereby effectively improving the security of the unified diagnostic service.
[0040] On the other hand, such as Figure 4 As shown, an apparatus for a unified diagnostic service for vehicles is also provided, the apparatus being used to perform the method provided in the embodiments of the present invention, the apparatus comprising: Authentication module 401 is used for authentication using APCE two-way identity authentication service; The first generation module 402 is used to perform key negotiation and generate a shared key value after successful authentication; The second generation module 403 is used to generate a freshness value and a message authentication code key based on the shared key value; The verification module 404 generates digest information based on the freshness value and the message authentication code key during a session, and adds the digest information to the message information for transmission, so that the receiver can verify the sender based on the digest information.
[0041] On the other hand, such as Figure 5 As shown, this embodiment of the invention also provides a host computer, the host computer comprising: First processor 501; A first memory 502 stores a first computer-readable instruction. When the first computer-readable instruction is executed by the first processor 501, it implements the method provided in the embodiments of the present invention.
[0042] On the other hand, such as Figure 6 As shown, a server is also provided, the server comprising: Second processor 601; The second memory 602 stores a second computer-readable instruction. When the second computer-readable instruction is executed by the second processor 601, it implements the method provided in the embodiments of the present invention.
[0043] The first memory 502 and the first processor 501 can communicate via the first bus 503. The first memory 502 is used to store computer programs. The first processor 501 is used to execute computer programs. The second memory 602 and the second processor 601 can communicate via the second bus 603. The second memory 602 is used to store computer programs. The second processor 601 is used to execute computer programs.
[0044] Optionally, the first processor 501 and the second processor 601 described above can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps in the method embodiments disclosed in this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0045] The serial numbers in the embodiments of this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0046] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0047] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be 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 system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0048] The units described 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 units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0049] 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.
[0050] 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 several 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 program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0051] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for vehicle unified diagnostic services, characterized by, The method comprises: authentication using an APCE two-way identity authentication service; after successful authentication, key negotiation is performed to generate a shared key value; a freshness value and a message authentication code key are generated based on the shared key value; when a session is performed, digest information is generated based on the freshness value and the message authentication code key, and the digest information is added to message information for transmission, so that the receiving party performs sender verification according to the digest information.
2. The method of claim 1, wherein, The method comprises: when it is determined that information needs to be transmitted, the freshness value is increased by a set value to update the freshness value; digest information is generated based on the updated freshness value and the message authentication code key through a first MAC algorithm; the digest information is added to the message information for transmission; after receiving the message information, the local freshness value is obtained, the freshness value is increased by a set value, and a comparison value is generated; first digest information is generated according to the comparison value and the message authentication code key through the first MAC algorithm; the digest information is compared with the first digest information; when the comparison result is consistent, it is determined that the sender verification is passed, and the local freshness value is increased by a set value to update the freshness value.
3. The method of claim 2, wherein, The first MAC algorithm comprises: HMAC or AES-CMAC.
4. The method of claim 1, wherein, The APCE two-way identity authentication service is service 29.
5. The method of claim 1, wherein, The method comprises: based on the shared key value, the freshness value and the message authentication code key are derived through MGF1 or AES_MP.
6. The method of claim 1, wherein, The method further comprises: when a session is performed, if no feedback information from the other party is received within a set time period after the message information is transmitted, it is determined that the authentication success state is cancelled.
7. An apparatus for unified diagnostic services for a vehicle, characterized by, The device is used to perform the method according to any one of claims 1-6, and the device comprises: an authentication module configured to perform authentication using an APCE two-way identity authentication service; a first generation module configured to perform key negotiation to generate a shared key value after successful authentication; a second generation module configured to generate a freshness value and a message authentication code key based on the shared key value; a verification module configured to, when a session is performed, generate digest information based on the freshness value and the message authentication code key, add the digest information to message information for transmission, and enable the receiving party to perform sender verification according to the digest information.
8. A host computer, characterized by The upper computer comprises: a first processor; a first memory, wherein first computer readable instructions are stored on the first memory, and the first computer readable instructions are executed by the first processor to implement the method according to any one of claims 1-6.
9. A server, characterized by The server comprises: a second processor; a second memory, wherein second computer readable instructions are stored on the second memory, and the second computer readable instructions are executed by the second processor to implement the method according to any one of claims 1-6.
Citation Information
Patent Citations
Method for safe transmission of data based on creditable password module
CN101651538A
Communication method, device and system based on communication network
CN112636898A
Internet of vehicles v2v efficient communication method based on message pre-authentication technology
CN114430552A
Terminal anonymous access and switching authentication method and system in vehicle-mounted edge computing
CN115460589A
Vehicle-mounted Ethernet communication method, ECU, electronic equipment and storage medium
CN118300813A