Identity authentication method and device, vehicle, electronic control unit and storage medium
By using part of the encrypted information for ECU identity authentication in the in-vehicle network, the problem of missing ECU identity authentication in the in-vehicle network is solved, secure communication and efficient identity authentication are achieved, and the security and communication of the in-vehicle network are enhanced. efficiency.
Patent Information
- Application Number
- CN202310361154.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-06
- Publication Date
- 2024-10-15
AI Technical Summary
The lack of an identity authentication solution for electronic control units (ECUs) in the in-vehicle network makes it impossible to achieve secure communication between ECUs.
By encrypting the initial data obtained based on the preset key and sending part of the encrypted information for identity authentication between ECUs, two-way identity authentication is achieved, the amount of information data and load rate are reduced, and communication efficiency and security are improved.
It realizes identity authentication between ECUs, improves communication security and efficiency, can resist replay attacks, and ensures the credibility and security of intra-vehicle network communications.
Smart Images

Figure CN118784251A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of in-vehicle network technology, and in particular to an identity authentication method, device, vehicle, electronic control unit and storage medium. Background Art
[0002] In-vehicle network is the basic technology for realizing single-vehicle intelligent networking. In-vehicle network refers to a standardized vehicle network established based on mature technologies such as controller area network (CAN), local interconnect network (Local Interconnect Network) or Ethernet, which realizes communication between various electronic control units (ECU) in the vehicle.
[0003] In order to achieve secure communication between two ECUs, the ECUs need to be authenticated. However, currently, there is a lack of solutions for ECU authentication in the in-vehicle network. Therefore, how to authenticate the ECUs has become a technical problem that needs to be solved urgently in this field. Summary of the invention
[0004] Based on this, it is necessary to provide an identity authentication method, device, vehicle, electronic control unit and storage medium that can authenticate the ECU in response to the above technical problems.
[0005] In a first aspect, the present application provides an identity authentication method. The method is applied to a first electronic control unit ECU, and the method comprises:
[0006] Encrypting the acquired initial data based on a preset key to obtain encrypted information;
[0007] The first sub-information in the encrypted information is sent to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
[0008] In the embodiment of the present application, the encrypted information is obtained by encrypting the acquired initial data based on a preset key, and the first sub-information in the encrypted information is sent to the second electronic control unit ECU, so that the second ECU authenticates the first ECU based on the first sub-information, obtains the first authentication result, and thus realizes the identity authentication of the first ECU by the second ECU. In addition, since the first ECU only sends part of the information in the encrypted information to the second ECU, the amount of data sent is reduced, the load rate of the identity authentication is reduced, and the communication efficiency of the identity authentication is improved.
[0009] In one embodiment, the method further comprises:
[0010] receiving the second sub-information and the first authentication result sent by the second ECU, and performing identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result;
[0011] Based on the first authentication result and the second authentication result, a bidirectional identity authentication result of the first ECU and the second ECU is determined.
[0012] In the embodiment of the present application, by receiving the second sub-information and the first authentication result sent by the second ECU, and based on the second sub-information and the third sub-information in the encrypted information, the second ECU is authenticated to obtain the second authentication result, and based on the first authentication result and the second authentication result, the bidirectional authentication result of the first ECU and the second ECU is determined, thereby realizing the bidirectional authentication between the first ECU and the second ECU. In addition, since the first ECU authenticates the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain the second authentication result, that is, the second ECU only sends the second sub-information to the first ECU, thereby reducing the amount of data received by the first ECU, thereby reducing the load rate of the bidirectional authentication and improving the communication efficiency of the bidirectional authentication.
[0013] In one embodiment, the first sub-information is the sub-information in the encrypted information that is located within a first preset area, and the third sub-information is the sub-information in the encrypted information that is located within a second preset area.
[0014] In an embodiment of the present application, the first sub-information is the sub-information in the encrypted information that is located within the first preset area, and the third sub-information is the sub-information in the encrypted information that is located within the second preset area, so that the first ECU can quickly determine the first sub-information based on the first preset area, and can quickly determine the third sub-information based on the second preset area, thereby improving the efficiency of identity authentication.
[0015] In one embodiment, the identity authentication of the second ECU is performed based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result, including:
[0016] Comparing the second sub-information with the third sub-information to obtain a comparison result;
[0017] If the comparison result is that the second sub-information is consistent with the third sub-information, then the second authentication result is determined to be identity authentication passed;
[0018] If the comparison result is that the second sub-information is inconsistent with the third sub-information, then the second authentication result is determined to be identity authentication failure.
[0019] In an embodiment of the present application, a comparison result is obtained by comparing the second sub-information with the third sub-information, and then the second authentication result is determined based on the comparison result. The received second sub-information is compared with the third sub-information calculated by the first ECU. Since the comparison is between the second sub-information and the third sub-information, the amount of data required for comparison is reduced, thereby improving the comparison efficiency.
[0020] In one embodiment, determining the bidirectional identity authentication result between the first ECU and the second ECU based on the first authentication result and the second authentication result includes:
[0021] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is passed, then determining that the two-way identity authentication result is that the two-way identity authentication is passed;
[0022] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is not passed, then it is determined that the two-way identity authentication result is that the two-way identity authentication is not passed.
[0023] In this embodiment, based on the first authentication result and the second authentication result, bidirectional identity authentication is achieved between the first ECU and the second ECU.
[0024] In one embodiment, the method further comprises:
[0025] Receiving the first authentication result sent by the second ECU;
[0026] If the first authentication result is that the identity authentication fails, it is determined that the identity authentication of the first ECU by the second ECU fails.
[0027] In an embodiment of the present application, if the first ECU receives a first authentication result, and the first authentication result is that the identity authentication fails, the first ECU can determine that the second ECU has failed the identity authentication of the first ECU, that is, if the first authentication result received by the first ECU is that the identity authentication fails, the first ECU may not send communication data to the second ECU subsequently, thereby improving the security of the communication data.
[0028] In one embodiment, the method further comprises:
[0029] Sending a first identity authentication request to the second ECU; the first identity authentication request is used to trigger the second ECU to generate a first random number;
[0030] The first random number sent by the second ECU is received, and the first random number is used as the initial data.
[0031] In an embodiment of the present application, by sending a first identity authentication request to the second ECU, receiving a first random number sent by the second ECU, and using the first random number as initial data, the non-fixed nature of the initial data is achieved, thereby improving the credibility of the first authentication result obtained by the second ECU authenticating the first ECU.
[0032] In one embodiment, sending the first identity authentication request to the second ECU includes:
[0033] The first identity authentication request is sent to the second ECU at preset time intervals.
[0034] In the embodiment of the present application, the method provided in the embodiment of the present application is that the first ECU sends a first identity authentication request to the second ECU at a preset time interval, so that the first random number sent by the second ECU received by the first ECU each time is different, and then the initial data obtained based on the first random number is different, so as to achieve the non-fixedness of the initial data, thereby improving the credibility of the first authentication result obtained by the second ECU for identity authentication of the first ECU, making the entire communication process more secure and able to resist replay attacks well. In addition, since the first identity authentication request is sent to the second ECU at a preset time interval, the number of first identity authentication requests sent by the first ECU can be reduced, and the communication load rate can be reduced.
[0035] In one embodiment, the method further comprises:
[0036] If the result of the two-way identity authentication is that the two-way identity authentication is passed, a communication message is sent to the second ECU; the communication message includes communication data and verification information, the verification information is determined according to the encrypted information, and the verification information is used for the second ECU to verify the communication data.
[0037] In an embodiment of the present application, when the result of the two-way authentication is that the two-way authentication is passed, the first ECU sends a communication message to the second ECU, and the verification information included in the communication message is determined based on the encrypted information, thereby improving the security of the entire communication process and being able to resist replay attacks well.
[0038] In one embodiment, the verification information includes first verification information and / or second verification information, the first verification information is information in the first sub-information located within a third preset area, and the second verification information is information in the third sub-information located within a fourth preset area.
[0039] In the embodiment of the present application, by adding verification information including the first verification information and / or the second verification information to the communication data, the security of the communication data is improved.
[0040] In one embodiment, the method further comprises:
[0041] Receiving a second identity authentication request sent by the second ECU;
[0042] A second random number is generated in response to the second identity authentication request, and the second random number is sent to the second ECU, and the second random number is used as the initial data.
[0043] In the embodiment of the present application, the first ECU can actively send a first identity authentication request to the second ECU to enable the second ECU to authenticate the first ECU, or it can passively receive a second identity authentication request sent by the second ECU, thereby enabling the first ECU to authenticate the second ECU and improving the efficiency of two-way identity authentication.
[0044] In a second aspect, the present application further provides an identity authentication device. The device is arranged in a first ECU, and the device comprises:
[0045] An encryption module, used for encrypting the acquired initial data based on a preset key to obtain encrypted information;
[0046] The sending module is used to send the first sub-information in the encrypted information to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
[0047] In a third aspect, the present application further provides a vehicle, characterized in that the vehicle comprises a first electronic control unit ECU and a second ECU;
[0048] The first ECU is used to encrypt the acquired initial data based on a preset key to obtain encrypted information;
[0049] The first ECU is used to send the first sub-information in the encrypted information to the second ECU;
[0050] The second ECU is used to perform identity authentication on the first ECU based on the first sub-information to obtain a first authentication result.
[0051] In one embodiment, the second ECU is further used to encrypt the acquired initial data based on the preset key to obtain authentication information, perform identity authentication on the first ECU based on the first sub-information and the fourth sub-information in the authentication information, and send the second sub-information in the authentication information to the first ECU; the second sub-information is the sub-information in the authentication information that is located within the second preset area, and the fourth sub-information is the sub-information in the authentication information that is located within the first preset area;
[0052] The first ECU is further configured to receive the second sub-information sent by the second ECU, and perform identity authentication on the second ECU based on the third sub-information in the encrypted information and the second sub-information to obtain a second authentication result.
[0053] In a fourth aspect, the present application further provides an electronic control unit, comprising a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of the above method when executing the computer program.
[0054] In a fifth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor.
[0055] In a sixth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0056] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Moreover, the same reference numerals are used throughout the drawings to represent the same components. In the drawings:
[0058] Figure 1 is an application environment diagram of an identity authentication method in an embodiment;
[0059] Figure 2 It is a flowchart of an identity authentication method provided in an embodiment of the present application;
[0060] Figure 3 It is a flowchart of a two-way identity authentication method provided in an embodiment of the present application;
[0061] Figure 4 It is a flowchart of a method for obtaining a second authentication result provided in an embodiment of the present application;
[0062] Figure 5 It is a flowchart of another identity authentication method provided in an embodiment of the present application;
[0063] Figure 6It is a flowchart of a method for sending an identity authentication request provided in an embodiment of the present application;
[0064] Figure 7 This is a schematic diagram of a communication message format provided by an embodiment of the present application;
[0065] Figure 8 is a schematic diagram of the verification information format provided in an embodiment of the present application;
[0066] Fig. 9 It is a signaling flow chart of a two-way identity authentication method provided in an embodiment of the present application;
[0067] Fig.10 It is a flowchart of another method for sending an identity authentication request provided in an embodiment of the present application;
[0068] Fig.11 It is a structural block diagram of an identity authentication device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0070] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0071] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0072] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0073] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0074] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple pieces" refers to more than two pieces (including two pieces).
[0075] In the description of the embodiments of the present application, the technical terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the embodiments of the present application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the embodiments of the present application.
[0076] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0077] In-vehicle network is the basic technology for realizing single-vehicle intelligent networking. In-vehicle network refers to a standardized vehicle network built based on mature CAN, local area network or Ethernet technologies to achieve communication between various ECUs in the vehicle.
[0078] In order to achieve secure communication between two ECUs, the ECUs need to be authenticated. However, currently, there is a lack of solutions for ECU authentication in the in-vehicle network. Therefore, how to authenticate the ECUs has become a technical problem that needs to be solved urgently in this field.
[0079] In an embodiment of the present application, in order to realize identity authentication of the ECU, the first ECU encrypts the acquired initial data based on a preset key to obtain encrypted information, and sends the first sub-information in the encrypted information to the second ECU; the first sub-information is used by the second ECU to authenticate the first ECU, obtain the first authentication result, and realize the identity authentication of the first ECU by the second ECU.
[0080] The identity authentication method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the first ECU communicates with the second ECU through a network. The first ECU encrypts the acquired initial data based on a preset key to obtain encrypted information, the first ECU sends the first sub-information in the encrypted information to the second ECU, the second ECU authenticates the first ECU based on the first sub-information, and obtains a first authentication result for authenticating the first ECU, thereby authenticating the ECU.
[0081] In one embodiment, Figure 2 As shown, Figure 2 is a flow chart of an identity authentication method provided in an embodiment of the present application. The method is applied to an ECU in a vehicle. In this embodiment, the method is applied to Figure 1 Taking the first ECU in the example as an example, the method includes the following steps:
[0082] S201. Encrypt the acquired initial data based on a preset key to obtain encrypted information.
[0083] The first ECU may use a cryptographic algorithm to encrypt the acquired initial data based on a preset key to obtain encrypted information. The cryptographic algorithm may include a Data Encryption Standard (DES) encryption algorithm, an Advanced Encryption Standard (AES) encryption algorithm, a message-digest algorithm 5 (MD5) encryption algorithm, etc. The preset key and the cryptographic algorithm may be integrated into the first ECU at the factory.
[0084] The initial data may be preset data, and the first ECU and the second ECU may store the preset data in advance. After the vehicle is started, both parties may simultaneously encrypt the pre-stored preset data based on the preset key to obtain encrypted information. Alternatively, the initial data may also be a random number sent by the second ECU and received by the first ECU.
[0085] S202, sending the first sub-information in the encrypted information to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
[0086] After the first ECU obtains the encrypted information, it can send part of the encrypted information to the second ECU, that is, send the first sub-information in the encrypted information to the second ECU, so that the second ECU can authenticate the first ECU based on the first sub-information and obtain a first authentication result.
[0087] In one implementation, the first ECU uses the highest bit of the encrypted information as the starting position and the number of bits of the first preset length as the first sub-information. The first preset length can be equal to one-half of the total length of the encrypted information, or can be equal to other lengths. For example, if the length of the encrypted information is 8 bytes, the high 4 bytes can be named K1, and the low 4 bytes can be named K3. The first ECU can use K1 as the first sub-information, and the first ECU only sends K1 to the second ECU.
[0088] In another implementation, the first ECU uses the lowest bit of the encrypted information as the starting position and the number of bits of the second preset length as the first sub-information. The second preset length can be equal to half of the total length of the encrypted information, or can be equal to other lengths. For example, the first ECU can use K3 as the first sub-information, and the first ECU only sends K3 to the second ECU.
[0089] It should be noted that the ECUs can determine whether to send K1 or K3 through a protocol. If the protocol is that the first ECU sends K1 after receiving the encrypted information, the first ECU sends K1 to the second ECU. If the protocol is that the first ECU sends K3 after receiving the encrypted information, the first ECU sends K3 to the second ECU. For ease of introduction, this embodiment takes the example of the first ECU sending K1 to the second ECU for explanation.
[0090] The second ECU is also integrated with a preset key and cryptographic algorithm when it leaves the factory. After the vehicle is started, the second ECU can use the integrated cryptographic algorithm to encrypt the preset key to obtain authentication information. The length of the authentication information is 8 bytes. The high 4 bytes in the authentication information are named K4, and the low 4 bytes in the authentication information are named K2. After the second ECU receives K1, the process of the second ECU performing identity authentication on the first ECU is, for example, as follows: the second ECU compares K1 with K4 calculated by itself. If K1 is consistent with K4, the first authentication result is determined to be identity authentication passed; if K1 is inconsistent with K4, the first authentication result is determined to be identity authentication failed. Among them, if the preset key integrated in the second ECU when it leaves the factory is the same as that of the first ECU, and the cryptographic algorithm integrated in the second ECU is the same as that of the first ECU, the first authentication result obtained by the second ECU comparing K1 with K4 calculated by itself is the result of identity authentication passed, otherwise, the first authentication result obtained is the result of identity authentication failed.
[0091] The method provided in the embodiment of the present application encrypts the acquired initial data based on a preset key to obtain encrypted information, and sends the first sub-information in the encrypted information to the second electronic control unit ECU, so that the second ECU authenticates the first ECU based on the first sub-information, obtains the first authentication result, and thus realizes the second ECU's authentication of the first ECU. In addition, since the first ECU only sends part of the information in the encrypted information to the second ECU, the amount of data sent is reduced, the load rate of the authentication is reduced, and the communication efficiency of the authentication is improved.
[0092] In one embodiment, Figure 3 As shown, Figure 3 : is a flowchart of a two-way identity authentication method provided in an embodiment of the present application. The method comprises the following steps:
[0093] S301. Encrypt the acquired initial data based on a preset key to obtain encrypted information.
[0094] S302, sending the first sub-information in the encrypted information to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
[0095] S303, receiving the second sub-information and the first authentication result sent by the second ECU, and performing identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result.
[0096] Taking the first sub-information as K1 as an example, the second sub-information is, for example, K2 in the above embodiment. If the first authentication result obtained by the second ECU is that the identity authentication is passed, that is, the second ECU determines that the first ECU is a trusted ECU, the second ECU can send K2 and the first authentication result to the first ECU. Correspondingly, the first ECU receives K2 and the first authentication result, and based on K2 and the third sub-information in the encrypted information, performs identity authentication on the second ECU to obtain the second authentication result. Among them, the third sub-information is K3.
[0097] If K2 is consistent with K3, the first ECU determines that the second authentication result is that the identity authentication is passed, that is, the first ECU determines that the second ECU is a trusted ECU. If K2 is consistent with K3, the first ECU determines that the second authentication result is that the identity authentication is not passed, that is, the first ECU determines that the second ECU is an untrustworthy ECU.
[0098] It should be noted that the authentication of the first ECU by the second ECU and the authentication of the second ECU by the first ECU can be performed simultaneously, that is, after the vehicle is started, the first ECU obtains the encrypted information, the second ECU obtains the authentication information, and the first ECU sends K1 to the second ECU, and the second ECU sends K2 to the first ECU. Among them, the first ECU sends K1 to the second ECU, so that the second ECU can realize the identity authentication of the first ECU based on K1 and K4; the second ECU sends K2 to the first ECU, so that the first ECU can realize the identity authentication of the second ECU based on K2 and K3.
[0099] S304: Determine a bidirectional identity authentication result between the first ECU and the second ECU based on the first authentication result and the second authentication result.
[0100] If the first authentication result is that the identity authentication fails, and the second authentication result is that the identity authentication passes, then the two-way identity authentication result is determined to be that the two-way identity authentication fails;
[0101] If the first authentication result is that the identity authentication fails, and the second authentication result is that the identity authentication fails, then the bidirectional identity authentication result is determined to be that the bidirectional identity authentication fails.
[0102] The method provided in this embodiment receives the second sub-information and the first authentication result sent by the second ECU, and performs identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain the second authentication result, and determines the bidirectional identity authentication result of the first ECU and the second ECU based on the first authentication result and the second authentication result, thereby realizing the bidirectional identity authentication between the first ECU and the second ECU. In addition, since the first ECU performs identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain the second authentication result, that is, the second ECU only sends the second sub-information to the first ECU, thereby reducing the amount of information received by the first ECU, thereby reducing the load rate of the bidirectional identity authentication and improving the communication efficiency of the bidirectional identity authentication.
[0103] In one embodiment, the first sub-information is sub-information in the encrypted information that is located within a first preset area, and the third sub-information is sub-information in the encrypted information that is located within a second preset area.
[0104] For example, if the length of the encrypted information is 8 bytes, the highest byte of the encrypted information can be used as the first sub-information, and the lowest byte of the encrypted information can be used as the third sub-information. The highest byte is the first preset area range, and the lowest byte is the second preset area range.
[0105] Alternatively, the highest byte and the lowest byte of the encrypted information are used as the first sub-information, and the other sub-information in the encrypted information except the first sub-information is used as the third sub-information.
[0106] In an embodiment of the present application, the first sub-information is the sub-information in the encrypted information that is located within the first preset area, and the third sub-information is the sub-information in the encrypted information that is located within the second preset area, so that the first ECU can quickly determine the first sub-information based on the first preset area, and can quickly determine the third sub-information based on the second preset area, thereby improving the efficiency of identity authentication.
[0107] In one embodiment, Figure 4 As shown, Figure 4 : is a flow chart of a method for obtaining a second authentication result provided in an embodiment of the present application. This embodiment relates to a possible implementation method of how to authenticate the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result. Based on the above embodiment, the above S303 "authenticating the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result" may include the following steps:
[0108] S401: Compare the second sub-information with the third sub-information to obtain a comparison result.
[0109] S402: If the comparison result is that the second sub-information is consistent with the third sub-information, determine that the second authentication result is identity authentication passed.
[0110] S403: If the comparison result is that the second sub-information is inconsistent with the third sub-information, determine that the second authentication result is that the identity authentication fails.
[0111] For example, if the second sub-information is K2 and the third sub-information is K3, then if K2 and K3 are consistent, the second authentication result is determined to be identity authentication passed. If K2 and K3 are inconsistent, the second authentication result is determined to be identity authentication failed.
[0112] The second sub-information is consistent with the third sub-information, which may mean that the second sub-information is identical to the third sub-information, or the similarity between the second sub-information and the third sub-information is greater than or equal to a preset threshold, for example, the preset threshold is 99.8%, and the similarity between the second sub-information and the third sub-information is equal to 99.9%, then the second sub-information is considered to be consistent with the third sub-information.
[0113] In an embodiment of the present application, a comparison result is obtained by comparing the second sub-information with the third sub-information, and then the second authentication result is determined based on the comparison result. The received second sub-information is compared with the third sub-information calculated by the first ECU. Since the comparison is between the second sub-information and the third sub-information, the amount of data required for comparison is reduced, thereby improving the comparison efficiency.
[0114] In one embodiment, the above S302, determining the bidirectional identity authentication result of the first ECU and the second ECU based on the first authentication result and the second authentication result, can be implemented as follows:
[0115] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is passed, then determining that the two-way identity authentication result is that the two-way identity authentication is passed;
[0116] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is failed, then the result of the two-way identity authentication is determined to be that the two-way identity authentication is failed.
[0117] In this embodiment, based on the first authentication result and the second authentication result, bidirectional identity authentication is achieved between the first ECU and the second ECU.
[0118] In one embodiment, Figure 5 As shown, Figure 5 : is a flowchart of another identity authentication method provided by an embodiment of the present application. This embodiment relates to a flowchart of how a first ECU determines whether a second ECU has passed the identity authentication of the first ECU. Based on the above embodiment, the method includes the following steps:
[0119] S501. Receive a first authentication result sent by a second ECU.
[0120] S502: If the first authentication result is that the identity authentication fails, determine that the identity authentication of the first ECU by the second ECU fails.
[0121] In an embodiment of the present application, if the first ECU receives a first authentication result, and the first authentication result is that the identity authentication fails, the first ECU can determine that the second ECU has failed the identity authentication of the first ECU, that is, if the first authentication result received by the first ECU is that the identity authentication fails, the first ECU will not subsequently send communication data to the second ECU, thereby improving the security of the communication data.
[0122] It should be noted that if the first authentication result received by the first ECU is that the identity authentication fails, then even if the first ECU has received the second sub-information sent by the second ECU, it is not necessary to compare the second sub-information with the third sub-information, that is, there is no need to authenticate the identity of the second ECU, and the identity authentication of other ECUs can be performed next, thereby improving the efficiency of communication authentication.
[0123] In some embodiments, the first ECU may be an ECU that actively initiates an identity authentication request, and the ECU that actively initiates an identity authentication request may be an ECU that actively sends data to another ECU. Figure 6 As shown, Figure 6 : is a flowchart of a method for sending an identity authentication request provided in an embodiment of the present application. Based on the above embodiment, the method includes the following steps:
[0124] S601. Send a first identity authentication request to the second ECU; the first identity authentication request is used to trigger the second ECU to generate a first random number.
[0125] The first ECU may send a first identity authentication request to the second ECU in real time.
[0126] S602: Receive a first random number sent by the second ECU, and use the first random number as initial data.
[0127] The second ECU can send the first random number generated by itself to the first ECU, and accordingly, the first ECU uses the received first random number as initial data. After the first ECU obtains the initial data, it can encrypt the initial data based on the preset key to obtain new encrypted information, that is, for each first identity authentication request, the encrypted information obtained by the first ECU may be different, that is, K1 and K3 in the encrypted information obtained by the first ECU each time may be different.
[0128] The method provided in the embodiment of the present application realizes the non-fixedness of the initial data by sending a first identity authentication request to the second ECU, receiving a first random number sent by the second ECU, and using the first random number as initial data, thereby improving the credibility of the first authentication result obtained by the second ECU to authenticate the first ECU.
[0129] In some embodiments, the above S601, sending the first identity authentication request to the second ECU, may be implemented in the following manner:
[0130] The first ECU may send a first identity authentication request to the second ECU at a preset time interval. For example, the first ECU may repeatedly send a first identity authentication request to the second ECU every 5 seconds, that is, multiple identity authentications may be performed in a driving period from vehicle startup to vehicle shutdown. For each first identity authentication request sent by the first ECU, the second ECU generates a new first random number S.
[0131] In the method provided by the embodiment of the present application, the first ECU sends a first identity authentication request to the second ECU at a preset time interval, so that the first random number sent by the second ECU received by the first ECU each time is different, and then the initial data obtained based on the first random number is different, so as to achieve the non-fixedness of the initial data, thereby improving the credibility of the first authentication result obtained by the second ECU for identity authentication of the first ECU, making the entire communication process more secure and able to resist replay attacks well. In addition, since the first identity authentication request is sent to the second ECU at a preset time interval, the number of first identity authentication requests sent by the first ECU can be reduced, and the communication load rate can be reduced.
[0132] In some embodiments, if the first ECU is the ECU that actively initiates the identity authentication request, then when the result of the two-way identity authentication between the first ECU and the second ECU is that the two-way identity authentication is passed, the first ECU may actively send a communication message to the second ECU, and the steps of sending the communication message to the second ECU are as follows:
[0133] If the result of the two-way identity authentication is that the two-way identity authentication is passed, a communication message is sent to the second ECU; the communication message includes communication data and verification information, the verification information is determined according to the encrypted information, and the verification information is used for the second ECU to verify the communication data. Among them, the format of a frame of communication message is as follows Figure 7 As shown, Figure 7 It is a schematic diagram of a communication message format provided in an embodiment of the present application.
[0134] In an embodiment of the present application, when the result of the two-way authentication is that the two-way authentication is passed, the first ECU sends a communication message to the second ECU, and the verification information included in the communication message is determined based on the encrypted information, thereby improving the security of the entire communication process and being able to resist replay attacks well.
[0135] For example, if the encrypted information is the 8-byte encrypted information described in the above embodiment, and the encrypted information includes the first sub-information K1 and the third sub-information K3, then the verification information may include part of the information in K1 and / or part of the information in K3. For example, the verification information includes the upper 4 bits in the first sub-information K1 and the lower 4 bits in the third sub-information K3.
[0136] It should be noted that if the first ECU uses the first random number sent by the second ECU as the initial data, since the first random number corresponding to each first authentication request may be different, the initial data may be different, so that the encryption information corresponding to each first authentication request is different, and the verification information will also change with the encryption information. This can make the entire communication process more secure and can resist replay attacks well.
[0137] In some embodiments, the verification information includes first verification information and / or second verification information, the first verification information is information in the first sub-information located within a third preset area, and the second verification information is information in the third sub-information located within a fourth preset area.
[0138] The third preset area range may be a part of or the entire area in the first sub-information, and the fourth preset area range may be a part of or the entire area in the third sub-information.
[0139] For example, taking the third preset area range as a part of the first sub-information and the fourth preset area range as a part of the third sub-information as an example, the first verification information may be composed of the upper 4 bits of the first sub-information, and the third preset area range refers to the area range where the upper 4 bits of the first sub-information are located; the second verification information may be composed of the lower 4 bits of the third sub-information, and the fourth preset area range refers to the area range where the lower 4 bits of the third sub-information are located. In this case, the amount of data in the verification information can be reduced and the verification efficiency can be improved. Figure 8 As shown, Figure 8 is a schematic diagram of the verification information format provided in the embodiment of the present application, Figure 8 The check information shown in is 1 byte, the high 4 bits of the 1 byte are used as the first check information, the low 4 bits of the 1 byte are used as the second check information, the high 4 bits are the high 4 bits in the first sub-information, and the low 4 bits are the low 4 bits in the third sub-information.
[0140] Alternatively, the first verification information may be composed of the upper 4 bits of the first sub-information, and the third preset area range refers to the area range where the upper 4 bits of the first sub-information are located; the second verification information may be composed of the upper 4 bits of the third sub-information, and the fourth preset area range refers to the area range where the upper 4 bits of the third sub-information are located.
[0141] In the embodiment of the present application, by adding verification information including the first verification information and / or the second verification information to the communication data, the security of the communication data is improved.
[0142] In order to introduce the two-way authentication process between the first ECU and the second ECU more clearly, Fig. 9 To explain, Fig. 9This is a signaling flow chart of a two-way identity authentication method provided in an embodiment of the present application. In this embodiment, the first ECU actively sends an identity authentication request to the second ECU as an example.
[0143] S901. The first ECU sends a first identity authentication request to the second ECU.
[0144] Correspondingly, the second ECU receives the first identity authentication request sent by the first ECU.
[0145] S902. The second ECU generates a first random number in response to the first identity authentication request.
[0146] S903: The second ECU sends a first random number to the first ECU.
[0147] The second ECU sends a first random number to the first ECU to challenge the first ECU.
[0148] S904: The second ECU uses the first random number as initial data, uses a pre-stored preset key to encrypt the initial data to obtain authentication information, and divides the authentication information into fourth sub-information and second sub-information.
[0149] The fourth sub-information may be a sub-information of a preset length starting from the highest bit of the authentication information, and the second sub-information K may be a sub-information of a preset length starting from the lowest bit of the authentication information. For example, the fourth sub-information is K4 as described in the above embodiment, and the second sub-information is K2, that is, the second ECU divides the authentication information into the upper 4 bytes of K4 and the lower 4 bytes of K2.
[0150] S905 . The first ECU uses the first random number as initial data, encrypts the acquired initial data based on a preset key to obtain encrypted information, and decomposes the encrypted information into first sub-information and third sub-information.
[0151] The first sub-information may be K1 introduced in the above embodiment, and the third sub-information may be K3 introduced in the above embodiment.
[0152] S906: The first ECU sends the first sub-information to the second ECU.
[0153] Correspondingly, the second ECU receives the first sub-information sent by the first ECU.
[0154] S907 . The second ECU compares the received first sub-information with the fourth sub-information to obtain a first authentication result.
[0155] If the first sub-information is consistent with the fourth sub-information, the first authentication result is determined to be identity authentication passed. If the first sub-information is inconsistent with the fourth sub-information, the first authentication result is determined to be identity authentication failed. If the first authentication result is identity authentication passed, the second ECU can send the first authentication result and the second sub-information to the first ECU.
[0156] S908. The second ECU sends the first authentication result and the second sub-information to the first ECU.
[0157] Correspondingly, the first ECU receives the first authentication result and the second sub-information sent by the second ECU.
[0158] S909: The first ECU compares the second sub-information with the third sub-information in the encrypted information.
[0159] If the second sub-information is consistent with the third sub-information, the first ECU determines that the second ECU is a trusted ECU.
[0160] S910. The first ECU sends a communication message to the second ECU.
[0161] S911. The second ECU verifies the communication data in the communication message based on the authentication information and the verification information.
[0162] Correspondingly, the second ECU receives the communication message and verifies the verification information included in the communication message based on the authentication information calculated by itself. For example, if the first verification information is composed of the upper 4 bits of the first sub-information, and the second verification information is composed of the lower 4 bits of the third sub-information, the second ECU can use the upper 4 bits in the fourth sub-information to compare with the first verification information to obtain a first comparison result, and use the lower 4 bits in the second sub-information to compare with the second verification information to obtain a second comparison result, and then determine whether the received communication message is a credible message based on the first comparison result and the second comparison result.
[0163] For example, if the first comparison result is that the lower 4 bits in the second sub-information are consistent with the second verification information, and the second comparison result is that the lower 4 bits in the second sub-information are consistent with the second verification information, then the received communication message is determined to be a credible message; if the first comparison result is that the lower 4 bits in the second sub-information are inconsistent with the second verification information, and / or the second comparison result is that the lower 4 bits in the second sub-information are inconsistent with the second verification information, then the received communication message is determined to be an untrustworthy message.
[0164] It should be noted that, in some embodiments, the first ECU may be an ECU that passively performs an identity authentication request, and the ECU that passively performs an identity authentication request may be an ECU that receives data sent by the second ECU, that is, if the second ECU needs to actively send data to the first ECU, the second ECU may send a second identity authentication request to the first ECU. Fig.10 As shown, Fig.10 1 is a flow chart of another method for sending an identity authentication request provided in an embodiment of the present application. Based on the above embodiment, the method includes the following steps:
[0165] S1001. Receive a second identity authentication request sent by a second ECU.
[0166] S1002. Generate a second random number in response to the second identity authentication request, send the second random number to the second ECU, and use the second random number as initial data.
[0167] If the first ECU receives a second identity authentication request sent by the second ECU, it can generate a second random number in response to the second identity authentication request, and send the second random number to the second ECU, and use the second random number as initial data. The first ECU uses a preset key to encrypt the initial data to obtain encrypted information, and the subsequent execution process of the first ECU is the same as the execution process of the second ECU introduced in the above embodiment. To avoid repetition, it will not be repeated here.
[0168] In the embodiment of the present application, the first ECU can actively send a first identity authentication request to the second ECU to enable the second ECU to authenticate the first ECU, or it can passively receive a second identity authentication request sent by the second ECU, thereby enabling the first ECU to authenticate the second ECU and improving the efficiency of two-way identity authentication.
[0169] In an embodiment of the present application, a vehicle is also provided, the vehicle comprising: Figure 1 A first ECU and a second ECU are shown;
[0170] The first ECU is used to encrypt the acquired initial data based on a preset key to obtain encrypted information;
[0171] The first ECU is used to send the first sub-information in the encrypted information to the second ECU;
[0172] The second ECU is used to perform identity authentication on the first ECU based on the first sub-information to obtain a first authentication result.
[0173] In some embodiments, the second ECU is further used to encrypt the acquired initial data based on a preset key to obtain authentication information, perform identity authentication on the first ECU based on the first sub-information and the fourth sub-information in the authentication information, and send the second sub-information in the authentication information to the first ECU; the second sub-information is the sub-information in the authentication information that is within the second preset area, and the fourth sub-information is the sub-information in the authentication information that is within the first preset area;
[0174] The first ECU is further used to receive the second sub-information sent by the second ECU, and perform identity authentication on the second ECU based on the third sub-information in the encrypted information and the second sub-information to obtain a second authentication result.
[0175] The second sub-information is the sub-information in the authentication information that is located within the second preset area, that is, the area where the second sub-information is located in the authentication information corresponds to the area where the third sub-information is located in the encrypted information. For example, when the third sub-information is information of a lowest byte of the encrypted information, the second sub-information is information of a lowest byte in the authentication information.
[0176] The fourth sub-information is the sub-information in the authentication information that is located within the first preset area, that is, the area where the fourth sub-information is located in the authentication information corresponds to the area where the first sub-information is located in the encrypted information. For example, when the first sub-information is the highest byte of the encrypted information, the fourth sub-information is the highest byte of the authentication information.
[0177] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0178] Based on the same inventive concept, the embodiment of the present application also provides an identity authentication device for implementing the identity authentication method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more identity authentication device embodiments provided below can refer to the limitations on the identity authentication method above, and will not be repeated here.
[0179] In one embodiment, Fig.11 As shown, Fig.11 1 is a structural block diagram of an identity authentication device provided in an embodiment of the present application. The device 1100 is arranged in a first ECU, and the device 1100 includes:
[0180] The encryption module 1101 is used to encrypt the acquired initial data based on a preset key to obtain encrypted information;
[0181] The first sending module 1102 is used to send the first sub-information in the encrypted information to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
[0182] In one embodiment, the method further comprises:
[0183] The first receiving module is used to receive the second sub-information and the first authentication result sent by the second ECU, and perform identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result;
[0184] The first determination module is used to determine a bidirectional identity authentication result between the first ECU and the second ECU based on the first authentication result and the second authentication result.
[0185] In one embodiment, the first sub-information is sub-information in the encrypted information that is located within a first preset area, and the third sub-information is sub-information in the encrypted information that is located within a second preset area.
[0186] In one embodiment, the first receiving module is specifically used to compare the second sub-information with the third sub-information to obtain a comparison result; if the comparison result is that the second sub-information is consistent with the third sub-information, the second authentication result is determined to be identity authentication passed; if the comparison result is that the second sub-information is inconsistent with the third sub-information, the second authentication result is determined to be identity authentication failed.
[0187] In one embodiment, the first determination module is specifically used to determine that the result of the two-way identity authentication is passed if the first authentication result is that the identity authentication is passed and the second authentication result is that the identity authentication is passed; if the first authentication result is that the identity authentication is passed and the second authentication result is that the identity authentication is not passed, then determine that the result of the two-way identity authentication is failed.
[0188] In one embodiment, the apparatus 1100 may further include:
[0189] The second receiving module is used to receive the first authentication result sent by the second ECU; if the first authentication result is that the identity authentication fails, it is determined that the identity authentication of the first ECU by the second ECU fails.
[0190] In one embodiment, the apparatus 1100 may further include:
[0191] A second sending module is used to send a first identity authentication request to the second ECU; the first identity authentication request is used to trigger the second ECU to generate a first random number;
[0192] The third receiving module is used to receive the first random number sent by the second ECU and use the first random number as initial data.
[0193] In one embodiment, the second sending module is specifically configured to send the first identity authentication request to the second ECU at preset time intervals.
[0194] In one embodiment, the apparatus 1100 may further include:
[0195] The third sending module is used to send a communication message to the second ECU if the result of the two-way identity authentication is that the two-way identity authentication is passed; the communication message includes communication data and verification information, the verification information is determined according to the encrypted information, and the verification information is used for the second ECU to verify the communication data.
[0196] In one embodiment, the verification information includes first verification information and / or second verification information, the first verification information is information in the first sub-information located within a third preset area, and the second verification information is information in the third sub-information located within a fourth preset area.
[0197] In one embodiment, the apparatus 1100 may further include:
[0198] A fourth receiving module, used for receiving a second identity authentication request sent by a second ECU;
[0199] The fourth sending module is used to generate a second random number in response to the second identity authentication request, send the second random number to the second ECU, and use the second random number as initial data.
[0200] Each module in the above-mentioned identity authentication device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0201] In one embodiment, an electronic control unit is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0202] Encrypting the acquired initial data based on a preset key to obtain encrypted information;
[0203] The first sub-information in the encrypted information is sent to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
[0204] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0205] receiving the second sub-information and the first authentication result sent by the second ECU, and performing identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result;
[0206] Based on the first authentication result and the second authentication result, a bidirectional identity authentication result of the first ECU and the second ECU is determined.
[0207] In one embodiment, the first sub-information is sub-information in the encrypted information that is located within a first preset area, and the third sub-information is sub-information in the encrypted information that is located within a second preset area.
[0208] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0209] Comparing the second sub-information with the third sub-information to obtain a comparison result;
[0210] If the comparison result shows that the second sub-information is consistent with the third sub-information, the second authentication result is determined to be identity authentication passed;
[0211] If the comparison result is that the second sub-information is inconsistent with the third sub-information, the second authentication result is determined to be identity authentication failure.
[0212] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0213] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is passed, then determining that the two-way identity authentication result is that the two-way identity authentication is passed;
[0214] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is failed, then the result of the two-way identity authentication is determined to be that the two-way identity authentication is failed.
[0215] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0216] Receiving a first authentication result sent by a second ECU;
[0217] If the first authentication result is that the identity authentication fails, it is determined that the identity authentication of the first ECU by the second ECU fails.
[0218] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0219] Sending a first identity authentication request to the second ECU; the first identity authentication request is used to trigger the second ECU to generate a first random number;
[0220] A first random number sent by the second ECU is received, and the first random number is used as initial data.
[0221] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0222] A first identity authentication request is sent to the second ECU at preset time intervals.
[0223] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0224] If the result of the two-way identity authentication is that the two-way identity authentication is passed, a communication message is sent to the second ECU; the communication message includes communication data and verification information, the verification information is determined according to the encrypted information, and the verification information is used for the second ECU to verify the communication data.
[0225] In one embodiment, the verification information includes first verification information in the first sub-information that is located within a third preset area and / or second verification information in the third sub-information that is located within a fourth preset area.
[0226] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0227] Receiving a second identity authentication request sent by a second ECU;
[0228] A second random number is generated in response to the second identity authentication request, and the second random number is sent to the second ECU, and the second random number is used as initial data.
[0229] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0230] Encrypting the acquired initial data based on a preset key to obtain encrypted information;
[0231] The first sub-information in the encrypted information is sent to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
[0232] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0233] receiving the second sub-information and the first authentication result sent by the second ECU, and performing identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result;
[0234] Based on the first authentication result and the second authentication result, a bidirectional identity authentication result of the first ECU and the second ECU is determined.
[0235] In one embodiment, the first sub-information is sub-information in the encrypted information that is located within a first preset area, and the third sub-information is sub-information in the encrypted information that is located within a second preset area.
[0236] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0237] Comparing the second sub-information with the third sub-information to obtain a comparison result;
[0238] If the comparison result shows that the second sub-information is consistent with the third sub-information, the second authentication result is determined to be identity authentication passed;
[0239] If the comparison result is that the second sub-information is inconsistent with the third sub-information, the second authentication result is determined to be identity authentication failure.
[0240] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0241] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is passed, then determining that the two-way identity authentication result is that the two-way identity authentication is passed;
[0242] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is failed, then the result of the two-way identity authentication is determined to be that the two-way identity authentication is failed.
[0243] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0244] Receiving a first authentication result sent by a second ECU;
[0245] If the first authentication result is that the identity authentication fails, it is determined that the identity authentication of the first ECU by the second ECU fails.
[0246] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0247] Sending a first identity authentication request to the second ECU; the first identity authentication request is used to trigger the second ECU to generate a first random number;
[0248] A first random number sent by the second ECU is received, and the first random number is used as initial data.
[0249] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0250] A first identity authentication request is sent to the second ECU at preset time intervals.
[0251] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0252] If the result of the two-way identity authentication is that the two-way identity authentication is passed, a communication message is sent to the second ECU; the communication message includes communication data and verification information, the verification information is determined according to the encrypted information, and the verification information is used for the second ECU to verify the communication data.
[0253] In one embodiment, the verification information includes first verification information and / or second verification information, the first verification information is information in the first sub-information located within a third preset area, and the second verification information is information in the third sub-information located within a fourth preset area.
[0254] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0255] Receiving a second identity authentication request sent by a second ECU;
[0256] A second random number is generated in response to the second identity authentication request, and the second random number is sent to the second ECU, and the second random number is used as initial data.
[0257] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0258] Encrypting the acquired initial data based on a preset key to obtain encrypted information;
[0259] The first sub-information in the encrypted information is sent to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
[0260] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0261] receiving the second sub-information and the first authentication result sent by the second ECU, and performing identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result;
[0262] Based on the first authentication result and the second authentication result, a bidirectional identity authentication result of the first ECU and the second ECU is determined.
[0263] In one embodiment, the first sub-information is sub-information in the encrypted information that is located within a first preset area, and the third sub-information is sub-information in the encrypted information that is located within a second preset area.
[0264] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0265] Comparing the second sub-information with the third sub-information to obtain a comparison result;
[0266] If the comparison result shows that the second sub-information is consistent with the third sub-information, the second authentication result is determined to be identity authentication passed;
[0267] If the comparison result is that the second sub-information is inconsistent with the third sub-information, the second authentication result is determined to be identity authentication failure.
[0268] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0269] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is passed, then determining that the two-way identity authentication result is that the two-way identity authentication is passed;
[0270] If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is failed, then the result of the two-way identity authentication is determined to be that the two-way identity authentication is failed.
[0271] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0272] Receiving a first authentication result sent by a second ECU;
[0273] If the first authentication result is that the identity authentication fails, it is determined that the identity authentication of the first ECU by the second ECU fails.
[0274] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0275] Sending a first identity authentication request to the second ECU; the first identity authentication request is used to trigger the second ECU to generate a first random number;
[0276] A first random number sent by the second ECU is received, and the first random number is used as initial data.
[0277] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0278] A first identity authentication request is sent to the second ECU at preset time intervals.
[0279] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0280] If the result of the two-way identity authentication is that the two-way identity authentication is passed, a communication message is sent to the second ECU; the communication message includes communication data and verification information, the verification information is determined according to the encrypted information, and the verification information is used for the second ECU to verify the communication data.
[0281] In one embodiment, the verification information includes first verification information and / or second verification information, the first verification information is information in the first sub-information located within a third preset area, and the second verification information is information in the third sub-information located within a fourth preset area.
[0282] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0283] Receiving a second identity authentication request sent by a second ECU;
[0284] A second random number is generated in response to the second identity authentication request, and the second random number is sent to the second ECU, and the second random number is used as initial data.
[0285] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0286] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0287] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0288] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application. In particular, as long as there is no structural conflict, the various technical features mentioned in the various embodiments can be combined in any way. The present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions that fall within the scope of the claims.
Claims
1. An identity authentication method, characterized in that: The method is applied to a first electronic control unit ECU, and the method comprises: Encrypting the acquired initial data based on a preset key to obtain encrypted information; The first sub-information in the encrypted information is sent to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
2. The method according to claim 1, characterized in that: The method further comprises: receiving the second sub-information and the first authentication result sent by the second ECU, and performing identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result; Based on the first authentication result and the second authentication result, a bidirectional identity authentication result of the first ECU and the second ECU is determined.
3. The method according to claim 2, characterized in that The first sub-information is sub-information in the encrypted information that is located within a first preset area, and the third sub-information is sub-information in the encrypted information that is located within a second preset area.
4. The method according to claim 2 or 3, characterized in that: The performing identity authentication on the second ECU based on the second sub-information and the third sub-information in the encrypted information to obtain a second authentication result includes: Comparing the second sub-information with the third sub-information to obtain a comparison result; If the comparison result is that the second sub-information is consistent with the third sub-information, determining that the second authentication result is identity authentication passed; If the comparison result is that the second sub-information is inconsistent with the third sub-information, it is determined that the second authentication result is that the identity authentication fails.
5. The method according to any one of claims 2 to 4, characterized in that: The determining, based on the first authentication result and the second authentication result, a bidirectional identity authentication result between the first ECU and the second ECU includes: If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is passed, then determining that the two-way identity authentication result is that the two-way identity authentication is passed; If the first authentication result is that the identity authentication is passed, and the second authentication result is that the identity authentication is failed, then it is determined that the two-way identity authentication result is that the two-way identity authentication is failed.
6. The method according to claim 1, characterized in that The method further comprises: Receiving the first authentication result sent by the second ECU; If the first authentication result is that the identity authentication fails, it is determined that the identity authentication of the first ECU by the second ECU fails.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Sending a first identity authentication request to the second ECU; the first identity authentication request is used to trigger the second ECU to generate a first random number; Receive the first random number sent by the second ECU, and use the first random number as the initial data.
8. The method according to claim 7, characterized in that The sending a first identity authentication request to the second ECU includes: The first identity authentication request is sent to the second ECU at preset time intervals.
9. The method according to any one of claims 2 to 5, characterized in that: The method further comprises: If the result of the two-way identity authentication is that the two-way identity authentication is passed, a communication message is sent to the second ECU; the communication message includes communication data and verification information, the verification information is determined according to the encryption information, and the verification information is used for the second ECU to verify the communication data.
10. The method according to claim 9, characterized in that The verification information includes first verification information and / or second verification information, the first verification information is information in the first sub-information that is within a third preset area, and the second verification information is information in the third sub-information that is within a fourth preset area.
11. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Receiving a second identity authentication request sent by the second ECU; A second random number is generated in response to the second identity authentication request, and the second random number is sent to the second ECU, and the second random number is used as the initial data.
12. An identity authentication device, characterized in that: The device is arranged in a first ECU, and comprises: An encryption module, used for encrypting the acquired initial data based on a preset key to obtain encrypted information; The sending module is used to send the first sub-information in the encrypted information to the second electronic control unit ECU; the first sub-information is used by the second ECU to perform identity authentication on the first ECU to obtain a first authentication result.
13. A vehicle, characterized in that: The vehicle comprises a first electronic control unit ECU and a second ECU; The first ECU is used to encrypt the acquired initial data based on a preset key to obtain encrypted information; The first ECU is used to send the first sub-information in the encrypted information to the second ECU; The second ECU is used to perform identity authentication on the first ECU based on the first sub-information to obtain a first authentication result.
14. The vehicle according to claim 13, characterized in that The second ECU is further configured to encrypt the acquired initial data based on the preset key to obtain authentication information, perform identity authentication on the first ECU based on the first sub-information and the fourth sub-information in the authentication information, and send the second sub-information in the authentication information to the first ECU; The second sub-information is the sub-information in the authentication information that is within the second preset area, and the fourth sub-information is the sub-information in the authentication information that is within the first preset area; The first ECU is further used to receive the second sub-information sent by the second ECU, and perform identity authentication on the second ECU based on the third sub-information in the encrypted information and the second sub-information to obtain a second authentication result.
15. An electronic control unit, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
