Lightweight key and fresh value collaborative verification method and system for resource-constrained ECU (Electronic Control Unit)

By using a derivation mechanism of pre-shared Root Key and temporary Session Key, combined with a collaborative verification method of high-bit and low-bit freshness values, the problem of insufficient key security and rigid freshness verification in resource-constrained ECUs is solved. This achieves efficient key management and anti-replay attack capabilities, and is suitable for lightweight key and freshness value collaborative verification in automotive electronic systems.

CN121966973APending Publication Date: 2026-05-01WUHAN JIANGXIA CHUNENG AUTOMOBILE TECHNOLOGY R&D CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN JIANGXIA CHUNENG AUTOMOBILE TECHNOLOGY R&D CO LTD
Filing Date
2026-01-13
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In existing technologies, resource-constrained ECUs in automotive electronic systems suffer from insufficient key security, rigid freshness verification, and limited replay resistance, failing to meet the security requirements of the AUTOSAR SecOC standard.

Method used

A pre-shared Root Key and temporary Session Key derivation mechanism is adopted, combined with a collaborative verification method of High Freshness Value (HighFV) and Low Freshness Value (LocalFV). The message authentication code is calculated through HKDF and CMAC algorithms, and the key and freshness value are dynamically updated to ensure security and communication robustness.

Benefits of technology

It significantly improves the dynamic security and anti-attack capability of the key system, optimizes the freshness verification mechanism, balances security and communication robustness, adapts to the real-time requirements of vehicle networks, and reduces computing and storage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121966973A_ABST
    Figure CN121966973A_ABST
Patent Text Reader

Abstract

The invention discloses a lightweight key and freshness value collaborative verification method and system for a resource-constrained ECU, and the method is applied to a first electronic control unit, and comprises the steps: obtaining an initial high-order freshness value, and a preset same Root Key value between the first electronic control unit and a second electronic control unit; obtaining a first message authentication code according to the Root Key value and the initial high-order freshness value; combining ECU original data, a low-order freshness value and the first message authentication code to obtain an ECU message and sending the ECU message to a second electronic control unit; obtaining a result that a second electronic control unit judges whether the ECU message passes verification or not; and periodically acquiring a new initial high-order freshness value, and acquiring a verification result of the correspondingly generated new ECU message according to the new initial high-order freshness value. Based on the data processing flow, the problems of insufficient key security, rigidness in freshness verification, limited anti-replay capability and the like are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Lightweight Key and Freshness Co-verification Method and System for Resource-Constrained ECUs Technical Field

[0001] This invention relates to the field of ECU message technology, and in particular to a lightweight key and freshness value collaborative verification method and system for resource-constrained ECUs. Background Technology

[0002] To prevent CAN messages from being tampered with or replayed, the AUTOSAR SecOC standard introduces message authentication codes and freshness value (FV) mechanisms. However, practical deployment faces the following challenges: 1. In automotive electronics and other scenarios, low-end electronic control units (ECUs) typically lack hardware security modules. Due to their limited RAM and flash memory capacity, it is difficult to run resource-intensive security mechanisms (such as complex "freshness value" synchronization to prevent replay attacks) or store large amounts of encryption keys.

[0003] 2. Inefficient key management: Most keys use static keys, which cannot be rotated or dynamically derived by session, posing a risk of long-term exposure.

[0004] 3. R155 / GB 44495 compliance: The regulations require "effective prevention of replay attacks" but do not specify the specific implementation method. Existing lightweight solutions often fail the certification test due to the FV rollback vulnerability. Summary of the Invention

[0005] This invention provides a lightweight key and freshness value collaborative verification method and system for resource-constrained ECUs, addressing issues such as insufficient key security, rigid freshness verification, and limited replay resistance in existing technologies. In a first aspect, a lightweight key and freshness value collaborative verification method for resource-constrained ECUs is provided, comprising: obtaining an initial high-order freshness value and a preset identical Root Key value between a first electronic control unit and a second electronic control unit; obtaining a first message authentication code based on the Root Key value and the initial high-order freshness value; combining the original ECU data, the low-order freshness value, and the first message authentication code to obtain an ECU message and sending it to the second electronic control unit; obtaining the result of the second electronic control unit determining whether the ECU message has passed verification; periodically obtaining a new initial high-order freshness value, and obtaining the verification result of the corresponding newly generated ECU message based on the new initial high-order freshness value.

[0006] In some embodiments, obtaining the first message authentication code based on the Root Key value and the initial high-order freshness value includes: performing key derivation calculation on the Root Key value and the initial high-order freshness value using the HKDF algorithm to generate a first SessionKey value; combining the low-order freshness value and the initial high-order freshness value to obtain a first freshness combination value; and using the CMAC algorithm to obtain the first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data.

[0007] In some embodiments, obtaining the result of the second electronic control unit's determination of whether the ECU message has been verified includes: the second electronic control unit obtains a second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value, and determines whether the ECU message has been verified based on the first message authentication code and the second message authentication code; and obtains the result of the second electronic control unit's determination of whether the ECU message has been verified.

[0008] In some embodiments, obtaining the second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value includes: acquiring the Root Key value, the initial high-order freshness value, and the ECU message; extracting the original ECU data, the first message authentication code, and the low-order freshness value from the ECU message, and checking whether the low-order freshness value is within a preset range; combining the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; performing key derivation calculation on the Root Key value and the initial high-order freshness value using the HKDF algorithm to generate a second SessionKey value; and obtaining the second message authentication code based on the second SessionKey value, the second freshness combination value, and the original ECU data using the CMAC algorithm.

[0009] In some embodiments, determining whether the ECU message has been verified based on the first message authentication code and the second message authentication code includes: if the first message authentication code and the second message authentication code match and the low-order freshness value is within a preset range, then the ECU message is determined to have been verified; if the first message authentication code and the second message authentication code do not match, or the low-order freshness value is not within a preset range, then the ECU message is determined to have failed to be verified.

[0010] In some embodiments, a lightweight key and freshness value collaborative verification method for resource-constrained ECUs is applied to a second electronic control unit, comprising: obtaining an initial high-order freshness value and a preset identical Root Key value between a first electronic control unit and a second electronic control unit; obtaining a first message authentication code and an ECU message obtained by the first electronic control unit based on the Root Key value and the initial high-order freshness value; obtaining a second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value; determining whether the ECU message has been verified based on the first message authentication code and the second message authentication code; periodically obtaining a new initial high-order freshness value, and determining whether the corresponding newly generated ECU message has been verified based on the new initial high-order freshness value.

[0011] In some embodiments, obtaining the first message authentication code and ECU message obtained by the first electronic control unit based on the Root Key value and the initial high-order freshness value includes: the first electronic control unit using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a first SessionKey value; combining the low-order freshness value and the initial high-order freshness value to obtain a first freshness combination value; using the CMAC algorithm to obtain a first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data; and combining the original ECU data, the low-order freshness value, and the first message authentication code to obtain the ECU message.

[0012] In some embodiments, obtaining the second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value includes: extracting the original ECU data, the first message authentication code, and the low-order freshness value from the ECU message, and checking whether the low-order freshness value is within a preset range; combining the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; performing key derivation calculation on the Root Key value and the initial high-order freshness value using the HKDF algorithm to generate a second SessionKey value; and obtaining the second message authentication code based on the second SessionKey value, the second freshness combination value, and the original ECU data using the CMAC algorithm.

[0013] In some embodiments, determining whether the ECU message has been verified based on the first message authentication code and the second message authentication code includes: if the first message authentication code and the second message authentication code match and the low-order freshness value is within a preset range, then the ECU message is determined to have been verified; if the first message authentication code and the second message authentication code do not match, or the low-order freshness value is not within a preset range, then the ECU message is determined to have failed to be verified.

[0014] Secondly, a lightweight key and freshness value collaborative verification system for resource-constrained ECUs is provided, including a master control domain controller, a first electronic control unit, and a second electronic control unit connected in communication. The master control domain controller is used to pre-set the same Root Key value between the first and second electronic control units; set an initial high-order freshness value, and send the Root Key value and the initial high-order freshness value to the first and second electronic control units. The first electronic control unit is used to: acquire the Root Key value and the initial high-order freshness value; perform key derivation calculation on the Root Key value and the initial high-order freshness value using the HKDF algorithm to generate a first SessionKey value; combine the low-order freshness value and the initial high-order freshness value to obtain a first freshness combination value; use the CMAC algorithm to obtain a first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data; combine the original ECU data, the low-order freshness value, and the first message authentication code to obtain an ECU message and send it to the second electronic control unit. The second electronic control unit is used to: acquire the Root Key value... The following steps are taken: 1. Extract the ECU original data, the first message authentication code, and the low-order freshness value from the ECU message; 2. Check if the low-order freshness value is within a preset range; 3. Combine the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; 4. Use the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a second SessionKey value; 5. Use the CMAC algorithm to obtain a second message authentication code based on the second SessionKey value, the second freshness combination value, and the ECU original data; 6. Compare the first message authentication code and the second message authentication code; 7. If the first message authentication code and the second message authentication code match, and the low-order freshness value is within a preset range, then the ECU message verification is considered successful; 8. If the first message authentication code and the second message authentication code do not match, or the low-order freshness value is not within a preset range, then the ECU message verification is considered unsuccessful.

[0015] Compared with existing technologies, the advantages of this invention are as follows: 1. By adopting a "pre-shared Root Key + temporary SessionKey derivation" mechanism, using the Root Key, a fixed identifier string, and the current initial high-order freshness value (HighFV) as input, a SessionKey valid only within a specific HighFV window is dynamically derived. This avoids the risk of leakage caused by long-term use of the same key. The temporary key becomes invalid with HighFV updates, and even if a session key is cracked, historical or future sessions cannot be traced, significantly improving the dynamic security and anti-attack capability of the key system.

[0016] 2. A freshness value combining a high-order HighFV and a low-order LocalFV is designed. The HighFV is broadcast and updated by the master domain controller, providing a large time window to prevent replay. The LocalFV is the sender's local sequence number, allowing for a small range of out-of-order delivery. Therefore, this invention ensures message replay through HighFV while tolerating out-of-order delivery due to network latency through the LocalFV window, avoiding the loss of legitimate messages due to strict order verification, optimizing the freshness verification mechanism, and balancing security and communication robustness.

[0017] 3. Periodically broadcast updates to HighFV, triggering synchronous updates between the two ECUs, deriving a new SessionKey, clearing the LocalFV window, and completely switching to the new session. Therefore, the old session's key and FV space immediately become invalid. Even if an attacker intercepts historical packets, they cannot obtain the new session key or match the new FV, thus preventing the forgery or replay of old packets and eliminating the risk of historical attacks.

[0018] 4. By employing the CMAC algorithm to calculate the MAC, that is, using the SessionKey as the key to jointly encrypt and hash the Payload and the complete FV, and only carrying the LocalFV and MAC in the message, transmission overhead is reduced. Therefore, this invention achieves message integrity and source authentication with low computational and storage costs in automotive resource-constrained scenarios, adapting to the real-time requirements of in-vehicle networks. Attached Figure Description

[0019] Figure 1 is a flowchart illustrating an embodiment of a lightweight key and freshness value collaborative verification method for resource-constrained ECUs according to the present invention; Figure 2 is a flowchart illustrating another embodiment of a lightweight key and freshness value collaborative verification method for resource-constrained ECUs according to the present invention; Figure 3 is a structural schematic diagram of a lightweight key and freshness value collaborative verification system for resource-constrained ECUs according to the present invention. Detailed Implementation

[0020] Referring now to specific embodiments of the invention, examples of which are illustrated in the accompanying drawings. Although the invention will be described in conjunction with specific embodiments, it will be understood that it is not intended to limit the invention to the described embodiments. Rather, it is intended to cover variations, modifications, and equivalents included within the spirit and scope of the invention as defined by the appended claims. It should be noted that the method steps described herein can be implemented by any functional block or functional arrangement, and any functional block or functional arrangement can be implemented as a physical entity or a logical entity, or a combination of both.

[0021] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0022] Note: The examples described below are merely specific examples and are not intended to limit the embodiments of the present invention to the specific steps, values, conditions, data, order, etc. Those skilled in the art can utilize the concept of the present invention to construct more embodiments not mentioned herein by reading this specification.

[0023] Please refer to Figure 1. This invention provides a lightweight key and freshness value collaborative verification method for resource-constrained ECUs, applied to a first electronic control unit. The method includes: step S100, obtaining an initial high-order freshness value and a preset identical Root Key value between the first and second electronic control units. Specifically, in this embodiment, the first electronic control unit can be configured as a battery management system (BMS) and is the sender; the second electronic control unit can be configured as a vehicle control unit (VCU) responsible for coordinating vehicle operation and is the receiver.

[0024] The BMS and VCU are injected with the same root key at the factory. The root key is a pre-shared, long-term secret key that is securely injected into the BMS and VCU during production. It is the basis for all session keys.

[0025] Setting the initial High-Freshness Value (HighFV): When the master domain controller powers on for the first time, it sets HighFV to an initial value, such as 0x1234, and broadcasts it via the CAN bus (ID 0x7E0). Upon receiving this, both the BMS and VCU will store this initial High-Freshness Value as the current HighFV.

[0026] Step S200, obtaining the first message authentication code based on the Root Key value and the initial high-order freshness value, includes: Step S210, using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate the first SessionKey value; the HKDF (HMAC-based Extract-and-Expand Key Derivation Function) algorithm is an HMAC-based "extract-expand" key derivation algorithm. It transforms potentially noisy and uneven input key material into a high-quality, divisible derived key.

[0027] Assuming the ECU here is set as a Battery Management System (BMS), the BMS uses the HKDF algorithm. It takes the Root Key, a string identifying this communication channel (“SecOC_BMS_VCU”), and the current HighFV (0x1234) as input to generate a new, temporary SessionKey. This key is only valid within the current HighFV window. The specific derivation calculation is as follows: First SessionKey value = HKDF(RootKey, “SecOC_BMS_VCU”, 0x1234).

[0028] Step S220: Combine the low-order freshness value with the initial high-order freshness value to obtain the first freshness combination value; the low-order freshness value FV corresponds to the local FV, and the ECU maintains a local, small serial number LocalFV. This time, 0x05 is used (assuming 0x04 was used last time). This LocalFV cycles within a very small range (e.g., 0x00 to 0x0F).

[0029] Combine HighFV (0x1234) and LocalFV (0x05) to form the complete first freshness combination value FV = 0x12340005.

[0030] Step S230: Using the CMAC algorithm, obtain the first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data.

[0031] Specifically, the BMS uses the newly derived first SessionKey value to perform CMAC operation on the ECU raw data payload to be sent and the first freshness combination value FV (0x12340005) to generate a MAC value, which corresponds to the first message authentication code.

[0032] CMAC (Cipher-based Message Authentication Code) is a MAC algorithm constructed using block ciphers. It is used to verify message integrity and origin, supports messages of arbitrary length, and can truncate the output length.

[0033] Therefore, the calculation method for the first message authentication code is as follows: First Message Authentication Code MAC = CMAC(SessionKey, Payload || FV).

[0034] Step S300: Combine the ECU raw data, low-order freshness value and the first message authentication code to obtain the ECU message and send it to the second electronic control unit; specifically, the BMS reconstructs the final ECU message as: ECU raw data Payload + LocalFV (0x05) + first message authentication code MAC, and finally sends the ECU message to the second electronic control unit.

[0035] Step S400, obtaining the result of the second electronic control unit's determination of whether the ECU message has been verified, includes: Step S410, the second electronic control unit obtains a second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value, including: obtaining the Root Key value, the initial high-order freshness value, and the ECU message; extracting the ECU original data, the first message authentication code, and the low-order freshness value from the ECU message, and checking whether the low-order freshness value is within a preset range; combining the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a second SessionKey value; using the CMAC algorithm to obtain the second message authentication code based on the second SessionKey value, the second freshness combination value, and the ECU original data.

[0036] Specifically, when the vehicle control unit (VCU) receives a message from the ECU, it extracts the low-order freshness value LocalFV=0x05 from the ECU message and combines it with HighFV=0x1234. It then checks whether the received LocalFV=0x05 is within an allowed preset range window (e.g., [0x00, 0x0F]). This check allows for a small number of out-of-order messages (e.g., receiving 0x06 first, then 0x05). If it exceeds the window (e.g., receiving 0x10), it is considered expired or invalid.

[0037] The VCU then combines its stored current HighFV=0x1234 with the received LocalFV=0x05 to obtain the complete second freshness combination value=0x12340005.

[0038] The VCU uses the same parameters (its own Root Key, "SecOC_BMS_VCU", and the initial high-order freshness value HighFV 0x1234) to derive a second SessionKey value via HKDF. Then, using this second SessionKey value, a CMAC operation is performed on the received ECU raw data payload and the reconstructed second freshness combination value = 0x12340005 to calculate a desired MAC value, corresponding to the second message authentication code. Subsequently, the second message authentication code is compared with the first message authentication code.

[0039] Step S420, determining whether the ECU message has been verified based on the first message authentication code and the second message authentication code, includes: if the first message authentication code and the second message authentication code match, and the low-order freshness value is within a preset range, then the ECU message is verified; if the first message authentication code and the second message authentication code do not match, or the low-order freshness value is not within a preset range, then the ECU message is verified.

[0040] Specifically, if the first message authentication code matches the second message authentication code, and the low-order freshness value is within a preset range, then the ECU message verification is successful. In other words, the VCU considers the ECU message to be fresh and untampered, and processes the original ECU data within it.

[0041] If the first message authentication code and the second message authentication code do not match, or if the low-order freshness value is not within the preset range, the ECU message verification fails. In other words, the VCU discards the message and records a security event.

[0042] Simultaneously, in step S430, the first electronic control unit obtains the verification result of the ECU message as determined by the second electronic control unit.

[0043] Step S500: Periodically obtain new initial high-order freshness values, and obtain the verification results of the corresponding newly generated ECU messages based on the new initial high-order freshness values.

[0044] Specifically, in this embodiment of the invention, approximately every preset interval of 10 minutes (which can be defined as 10 minutes), the master domain controller increments its HighFV counter by 1 (for example, from 0x1234 to 0x1235) and broadcasts this new initial HighFV value via CAN.

[0045] After receiving a new HighFV broadcast, both BMS and VCU will update their stored HighFV value (to 0x1235).

[0046] Both BMS and VCU use the new HighFV (0x1235) and the same Root Key, the string "SecOC_BMS_VCU", to derive a completely new SessionKey via HKDF. This will also clear or reset the localFV window.

[0047] Subsequently, new ECU messages sent by the BMS will use the new HighFV (0x1235), the new LocalFV, and the newly derived SessionKey to calculate the MAC. The VCU will also use the new SessionKey to verify subsequent ECU messages. At the same time, the old SessionKey and LocalFV window immediately become invalid, achieving complete session isolation and the non-reusability of historical messages.

[0048] Referring to Figure 2, this invention provides a lightweight key and freshness value collaborative verification method for resource-constrained ECUs, applied to a second electronic control unit. The method includes: S10, obtaining an initial high-order freshness value and a pre-set identical Root Key value between the first and second electronic control units; S20, obtaining a first message authentication code and an ECU message obtained by the first electronic control unit based on the Root Key value and the initial high-order freshness value, including: the first electronic control unit using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a first SessionKey value; combining the low-order freshness value and the initial high-order freshness value to obtain a first freshness combination value; using the CMAC algorithm to obtain a first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data; and combining the original ECU data, the low-order freshness value, and the first message authentication code to obtain an ECU message.

[0049] S30, obtaining a second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value includes: extracting the original ECU data, the first message authentication code, and the low-order freshness value from the ECU message, and checking whether the low-order freshness value is within a preset range; combining the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a second SessionKey value; and using the CMAC algorithm to obtain the second message authentication code based on the second SessionKey value, the second freshness combination value, and the original ECU data.

[0050] S40, determining whether the ECU message has passed verification based on the first message authentication code and the second message authentication code. This includes: if the first message authentication code and the second message authentication code match, and the low-order freshness value is within a preset range, then the ECU message verification is deemed successful; if the first message authentication code and the second message authentication code do not match, or the low-order freshness value is not within a preset range, then the ECU message verification is deemed unsuccessful.

[0051] S50 periodically acquires new initial high-order freshness values ​​and determines whether the corresponding newly generated ECU message has passed verification based on the new initial high-order freshness values.

[0052] Specifically, in this embodiment of the invention, the specific process of the method of the invention applied to the second electronic control unit is the same as that applied to the first electronic control unit, and will not be repeated here.

[0053] Referring also to Figure 3, this embodiment of the invention also provides a lightweight key and freshness value collaborative verification system for resource-constrained ECUs, including a master control domain controller, a first electronic control unit, and a second electronic control unit connected in communication; the master control domain controller is used to preset the same Root Key value between the first and second electronic control units; set an initial high-order freshness value, and send the Root Key value and the initial high-order freshness value to the first and second electronic control units; the first electronic control unit is used to obtain the Root Key value and the initial high-order freshness value; perform key derivation calculation on the Root Key value and the initial high-order freshness value using the HKDF algorithm to generate a first SessionKey value; combine the low-order freshness value and the initial high-order freshness value to obtain a first freshness combination value; use the CMAC algorithm to obtain a first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data; combine the original ECU data, the low-order freshness value, and the first message authentication code to obtain an ECU message and send it to the second electronic control unit; the second electronic control unit is used to obtain the Root Key value and the initial high-order freshness value; The following steps are taken: 1. Extract the ECU original data, the first message authentication code, and the low-order freshness value from the ECU message; 2. Check if the low-order freshness value is within a preset range; 3. Combine the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; 4. Use the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a second SessionKey value; 5. Use the CMAC algorithm to obtain a second message authentication code based on the second SessionKey value, the second freshness combination value, and the ECU original data; 6. Compare the first message authentication code and the second message authentication code; 7. If the first message authentication code and the second message authentication code match, and the low-order freshness value is within a preset range, then the ECU message verification is considered successful; 8. If the first message authentication code and the second message authentication code do not match, or the low-order freshness value is not within a preset range, then the ECU message verification is considered unsuccessful.

[0054] In summary, the main innovations of this invention are as follows: 1. By adopting a "pre-shared Root Key + temporary SessionKey derivation" mechanism, using the Root Key, a fixed identifier string ("SecOC_BMS_VCU"), and the current initial high-order freshness value (HighFV) as input, a SessionKey valid only within a specific HighFV window is dynamically derived. This avoids the risk of leakage caused by long-term use of the same key. The temporary key becomes invalid with HighFV updates, and even if a session key is cracked, historical or future sessions cannot be traced, significantly improving the dynamic security and anti-attack capabilities of the key system.

[0055] 2. A freshness value combining a "HighFV" and a "LocalFV" is designed. The HighFV is broadcast and updated by the master domain controller, providing a large time window to prevent replay. The LocalFV is the sender's local sequence number, allowing for a small range of out-of-order delivery. Therefore, this invention ensures message replay through HighFV while tolerating out-of-order delivery due to network latency through the LocalFV window, avoiding the loss of legitimate messages due to strict order checking, thus balancing security and communication robustness.

[0056] 3. Periodically broadcast updates to HighFV, triggering BMS / VCU to synchronously update HighFV, derive a new SessionKey, clear the LocalFV window, and completely switch to the new session. Therefore, the old session's key and FV space immediately become invalid. Even if an attacker intercepts historical packets, they cannot obtain the new session key or match the new FV, thus preventing them from forging or replaying old packets and eliminating the risk of historical attacks.

[0057] 4. By employing the CMAC algorithm to calculate the MAC, that is, using the SessionKey as the key to jointly encrypt and hash the Payload and the complete FV, and only carrying the LocalFV and MAC in the message, transmission overhead is reduced. Therefore, this invention achieves message integrity and source authentication with low computational / storage costs in automotive resource-constrained scenarios, adapting to the real-time requirements of in-vehicle networks.

[0058] Specifically, this embodiment corresponds one-to-one with the above method embodiments. The functions of each module have been described in detail in the corresponding method embodiments, so they will not be repeated here.

[0059] Based on the same inventive concept, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements all or part of the method steps of the above method.

[0060] The present invention can implement all or part of the processes in the above methods, or it can be accomplished by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0061] Based on the same inventive concept, embodiments of this application also provide an electronic device, including a memory and a processor. The memory stores a computer program that runs on the processor. When the processor executes the computer program, it implements all or part of the method steps described above.

[0062] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the computer device, connecting all parts of the computer device through various interfaces and lines.

[0063] Memory can be used to store computer programs and / or modules. The processor performs various functions of the computer device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can primarily include a program storage area and a data storage area. The program storage area can store the operating system and at least one application program required for a function (e.g., sound playback, image playback, etc.); the data storage area can store data created based on the use of the mobile phone (e.g., audio data, video data, etc.). Furthermore, memory can include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, SmartMedia Cards (SMC), Secure Digital (SD) cards, Flash Cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.

[0064] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, servers, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.

[0065] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), servers, and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.

[0066] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.

[0067] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.

[0068] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A lightweight key and freshness value collaborative verification method for resource-constrained ECUs, applied to a first electronic control unit, characterized in that, include: Obtain the initial high freshness value and the same root key value preset between the first electronic control unit and the second electronic control unit; Based on the Root Key value and the initial high-order freshness value, a first message authentication code is obtained; the original ECU data, the low-order freshness value, and the first message authentication code are combined to obtain an ECU message and send it to the second electronic control unit; the result of the second electronic control unit determining whether the ECU message has been verified is obtained; a new initial high-order freshness value is periodically obtained, and the verification result of the corresponding newly generated ECU message is obtained based on the new initial high-order freshness value.

2. The lightweight key and freshness value collaborative verification method for resource-constrained ECUs as described in claim 1, characterized in that, The step of obtaining the first message authentication code based on the Root Key value and the initial high-order freshness value includes: using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a first SessionKey value; combining the low-order freshness value and the initial high-order freshness value to obtain a first freshness combination value; and using the CMAC algorithm to obtain the first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data.

3. The lightweight key and freshness value collaborative verification method for resource-constrained ECUs as described in claim 1, characterized in that, The step of obtaining the result of the second electronic control unit's determination of whether the ECU message has been verified includes: the second electronic control unit obtains a second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value, and determines whether the ECU message has been verified based on the first message authentication code and the second message authentication code; and obtains the result of the second electronic control unit's determination of whether the ECU message has been verified.

4. The lightweight key and freshness value collaborative verification method for resource-constrained ECUs as described in claim 3, characterized in that, The step of obtaining the second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value includes: acquiring the Root Key value, the initial high-order freshness value, and the ECU message; extracting the original ECU data, the first message authentication code, and the low-order freshness value from the ECU message, and checking whether the low-order freshness value is within a preset range; combining the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a second SessionKey value; and using the CMAC algorithm to obtain the second message authentication code based on the second SessionKey value, the second freshness combination value, and the original ECU data.

5. The lightweight key and freshness value collaborative verification method for resource-constrained ECUs as described in claim 3, characterized in that, The step of determining whether the ECU message has been verified based on the first message authentication code and the second message authentication code includes: if the first message authentication code and the second message authentication code match and the low-order freshness value is within a preset range, then the ECU message is determined to have been verified; if the first message authentication code and the second message authentication code do not match, or the low-order freshness value is not within the preset range, then the ECU message is determined to have failed to be verified.

6. A lightweight key and freshness value collaborative verification method for resource-constrained ECUs, applied to a second electronic control unit, characterized in that, include: Obtain the initial high freshness value and the same root key value preset between the first electronic control unit and the second electronic control unit; Obtain the first message authentication code and ECU message obtained by the first electronic control unit based on the Root Key value and the initial high-order freshness value; The second message authentication code is obtained based on the ECU message, the Root Key value, and the initial high-order freshness value; The system determines whether the ECU message has been verified based on the first message authentication code and the second message authentication code; it periodically acquires a new initial high-order freshness value and determines whether the corresponding newly generated ECU message has been verified based on the new initial high-order freshness value.

7. The lightweight key and freshness value collaborative verification method for resource-constrained ECUs as described in claim 6, characterized in that, The step of obtaining the first message authentication code and ECU message obtained by the first electronic control unit based on the Root Key value and the initial high-order freshness value includes: the first electronic control unit using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a first SessionKey value; combining the low-order freshness value and the initial high-order freshness value to obtain a first freshness combination value; using the CMAC algorithm to obtain a first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data; and combining the original ECU data, the low-order freshness value, and the first message authentication code to obtain the ECU message.

8. The lightweight key and freshness value collaborative verification method for resource-constrained ECUs as described in claim 6, characterized in that, The step of obtaining the second message authentication code based on the ECU message, the Root Key value, and the initial high-order freshness value includes: extracting the original ECU data, the first message authentication code, and the low-order freshness value from the ECU message, and checking whether the low-order freshness value is within a preset range; combining the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; using the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a second SessionKey value; and using the CMAC algorithm to obtain the second message authentication code based on the second SessionKey value, the second freshness combination value, and the original ECU data.

9. The lightweight key and freshness value collaborative verification method for resource-constrained ECUs as described in claim 8, characterized in that, The step of determining whether the ECU message has been verified based on the first message authentication code and the second message authentication code includes: if the first message authentication code and the second message authentication code match and the low-order freshness value is within a preset range, then the ECU message is determined to have been verified; if the first message authentication code and the second message authentication code do not match, or the low-order freshness value is not within the preset range, then the ECU message is determined to have failed to be verified.

10. A lightweight key and freshness value collaborative verification system for resource-constrained ECUs, characterized in that, The system includes a master control domain controller, a first electronic control unit (ECU), and a second ECU connected via communication. The master control domain controller is configured to: preset the same Root Key value between the first ECU and the second ECU; set an initial high-order freshness value and send the Root Key value and the initial high-order freshness value to the first ECU and the second ECU; the first ECU is configured to: acquire the Root Key value and the initial high-order freshness value; perform key derivation calculation on the Root Key value and the initial high-order freshness value using the HKDF algorithm to generate a first SessionKey value; combine the low-order freshness value and the initial high-order freshness value to obtain a first freshness combination value; use the CMAC algorithm to obtain a first message authentication code based on the first SessionKey value, the first freshness combination value, and the original ECU data; combine the original ECU data, the low-order freshness value, and the first message authentication code to obtain an ECU message and send it to the second ECU; the second ECU is configured to: acquire the Root Key value... The following steps are taken:

1. Extract the ECU original data, the first message authentication code, and the low-order freshness value from the ECU message; 2. Check if the low-order freshness value is within a preset range; 3. Combine the initial high-order freshness value and the low-order freshness value to obtain a second freshness combination value; 4. Use the HKDF algorithm to perform key derivation calculation on the Root Key value and the initial high-order freshness value to generate a second SessionKey value; 5. Use the CMAC algorithm to obtain a second message authentication code based on the second SessionKey value, the second freshness combination value, and the ECU original data; 6. Compare the first message authentication code with the second message authentication code; 7. If the first message authentication code and the second message authentication code match, and the low-order freshness value is within a preset range, then the ECU message verification is considered successful. If the first message authentication code and the second message authentication code do not match, or if the low-order freshness value is not within the preset range, then the ECU message verification is determined to have failed.