Key management method, device and equipment of in-vehicle network and storage medium
Through the on-board gateway, the on-board controller is authenticated and the key adjustment parameters are generated, and the shared key is adjusted, which solves the problem of easy cracking of encryption methods and low asymmetric encryption efficiency in the existing on-board network, achieving higher security and timeliness.
Patent Information
- Application Number
- CN202311519330.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-15
- Publication Date
- 2025-05-16
AI Technical Summary
The symmetric encryption methods used in existing vehicle-mounted networks are easily cracked, resulting in the inability to guarantee the security of data transmission. The asymmetric encryption algorithm is inefficient in key distribution, affecting the timeliness of automotive data communication.
The on-board controller is authenticated through the on-board gateway, and key adjustment parameters are generated based on random numbers, and the pre-stored shared key is adjusted to generate a session key for on-board network communication.
It improves the security and timeliness of on-board network communication, enhances the randomness and attack resistance of session keys, and reduces system resource consumption.
Smart Images

Figure CN120018121A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle-mounted communication technology, and in particular to a key management method, device, equipment and storage medium for a vehicle-mounted network. Background Art
[0002] With the development of modern automobile industry and information technology, traditional automobiles are moving towards intelligence and digitalization. As the degree of automobile intelligence and digitalization increases, more security vulnerabilities also emerge. Therefore, the information security of vehicle networks has become a key issue that needs to be considered in the automobile industry.
[0003] At present, the vehicle network mainly adopts symmetric encryption, and the communication data is encrypted through the shared key pre-stored in each vehicle controller (including ECU, automotive electronic control unit). However, this encryption method is relatively easy to be cracked by attackers, resulting in the inability to guarantee the security of data transmission. For the distribution of keys, it is necessary to use an asymmetric encryption algorithm to encrypt the shared key and then distribute it to each vehicle controller. Since the key length of asymmetric encryption is too long, it is not suitable for the CAN bus widely used in vehicle network communication. In addition, since the asymmetric encryption algorithm is relatively complex, it has the disadvantages of low encryption and decryption efficiency and high system overhead, which leads to excessive time-consuming key distribution and affects the timeliness of vehicle data communication. Therefore, there is an urgent need for a key management solution that can improve the security and timeliness of vehicle network communication. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a key management method, device, equipment and storage medium for an in-vehicle network, so as to improve the security and timeliness of in-vehicle network communications.
[0005] In a first aspect, an embodiment of the present application provides a key management method for an in-vehicle network, which is executed by an in-vehicle controller and includes:
[0006] Sending an identity authentication request to the vehicle gateway, so that the vehicle gateway performs identity authentication on the vehicle controller based on the identity authentication request;
[0007] Receiving a response message fed back by the vehicle gateway after determining that the vehicle controller has passed identity authentication; wherein the response message includes a first random number generated by the gateway;
[0008] A key adjustment parameter is determined according to the first random number, and a pre-stored shared key is adjusted according to the key adjustment parameter to obtain a session key for vehicle network communication.
[0009] In an embodiment of the present application, the vehicle-mounted controller is authenticated by the vehicle-mounted gateway, and a random number is fed back after the authentication is confirmed to be successful, so as to adjust the pre-stored shared key, thereby improving the security and timeliness of the vehicle-mounted network communication.
[0010] In some possible embodiments, determining a key adjustment parameter according to the first random number, and adjusting a pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication includes:
[0011] A key adjustment parameter is determined according to the first random number, and a cyclic shift process is performed on the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication.
[0012] In an embodiment of the present application, by cyclically shifting the shared key based on parameters determined by random numbers, the randomness and anti-attack capability of generating the session key can be improved, thereby further improving the security of the vehicle network communication.
[0013] In some possible embodiments, determining a key adjustment parameter according to the first random number, and performing cyclic shift processing on a pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication includes:
[0014] Determine a first adjustment parameter and a second adjustment parameter according to the first random number, and perform cyclic shift processing on the pre-stored shared key according to the first adjustment parameter to obtain a derived key;
[0015] Dividing the derived key into a plurality of derived sub-keys, and performing cyclic shift processing on each derived sub-key according to the second adjustment parameter;
[0016] The derived sub-keys after cyclic shift processing are concatenated to obtain the session key used for vehicle network communication.
[0017] In an embodiment of the present application, two adjustment parameters are generated according to random numbers respectively. After the shared key is cyclically shifted using the first adjustment parameter to obtain a derived key, the second adjustment parameter is then used to cyclically shift several divided derived sub-keys, so that the generated session key is more random and resistant to attacks, thereby further improving the security of the vehicle network communication.
[0018] In some possible embodiments, determining the first adjustment parameter and the second adjustment parameter according to the first random number includes:
[0019] Performing a rounding operation on the first random number based on a preset first divisor, and determining the first adjustment parameter according to an integer obtained by the operation;
[0020] A remainder operation is performed on the first random number based on a preset second divisor, and the second adjustment parameter is determined according to a remainder obtained by the operation.
[0021] In an embodiment of the present application, by performing rounding and remainder operations on the random number based on a set divisor, two adjustment parameters for cyclic shift processing are obtained, thereby improving the efficiency of generating session keys and further improving the timeliness of vehicle network communications.
[0022] In some possible embodiments, the identity authentication request includes identity information of the onboard controller;
[0023] The vehicle gateway performs identity authentication on the vehicle controller based on the identity authentication request, including:
[0024] When the vehicle gateway determines that the identity information of the vehicle controller is legal based on the pre-stored identity information list, it is determined that the vehicle controller has passed the identity authentication.
[0025] In an embodiment of the present application, identity authentication is performed on the vehicle controller that initiates the authentication request through the identity information list pre-stored by the gateway, which can improve the efficiency of identity authentication and further improve the timeliness of vehicle network communication.
[0026] In some possible embodiments, the identity authentication request includes a second random number generated by the vehicle controller; the response message also includes a first message authentication code generated by the vehicle gateway based on the shared key for the second random number;
[0027] The determining of the key adjustment parameter according to the first random number is specifically:
[0028] Generate a second message authentication code for the second random number based on the shared key;
[0029] If it is determined that the first message authentication code matches the second message authentication code, a key adjustment parameter is determined according to the first random number.
[0030] In an embodiment of the present application, a second random number is generated by the vehicle controller and sent to the vehicle gateway, thereby achieving two-way identity authentication between the vehicle controller and the vehicle gateway, thereby further improving the security of vehicle network communications.
[0031] In some possible embodiments, adjusting the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication includes:
[0032] The pre-stored shared key is adjusted according to the key adjustment parameter, and a hash operation is performed on the result after the adjustment to obtain a session key for vehicle network communication.
[0033] In the embodiment of the present application, by further performing a hash operation on the adjusted key, the generated session key is made unidirectional and collision-resistant, thereby further improving the security of the vehicle network communication.
[0034] In some possible embodiments, the first random number is a true random number generated by the vehicle gateway based on the hardware electrical characteristics when the vehicle is started this time; the second random number is a true random number generated by the vehicle controller based on the hardware electrical characteristics when the vehicle is started this time.
[0035] In the embodiment of the present application, a true random number is generated based on the hardware electrical characteristics of the car when it is started, which is used as the basis for identity authentication and key adjustment, thereby further improving the security of the vehicle network communication.
[0036] In a second aspect, an embodiment of the present application provides a key management device for an in-vehicle network, which is applied to an in-vehicle controller, including:
[0037] An authentication request module, used to send an identity authentication request to the vehicle gateway, so that the vehicle gateway performs identity authentication on the vehicle controller based on the identity authentication request;
[0038] A message receiving module, used to receive a response message fed back by the vehicle gateway after determining that the vehicle controller has passed the identity authentication; wherein the response message includes a first random number generated by the gateway;
[0039] The key generation module is used to determine a key adjustment parameter according to the first random number, and adjust the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication.
[0040] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in any embodiment of the first aspect can be implemented.
[0041] In a fourth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a computer program, wherein when the computer program is executed by a processor, the method described in any embodiment of the first aspect can be implemented.
[0042] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor can implement the method described in any embodiment of the first aspect when executing the program. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 A flowchart of a key management method for an in-vehicle network provided in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of the structure of a key management device for an in-vehicle network provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0048] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0049] like Figure 1 As shown, the embodiment of the present application provides a key management method for an in-vehicle network, which is executed by an in-vehicle controller and may include the following steps:
[0050] S1. Send an identity authentication request to the vehicle gateway, so that the vehicle gateway performs identity authentication on the vehicle controller based on the identity authentication request;
[0051] It should be noted that the car is equipped with on-board controllers such as ECU and VCU. These controllers need to communicate with each other when the car is running. In order to ensure the confidentiality of the communication data, session keys need to be used for data encryption. First, when the car is started, each on-board controller initiates an identity authentication request to the on-board gateway, and the on-board gateway authenticates these on-board controllers to ensure the legitimacy of each on-board controller when distributing key information.
[0052] S2, receiving a response message fed back by the vehicle gateway after determining that the vehicle controller has passed the identity authentication; wherein the response message includes a first random number generated by the gateway;
[0053] For a single vehicle controller, when the vehicle gateway authenticates the vehicle controller and determines that the authentication is passed, it will generate a first random number and feed it back to the vehicle controller through a response message. It is understandable that when it is determined that a vehicle controller has not passed the authentication, the vehicle gateway can feed back a message of rejection of the response to the vehicle controller, or it can directly ignore the request of the vehicle controller, so that the vehicle controller cannot obtain the first random number and generate a session key.
[0054] S3. Determine a key adjustment parameter according to the first random number, and adjust the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication.
[0055] Further, step S3 may include:
[0056] A key adjustment parameter is determined according to the first random number, and a cyclic shift process is performed on the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication.
[0057] The vehicle controller can generate a key adjustment parameter according to a certain rule based on the received first random number, and adjust the pre-stored shared key according to the key adjustment parameter, thereby generating a session key for vehicle network communication.
[0058] It should be noted that the key adjustment parameter is generated according to the first random number, and the random number can be added, subtracted, multiplied and / or divided based on a preset constant to obtain a parameter that can adjust the shared key. In order to ensure the availability of the generated key adjustment parameter, a certain interval range can be set when generating the first random number to control the generated first random number to be within the interval range.
[0059] It should be noted that, the pre-stored shared key is adjusted according to the key adjustment parameter, and a key derivation function can be applied to generate a session key by a preset algorithm using the shared key and the key adjustment parameter as input. For example, the key adjustment parameter can be used as the shift bit number, and the shared key can be cyclically shifted (either cyclically left shift or cyclically right shift) according to the shift bit number to obtain a session key for vehicle network communication.
[0060] Based on this, by cyclically shifting the shared key according to the parameters determined by the random number, the randomness and anti-attack capability of the generated session key can be improved, thereby further improving the security of the vehicle network communication.
[0061] It should be noted that, simply, the first random number can be directly used as the key adjustment parameter, and correspondingly, the shared key can be added, subtracted, multiplied and / or divided based on the first random number to generate a session key. In addition, in some possible embodiments, the process of generating the key adjustment parameter according to the first random number can adopt other preset rules, and the process of adjusting the pre-stored shared key according to the key adjustment parameter can also adopt other preset strategies, and the embodiments of the present application are not limited thereto.
[0062] It should be noted that each vehicle controller stores the same shared key. Since directly using the shared key for data encryption is a symmetric encryption method, this encryption method has the disadvantage that the key is easily leaked. In the process of encrypting the shared key with an asymmetric encryption algorithm and then distributing the shared key to each vehicle controller, due to the complexity of the asymmetric encryption algorithm, low encryption and decryption efficiency and high system overhead, key distribution takes too much time, thus affecting the timeliness of data encryption communication.
[0063] Compared with the symmetric encryption technology that directly uses pre-stored shared keys for data encryption and the technology that distributes shared keys through asymmetric encryption algorithms, the embodiment of the present application generates a random number by the vehicle gateway and feeds it back to the vehicle controller that has passed identity authentication, so that the vehicle controller adjusts the pre-stored shared key according to the random number to obtain a one-time session key. Since the dynamically generated session key is updated every time the vehicle is started, it can resist replay attacks and ensure the forward and backward security of the session key, thereby effectively improving the security of vehicle network communications. At the same time, since there is no need to go through complex encryption algorithms and no need for the participation of certification agencies such as certification centers and digital certificates, the system resource consumption is reduced, and it is suitable for vehicle network scenarios with limited system resources. It also overcomes the problem of excessive time-consuming traditional key distribution through asymmetric encryption algorithms, thereby ensuring that the vehicle network communication has high timeliness.
[0064] In some possible embodiments, determining a key adjustment parameter according to a first random number, and performing a cyclic shift process on a pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication includes:
[0065] Determine a first adjustment parameter and a second adjustment parameter according to the first random number, and perform cyclic shift processing on the pre-stored shared key according to the first adjustment parameter to obtain a derived key;
[0066] Dividing the derived key into a plurality of derived sub-keys, and performing cyclic shift processing on each derived sub-key according to the second adjustment parameter;
[0067] The derived sub-keys after cyclic shift processing are concatenated to obtain the session key used for vehicle network communication.
[0068] It should be noted that, in the process of adjusting the shared key, the shared key may be first subjected to a cyclic shift process to obtain a derived key, and then the derived key may be divided into a plurality of derived subkeys, and each derived subkey may be subjected to a cyclic shift process respectively, and finally the derived subkeys subjected to the cyclic shift process may be concatenated to obtain the session key. The first adjustment parameter used in the first cyclic shift and the second adjustment parameter used in the second cyclic shift may both be determined according to the first random number.
[0069] For example, when the first random number is a two-digit number, the tens digit of the first random number can be used as the first adjustment parameter, and the ones digit of the first random number can be used as the second adjustment parameter. For another example, the result of adding the ones digit and the tens digit of the first random number can be used as the first adjustment parameter, and the result of subtracting the ones digit and the tens digit of the first random number can be used as the second adjustment parameter. In addition, other methods can be used to determine two adjustment parameters based on the first random number, and the embodiments of the present application are not limited to this.
[0070] Based on this, the shared key is cyclically shifted, and the derived sub-keys are divided and then cyclically shifted separately, and finally spliced into a session key. This effectively improves the obfuscation level of the session key, thereby further improving the key's anti-cracking ability, thereby further improving the security of vehicle network communications.
[0071] Further, determining the first adjustment parameter and the second adjustment parameter according to the first random number includes:
[0072] Performing a rounding operation on the first random number based on a preset first divisor, and determining a first adjustment parameter according to an integer obtained by the operation;
[0073] A remainder operation is performed on the first random number based on a preset second divisor, and a second adjustment parameter is determined according to a remainder obtained by the operation.
[0074] It should be noted that the first adjustment parameter and the second adjustment parameter can be obtained by rounding and modulo respectively based on a preset divisor. Specifically, the first adjustment parameter is obtained by rounding the first random number by the first divisor, and the second adjustment parameter is obtained by modulo the first random number by the second divisor. It is understandable that the first divisor and the second divisor can be the same number.
[0075] As an example, the session key generation process is as follows:
[0076] 1. Determine the first adjustment parameter and the second adjustment parameter based on the first random number: N=Seed / 128, R=Seed%128; wherein, using a preset divisor (here 128, which can be set according to actual needs), the first random number Seed is rounded to obtain the first adjustment parameter N, and the first random number Seed is modulo operation to obtain the second adjustment parameter R.
[0077] 2. Circularly shift the pre-stored shared key left by N bits to obtain the derived key;
[0078] 3. Divide the derived key into four groups (it can be divided equally or unequally, and the number of groups can be set arbitrarily) to obtain four derived sub-keys D0, D1, D2, and D3;
[0079] 4. Perform cyclic shift processing on each derived sub-key based on the second adjustment parameter R:
[0080] D0'=Turnleft(D0, R+3), represents a circular left shift of (R+3) bits for D0;
[0081] D1'=Turnright(D1, 2(R+1)), represents a circular right shift of D1 by 2(R+1);
[0082] D2'=Turnleft(D2, 3(R+2)), represents a circular left shift of D2 by 3(R+2);
[0083] D3'=Turnright(D3, R+4), represents a circular right shift of D3 by R+4 bits;
[0084] The number of bits of the cyclic shift may be arbitrarily set based on R, and the left and right directions of the cyclic shift may also be arbitrarily set according to actual needs, and this embodiment is not limited thereto.
[0085] 5. Concatenate D0', D1', D2', and D3' and use the hash algorithm to generate the session key.
[0086] In some possible embodiments, the identity authentication request includes identity information of the onboard controller;
[0087] The vehicle gateway authenticates the vehicle controller based on the authentication request, including:
[0088] When the vehicle gateway determines that the identity information of the vehicle controller is legal based on the pre-stored identity information list, it is determined that the vehicle controller has passed the identity authentication.
[0089] It should be noted that a car is equipped with multiple on-board controllers, each of which is assigned unique identity information (such as ECU ID). On the other hand, the on-board gateway stores a list of identity information corresponding to each on-board controller. During the identity authentication process, the on-board gateway matches and verifies the identity information sent by the on-board controller according to the pre-stored identity information list to complete the identity authentication process for each on-board controller.
[0090] Furthermore, the vehicle gateway can store the identity information of the vehicle controller in the form of a hash value table. When the vehicle controller initiates an identity authentication request, it converts its own identity information into a hash value and sends it to the vehicle gateway, so that the vehicle gateway can perform identity authentication by matching the hash value. This can further ensure that the identity information of the vehicle controller is not leaked.
[0091] In some possible embodiments, the identity authentication request includes a second random number generated by the vehicle controller; the response message also includes a first message authentication code generated by the vehicle gateway based on the shared key to the second random number;
[0092] Determine the key adjustment parameter according to the first random number, specifically:
[0093] Generate a second message authentication code based on the shared key to the second random number;
[0094] If it is determined that the first message authentication code matches the second message authentication code, a key adjustment parameter is determined according to the first random number.
[0095] It should be noted that during the identity authentication process, the identity authentication request initiated by the vehicle controller also includes a second random number generated by the vehicle controller. When the vehicle gateway returns a response message, it will generate a first message authentication code based on the shared key for the second random number. When the vehicle controller receives the response message from the vehicle gateway, it will also generate a second message authentication code based on the shared key for the second random number. Then, by matching and verifying the first message authentication code with the second message authentication code, the two-way authentication between the vehicle controller and the vehicle gateway is completed. Optionally, the process of generating a message authentication code based on the shared key for the second random number can be performed using the AES128 encryption algorithm.
[0096] It should be noted that both the on-board gateway and the on-board controller can pre-store a shared key, which is written to the non-volatile memory (NVM) of the on-board controller through the offline electrical inspection diagnostic instrument before the vehicle leaves the factory. Among them, the 16-byte shared key can be stored in a storage area with a fixed address to enhance the security of the shared key storage. As an example, the 16-byte shared key can be divided into 4 parts (or split into unequal lengths), and each part can be stored in a storage area with a length of 64 bytes. In addition, the integrity of the shared key as a whole can be protected and verified by the CRC (Cyclic Redundancy Check) code.
[0097] It is understandable that only when the vehicle gateway has both the shared key and the second random number can the vehicle controller authenticate the vehicle gateway. In a network attack scenario, if the attacker only obtains the shared key or the second random number, it cannot generate a legal message authentication code (MAC), so it cannot authenticate the vehicle gateway through the vehicle controller, thereby further ensuring the security of communication data.
[0098] Based on this, the vehicle controller generates a second random number as key information to achieve two-way identity authentication between the vehicle controller and the vehicle gateway, thereby further improving the security of vehicle network communications.
[0099] In some possible embodiments, adjusting the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication includes:
[0100] The pre-stored shared key is adjusted according to the key adjustment parameter, and a hash operation is performed on the result after the adjustment to obtain a session key for vehicle network communication.
[0101] It should be noted that after the pre-stored shared key is adjusted according to the key adjustment parameters, the key information can be further encrypted using a hash algorithm (such as MD5, SHA-1 and other hash encryption algorithms), thereby utilizing the unidirectionality and anti-collision properties of the hash algorithm to make the generated session key more reliable and secure.
[0102] In some possible embodiments, the first random number is a true random number generated by the vehicle gateway based on the hardware electrical characteristics when the vehicle is started this time; the second random number is a true random number generated by the vehicle controller based on the hardware electrical characteristics when the vehicle is started this time.
[0103] It should be noted that in order to further increase the random characteristics of random numbers, the vehicle gateway or vehicle controller can generate true random numbers based on hardware electrical characteristics as random parameters for identity authentication and key adjustment. Specifically, since the session key is generated each time the car is started, the corresponding hardware electrical characteristics information, such as voltage, temperature, etc., can be obtained according to the set category when the car is started this time to generate the corresponding true random number.
[0104] Based on this, compared to pseudo-random numbers, the embodiment of the present application generates true random numbers based on the hardware electrical characteristics each time the car is started, which serves as the information basis for identity authentication and key adjustment, thereby further improving the security of vehicle network communications.
[0105] Please refer to Figure 2 , Figure 2 The following is a block diagram showing the composition of a key management device for an in-vehicle network provided by some embodiments of the present application. It should be understood that the key management device for the in-vehicle network is similar to the above-mentioned Figure 1 Corresponding to the method embodiment, each step involved in the above method embodiment can be executed. The specific functions of the key management device of the vehicle network can be found in the description above. To avoid repetition, the detailed description is appropriately omitted here.
[0106] Figure 2 The key management device of the vehicle network includes at least one software function module that can be stored in a memory in the form of software or firmware or fixed in the key management device of the vehicle network. The key management device of the vehicle network is applied to the vehicle controller, including:
[0107] An authentication request module 210 is used to send an identity authentication request to the vehicle gateway, so that the vehicle gateway performs identity authentication on the vehicle controller based on the identity authentication request;
[0108] The message receiving module 220 is used to receive a response message fed back by the vehicle gateway after determining that the vehicle controller has passed the identity authentication; wherein the response message includes a first random number generated by the gateway;
[0109] The key generation module 230 is used to determine a key adjustment parameter according to the first random number, and adjust the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication.
[0110] It can be understood that the above-mentioned device item embodiment corresponds to the method item embodiment of the present invention. The key management device for a vehicle network provided by the embodiment of the present invention can implement the key management method for a vehicle network provided by any method item embodiment of the present invention.
[0111] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method, and will not be described in detail here.
[0112] like Figure 3 As shown, some embodiments of the present application provide an electronic device 300, which includes: a memory 310, a processor 320, and a computer program stored in the memory 310 and executable on the processor 320, wherein the processor 320 reads the program from the memory 310 through a bus 330 and executes the program to implement a method of any embodiment of the key management method for the vehicle network as described above.
[0113] Processor 320 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 320 can be a microprocessor.
[0114] The memory 310 may be used to store instructions executed by the processor 320 or data related to the execution of instructions. These instructions and / or data may include codes for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 320 of the disclosed embodiment may be used to execute instructions in the memory 310 to implement the method shown above. The memory 310 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memory known to those skilled in the art.
[0115] Some embodiments of the present application further provide a computer-readable storage medium having a computer program stored thereon. The computer program is executed by a processor to execute the method described in the method embodiment.
[0116] Some embodiments of the present application further provide a computer program product, which, when executed on a computer, enables the computer to execute the method described in the method embodiment.
[0117] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0118] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0119] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0120] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0121] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0122] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0123] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A key management method for an in-vehicle network, characterized in that: Executed by the on-board controller, including: Sending an identity authentication request to the vehicle gateway, so that the vehicle gateway performs identity authentication on the vehicle controller based on the identity authentication request; Receiving a response message fed back by the vehicle gateway after determining that the vehicle controller has passed identity authentication; wherein the response message includes a first random number generated by the gateway; A key adjustment parameter is determined according to the first random number, and a pre-stored shared key is adjusted according to the key adjustment parameter to obtain a session key for vehicle network communication.
2. The key management method for an in-vehicle network according to claim 1, characterized in that: The determining of the key adjustment parameter according to the first random number, and adjusting the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication includes: A key adjustment parameter is determined according to the first random number, and a cyclic shift process is performed on the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication.
3. The key management method for an in-vehicle network according to claim 2, characterized in that: The determining of the key adjustment parameter according to the first random number, and performing cyclic shift processing on the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication includes: Determine a first adjustment parameter and a second adjustment parameter according to the first random number, and perform cyclic shift processing on the pre-stored shared key according to the first adjustment parameter to obtain a derived key; Dividing the derived key into a plurality of derived sub-keys, and performing cyclic shift processing on each derived sub-key according to the second adjustment parameter; The derived sub-keys after cyclic shift processing are concatenated to obtain the session key used for vehicle network communication.
4. The key management method for an in-vehicle network according to claim 3, characterized in that: The determining of the first adjustment parameter and the second adjustment parameter according to the first random number includes: Performing a rounding operation on the first random number based on a preset first divisor, and determining the first adjustment parameter according to an integer obtained by the operation; A remainder operation is performed on the first random number based on a preset second divisor, and the second adjustment parameter is determined according to a remainder obtained by the operation.
5. The key management method for an in-vehicle network according to claim 1, characterized in that: The identity authentication request includes the identity information of the vehicle controller; The vehicle gateway performs identity authentication on the vehicle controller based on the identity authentication request, including: When the vehicle gateway determines that the identity information of the vehicle controller is legal based on the pre-stored identity information list, it is determined that the vehicle controller has passed the identity authentication.
6. The key management method for an in-vehicle network according to claim 1, characterized in that: The identity authentication request includes a second random number generated by the vehicle controller; the response message also includes a first message authentication code generated by the vehicle gateway based on the shared key for the second random number; The determining of the key adjustment parameter according to the first random number is specifically: Generate a second message authentication code for the second random number based on the shared key; If it is determined that the first message authentication code matches the second message authentication code, a key adjustment parameter is determined according to the first random number.
7. The key management method for an in-vehicle network according to any one of claims 1 to 6, characterized in that: The step of adjusting the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication includes: The pre-stored shared key is adjusted according to the key adjustment parameter, and a hash operation is performed on the result after the adjustment to obtain a session key for vehicle network communication.
8. The key management method for an in-vehicle network according to claim 7, characterized in that: The first random number is a true random number generated by the vehicle gateway based on the hardware electrical characteristics when the vehicle is started this time; The second random number is a true random number generated by the vehicle controller based on the hardware electrical characteristics when the vehicle is started this time.
9. A key management device for an in-vehicle network, characterized in that: Applied to vehicle controllers, including: An authentication request module, used to send an identity authentication request to the vehicle gateway, so that the vehicle gateway performs identity authentication on the vehicle controller based on the identity authentication request; A message receiving module, used to receive a response message fed back by the vehicle gateway after determining that the vehicle controller has passed the identity authentication; wherein the response message includes a first random number generated by the gateway; The key generation module is used to determine a key adjustment parameter according to the first random number, and adjust the pre-stored shared key according to the key adjustment parameter to obtain a session key for vehicle network communication.
10. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor can implement the key management method for the vehicle network as described in any one of claims 1 to 8 when executing the program.