Identity authentication method and device, electronic equipment and storage medium
By pre-setting keys and identification codes in the vehicle's ECU and using symmetric encryption algorithms for identity authentication and key negotiation, the low latency and high concurrency issues of secure in-vehicle communication in the Internet of Vehicles (IoV) are solved, achieving efficient and secure in-vehicle communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-13
AI Technical Summary
Existing vehicle-to-everything (V2X) in-vehicle security communication solutions are insufficient to meet the requirements of low latency and high concurrency in resource-constrained vehicle environments. Furthermore, traditional solutions are computationally complex, have high storage overhead, and pose a high risk of single point of failure.
By pre-setting two keys and a unique identification code corresponding to the ECU in the vehicle, identity authentication between multiple ECUs is achieved. A symmetric encryption algorithm is used for identity authentication and key negotiation, avoiding complex certificate management.
It simplifies the in-vehicle communication process, improves communication efficiency and security, reduces resource consumption, avoids single point of failure risk, and meets the efficiency and resource requirements of the in-vehicle environment.
Smart Images

Figure CN121664489A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication authentication, and more specifically, to an identity authentication method, apparatus, electronic device, and storage medium. Background Technology
[0002] In a defense-in-depth architecture, secure in-vehicle communication is crucial for connected vehicles. However, existing technologies often employ complex and heavy-duty solutions to ensure security, making it difficult to meet the low-latency and high-concurrency communication requirements in resource-constrained in-vehicle environments. Summary of the Invention
[0003] In view of this, embodiments of this application propose an identity authentication method, apparatus, electronic device, and storage medium to improve the above-mentioned problems.
[0004] In a first aspect, embodiments of this application provide an identity authentication method, the method comprising: obtaining first authentication information sent by a second ECU through a first ECU in a vehicle, wherein the first ECU stores a first key, a second key, a first identification code corresponding to the first ECU and a second identification code corresponding to the second ECU, and the second ECU stores the first key, the second key, the first identification code and the second identification code; the first authentication information is determined by the second ECU encrypting a first random number and a first message authentication code based on the first key; the first message authentication code is obtained by the second ECU based on the second key, the second identification code and the first random number; decrypting the first authentication information by the first ECU based on the first key to obtain the first random number and the first message authentication code; obtaining a second message authentication code by the first ECU based on the second key, the second identification code and the first random number; and if the second message authentication code matches the first message authentication code, then determining by the first ECU that the second ECU has passed the identity authentication prior to communication.
[0005] Secondly, embodiments of this application provide an identity authentication device, comprising: a first authentication information acquisition module, a first authentication information decryption module, a second message authentication code acquisition module, and a first verification module. The first authentication information acquisition module is used to acquire first authentication information sent by a second ECU through a first ECU in a vehicle. The first ECU stores a first key, a second key, a first identification code corresponding to the first ECU, and a second identification code corresponding to the second ECU. The second ECU stores the first key, the second key, the first identification code, and the second identification code. The first authentication information is determined by the second ECU encrypting a first random number and a first message authentication code based on the first key. The first message authentication code is acquired by the second ECU based on the second key, the second identification code, and the first random number. The first authentication information decryption module is used to decrypt the first authentication information through the first ECU based on the first key to obtain the first random number and the first message authentication code. The second message authentication code acquisition module is used to acquire a second message authentication code through the first ECU based on the second key, the second identification code, and the first random number. The first verification module is used to determine, if the second message authentication code matches the first message authentication code, that the second ECU has successfully completed the identity authentication prior to communication through the first ECU.
[0006] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor executes the authentication method provided in the first aspect above.
[0007] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code, which can be invoked by a processor to execute the authentication method provided in the first aspect above.
[0008] In this application's solution, the first authentication information sent by the second ECU is obtained through the first ECU in the vehicle. The first ECU stores a first key, a second key, a first identification code corresponding to the first ECU, and a second identification code corresponding to the second ECU. The second ECU stores the first key, the second key, the first identification code, and the second identification code. The first authentication information is determined by the second ECU encrypting a first random number and a first message authentication code based on the first key. The first message authentication code is obtained by the second ECU based on the second key, the second identification code, and the first random number. The first ECU decrypts the first authentication information based on the first key to obtain the first random number and the first message authentication code. The first ECU then obtains the second message authentication code based on the second key, the second identification code, and the first random number. If the second message authentication code matches the first message authentication code, the first ECU confirms that the second ECU has passed the pre-communication authentication. Thus, before multiple ECUs communicate within the vehicle, mutual authentication of identity information between multiple ECUs is achieved through two pre-set keys in the vehicle's ECUs and the unique identification code corresponding to each ECU. This eliminates the need for complex certificate management, making the entire process simple and fast, ensuring in-vehicle communication security while improving in-vehicle communication efficiency. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 A flowchart illustrating an embodiment of the authentication method provided in this application is shown. Figure 2 A flowchart illustrating an embodiment of the authentication method provided in this application is shown. Figure 3 A timing diagram of an identity authentication method provided in an embodiment of this application is shown; Figure 4 A flowchart illustrating an embodiment of the authentication method provided in this application is shown. Figure 5 This paper illustrates a schematic diagram of a key filling process according to an embodiment of the present application; Figure 6 A block diagram of an identity authentication device according to an embodiment of this application is shown; Figure 7 A block diagram of an electronic device for performing an authentication method according to an embodiment of the present application is shown. Detailed Implementation
[0011] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0012] To better understand the solutions of the embodiments of this application, the technical terms used in the embodiments of this application will be explained below.
[0013] Electronic Control Unit (ECU).
[0014] Cipher-based Message Authentication Code (CMAC).
[0015] Communication Control Unit (CCU).
[0016] Intelligent Driving Controller, IDC Autonomous Driving Computer / Compute, ADC Telematics Box (TBOX) is a remote information processor.
[0017] True Random Number Generator (TRNG).
[0018] The implementation details of the technical solutions in the embodiments of this application are described in detail below: Currently, in-vehicle secure communication solutions in the field of vehicle networking are mainly divided into two categories: certificate-based PKI solutions and certification authority-based solutions. Among them, the certificate-based PKI scheme uses X.509 digital certificates to achieve identity authentication and communication encryption. Each ECU needs to maintain its own digital certificate and private key, and perform certificate verification and digital signature calculations during communication. The main disadvantages of this scheme are: (1) high computational complexity, especially the low efficiency of asymmetric encryption algorithms such as RSA / ECC on resource-constrained ECUs; (2) complex certificate management, requiring the implementation of complete lifecycle management such as certificate issuance, renewal, and revocation; (3) large storage overhead, each ECU needs to store the root certificate, intermediate certificates, and a possible CRL list; (4) high authentication latency, the complete TLS handshake process usually requires multiple round trips and a large amount of computation.
[0019] Among them, the authentication center-based scheme relies on a central authentication server (such as a central gateway) for identity authentication and key distribution. Both communicating parties need to interact with the authentication center in real time to obtain session keys or authentication tokens. This scheme has the following problems: (1) Single point of failure risk: once the authentication center is unavailable, the entire system will not be able to work properly; (2) High communication latency: all nodes need to negotiate keys with the central authentication server before communicating with each other.
[0020] Therefore, current in-vehicle security communication solutions in the field of vehicle networking perform poorly in resource-constrained in-vehicle environments, failing to meet the requirements of low latency and high concurrency for in-vehicle communication. Furthermore, with the increase in the number of in-vehicle ECUs and the increase in communication frequency, the computational and communication overhead of traditional solutions increases linearly, severely impacting system performance. Therefore, there is an urgent need for a lightweight in-vehicle security communication solution that can meet the stringent requirements of efficiency and resource consumption in the in-vehicle environment while ensuring security.
[0021] To address the aforementioned problems, the inventors, through extensive research, have developed an authentication method, device, electronic device, and storage medium as provided in this application. By using two pre-installed keys within each ECU and a unique identification code corresponding to that ECU before communication within the vehicle, mutual authentication of identity information between multiple ECUs is achieved. This eliminates the need for complex certificate management, making the entire process simple and fast, while ensuring the security of in-vehicle communication and improving its efficiency. The specific authentication method will be described in detail in subsequent embodiments.
[0022] The embodiments involved in this application will now be described with reference to the accompanying drawings.
[0023] Please see Figure 1 , Figure 1 A flowchart illustrating an embodiment of the authentication method provided in this application is shown. In a specific embodiment, this authentication method can be applied to, for example... Figure 6 The identity authentication device 200 and the electronic device 100 equipped with the identity authentication device 200 are shown. Figure 7 The following will use an electronic device as an example to illustrate the specific process of this embodiment. Of course, it is understood that the electronic device used in this embodiment may include robots, vehicles, in-vehicle terminals, computers, etc., and is not limited thereto. The following will focus on... Figure 1 The process shown will be described in detail. The identity authentication method may specifically include the following steps: Step S110: Obtain the first authentication information sent by the second ECU through the first ECU in the vehicle, wherein the first ECU stores a first key, a second key, a first identification code corresponding to the first ECU and a second identification code corresponding to the second ECU, and the second ECU stores the first key, the second key, the first identification code and the second identification code. The first authentication information is determined by the second ECU by encrypting a first random number and a first message authentication code based on the first key. The first message authentication code is obtained by the second ECU based on the second key, the second identification code and the first random number.
[0024] In some implementations, the electronic device can be understood as a vehicle, which may include a CCU and multiple ECUs (e.g., IDC, ADC, TBOX, etc.). The CCU can communicate with the multiple ECUs. Before the multiple ECUs in the vehicle can communicate, they need to be authenticated. For example, the vehicle includes a first ECU and a second ECU, which can be any one of the multiple ECUs in the vehicle, but the first ECU and the second ECU are different. If the two parties needing to communicate are the first ECU and the second ECU, then authentication is required for both. The identification code corresponding to the ECU can be the component serial number (SN) corresponding to the ECU. It should be noted that the component serial number is a unique identifier for the device.
[0025] In some implementations, the vehicle can obtain a first key, a second key, and the identification codes corresponding to each of the multiple ECUs through the CCU, and send them to each ECU in the vehicle through the CCU. Each ECU stores the first key, the second key, and the unique identification codes corresponding to each of the multiple ECUs for identity authentication before subsequent in-vehicle ECU communication, thus ensuring the security of in-vehicle communication.
[0026] For example, both the first ECU and the second ECU may store a first key, a second key, a first identification code corresponding to the first ECU, and a second identification code corresponding to the second ECU.
[0027] In some implementations, if the first ECU and the second ECU in the vehicle need to communicate, the second ECU can initiate a communication request. During the process of initiating the communication request, the first ECU can obtain the first authentication information sent by the second ECU. The first authentication information can be determined by the second ECU through encryption of a first random number and a first message authentication code using a first key. The first message authentication code can be obtained by the second ECU based on a second key, a second identification code, and the first random number.
[0028] The second ECU can use a second key to concatenate a second identification code and a first random number using the CMAC algorithm to obtain a MAC value, which can then be used as the first message authentication code. After obtaining the first message authentication code, the second ECU can encrypt the first random number and the first message authentication code using the first key to obtain first authentication information. In the process of concatenating the second identification code and the first random number using the CMAC algorithm, the second ECU can use the second identification code as the first segment of the first message authentication code and the first random number as the last segment; alternatively, the second identification code can be used as the last segment of the first message authentication code and the first random number as the first segment, which is not limited here.
[0029] The second ECU can obtain the first authentication information by encrypting the first random number and the first message authentication code with AES-128 based on the first key.
[0030] The first random number can be generated by the second ECU; for example, the second ECU can generate a random number based on its own true random number generator, and can determine this random number as the first random number. It is understood that the first random number is randomly generated by the second ECU and possesses randomness.
[0031] Step S120: The first ECU decrypts the first authentication information based on the first key to obtain the first random number and the first message authentication code.
[0032] In some implementations, after receiving the first authentication information sent by the second ECU, the first ECU in the vehicle can decrypt the first authentication information based on a first key stored in the first ECU to obtain a first random number and a first message authentication code carried in the first authentication information. Specifically, the first ECU can perform AES-128 decryption on the first authentication information based on the first key to obtain the first random number and the first message authentication code.
[0033] Step S130: The first ECU obtains the second message authentication code based on the second key, the second identification code, and the first random number.
[0034] In some implementations, the first ECU in the vehicle decrypts the first authentication information based on the first key, obtains the first random number and the first message authentication code, and then obtains the second message authentication code based on the second key, the second identification code, and the first random number stored in the first ECU. For example, the first ECU can concatenate the second identification code with the first random number based on its own stored second key and second identification code to obtain a MAC value, and can determine this MAC value as the second message authentication code.
[0035] Step S140: If the second message authentication code matches the first message authentication code, then the first ECU determines the identity authentication of the second ECU before communication.
[0036] In some implementations, after the first ECU in the vehicle obtains the second authentication code, it can compare the second authentication code with the first authentication code. If the second authentication code matches the first authentication code, it can be determined that the second ECU has passed the authentication process prior to communication. Specifically, if the first ECU determines that the second authentication code matches the first authentication code, it can be determined that the second authentication code matches the first authentication code.
[0037] If the first ECU determines that the second message authentication code is inconsistent with the first message authentication code, it can be determined that the second message authentication code does not match the first message authentication code. This means that the second ECU has not passed the identity authentication before communication, and the identity authentication between the first ECU and the second ECU is terminated, thereby improving the security of in-vehicle communication.
[0038] An embodiment of this application provides an authentication method that obtains first authentication information sent by a second ECU through a first ECU in a vehicle. The first ECU stores a first key, a second key, a first identification code corresponding to the first ECU, and a second identification code corresponding to the second ECU. The second ECU stores the first key, the second key, the first identification code, and the second identification code. The first authentication information is determined by the second ECU encrypting a first random number and a first message authentication code based on the first key. The first message authentication code is obtained by the second ECU based on the second key, the second identification code, and the first random number. The first ECU decrypts the first authentication information based on the first key to obtain the first random number and the first message authentication code. The first ECU then obtains the second message authentication code based on the second key, the second identification code, and the first random number. If the second message authentication code matches the first message authentication code, the first ECU determines that the second ECU has passed the authentication process before communication. Thus, before communication between multiple ECUs in the vehicle, mutual authentication of identity information between multiple ECUs is achieved through two pre-set keys in the vehicle's ECUs and the unique identification code corresponding to each ECU. This eliminates the need for complex certificate management, making the entire process simple and fast, ensuring the security of in-vehicle communication while improving its efficiency.
[0039] Please see Figure 2 , Figure 2 A schematic flowchart of an identity authentication method provided in an embodiment of this application is shown. This method is applied to the aforementioned electronic device, and will be discussed below. Figure 2 The process shown will be described in detail. The identity authentication method may specifically include the following steps: Step S201: Each time the second ECU is powered on, the first authentication information is sent from the second ECU to the first ECU.
[0040] In some implementations, the second ECU in the vehicle can send first authentication information to the first ECU each time it is powered on. It is understood that the first authentication information carries a first random number, which is randomly generated by the second ECU. Thus, the first authentication information is re-acquired by the second ECU when it switches from power-off to power-on, ensuring the security of in-vehicle communication.
[0041] Step S202: Obtain the first authentication information sent by the second ECU through the first ECU in the vehicle. The first ECU stores a first key, a second key, a first identification code corresponding to the first ECU and a second identification code corresponding to the second ECU. The second ECU stores the first key, the second key, the first identification code and the second identification code. The first message authentication code is obtained by the second ECU concatenating the second identification code with the first random number based on the second key and the password-based message authentication code (CMAC) algorithm.
[0042] In some implementations, the first message authentication code can be obtained by a second ECU in the vehicle concatenating a second identification code with a first random number using a second key and a password-based message authentication code (CMAC) algorithm. Specifically, the second ECU can use the second key to concatenate the second identification code with the first random number using the CMAC algorithm to obtain the first message authentication code. For example, the first segment of the first message authentication code's numerical field can be the second identification code, and the last segment can be the first random number. Optionally, the first segment of the first message authentication code's numerical field can be the first random number, and the last segment can be the second identification code; this is not limited to this specific implementation.
[0043] Step S203: The first ECU decrypts the first authentication information based on the first key to obtain the first random number and the first message authentication code.
[0044] Step S204: The first ECU obtains the second message authentication code based on the second key, the second identification code, and the first random number.
[0045] Step S205: If the second message authentication code matches the first message authentication code, then the first ECU determines the identity authentication of the second ECU before communication.
[0046] For a description of steps S203-S205, please refer to the previous description of steps S120-S140, which will not be repeated here.
[0047] Step S206: Obtain the second authentication information sent by the first ECU through the second ECU, wherein the second authentication information is determined by the first ECU by encrypting the second random number and the third message authentication code based on the first key, and the third message authentication code is obtained by the first ECU based on the second key, the first identification code and the second random number.
[0048] In some implementations, before the first ECU and the second ECU communicate, the second ECU can obtain the second authentication information sent by the first ECU. The second authentication information can be determined by the first ECU through encryption of a second random number and a third message authentication code using a first key; the third message authentication code can be obtained by the first ECU based on the second key, a first identification code, and the second random number.
[0049] The first ECU can use a second key to concatenate a first identification code and a second random number using the CMAC algorithm to obtain a MAC value, which can then be used as the third message authentication code. After obtaining the third message authentication code, the first ECU can encrypt the second random number and the third message authentication code using the first key to obtain second authentication information. In the process of concatenating the first identification code and the second random number using the CMAC algorithm with the second key to obtain the third message authentication code, the first identification code can be used as the first segment of the digital segment of the third message authentication code, and the second random number as the last segment; alternatively, the first identification code can be used as the last segment of the digital segment of the third message authentication code, and the second random number as the first segment, which is not limited here.
[0050] The second random number can be generated by the first ECU; for example, the first ECU can generate a random number based on its own true random number generator, and can determine this random number as the second random number. It is understood that the second random number is randomly generated by the first ECU and possesses randomness.
[0051] In some implementations, when the first ECU and the second ECU in the vehicle need to communicate, the communication request can be initiated by the first ECU, the communication request can be initiated by the second ECU, or the communication request can be sent by the first ECU and the second ECU simultaneously; no limitation is made here.
[0052] As an feasible approach, if the first ECU and the second ECU in the vehicle need to communicate, the second ECU initiates the communication request. Based on this, the first ECU can send second authentication information to the second ECU after determining that the second ECU has passed the identity authentication before communication, so that the second ECU can obtain the second authentication information sent by the first ECU and perform identity authentication of the first ECU before communication.
[0053] Optionally, if the first ECU and the second ECU in the vehicle need to communicate, the first ECU initiates the communication request. Based on this, the first ECU can directly send second authentication information to the second ECU, which then uses this second authentication information to authenticate the first ECU before communication. This allows authentication of one party to proceed only after successful authentication of the other, reducing the resource consumption associated with authentication.
[0054] Optionally, if the first ECU and the second ECU in the vehicle need to communicate, and both the second ECU and the first ECU initiate a communication request to each other, then the first ECU and the second ECU in the vehicle can simultaneously send authentication information to each other. The first ECU receives the first authentication information sent by the second ECU to authenticate the second ECU before communication, and the second ECU receives the second authentication information sent by the first ECU to authenticate the first ECU before communication. This requires both parties to perform authentication simultaneously, improving the efficiency of authentication.
[0055] Step S207: The second ECU decrypts the second authentication information based on the first key to obtain the second random number and the third message authentication code.
[0056] In some implementations, after receiving the second authentication information sent by the first ECU, the second ECU in the vehicle can decrypt the second authentication information based on its own stored first key to obtain the second random number and the third message authentication code carried in the second authentication information.
[0057] Step S208: The second ECU obtains the fourth message authentication code based on the second key, the first identification code, and the second random number.
[0058] In some implementations, the second ECU in the vehicle decrypts the second authentication information based on the first key, obtains a second random number and a third message authentication code, and then obtains a fourth message authentication code based on the second key, the first identification code, and the second random number stored in the second ECU. For example, the second ECU can concatenate the first identification code with the second random number based on its own stored second key and first identification code to obtain a MAC value, and can determine this MAC value as the fourth message authentication code.
[0059] Step S209: If the fourth message authentication code matches the third message authentication code, then the second ECU determines the identity authentication of the first ECU before communication.
[0060] In some implementations, after the second ECU in the vehicle obtains the fourth authentication code, it can compare the fourth authentication code with the third authentication code. If the fourth authentication code matches the third authentication code, it can be determined that the second ECU has passed the authentication process prior to communication. Specifically, if the second ECU determines that the fourth authentication code matches the third authentication code, it can be confirmed that the fourth authentication code matches the third authentication code.
[0061] If the second ECU determines that the fourth message authentication code is inconsistent with the third message authentication code, it can be determined that the fourth message authentication code and the third message authentication code do not match. This allows it to determine that the first ECU has not passed the identity authentication before communication and terminate the identity authentication between the first ECU and the second ECU, thereby improving the security of in-vehicle communication.
[0062] Step S210: After the first ECU determines the identity authentication of the second ECU before communication, and the second ECU determines the identity authentication of the first ECU before communication, the first ECU obtains a fifth message authentication code based on the second key, the first random number, and the second random number, and the second ECU obtains a sixth message authentication code based on the second key, the first random number, and the second random number, so that the first ECU and the second ECU can communicate based on the fifth message authentication code and the sixth message authentication code.
[0063] In some implementations, after the vehicle verifies the identity of the second ECU before communication through the first ECU and the first ECU verifies the identity of the first ECU before communication through the second ECU, the first ECU can obtain a fifth message authentication code based on its stored second key, first random number, and second random number, and the second ECU can obtain a sixth message authentication code based on its stored second key, first random number, and second random number, so that the first ECU and the second ECU can communicate based on the fifth message authentication code and the sixth message authentication code.
[0064] In the process of obtaining the fifth message authentication code using its stored second key, first random number, and second random number, the first ECU can use the second key to concatenate the first and second random numbers to obtain a MAC value, which can then be used as the fifth message authentication code. Similarly, in the process of obtaining the sixth message authentication code using the same stored second key, first random number, and second random number, the second ECU can use the second key to concatenate the first and second random numbers to obtain a MAC value, which can then be used as the sixth message authentication code. Therefore, during subsequent communication between the first and second ECUs, the fifth and sixth message authentication codes can be used as encryption keys to encrypt communication data, thereby improving the security of in-vehicle communication.
[0065] In some implementations, during the process of the vehicle obtaining a fifth message authentication code via the first ECU based on a second key, a first random number, and a second random number, and obtaining a sixth message authentication code via the second ECU based on the second key, the first random number, and the second random number, the second ECU can output target prompt information to the first ECU to prompt the first ECU to complete the identity authentication before communication. The first ECU can also send a key negotiation command to the second ECU based on the target prompt information. In response to the key negotiation command, the second ECU can obtain the sixth message authentication code based on the second key, the first random number, and the second random number, and the first ECU can obtain the fifth message authentication code based on the second key, the first random number, and the second random number.
[0066] For example, please refer to Figure 3 The diagram illustrates a timing diagram of an authentication method provided in an embodiment of this application. The vehicle includes a first ECU and a second ECU. Figure 3 Only the first ECU is shown as an ADC and the second ECU as an IDC; the specific type of ECU is not limited here. Communication is required between the IDC and the ADC. The IDC can initiate a communication request to the ADC and can send first authentication information to the ADC.
[0067] Among them, IDC can generate a random number N1 (the first random number) based on its own true random number generator, and can use its own stored second key K. 2IDC Calculate the SN of IDC based on the CMAC algorithm IDC The MAC value (first message authentication code CMAC) obtained by concatenating (first identification code) and N1. K2IDC (SN) IDC ||N1)). Among them, IDC can also rely on its own stored first key K. 1IDCThe first authentication information (E) is obtained by encrypting N1 and the first message authentication code. K1IDC (N1, CMAC) K2IDC (SN) IDC ||N1))), and send the first authentication information to the ADC. Among them, E k The key K is used to encrypt the data using AES-128.
[0068] After receiving the first authentication information, the ADC can first use its stored first key K. 1ADC Decrypt the first authentication information (D) K1ADC (N1, CMAC) K2IDC (SN) IDC ||N1))), obtain N1 and the first message authentication code, and can, after decryption, use the second key K stored within itself. 2ADC and SN IDC Calculate SN IDC The MAC value (CMAC) concatenated with N1 K2ADC (SN) IDC Based on this, the ADC can compare the recalculated MAC value (Second Message Authentication Code CMAC). K2ADC (SN) IDC ||N1)) and the MAC value (first message authentication code CMAC) sent by IDC K2IDC (SN) IDC Whether ||N1)) are consistent; where, if it is determined that the second message authentication code is consistent with the first message authentication code, it can be determined that the IDC has passed the identity authentication before communication; if it is determined that the second message authentication code is inconsistent with the first message authentication code, it can be determined that the IDC has not passed the identity authentication before communication. Where, D k The key K is used to decrypt the data using AES-128.
[0069] If the ADC determines that the IDC has successfully authenticated before communication, it can reply with the verified information to notify the IDC that the authentication has been successful. Simultaneously, the ADC can generate a random number N2 (a second random number) based on its own true random number generator and can utilize its stored second key K. 2ADC Calculate the SN of the ADC based on the CMAC algorithm ADC The MAC value (third message authentication code CMAC) obtained by concatenating the second identification code and N2. K2ADC (SN) ADC ||N2), and can utilize its own stored first key K 1ADC The second authentication information (E) is obtained by encrypting N2 and the third message authentication code. K1ADC (N2, CMAC) K2ADC (SN)ADC ||N2))), and can send the second authentication information to IDC.
[0070] After receiving the second authentication information, IDC can first use its stored first key K. 1IDC Decrypt the second authentication information (D) K1IDC (N2, CMAC) K2ADC (SN) ADC ||N2)))), obtain the second random number and the third message authentication code, and can, after decryption, use the second key K stored within itself. 2IDC and SN ADC Calculate the SN of the ADC ADC The MAC value after concatenation with N2 (CMAC, Fourth Message Authentication Code) K2IDC (SN) ADC Based on this, IDC can compare the recalculated MAC value (Fourth Message Authentication Code CMAC). K2IDC (SN) ADC ||N2)) and the MAC value (third message authentication code CMAC) sent by the ADC K2ADC (SN) ADC Whether ||N2)) are consistent; if it is determined that the fourth message authentication code is consistent with the third message authentication code, it can be determined that the ADC has passed the identity authentication before communication; if it is determined that the fourth message authentication code is inconsistent with the third message authentication code, it can be determined that the ADC has not passed the identity authentication before communication.
[0071] Specifically, after confirming that the ADC has successfully completed authentication before communication, the IDC can reply with verification information (target prompt information) to the IDC, indicating that the ADC has passed the authentication process. This prompts the ADC to send a key negotiation command to the IDC based on the target prompt information. The IDC can then respond to the key negotiation command by utilizing K... 2IDC Calculate the MAC value (sixth message authentication code CMAC) after concatenating N1 and N2. K2IDC (N1||N2)); where, the ADC can utilize K 2ADC Calculate the MAC value (CMAC) after concatenating N1 and N2. K2ADC (N1||N2)), and subsequently the fifth and sixth message authentication codes will be used as temporary encryption keys K. s Encrypt the communication data between the IDC and ADC to ensure the security of in-vehicle communication.
[0072] The authentication process between the IDC and ADC before communication is required must be re-executed every time the IDC and / or ADC are powered on to ensure the freshness and security of the encryption.
[0073] In this embodiment, it is understood that before interaction, each ECU generates a random number N1 and N2, and uses their respective serial numbers (SNs) as authentication information to initiate authentication. The authentication information needs to calculate its CMAC value based on the key K2, thereby protecting the integrity of the random numbers and SNs and preventing tampering during communication. Simultaneously, N1, N2, and CMAC are encrypted using K1 to ensure confidentiality. Furthermore, after authentication is completed, the communicating parties calculate the final session key K based on the negotiated and exchanged random numbers N1 and N2. s The session key is renegotiated each time the vehicle and / or each ECU is powered on, ensuring the freshness and security of the negotiated key. Therefore, based on K1, K2, SN, and randomly generated random numbers N1 and N2, and using a corresponding algorithm, authentication and negotiation of the temporary session key K are completed. s This technology is used for subsequent in-vehicle secure communication. It can complete two-way authentication and key negotiation in just three handshakes, which improves the authentication speed. It uses only symmetric encryption algorithms, which has low computational resource consumption in the resource-constrained vehicle ECU. It does not rely on a centralized authentication authority, avoiding the risk of single point of failure. The process is simple and easy to deploy in the vehicle system.
[0074] The identity authentication method provided in one embodiment of this application is compared to... Figure 1 The authentication method shown in this embodiment can send the first authentication information to the first ECU every time the second ECU is powered on, before the first ECU in the vehicle obtains the first authentication information sent by the second ECU. This ensures the security of in-vehicle communication by generating a new session key before communication each time the ECU that needs to communicate is powered on.
[0075] Meanwhile, in this embodiment, the first message authentication code can be obtained by the second ECU by concatenating the second identification code with the first random number based on the second key and the password-based message authentication code CMAC algorithm. This allows for data encryption based on the ECU's own identification code and basic key, ensuring the integrity of communication data and improving the efficiency of identity authentication and the security of in-vehicle communication.
[0076] In addition, this embodiment can also obtain the second authentication information sent by the first ECU through the second ECU. The second authentication information is determined by the first ECU by encrypting the second random number and the third message authentication code based on the first key. The third message authentication code is obtained by the first ECU based on the second key, the first identification code, and the second random number. The second ECU decrypts the second authentication information based on the first key to obtain the second random number and the third message authentication code. The second ECU obtains the fourth message authentication code based on the second key, the first identification code, and the second random number. If the fourth message authentication code matches the third message authentication code, the second ECU determines that the first ECU has passed the identity authentication before communication. Thus, based on a symmetric algorithm, identity authentication can be achieved before in-vehicle network communication using two basic keys and the device's built-in identification code. This method has high efficiency on resource-constrained ECUs, low storage overhead, and each communicating party authenticates itself, avoiding the risk of single point of failure and improving the efficiency and security of in-vehicle communication.
[0077] Furthermore, this embodiment can also verify the identity of the second ECU before communication by the first ECU and the first ECU before communication by the second ECU. Then, the first ECU obtains the fifth message authentication code based on the second key, the first random number, and the second random number, and the second ECU obtains the sixth message authentication code based on the second key, the first random number, and the second random number. This allows the first ECU and the second ECU to communicate based on the fifth and sixth message authentication codes. Thus, while using two basic keys and the device's built-in SN to perform identity authentication before in-vehicle network communication, it also achieves session key negotiation. The complete authentication and negotiation process requires only a three-way handshake, reducing authentication latency. It eliminates the need for complex certificate management processes, and all operations are based on symmetric algorithms, resulting in extremely low ECU resource consumption while ensuring security. This meets the stringent requirements of the in-vehicle environment for efficiency and resource consumption. Encryption is implemented during both authentication and communication, improving the security of in-vehicle communication.
[0078] Please see Figure 4 , Figure 4 A schematic flowchart of an identity authentication method provided in an embodiment of this application is shown. This method is applied to the aforementioned electronic device, and will be discussed below. Figure 4 The process shown will be described in detail. The identity authentication method may specifically include the following steps: Step S310: The vehicle control unit (CCU) generates the first key and the second key in response to the key generation request, and sends the first key and the second key to the first ECU and the second ECU, respectively.
[0079] In some implementations, the vehicle may include a Control Unit (CCU) that can be linked to an ECU in the vehicle; for example, the CCU may be connected to a first ECU and a second ECU, respectively. The CCU may generate a first key and a second key in response to a key generation request, and may send the first key and the second key to the first ECU and the second ECU, respectively.
[0080] For example, please refer to Figure 5 This document illustrates a schematic diagram of a key filling process according to an embodiment of this application. The vehicle's CCU can be connected to a diagnostic tool when the vehicle rolls off the production line. The diagnostic tool can send a key generation request to the vehicle's CCU; the CCU can receive the key generation request from the diagnostic tool and, in response to the request, generate two base keys based on its own True Random Number Generator (TRNG), such as a first key K1 and a second key K2. The length of the base keys can be 128 bits. i =TRNG(0,1) 128 64 bits, etc., are not limited here.
[0081] The CCU can generate the first key K1 and the second key K2, and then send them to the in-vehicle ECUs (such as IDC, ADC, TBOX, etc.) that need to communicate with each other. After obtaining the first key K1 and the second key K2, the CCU, IDC, ADC, and TBOX can store the first key K1 and the second key K2 in their own non-volatile memory area NVM for use in subsequent identity authentication.
[0082] Step S320: Obtain the first identification code and the second identification code through the CCU, and send the first identification code and the second identification code to the first ECU and the second ECU through the CCU.
[0083] In some implementations, the vehicle can also obtain the first identification code corresponding to the second ECU and the second identification code corresponding to the second ECU through the CCU, and can send the first identification code and the second identification code to the first ECU and the second ECU through the CCU.
[0084] For example, please refer to [the document / reference]. Figure 5 The CCU can also receive the serial number (SN) of each component corresponding to the in-vehicle ECU (e.g., SN) input from the diagnostic tool. CCU SN IDC SN ADC SN TBOX(etc.), and can forward the SN of the in-vehicle ECU to the vehicle's ECUs. Each ECU can store the SN of the in-vehicle ECU for subsequent authentication. Thus, the CCU acts as a central gateway for data forwarding. When the vehicle is off-line, each ECU in the vehicle is injected with two keys, K1 and K2, as well as a unique identification code SN number for each communicating party. In this way, identity authentication and key negotiation before in-vehicle ECU communication are achieved through two pre-set keys and SN, improving the efficiency and security of in-vehicle communication.
[0085] Step S330: Obtain first authentication information sent by the second ECU through the first ECU in the vehicle, wherein the first ECU stores a first key, a second key, a first identification code corresponding to the first ECU and a second identification code corresponding to the second ECU, and the second ECU stores the first key, the second key, the first identification code and the second identification code. The first authentication information is determined by the second ECU by encrypting a first random number and a first message authentication code based on the first key. The first message authentication code is obtained by the second ECU based on the second key, the second identification code and the first random number.
[0086] Step S340: The first ECU decrypts the first authentication information based on the first key to obtain the first random number and the first message authentication code.
[0087] Step S350: The first ECU obtains the second message authentication code based on the second key, the second identification code, and the first random number.
[0088] Step S360: If the second message authentication code matches the first message authentication code, then the first ECU determines the identity authentication of the second ECU before communication.
[0089] For a description of steps S330-S360, please refer to the previous description of steps S110 and S140, which will not be repeated here.
[0090] The identity authentication method provided in one embodiment of this application is compared to... Figure 1The authentication method shown in this embodiment can generate a first key and a second key in response to a key generation request before the first ECU in the vehicle obtains the first authentication information sent by the second ECU. The first key and the second key are then sent to the first ECU and the second ECU, respectively. The first identification code and the second identification code are obtained by the CCU and sent to the first ECU and the second ECU, respectively. The CCU acts as a central gateway for data forwarding. When the vehicle is off the production line, two keys K1 and K2 and a unique identification code SN of each communicating party are injected into each ECU in the vehicle. Thus, identity authentication and key negotiation before communication between the ECUs in the vehicle are realized through the two preset keys and SN, which improves the efficiency and security of in-vehicle communication.
[0091] Please see Figure 6 , Figure 6 This illustration shows a module block diagram of an authentication device according to an embodiment of the present application. The authentication device 200 is applied to the aforementioned electronic device, and will be discussed below. Figure 6 The process is described in detail below. The identity authentication device 200 includes: a first authentication information acquisition module 210, a first authentication information decryption module 220, a second message authentication code acquisition module 230, and a first verification module 240, wherein: The first authentication information acquisition module 210 is used to acquire first authentication information sent by the second ECU through the first ECU in the vehicle. The first ECU stores a first key, a second key, a first identification code corresponding to the first ECU and a second identification code corresponding to the second ECU. The second ECU stores the first key, the second key, the first identification code and the second identification code. The first authentication information is determined by the second ECU encrypting a first random number and a first message authentication code based on the first key. The first message authentication code is obtained by the second ECU based on the second key, the second identification code and the first random number.
[0092] The first authentication information decryption module 220 is used to decrypt the first authentication information based on the first key by the first ECU to obtain the first random number and the first message authentication code.
[0093] The second message authentication code acquisition module 230 is used to acquire the second message authentication code through the first ECU based on the second key, the second identification code and the first random number.
[0094] The first verification module 240 is used to determine the identity authentication of the second ECU before communication by the first ECU if the second message authentication code matches the first message authentication code.
[0095] Furthermore, the identity authentication device 200 may further include: a second authentication information acquisition unit, a second authentication information decryption unit, a fourth message authentication code acquisition unit, and a second verification unit, wherein: The second authentication information acquisition unit is used to acquire the second authentication information sent by the first ECU through the second ECU. The second authentication information is determined by the first ECU by encrypting a second random number and a third message authentication code based on the first key. The third message authentication code is acquired by the first ECU based on the second key, the first identification code, and the second random number.
[0096] The second authentication information decryption unit is used to decrypt the second authentication information based on the first key by the second ECU to obtain the second random number and the third message authentication code.
[0097] The fourth message authentication code acquisition unit is used to acquire the fourth message authentication code through the second ECU based on the second key, the first identification code and the second random number.
[0098] The second verification unit is used to determine the identity authentication of the first ECU before communication by means of the second ECU if the fourth message authentication code matches the third message authentication code.
[0099] Furthermore, the identity authentication device 200 may further include: a key negotiation unit, wherein: The key negotiation unit is used to, after the first ECU determines the identity authentication of the second ECU before communication, and after the second ECU determines the identity authentication of the first ECU before communication, obtain a fifth message authentication code through the first ECU based on the second key, the first random number, and the second random number, and obtain a sixth message authentication code through the second ECU based on the second key, the first random number, and the second random number, so that the first ECU and the second ECU can communicate based on the fifth message authentication code and the sixth message authentication code.
[0100] Furthermore, the key negotiation unit may include: an authentication pass prompt unit, a key negotiation instruction sending unit, and a key negotiation subunit, wherein: The authentication success prompt unit is used to output target prompt information to the first ECU through the second ECU, wherein the target prompt information is used to prompt the first ECU to pass the identity authentication before communication.
[0101] A key negotiation instruction sending unit is used to send a key negotiation instruction to the second ECU through the first ECU based on the target prompt information.
[0102] The key negotiation subunit is configured to obtain the sixth message authentication code based on the second key, the first random number, and the second random number in response to the key negotiation instruction via the second ECU, and to obtain the fifth message authentication code based on the second key, the first random number, and the second random number via the first ECU.
[0103] Furthermore, before obtaining the first authentication information sent by the second ECU through the first ECU in the vehicle, the identity authentication device 200 may further include: a first authentication information sending unit, wherein: The first authentication information sending unit is used to send the first authentication information to the first ECU through the second ECU each time the second ECU is powered on.
[0104] Furthermore, before obtaining the first authentication information sent by the second ECU through the first ECU in the vehicle, the identity authentication device 200 may further include: a key generation unit and an identification code sending unit, wherein: The key generation unit is configured to generate the first key and the second key in response to a key generation request via the vehicle control unit (CCU), and send the first key and the second key to the first ECU and the second ECU, respectively.
[0105] An identification code sending unit is used to obtain the first identification code and the second identification code through the CCU, and send the first identification code and the second identification code to the first ECU and the second ECU through the CCU.
[0106] Furthermore, the first message authentication code is obtained by the second ECU concatenating the second identification code with the first random number based on the second key and the password-based message authentication code (CMAC) algorithm.
[0107] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0108] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.
[0109] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0110] Please see Figure 7 This document illustrates a structural block diagram of an electronic device according to an embodiment of this application. The electronic device 100 can be a vehicle, in-vehicle terminal, server, computer, or other device with processing capabilities. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs. The one or more application programs may be stored in the memory 120 and configured to be executed by one or more processors 110. The one or more programs are configured to perform the methods described in the foregoing method embodiments.
[0111] The processor 110 may include one or more processing cores. The processor 110 connects to various parts of the vehicle 100 via various interfaces and lines, and performs various functions and processes data of the vehicle 100 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and by calling data stored in the memory 120. Optionally, the processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 110 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 110 and may be implemented separately through a communication chip.
[0112] The memory 120 may include random access memory (RAM) or read-only memory (ROM). The memory 120 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 100 during use (such as phonebook data, audio and video data, chat log data, etc.).
[0113] In this embodiment, a computer-readable medium stores program code, which can be called by a processor to execute the methods described in the above method embodiments.
[0114] Computer-readable storage media can be electronic storage devices such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, computer-readable storage media includes non-transitory computer-readable storage medium. The computer-readable storage medium has storage space for program code that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code can be compressed, for example, in a suitable form.
[0115] In this application, "multiple" refers to two or more.
[0116] In this application, unless otherwise expressly defined, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0117] The terms “first,” “second,” “third,” “fourth,” etc., in this application (if present) are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0118] In this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, in this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0119] Unless otherwise specified, all steps in this application may be performed sequentially or randomly. For example, if the method includes steps A and B, it means that the method may include steps A and B performed sequentially, or it may include steps B and A performed sequentially. For example, if the method may also include step C, it means that step C may be added to the method in any order. For example, the method may include steps A, B, and C, or it may include steps A, C, and B, or it may include steps C, A, and B, etc.
[0120] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An identity authentication method, characterized in that, The method includes: The first authentication information sent by the second ECU is obtained through the first ECU in the vehicle. The first ECU stores a first key, a second key, a first identification code corresponding to the first ECU and a second identification code corresponding to the second ECU. The second ECU stores the first key, the second key, the first identification code and the second identification code. The first authentication information is determined by the second ECU by encrypting a first random number and a first message authentication code based on the first key. The first message authentication code is obtained by the second ECU based on the second key, the second identification code and the first random number. The first ECU decrypts the first authentication information based on the first key to obtain the first random number and the first message authentication code; The first ECU obtains the second message authentication code based on the second key, the second identification code, and the first random number. If the second message authentication code matches the first message authentication code, then the first ECU determines the identity authentication of the second ECU before communication.
2. The method according to claim 1, characterized in that, The method further includes: The second ECU obtains the second authentication information sent by the first ECU, wherein the second authentication information is determined by the first ECU by encrypting the second random number and the third message authentication code based on the first key, and the third message authentication code is obtained by the first ECU based on the second key, the first identification code and the second random number; The second ECU decrypts the second authentication information based on the first key to obtain the second random number and the third message authentication code; The second ECU obtains the fourth message authentication code based on the second key, the first identification code, and the second random number. If the fourth message authentication code matches the third message authentication code, then the second ECU determines the identity authentication of the first ECU before communication.
3. The method according to claim 2, characterized in that, The method further includes: After the first ECU determines the identity authentication of the second ECU before communication, and the second ECU determines the identity authentication of the first ECU before communication, the first ECU obtains a fifth message authentication code based on the second key, the first random number, and the second random number, and the second ECU obtains a sixth message authentication code based on the second key, the first random number, and the second random number, so that the first ECU and the second ECU can communicate based on the fifth message authentication code and the sixth message authentication code.
4. The method according to claim 3, characterized in that, The step of obtaining a fifth message authentication code through the first ECU based on the second key, the first random number, and the second random number, and obtaining a sixth message authentication code through the second ECU based on the second key, the first random number, and the second random number, includes: The second ECU outputs target prompt information to the first ECU, wherein the target prompt information is used to prompt the first ECU to complete the identity authentication before communication; The first ECU sends a key negotiation command to the second ECU based on the target prompt information; The second ECU, in response to the key negotiation instruction, obtains the sixth message authentication code based on the second key, the first random number, and the second random number, and the first ECU obtains the fifth message authentication code based on the second key, the first random number, and the second random number.
5. The method according to any one of claims 1-4, characterized in that, Before obtaining the first authentication information sent by the second ECU through the first ECU in the vehicle, the method further includes: Each time the second ECU is powered on, the first authentication information is sent from the second ECU to the first ECU.
6. The method according to any one of claims 1-4, characterized in that, Before obtaining the first authentication information sent by the second ECU through the first ECU in the vehicle, the method further includes: The vehicle control unit (CCU) generates the first key and the second key in response to the key generation request, and sends the first key and the second key to the first ECU and the second ECU, respectively. The first identification code and the second identification code are obtained through the CCU, and the first identification code and the second identification code are sent to the first ECU and the second ECU through the CCU.
7. The method according to any one of claims 1-4, characterized in that, The first message authentication code is obtained by the second ECU by concatenating the second identification code with the first random number based on the second key and the password-based message authentication code (CMAC) algorithm.
8. An identity authentication device, characterized in that, The device includes: The first authentication information acquisition module is used to acquire first authentication information sent by the second ECU through the first ECU in the vehicle. The first ECU stores a first key, a second key, a first identification code corresponding to the first ECU and a second identification code corresponding to the second ECU. The second ECU stores the first key, the second key, the first identification code and the second identification code. The first authentication information is determined by the second ECU by encrypting a first random number and a first message authentication code based on the first key. The first message authentication code is obtained by the second ECU based on the second key, the second identification code and the first random number. The first authentication information decryption module is used to decrypt the first authentication information based on the first key through the first ECU to obtain the first random number and the first message authentication code; The second message authentication code acquisition module is used to acquire the second message authentication code through the first ECU based on the second key, the second identification code and the first random number; The first verification module is used to determine the identity authentication of the second ECU before communication by means of the first ECU if the second message authentication code matches the first message authentication code.
9. An electronic device, characterized in that, include: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains program code that can be invoked by a processor to execute the method as described in any one of claims 1-7.