WO2018214487A1 - 一种控制器区域网总线安全通信方法、装置及系统 - Google Patents

一种控制器区域网总线安全通信方法、装置及系统 Download PDF

Info

Publication number
WO2018214487A1
WO2018214487A1 PCT/CN2017/116986 CN2017116986W WO2018214487A1 WO 2018214487 A1 WO2018214487 A1 WO 2018214487A1 CN 2017116986 W CN2017116986 W CN 2017116986W WO 2018214487 A1 WO2018214487 A1 WO 2018214487A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
ecu
identifier
random number
bus
Prior art date
Application number
PCT/CN2017/116986
Other languages
English (en)
French (fr)
Inventor
林孝盈
魏卓
沙庆迪
唐康
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN201710854489.2A external-priority patent/CN108965218B/zh
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP17911391.5A priority Critical patent/EP3641215B1/en
Priority to JP2019565171A priority patent/JP6915095B2/ja
Priority to KR1020197037871A priority patent/KR102316872B1/ko
Publication of WO2018214487A1 publication Critical patent/WO2018214487A1/zh
Priority to US16/692,654 priority patent/US11271771B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials

Definitions

  • the present application relates to the field of communications technologies, and in particular, to a controller area network (CAN) bus secure communication method, apparatus, and system.
  • CAN controller area network
  • the CAN communication protocol defines the data transmission standard of the physical layer (PHY) and the data link layer (DLL). It is a broadcast type transmission channel and is widely used, for example, widely used. In the car communication.
  • a central gateway electronic control unit connects multiple ECUs through a CAN bus system, wherein the CAN bus system may include multiple CAN buses, each of which A plurality of ECUs in the CAN bus are connected to each other through other CAN buses and a central gateway ECU, and perform transmission and reception of respective services and information.
  • a central gateway ECU connects a plurality of CAN buses responsible for in-vehicle function services (powertrain CAN bus, comfort system CAN bus, diagnostic system CAN bus, and Infotainment system CAN bus).
  • a plurality of ECUs in each CAN bus responsible for the in-vehicle function service are connected to each other through other CAN buses and a central gateway ECU, and perform transmission and reception of respective services and information.
  • the powertrain system can detect engine speed in real time and transmit the engine speed value to the powertrain CAN bus.
  • the engine speed value can be transmitted to the instrument panel ECU through the powertrain CAN bus, and the instrument panel ECU receives the engine speed. After the value, the engine speed value can be displayed in real time on the dashboard.
  • a malicious attacker can effectively attack the CAN bus system by eavesdropping, injecting or replaying the CAN message transmitted during the communication process.
  • the engine speed value is transmitted through the original CAN message shown in FIG. 2, and the value of the byte 0 to byte 7 in the original CAN message identified as 0x123 in FIG. Indicates the engine speed value.
  • the instrument board parses the engine speed value after receiving the implanted tampering CAN message.
  • 0x1F40 8000 RPM, causing the instrument panel to receive and display engine speed values as erroneous values.
  • a key can be used to process CAN messages ( The CAN message identifier, the counter value corresponding to the CAN identifier, and the data in the CAN message corresponding to the CAN message identifier are subjected to an encryption operation and an information verification code is generated, and then the information verification code is transmitted through an additional CAN message.
  • this method is still unencrypted for the data in the CAN message to be transmitted, so this method cannot resist eavesdropping, but it can Resist the replay attack and transmit the information verification code through additional CAN messages, which has a large transmission overhead.
  • a set of Cyclic Redundancy Check (CRC) values is first calculated for the data in the CAN message corresponding to the CAN message identifier, and then the data is used in tandem with the CRC value. The key is encrypted.
  • the CRC value is not random, if the attacker obtains a valid CRC value, the replay attack can still be performed.
  • the information authentication code is embedded in a higher physical frequency of transmitting and receiving by using a non-standard CAN transceiver hardware, and transmitted simultaneously with a standard CAN message, thereby realizing an information authentication mechanism for the CAN message.
  • Adopt information authentication code technology Due to the use of non-standard CAN transceiver hardware, the CAN transceiver hardware needs to be modified and cannot be directly applied to existing CAN bus communication systems.
  • the embodiment of the present application provides a method, a device, and a system for secure communication of a CAN bus, so as to effectively resist an attacker from eavesdropping, injecting, and replaying attacks.
  • a CAN bus safety communication system in a first aspect, includes a gateway ECU and at least one CAN bus connected to the gateway ECU. wherein each CAN bus is connected with at least one CAN bus.
  • the ECU includes a first CAN bus ECU in the at least one CAN bus ECU.
  • the gateway ECU is configured to generate a random number and send the generated random number to the at least one CAN bus ECU through the at least one CAN bus.
  • the first CAN bus ECU is configured to acquire the random number sent by the gateway ECU, and based on the key of the first CAN identifier, the random number sent by the gateway ECU, the count value of the first CAN identifier, and the first CAN message Data, generating a first information authentication code.
  • the first CAN bus ECU is further configured to perform an encryption operation based on the second CAN message and the key of the first CAN identifier to obtain a first encryption operation result, the first encryption operation result, the first information authentication code,
  • the count value of the first CAN identifier and the data of the first CAN message are subjected to the same length encryption operation to obtain the first CAN message encrypted and authenticated, and the first CAN message encrypted and authenticated is sent.
  • the key of the first CAN identifier is pre-allocated by the CAN bus security communication system for the first CAN identifier, and the count value of the first CAN identifier is used to transmit the CAN message according to the first CAN bus ECU using the first CAN identifier.
  • the quantity is determined and varies according to the change of the number of CAN messages transmitted by the first CAN bus ECU using the first CAN identifier, the first CAN message is a message to be sent by the first CAN bus ECU, and the first CAN bus ECU The first CAN message is transmitted using a first CAN identifier.
  • the second CAN message is a historical CAN message of the first CAN bus ECU.
  • the historical CAN message of the first CAN bus ECU may be the first CAN bus safety communication system.
  • the initial default CAN message pre-assigned by the CAN identifier.
  • the historical CAN message of the first CAN bus ECU may be the first CAN identifier used by the first CAN bus ECU The CAN message set in the CAN message that has been sent has been completed.
  • the CAN message set in the CAN message that the first CAN bus ECU has completed using the first CAN identifier is the CAN message that the first CAN bus ECU has completed using the first CAN identifier.
  • the previous CAN message adjacent to the first CAN message in the text to reduce storage overhead.
  • the first CAN bus ECU encrypts the operation process of the CAN message and generates the information recognition
  • the process of the code not only the data of the message to be sent but also the random number of the rate, the count value and the CAN message set in the transmitted CAN message are used, so even if the same data value is injected, the generated information authentication code and
  • the encryption operation structure is also different, so the CAN bus ECU sends the encrypted authentication CAN message, which can resist the replay attack, and combines the encryption and authentication dual process, so that the data of the transmitted CAN message data area can simultaneously resist the eavesdropping attack, injecting Attack and replay attacks are more secure.
  • the information authentication code can be understood as being directly embedded in the CAN message data area, without using another CAN message loading, the transmission overhead is low, and the overall design does not modify the CAN transceiver hardware, and can be applied to the existing CAN. Bus system.
  • the first CAN bus ECU may obtain the first generation key based on the random number and the key of the first CAN identifier, and based on the first generation key, the random number, the count value of the first CAN identifier, the first CAN
  • the data of the message generates a first information authentication code to further improve the security of CAN message transmission.
  • the CAN bus safety communication system further includes a second CAN bus ECU, and the second CAN bus ECU is configured to obtain the first CAN message of the encrypted authentication, and decrypt the first CAN message encrypted and authenticated to obtain the first Decrypting the information authentication code, the decrypted data of the first CAN message, and the first decrypted count value of the first CAN identifier.
  • the second CAN bus ECU acquires the random number sent by the gateway ECU, and based on the key of the first CAN identifier, the random number sent by the gateway ECU, the first decrypted count value of the first CAN identifier, and the decryption of the first CAN message
  • the data generates a second information authentication code. If the first decryption information authentication code and the second information authentication code are consistent, and the first decryption count value of the first CAN identifier is legal, it is determined that the first CAN message of the encrypted authentication is legal.
  • the first decryption count value of the first CAN identifier is legal means that the first decryption count value of the first CAN identifier is within a preset allowable error range of the count value, so as to set different ranges according to different security levels.
  • the second CAN bus ECU may obtain the first generation key based on the random number sent by the gateway ECU and the key of the first CAN identifier, and based on the first generation key, the random number sent by the gateway ECU, and the first CAN
  • the first decrypted count value of the identifier and the decrypted data of the first CAN message generate a second information authentication code.
  • the gateway ECU may perform encryption authentication on the random number, for example, the gateway ECU may obtain the first random number transmission key based on the third CAN message and the key of the second CAN identifier.
  • the gateway ECU generates a first random number information authentication code based on the first random number transmission key and the random number to be sent by the gateway ECU, and performs encryption operation on the first random number transmission key and the third CAN message to obtain a second Encryption operation result.
  • the gateway ECU performs an equal-length encryption operation on the second encryption operation result, the first random number information authentication code, and the random number to be transmitted to obtain an encrypted authentication random number, and sends the encryption to the at least one CAN bus ECU Certified random number.
  • the first CAN bus ECU is further configured to acquire a random number of the second CAN identifier and the third CAN message encryption authentication. Obtaining a second random number transmission key based on the second CAN identifier key and the third CAN message; performing encryption operation on the second random number transmission key and the third CAN message to obtain a third encryption operation result .
  • the first CAN bus ECU performs an equal-length decryption operation on the third encryption operation result and the encrypted authentication random number to obtain a first random number decryption information authentication code; and transmits the secret based on the random number and the second random number sent by the gateway ECU And generating a second random number information authentication code; if the first random number decryption information authentication code and the second random number information authentication code are consistent, determining that the random number sent by the gateway ECU is legal.
  • the gateway ECU sends a CAN message to the at least one CAN bus ECU using the second CAN identifier, and the key of the second CAN identifier is pre-allocated by the CAN bus secure communication system for the second CAN identifier.
  • the third CAN message is a historical CAN message of the gateway ECU.
  • the historical CAN message of the gateway ECU is an initial default CAN message pre-allocated by the CAN bus safety communication system to the gateway ECU. If the random number to be sent by the gateway ECU is a non-first random number sent by the gateway ECU, the historical CAN message of the gateway ECU is a CAN message set in the CAN message that the gateway ECU has completed using the second CAN identifier. .
  • the gateway ECU uses the second CAN identifier to complete the CAN message set in the transmitted CAN message, and the gateway ECU uses the second CAN identifier to complete the transmission of the CAN message and the gateway ECU.
  • the second CAN identifier is the last CAN message adjacent to the currently transmitted CAN message to reduce storage overhead.
  • the gateway ECU sends the random number of the encrypted authentication, and the first CAN bus ECU verifies the legitimacy of the received random number, which can further improve the security in the CAN bus secure communication system.
  • a CAN bus secure communication device which can be applied to a first CAN bus ECU.
  • the CAN bus safety communication device applied to the first CAN bus ECU has the functions of implementing the above first aspect and the first CAN bus ECU in any design of the first aspect, and the functions can be implemented by hardware or by executing corresponding software through hardware.
  • the hardware or software includes one or more modules corresponding to the functions described above.
  • the modules can be software and/or hardware.
  • the CAN bus safety communication device applied to the first CAN bus ECU includes a receiving unit, a processing unit, and a transmitting unit, wherein the receiving unit, the processing unit, and the transmitting unit are executable by the first CAN bus ECU. Corresponding to each functional step, it will not be described here.
  • the CAN bus security communication device applied to the first CAN bus ECU includes a processor, a transceiver, and a storage space.
  • a memory space (also referred to as a memory) is coupled to the processor for storing various software programs and/or sets of instructions.
  • the stored program or instruction of the processor calling the storage space performs the functional steps performed by the first CAN bus ECU described above, and controls the transceiver to send and receive signals.
  • a CAN bus safety communication device which can be applied to a second CAN bus ECU.
  • the CAN bus safety communication device applied to the second CAN bus ECU has the functions of implementing the first aspect and the second CAN bus ECU in any design of the first aspect, and the functions can be implemented by hardware or by executing corresponding software through hardware.
  • the hardware or software includes one or more modules corresponding to the functions described above.
  • the modules can be software and/or hardware.
  • the CAN bus safety communication device applied to the second CAN bus ECU includes a receiving unit and a processing unit, wherein the receiving unit and the processing unit can correspond to the functional steps performed by the second CAN bus ECU, I will not repeat them here.
  • the CAN bus secure communication device applied to the second CAN bus ECU includes a processor, a transceiver, and a storage space.
  • a memory space (also referred to as a memory) is coupled to the processor for storing various software programs and/or sets of instructions.
  • the stored program or instruction of the processor calling the storage space executes the functional steps performed by the second CAN bus ECU described above, and controls the transceiver to transmit and receive signals.
  • a CAN bus safety communication device which can be applied to a gateway ECU.
  • the CAN bus security communication device applied to the gateway ECU has the functions of implementing the above-mentioned first aspect and the gateway ECU in any design of the first aspect, and the functions may be implemented by hardware or by executing corresponding software by hardware.
  • the hardware or software includes one or more modules corresponding to the functions described above.
  • the modules can be software and/or hardware.
  • the CAN bus security communication device applied to the gateway ECU includes a processing unit and a transmitting unit, wherein the processing unit and the transmitting unit may correspond to the functional steps performed by the gateway ECU, and details are not described herein.
  • the CAN bus security communication device applied to the gateway ECU includes a processor, at least A set of transceivers and storage space.
  • a memory space (also referred to as a memory) is coupled to the processor for storing various software programs and/or sets of instructions.
  • the stored program or instruction of the processor calling the storage space performs the functional steps performed by the gateway ECU described above, and controls the at least one set of transceivers to transmit and receive signals.
  • a fifth aspect provides a CAN bus security communication method, in which the method steps performed by the CAN bus ECU correspond to the first aspect and the respective functional steps performed by the first CAN bus ECU in any design of the first aspect .
  • a CAN bus secure communication method in which the method steps performed by the CAN bus ECU are in accordance with the first aspect and the functional steps performed by the second CAN bus ECU in any of the first aspects of the first aspect. correspond.
  • a CAN bus secure communication method in which the method steps performed by the CAN bus ECU correspond to the functional steps performed by the gateway ECU in the first aspect and the arbitrary design of the first aspect.
  • a computer storage medium for storing instructions that, when executed, can complete the first aspect and the gateway ECU, the first CAN bus ECU, and the second CAN bus ECU in any possible design of the first aspect Any of the functions involved.
  • a computer program product for storing a computer program for performing a gateway ECU, a first CAN bus ECU, and a second CAN bus ECU in the first aspect and any possible design of the first aspect Any of the functions involved.
  • the first CAN bus ECU not only uses the data of the to-be-sent message but also the random number of the process in the process of encrypting the CAN message and generating the information authentication code.
  • the count value and the CAN message set in the sent CAN message so even if the same data value is injected, the generated information authentication code and the encryption operation structure are different, so the CAN bus ECU sends the encrypted authentication CAN message, which can withstand Replay attack, and because of the combination of encryption and authentication, the data in the transmitted CAN message data area can simultaneously resist eavesdropping attacks, inject attacks and replay attacks, and has high security.
  • the information authentication code can be understood as being directly embedded in the CAN message data area, without using another CAN message loading, the transmission overhead is low, and the overall design does not modify the CAN transceiver hardware, and can be applied to the existing CAN. Bus system.
  • the first CAN bus ECU and the second CAN bus ECU perform key generation processing on the key of the first CAN identifier by using a random number sent by the gateway ECU, so that the key used each time is more It is random and can improve the security of CAN message transmission more effectively.
  • Figure 1 is a CAN communication network architecture for in-vehicle communication
  • FIG. 2 is a schematic diagram of a CAN message being eavesdropped and injected in a CAN communication network for in-vehicle communication;
  • FIG. 3 is a CAN bus security communication system according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a format of a CAN message involved in the embodiment of the present application.
  • FIG. 5 is a schematic diagram of configuration of a CAN identifier and a count value in a CAN bus secure communication system according to an embodiment of the present application
  • FIG. 6 is a schematic diagram of configuring a CAN identifier corresponding key in a CAN bus security communication system according to an embodiment of the present application
  • FIG. 7 is another schematic diagram of configuring a CAN identifier corresponding key in a CAN bus secure communication system according to an embodiment of the present application
  • FIG. 8 is a schematic diagram of pre-configuration parameters of a CAN bus security communication system according to an embodiment of the present application.
  • FIG. 9 is a flowchart of implementing a CAN bus security communication method according to the present application.
  • FIG. 10 is a schematic diagram of generating an encrypted authentication random number data area according to an embodiment of the present application.
  • FIG. 11 is a schematic flowchart of an implementation process for verifying the validity of an encrypted authentication random number according to an embodiment of the present disclosure
  • FIG. 12 is a schematic diagram of a data area for generating an encrypted authentication CAN message according to an embodiment of the present disclosure
  • FIG. 13 is a schematic flowchart of an implementation process for verifying the legality of an encrypted authentication CAN message according to an embodiment of the present disclosure
  • FIG. 14 is a schematic structural diagram of a CAN bus security communication apparatus according to an embodiment of the present application.
  • FIG. 15 is a schematic structural diagram of another CAN bus security communication device according to an embodiment of the present disclosure.
  • FIG. 16 is a schematic structural diagram of still another CAN bus security communication device according to an embodiment of the present application.
  • FIG. 3 is a CAN bus security communication system according to an embodiment of the present application.
  • the CAN bus safety communication system includes a gateway ECU and at least one CAN bus connected to the gateway ECU; wherein each CAN bus is connected with at least one CAN bus ECU.
  • Both the gateway ECU and the CAN bus ECU have a processor for performing arithmetic processing, an internal storage space for storing commands, and a transceiver for transmitting and receiving information.
  • the CAN bus ECU can usually include a set of transceivers connected to a CAN bus.
  • the gateway ECU can include multiple sets of transceivers and is connected to multiple CAN buses.
  • the CAN bus can be understood as the transmission channel of the CAN bus safety communication system, and the gateway ECU can perform parallel transmission and reception of information through multiple CAN buses connected thereto.
  • the CAN bus ECU transmits and receives information through the CAN bus connected to it.
  • each CAN bus ECU can communicate with the gateway ECU, and communication can also be performed between the CAN bus ECUs.
  • the structure of the gateway ECU and the CAN bus ECU in the CAN bus safety communication system shown in FIG. 3 is only one implementation manner of the embodiment of the present application. In practical applications, the gateway ECU and the CAN bus ECU may further include more Or fewer parts, no restrictions here.
  • the transceiver can connect and communicate with other transceivers through the physical CAN bus.
  • the physical CAN bus communicates using a CAN communication protocol, which may include, but is not limited to, CAN 2.0A, CAN 2.0B, CAN-FD (CAN flexible data-rate).
  • the transceiver may also communicate with other communication devices using different communication networks, such as Ethernet, Radio Access Technology (RAN), Wireless Local Area Networks (WLAN), and the like.
  • the communication protocol supported by the communication interface 304 may include, but is not limited to, 2G/3G, Long Term Evolution (LTE), Wireless-Fidelity (Wi-Fi), and 5G new radio (New Radio). , NR) and so on.
  • a memory space (also referred to as a memory) is coupled to the processor for storing various software programs and/or sets of instructions.
  • the storage space may include high speed random access memory, and may also include non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid state storage devices.
  • the storage space can store the operating system of the CAN bus secure communication.
  • the storage space can be used to store implementations of embodiments of the present application.
  • the storage space can also store a network communication program that can be used to communicate with one or more additional devices, one or more terminal devices, one or more network devices.
  • the processor may be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated systems for controlling the execution of the program of the present application. Circuit.
  • CPU general purpose central processing unit
  • ASIC application-specific integrated circuit
  • the gateway ECU and the CAN bus ECU may also include an output device and an input device.
  • Output The device communicates with the processor and can display information in a variety of ways.
  • the output device may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc.
  • the input device communicates with the processor and can receive user input in a variety of ways.
  • the input device can be a mouse, a keyboard, a touch screen device, or a sensing device, and the like.
  • the memory may further store a user interface program, which can visually display the content of the application through a graphical operation interface, and through the menu.
  • Input controls such as dialog boxes and buttons receive user control operations on the application.
  • the CAN bus communication protocol specifies the format of a CAN message frame transmitted between CAN ECUs and between CAN bus ECUs and gateway ECUs.
  • Figure 4 shows the format of the CAN message format.
  • the CAN message includes a start of frame (SOF), a CAN identifier (Identifier), a remote transmission request (RTR) code, and control.
  • SOF start of frame
  • RTR remote transmission request
  • Control data area
  • CRC cyclic redundancy check
  • ACK end of frame
  • EEF end of frame
  • the CAN identifier can be used to identify different CAN messages, and there are two formats, 11 characters and 29 characters.
  • the data area is up to 8 bytes in the CAN standard.
  • the sender sends a CAN message
  • the receiver selects the CAN message to be received according to the CAN identifier.
  • the CAN message corresponding to one CAN identifier may have more than two recipients.
  • the CAN message transmitted by the CAN bus ECU 1 can be received by the CAN bus ECU 2 and the CAN bus ECU 3.
  • the CAN message transmitted between each CAN bus ECU and between the CAN bus ECU and the gateway ECU can be encrypted and authenticated to prevent the malicious attacker from eavesdropping, injecting and weighting the CAN message. Put an attack.
  • each ECU (each CAN bus ECU and the gateway ECU) in the CAN bus safety communication system can be pre-configured with a counter, and the count value of the counter can be used to save one CAN message for each CAN identifier.
  • the count value, the count value of each CAN identifier can represent the number of packets that the CAN identifier of the CAN identifier has been transmitted in the system, and can also be understood as the current transmitted CAN message by the count value of the CAN identifier. .
  • the count value of the CAN identifier is determined based on the number of CAN messages transmitted by the CAN bus ECU using the CAN identifier, and varies as the number of CAN messages transmitted by the CAN bus ECU using the CAN identifier changes.
  • the count value of the CAN identifier can be implemented by using a count value of a rolling counter. It is assumed that the number of CAN messages transmitted by the CAN bus ECU using the CAN identifier is N, and the count value of the scroll counter is The n-bit length is the value obtained by taking the modulo value of the CAN identifier after N/(2 n ).
  • the ECU that transmits the CAN message and the ECU that receives the CAN message both store the count value for each CAN identifier message, wherein the table for saving the count value includes two columns, and the first column is CAN.
  • the identifier, the second column is a count value corresponding to the CAN identifier.
  • the count value of the CAN identifier Id a in the ECU that transmits the CAN message is C a
  • the count value of the CAN identifier Id b is C.
  • the count value of the CAN identifier Id c is C c .
  • the count value of the CAN identifier Id d in the ECU receiving the CAN message is C d
  • the count value of the CAN identifier Id e is C e
  • the count value of the CAN identifier Id f is C f .
  • the CAN bus security communication system may further configure a corresponding key for each CAN identifier to perform encryption and authentication by using the key.
  • a hierarchical architecture can be used to generate a key and configure for different CAN identifiers. For example, an independently generated root key can be configured for the entire CAN bus secure communication system, and then the root key is used to generate a CAN bus key for different CAN buses, and then a CAN bus key is used to generate different CAN identifiers.
  • the key of the CAN identifier is shown in Figure 6.
  • a root key may be configured for the gateway ECU, and a corresponding CAN bus key is configured for each CAN bus ECU, for example, the key of the ECU on the CAN bus 1 is a CAN bus 1 key. And the CAN bus 1 can generate a key corresponding to the actually required CAN identifier through the CAN bus 1 key. In the embodiment of the present application, the entire CAN bus can also be used for security The letter system pre-configures an independently generated root key and then uses this root key to generate different keys for different CAN identifiers, as shown in Figure 7, as shown in Figure 7.
  • a root key when performing key configuration, a root key may be configured for each ECU, and the ECU may generate a key corresponding to the actually required CAN identifier by using the root key.
  • a method of generating a key using a hierarchical architecture and configuring a key configuration method can reduce the space requirement method for each ECU to store a key.
  • the key and the system initial value may be independently generated and configured for different CAN identifiers.
  • the CAN bus ECU in the CAN bus safety communication system can generate an information authentication code based on the CAN identifier key, the identifier count value, the random number, and the data of the CAN message data area to be transmitted, based on the CAN.
  • the key of the identifier and the CAN identifier have been sent to the CAN message set in the CAN message for encryption operation, and the result of the encryption operation, the information authentication code, the count value of the CAN identifier, and the CAN message data area to be transmitted.
  • the data is subjected to the same length encryption operation so that the data length of the encrypted authentication CAN message data area conforms to the data area length of the CAN bus communication protocol specification, and the encrypted authentication CAN message data is placed in the data area of the message to be transmitted. send. Due to the encryption and authentication process of the CAN message and the process of generating the information authentication code, not only the data of the message to be sent but also the random number of the message, the count value, and the CAN message set in the transmitted CAN message are used.
  • the CAN bus ECU sends the encrypted authentication CAN message, which can resist the replay attack, and combines the encryption and authentication dual processes to make the transmission
  • the data in the CAN packet data area can simultaneously resist eavesdropping attacks, injecting attacks and replaying attacks, and has high security.
  • the information authentication code can be understood as being directly embedded in the CAN message data area, without using another CAN message loading, the transmission overhead is low, and the overall design does not modify the CAN transceiver hardware, and can be applied to the existing CAN. Bus system.
  • the CAN bus ECU may perform an encryption operation based on the key of the CAN identifier and the initial default CAN message.
  • the initial default CAN message can be pre-configured during the initial setup phase of the CAN bus security communication system parameters.
  • the CAN message to be sent by the CAN bus ECU is referred to as a first CAN message
  • the CAN identifier used by the CAN bus ECU to transmit the first CAN message is referred to as a first CAN identifier.
  • the CAN message used by the CAN bus ECU for the encryption operation process is referred to as a second CAN message.
  • the second CAN message is a historical CAN message of the first CAN bus ECU.
  • a historical CAN message can be understood as a message that already exists before the current CAN is sent.
  • the historical CAN message of the first CAN bus ECU may be the first CAN bus safety communication system.
  • the initial default CAN message pre-assigned by the CAN identifier.
  • the historical CAN message of the first CAN bus ECU may be the first CAN identifier used by the first CAN bus ECU The CAN message set in the CAN message that has been sent has been completed.
  • the CAN bus ECU receiving the encrypted authentication CAN message in the CAN bus safety communication system can decrypt the received encrypted authentication CAN message to obtain the decrypted data of the CAN message, the decryption count value of the CAN identifier, and the decryption information.
  • the authentication code generates a message authentication code based on the key of the CAN identifier, the random number, the decryption count value of the CAN identifier, and the decrypted data of the CAN message. If it is determined that the decrypted information authentication code and the generated information authentication code are consistent, And if the decryption count value of the CAN identifier is legal, it is determined that the decrypted data of the CAN message is legal.
  • the decryption count value of the identifier may be understood as the decryption count value of the CAN identifier being the same as the preset count value, and the preset count value may be the CAN identifier used in the process of obtaining the encrypted authentication CAN message. Count value.
  • the decryption count value of the CAN identifier may also be understood to be that the decryption count value of the CAN identifier is within a preset tolerance of the count value.
  • the allowed error range can be pre-configured during the initial setup phase of the CAN bus safety communication system parameters. Among them, the error range can be set according to different security levels. Among them, the error range with higher security level requirement is relatively smaller than the error range with lower security level requirement.
  • a CAN bus ECU that transmits a CAN message in a CAN bus safety communication system is referred to as a first CAN bus ECU
  • a CAN bus ECU that receives a CAN message in a CAN bus safety communication system is referred to as a first Two CAN bus ECUs.
  • the first CAN bus ECU and the second CAN bus ECU may generate a first generation key based on the random number and the key of the CAN identifier, and based on the first generation key, the random number
  • the value of the CAN identifier and the data of the CAN message generate the information authentication code to further improve the system security and resist the replay attack.
  • the random number used in the encryption authentication process performed by the first CAN bus ECU and the second CAN bus ECU in the embodiment of the present application may be generated and transmitted by the gateway ECU.
  • the gateway ECU can transmit a random number in a manner such as broadcasting.
  • the gateway ECU may also perform encryption authentication on the random number by using an encryption authentication process similar to the above-mentioned CAN message encryption authentication process to obtain an encrypted authentication random number. For example, the gateway ECU obtains a random number transmission key based on the key of the CAN identifier and the CAN message set in the transmitted CAN message. The gateway ECU generates a random number information authentication code based on the random number transmission key and the random number to be transmitted, and transmits the key to the random number and the CAN message set in the sent CAN message. Encryption operation to get the result of the encryption operation. The gateway ECU performs an equal-length encryption operation on the encryption operation result, the random number information authentication code, and the transmitted random number to obtain an encrypted authentication random number. The gateway ECU may send the encrypted authentication random number to a CAN bus ECU in a CAN bus secure communication system. The gateway ECU may transmit the encrypted authentication random number in a manner such as broadcast.
  • the gateway ECU may obtain the random number transmission key based on the initial default CAN message and the key of the CAN identifier.
  • the CAN identifier used by the gateway ECU to transmit the CAN message is referred to as a second CAN identifier for convenience of description, and the CAN bus security communication system may pre-configure the key for the second CAN identifier.
  • the CAN message used in the process of generating the random number transmission key by the gateway ECU is referred to as a third CAN message.
  • the third CAN message may be a historical CAN message of the gateway ECU. Specifically, if the random number to be sent by the gateway ECU is the first random number sent by the gateway ECU, the historical CAN message of the gateway ECU is an initial default CAN message pre-allocated by the CAN bus safety communication system to the gateway ECU.
  • the historical CAN message of the gateway ECU is a CAN message set in the CAN message that the gateway ECU has completed using the second CAN identifier. .
  • the CAN bus ECU that receives the encrypted authentication random number can verify the legitimacy of the received random number.
  • the CAN bus ECU that receives the encrypted authentication random number may obtain a random number transmission key based on the key of the second CAN identifier of the gateway ECU and the third CAN message.
  • the gateway ECU may send a key based on the random number obtained by the third CAN message and the second CAN identifier, and is referred to as a first random number transmission key, and the CAN bus ECU is used.
  • the obtained random number transmission key is referred to as a second random number transmission key.
  • the CAN bus ECU receiving the encrypted authentication random number performs encryption operation on the second random number transmission key and the third CAN message to obtain an encryption operation result, and performs the obtained encryption operation result and the encrypted authentication random number.
  • the equal-length decryption operation obtains the information authentication code after the random number decryption.
  • the CAN bus ECU encrypts the second random number transmission key and the third CAN message to obtain an encryption operation.
  • the result of the encryption operation is called the result of the third encryption operation.
  • the information authentication code obtained by decrypting the random number obtained by the CAN bus ECU by performing the equal-length decryption operation on the third encryption operation result and the encrypted authentication random number is referred to as a first random number decryption information authentication code.
  • the CAN bus ECU that has received the encrypted authentication random number can generate a random number information authentication code based on the random number and the second random number transmission key transmitted by the gateway ECU, and is hereinafter referred to as a second random number information authentication code.
  • the CAN bus ECU receiving the encrypted authentication random number can verify the validity of the random number transmitted by the gateway ECU by determining whether the first random number decryption information authentication code and the second random number information authentication code are identical. If the first random number decryption information authentication code and the second random number information authentication code are consistent, if the random number law sent by the gateway ECU is determined, the transmitted random number may be used to perform the CAN report. Text authentication and encryption to further improve security.
  • the CAN message transmitted between each CAN bus ECU and between the CAN bus ECU and the gateway ECU can be encrypted and authenticated to prevent the malicious attacker from eavesdropping, injecting and weighting the CAN message. Put an attack.
  • the CAN bus security communication system needs to perform pre-configuration of parameters in order to implement the secure communication method involved in the foregoing embodiment.
  • the key associated with the CAN identifier and the system initial default value need to be pre-configured for each CAN identifier.
  • the initial default value of the system can be understood as a set of strings, which can be understood as, for example, the above embodiments.
  • the initial default CAN message is directed to a gateway ECU that needs to be pre-configured with a second CAN identifier, which can be understood as a CAN identifier used by the gateway ECU to transmit CAN messages on each CAN bus.
  • a second CAN identifier it is also necessary to pre-configure the corresponding key and the system initial default value (initial default CAN message).
  • the gateway ECU and all the CAN bus ECUs that have information interaction with the gateway ECU need to configure the key of the second CAN identifier and the initial default CAN message of the gateway ECU, so that the CAN bus ECU can be implemented. Random number legality verification.
  • the CAN bus ECU that sends and receives a CAN message of a certain CAN identifier is also required to configure the key of the CAN identifier and the initial default CAN message of the CAN bus ECU, so as to send the CAN message.
  • the CAN bus ECU encrypts and transmits the transmitted CAN message, so that the CAN bus ECU that receives the encrypted authentication CAN message verifies the validity of the CAN message.
  • it is also required to configure a count value of the CAN identifier for each ECU, wherein the error range of the count value may also be configured to verify the validity of the decrypted count value.
  • FIG. 8 is a schematic diagram of pre-configuration parameters of a CAN bus security communication system according to an embodiment of the present application.
  • the CAN bus safety communication system includes a gateway ECU and five CAN bus ECUs including ECU 1, ECU 2, ECU 3, ECU 4, and ECU 5.
  • the gateway ECU in the CAN bus safety communication system configures the second CAN identifier CID B , the key K B and the initial default message IV B
  • the second ECU identifier needs to be configured in both the gateway ECU and the five CAN bus ECUs.
  • CID B corresponding to the key K B and the initial default packets IV B.
  • FIG. 9 is a flowchart of implementing a CAN bus security communication method according to the present application. Referring to FIG. 9, the method includes:
  • the gateway ECU generates and transmits a random number.
  • the gateway ECU may generate a random number R according to a certain frequency and periodically send through the CAN bus. This random number is to each CAN bus ECU in the CAN bus safety communication system.
  • the gateway ECU can transmit the random number to each CAN bus ECU in the CAN bus safety communication system by means of periodic broadcast.
  • the encrypted authentication random number may be sent in the form of a CAN message.
  • the data flow of the encrypted authentication random number may be generated by using the method flow shown in FIG. 10.
  • the gateway ECU generates a first random number transmission key by using a key generation algorithm based on the key K B and the third CAN message corresponding to the second CAN identifier CID B.
  • the gateway ECU generates a first random number information authentication code ⁇ based on the first random number transmission key and the transmitted random number (the newly generated random number R i+1 ), using the information authentication code generation algorithm and the length adjustment algorithm.
  • the gateway ECU performs an encryption operation based on the first random number transmission key and the third CAN message by using an encryption algorithm such as a block encryption algorithm to obtain a second encryption operation result.
  • the gateway ECU performs an equal-length encryption operation on the second encryption operation result, the first random number information authentication code, and the transmitted random number to obtain an encrypted authentication random number, for example, the second encryption operation
  • the first random number information authentication code and the transmitted random number are XORed to obtain a data area of an encrypted authentication random number whose operation result is 8 bytes in length, and the data area of the encrypted authentication random number is obtained. It is placed in the CAN message data area for transmission.
  • the third CAN message is the initial default CAN message of the gateway ECU, if the transmitted random number (the newly generated random number R i+1 ) is a non-first random number, and the third CAN message is set in the CAN message that the gateway ECU has completed using the second CAN identifier. CAN message.
  • the CAN message set in the CAN message that the gateway ECU uses to send the second CAN identifier in the embodiment of the present application may be the previous one adjacent to the CAN message currently sent by using the second CAN identifier.
  • the CAN message may also be the first two CAN messages, or may be any completed CAN message, which is not limited in the embodiment of the present application, and the third CAN message used by the gateway ECU and the CAN bus ECU remains. Consistent.
  • the CAN message set in the CAN message that the gateway ECU has completed using the second CAN identifier may be set to use the second CAN identifier.
  • the previous CAN message adjacent to the currently transmitted CAN message may be set to use the second CAN identifier.
  • the first CAN bus ECU acquires a random number sent by the gateway ECU, and verifies the legality of the obtained random number.
  • the step of verifying the validity of the random number in the embodiment of the present application is an optional step. Wherein, if the gateway ECU encrypts the transmitted random number and sends the encrypted authentication random number to the CAN bus ECU, the implementation process of verifying the validity of the random number in the step S102 may be included.
  • the first CAN bus ECU can be understood as an ECU that transmits a CAN message. It can be understood that the CAN bus ECU that obtains the random number sent by the gateway ECU in the embodiment of the present application does not only have the first CAN bus ECU, and the second ECU also receives the random number sent by the gateway ECU.
  • the implementation flow of verifying the validity of the random number by the first CAN bus ECU is described, and the implementation process of verifying the validity of the random number of the second CAN bus ECU and the first CAN bus ECU verifying the random number law The implementation process of the sex is the same and will not be described here.
  • FIG. 11 is a schematic flowchart of an implementation process of verifying the validity of a random number of an encrypted authentication by a first CAN bus ECU according to an embodiment of the present application.
  • the first ECU CAN bus based on a second key K B and the third CAN CAN message identifier CID B, the transmitted random number to obtain a second key.
  • the third CAN message can be understood as a set CAN message in a CAN message sent using CID B. If there is no CAN message sent using CID B , the third CAN message is the initial default message IV B .
  • the first CAN bus ECU performs an encryption operation based on the second random number transmission key and the third CAN message by using a block encryption algorithm to obtain a random number encryption operation result.
  • the first CAN bus ECU generates a second random number information authentication code ⁇ ′ based on the random number sent by the gateway ECU and the second random number transmission key, and the third encryption operation result and the encrypted authentication random number
  • An equal-length decryption operation (for example, an exclusive-OR operation) is performed to obtain the random number (R i+1 ) transmitted by the gateway ECU and the first random number information authentication code ⁇ .
  • the first CAN bus ECU determines whether the first random number information authentication code ⁇ and the second random number information authentication code ⁇ ′ are consistent, if the first random number information authentication code ⁇ and the second random number information authentication code ⁇ ′ Consistently, the random number law sent by the gateway ECU is determined.
  • the legal random number can be recorded, so as to be used in the subsequent encryption and authentication process of the CAN message.
  • the first CAN bus ECU generates a first information authentication code based on a key of the first CAN identifier, a random number sent by the gateway ECU, a count value of the first CAN identifier, and data of the first CAN message.
  • the first CAN bus ECU can be understood as an ECU that sends a CAN message
  • the first CAN message can be understood as a CAN message to be sent by the first CAN bus ECU, the first CAN identifier. It can be understood as the CAN identifier used by the first CAN bus ECU to transmit the first CAN message.
  • the first CAN bus ECU performs an encryption operation based on the key of the first CAN identifier and the second CAN message to obtain a first encryption operation result, and the first encryption operation result and the first information.
  • the authentication code, the count value of the first CAN identifier, and the data of the first CAN message are subjected to equal-length encryption operations to obtain a first CAN message encrypted and authenticated.
  • FIG. 12 is a schematic diagram showing an implementation process of a first CAN message generated by a first CAN bus ECU for generating an encrypted authentication according to an embodiment of the present application.
  • the first CAN bus ECU generates a first generation key using a key generation algorithm based on the random number transmitted by the gateway ECU and the key K A of the first CAN message identifier CID A.
  • the first CAN bus ECU generates an information authentication code based on the first generation key, a random number transmitted by the gateway ECU, the count value T A of the first CAN identifier, and the data of the first CAN message data area, and undergoes a length adjustment algorithm.
  • the first information authentication code ⁇ is generated.
  • the first CAN bus ECU performs an encryption operation based on the first generation key and the second CAN message by using, for example, a block encryption algorithm to obtain a first encryption operation result, and the first encryption operation result, the first
  • the information authentication code ⁇ , the count value T A of the first CAN identifier, and the data of the first CAN message data area are subjected to equal-length encryption operations (for example, exclusive-OR operations) to obtain an operation result of 8 bytes in length.
  • the data area of the first CAN message is encrypted and authenticated, and the data area of the first CAN message encrypted and authenticated is placed in the CAN message data area for transmission.
  • the second CAN message as the initial default ECU first CAN bus CAN message IV A. If the first CAN message is a non-first CAN message sent by using the first CAN identifier CID A , the second CAN message is completed by using the first CAN identifier CID A to send a CAN message.
  • the CAN message set in the text.
  • the first CAN identifier CID A is used to complete the CAN message set in the CAN message, and the CAN message set in the CAN message may be the sent CAN message and the first CAN message.
  • the previous CAN message adjacent to the text may also be the first two adjacent CAN messages, or may be any transmitted CAN message, which is not limited in the embodiment of the present application, the gateway ECU and the CAN bus.
  • the second CAN message used by the ECU can be kept consistent.
  • the first CAN identifier may be configured as a CAN message sent in the sent CAN message as being sent in the CAN message.
  • the previous CAN message adjacent to the first CAN message may be configured as a CAN message sent in the sent CAN message as being sent in the CAN message.
  • the first CAN bus ECU sends the encrypted first authentication CAN message, and the second CAN bus ECU receives the encrypted first authentication CAN message.
  • FIG. 13 is a schematic diagram showing the implementation process of verifying the legality of the first CAN message of the second CAN bus ECU in the embodiment of the present application.
  • the second CAN bus ECU in FIG. 13 decrypts the encrypted first authentication CAN message to obtain a first decryption information authentication code ⁇ , decryption data of the first CAN message, and first decryption of the first CAN identifier. Count value.
  • the CAN bus ECU acquires a random number (first random number used by the gateway ECU) transmitted from the gateway ECU, based on a first identifier CID A CAN key K A, the random number, the first CAN identifier A decryption count value and decrypted data of the first CAN message generate a second information authentication code ⁇ '.
  • the first decryption count value of the first CAN identifier is legal, that is, the first decryption count value of the first CAN identifier is within a preset error value tolerance range.
  • the pre-configured count value allows the error range to be up and down by three values, and if the first decrypted count value is the count value T A of the first CAN identifier, or is within the range of T A ⁇ 3, the first The decryption count value is legal.
  • the second CAN bus ECU may continue the subsequent processing. If it is determined that the first CAN message of the encrypted authentication is invalid, the CAN message may be discarded.
  • the first CAN bus ECU in the process of encrypting the CAN message and generating the information authentication code, the first CAN bus ECU not only uses the data of the message to be sent, but also uses the random number and the count value.
  • the CAN message set in the CAN message has been sent, so even if the same data value is injected, the generated information authentication code and the encryption operation structure are different, so the CAN bus ECU sends the encrypted authentication CAN message, which can resist the replay attack.
  • the data of the transmitted CAN message data area can simultaneously resist the eavesdropping attack, injecting attacks and replaying attacks, and the security is high.
  • the information authentication code can be understood as being directly embedded in the CAN message data area, without using another CAN message loading, the transmission overhead is low, and the overall design does not modify the CAN transceiver hardware, and can be applied to the existing CAN. Bus system.
  • the first CAN bus ECU and the second CAN bus ECU perform key generation processing on the key of the first CAN identifier by using a random number sent by the gateway ECU, so that the key used each time is more It is random and can improve the security of CAN message transmission more effectively.
  • the solution provided by the embodiment of the present application is mainly introduced from the perspective of interaction between the gateway ECU, the first CAN bus ECU and the second CAN bus ECU. It can be understood that the gateway ECU, the first CAN bus ECU and the second CAN bus ECU comprise corresponding hardware structures and/or software modules for performing the respective functions in order to realize the above functions.
  • the embodiments of the present application can be implemented in a combination of hardware or hardware and computer software in combination with the elements of the examples and algorithm steps described in the embodiments disclosed in the application. Whether a function is implemented in hardware or computer software to drive hardware depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the technical solutions of the embodiments of the present application.
  • the embodiment of the present application may divide the functional unit of the gateway ECU, the first CAN bus ECU, and the second CAN bus ECU according to the foregoing method example.
  • each functional unit may be divided according to each function, or two or More than two functions are integrated in one processing unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logical function division. In actual implementation, there may be another division manner.
  • FIG. 14 shows a schematic structural diagram of a CAN bus safety communication device 100 applied to a first CAN bus ECU.
  • the bus safety communication device 100 includes a receiving unit 101, a processing unit 102, and a transmitting unit 103, wherein the receiving unit 101 is configured to acquire a random number transmitted by the gateway ECU.
  • the processing unit 102 is configured to generate a first information authentication code based on a key of the first CAN identifier, a count value of the first CAN identifier, data of the first CAN message, and a random number acquired by the receiving unit 101, where
  • the first CAN identifier is a CAN identifier of the first CAN message; and the second CAN message is encrypted according to the key of the first CAN identifier to obtain a first encryption operation.
  • the first encryption operation result, the first information authentication code, the count value of the first CAN identifier, and the data of the first CAN message are subjected to the same length encryption operation to obtain an encrypted authentication.
  • the sending unit 103 is configured to send the first CAN message of the encrypted authentication generated by the processing unit 102.
  • the key of the first CAN identifier is pre-allocated by the CAN bus security communication system for the first CAN identifier, and the count value of the first CAN identifier is used to transmit the CAN message according to the first CAN bus ECU using the first CAN identifier.
  • the quantity is determined and varies according to the change of the number of CAN messages transmitted by the first CAN bus ECU using the first CAN identifier, the first CAN message is a message to be sent by the first CAN bus ECU, and the first CAN bus ECU The first CAN message is transmitted using a first CAN identifier.
  • the second CAN message is a historical CAN message of the first CAN bus ECU.
  • the historical CAN message of the first CAN bus ECU may be the first CAN bus safety communication system.
  • the initial default CAN message pre-assigned by the CAN identifier.
  • the historical CAN message of the first CAN bus ECU may be the first CAN identifier used by the first CAN bus ECU The CAN message set in the CAN message that has been sent has been completed.
  • the receiving unit 101 is further configured to acquire a third CAN message, a second CAN identifier, and an encrypted authentication random number sent by the gateway ECU.
  • the processing unit 102 is further configured to: obtain a second random number sending key, based on the key of the second CAN identifier and the third CAN message received by the receiving unit 101; And performing a cryptographic operation on the second random number transmission key and the third CAN message to obtain a third cryptographic operation result; and performing equal length on the third cryptographic operation result and the cryptographically authenticated random number acquired by the acquiring unit Decrypting operation to obtain a first random number decryption information authentication code; generating a second random number information authentication code based on the random number and the second random number transmission key sent by the gateway ECU; if the first random number And the decryption information authentication code and the second random number information authentication code are consistent, and determining the random number law sent by the gateway ECU acquired by the receiving unit 101.
  • the gateway ECU sends a CAN message to the at least one CAN bus ECU using the second CAN identifier, and the key of the second CAN identifier is pre-allocated by the CAN bus secure communication system for the second CAN identifier.
  • the third CAN message is a historical CAN message of the gateway ECU.
  • the historical CAN message of the gateway ECU is an initial default CAN message pre-allocated by the CAN bus safety communication system to the gateway ECU. If the random number to be sent by the gateway ECU is a non-first random number sent by the gateway ECU, the history CAN of the gateway ECU The message is a CAN message set in the CAN message that the gateway ECU has completed using the second CAN identifier.
  • the processing unit 102 may obtain a first generation key based on the random number and a key of the first CAN identifier, and based on the count value of the first CAN identifier, the first CAN report.
  • the data of the text, the first generation key, and the random number generate a first information authentication code.
  • the CAN message set in the transmitted CAN message is completed using the first CAN identifier, and the previous message adjacent to the first CAN message in the sent CAN message is CAN message.
  • the processing unit 102 may be a processor, and the receiving unit 101 and the transmitting unit 103 may be transceivers.
  • the processing unit 102 is a processor, and the receiving unit 101 and the transmitting unit 103 are transceivers, the processing unit 102 is applied to the transceiver.
  • the CAN bus safety communication device 100 of the first CAN bus ECU can adopt the structure of the CAN bus ECU in the CAN bus safety communication system shown in FIG.
  • the CAN bus safety communication device 100 employing the CAN bus ECU structure shown in FIG. 3 may be the first CAN bus ECU.
  • FIG. 15 shows a schematic structural diagram of a CAN bus safety communication device 200 applied to a second CAN bus ECU.
  • the bus secure communication device 200 includes a receiving unit 201 and a processing unit 202.
  • the receiving unit 201 is configured to obtain the first CAN message encrypted and authenticated and the random number sent by the gateway ECU.
  • the processing unit 202 is configured to decrypt the first CAN message of the encrypted authentication acquired by the receiving unit 201 to obtain a first decryption information authentication code, decryption data of the first CAN message, and a first CAN identifier.
  • the first decryption count value of the first CAN identifier is legal, that is, the first decryption count value of the first CAN identifier is within a preset count value tolerance range.
  • the processing unit 202 is based on the key of the first CAN identifier, the random number, the first decrypted count value of the first CAN identifier, and the first CAN message.
  • Decrypting data to generate a second information authentication code obtaining a first generation key based on a random number sent by the gateway ECU and a key of the first CAN identifier, and transmitting, according to the first generation key, the gateway ECU The random number, the first decrypted count value of the first CAN identifier, and the decrypted data of the first CAN message generate a second information authentication code.
  • the processing unit 202 may be a processor
  • the receiving unit 201 may be a transceiver
  • the CAN bus is applied to the second CAN bus ECU.
  • the secure communication device 200 can adopt the structure of the CAN bus ECU in the CAN bus safety communication system shown in FIG.
  • the CAN bus safety communication device 200 employing the CAN bus ECU structure shown in FIG. 3 may be a second CAN bus ECU.
  • FIG. 16 shows a schematic structural diagram of a CAN bus security communication device 300 applied to a gateway ECU.
  • the CAN bus security communication device 300 applied to the gateway ECU includes Processing unit 301 and transmitting unit 302.
  • the processing unit 301 is configured to generate a random number.
  • the sending unit 302 is configured to send the random number generated by the processing unit 301 to the at least one CAN bus ECU.
  • the processing unit 301 can obtain a first random number transmission key based on the key of the second CAN identifier and the third CAN message; send the key based on the first random number and the random to be sent by the gateway ECU And generating a first random number information authentication code; performing a cryptographic operation on the first random number transmission key and the third CAN message to obtain a second cryptographic operation result; and performing the second cryptographic operation result and the The first random number information authentication code, the The random number to be transmitted is subjected to the same length encryption operation to obtain a random number for encryption authentication.
  • the transmitting unit 302 transmits the random number of the encrypted authentication generated by the processing unit 301 to the at least one CAN bus ECU.
  • the gateway ECU sends a CAN message to the at least one CAN bus ECU using the second CAN identifier, and the key of the second CAN identifier is pre-allocated by the CAN bus secure communication system for the second CAN identifier.
  • the third CAN message is a historical CAN message of the gateway ECU.
  • the historical CAN message of the gateway ECU is an initial default CAN message pre-allocated by the CAN bus safety communication system to the gateway ECU. If the random number to be sent by the gateway ECU is a non-first random number sent by the gateway ECU, the historical CAN message of the gateway ECU is a CAN message set in the CAN message that the gateway ECU has completed using the second CAN identifier. .
  • the CAN message set in the CAN message that has been sent using the second CAN identifier is the CAN message currently sent in the CAN message and the second CAN identifier is used. Adjacent previous CAN message.
  • the processing unit 301 may be a processor
  • the sending unit 302 may be a transceiver
  • the CAN bus security communication device is applied to the gateway ECU.
  • 300 can adopt the structure of the gateway ECU in the CAN bus safety communication system shown in FIG.
  • the CAN bus security communication device 300 employing the gateway ECU structure in the CAN bus security communication system shown in FIG. 3 may be a gateway ECU.
  • embodiments of the present application can be provided as a method, system, or computer program product. Therefore, the embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Moreover, embodiments of the present application 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, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG.
  • 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 device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Small-Scale Networks (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)

Abstract

一种控制器区域网总线安全通信方法、装置及系统,以有效的抵挡攻击者进行窃听﹑注入与重放攻击。网关ECU生成随机数并向至少一个CAN总线ECU发送随机数。第一CAN总线ECU,获取网关ECU发送的随机数,并基于第一CAN标识符的密钥、网关ECU发送的随机数、第一CAN标识符的计数值、第一CAN报文的数据,生成第一信息认证码。第一CAN总线ECU基于第一CAN标识符的密钥和第二CAN报文进行加密运算,以得到第一加密运算结果,并对第一加密运算结果、第一信息认证码、第一CAN标识符的计数值、第一CAN报文的数据进行等长加密运算,以得到加密认证的第一CAN报文,发送所述加密认证的第一CAN报文。

Description

一种控制器区域网总线安全通信方法、装置及系统
本申请要求在2017年5月25日提交中国专利局、申请号为201710381307.4、发明名称为“一种控制器区域网总线安全通信方法、装置及系统”及2017年9月20日提交中国专利局、申请号为201710854489.2、发明名称为“一种控制器区域网总线安全通信方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,尤其涉及一种控制器区域网(Controller Area Network,CAN)总线安全通信方法、装置及系统。
背景技术
CAN通信协议定义了物理层(Physical Layer,PHY)与数据链路层(Data Link Layer,DLL)的数据传输标准,是一个广播型态的传输信道,且被广泛应用,例如被广泛地被运用在车内通信当中。
基于CAN通信协议进行通信的CAN通信网络架构中,一个中央网关电子控制单元(Electronic Control Unit,ECU)通过CAN总线系统连接多个ECU,其中,CAN总线系统中可包括多个CAN总线,每个CAN总线中的多个ECU通过其它CAN总线以及中央网关ECU互相连接,并进行各自业务与信息的收发。例如图1所示的应用于车内通信的CAN通信网络架构中,一个中央网关ECU连接多个负责车内功能业务的CAN总线(动力传动系统CAN总线、舒适系统CAN总线、诊断系统CAN总线以及信息娱乐系统CAN总线)。负责车内功能业务的每个CAN总线中的多个ECU通过其它CAN总线以及中央网关ECU互相连接,并进行各自业务与信息的收发。例如,动力传动系统可以实时侦测引擎转速并将引擎转速值传送到动力传动系统CAN总线,通过该动力传动系统CAN总线可将该引擎转速值传送给仪表板ECU,仪表板ECU收到引擎转速值后,可在仪表板上实时显示该引擎转速值。
目前,基于CAN通信协议进行通信过程中,恶意攻击者可以通过对通信过程中传输的CAN报文(frame)进行窃听,注入或重放攻击,对CAN总线系统进行有效攻击。例如,应用于车内通信的CAN通信系统中通过图2所示的原始CAN报文传送引擎转速数值,图2中标识为0x123的原始CAN报文中通过字节0~字节7的值可表示引擎转速数值,例如字节0和字节1表示的引擎转速数值为0x5DC=1500RPM,若攻击者通过窃听获取到该原始CAN报文,解析出CAN报文格式,针对攻击目标(引擎转速数值)注入错误的数值,例如图2中植入篡改的CAN报文中将引擎转速数值修改为0x1F40=8000RPM,则仪表板在接收到该植入篡改的CAN报文后,解析得到引擎转速数值为0x1F40=8000RPM,使得仪表板接收并且显示的引擎转速数值为错误的数值。
为抵挡攻击者对CAN报文的窃听,注入或重放攻击,目前存在一些对CAN报文进行认证或加密的机制,例如,一种机制中,可使用一个密钥对CAN报文的数据(CAN报文标识符、对应CAN标识符的计数器值以及该CAN报文标识符对应的CAN报文中的数据)进行加密运算并生成信息验证码,然后通过额外的CAN报文传输该信息验证码,但此种方法对于要传输的CAN报文中的数据仍是未被加密处理的,故此种方式并不能抵挡窃听,只是可以 抵挡重放攻击,并且通过额外的CAN报文传输信息验证码,传输开销较大。再例如,另一种机制中,针对CAN报文标识符对应的CAN报文中的数据先计算一组循环冗余校验(Cyclic Redundancy Check,CRC)值,然后将数据与CRC值串联后使用密钥进行加密,然而由于CRC值不具有随机性,若攻击者获取到合法的CRC值,则仍可进行重放攻击。又例如,又一种机制中,通过运用非标准的CAN收发器硬件将信息认证码镶嵌于较高的收发物理频率中,与标准CAN报文同时传送,实现对CAN报文的信息认证机制且采用信息认证码技术。由于使用非标准的CAN收发器硬件,需要对CAN收发器硬件进行修改,无法直接应用于现有的CAN总线通信系统中。
故,提供一种有效的基于CAN总线进行安全通信的方法,以抵挡攻击者进行窃听﹑注入与重放攻击,势在必行。
发明内容
本申请实施例提供一种CAN总线安全通信方法、装置及系统,以有效的抵挡攻击者进行窃听﹑注入与重放攻击。
第一方面,提供一种CAN总线安全通信系统,该CAN总线安全通信系统中包括网关ECU、与所述网关ECU相连接的至少一个CAN总线;其中,每个CAN总线上连接有至少一个CAN总线ECU,所述至少一个CAN总线ECU中包括第一CAN总线ECU。其中,网关ECU用于生成随机数并通过所述至少一个CAN总线向至少一个CAN总线ECU发送生成的随机数。第一CAN总线ECU用于获取网关ECU发送的所述随机数,并基于第一CAN标识符的密钥、网关ECU发送的随机数、第一CAN标识符的计数值、第一CAN报文的数据,生成第一信息认证码。第一CAN总线ECU还用于基于第二CAN报文和所述第一CAN标识符的密钥进行加密运算,以得到第一加密运算结果,对第一加密运算结果、第一信息认证码、第一CAN标识符的计数值、第一CAN报文的数据进行等长加密运算,以得到加密认证的第一CAN报文,并发送加密认证的第一CAN报文。
其中,第一CAN标识符的密钥由CAN总线安全通信系统为第一CAN标识符预先分配,第一CAN标识符的计数值根据第一CAN总线ECU使用第一CAN标识符传输CAN报文的数量确定,且随第一CAN总线ECU使用第一CAN标识符传输CAN报文的数量的变化而变化,第一CAN报文为第一CAN总线ECU待发送的报文,且第一CAN总线ECU使用第一CAN标识符发送所述第一CAN报文。
其中,第二CAN报文为第一CAN总线ECU的历史CAN报文。
具体的,若第一CAN报文为第一CAN总线ECU使用第一CAN标识符发送的首个CAN报文,则第一CAN总线ECU的历史CAN报文可以为CAN总线安全通信系统为第一CAN标识符预先分配的初始默认CAN报文。若第一CAN报文为第一CAN总线ECU使用第一CAN标识符发送的非首个CAN报文,则第一CAN总线ECU的历史CAN报文可以为第一CAN总线ECU使用第一CAN标识符已完成发送的CAN报文中设定的CAN报文。
一种可能的设计中,第一CAN总线ECU使用第一CAN标识符已完成发送的CAN报文中设定的CAN报文为第一CAN总线ECU使用第一CAN标识符已完成发送的CAN报文中与第一CAN报文相邻的前一则CAN报文,以减少存储开销。
本申请实施例中,第一CAN总线ECU对CAN报文的加密运算过程以及生成信息认 证码过程中,不仅使用待发送报文的数据,还使用率随机数、计数值以及已发送CAN报文中设定的CAN报文,故即使注入相同的数据值,生成的信息认证码和加密运算结构也不同,故CAN总线ECU发送加密认证CAN报文,可以抵挡重放攻击,并由于结合了加密与认证双重过程,使传输的CAN报文数据区的数据可同时抵挡窃听攻击,注入攻击与重放攻击,安全度较高。并且信息认证码可理解为是直接镶嵌于CAN报文数据区中的,不使用另外CAN报文装载,传输开销较低,并且整体设计不修改CAN收发器硬件,可应用于目前已有的CAN总线系统。
其中,第一CAN总线ECU可基于随机数以及第一CAN标识符的密钥得到第一生成密钥,并基于第一生成密钥、随机数、第一CAN标识符的计数值、第一CAN报文的数据生成第一信息认证码,以进一步提高CAN报文传输的安全性。
其中,CAN总线安全通信系统中还包括第二CAN总线ECU,第二CAN总线ECU用于获取加密认证的第一CAN报文,并对加密认证的第一CAN报文进行解密,以得到第一解密信息认证码、第一CAN报文的解密数据、第一CAN标识符的第一解密计数值。第二CAN总线ECU获取网关ECU发送的随机数,并基于第一CAN标识符的密钥、网关ECU发送的随机数、第一CAN标识符的第一解密计数值、第一CAN报文的解密数据生成第二信息认证码。若第一解密信息认证码和所述第二信息认证码一致,且第一CAN标识符的第一解密计数值合法,则确定所述加密认证的第一CAN报文合法。
其中,第一CAN标识符的第一解密计数值合法是指第一CAN标识符的第一解密计数值在预设的计数值允许误差范围内,以根据安全级别不同设置不同的范围。
其中,第二CAN总线ECU可基于网关ECU发送的随机数以及第一CAN标识符的密钥,得到第一生成密钥,并基于第一生成密钥、网关ECU发送的随机数、第一CAN标识符的第一解密计数值、第一CAN报文的解密数据生成第二信息认证码。
一种可能的设计中,网关ECU可对随机数进行加密认证,例如网关ECU可基于第三CAN报文和第二CAN标识符的密钥,得到第一随机数发送密钥。网关ECU基于第一随机数发送密钥以及网关ECU待发送的随机数,生成第一随机数信息认证码,对第一随机数发送密钥以及第三CAN报文进行加密运算,以得到第二加密运算结果。网关ECU对第二加密运算结果、第一随机数信息认证码、待发送的随机数进行等长加密运算,以得到加密认证的随机数,并向所述至少一个CAN总线ECU,发送所述加密认证的随机数。
第一CAN总线ECU还用于获取第二CAN标识符、第三CAN报文加密认证的随机数。基于第二CAN标识符的密钥和第三CAN报文,得到第二随机数发送密钥;对第二随机数发送密钥以及第三CAN报文进行加密运算,以得到第三加密运算结果。第一CAN总线ECU对第三加密运算结果和加密认证的随机数进行等长解密运算,以得到第一随机数解密信息认证码;基于网关ECU发送的所述随机数与第二随机数发送密钥,生成第二随机数信息认证码;若第一随机数解密信息认证码和所述第二随机数信息认证码一致,则确定所述网关ECU发送的所述随机数合法。
其中,网关ECU使用第二CAN标识符向至少一个CAN总线ECU发送CAN报文,第二CAN标识符的密钥由CAN总线安全通信系统为第二CAN标识符预先分配。
其中,第三CAN报文为所述网关ECU的历史CAN报文。
具体的,若网关ECU待发送的随机数为网关ECU发送的首个随机数,则网关ECU的历史CAN报文为CAN总线安全通信系统为网关ECU预先分配的初始默认CAN报文。 若网关ECU待发送的随机数为网关ECU发送的非首个随机数,则网关ECU的历史CAN报文为网关ECU使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文。
一种可能的设计中,网关ECU使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文为网关ECU使用第二CAN标识符已完成发送的CAN报文中与网关ECU使用第二CAN标识符当前发送的CAN报文相邻的上一个CAN报文,以减少存储开销。
本申请实施例中网关ECU发送加密认证的随机数,第一CAN总线ECU验证接收到的随机数的合法性,能够进一步提高CAN总线安全通信系统中的安全性。
第二方面,提供一种CAN总线安全通信装置,该CAN总线安全通信装置可应用于第一CAN总线ECU。应用于第一CAN总线ECU的CAN总线安全通信装置具有实现上述第一方面以及第一方面任意设计中第一CAN总线ECU的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。所述模块可以是软件和/或硬件。
一种可能的设计中,应用于第一CAN总线ECU的CAN总线安全通信装置包括接收单元、处理单元和发送单元,其中,接收单元、处理单元和发送单元可以和上述第一CAN总线ECU执行的各功能步骤相对应,在此不予赘述。
另一种可能的设计中,应用于第一CAN总线ECU的CAN总线安全通信装置包括处理器,收发器和存储空间。存储空间(也可称为存储器)与处理器耦合,用于存储各种软件程序和/或多组指令。处理器调用存储空间的存储程序或指令执行上述第一CAN总线ECU执行的功能步骤,并控制收发器收发信号。
第三方面,提供一种CAN总线安全通信装置,该CAN总线安全通信装置可应用于第二CAN总线ECU。应用于第二CAN总线ECU的CAN总线安全通信装置具有实现上述第一方面以及第一方面任意设计中第二CAN总线ECU的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。所述模块可以是软件和/或硬件。
一种可能的设计中,应用于第二CAN总线ECU的CAN总线安全通信装置包括接收单元和处理单元,其中,接收单元和处理单元可以和上述第二CAN总线ECU执行的各功能步骤相对应,在此不予赘述。
另一种可能的设计中,应用于第二CAN总线ECU的CAN总线安全通信装置包括处理器,收发器和存储空间。存储空间(也可称为存储器)与处理器耦合,用于存储各种软件程序和/或多组指令。处理器调用存储空间的存储程序或指令执行上述第二CAN总线ECU执行的功能步骤,并控制收发器收发信号。
第四方面,提供一种CAN总线安全通信装置,该CAN总线安全通信装置可应用于网关ECU。应用于网关ECU的CAN总线安全通信装置具有实现上述第一方面以及第一方面任意设计中网关ECU的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。所述模块可以是软件和/或硬件。
一种可能的设计中,应用于网关ECU的CAN总线安全通信装置包括处理单元和发送单元,其中,处理单元和发送单元可以和上述网关ECU执行的各功能步骤相对应,在此不予赘述。
另一种可能的设计中,应用于网关ECU的CAN总线安全通信装置包括处理器,至少 一组收发器和存储空间。存储空间(也可称为存储器)与处理器耦合,用于存储各种软件程序和/或多组指令。处理器调用存储空间的存储程序或指令执行上述网关ECU执行的功能步骤,并控制所述至少一组收发器收发信号。
第五方面提供一种CAN总线安全通信方法,在该方法中,CAN总线ECU执行的各方法步骤与上述第一方面以及第一方面任意设计中的第一CAN总线ECU执行的各功能步骤相对应。
第六方面,提供一种CAN总线安全通信方法,在该方法中,CAN总线ECU执行的各方法步骤与上述第一方面以及第一方面任意设计中的第二CAN总线ECU执行的各功能步骤相对应。
第七方面,提供一种CAN总线安全通信方法,在该方法中,CAN总线ECU执行的各方法步骤与上述第一方面以及第一方面任意设计中的网关ECU执行的各功能步骤相对应。
第八方面,提供计算机存储介质,用于存储一些指令,这些指令被执行时,可以完成第一方面以及第一方面任意可能设计中的网关ECU、第一CAN总线ECU以及第二CAN总线ECU所涉及的任意一种功能。
第九方面,提供一种计算机程序产品,用于存储计算机程序,该计算机程序用于执行完成第一方面以及第一方面任意可能设计中的网关ECU、第一CAN总线ECU以及第二CAN总线ECU所涉及的任意一种功能。
本申请实施例提供的CAN总线安全通信方法、装置及系统,第一CAN总线ECU对CAN报文加密运算过程以及生成信息认证码过程中,不仅使用待发送报文的数据,还使用率随机数、计数值以及已发送CAN报文中设定的CAN报文,故即使注入相同的数据值,生成的信息认证码和加密运算结构也不同,故CAN总线ECU发送加密认证CAN报文,可以抵挡重放攻击,并由于结合了加密与认证双重过程,使传输的CAN报文数据区的数据可同时抵挡窃听攻击,注入攻击与重放攻击,安全度较高。并且信息认证码可理解为是直接镶嵌于CAN报文数据区中的,不使用另外CAN报文装载,传输开销较低,并且整体设计不修改CAN收发器硬件,可应用于目前已有的CAN总线系统。
进一步的,本申请实施例中,第一CAN总线ECU和第二CAN总线ECU使用网关ECU发送的随机数对第一CAN标识符的密钥进行密钥生成处理,使得每次使用的密钥更具有随机性,可更有效的提高CAN报文传输的安全性。
附图说明
图1为用于车内通信的CAN通信网络架构;
图2为车内通信的CAN通信网络中CAN报文被窃听并注入的示意图;
图3为本申请实施例提供的一种CAN总线安全通信系统;
图4为本申请实施例中涉及的CAN报文的格式示意图;
图5为本申请实施例中CAN总线安全通信系统中CAN标识符与计数值配置示意图;
图6为本申请实施例中CAN总线安全通信系统中配置CAN标识符对应密钥的一种示意图;
图7为本申请实施例中CAN总线安全通信系统中配置CAN标识符对应密钥的另一种示意图;
图8为本申请实施例中CAN总线安全通信系统预配置参数的示意图;
图9为本申请提供的一种CAN总线安全通信方法实施流程图;
图10为本申请实施例提供的产生加密认证随机数数据区的示意图;
图11为本申请实施例提供的验证加密认证随机数合法性的实施流程示意图;
图12为本申请实施例提供的产生加密认证CAN报文数据区的示意图;
图13为本申请实施例提供的验证加密认证CAN报文合法性的实施流程示意图;
图14为本申请实施例提供的一种CAN总线安全通信装置的结构示意图;
图15为本申请实施例提供的另一种CAN总线安全通信装置的结构示意图;
图16为本申请实施例提供的又一种CAN总线安全通信装置的结构示意图。
具体实施方式
下面将结合附图,对本申请实施例中的技术方案进行描述。
图3为本申请实施例提供的一种CAN总线安全通信系统。参阅图3所示,CAN总线安全通信系统中包括网关ECU、与所述网关ECU相连接的至少一个CAN总线;其中,每个CAN总线上连接有至少一个CAN总线ECU。网关ECU和CAN总线ECU中均具有进行运算处理的处理器、用于存储命令的内部存储空间以及进行信息发送与接收的收发器。其中,CAN总线ECU中通常可包括一组收发器,与一个CAN总线相连。网关ECU中可包括多组收发器,并与多个CAN总线相连。CAN总线可以理解为是CAN总线安全通信系统的发送通道,网关ECU可以通过与其连接的多个CAN总线进行信息的并行发送与接收。CAN总线ECU通过与其相连的CAN总线,进行信息的发送与接收。其中,各CAN总线ECU可与网关ECU进行通信,各CAN总线ECU之间也可进行通信。
需要说明的,图3所示CAN总线安全通信系统中的网关ECU以及CAN总线ECU的结构仅仅是本申请实施例的一种实现方式,实际应用中,网关ECU以及CAN总线ECU还可以包括更多或更少的部件,这里不作限制。
其中,收发器可通过实体CAN总线与其他收发器相互连接并通信。实体CAN总线使用CAN通信协议进行通信,所述CAN通信协议可包括但不限于:CAN2.0A,,CAN2.0B,CAN-FD(CAN flexible data-rate)。收发器还可能与其他通信设备使用不同的通信网络进行通信,如以太网(Ethernet),无线接入网(Radio Access Technology,RAN),无线局域网Wireless Local Area Networks,WLAN)等。具体实现中,通信接口304支持的通信协议可包括但不限于:2G/3G、长期演进(Long Term Evolution,LTE)、无线保真(Wireless-Fidelity,Wi-Fi)、5G新无线(New Radio,NR)等等。
存储空间(也可称为存储器)与处理器耦合,用于存储各种软件程序和/或多组指令。具体实现中,存储空间可包括高速随机存取的存储器,并且也可包括非易失性存储器,例如一个或多个磁盘存储设备、闪存设备或其他非易失性固态存储设备。存储空间可以存储CAN总线安全通信的操作系统。存储空间可用于存储本申请实施例的实现程序。存储空间还可以存储网络通信程序,该网络通信程序可用于与一个或多个附加设备,一个或多个终端设备,一个或多个网络设备进行通信。
处理器可以是一个通用中央处理器(Central Processing Unit,CPU),微处理器,特定应用集成电路(Application-Specific Integrated Circuit,ASIC),或一个或多个用于控制本申请方案程序执行的集成电路。
在一些实施例中,网关ECU以及CAN总线ECU还可以包括输出设备和输入设备。输出 设备和处理器通信,可以以多种方式来显示信息。例如,输出设备可以是液晶显示器(Liquid Crystal Display,LCD),发光二级管(Light Emitting Diode,LED)显示设备,阴极射线管(Cathode Ray Tube,CRT)显示设备,或投影仪(projector)等。输入设备和处理器通信,可以以多种方式接收用户的输入。例如,输入设备可以是鼠标、键盘、触摸屏设备或传感设备等。为了便于输出设备和输入设备的用户使用,在一些实施例中,存储器还可以存储用户接口程序,该用户接口程序可以通过图形化的操作界面将应用程序的内容形象逼真的显示出来,并通过菜单、对话框以及按键等输入控件接收用户对应用程序的控制操作。
目前,CAN总线通信协议规范了各CAN总线ECU之间,以及各CAN总线ECU与网关ECU之间进行通信过程中传输的CAN报文(frame)的格式。图4所示为CAN报文的格式示意图,参阅图4所示,CAN报文中包括报文头(start of frame,SOF),CAN标识符(Identifier),远程传输要求(RTR)码,控制区(Control),数据区(data),循环冗余校验(CRC),响应(ACK),报文结尾(end of frame,EOF)。其中,CAN标识符可用于标识不同的CAN报文,并有两种格式,分别是11字符与29字符。数据区在CAN标准中最多为8个字节。利用CAN总线通信协议进行通信过程中,发送者发出CAN报文,接收者按照CAN标识符选择要接收的CAN报文,一个CAN标识符所对应的CAN报文可以有两个以上的接收者。例如,图3中,CAN总线ECU1发送的CAN报文,可被CAN总线ECU2和CAN总线ECU3接收。
本申请实施例中,可对各CAN总线ECU之间,以及各CAN总线ECU与网关ECU之间传输的CAN报文进行加密与认证,以抵挡恶意攻击者对CAN报文的窃听﹑注入与重放攻击。
本申请实施例中,可为CAN总线安全通信系统中每个ECU(各CAN总线ECU以及网关ECU)预先配置计数器,通过计数器的计数值可实现可对每个CAN标识符的CAN报文保存一个计数值,每个CAN标识符的计数值可表征该CAN标识符的CAN报文已经在系统中传递的报文数,也可以理解为通过CAN标识符的计数值可标识当前传输的CAN报文。通常,CAN标识符的计数值根据CAN总线ECU使用CAN标识符传输CAN报文的数量确定,且随CAN总线ECU使用CAN标识符传输CAN报文的数量的变化而变化。一种可能的实施方式中,CAN标识符的计数值可通过滚动计数器(rolling counter)的计数值实现,假设CAN总线ECU使用CAN标识符传输CAN报文的数量为N,滚动计数器的计数值为n比特长,则CAN标识符的计数值可以N/(2n)后取模得到的数值。
例如图5中,发送CAN报文的ECU和接收CAN报文的ECU中均保存有对各CAN标识符报文的计数值,其中,保存计数值的表格中包括两列,第一列是CAN标识符,第二列是对应于CAN标识符的计数值,例如图5中,发送CAN报文的ECU中CAN标识符Ida的计数值为Ca,CAN标识符Idb的计数值为Cb,CAN标识符Idc的计数值为Cc。接收CAN报文的ECU中CAN标识符Idd的计数值为Cd,CAN标识符Ide的计数值为Ce,CAN标识符Idf的计数值为Cf
进一步的,本申请实施例中CAN总线安全通信系统还可针对每一CAN标识符配置对应的密钥,以通过该密钥进行加密与认证。本申请实施例中可针对不同的CAN标识符,使用阶层式架构产生密钥并进行配置。例如,可针对整个CAN总线安全通信系统先配置一个独立产生的根密钥,然后使用这个根密钥对不同的CAN总线生成CAN总线密钥,再使用CAN总线密钥对不同的CAN标识符生成CAN标识符的密钥,如图6所示。具体的,进行密钥配置时,可为网关ECU配置根密钥,为各CAN总线ECU分别配置相对应的CAN总线密钥,例如在CAN总线1上的ECU的密钥为CAN总线1密钥,并且CAN总线1可通过CAN总线1密钥,生成实际需要的CAN标识符相对应的密钥。本申请实施例中还可针对整个CAN总线安全通 信系统预先配置一个独立产生的根密钥,然后使用这个根密钥针对不同的CAN标识符生成不同的密钥,如图7所示,如图7所示。具体的,进行密钥配置时,可为每个ECU配置根密钥,ECU通过该根密钥可以生成实际需要的CAN标识符对应的密钥。通过使用阶层式架构产生密钥并进行配置的密钥配置方法可以降低各ECU储存密钥的空间需求方法。当然,本申请实施例中还可针对不同的CAN标识符,独立产生密钥与系统初始值并进行配置。
本申请实施例中,CAN总线安全通信系统中的CAN总线ECU可基于CAN标识符的密钥、标识符的计数值、随机数、待发送CAN报文数据区的数据生成信息认证码,基于CAN标识符的密钥以及CAN标识符已发送CAN报文中设定的CAN报文进行加密运算,并对加密运算结果、信息认证码、CAN标识符的计数值、待发送CAN报文数据区的数据进行等长加密运算,以使加密认证的CAN报文数据区的数据长度符合CAN总线通信协议规范的数据区长度,将加密认证后的CAN报文数据置于待发送报文的数据区进行发送。由于该加密认证的CAN报文加密运算过程以及生成信息认证码过程中,不仅使用待发送报文的数据,还使用率随机数、计数值以及已发送CAN报文中设定的CAN报文,故即使注入相同的数据值,生成的信息认证码和加密运算结构也不同,故CAN总线ECU发送加密认证CAN报文,可以抵挡重放攻击,并由于结合了加密与认证双重过程,使传输的CAN报文数据区的数据可同时抵挡窃听攻击,注入攻击与重放攻击,安全度较高。并且信息认证码可理解为是直接镶嵌于CAN报文数据区中的,不使用另外CAN报文装载,传输开销较低,并且整体设计不修改CAN收发器硬件,可应用于目前已有的CAN总线系统。
一种可能的示例中,若待发送的CAN报文为CAN标识符的首个报文,则CAN总线ECU可基于CAN标识符的密钥以及初始默认的CAN报文进行加密运算。其中,该初始默认的CAN报文可在CAN总线安全通信系统参数初始设置阶段进行预配置。
本申请实施例为描述方便,可将CAN总线ECU待发送的CAN报文称为第一CAN报文,CAN总线ECU发送第一CAN报文所使用的CAN标识符称为第一CAN标识符。将CAN总线ECU进行加密运算过程使用的CAN报文称为第二CAN报文。其中,第二CAN报文为第一CAN总线ECU的历史CAN报文。历史CAN报文可以理解为是在发送当前CAN之前已经存在的报文。
具体的,若第一CAN报文为第一CAN总线ECU使用第一CAN标识符发送的首个CAN报文,则第一CAN总线ECU的历史CAN报文可以为CAN总线安全通信系统为第一CAN标识符预先分配的初始默认CAN报文。若第一CAN报文为第一CAN总线ECU使用第一CAN标识符发送的非首个CAN报文,则第一CAN总线ECU的历史CAN报文可以为第一CAN总线ECU使用第一CAN标识符已完成发送的CAN报文中设定的CAN报文。
CAN总线安全通信系统中接收到加密认证CAN报文的CAN总线ECU,可对接收到的加密认证CAN报文进行解密,以得到CAN报文的解密数据、CAN标识符的解密计数值、解密信息认证码,并基于CAN标识符的密钥、随机数、CAN标识符的解密计数值、CAN报文的解密数据生成信息认证码,若确定解密得到的信息认证码和生成的信息认证码一致,且CAN标识符的解密计数值合法,则确定CAN报文的解密数据合法。
其中,标识符的解密计数值合法可以理解为是CAN标识符的解密计数值与预设的计数值相同,该预设的计数值可以是得到加密认证CAN报文过程中使用的CAN标识符的计数值。
一种可能的示例中,CAN标识符的解密计数值合法也可以理解为是CAN标识符的解密计数值在预设的计数值允许误差范围内。其中,该允许的误差范围可在CAN总线安全通信系统参数初始设置阶段进行预配置。其中,该误差范围可根据安全级别不同设置不同的范围。其中,安全级别要求较高的误差范围相对小于安全级别要求较低的误差范围。
本申请实施例中为描述方便,将CAN总线安全通信系统中发送CAN报文的CAN总线ECU称为第一CAN总线ECU,将CAN总线安全通信系统中接收CAN报文的CAN总线ECU称为第二CAN总线ECU。
一种可能的示例中,第一CAN总线ECU和第二CAN总线ECU可基于随机数和CAN标识符的密钥,生成第一生成密钥,并基于该第一生成密钥、所述随机数、CAN标识符的计数值、CAN报文的数据生成信息认证码,以进一步提高系统安全度,抵挡重放攻击。
又一种可能的示例中,本申请实施例上述第一CAN总线ECU和第二CAN总线ECU进行加密认证过程中所使用的随机数可由网关ECU生成并且发送。其中,网关ECU可采用诸如广播的方式发送随机数。
其中,网关ECU也可采用与上述CAN报文加密认证过程类似的加密认证过程对随机数进行加密认证,以得到加密认证随机数。例如,网关ECU基于CAN标识符的密钥和已发送CAN报文中设定的CAN报文,得到随机数发送密钥。所述网关ECU基于所述随机数发送密钥以及待发送的随机数,生成随机数信息认证码,并对所述随机数发送密钥,以及已发送CAN报文中设定的CAN报文进行加密运算,以得到加密运算结果。网关ECU对加密运算结果、随机数信息认证码、发送的随机数进行等长加密运算,以得到加密认证随机数。所述网关ECU可向CAN总线安全通信系统中的CAN总线ECU,发送所述加密认证随机数。其中,网关ECU可采用诸如广播的方式发送所述加密认证随机数。
其中,若网关ECU发送的随机数为首个随机数,则网关ECU可基于初始默认CAN报文和CAN标识符的密钥,得到随机数发送密钥。
本申请实施例中为描述方便可将网关ECU发送CAN报文使用的CAN标识符称为第二CAN标识符,CAN总线安全通信系统可为第二CAN标识符预先配置密钥。将网关ECU生成随机数发送密钥过程中使用的CAN报文称为第三CAN报文。其中,第三CAN报文可为网关ECU的历史CAN报文。具体的,若网关ECU待发送的随机数为网关ECU发送的首个随机数,则网关ECU的历史CAN报文为CAN总线安全通信系统为网关ECU预先分配的初始默认CAN报文。若网关ECU待发送的随机数为网关ECU发送的非首个随机数,则网关ECU的历史CAN报文为网关ECU使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文。
接收到加密认证随机数的CAN总线ECU可验证接收到的随机数的合法性。例如,接收到加密认证随机数的CAN总线ECU可基于网关ECU的第二CAN标识符的密钥和第三CAN报文,得到随机数发送密钥。本申请实施例中为描述方便,可将网关ECU基于第三CAN报文和第二CAN标识符的密钥得到的随机数发送密钥,称为第一随机数发送密钥,将CAN总线ECU基于第二CAN标识符的密钥和第三CAN报文,得到的随机数发送密钥,称为第二随机数发送密钥。接收到加密认证随机数的CAN总线ECU对所述第二随机数发送密钥以及所述第三CAN报文进行加密运算得到加密运算结果,并对得到的加密运算结果和加密认证的随机数进行等长解密运算,得到随机数解密后的信息认证码。为描述方便,将CAN总线ECU对所述第二随机数发送密钥以及所述第三CAN报文进行加密运算得到 的加密运算结果,称为第三加密运算结果。将CAN总线ECU对所述第三加密运算结果和所述加密认证的随机数进行等长解密运算得到的随机数解密后的信息认证码,称为第一随机数解密信息认证码。接收到加密认证随机数的CAN总线ECU基于所述网关ECU发送的所述随机数与第二随机数发送密钥,可生产随机数的信息认证码,以下称为第二随机数信息认证码。接收到加密认证随机数的CAN总线ECU通过判断第一随机数解密信息认证码和第二随机数信息认证码是否一致,可验证网关ECU发送的随机数的合法性。其中,若所述第一随机数解密信息认证码和所述第二随机数信息认证码一致,则确定所述网关ECU发送的所述随机数合法,则可利用该发送的随机数进行CAN报文的认证与加密,以进一步提高安全性。
本申请实施例中,可对各CAN总线ECU之间,以及各CAN总线ECU与网关ECU之间传输的CAN报文进行加密与认证,以抵挡恶意攻击者对CAN报文的窃听﹑注入与重放攻击。
以下将结合实际应用,对CAN总线安全通信系统进行安全通信的过程进行说明。
本申请实施例中CAN总线安全通信系统为实现上述实施方式中涉及的安全通信方法,需要进行参数的预配置。例如,需要针对每个CAN标识符预配置与该CAN标识符相的密钥以及系统初始默认值,该系统初始默认值可以理解为是一组字符串,例如可以理解为是上述实施例中涉及的初始默认CAN报文。本申请针对网关ECU需要预配置第二CAN标识符,该第二CAN标识符可以理解为是网关ECU在各CAN总线进行CAN报文发送所用的CAN标识符。针对第二CAN标识符,也需要预先配置对应的密钥与系统初始默认值(初始默认CAN报文)。
本申请实施例中,需要为网关ECU,以及所有与网关ECU有信息交互的CAN总线ECU配置第二CAN标识符的密钥以及网关ECU的初始默认CAN报文,以实现上述CAN总线ECU可以对随机数合法性验证。本申请实施例中还需要为发送和接收某一CAN标识符的CAN报文的CAN总线ECU配置该CAN标识符的密钥以及CAN总线ECU的初始默认CAN报文,以使发送CAN报文的CAN总线ECU对发送的CAN报文进行加密认证,使接收到加密认证CAN报文的CAN总线ECU对CAN报文的合法性进行验证。进一步的,本申请实施例中还需要为每个ECU配置CAN标识符的计数值,其中,还可配置计数值的误差范围,以验证解密计数值的合法性。
图8所示为本申请实施例中CAN总线安全通信系统预配置参数的示意图。例如图8中,CAN总线安全通信系统中包括网关ECU以及包括ECU1、ECU2、ECU3、ECU4和ECU5在内的五个CAN总线ECU。假设为CAN总线安全通信系统中的网关ECU配置第二CAN标识符CIDB、密钥KB和初始默认报文IVB,则网关ECU与五个CAN总线ECU中均需要配置第二CAN标识符CIDB对应的密钥KB和初始默认报文IVB。ECU1、ECU2与ECU3会进行CAN标识符CIDA的CAN报文的收发,假设为CAN标识符CIDA预先配置的密钥为KA,初始默认报文为IVA,则ECU1、ECU2与ECU3需要配置CAN标识符CIDA对应的密钥为KA和初始默认报文为IVA。进一步的,ECU1、ECU2与ECU3也需要配置CAN标识符CIDA对应的计数值TA
本申请实施例中CAN总线安全通信系统完成上述预配置后,可实施上述涉及的安全通信方法。
图9所示为本申请提供的一种CAN总线安全通信方法实施流程图,参阅图9所示,包括:
S101:网关ECU生成并发送随机数。
本申请实施例中,网关ECU可按照一定的频率产生随机数R并通过CAN总线定期发送 此随机数到CAN总线安全通信系统中的各CAN总线ECU。其中,网关ECU可采用定期广播的方式,将随机数发送至CAN总线安全通信系统中的各CAN总线ECU。
一种可能的实施方式中,网关ECU产生随机数之后,可以以CAN报文的形式发送该加密认证随机数。本申请实施例中可采用图10所示的方法流程产生加密认证随机数的数据区。图10中,网关ECU基于第二CAN标识符CIDB对应的密钥KB和第三CAN报文,采用密钥生成算法,生成第一随机数发送密钥。网关ECU基于第一随机数发送密钥以及发送的随机数(新产生的随机数Ri+1),采用信息认证码生成算法以及长度调整算法,生成第一随机数信息认证码σ。所述网关ECU基于所述第一随机数发送密钥以及第三CAN报文,采用诸如分块加密算法等加密算法进行加密运算,以得到第二加密运算结果。所述网关ECU对所述第二加密运算结果、所述第一随机数信息认证码、所述发送的随机数进行等长加密运算,以得到加密认证随机数,例如对所述第二加密运算结果、所述第一随机数信息认证码、所述发送的随机数进行异或运算,以得到运算结果为8字节长度的加密认证随机数的数据区,将该加密认证随机数的数据区置于CAN报文数据区进行传送。
本申请实施例中,若发送的随机数(新产生的随机数Ri+1)为首个随机数(R1),则所述第三CAN报文为网关ECU的初始默认CAN报文,若发送的随机数(新产生的随机数Ri+1)为非首个随机数,则所述第三CAN报文为网关ECU使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文。
其中,本申请实施例中网关ECU使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文可以是与使用第二CAN标识符当前发送的CAN报文相邻的前一则CAN报文,也可以是前两则CAN报文,或者也可以是任何已完成发送CAN报文,本申请实施例中并不限定,网关ECU和CAN总线ECU所使用的第三CAN报文保持一致即可。
本申请实施例中为减少存储开销,一种可能的实施方式中可将网关ECU使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文设置为与使用第二CAN标识符当前发送的CAN报文相邻的前一则CAN报文。
S102:第一CAN总线ECU获取所述网关ECU发送的随机数,验证获取到的随机数的合法性。
本申请实施例中验证随机数合法性的步骤为可选步骤。其中,若网关ECU对发送的随机数进行了加密认证,并向CAN总线ECU发送了加密认证随机数,则可包括S102步骤中验证随机数合法性的实施过程。
本申请实施例中,第一CAN总线ECU可以理解为是发送CAN报文的ECU。可以理解的是,本申请实施例中获取到网关ECU发送的随机数的CAN总线ECU并不是只有第一CAN总线ECU,第二ECU也会接收到网关ECU发送的随机数。本申请实施例中为描述方便,以第一CAN总线ECU验证随机数合法性的实施流程进行说明,对于第二CAN总线ECU验证随机数合法性的实施流程与第一CAN总线ECU验证随机数合法性的实施流程相同,在此不再赘述。
图11为本申请实施例第一CAN总线ECU验证加密认证随机数合法性的实施流程示意图。参阅图11所示,第一CAN总线ECU基于第二CAN标识符CIDB的密钥KB和第三CAN报文,得到第二随机数发送密钥。第三CAN报文可以理解为是使用CIDB发送的CAN报文中的设定CAN报文。若不存在使用CIDB发送的CAN报文,则第三CAN报文为初始默认报文IVB。第一CAN总线ECU基于所述第二随机数发送密钥以及所述第三CAN报文, 采用诸如分块加密算法进行加密运算,以得到随机数加密运算结果。第一CAN总线ECU基于所述网关ECU发送的随机数与第二随机数发送密钥,生成第二随机数信息认证码σ’,并对所述第三加密运算结果和所述加密认证随机数进行等长解密运算(例如异或运算),以得到所述网关ECU发送的所述随机数(Ri+1)以及所述第一随机数信息认证码σ。第一CAN总线ECU判断第一随机数信息认证码σ和第二随机数信息认证码σ’是否一致,若所述第一随机数信息认证码σ和所述第二随机数信息认证码σ’一致,则确定所述网关ECU发送的所述随机数合法。
本申请实施例中,第一CAN总线ECU验证随机数合法后,可记录该合法的随机数,以备后续对CAN报文进行加密认证过程中使用。
S103:第一CAN总线ECU基于第一CAN标识符的密钥、所述网关ECU发送的随机数、第一CAN标识符的计数值和第一CAN报文的数据,生成第一信息认证码。
本申请实施例中,第一CAN总线ECU可以理解为是发送CAN报文的ECU,第一CAN报文可以理解为是第一CAN总线ECU待发送的CAN报文,所述第一CAN标识符可以理解为是第一CAN总线ECU发送第一CAN报文使用的CAN标识符。
S104:第一CAN总线ECU基于所述第一CAN标识符的密钥和第二CAN报文进行加密运算,以得到第一加密运算结果,对所述第一加密运算结果、所述第一信息认证码、所述第一CAN标识符的计数值、所述第一CAN报文的数据进行等长加密运算,以得到加密认证的第一CAN报文。
图12所示为本申请实施例提供的第一CAN总线ECU生成加密认证的第一CAN报文的实施过程示意图。图12中,第一CAN总线ECU基于述网关ECU发送的随机数、第一CAN报文标识符CIDA的密钥KA,采用密钥生成算法生成第一生成密钥。第一CAN总线ECU基于该第一生成密钥、网关ECU发送的随机数、第一CAN标识符的计数值TA以及第一CAN报文数据区的数据生成信息认证码,并经过长度调整算法后生成第一信息认证码σ。第一CAN总线ECU基于该第一生成密钥以及第二CAN报文采用诸如分块加密算法进行加密运算,以得到第一加密运算结果,并对所述第一加密运算结果、所述第一信息认证码σ、所述第一CAN标识符的计数值TA、所述第一CAN报文数据区的数据进行等长加密运算(例如异或运算),以得到运算结果为8字节长度的加密认证第一CAN报文的数据区,将该加密认证第一CAN报文的数据区置于CAN报文数据区进行发送。
本申请实施例中,若所述第一CAN报文为使用第一CAN标识符CIDA发送的首个CAN报文,则所述第二CAN报文为所述第一CAN总线ECU的初始默认CAN报文IVA。若所述第一CAN报文为使用第一CAN标识符CIDA发送的非首个CAN报文,则所述第二CAN报文为使用所述第一CAN标识符CIDA已完成发送CAN报文中设定的CAN报文。
其中,本申请实施例中使用所述第一CAN标识符CIDA已完成发送CAN报文中设定的CAN报文中设定的CAN报文可以是已发送CAN报文中与第一CAN报文相邻的前一则CAN报文,也可以是相邻的前两则CAN报文,或者也可以是任何已发送的CAN报文,本申请实施例中并不限定,网关ECU和CAN总线ECU所使用的第二CAN报文保持一致即可。
本申请实施例中为减少存储开销,一种可能的实施方式中可将所述第一CAN标识符对应已发送CAN报文中设定的CAN报文配置为已发送CAN报文中与所述第一CAN报文相邻的前一则CAN报文。
S105:第一CAN总线ECU发送所述加密认证的第一CAN报文,第二CAN总线ECU接收所述加密认证的第一CAN报文。
S106:第二CAN总线ECU验证接收到的、加密认证的第一CAN报文的合法性。
图13所示为本申请实施例中第二CAN总线ECU验证加密认证的第一CAN报文合法性的实施过程示意图。图13中第二CAN总线ECU对所述加密认证的第一CAN报文进行解密,以得到第一解密信息认证码σ、第一CAN报文的解密数据、第一CAN标识符的第一解密计数值。所述CAN总线ECU获取网关ECU发送的随机数(第一网关ECU使用的随机数),并基于第一CAN标识符CIDA的密钥KA、所述随机数、第一CAN标识符的第一解密计数值、第一CAN报文的解密数据生成第二信息认证码σ’。判断第一解密信息认证码σ和第二信息认证码σ’是否一致,且第一CAN标识符的第一解密计数值是否合法,若所述CAN总线ECU确定所述第一解密信息认证码和所述第二信息认证码一致,且所述第一CAN标识符的第一解密计数值合法,则确定所述加密认证的第一CAN报文合法,即确定接收到的加密认证的第一CAN报文合法。
本申请实施例中,所述第一CAN标识符的第一解密计数值合法是指所述第一CAN标识符的第一解密计数值在预设的计数值允许误差范围内。例如,预配置的计数值允许误差范围为上下浮动3个数值,则若第一解密计数值为第一CAN标识符的计数值TA,或者为TA±3范围内,都可确定第一解密计数值合法。
本申请实施例中,第二CAN总线ECU确定加密认证的第一CAN报文合法后,可继续进行后续处理,若确定加密认证的第一CAN报文不合法,则可舍弃此CAN报文。
本申请实施例提供的CAN总线安全通信方法,第一CAN总线ECU对CAN报文加密运算过程以及生成信息认证码过程中,不仅使用待发送报文的数据,还使用率随机数、计数值以及已发送CAN报文中设定的CAN报文,故即使注入相同的数据值,生成的信息认证码和加密运算结构也不同,故CAN总线ECU发送加密认证CAN报文,可以抵挡重放攻击,并由于结合了加密与认证双重过程,使传输的CAN报文数据区的数据可同时抵挡窃听攻击,注入攻击与重放攻击,安全度较高。并且信息认证码可理解为是直接镶嵌于CAN报文数据区中的,不使用另外CAN报文装载,传输开销较低,并且整体设计不修改CAN收发器硬件,可应用于目前已有的CAN总线系统。
进一步的,本申请实施例中,第一CAN总线ECU和第二CAN总线ECU使用网关ECU发送的随机数对第一CAN标识符的密钥进行密钥生成处理,使得每次使用的密钥更具有随机性,可更有效的提高CAN报文传输的安全性。
上述主要从网关ECU、第一CAN总线ECU和第二CAN总线ECU交互的角度对本申请实施例提供的方案进行了介绍。可以理解的是,网关ECU、第一CAN总线ECU和第二CAN总线ECU为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。结合本申请中所公开的实施例描述的各示例的单元及算法步骤,本申请实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用来使用不同的方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的技术方案的范围。
本申请实施例可以根据上述方法示例对网关ECU、第一CAN总线ECU和第二CAN总线ECU进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或 两个以上的功能集成在一个处理单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用软件功能单元的形式实现时,图14示出了一种应用于第一CAN总线ECU的CAN总线安全通信装置100的结构示意图,参阅图14所示,应用于第一CAN总线ECU的CAN总线安全通信装置100包括接收单元101、处理单元102和发送单元103,其中,接收单元101用于获取网关ECU发送的随机数。处理单元102,用于基于第一CAN标识符的密钥、第一CAN标识符的计数值、第一CAN报文的数据和所述接收单元101获取的随机数,生成第一信息认证码,其中,所述第一CAN标识符为所述第一CAN报文的CAN标识符;并基于所述第一CAN标识符的密钥对第二CAN报文进行加密运算,以得到第一加密运算结果,对所述第一加密运算结果、所述第一信息认证码、所述第一CAN标识符的计数值、所述第一CAN报文的数据进行等长加密运算,以得到加密认证的第一CAN报文。发送单元103,用于发送所述处理单元102生成的加密认证的第一CAN报文。
其中,第一CAN标识符的密钥由CAN总线安全通信系统为第一CAN标识符预先分配,第一CAN标识符的计数值根据第一CAN总线ECU使用第一CAN标识符传输CAN报文的数量确定,且随第一CAN总线ECU使用第一CAN标识符传输CAN报文的数量的变化而变化,第一CAN报文为第一CAN总线ECU待发送的报文,且第一CAN总线ECU使用第一CAN标识符发送所述第一CAN报文。
其中,第二CAN报文为第一CAN总线ECU的历史CAN报文。
具体的,若第一CAN报文为第一CAN总线ECU使用第一CAN标识符发送的首个CAN报文,则第一CAN总线ECU的历史CAN报文可以为CAN总线安全通信系统为第一CAN标识符预先分配的初始默认CAN报文。若第一CAN报文为第一CAN总线ECU使用第一CAN标识符发送的非首个CAN报文,则第一CAN总线ECU的历史CAN报文可以为第一CAN总线ECU使用第一CAN标识符已完成发送的CAN报文中设定的CAN报文。
一种可能的实施方式中,所述接收单元101,还用于获取第三CAN报文、第二CAN标识符以及所述网关ECU发送的加密认证随机数。所述处理单元102,还用于:基于所述接收单元101接收的所述第二CAN标识符的密钥和所述第三CAN报文,得到第二随机数发送密钥;对所述第二随机数发送密钥以及所述第三CAN报文,进行加密运算,以得到第三加密运算结果;对所述第三加密运算结果和所述获取单元获取的加密认证的随机数进行等长解密运算,以得到第一随机数解密信息认证码;基于所述网关ECU发送的所述随机数与第二随机数发送密钥,生成第二随机数信息认证码;若所述第一随机数解密信息认证码和所述第二随机数信息认证码一致,则确定所述接收单元101获取到的所述网关ECU发送的所述随机数合法。
其中,网关ECU使用第二CAN标识符向至少一个CAN总线ECU发送CAN报文,第二CAN标识符的密钥由CAN总线安全通信系统为第二CAN标识符预先分配。第三CAN报文为所述网关ECU的历史CAN报文。
具体的,若网关ECU待发送的随机数为网关ECU发送的首个随机数,则网关ECU的历史CAN报文为CAN总线安全通信系统为网关ECU预先分配的初始默认CAN报文。若网关ECU待发送的随机数为网关ECU发送的非首个随机数,则网关ECU的历史CAN 报文为网关ECU使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文。
一种可能的示例中,所述处理单元102,可基于所述随机数以及第一CAN标识符的密钥得到第一生成密钥,并基于第一CAN标识符的计数值、第一CAN报文的数据、所述第一生成密钥和所述随机数生成第一信息认证码。
另一种可能的示例中,使用所述第一CAN标识符已完成发送CAN报文中设定的CAN报文为已发送CAN报文中与所述第一CAN报文相邻的前一则CAN报文。
在采用硬件形式实现时,上述处理单元102可以是处理器,接收单元101和发送单元103可以是收发器,当处理单元102是处理器,接收单元101和发送单元103是收发器时,应用于第一CAN总线ECU的CAN总线安全通信装置100可采用图3所示CAN总线安全通信系统中CAN总线ECU的结构。采用图3所示的CAN总线ECU结构的CAN总线安全通信装置100可以是第一CAN总线ECU。
在采用软件功能单元的形式实现时,图15示出了一种应用于第二CAN总线ECU的CAN总线安全通信装置200的结构示意图,参阅图15所示,应用于第二CAN总线ECU的CAN总线安全通信装置200包括接收单元201和处理单元202。其中,接收单元201,用于获取加密认证的第一CAN报文以及网关ECU发送的随机数。处理单元202,用于对所述接收单元201获取的加密认证的第一CAN报文进行解密,以得到第一解密信息认证码、第一CAN报文的解密数据、第一CAN标识符的第一解密计数值,并基于第一CAN报文的解密数据、第一CAN标识符的第一解密计数值、所述第一CAN标识符的密钥、所述接收单元接收到的所述随机数,生成第二信息认证码,并确定所述第一解密信息认证码和所述第二信息认证码是否一致,若所述第一解密信息认证码和所述第二信息认证码一致,且所述第一CAN标识符的第一解密计数值合法,则确定所述加密认证的第一CAN报文合法。
其中,所述第一CAN标识符的第一解密计数值合法是指所述第一CAN标识符的第一解密计数值在预设的计数值允许误差范围内。
一种可能的示例中,所述处理单元202采用如下方式基于所述第一CAN标识符的密钥、所述随机数、第一CAN标识符的第一解密计数值、第一CAN报文的解密数据生成第二信息认证码:基于所述网关ECU发送的随机数以及第一CAN标识符的密钥得到第一生成密钥,并基于所述第一生成密钥、所述网关ECU发送的随机数、第一CAN标识符的第一解密计数值、第一CAN报文的解密数据生成第二信息认证码。
在采用硬件形式实现时,上述处理单元202可以是处理器,接收单元201可以是收发器,当处理单元202是处理器,接收单元201是收发器时,应用于第二CAN总线ECU的CAN总线安全通信装置200可采用图3所示CAN总线安全通信系统中CAN总线ECU的结构。采用图3所示的CAN总线ECU结构的CAN总线安全通信装置200可以是第二CAN总线ECU。
在采用软件功能单元的形式实现时,图16示出了一种应用于网关ECU的CAN总线安全通信装置300的结构示意图,参阅图16所示,应用于网关ECU的CAN总线安全通信装置300包括处理单元301和发送单元302。其中,处理单元301,用于生成随机数。发送单元302,用于向至少一个CAN总线ECU发送所述处理单元301生成的随机数。
其中,处理单元301可基于第二CAN标识符的密钥和第三CAN报文,得到第一随机数发送密钥;基于所述第一随机数发送密钥以及所述网关ECU待发送的随机数,生成第一随机数信息认证码;对所述第一随机数发送密钥,以及第三CAN报文进行加密运算,以得到第二加密运算结果;对所述第二加密运算结果、所述第一随机数信息认证码、所述 待发送的随机数进行等长加密运算,以得到加密认证的随机数。所述发送单元302,向所述至少一个CAN总线ECU,发送所述处理单元301生成的加密认证的随机数。
其中,网关ECU使用第二CAN标识符向至少一个CAN总线ECU发送CAN报文,第二CAN标识符的密钥由CAN总线安全通信系统为第二CAN标识符预先分配。第三CAN报文为所述网关ECU的历史CAN报文。
具体的,若网关ECU待发送的随机数为网关ECU发送的首个随机数,则网关ECU的历史CAN报文为CAN总线安全通信系统为网关ECU预先分配的初始默认CAN报文。若网关ECU待发送的随机数为网关ECU发送的非首个随机数,则网关ECU的历史CAN报文为网关ECU使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文。
一种可能的实施方式中,使用第二CAN标识符已完成发送的CAN报文中设定的CAN报文,为已完成发送CAN报文中与使用第二CAN标识符当前发送的CAN报文相邻的前一则CAN报文。
在采用硬件形式实现时,上述处理单元301可以是处理器,发送单元302可以是收发器,当处理单元301是处理器,发送单元302是收发器时,应用于网关ECU的CAN总线安全通信装置300可采用图3所示CAN总线安全通信系统中网关ECU的结构。采用图3所示CAN总线安全通信系统中网关ECU结构的CAN总线安全通信装置300可以是网关ECU。
本领域内的技术人员应明白,本申请实施例可提供为方法、系统、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请实施例是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
显然,本领域的技术人员可以对本申请实施例进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请实施例的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。

Claims (28)

  1. 一种控制器区域网CAN总线安全通信系统,其特征在于,包括网关电子控制单元ECU、与所述网关ECU相连接的至少一个CAN总线;其中,每个CAN总线上连接有至少一个CAN总线ECU,所述至少一个CAN总线ECU中包括第一CAN总线ECU,其中:
    所述网关ECU,用于生成随机数并通过所述至少一个CAN总线向所述至少一个CAN总线ECU发送所述随机数;
    所述第一CAN总线ECU,用于获取所述网关ECU发送的所述随机数,并基于第一CAN标识符的密钥、第一CAN标识符的计数值、第一CAN报文的数据以及所述网关ECU发送的所述随机数,生成第一信息认证码,其中,第一CAN标识符的密钥由所述CAN总线安全通信系统为所述第一CAN标识符预先分配,第一CAN标识符的计数值根据所述第一CAN总线ECU使用所述第一CAN标识符传输CAN报文的数量确定,且随所述第一CAN总线ECU使用所述第一CAN标识符传输CAN报文的数量的变化而变化,第一CAN报文为所述第一CAN总线ECU待发送的报文,且所述第一CAN总线ECU使用所述第一CAN标识符发送所述第一CAN报文;
    所述第一CAN总线ECU,还用于基于第二CAN报文和所述第一CAN标识符的密钥进行加密运算,以得到第一加密运算结果,并对所述第一加密运算结果、所述第一信息认证码、所述第一CAN标识符的计数值、所述第一CAN报文的数据进行等长加密运算,以得到加密认证的第一CAN报文,并发送所述加密认证的第一CAN报文;
    其中,所述第二CAN报文为所述第一CAN总线ECU的历史CAN报文。
  2. 如权利要求1所述的系统,其特征在于,所述网关ECU具体用于:
    基于第三CAN报文和第二CAN标识符的密钥,得到第一随机数发送密钥,其中,所述网关ECU使用所述第二CAN标识符向所述至少一个CAN总线ECU发送CAN报文,所述第二CAN标识符的密钥由所述CAN总线安全通信系统为所述第二CAN标识符预先分配,所述第三CAN报文为所述网关ECU的历史CAN报文;
    基于所述第一随机数发送密钥以及所述网关ECU待发送的随机数,生成第一随机数信息认证码;
    对所述第一随机数发送密钥和所述第三CAN报文进行加密运算,以得到第二加密运算结果;
    对所述第二加密运算结果、所述第一随机数信息认证码、所述待发送的随机数进行等长加密运算,以得到加密认证的随机数;
    向所述至少一个CAN总线ECU,发送所述加密认证的随机数。
  3. 如权利要求2所述的系统,其特征在于,所述第一CAN总线ECU,还用于:
    获取所述第二CAN标识符、所述第三CAN报文以及所述加密认证的随机数;
    基于所述第二CAN标识符的密钥和所述第三CAN报文,得到第二随机数发送密钥;
    对所述第二随机数发送密钥以及所述第三CAN报文进行加密运算,以得到第三加密运算结果;
    对所述第三加密运算结果和所述加密认证的随机数进行等长解密运算,以得到第一随机数解密信息认证码;
    基于所述网关ECU发送的所述随机数与所述第二随机数发送密钥,生成第二随机数 信息认证码;
    若所述第一随机数解密信息认证码和所述第二随机数信息认证码一致,则确定所述网关ECU发送的所述随机数合法。
  4. 如权利要求1至3任一项所述的系统,其特征在于,所述至少一个CAN总线ECU中还包括第二CAN总线ECU,所述第二CAN总线ECU用于:
    获取所述加密认证的第一CAN报文,并对所述加密认证的第一CAN报文进行解密,以得到第一解密信息认证码、第一CAN报文的解密数据、第一CAN标识符的第一解密计数值;
    获取所述网关ECU发送的所述随机数,并基于所述第一CAN标识符的密钥、所述网关ECU发送的所述随机数、所述第一CAN标识符的第一解密计数值和所述第一CAN报文的解密数据,生成第二信息认证码;
    若所述第一解密信息认证码和所述第二信息认证码一致,且所述第一CAN标识符的第一解密计数值合法,则确定所述加密认证的第一CAN报文合法。
  5. 如权利要求4所述的系统,其特征在于,所述第一CAN标识符的第一解密计数值合法是指所述第一CAN标识符的第一解密计数值在预设的计数值允许误差范围内。
  6. 如权利要求4或5所述的系统,其特征在于,所述第一CAN总线ECU,具体用于:
    基于所述网关ECU发送的所述随机数以及第一CAN标识符的密钥,得到第一生成密钥,并
    基于第一CAN标识符的计数值、第一CAN报文的数据、所述第一生成密钥以及所述网关ECU发送的所述随机数,生成第一信息认证码;
    所述第二CAN总线ECU,具体用于:
    基于所述网关ECU发送的所述随机数以及第一CAN标识符的密钥,得到第一生成密钥,并
    基于所述第一生成密钥、所述网关ECU发送的所述随机数、所述第一CAN标识符的第一解密计数值、所述第一CAN报文的解密数据,生成第二信息认证码。
  7. 如权利要求1至6任一项所述的系统,其特征在于,若所述第一CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符发送的首个CAN报文,则所述第一CAN总线ECU的历史CAN报文为所述CAN总线安全通信系统为所述第一CAN标识符预先分配的初始默认CAN报文;
    若所述第一CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符发送的非首个CAN报文,则所述第一CAN总线ECU的历史CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符已完成发送的CAN报文中设定的CAN报文。
  8. 如权利要求2至6任一项所述的系统,其特征在于,若所述网关ECU待发送的随机数为所述网关ECU发送的首个随机数,则所述网关ECU的历史CAN报文为所述CAN总线安全通信系统为所述网关ECU预先分配的初始默认CAN报文;
    若所述网关ECU待发送的随机数为所述网关ECU发送的非首个随机数,则所述网关ECU的历史CAN报文为所述网关ECU使用所述第二CAN标识符已完成发送的CAN报文中设定的CAN报文。
  9. 一种控制器区域网CAN总线安全通信装置,其特征在于,应用于第一CAN总线电子控制单元ECU,包括:
    接收单元,用于获取网关ECU发送的随机数;
    处理单元,用于基于第一CAN标识符的密钥、第一CAN标识符的计数值、第一CAN报文的数据以及所述接收单元获取的随机数,生成第一信息认证码,其中,第一CAN标识符的密钥由CAN总线安全通信系统为所述第一CAN标识符预先分配,第一CAN标识符的计数值根据所述第一CAN总线ECU使用所述第一CAN标识符传输CAN报文的数量确定,且随所述第一CAN总线ECU使用所述第一CAN标识符传输CAN报文的数量的变化而变化,第一CAN报文为所述第一CAN总线ECU待发送的报文,且所述第一CAN总线ECU使用所述第一CAN标识符发送所述第一CAN报文;并
    基于所述第二CAN报文和第一CAN标识符的密钥进行加密运算,以得到第一加密运算结果,对所述第一加密运算结果、所述第一信息认证码、所述第一CAN标识符的计数值、所述第一CAN报文的数据进行等长加密运算,以得到加密认证的第一CAN报文;
    其中,所述第二CAN报文为所述第一CAN总线ECU的历史CAN报文;
    发送单元,用于发送所述处理单元生成的加密认证的第一CAN报文。
  10. 如权利要求9所述的装置,其特征在于,所述接收单元,还用于获取第二CAN标识符、第三CAN报文以及加密认证的随机数,其中,所述网关ECU使用所述第二CAN标识符向所述至少一个CAN总线ECU发送CAN报文,所述第三CAN报文为所述网关ECU的历史CAN报文;
    所述处理单元,还用于:
    基于所述第二CAN标识符的密钥和所述第三CAN报文,得到第二随机数发送密钥,所述第二CAN标识符的密钥由所述CAN总线安全通信系统为所述第二CAN标识符预先分配;
    对所述第二随机数发送密钥以及所述第三CAN报文进行加密运算,以得到第三加密运算结果;
    对所述第三加密运算结果和所述接收单元接收到的加密认证的随机数,进行等长解密运算,以得到第一随机数解密信息认证码;
    基于所述接收单元接收到的随机数与所述第二随机数发送密钥,生成第二随机数信息认证码;
    若所述第一随机数解密信息认证码和所述第二随机数信息认证码一致,则确定所述接收单元获取到的所述随机数合法。
  11. 如权利要求9或10所述的装置,其特征在于,所述处理单元,采用如下方式基于第一CAN标识符的密钥、第一CAN标识符的计数值、第一CAN报文的数据以及所述接收单元获取的随机数,生成第一信息认证码:
    基于所述接收单元接收到的随机数以及第一CAN标识符的密钥,得到第一生成密钥,并
    基于第一CAN标识符的计数值、第一CAN报文的数据、所述第一生成密钥以及所述接收单元接收到的随机数,生成第一信息认证码。
  12. 如权利要求9至11任一项所述的装置,其特征在于,若所述第一CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符发送的首个CAN报文,则所述第一CAN总线ECU的历史CAN报文为所述CAN总线安全通信系统为所述第一CAN标识符预先分配的初始默认CAN报文;
    若所述第一CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符发送的非首个CAN报文,则所述第一CAN总线ECU的历史CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符已完成发送的CAN报文中设定的CAN报文。
  13. 一种控制器区域网CAN总线安全通信装置,其特征在于,应用于第二CAN总线电子控制单元ECU,包括:
    接收单元,用于获取加密认证的第一CAN报文以及网关ECU发送的随机数;
    处理单元,用于对所述接收单元获取的加密认证的第一CAN报文进行解密,以得到第一解密信息认证码、第一CAN报文的解密数据、第一CAN标识符的第一解密计数值,并基于所述第一CAN标识符的密钥、所述接收单元接收到的所述随机数、所述第一CAN标识符的第一解密计数值、所述第一CAN报文的解密数据,生成第二信息认证码,并确定所述第一解密信息认证码和所述第二信息认证码是否一致,若所述第一解密信息认证码和所述第二信息认证码一致,且所述第一CAN标识符的第一解密计数值合法,则确定所述加密认证的第一CAN报文合法;
    其中,第一CAN标识符的密钥由CAN总线安全通信系统为所述第一CAN标识符预先分配。
  14. 如权利要求13所述的装置,其特征在于,所述第一CAN标识符的第一解密计数值合法是指所述第一CAN标识符的第一解密计数值在预设的计数值允许误差范围内。
  15. 如权利要求13或14所述的装置,其特征在于,所述处理单元采用如下方式基于所述第一CAN标识符的密钥、所述接收单元接收到的所述随机数、所述第一CAN标识符的第一解密计数值、所述第一CAN报文的解密数据,生成第二信息认证码:
    基于所述接收单元接收到的随机数以及第一CAN标识符的密钥,得到第一生成密钥,并
    基于所述第一生成密钥、所述接收单元接收到的随机数、所述第一CAN标识符的第一解密计数值、所述第一CAN报文的解密数据,生成第二信息认证码。
  16. 一种控制器区域网CAN总线安全通信装置,其特征在于,应用于网关电子控制单元ECU,包括:
    处理单元,用于生成随机数;
    发送单元,用于向至少一个控制器区域网CAN总线ECU发送所述处理单元生成的随机数。
  17. 如权利要求16所述的装置,其特征在于,所述处理单元采用如下方式生成随机数:
    基于第三CAN报文和第二CAN标识符的密钥,得到第一随机数发送密钥,其中,所述网关ECU使用所述第二CAN标识符向所述至少一个CAN总线ECU发送CAN报文,所述第二CAN标识符的密钥由所述CAN总线安全通信系统为所述第二CAN标识符预先分配,所述第三CAN报文为所述网关ECU的历史CAN报文;
    基于所述第一随机数发送密钥以及所述网关ECU待发送的随机数,生成第一随机数信息认证码;
    对所述第一随机数发送密钥和所述第三CAN报文进行加密运算,以得到第二加密运算结果;
    对所述第二加密运算结果、所述第一随机数信息认证码、所述待发送的随机数进行等 长加密运算,以得到加密认证的随机数;
    所述发送单元,采用如下方式向至少一个CAN总线ECU发送所述处理单元生成的随机数:
    向所述至少一个CAN总线ECU,发送所述处理单元生成的加密认证随机数。
  18. 如权利要求17所述的装置,其特征在于,若所述网关ECU待发送的随机数为所述网关ECU发送的首个随机数,则所述网关ECU的历史CAN报文为所述CAN总线安全通信系统为所述网关ECU预先分配的初始默认CAN报文;
    若所述网关ECU待发送的随机数为所述网关ECU发送的非首个随机数,则所述网关ECU的历史CAN报文为所述网关ECU使用所述第二CAN标识符已完成发送的CAN报文中设定的CAN报文。
  19. 一种控制器区域网CAN总线安全通信方法,其特征在于,包括:
    CAN总线电子控制单元ECU获取网关ECU发送的随机数;
    所述CAN总线ECU基于第一CAN标识符的密钥、第一CAN标识符的计数值、第一CAN报文的数据以及所述网关ECU发送的所述随机数,生成第一信息认证码,其中,第一CAN标识符的密钥由CAN总线安全通信系统为所述第一CAN标识符预先分配,第一CAN标识符的计数值根据所述第一CAN总线ECU使用所述第一CAN标识符传输CAN报文的数量确定,且随所述第一CAN总线ECU使用所述第一CAN标识符传输CAN报文的数量的变化而变化,第一CAN报文为所述第一CAN总线ECU待发送的报文,且所述第一CAN总线ECU使用所述第一CAN标识符发送所述第一CAN报文;
    所述CAN总线ECU基于第二CAN报文和所述第一CAN标识符的密钥进行加密运算,以得到第一加密运算结果,对所述第一加密运算结果、所述第一信息认证码、所述第一CAN标识符的计数值、所述第一CAN报文的数据进行等长加密运算,以得到加密认证的第一CAN报文,并发送所述加密认证的第一CAN报文;
    其中,所述第二CAN报文为所述第一CAN总线ECU的历史CAN报文。
  20. 如权利要求19所述的方法,其特征在于,所述CAN总线ECU获取网关ECU发送的随机数之后,所述方法还包括:
    所述CAN总线ECU获取第二CAN标识符、第三CAN报文以及所述加密认证的随机数,其中,所述网关ECU使用所述第二CAN标识符向所述至少一个CAN总线ECU发送CAN报文,所述第三CAN报文为所述网关ECU的历史CAN报文;
    所述CAN总线ECU基于所述第二CAN标识符的密钥和所述第三CAN报文,得到第二随机数发送密钥,所述第二CAN标识符的密钥由所述CAN总线安全通信系统为所述第二CAN标识符预先分配;
    所述CAN总线ECU对所述第二随机数发送密钥以及所述第三CAN报文,进行加密运算,以得到第三加密运算结果;
    所述CAN总线ECU对所述第三加密运算结果和所述加密认证的随机数,进行等长解密运算,以得到第一随机数解密信息认证码;
    所述CAN总线ECU基于所述网关ECU发送的所述随机数与所述第二随机数发送密钥,生成第二随机数信息认证码;
    若所述CAN总线ECU确定所述第一随机数解密信息认证码和所述第二随机数信息认证码一致,则确定获取到的所述网关ECU发送的所述随机数合法。
  21. 如权利要求19或20所述的方法,其特征在于,所述CAN总线ECU基于第一CAN标识符的密钥、第一CAN标识符的计数值、第一CAN报文的数据以及所述网关ECU发送的所述随机数,生成第一信息认证码,包括:
    所述CAN总线ECU基于所述网关ECU发送的所述随机数以及第一CAN标识符的密钥,得到第一生成密钥,并
    基于第一CAN标识符的计数值、第一CAN报文的数据、所述第一生成密钥以及所述网关ECU发送的所述随机数,生成第一信息认证码。
  22. 如权利要求19至21任一项所述的方法,其特征在于,若所述第一CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符发送的首个CAN报文,则所述第一CAN总线ECU的历史CAN报文为所述CAN总线安全通信系统为所述第一CAN标识符预先分配的初始默认CAN报文;
    若所述第一CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符发送的非首个CAN报文,则所述第一CAN总线ECU的历史CAN报文为所述第一CAN总线ECU使用所述第一CAN标识符已完成发送的CAN报文中设定的CAN报文。
  23. 一种控制器区域网CAN总线安全通信方法,其特征在于,包括:
    CAN总线电子控制单元ECU获取加密认证的第一CAN报文,并对所述加密认证的第一CAN报文进行解密,以得到第一解密信息认证码、第一CAN报文的解密数据、第一CAN标识符的第一解密计数值;
    所述CAN总线ECU获取网关ECU发送的所述随机数,并基于第一CAN标识符的密钥、所述网关ECU发送的所述随机数、所述第一CAN标识符的第一解密计数值和所述第一CAN报文的解密数据,生成第二信息认证码;
    若所述CAN总线ECU确定所述第一解密信息认证码和所述第二信息认证码一致,且所述第一CAN标识符的第一解密计数值合法,则确定所述加密认证的第一CAN报文合法。
  24. 如权利要求23所述的方法,其特征在于,所述第一CAN标识符的第一解密计数值合法是指所述第一CAN标识符的第一解密计数值在预设的计数值允许误差范围内。
  25. 如权利要求23或24所述的方法,其特征在于,所述CAN总线ECU基于所述第一CAN标识符的密钥、所述网关ECU发送的所述随机数、所述第一CAN标识符的第一解密计数值和所述第一CAN报文的解密数据,生成第二信息认证码,包括:
    所述CAN总线ECU基于所述网关ECU发送的所述随机数以及第一CAN标识符的密钥,得到第一生成密钥,并
    基于所述第一生成密钥、所述网关ECU发送的所述随机数、所述第一CAN标识符的第一解密计数值和所述第一CAN报文的解密数据,生成第二信息认证码。
  26. 一种控制器区域网CAN总线安全通信方法,其特征在于,包括:
    网关ECU生成随机数;
    所述网关ECU向至少一个控制器区域网CAN总线ECU发送所述生成的随机数。
  27. 如权利要求26所述的方法,其特征在于,所述网关ECU生成随机数,包括:
    所述网关ECU基于第三CAN报文和第二CAN标识符的密钥,得到第一随机数发送密钥,其中,所述网关ECU使用所述第二CAN标识符向所述至少一个CAN总线ECU发送CAN报文,所述第二CAN标识符的密钥由所述CAN总线安全通信系统为所述第二CAN标识符预先分配,所述第三CAN报文为所述网关ECU的历史CAN报文;
    所述网关ECU基于所述第一随机数发送密钥以及所述网关ECU待发送的随机数,生成第一随机数信息认证码;
    所述网关ECU对所述第一随机数发送密钥和所述第三CAN报文进行加密运算,以得到第二加密运算结果;
    所述网关ECU对所述第二加密运算结果、所述第一随机数信息认证码、所述待发送的随机数进行等长加密运算,以得到加密认证的随机数;
    所述网关ECU向至少一个CAN总线ECU发送所述生成的随机数,包括:
    所述网关ECU向所述至少一个CAN总线ECU,发送所述加密认证随机数。
  28. 如权利要求27所述的方法,其特征在于,若所述网关ECU待发送的随机数为所述网关ECU发送的首个随机数,则所述网关ECU的历史CAN报文为所述CAN总线安全通信系统为所述网关ECU预先分配的初始默认CAN报文;
    若所述网关ECU待发送的随机数为所述网关ECU发送的非首个随机数,则所述网关ECU的历史CAN报文为所述网关ECU使用所述第二CAN标识符已完成发送的CAN报文中设定的CAN报文。
PCT/CN2017/116986 2017-05-25 2017-12-18 一种控制器区域网总线安全通信方法、装置及系统 WO2018214487A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
EP17911391.5A EP3641215B1 (en) 2017-05-25 2017-12-18 Secure communication method, apparatus and system for controller area network bus
JP2019565171A JP6915095B2 (ja) 2017-05-25 2017-12-18 コントローラエリアネットワークバスベースのセキュリティ通信方法、装置、およびシステム
KR1020197037871A KR102316872B1 (ko) 2017-05-25 2017-12-18 제어기 영역 네트워크 버스 기반 보안 통신 방법, 장치 및 시스템
US16/692,654 US11271771B2 (en) 2017-05-25 2019-11-22 Controller area network bus based security communications method, apparatus, and system

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201710381307.4 2017-05-25
CN201710381307 2017-05-25
CN201710854489.2 2017-09-20
CN201710854489.2A CN108965218B (zh) 2017-05-25 2017-09-20 一种控制器区域网总线安全通信方法、装置及系统

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/692,654 Continuation US11271771B2 (en) 2017-05-25 2019-11-22 Controller area network bus based security communications method, apparatus, and system

Publications (1)

Publication Number Publication Date
WO2018214487A1 true WO2018214487A1 (zh) 2018-11-29

Family

ID=64396088

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/116986 WO2018214487A1 (zh) 2017-05-25 2017-12-18 一种控制器区域网总线安全通信方法、装置及系统

Country Status (1)

Country Link
WO (1) WO2018214487A1 (zh)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111210539A (zh) * 2020-01-02 2020-05-29 浙江吉利新能源商用车集团有限公司 一种动力蓄电池数据分析系统
TWI718008B (zh) * 2020-02-21 2021-02-01 宏碁股份有限公司 控制器區域網路資料壓縮/解壓縮之方法與裝置
CN113132092A (zh) * 2019-12-31 2021-07-16 华为技术有限公司 通信方法和电子设备
WO2022041122A1 (zh) * 2020-08-28 2022-03-03 华为技术有限公司 一种数据传输方法以及装置
CN114301596A (zh) * 2021-11-18 2022-04-08 成都市卡蛙科技有限公司 车内网ota安全通讯方法、装置、车载系统及存储介质
US11379571B2 (en) 2019-07-12 2022-07-05 Hewlett Packard Enterprise Development Lp Presence terminal-based side channel communications
CN115242411A (zh) * 2022-09-23 2022-10-25 合肥工业大学 一种基于量子随机数发生器的车内网安全通信方法
US11606366B2 (en) 2019-07-02 2023-03-14 Cisco Technology, Inc. Using CRC for sender authentication in a serial network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104025506A (zh) * 2011-10-31 2014-09-03 丰田自动车株式会社 通信系统中的消息认证方法及通信系统
CN105897669A (zh) * 2015-11-11 2016-08-24 乐卡汽车智能科技(北京)有限公司 数据发送、接收方法、发送端、接收端和can总线网络
CN106027260A (zh) * 2016-05-12 2016-10-12 成都信息工程大学 基于密钥预分配的汽车ecu完整性验证和加密通信方法
US20160315766A1 (en) * 2014-11-13 2016-10-27 Panasonic Intellectual Property Corporation Of America Key management method used in encryption processing for safely transmitting and receiving messages

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104025506A (zh) * 2011-10-31 2014-09-03 丰田自动车株式会社 通信系统中的消息认证方法及通信系统
US20160315766A1 (en) * 2014-11-13 2016-10-27 Panasonic Intellectual Property Corporation Of America Key management method used in encryption processing for safely transmitting and receiving messages
CN105897669A (zh) * 2015-11-11 2016-08-24 乐卡汽车智能科技(北京)有限公司 数据发送、接收方法、发送端、接收端和can总线网络
CN106027260A (zh) * 2016-05-12 2016-10-12 成都信息工程大学 基于密钥预分配的汽车ecu完整性验证和加密通信方法

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11606366B2 (en) 2019-07-02 2023-03-14 Cisco Technology, Inc. Using CRC for sender authentication in a serial network
US11379571B2 (en) 2019-07-12 2022-07-05 Hewlett Packard Enterprise Development Lp Presence terminal-based side channel communications
CN113132092A (zh) * 2019-12-31 2021-07-16 华为技术有限公司 通信方法和电子设备
CN113132092B (zh) * 2019-12-31 2022-04-22 华为技术有限公司 通信方法和电子设备
CN111210539A (zh) * 2020-01-02 2020-05-29 浙江吉利新能源商用车集团有限公司 一种动力蓄电池数据分析系统
CN111210539B (zh) * 2020-01-02 2023-09-19 浙江吉利新能源商用车集团有限公司 一种动力蓄电池数据分析系统
TWI718008B (zh) * 2020-02-21 2021-02-01 宏碁股份有限公司 控制器區域網路資料壓縮/解壓縮之方法與裝置
WO2022041122A1 (zh) * 2020-08-28 2022-03-03 华为技术有限公司 一种数据传输方法以及装置
CN114301596A (zh) * 2021-11-18 2022-04-08 成都市卡蛙科技有限公司 车内网ota安全通讯方法、装置、车载系统及存储介质
CN115242411A (zh) * 2022-09-23 2022-10-25 合肥工业大学 一种基于量子随机数发生器的车内网安全通信方法
CN115242411B (zh) * 2022-09-23 2022-12-02 合肥工业大学 一种基于量子随机数发生器的车内网安全通信方法

Similar Documents

Publication Publication Date Title
US11271771B2 (en) Controller area network bus based security communications method, apparatus, and system
WO2018214487A1 (zh) 一种控制器区域网总线安全通信方法、装置及系统
CN110073634B (zh) 数据转换系统及方法
WO2018046009A1 (zh) 一种区块链身份系统
JP4814339B2 (ja) 制約された暗号キー
US11533297B2 (en) Secure communication channel with token renewal mechanism
CN108599925B (zh) 一种基于量子通信网络的改进型aka身份认证系统和方法
CN107659406B (zh) 一种资源操作方法及装置
CN104094267B (zh) 安全共享来自源装置的媒体内容的方法、装置和系统
KR101508497B1 (ko) 차량용 데이터의 인증 및 획득 방법
KR101356476B1 (ko) 차량용 데이터의 인증 및 획득 방법
KR101549034B1 (ko) Can에서 데이터의 기밀성과 무결성을 보장하는 방법
JP2014204444A (ja) センサへの操作及び/又はセンサのセンサデータへの操作を検出するための方法及び装置
US20080010242A1 (en) Device authentication method using broadcast encryption (BE)
CN112640365B (zh) 一种控制器区域网can总线安全通信方法及装置
EP2917867B1 (en) An improved implementation of robust and secure content protection in a system-on-a-chip apparatus
WO2021147100A1 (zh) 报文传输方法及装置
KR20210153595A (ko) 암호화 데이터 검증 방법
KR101481403B1 (ko) 차량용 데이터의 인증 및 획득 방법
US20200028698A1 (en) Protecting media content
WO2022161098A1 (zh) 一种秘钥的分发方法及电子设备
CN111131311A (zh) 基于区块链的数据传输方法及区块链节点
US20020196945A1 (en) Key sharing system, public key cryptosystem, signature system, key sharing apparatus, encryption apparatus, decryption apparatus, signature apparatus, authentication apparatus, key sharing method, encryption method, decryption method, signature method, authentication method, and programs
CN114584321B (zh) 一种基于puf器件的数据信息加密部署方法
Kumar et al. Binary Hash Tree based Certificate Access Management

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17911391

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019565171

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2017911391

Country of ref document: EP

Effective date: 20191204

ENP Entry into the national phase

Ref document number: 20197037871

Country of ref document: KR

Kind code of ref document: A