Electronic control system safety layer test method, device, equipment and readable storage medium

By using the HIL simulator to interact with the hardware interface of the electronic control unit and verify security keys, a closed-loop interaction is formed, which solves the problem of insufficient coverage of extreme environments and multiple fault scenarios in existing electronic control system testing methods. This enables highly realistic and anti-interference testing of electronic control systems, ensuring the safety and functional reliability of new energy vehicles.

CN122261112APending Publication Date: 2026-06-23ZHONGAN ZHIYAN (WUHAN) TRANSPORTATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610404334.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-30
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing testing methods for electronic control systems cannot effectively reproduce extreme environments and concurrent fault scenarios. Bench tests are costly and software simulations lack realism, failing to fully verify the impact of hardware latency and electromagnetic interference on control commands.

Method used

Data interaction is achieved through the hardware interface between the HIL simulator and the electronic control unit, performing integrity verification and signal threshold judgment. Control commands are encrypted and digitally signed using a preset security key, and the HIL simulator decrypts and timestamps the commands, forming a hardware-in-the-loop closed-loop interaction to simulate the testing of the electronic control system in a real hardware environment.

Benefits of technology

It enables comprehensive testing of the electronic control system under the influence of real hardware delays, electromagnetic interference, and dynamic interaction factors, improving the realism and anti-interference capabilities of the test, and ensuring the safety and functional reliability of new energy vehicles under extreme conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122261112A_ABST
    Figure CN122261112A_ABST
Patent Text Reader

Abstract

A method, apparatus, device, and readable storage medium for testing the security layer of an electronic control system are disclosed, relating to the field of electronic control technology for new energy vehicles. Specifically, the method includes an electronic control unit (ECU) receiving a test data packet from a HIL simulator via a hardware interface. This data packet includes scenario-based extreme operating condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals. The ECU performs integrity verification and signal threshold judgment on the test data packet to obtain a first result, and generates control commands based on the first result. The ECU encrypts and digitally signs the control commands based on a preset security key to obtain a target control command, which is then sent to the HIL simulator via a communication bus. The HIL simulator decrypts the target control command, timestamps it, and verifies the digital signature to obtain a second result, and executes the target control command based on the second result, thereby achieving security layer testing of the electronic control system. This application can improve the realism and anti-interference capability of security layer testing of electronic control systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electric control technology for new energy vehicles, specifically to a method, apparatus, equipment, and readable storage medium for testing the security layer of an electric control system. Background Technology

[0002] With the continuous development of new energy vehicle technology, the electronic control system has become a core component for ensuring vehicle power output, energy management, and safety protection, and its importance is becoming increasingly prominent. Currently, the electronic control system mainly includes key units such as the Vehicle Control Unit (VCU), Battery Management System (BMS), and Motor Control Unit (MCU), which are directly related to vehicle driving safety, such as preventing battery thermal runaway, motor overcurrent burnout, and unexpected power interruption.

[0003] In related technologies, the testing methods for the electronic control system of new energy vehicles mainly rely on bench tests and software simulation. However, the existing testing methods have obvious shortcomings: (1) Reliance on bench tests, limited scenario coverage: Traditional tests mostly simulate some working conditions through physical benches (such as charging and discharging tests at room temperature), but it is difficult to reproduce high-risk scenarios such as extreme environments (such as low temperature start-up at -40℃, high temperature fast charging) and multiple concurrent faults (such as sensor failure + motor overcurrent). Moreover, bench tests are costly and have long cycles, and cannot cover the working conditions of the entire life cycle.

[0004] (2) Insufficient realism of software simulation: Some tests rely on software simulation environments such as MATLAB / Simulink. Although they can simulate control logic, they lack real-time interaction with hardware (such as power devices, sensors, and communication buses), and cannot verify the impact of hardware delay and electromagnetic interference on control commands, resulting in deviations between simulation results and actual operation.

[0005] Therefore, how to provide a highly realistic and interference-resistant testing method for the safety layer of electronic control systems is an urgent problem to be solved. Summary of the Invention

[0006] This application provides a method, apparatus, equipment, and readable storage medium for testing the security layer of an electronic control system, which can improve the realism and anti-interference capability of testing the security layer of an electronic control system.

[0007] In a first aspect, embodiments of this application provide a method for testing the security layer of an electronic control system, the method comprising: The electronic control unit receives the test data packet sent by the HIL simulator through the hardware interface, performs integrity verification and signal threshold judgment on the test data packet, obtains the first result, and generates control instructions based on the first result. The test data packet includes scenario-based extreme working condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals. The encrypted abnormal signals include sensor data jump amplitude, actuator delay duration, and bus packet loss rate. The electronic control unit encrypts and digitally signs the control commands based on a preset security key to obtain the target control commands, and sends them to the HIL simulator via the communication bus. The HIL simulator decrypts, timestamps, and digitally signs the target control instructions to obtain a second result, and executes the target control instructions based on the second result to achieve the security layer test of the electronic control system.

[0008] In conjunction with the first aspect, in one implementation, the step of performing integrity verification and signal threshold determination on the test data packet includes: Under any extreme working condition in any scenario, a local verification code is obtained by calculating the encrypted interference signal, sensor signal and abnormal signal through a preset verification algorithm; The local verification code is compared with the preset verification code to obtain the comparison result; If the comparison results are consistent, the integrity verification is deemed to have passed, and the signal threshold judgment is performed on the scenario-based extreme working condition parameters. If the comparison results are inconsistent, the integrity verification is deemed to have failed.

[0009] In conjunction with the first aspect, in one implementation, the step of determining the signal threshold for scenario-specific extreme operating condition parameters includes: Target parameters are extracted from scenario-based extreme operating condition parameters, including individual battery cell voltage, battery pack temperature, charging current, and rotational speed. For each target parameter, the target parameter is verified based on a preset safety threshold.

[0010] In conjunction with the first aspect, in one embodiment, prior to the step of the electronic control unit receiving the test data packet sent by the HIL simulator via the hardware interface, the method further includes: A secure communication link is established between the HIL simulator and the electronic control unit based on a preset encryption algorithm, and a temporary session key is generated.

[0011] In conjunction with the first aspect, in one implementation, the HIL simulator decrypts, timestamps, and digitally signs the target control commands, including: The control command is decrypted based on the temporary session key to obtain the decrypted control command. The digital signature in the decryption control command is verified using a preset verification public key. The timestamp in the decryption control command is verified based on the current time of the HIL simulator.

[0012] In conjunction with the first aspect, in one implementation, verifying the timestamp in the decryption control command based on the current time of the HIL simulator includes: The time deviation is determined based on the current time and timestamp; If the time deviation is not greater than the preset deviation threshold, the timestamp verification is deemed successful. If the time deviation is greater than the preset deviation threshold, the timestamp verification is deemed unsuccessful.

[0013] Secondly, embodiments of this application provide a security layer testing device for an electronic control system, the security layer testing device for an electronic control system comprising: The first processing module is used for the electronic control unit to receive test data packets sent by the HIL simulator through the hardware interface, and to perform integrity verification and signal threshold judgment on the test data packets to obtain a first result. Based on the first result, control instructions are generated. The test data packets include scenario-based extreme working condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals. The encrypted abnormal signals include sensor data jump amplitude, actuator delay duration, and bus packet loss rate. The second processing module is used by the electronic control unit to encrypt and digitally sign the control command based on a preset security key, obtain the target control command, and send it to the HIL simulator through the communication bus. The third processing module is used by the HIL simulator to decrypt, timestamp, and digitally sign the target control instructions to obtain a second result, and execute the target control instructions based on the second result to achieve the security layer test of the electronic control system.

[0014] In conjunction with the second aspect, in one implementation, the first processing module is specifically used for: Under any extreme working condition in any scenario, a local verification code is obtained by calculating the encrypted interference signal, sensor signal and abnormal signal through a preset verification algorithm; The local verification code is compared with the preset verification code to obtain the comparison result; If the comparison results are consistent, the integrity verification is deemed to have passed, and the signal threshold judgment is performed on the scenario-based extreme working condition parameters. If the comparison results are inconsistent, the integrity verification is deemed to have failed.

[0015] Thirdly, embodiments of this application provide an electronic control system security layer testing device, which includes a processor, a memory, and an electronic control system security layer testing program stored in the memory and executable by the processor. When the electronic control system security layer testing program is executed by the processor, it implements the steps of the electronic control system security layer testing method as described in any of the preceding claims.

[0016] Fourthly, embodiments of this application provide a computer-readable storage medium storing an electronic control system security layer test program, wherein when the electronic control system security layer test program is executed by a processor, it implements the steps of the electronic control system security layer test method as described in any of the preceding claims.

[0017] The beneficial effects of the technical solutions provided in this application include: The electronic control unit (ECU) receives a test data packet from the HIL simulator via a hardware interface. This packet includes scenario-specific extreme operating condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals (sensor data jump amplitude, actuator delay duration, and bus packet loss rate). The ECU performs integrity verification and signal threshold judgment on the test data packet to obtain a first result, and generates control commands based on this first result. The ECU encrypts and digitally signs the control commands using a preset security key to obtain the target control command, and sends it to the HIL simulator via the communication bus. This establishes a real-time physical connection between the ECU and the HIL simulator directly based on the real hardware interface and communication bus. The HIL simulator decrypts the target control command... The application employs timestamp and digital signature verification, and executes target control commands based on the verification results, forming a dynamic hardware-in-the-loop interactive closed loop. In this application, the sensor signals generated by the HIL simulator simulate the output of real hardware sensors. The execution of the command by the HIL simulator simulates the response of the power devices, fully reproducing the hardware signal chain of sensor acquisition → controller (electronic control system) decision → power device execution in a real vehicle. This realizes real-time, closed-loop interaction between the electronic control unit and the sensors and power devices, and verifies the collaborative working capability of the entire control link on the real hardware platform. Thus, it efficiently and realistically completes comprehensive testing of the electronic control system's security layer under the influence of multiple factors such as real hardware delay, electromagnetic interference, and dynamic interaction in a laboratory environment. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating an embodiment of the electronic control system security layer testing method of this application; Figure 2 This is a schematic diagram of the interaction between the host computer, the electronic control system, and the HIL simulator in an embodiment of the electronic control system security layer testing method of this application. Figure 3This is a functional module diagram of an embodiment of the electrical control system safety layer testing device of this application; Figure 4 This is a schematic diagram of the hardware structure of the electrical control system safety layer testing equipment involved in the embodiments of this application. Detailed Implementation

[0019] 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 are within the scope of protection of the present application.

[0020] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0021] In a first aspect, embodiments of this application provide a method for testing the security layer of an electronic control system.

[0022] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the electronic control system security layer testing method of this application. Figure 1 As shown, the safety layer test method for electronic control systems includes: Step S10: The electronic control unit receives the test data packet sent by the HIL simulator through the hardware interface, performs integrity verification and signal threshold judgment on the test data packet, obtains a first result, and generates control instructions based on the first result. The test data packet includes scenario-based extreme working condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals. The encrypted abnormal signals include sensor data jump amplitude, actuator delay duration, and bus packet loss rate.

[0023] In an exemplary embodiment of this application, the test data package includes scenario-based extreme operating condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals. The scenario-based extreme operating condition parameters simulate the vehicle's operating parameters under extreme conditions, specifically including battery temperature -40°C to 85°C, charging current 0A to 500A, motor speed 0rpm to 20000rpm, and torque 0N·m to 1000N·m, used to reproduce boundary conditions in real roads to verify the functional integrity and safety of the electronic control system under extreme conditions. The encrypted interference signals include frequencies of 80MHz to 1000MHz and field strengths of 30V / m to 100V / m as specified in the ISO 11452 radiated interference standard, and bus voltage fluctuations of ±5% to ±15% as specified in the ISO 7637-2 conducted interference standard, used to test the communication reliability and anti-interference capability of the electronic control system in complex electromagnetic environments.

[0024] It should be noted that the hardware to be interacted with refers to the hardware components (such as power devices, sensors, and communication buses) that need to interact with the new energy vehicle electronic control system under test through physical signal exchange; the encrypted sensor signals refer to the physical quantity data collected in real time by various sensors of the vehicle, which are used to verify the accuracy of the electronic control unit's interpretation of input signals and the timeliness of its response; the encrypted abnormal signals include sensor data fluctuation amplitude of 5% to 20%, actuator delay duration of 10ms to 100ms, and bus packet loss rate of 0 to 10%, which are used to simulate abnormal operating conditions such as sensor failure, actuator response lag, and communication interruption, respectively, in order to comprehensively evaluate the execution capability, fault diagnosis accuracy, and fault tolerance control level of the electronic control system under multiple fault superposition conditions, thereby ensuring the operational safety and functional reliability of new energy vehicles in various potential risk scenarios.

[0025] Specifically, the hardware interface includes a CAN FD controller and an onboard Ethernet PHY chip. The electronic control unit (ECU) receives test data packets sent by the HIL (Hardware-in-the-Loop) simulator in real time through a hardware interface conforming to the ISO 11898-1 standard. It performs integrity checks on these test data packets by calculating a local checksum and comparing it with a pre-stored checksum in the test data packet to verify that the data remains intact during transmission, ensuring it has not been interfered with or tampered with. Simultaneously, it performs signal threshold judgments on various signals included in the test data packet, comparing signal parameters with preset safety thresholds to assess whether they are within the permissible operating range. The results of these two verification stages—integrity checks and signal threshold judgments—are interrelated and synergistic, serving as the basis for judgment. After comprehensive processing, a first result is generated.

[0026] Step S20: The electronic control unit encrypts and digitally signs the control command based on the preset security key to obtain the target control command, and sends it to the HIL simulator through the communication bus.

[0027] In this embodiment, as an example, the preset security key refers to an asymmetric encryption key pair or symmetric session key stored in the secure storage area of ​​the electronic control unit (ECU), used to establish a two-way authentication basis between the ECU and the HIL simulator and ensure the confidentiality of command transmission; the control command refers to the original operation command generated by the ECU based on the first result, including key parameters such as motor torque adjustment and battery charging and discharging control; the encryption process uses an algorithm conforming to the Chinese national cryptographic standard SM4 or the international standard AES-256 to obfuscate the control command, preventing the command from being stolen or tampered with during transmission; the digital signature refers to adding a timestamp and digital signature to the command using algorithms such as Elliptic Curve Digital Signature (ECDsa) to achieve verification of the authenticity and integrity of the source of the control command.

[0028] It should be noted that the target control command is the final command after encryption and digital signature, forming an "encrypted command-timestamp-signature" structure. This structure is used to ensure the command's resistance to replay attacks (referring to the communication system's ability to effectively identify and reject duplicate or expired messages through specific security mechanisms) and execution reliability during communication bus transmission. The communication bus refers to a high-speed vehicle bus system that meets the ISO 11898-1 standard, supports CAN FD or vehicle Ethernet protocols, and provides microsecond-level transmission latency to ensure real-time control requirements. The target control command is used to control external devices, which refer to controlled actuators such as motor controllers, battery contactors, or DC-DC converters. By driving these devices to perform adjustment actions through the target control command, the effectiveness of the electronic control system's security strategy is verified, while ensuring the safe disconnection of the high-voltage circuit and precise control of power output in new energy vehicles under extreme operating conditions. Ultimately, this achieves comprehensive testing and verification of the electronic control system's security layer in terms of command transmission confidentiality, authentication reliability, and execution security.

[0029] Step S30: The HIL simulator decrypts, timestamps, and digitally signs the target control command to obtain a second result, and executes the target control command based on the second result to achieve the security layer test of the electronic control system.

[0030] In an exemplary embodiment of this application, after the HIL simulator receives the target control command sent by the electronic control unit, it decrypts the command using the AES-256 algorithm based on the asymmetric encryption key pair or symmetric session key pre-negotiated with the electronic control unit, restoring the original control command content and extracting the timestamp and digital signature information. Subsequently, timestamp verification is performed by comparing the difference between the timestamp carried by the command and the local clock of the HIL simulator to confirm that it is within a preset valid time window, thereby eliminating the risk of replay attacks and ensuring the timeliness of the command. At the same time, digital signature verification is performed by using the public key of the electronic control unit to perform elliptic curve digital signature algorithm (ECDsa) verification on the signature data, comparing the consistency between the hash value of the decrypted command and the signature decryption result, thereby confirming the authenticity of the command source and the integrity of the transmission process.

[0031] It should be noted that the combined judgment result of the above three verification stages constitutes the second result. When decryption is successful, the timestamp is valid, and the signature verification is passed, the HIL simulator determines that the target control command is trustworthy and immediately executes the target control command to update the simulation scene and drive the response of virtual components such as the motor model or battery model. If any verification stage fails, the HIL simulator triggers a preset safety mechanism, records the "command verification failed" fault code, and simulates the actuator not responding. The HIL simulator can synchronize the target control command response result, safety policy trigger status, and abnormal information during the test process to the PC host computer. The PC host computer records key test indicators and generates a visual evaluation report through automated scripts.

[0032] The electronic control unit (ECU) of this application receives a test data packet sent by the HIL simulator via a hardware interface. This packet includes scenario-specific extreme operating condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals (sensor data jump amplitude, actuator delay duration, and bus packet loss rate). The ECU performs integrity verification and signal threshold judgment on the test data packet to obtain a first result, and generates control commands based on this first result. The ECU encrypts and digitally signs the control commands using a preset security key to obtain the target control commands, and sends them to the HIL simulator via the communication bus. This establishes a real-time physical connection between the ECU and the HIL simulator directly based on the real hardware interface and the communication bus. The HIL simulator decrypts the target control commands. The system uses encryption, timestamps, and digital signatures for verification, and executes target control commands based on the verification results, forming a dynamic hardware-in-the-loop interactive closed loop. In this application, the sensor signals generated by the HIL simulator simulate the output of real hardware sensors. The execution of the command by the HIL simulator simulates the response of the power devices, completely reproducing the hardware signal chain of sensor acquisition → controller (electronic control system) decision → power device execution in a real vehicle. This realizes real-time, closed-loop interaction between the electronic control unit and the sensors and power devices, and verifies the collaborative working capability of the entire control link on the real hardware platform. Thus, it efficiently and realistically completed a comprehensive test of the security layer of the electronic control system under the influence of multiple factors such as real hardware delay, electromagnetic interference, and dynamic interaction in a laboratory environment.

[0033] Furthermore, in one embodiment, the integrity verification and signal threshold determination of the test data packet includes: Under any extreme working condition in any scenario, a local verification code is obtained by calculating the encrypted interference signal, sensor signal and abnormal signal through a preset verification algorithm; The local verification code is compared with the preset verification code to obtain the comparison result; If the comparison results are consistent, the integrity verification is deemed to have passed, and the signal threshold judgment is performed on the scenario-based extreme working condition parameters. If the comparison results are inconsistent, the integrity verification is deemed to have failed.

[0034] As an example, in any scenario-specific extreme condition, the HIL simulator uses a preset verification algorithm (e.g., the CRC32 cyclic redundancy check algorithm based on the IEEE 802.3 standard) to perform data integrity verification calculations on the encrypted interference signal, sensor signal, and abnormal signal to obtain a local check code. Specifically, by taking the above signal data stream as input, a hash operation is performed using the 32-bit polynomial division of the CRC32 algorithm to generate a local check code that strictly corresponds to the original data. The implementation process of the CRC32 algorithm is common knowledge in the field and will not be described in detail here for the sake of brevity.

[0035] It should be noted that the HIL simulator compares the local checksum with the preset checksum pre-stored in the security layer of the electronic control unit (this checksum is generated and encrypted by the electronic control unit based on the same algorithm and original data before signal transmission) to verify whether the data has been tampered with or interfered with by noise during transmission. If the comparison results are consistent, the integrity verification is deemed to have passed, indicating that the signal data remains intact under electromagnetic interference and extreme operating conditions. Then, the signal threshold is further judged for the scenario-based extreme operating condition parameters. If the comparison results are inconsistent, the integrity verification is deemed to have failed, triggering the preset security strategy (such as cutting off the high-voltage circuit and reporting the "data verification failure" fault code within 100 milliseconds).

[0036] Furthermore, in one embodiment, the step of determining the signal threshold for scenario-specific extreme operating condition parameters includes: Target parameters are extracted from scenario-based extreme operating condition parameters, including individual battery cell voltage, battery pack temperature, charging current, and rotational speed. For each target parameter, the target parameter is verified based on a preset safety threshold.

[0037] In an exemplary embodiment of this application, the target parameters include individual cell voltage, battery pack temperature, charging current, and rotational speed. Individual cell voltage is a key indicator reflecting the electrochemical state of a single cell; battery pack temperature is a global parameter characterizing the thermal management system's effectiveness; charging current is a core parameter determining the energy input rate; and rotational speed is a dynamic parameter characterizing the motor's power output. Preset safety thresholds include safety thresholds corresponding to each target parameter. For example, the individual cell voltage threshold is set to 2.5 V-4.2 V according to GB / T 38661-2020 standard to prevent thermal runaway caused by overcharging and over-discharging; the battery pack temperature threshold is set to -20℃-60℃ according to ISO 12405-1 standard to avoid low-temperature lithium plating or high-temperature thermal propagation; the charging current threshold is set to no more than 500 A according to IEC 61851-1 standard to prevent overcurrent damage; and the rotational speed threshold is set to no more than 20,000 rpm according to ISO 15156 standard to avoid the risk of mechanical resonance.

[0038] Specifically, after extracting target parameters from scenario-based extreme operating condition parameters, the electronic control unit (ECU) safety layer performs real-time verification for each target parameter based on a preset safety threshold. The principle is to compare the instantaneous value of the extracted parameter with the upper and lower limits of the threshold. If the parameter value is within the threshold range, it indicates that the ECU safety layer is in a safe state, and the threshold judgment is considered passed. If the parameter value is below the lower limit or above the upper limit, it indicates that the ECU safety layer is in an abnormal state, and the threshold judgment is considered failed. This judgment process is completed in microseconds by the ECU's built-in hardware comparator circuit, ensuring rapid identification of boundary condition exceedances under extreme operating conditions. It should be understood that if the target parameter is the battery cell voltage, if the battery cell voltage is not greater than the preset voltage safety threshold, the threshold judgment is considered passed and a continuous charging command is generated; if the battery cell voltage is greater than the preset voltage safety threshold, a safety strategy is triggered, i.e., the charging relay is disconnected.

[0039] Furthermore, in one embodiment, before the step of the electronic control unit receiving the test data packet sent by the HIL simulator through the hardware interface, the method further includes: A secure communication link is established between the HIL simulator and the electronic control unit based on a preset encryption algorithm, and a temporary session key is generated.

[0040] As an example, in this embodiment of the application, when the test process starts, the HIL simulator and the new energy power control unit establish a secure communication link with two-way authentication based on a preset asymmetric encryption algorithm (which may be the Elliptic Curve Digital Signature Algorithm ECC conforming to the NIST FIPS 186-4 standard, with the curve parameter secp256r1 selected to balance security strength and computational efficiency). Specifically, the HIL simulator sends a negotiation request containing its own public key and a random challenge number to the power control unit, and the power control unit verifies the validity of the public key certificate chain and confirms the identity of the HIL simulator.

[0041] It should be noted that the electronic control unit generates a temporary key pair, encrypts its public key and response challenge number using the HIL simulator's public key, and then sends it back. At the same time, the HIL simulator performs the same operation to complete identity verification. Both parties use their respective private keys and the other party's public key to calculate the same shared key value according to the Elliptic Curve Diffie-Hellman Key Exchange Protocol (ECDH), ensuring that the key cannot be derived even if the communication channel is intercepted. The shared key value is input into the key derivation function KDF (using the HKDF algorithm based on SHA-256) and a timestamp is added to generate a 256-bit temporary session key. This key is immediately stored in the secure chip of the HIL simulator (compliant with ISO / IEC 15408 EAL4+ certification) and the secure storage area of ​​the electronic control unit (using a tamper-proof hardware encryption module), and a validity period threshold is set (e.g., 0.5 to 2 hours). After the timeout, the key rotation mechanism is automatically triggered and the update log is synchronized to the PC host computer.

[0042] Furthermore, in one embodiment, the HIL simulator decrypts, timestamps, and digitally signs the target control commands, including: The control command is decrypted based on the temporary session key to obtain the decrypted control command. The digital signature in the decryption control command is verified using a preset verification public key. The timestamp in the decryption control command is verified based on the current time of the HIL simulator.

[0043] In an exemplary embodiment of this application, after receiving the encrypted control command sent by the electronic control unit, the HIL simulator decrypts the command using the AES-256 symmetric encryption algorithm conforming to the FIPS 197 standard, based on the temporary session key stored in the security chip. This key is generated through the ECDH key exchange protocol and its validity period is strictly limited to 0.5 to 2 hours. The decryption process uses a hardware encryption engine to restore the original control command content and the attached digital signature and timestamp information within microseconds. Subsequently, based on the asymmetric public key certificate pre-registered by the electronic control unit (based on the X.509 v3 standard), the digital signature in the decrypted control command is verified using the Elliptic Curve Digital Signature Algorithm (ECDSA) with curve parameter secp256r1.

[0044] It should be understood that the principle of digital signature verification is to generate a digest value from the instruction data using SHA-256 hashing, and then compare it with the original digest value obtained from decrypting the digital signature. If the two match, it proves that the instruction source is authentic and the transmission process has not been tampered with. Simultaneously, the validity of the timestamp in the decryption control instruction is verified using the HIL simulator system clock synchronized with the IEEE 1588 precise time protocol. The difference between the timestamp in the decryption control instruction and the local clock is calculated, and the relationship between this difference and a preset time window is determined to eliminate the risk of replay attacks. It should be noted that after receiving the decryption control instruction, verification can be performed first on the digital signature or first on the timestamp; this is not a limitation.

[0045] Furthermore, in one embodiment, verifying the timestamp in the decryption control command based on the current time of the HIL simulator includes: The time deviation is determined based on the current time and timestamp; If the time deviation is not greater than the preset deviation threshold, the timestamp verification is deemed successful. If the time deviation is greater than the preset deviation threshold, the timestamp verification is deemed unsuccessful.

[0046] In this embodiment, the preset deviation threshold comprehensively considers three factors: the maximum transmission delay of the vehicle CAN FD bus (preferably 50µs), signal jitter caused by electromagnetic interference (preferably 30ms), and safety redundancy margin (preferably 20ms). Its specific value can be set according to the ISO 11898-1 standard and is not limited here. For example, the preset deviation threshold can preferably be 100ms. The current local timestamp (i.e., the current time) is obtained through a high-precision system clock synchronized with the IEEE 1588 Precision Time Protocol (PTP). The absolute difference between the current time and the timestamp in the decryption command is calculated to determine the time deviation, ensuring that the deviation accurately reflects the command transmission delay. The time deviation is compared with the preset deviation threshold. When the time deviation is not greater than the preset deviation threshold, the timestamp verification is deemed successful, indicating that the target control command is transmitted within the effective time window and has not been subjected to a replay attack. When the time deviation is greater than the preset deviation threshold, the timestamp verification is deemed unsuccessful, triggering a security mechanism to record a "timestamp invalid" fault code and not executing the target control command.

[0047] It should be understood that the above verification mechanism is based on the time-sensitivity constraint principle of time synchronization. It uses the inherent latency characteristics of the vehicle network to build a security boundary. By strictly limiting the effective lifespan of instructions (such as 100 milliseconds), it prevents attackers from using historically intercepted instructions to carry out replay attacks. At the same time, it avoids misjudgments caused by normal communication delays. Together with digital signature verification and decryption verification, it constitutes a "time-sensitivity-identity-confidentiality" security verification system. This ensures that in extreme working condition tests, the electronic control system only responds to real-time and valid control instructions, thereby effectively defending against network attacks and ensuring the functional safety of the high-voltage system of new energy vehicles.

[0048] It should be noted that, referring to Figure 2 The diagram illustrates a safety testing architecture for automotive electronic systems based on a HIL simulator. The PC host computer is equipped with a scripting engine for automated testing processes, and a visualization module facilitates user monitoring and interaction. Both communicate at high speed with the HIL simulator via Ethernet. The HIL simulator includes an environment simulation module to simulate the real vehicle environment, an EMI simulation module to simulate electromagnetic interference, a key negotiation module to ensure secure communication, and a security verification module to verify security functions. It also integrates a security chip. The system under test (SUT) consists of security layer modules and corresponding security chips for the VCU, MCU, and BMS. Data transmission and communication between these components rely on a CAN / CAN FD bus. This entire architecture aims to simulate complex real-world operating conditions to comprehensively test the safety functions of the vehicle's electronic systems, proactively identify potential risks, and ensure the safe and reliable operation of the vehicle's electronic systems.

[0049] It should be understood that the safety layer test of the electronic control system in this application can also be implemented in a variety of test scenarios, as shown in the following examples: Battery thermal runaway warning scenario: HIL simulates the battery temperature rising suddenly from 60°C to 90°C to verify whether the BMS triggers the warning (lights up the fault light) and cuts off the high voltage circuit within 300ms; Motor overcurrent protection scenario: HIL simulates a sudden increase in motor current from 300A to 600A (exceeding the safety threshold), verifying whether the MCU limits the current to a safe value (≤400A) within 50ms. Communication interference scenario: HIL injects error frames into the CAN bus (duty cycle 20%) to verify whether the control commands between VCU and BMS can still maintain integrity (packet loss rate ≤1%). Data tampering scenario: HIL tampers with the accelerator pedal signal (from 20% to 80%), verifying whether the VCU detects the anomaly through the check code and limits the power output.

[0050] It should be noted that the above scenarios (such as 100 thermal runaway scenario tests) can be executed repeatedly using Python automated scripts to record indicators such as the success rate of safety policy triggering and response time, and finally generate a test report.

[0051] Secondly, embodiments of this application also provide a test device for the security layer of an electronic control system.

[0052] In one embodiment, reference is made to Figure 3 , Figure 3 This is a functional module diagram of an embodiment of the electrical control system safety layer testing device of this application. Figure 3 As shown, the electrical control system safety layer testing device includes: The first processing module is used for the electronic control unit to receive test data packets sent by the HIL simulator through the hardware interface, and to perform integrity verification and signal threshold judgment on the test data packets to obtain a first result. Based on the first result, control instructions are generated. The test data packets include scenario-based extreme working condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals. The encrypted abnormal signals include sensor data jump amplitude, actuator delay duration, and bus packet loss rate. The second processing module is used by the electronic control unit to encrypt and digitally sign the control command based on a preset security key, obtain the target control command, and send it to the HIL simulator through the communication bus. The third processing module is used by the HIL simulator to decrypt, timestamp, and digitally sign the target control instructions to obtain a second result, and execute the target control instructions based on the second result to achieve the security layer test of the electronic control system.

[0053] Furthermore, in one embodiment, the first processing module is specifically used for: Under any extreme working condition in any scenario, a local verification code is obtained by calculating the encrypted interference signal, sensor signal and abnormal signal through a preset verification algorithm; The local verification code is compared with the preset verification code to obtain the comparison result; If the comparison results are consistent, the integrity verification is deemed to have passed, and the signal threshold judgment is performed on the scenario-based extreme working condition parameters. If the comparison results are inconsistent, the integrity verification is deemed to have failed.

[0054] Furthermore, in one embodiment, the first processing module is specifically used for: Target parameters are extracted from scenario-based extreme operating condition parameters, including individual battery cell voltage, battery pack temperature, charging current, and rotational speed. For each target parameter, the target parameter is verified based on a preset safety threshold.

[0055] Furthermore, in one embodiment, the first processing module is specifically used for: A secure communication link is established between the HIL simulator and the electronic control unit based on a preset encryption algorithm, and a temporary session key is generated.

[0056] Furthermore, in one embodiment, the third processing module is specifically used for: The control command is decrypted based on the temporary session key to obtain the decrypted control command. The digital signature in the decryption control command is verified using a preset verification public key. The timestamp in the decryption control command is verified based on the current time of the HIL simulator.

[0057] Furthermore, in one embodiment, the third processing module is specifically used for: The time deviation is determined based on the current time and timestamp; If the time deviation is not greater than the preset deviation threshold, the timestamp verification is deemed successful. If the time deviation is greater than the preset deviation threshold, the timestamp verification is deemed unsuccessful.

[0058] The electronic control unit (ECU) of this application receives a test data packet sent by the HIL simulator via a hardware interface. This packet includes scenario-specific extreme operating condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals (sensor data jump amplitude, actuator delay duration, and bus packet loss rate). The ECU performs integrity verification and signal threshold judgment on the test data packet to obtain a first result, and generates control commands based on this first result. The ECU encrypts and digitally signs the control commands using a preset security key to obtain the target control commands, and sends them to the HIL simulator via the communication bus. This establishes a real-time physical connection between the ECU and the HIL simulator directly based on the real hardware interface and the communication bus. The HIL simulator decrypts the target control commands. The system uses encryption, timestamps, and digital signatures for verification, and executes target control commands based on the verification results, forming a dynamic hardware-in-the-loop interactive closed loop. In this application, the sensor signals generated by the HIL simulator simulate the output of the real hardware sensors. The execution of the command by the HIL simulator simulates the response of the power devices, completely reproducing the hardware signal chain of sensor acquisition → controller (electronic control system) decision → power device execution in a real vehicle. This realizes real-time, closed-loop interaction between the electronic control unit and the sensors and power devices, and verifies the collaborative working capability of the entire control link on the real hardware platform. Thus, it efficiently and realistically completed a comprehensive test of the security layer of the electronic control system under the influence of multiple factors such as real hardware delay, electromagnetic interference, and dynamic interaction in a laboratory environment.

[0059] The functions of each module in the above-mentioned electronic control system security layer test device correspond to the steps in the above-mentioned electronic control system security layer test method embodiment, and their functions and implementation processes will not be described in detail here.

[0060] Thirdly, embodiments of this application provide a security layer testing device for an electronic control system. The security layer testing device for an electronic control system can be a personal computer (PC), a laptop computer, a server, or other device with data processing capabilities.

[0061] Reference Figure 4 , Figure 4 This is a schematic diagram of the hardware structure of the electronic control system security layer testing equipment involved in the embodiments of this application. In the embodiments of this application, the electronic control system security layer testing equipment may include a processor, a memory, a communication interface, and a communication bus.

[0062] The communication bus can be of any type and is used to interconnect the processor, memory, and communication interface.

[0063] Communication interfaces include input / output (I / O) interfaces, physical interfaces, and logical interfaces used for interconnecting devices within the electrical control system safety layer test equipment, as well as interfaces used for interconnecting the electrical control system safety layer test equipment with other devices (such as other computing devices or user equipment). Physical interfaces can be Ethernet interfaces, fiber optic interfaces, ATM interfaces, etc.; user equipment can be displays, keyboards, etc.

[0064] Memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0065] The processor can be a general-purpose processor, which can call the electronic control system security layer test program stored in the memory and execute the electronic control system security layer test method provided in the embodiments of this application. For example, the general-purpose processor can be a central processing unit (CPU). The method executed when the electronic control system security layer test program is called can be referred to the various embodiments of the electronic control system security layer test method of this application, and will not be repeated here.

[0066] Those skilled in the art will understand that Figure 4The hardware structure shown does not constitute a limitation of this application and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0067] Fourthly, embodiments of this application also provide a readable storage medium.

[0068] The present application has a readable storage medium storing an electronic control system security layer test program, wherein when the electronic control system security layer test program is executed by a processor, it implements the steps of the electronic control system security layer test method described above.

[0069] The method implemented when the electronic control system security layer test program is executed can be referred to in the various embodiments of the electronic control system security layer test method of this application, and will not be repeated here.

[0070] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. The terms "first," "second," and "third," etc., are used to distinguish different objects, etc., and do not indicate a sequence, nor do they limit "first," "second," and "third" to different types.

[0071] In the description of the embodiments of this application, terms such as "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a concrete manner.

[0072] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.

[0073] In some processes described in the embodiments of this application, multiple operations or steps are included in a specific order. However, it should be understood that these operations or steps may not be executed in the order they appear in the embodiments of this application, or they may be executed in parallel. The sequence number of the operation is only used to distinguish different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed sequentially or in parallel, and these operations or steps may be combined.

[0074] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0075] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of this application.

[0076] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A method for testing the safety layer of an electronic control system, characterized in that, The electronic control system security layer testing method includes: The electronic control unit receives the test data packet sent by the HIL simulator through the hardware interface, performs integrity verification and signal threshold judgment on the test data packet, obtains the first result, and generates control instructions based on the first result. The test data packet includes scenario-based extreme working condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals. The encrypted abnormal signals include sensor data jump amplitude, actuator delay duration, and bus packet loss rate. The electronic control unit encrypts and digitally signs the control commands based on a preset security key to obtain the target control commands, and sends them to the HIL simulator via the communication bus. The HIL simulator decrypts, timestamps, and digitally signs the target control instructions to obtain a second result, and executes the target control instructions based on the second result to achieve the security layer test of the electronic control system.

2. The electronic control system security layer testing method as described in claim 1, characterized in that, The integrity verification and signal threshold judgment of the test data packet include: Under any extreme working condition in any scenario, a local verification code is obtained by calculating the encrypted interference signal, sensor signal and abnormal signal through a preset verification algorithm; The local verification code is compared with the preset verification code to obtain the comparison result; If the comparison results are consistent, the integrity verification is deemed to have passed, and the signal threshold judgment is performed on the scenario-based extreme working condition parameters. If the comparison results are inconsistent, the integrity verification is deemed to have failed.

3. The electronic control system security layer testing method as described in claim 2, characterized in that, The step of determining the signal threshold for scenario-specific extreme operating condition parameters includes: Target parameters are extracted from scenario-based extreme operating condition parameters, including individual battery cell voltage, battery pack temperature, charging current, and rotational speed. For each target parameter, the target parameter is verified based on a preset safety threshold.

4. The electronic control system security layer testing method as described in claim 1, characterized in that, Before the step of the electronic control unit receiving the test data packet sent by the HIL simulator through the hardware interface, the method further includes: A secure communication link is established between the HIL simulator and the electronic control unit based on a preset encryption algorithm, and a temporary session key is generated.

5. The electronic control system security layer testing method as described in claim 4, characterized in that, The HIL simulator decrypts, timestamps, and verifies digital signatures of target control commands, including: The control command is decrypted based on the temporary session key to obtain the decrypted control command. The digital signature in the decryption control command is verified using a preset verification public key. The timestamp in the decryption control command is verified based on the current time of the HIL simulator.

6. The method for testing the safety layer of an electronic control system as described in claim 5, characterized in that, The verification of the timestamp in the decryption control command based on the current time of the HIL simulator includes: The time deviation is determined based on the current time and timestamp; If the time deviation is not greater than the preset deviation threshold, the timestamp verification is deemed successful. If the time deviation is greater than the preset deviation threshold, the timestamp verification is deemed unsuccessful.

7. A safety layer testing device for an electronic control system, characterized in that, The electronic control system security layer testing device includes: The first processing module is used for the electronic control unit to receive test data packets sent by the HIL simulator through the hardware interface, and to perform integrity verification and signal threshold judgment on the test data packets to obtain a first result. Based on the first result, control instructions are generated. The test data packets include scenario-based extreme working condition parameters, encrypted interference signals, encrypted sensor signals corresponding to the hardware to be interacted with, and encrypted abnormal signals. The encrypted abnormal signals include sensor data jump amplitude, actuator delay duration, and bus packet loss rate. The second processing module is used by the electronic control unit to encrypt and digitally sign the control command based on a preset security key, obtain the target control command, and send it to the HIL simulator through the communication bus. The third processing module is used by the HIL simulator to decrypt, timestamp, and digitally sign the target control instructions to obtain a second result, and execute the target control instructions based on the second result to achieve the security layer test of the electronic control system.

8. The electronic control system security layer testing device as described in claim 7, characterized in that, The first processing module is specifically used for: Under any extreme working condition in any scenario, a local verification code is obtained by calculating the encrypted interference signal, sensor signal and abnormal signal through a preset verification algorithm; The local verification code is compared with the preset verification code to obtain the comparison result; If the comparison results are consistent, the integrity verification is deemed to have passed, and the signal threshold judgment is performed on the scenario-based extreme working condition parameters. If the comparison results are inconsistent, the integrity verification is deemed to have failed.

9. A safety layer testing device for an electronic control system, characterized in that, The electronic control system security layer test equipment includes a processor, a memory, and an electronic control system security layer test program stored in the memory and executable by the processor, wherein when the electronic control system security layer test program is executed by the processor, it implements the steps of the electronic control system security layer test method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an electronic control system security layer test program, wherein when the electronic control system security layer test program is executed by a processor, it implements the steps of the electronic control system security layer test method as described in any one of claims 1 to 6.