Key generation method and device, vehicle-mounted equipment and vehicle
By adjusting the channel gain interval in the on-board system and generating a shared key, the problem of difficult to reach a consensus on keys between vehicles is solved, the security and consistency of information transmission is improved, and illegal attacks are resisted.
Patent Information
- Application Number
- CN202411279531.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-24
AI Technical Summary
In the on-board information physics system, the key generation method is difficult to achieve channel randomness evaluation and key consensus in an unpredictable driving environment, resulting in a high key inconsistency rate and the security of information transmission cannot be guaranteed.
By adjusting the first channel gain and the second channel gain, it is located in the preset gain interval, and a shared key is generated based on the adjusted interval encoding, and using the gain interval adjustment model and the action network model to optimize the interval adjustment action to ensure that different vehicles are Consistency of keys.
Implement key consensus in driving environments, improve the security of information transmission between vehicles, effectively resist illegal attacks, and ensure key consistency during communication.
Smart Images

Figure CN119183103A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent control technology, and in particular to a key generation method, device, vehicle-mounted equipment and vehicle. Background Art
[0002] In connected vehicle networks, the inherent vulnerability of physical systems requires strong encryption protocols, intrusion detection mechanisms, and authentication procedures to prevent potential attacks on the network and maintain user trust in the safety and effectiveness of automotive technology.
[0003] In vehicle-mounted cyber-physical systems, physical layer security is of great importance. It not only protects the privacy of sensitive data exchanged between vehicles and infrastructure, such as OTA (Over-The-Air technology), but also ensures the integrity and reliability of the entire transportation network. However, this method of using wireless channels for data transmission is very vulnerable to network attacks such as eavesdropping and message replay. After being attacked by a network, malicious actors can abuse the movement pattern of the vehicle by tracking the driving route. Therefore, key generation is a key link in establishing a secure communication channel and creating a unique encryption key for encryption, decryption and authentication. The main challenge faced by the relevant key generation methods is that the two vehicles that have established a connection in advance cannot accurately evaluate the channel randomness and cannot achieve key generation consensus in an unpredictable driving environment, resulting in a high key inconsistency rate and cannot guarantee the secure transmission of information.
[0004] Therefore, it is necessary to improve the current key generation method. Summary of the invention
[0005] In view of the above-mentioned shortcomings of the prior art, the present application provides a key generation method, device, vehicle-mounted equipment and vehicle to solve the above-mentioned technical problems.
[0006] The present application provides a key generation method, which includes: adjusting a preset gain interval according to a first channel gain and a second channel gain so that the first channel gain and the second channel gain are within the adjusted gain interval; wherein the first channel gain and the second channel gain are measured by different vehicles having a communication connection; determining an interval code based on the adjusted gain interval, and generating a shared key according to the interval code; the shared key is used to encrypt or decrypt data transmitted between vehicles.
[0007] In one embodiment of the present application, the process of adjusting the preset gain interval according to the first channel gain and the second channel gain includes: inputting the first channel gain, the second channel gain and the preset gain interval into a gain interval adjustment model to obtain the adjusted gain interval; wherein the gain interval adjustment model is obtained by training the preset interval adjustment model through sample data, and the sample data includes the channel gain measured by the vehicle at different historical moments and the gain intervals at different historical moments.
[0008] In one embodiment of the present application, the preset interval adjustment model is trained by sample data to obtain the gain interval adjustment model, including: classifying the channel gain in the sample data according to the sampling time and vehicle number, and combining the classification result with the gain interval in the sample data to obtain the network status at different times; and forming the network status at different times into a preset sequence structure; inputting the network status at the initial time in the preset sequence structure into a preset action network model to obtain an interval adjustment action; the preset action network model includes a preset action selection strategy; calculating the cost of the interval adjustment action, and calculating the expected value of the optional action at the first time according to the cost of the interval adjustment action, the optional actions at the first time and the optional network status; and selecting the optional action corresponding to the minimum expected value as the optimal adjustment action at the first time, and the optional action corresponding to the minimum expected value The optional network state is used as the network state at the first moment; according to the optimal adjustment action at the first moment and the network state at the first moment, the preset action network model is adjusted to obtain the adjusted action network model; the network state at the first moment is used as the network state at the current moment, and the network state at the current moment is input into the adjusted action network model, and the interval adjustment action is continued to be obtained, and the cost of the interval adjustment action and the expected value of the optional action at the next moment are calculated, and based on the expected value of the optional action at the next moment, the optimal adjustment action at the next moment and the network state at the next moment are continued to be determined, and the adjusted action network model is continued to be adjusted according to the optimal adjustment action at the next moment and the network state at the next moment, until the number of adjustments to the preset interval adjustment model reaches the preset number of iterations, and the gain interval adjustment model is obtained.
[0009] In one embodiment of the present application, if the preset gain interval includes multiple preset sub-intervals, the process of calculating the cost of the interval adjustment action includes: adjusting multiple preset sub-intervals through the interval adjustment action to obtain multiple adjusted sub-intervals; determining the first sub-interval to which the channel gain of the first vehicle at the initial moment belongs based on the comparison result of the channel gain of the first vehicle in the sample data at the initial moment with the multiple adjusted sub-intervals; determining the second sub-interval to which the channel gain of the second vehicle at the initial moment belongs based on the comparison result of the channel gain of the second vehicle in the sample data at the initial moment with the multiple adjusted sub-intervals; determining the coding difference between the first vehicle and the second vehicle based on the interval number of the first sub-interval and the interval number of the second sub-interval, and determining the cost of the interval adjustment action based on the coding difference.
[0010] In one embodiment of the present application, the expected value calculation formula of the optional action at the first moment includes: Among them, Q πθ (S α ,A α ) indicates that the network state at the initial time is S α And the interval adjustment action is A α The expected value of the optional action at the first moment, C(A α ) represents the cost of interval adjustment action, γ represents the discount factor, γ∈[0,1], πθ represents the preset action selection strategy, S α' Indicates the optional network state at the first moment, A α' represents the optional actions at the first moment, represents the expected function, Q πθ (S α' ,A α' ) indicates that the network state at the first moment is S α' And the interval adjustment action is A α' The expected value of the optional action at the second moment.
[0011] In one embodiment of the present application, the process of generating a shared key based on the interval code includes: converting the interval code into a key pair according to a preset key generation method; the key pair includes a public key and a private key; performing an XOR operation on the public key and the private key to obtain the shared key.
[0012] In one embodiment of the present application, if different vehicles include a first vehicle and a second vehicle, the process of obtaining the first channel gain and the second channel gain by measuring different vehicles includes: obtaining the transmission power of the first vehicle; controlling the first vehicle to send a first beacon message to the second vehicle, and determining the receiving power of the second vehicle based on the first feedback information of the second vehicle to the first beacon message; using the difference between the transmission power of the first vehicle and the receiving power of the second vehicle as the first channel gain; obtaining the transmission power of the second vehicle; controlling the second vehicle to send a second beacon message to the first vehicle, and determining the receiving power of the first vehicle based on the second feedback information of the first vehicle to the second beacon message; using the difference between the transmission power of the second vehicle and the receiving power of the first vehicle as the second channel gain.
[0013] According to one aspect of an embodiment of the present application, a key generation device is provided, the device comprising: an interval adjustment module, used to adjust a preset gain interval according to a first channel gain and a second channel gain, so that the first channel gain and the second channel gain are located within the adjusted gain interval; wherein the first channel gain and the second channel gain are measured by different vehicles having a communication connection; a key generation module, used to determine an interval code based on the adjusted gain interval, and generate a shared key according to the interval code; the shared key is used to encrypt or decrypt data transmitted between vehicles.
[0014] According to one aspect of an embodiment of the present application, a vehicle-mounted device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the vehicle-mounted device implements the key generation method as described above.
[0015] According to one aspect of an embodiment of the present application, a vehicle is provided, the vehicle comprising the key generating device as described above or the vehicle-mounted device as described above.
[0016] Beneficial effects of the present application: The present application adjusts the preset gain interval according to the first channel gain and the second channel gain so that the first channel gain and the second channel gain are within the adjusted gain interval, determines the interval code based on the adjusted gain interval, and generates a shared key according to the interval code. The above process can adjust the preset gain interval according to the first channel gain and the second channel gain so that the first channel gain and the second channel gain are divided into the adjusted gain interval, so that different vehicles can reach a key consensus in a driving environment, maintain the consistency of the key during communication, and effectively resist illegal attacks by third parties, thereby improving the security of information transmission between different vehicles.
[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0019] Figure 1 is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application;
[0020] Figure 2 is a flowchart of a key generation method shown in an exemplary embodiment of the present application;
[0021] Figure 3 is a block diagram of a key generation device shown in an exemplary embodiment of the present application;
[0022] Figure 4 A schematic diagram of the structure of a computer system of a vehicle-mounted device suitable for implementing an embodiment of the present application is shown. DETAILED DESCRIPTION
[0023] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.
[0024] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0025] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0026] Figure 1 It is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application.
[0027] Reference Figure 1 As shown, the system architecture may include a storage device 101 and an onboard controller 102. The onboard controller 102 may be at least one of a desktop graphics processing unit (GPU) computer, a GPU computing cluster, a neural network computer, etc. Relevant technicians may use the onboard controller 102 to adjust the preset gain interval according to the first channel gain and the second channel gain, so that the first channel gain and the second channel gain are located within the adjusted gain interval, determine the interval code based on the adjusted gain interval, and generate a shared key according to the interval code. The storage device 101 is used to store the first channel gain and the second channel gain, and provide them to the onboard controller 102 for processing.
[0028] Schematically, after obtaining the first channel gain and the second channel gain in the storage device 101, the on-board controller 102 adjusts the preset gain interval according to the first channel gain and the second channel gain so that the first channel gain and the second channel gain are within the adjusted gain interval, determines the interval code based on the adjusted gain interval, and generates a shared key according to the interval code. The above process can adjust the preset gain interval according to the first channel gain and the second channel gain so that the first channel gain and the second channel gain are divided into the adjusted gain interval, so that different vehicles can reach a key consensus in a driving environment, maintain the consistency of the key during communication, and effectively resist illegal attacks by third parties, thereby improving the security of information transmission between different vehicles.
[0029] It should be noted that the key generation method provided in the embodiment of the present application is generally executed by the vehicle-mounted controller 102 , and accordingly, the key generation device is generally arranged in the vehicle-mounted controller 102 .
[0030] The implementation details of the technical solution of the embodiment of the present application are described in detail below:
[0031] Figure 2is a flowchart of a key generation method shown in an exemplary embodiment of the present application. The key generation method can be executed by a computing processing device. The computing processing device can be Figure 1 The vehicle controller 102 shown in FIG. Figure 2 As shown, the key generation method at least includes steps S210 to S220, which are described in detail as follows:
[0032] In step S210, the preset gain interval is adjusted according to the first channel gain and the second channel gain, so that the first channel gain and the second channel gain are located within the adjusted gain interval.
[0033] In one embodiment of the present application, the first channel gain and the second channel gain are measured by different vehicles having communication connections. The communication connection between different vehicles is established through C-V2X (Cellular Vehicle-to-Everything, a wireless communication technology for vehicles based on cellular networks), DSRC (Dedicated Short Range Communications, dedicated short-range communications technology), TCP / IP (Transmission Control Protocol / Internet Protocol, Transmission Control Protocol / Internet Protocol), MQTT (Message Queuing Telemetry Transport, message queue telemetry transmission) protocols, etc.
[0034] In this embodiment, the preset gain interval includes multiple preset sub-intervals. If the first channel gain and the second channel gain do not fall within the same preset sub-interval, the preset sub-interval is adjusted to divide the first channel gain and the second channel gain into the adjusted sub-interval, and the adjusted sub-interval range is made more accurate; if the first channel gain and the second channel gain fall within the same preset sub-interval, the preset sub-interval is adjusted to make the adjusted sub-interval range more accurate. In this way, the sub-interval ranges to which the two communicating vehicles belong and other vehicles are distinguished are distinguished, thereby improving the accuracy of sub-interval division.
[0035] In step S220, a range code is determined based on the adjusted gain range, and a shared key is generated according to the range code.
[0036] In this embodiment, the adjusted gain interval includes multiple adjusted sub-intervals. Taking the preset gain interval as [0,10] and the number of preset sub-intervals as 8 as an example, the multiple adjusted sub-intervals are [0,0.5), [0.5,2), [2,3.4), [3,4.5), [4.5,5), [5,6), [6,7.5), [7.5,8], wherein the interval number of [0,0.5) is 0, the interval number of [0.5,2) is 1, the interval number of [2,3.4) is 2, the interval number of [3,4.5) is 3, the interval number of [4.5,5) is 4, the interval number of [5,6) is 5, the interval number of [6,7.5) is 6, and the interval number of [7.5,8] is 7.
[0037] In this embodiment, the interval number is encoded by Gray code, and the corresponding relationship between the interval number and the interval code is shown in the following table:
[0038] Table 1
[0039] Interval number Gray code 0 000 1 001 2 011 3 010 4 110 5 111 6 101 7 100
[0040] In Table 1, interval number 0 corresponds to Gray code 000, interval number 1 corresponds to Gray code 001, interval number 2 corresponds to Gray code 011, interval number 3 corresponds to Gray code 010, interval number 4 corresponds to Gray code 110, interval number 5 corresponds to Gray code 111, interval number 6 corresponds to Gray code 101, and interval number 7 corresponds to Gray code 100.
[0041] In this embodiment, by numbering the multiple adjusted sub-intervals and corresponding the interval numbers to the Gray codes, a corresponding relationship between the multiple adjusted sub-intervals and the interval codes is obtained, and after the adjusted sub-intervals are determined, the interval codes can be determined.
[0042] In this embodiment, the shared key is used to encrypt or decrypt the data transmitted between vehicles. After obtaining the shared key, different vehicles can reach a key consensus in the driving environment, maintain the consistency of the key during the communication process, and effectively resist illegal attacks from third parties, thereby improving the security of information transmission between different vehicles.
[0043] In one embodiment of the present application, the process of adjusting the preset gain interval according to the first channel gain and the second channel gain includes:
[0044] The first channel gain, the second channel gain and the preset gain interval are input into the gain interval adjustment model to obtain the adjusted gain interval.
[0045] In this embodiment, the gain interval adjustment model is obtained by training a preset interval adjustment model through sample data, where the sample data includes channel gains measured by the vehicle at different historical moments and gain intervals at different historical moments.
[0046] In this embodiment, the preset interval adjustment model includes a preset action network model, a preset evaluation network model, a preset state network model, etc. The preset action network model is provided with a preset action selection strategy for selecting an action according to the network state and the action selection strategy. The preset evaluation network model is provided with an evaluation parameter for calculating the cost of the selected action, and modifying the selected action according to the expected value of the optional action to determine the optimal adjustment action. The preset state network model is used to update the network state, for example, adding the newly acquired network state to the preset state network model and deleting the initially acquired network state, so that a fixed number of network states are always stored in the preset state network model.
[0047] In this embodiment, an LSTM (Long Short-Term Memory) model is also included. The LSTM model is used to periodically obtain the change rules in the observed state according to the adjusted sub-intervals, output the complete network state, and send the observed network state to the preset state network model.
[0048] In one embodiment of the present application, the process of training the preset interval adjustment model through sample data to obtain the gain interval adjustment model includes:
[0049] According to the sampling time and vehicle number, the channel gain in the sample data is classified, and the classification result is combined with the gain range in the sample data to obtain the network status at different times; and the network status at different times is formed into a preset series structure.
[0050] In this embodiment, if the vehicle number is the first vehicle number, the channel gain of the first vehicle number is screened out from the sample data according to the sampling time, and the channel gain of the first vehicle number is combined with the gain interval according to the sampling time to obtain the network status of the first vehicle number at different times; if the vehicle number is the second vehicle number, the channel gain of the second vehicle number is screened out from the sample data according to the sampling time, and the channel gain of the second vehicle number is combined with the gain interval according to the sampling time to obtain the network status of the second vehicle number at different times; the network status of the first vehicle number at different times and the network status of the second vehicle number at different times are combined according to the sampling time to obtain the network status at different times.
[0051] In this embodiment, the preset number series structure may be a Markov number series structure or other number series structures, which are not specifically limited herein.
[0052] The network state at the initial moment in the preset sequence structure is input into the preset action network model to obtain the interval adjustment action.
[0053] In this embodiment, the network status expression at the initial moment is as follows:
[0054] S c ={Ω ci ,Ω cj ,δ c,vi,j Formula (1)
[0055] Among them, S c represents the network state at the initial time, Ω ci represents the channel gain of the i-th vehicle at the initial moment, Ω cj represents the channel gain of the jth vehicle at the initial moment, δ c,vi,j represents the gain interval (ie, the preset gain interval) set for the channel gain of the i-th vehicle and the channel gain of the j-th vehicle at the initial moment, and c represents the initial moment.
[0056] In this embodiment, the preset action network model includes a preset action selection strategy. After the network state at the initial moment in the preset sequence structure is input into the preset action network model, the interval adjustment action is obtained according to the network state at the initial moment and the preset action selection strategy.
[0057] In this embodiment, the interval adjustment action is used to represent the action selected to adjust the channel gain of the first vehicle and the channel gain of the second vehicle to the same sub-interval within the continuous propagation period t. The set of interval adjustment actions is as follows:
[0058] A α,t ={δ l(i,j) Formula (2)
[0059] Among them, A α,t represents the interval adjustment action set when adjusting the channel gain of the first vehicle and the channel gain of the second vehicle to the same sub-interval within the continuous propagation period t, δ l(i,j) It represents an interval adjustment action of adjusting the channel gain of the i-th vehicle and the channel gain of the j-th vehicle to within the l-th subinterval.
[0060] Calculate the cost of the interval adjustment action, and calculate the expected value of the optional action at the first moment based on the cost of the interval adjustment action, the optional actions at the first moment, and the optional network state; and select the optional action corresponding to the minimum expected value as the optimal adjustment action at the first moment, and the optional network state corresponding to the minimum expected value as the network state at the first moment.
[0061] In this embodiment, the expected value calculation formula of the optional action is as follows:
[0062]
[0063] Among them, Q πθ (S α ,A α ) indicates that the network state at the initial time is S α And the interval adjustment action is A α The expected value of the optional action at the first moment, C(A α ) represents the cost of interval adjustment action, γ represents the discount factor, γ∈[0,1], πθ represents the preset action selection strategy, S α' Indicates the optional network state at the first moment, A α' represents the optional actions at the first moment, represents the expected function, Q πθ (S α' ,A α' ) indicates that the network state at the first moment is S α' And the interval adjustment action is A α' The expected value of the optional action at the second moment.
[0064] In this embodiment, the first moment is the next moment of the initial moment, and the second moment is the next moment of the first moment.
[0065] In this embodiment, the optimal adjustment action expression at the first moment is as follows:
[0066]
[0067] in, represents the optimal adjustment action at the first moment, C(A α ) represents the cost of interval adjustment action, γ represents the discount factor, γ∈[0,1], πθ represents the preset action selection strategy, Π represents the action selection strategy set, S α' Indicates the optional network state at the first moment, A α' represents the optional actions at the first moment, represents the expected value of the optional action at the first moment, Q πθ (S α' ,A α' ) indicates that the network state at the first moment is S α' And the interval adjustment action is A α' The expected value of the optional action at the second moment.
[0068] In this embodiment, the expected value of the optional action at the first moment is calculated based on the cost of the interval adjustment action, the optional actions at the first moment and the optional network status; and the optional action corresponding to the minimum expected value is selected as the optimal adjustment action at the first moment, thereby achieving continuous optimization of the interval adjustment action.
[0069] According to the optimal adjustment action at the first moment and the network state at the first moment, the preset action network model is adjusted to obtain an adjusted action network model.
[0070] In this embodiment, the process of adjusting the preset action network model is the process of adjusting the preset action selection strategy, and the accuracy of selecting the optimal adjustment action is improved by adjusting the preset action selection strategy.
[0071] The network state at the first moment is used as the network state at the current moment, and the network state at the current moment is input into the adjusted action network model, and the interval adjustment action is continued to be obtained, and the cost of the interval adjustment action and the expected value of the optional action at the next moment are calculated, and based on the expected value of the optional action at the next moment, the optimal adjustment action at the next moment and the network state at the next moment are continued to be determined, and the adjusted action network model is continued to be adjusted according to the optimal adjustment action at the next moment and the network state at the next moment, until the number of adjustments to the preset interval adjustment model reaches the preset number of iterations, and the gain interval adjustment model is obtained.
[0072] In this embodiment, the network status expression at the next moment is as follows:
[0073]
[0074] Among them, S α,n Indicates the network status at the next moment, Ω α,ni represents the channel gain of the i-th vehicle at the next moment, Ω α,nj represents the channel gain of the jth vehicle at the next moment, It represents the gain interval at the next moment obtained by adjusting the gain interval at the current moment based on the channel gain of the i-th vehicle and the channel gain of the j-th vehicle, n represents the next moment, α represents the action selection parameter, and the action selection parameter determines the action selection strategy.
[0075] In this embodiment, based on the expected values of the optional actions at the next moment, the process of continuing to determine the optimal adjustment action at the next moment and the network state at the next moment includes: selecting the minimum expected value from the expected values of the optional actions at the next moment, using the optional action corresponding to the minimum expected value as the optimal adjustment action at the next moment, and using the optional network state corresponding to the minimum expected value as the network state at the next moment.
[0076] In this embodiment, the preset number of iterations can be set according to actual conditions. By continuously adjusting the preset interval adjustment model, the fast convergence of the preset interval adjustment model is achieved, and the accuracy of the gain interval adjustment is improved.
[0077] In one embodiment of the present application, if the preset gain interval includes multiple preset sub-intervals, the process of calculating the cost of the interval adjustment action includes:
[0078] The multiple preset sub-intervals are adjusted through the interval adjustment action to obtain multiple adjusted sub-intervals.
[0079] In this embodiment, the range of the preset sub-interval includes the following four cases, and the first case is as follows:
[0080]
[0081] Among them, δ l represents the lth subinterval, represents the lower limit of the lth subinterval, Indicates the upper limit of the lth subinterval.
[0082] The second case is shown below:
[0083]
[0084] Among them, δ l represents the lth subinterval, represents the lower limit of the lth subinterval, Indicates the upper limit of the lth subinterval.
[0085] The third case is as follows:
[0086]
[0087] Among them, δ l represents the lth subinterval, represents the lower limit of the lth subinterval, Indicates the upper limit of the lth subinterval.
[0088] The third case is as follows:
[0089]
[0090] Among them, δ l represents the lth subinterval, represents the lower limit of the lth subinterval, Indicates the upper limit of the lth subinterval.
[0091] According to the comparison result of the channel gain of the first vehicle at the initial moment in the sample data and the multiple adjustment sub-intervals, the first sub-interval to which the channel gain of the first vehicle at the initial moment belongs is determined.
[0092] In this embodiment, if the channel gain of the first vehicle at the initial moment falls within a certain adjustment sub-interval, the adjustment sub-interval is used as the first sub-interval.
[0093] According to the comparison result of the channel gain of the second vehicle at the initial moment in the sample data and the multiple adjustment sub-intervals, the second sub-interval to which the channel gain of the second vehicle at the initial moment belongs is determined.
[0094] In this embodiment, if the channel gain of the second vehicle at the initial moment falls within a certain adjustment sub-interval, the adjustment sub-interval is used as the second sub-interval.
[0095] Based on the section number of the first subsection and the section number of the second subsection, a coding difference between the first vehicle and the second vehicle is determined, and based on the coding difference, a cost of the section adjustment action is determined.
[0096] In this embodiment, the interval number of the first sub-interval and the interval number of the second sub-interval can be the same or different. If the interval number of the first sub-interval is the same as the interval number of the second sub-interval, the interval code of the first sub-interval is the same as the interval code of the second sub-interval, and there is no coding difference between the two vehicles; if the interval number of the first sub-interval is different from the interval number of the second sub-interval, the interval code of the first sub-interval is different from the interval code of the second sub-interval, and there is a coding difference between the two vehicles. The cost of the interval adjustment action is proportional to the size of the coding difference. The larger the coding difference, the greater the cost of the interval adjustment action. If the coding difference is smaller, the cost of the interval adjustment action is smaller.
[0097] In this embodiment, the cost calculation formula of the interval adjustment action is as follows:
[0098]
[0099] Among them, C(A α ) represents the cost of the interval adjustment action, N represents the total number of vehicles, Represents the coding difference between the i-th vehicle and the j-th vehicle.
[0100] In this embodiment, the cost of the interval adjustment action is characterized by the coding difference between the two vehicles. In the process of training the preset interval adjustment model, the coding difference between the two vehicles is reduced to ensure the consistency of the key bit strings of the two vehicles, so that both vehicles use the same key bit string to encrypt and decrypt the transmitted data, thereby enhancing the security of vehicle-mounted communications.
[0101] In one embodiment of the present application, the process of generating a shared key according to the interval code includes:
[0102] The interval code is converted into a key pair according to the preset key generation method.
[0103] In this embodiment, the key pair includes a public key and a private key. The preset key generation method can be an RSA (Rivest-Shamir-Adleman) algorithm, a DSA (Digital Signature Algorithm) algorithm, etc., which is not specifically limited here.
[0104] Perform an XOR operation on the public key and the private key to obtain a shared key.
[0105] In this embodiment, the calculation formula of the shared key is:
[0106]
[0107] Among them, K S represents the shared key, represents the private key of the i-th vehicle, represents the public key of the jth vehicle, represents the private key of the jth vehicle, Represents the public key of the i-th vehicle.
[0108] In this embodiment, the private key of the ith vehicle is the same as the private key of the jth vehicle, and the public key of the ith vehicle is the same as the public key of the jth vehicle.
[0109] In one embodiment of the present application, if the different vehicles include a first vehicle and a second vehicle, the process of obtaining the first channel gain and the second channel gain by measuring the different vehicles includes:
[0110] Acquire the transmission power of the first vehicle; control the first vehicle to send a first beacon message to the second vehicle, and determine the receiving power of the second vehicle according to the first feedback information of the second vehicle to the first beacon message; and use the difference between the transmission power of the first vehicle and the receiving power of the second vehicle as the first channel gain.
[0111] In this embodiment, the first feedback information includes the receiving power of the second vehicle for the first beacon message. After receiving the first feedback information, the first vehicle parses the first feedback information to obtain the receiving power of the second vehicle.
[0112] Acquire the transmission power of the second vehicle; control the second vehicle to send a second beacon message to the first vehicle, and determine the receiving power of the first vehicle according to the second feedback information of the first vehicle to the second beacon message; and use the difference between the transmission power of the second vehicle and the receiving power of the first vehicle as the second channel gain.
[0113] In this embodiment, the second feedback information includes the receiving power of the first vehicle to the second beacon message. After receiving the second feedback information, the second vehicle parses the second feedback information to obtain the receiving power of the first vehicle.
[0114] In this embodiment, parsing the first feedback information may be implemented by referring to a method for parsing a data packet in related technologies, and the method for parsing the second feedback information is the same as the method for parsing the first feedback information.
[0115] In this embodiment, at least one leading vehicle and one following vehicle are included, the distance between the leading vehicle and the following vehicle is within a preset distance range, the leading vehicle and the following vehicle establish a communication connection in advance, and a key pair is generated between the leading vehicle end and the following vehicle end by estimating the quantized channel gain.
[0116] In this embodiment, the process of generating a key pair by estimating the quantized channel gain between the leading vehicle and the following vehicle includes: the leading vehicle sends a beacon data packet carrying the leading vehicle identification to the following vehicle (the beacon data packet is encapsulated through the C-V2X protocol or the DSRC protocol), and the leading vehicle determines the receiving power of the following vehicle based on the data fed back by the following vehicle for the beacon data packet. The leading vehicle determines the channel gain of the leading vehicle based on its own transmission power and the receiving power of the following vehicle. The following vehicle sends a beacon data packet carrying the leading vehicle identification to the leading vehicle (the beacon data packet is encapsulated through the C-V2X protocol or the DSRC protocol), and the following vehicle determines the receiving power of the following vehicle based on the data fed back by the leading vehicle for the beacon data packet. The following vehicle determines the channel gain of the following vehicle based on its own transmission power and the receiving power of the leading vehicle.
[0117] In this embodiment, the channel gain of the leading vehicle and the channel gain of the following vehicle are quantized to divide the channel gain of the leading vehicle and the channel gain of the following vehicle into the same sub-interval, and a key pair is generated according to the interval coding of the sub-interval, so that the key between the leading vehicle and the following vehicle is consistent, and the key is used for encryption and decryption to ensure the security of data transmission between the leading vehicle and the following vehicle. The number of sub-intervals can be set according to actual conditions, for example, the number of sub-intervals can be set to 10 or 8.
[0118] In this embodiment, the preset interval adjustment model is an A2C (Advantage Actor-Critic) model. The A2C (Advantage Actor-Critic) model includes a state network model, an evaluation network model, and an action selection model. An empty buffer length is also created to store the network status at different times during the training process.
[0119] In this embodiment, the process of training the preset interval adjustment model includes: first, the LSTM network model periodically obtains the change law in the observed state according to the adjusted sub-interval and outputs the complete network state, and sends the observed network state to the state network model. Then, the action selection model selects an action according to the network state and the action selection strategy to determine the optimal adjustment action and the network state at the next moment; finally, the network state newly observed by the LSTM network model is added to the buffer.
[0120] In this embodiment, during the iterative training of the preset interval adjustment model, the optional action corresponding to the minimum expected value is selected as the optimal adjustment action at the first moment, and the optional network state corresponding to the minimum expected value is used as the network state at the first moment, and the network state at the current moment is updated, and the buffer is continuously updated to remove the network state at the initial moment and supplement the latest network state, thereby ensuring the timeliness and relevance of the stored network state.
[0121] In this embodiment, the comment network model is used to calculate the expected value of optional actions, and the optional action corresponding to the minimum expected value is selected as the optimal adjustment action at the first moment, and the optional network state corresponding to the minimum expected value is used as the network state at the first moment. According to the optimal adjustment action at the first moment and the network state at the first moment, the preset action network model is adjusted to obtain the adjusted action network model. This process is repeated until the preset number of iterations is reached, and the optimal adjustment action in the dynamic driving environment is obtained. Based on the optimal adjustment action, the adjusted gain interval is obtained, and the shared key is generated according to the interval encoding of the adjusted gain interval.
[0122] The following describes an embodiment of the device of the present application, which can be used to execute the key generation method in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the key generation method in the above embodiment of the present application.
[0123] Figure 3 is a block diagram of a key generation device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1The implementation environment shown is specifically configured in the vehicle controller 102. The device may also be applicable to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applicable.
[0124] like Figure 3 As shown, the exemplary key generation device includes:
[0125] The interval adjustment module 301 is used to adjust the preset gain interval according to the first channel gain and the second channel gain, so that the first channel gain and the second channel gain are located within the adjusted gain interval.
[0126] The key generation module 302 is used to determine the interval code based on the adjusted gain interval, and generate a shared key according to the interval code.
[0127] In one embodiment of the present application, the first channel gain and the second channel gain are measured by different vehicles having communication connections. A communication connection is established in advance between different vehicles, and the communication connection between different vehicles is established through C-V2X (Cellular Vehicle-to-Everything, a wireless communication technology for vehicles based on cellular networks), DSRC (Dedicated Short Range Communications, dedicated short-range communications technology), TCP / IP (Transmission Control Protocol / Internet Protocol, Transmission Control Protocol / Internet Protocol), MQTT (Message Queuing Telemetry Transport, message queue telemetry transmission) protocols, etc.
[0128] In this embodiment, the preset gain interval includes multiple preset sub-intervals. If the first channel gain and the second channel gain do not fall within the same preset sub-interval, the preset sub-interval is adjusted to divide the first channel gain and the second channel gain into the adjusted sub-interval, and the adjusted sub-interval range is made more accurate; if the first channel gain and the second channel gain fall within the same preset sub-interval, the preset sub-interval is adjusted to make the adjusted sub-interval range more accurate. In this way, the sub-interval ranges to which the two communicating vehicles belong and other vehicles are distinguished are distinguished, thereby improving the accuracy of sub-interval division.
[0129] In this embodiment, the adjusted gain interval includes multiple adjusted sub-intervals. Taking the preset gain interval as [0,10] and the number of preset sub-intervals as 8 as an example, the multiple adjusted sub-intervals are [0,0.5), [0.5,2), [2,3.4), [3,4.5), [4.5,5), [5,6), [6,7.5), [7.5,8], wherein the interval number of [0,0.5) is 0, the interval number of [0.5,2) is 1, the interval number of [2,3) is 2, the interval number of [3,4.5) is 3, the interval number of [4.5,5) is 4, the interval number of [5,6) is 5, the interval number of [6,7.5) is 6, and the interval number of [7.5,8] is 7.
[0130] In this embodiment, the interval number is encoded by Gray code, and the corresponding relationship between the interval number and the interval code is shown in Table 1, which will not be described in detail here.
[0131] In this embodiment, by numbering the multiple adjusted sub-intervals and corresponding the interval numbers to the Gray codes, a corresponding relationship between the multiple adjusted sub-intervals and the interval codes is obtained, and after the adjusted sub-intervals are determined, the interval codes can be determined.
[0132] In this embodiment, the shared key is used to encrypt or decrypt the data transmitted between vehicles. After obtaining the shared key, different vehicles can reach a key consensus in the driving environment, maintain the consistency of the key during the communication process, and effectively resist illegal attacks from third parties, thereby improving the security of information transmission between different vehicles.
[0133] It should be noted that the key generation device provided in the above embodiment and the key generation method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the key generation device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0134] An embodiment of the present application also provides a vehicle-mounted device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the vehicle-mounted device implements the key generation method provided in the above-mentioned embodiments.
[0135] An embodiment of the present application further provides a vehicle, the vehicle comprising a key generating device as provided in each of the above embodiments or a vehicle-mounted device as provided in each of the above embodiments.
[0136] Figure 4 The schematic diagram of the structure of the computer system of the vehicle-mounted device suitable for implementing the embodiment of the present application is shown. It should be noted that: Figure 4 The computer system 400 of the vehicle-mounted device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0137] like Figure 4 As shown, the computer system 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage part 408 to the random access memory (RAM) 403, such as executing the method in the above embodiment. In the RAM 403, various programs and data required for system operation are also stored. The CPU 401, ROM 402 and RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0138] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed so that a computer program read therefrom is installed into the storage section 408 as needed.
[0139] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 409, and / or installed from a removable medium 411. When the computer program is executed by a central processing unit (CPU) 401, various functions defined in the system of the present application are executed.
[0140] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable medium or any combination of the above two. Computer-readable media can be, for example, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0141] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing 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 boxes represented in succession 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 or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0142] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0143] Another aspect of the present application also provides a computer-readable medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes the key generation method as described above. The computer-readable medium may be included in the vehicle-mounted device described in the above embodiment, or may exist independently without being assembled into the vehicle-mounted device.
[0144] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable medium. A processor of a computer device reads the computer instruction from the computer-readable medium, and the processor executes the computer instruction, so that the computer device executes the key generation method provided in each of the above embodiments.
[0145] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A key generation method, characterized in that: The method comprises: According to the first channel gain and the second channel gain, the preset gain interval is adjusted so that the first channel gain and the second channel gain are located within the adjusted gain interval; wherein the first channel gain and the second channel gain are measured by different vehicles having a communication connection; An interval code is determined based on the adjusted gain interval, and a shared key is generated according to the interval code; the shared key is used to encrypt or decrypt data transmitted between vehicles.
2. The key generation method according to claim 1, characterized in that: The process of adjusting the preset gain interval according to the first channel gain and the second channel gain includes: Inputting the first channel gain, the second channel gain and the preset gain interval into a gain interval adjustment model to obtain the adjusted gain interval; The gain interval adjustment model is obtained by training a preset interval adjustment model through sample data, and the sample data includes channel gains measured by the vehicle at different historical moments and gain intervals at different historical moments.
3. The key generation method according to claim 2, characterized in that: The process of training the preset interval adjustment model through sample data to obtain the gain interval adjustment model includes: Classifying the channel gains in the sample data according to the sampling time and the vehicle number, and combining the classification results with the gain intervals in the sample data to obtain network states at different times; and forming the network states at different times into a preset sequence structure; Inputting the network state at the initial moment in the preset sequence structure into a preset action network model to obtain an interval adjustment action; the preset action network model includes a preset action selection strategy; Calculating the cost of the interval adjustment action, and calculating the expected value of the optional action at the first moment according to the cost of the interval adjustment action, the optional action at the first moment, and the optional network state; and selecting the optional action corresponding to the minimum expected value as the optimal adjustment action at the first moment, and using the optional network state corresponding to the minimum expected value as the network state at the first moment; According to the optimal adjustment action at the first moment and the network state at the first moment, adjusting the preset action network model to obtain an adjusted action network model; The network state at the first moment is used as the network state at the current moment, and the network state at the current moment is input into the adjusted action network model, and the interval adjustment action is continued to be obtained, and the cost of the interval adjustment action and the expected value of the optional action at the next moment are calculated, and based on the expected value of the optional action at the next moment, the optimal adjustment action at the next moment and the network state at the next moment are continued to be determined, and the adjusted action network model is continued to be adjusted according to the optimal adjustment action at the next moment and the network state at the next moment, until the number of adjustments to the preset interval adjustment model reaches the preset number of iterations, and the gain interval adjustment model is obtained.
4. The key generation method according to claim 3, characterized in that: If the preset gain interval includes a plurality of preset sub-intervals, the process of calculating the cost of the interval adjustment action includes: Adjusting a plurality of preset sub-intervals through the interval adjustment action to obtain a plurality of adjusted sub-intervals; Determine, according to a comparison result of the channel gain of the first vehicle at the initial moment in the sample data with the plurality of adjustment sub-intervals, a first sub-interval to which the channel gain of the first vehicle at the initial moment belongs; Determine, according to a comparison result of the channel gain of the second vehicle at the initial moment in the sample data with the plurality of adjustment sub-intervals, the second sub-interval to which the channel gain of the second vehicle at the initial moment belongs; Based on the section number of the first subsection and the section number of the second subsection, a coding difference between the first vehicle and the second vehicle is determined, and based on the coding difference, a cost of the section adjustment action is determined.
5. The key generation method according to claim 3, characterized in that: The expected value calculation formula of the optional action at the first moment includes: Among them, Q πθ (S α ,A α ) indicates that the network state at the initial time is S α And the interval adjustment action is A α The expected value of the optional action at the first moment, C(A α ) represents the cost of interval adjustment action, γ represents the discount factor, γ∈[0,1], πθ represents the preset action selection strategy, S α' Indicates the optional network state at the first moment, A α' represents the optional actions at the first moment, represents the expected function, Q πθ (S α' ,A α' ) indicates that the network state at the first moment is S α' And the interval adjustment action is A α' The expected value of the optional action at the second moment.
6. The key generation method according to any one of claims 1 to 5, characterized in that: The process of generating a shared key according to the interval code includes: Converting the interval code into a key pair according to a preset key generation method; the key pair includes a public key and a private key; An XOR operation is performed on the public key and the private key to obtain the shared key.
7. The key generation method according to any one of claims 1 to 5, characterized in that: If the different vehicles include a first vehicle and a second vehicle, the process of obtaining the first channel gain and the second channel gain by measuring the different vehicles includes: Acquire the transmission power of the first vehicle; control the first vehicle to send a first beacon message to the second vehicle, and determine the reception power of the second vehicle according to first feedback information of the second vehicle to the first beacon message; use the difference between the transmission power of the first vehicle and the reception power of the second vehicle as the first channel gain; Acquire the transmission power of the second vehicle; control the second vehicle to send a second beacon message to the first vehicle, and determine the receiving power of the first vehicle according to the second feedback information of the first vehicle to the second beacon message; and use the difference between the transmission power of the second vehicle and the receiving power of the first vehicle as the second channel gain.
8. A key generation device, characterized in that: The device comprises: an interval adjustment module, configured to adjust a preset gain interval according to a first channel gain and a second channel gain, so that the first channel gain and the second channel gain are located within the adjusted gain interval; wherein the first channel gain and the second channel gain are measured by different vehicles having a communication connection; The key generation module is used to determine the interval code based on the adjusted gain interval, and generate a shared key according to the interval code; the shared key is used to encrypt or decrypt the transmission data between vehicles.
9. A vehicle-mounted device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the vehicle-mounted device to implement the key generation method as described in any one of claims 1 to 7.
10. A vehicle, characterized in that: The vehicle includes the key generation device as claimed in claim 8 or the vehicle-mounted device as claimed in claim 9.
