Communication method of vehicle and vehicle
By parsing and verifying the target data frames and using sliding window technology to ensure the correct reception of data frames, the problem of disordered data frame order and accidental discarding in secure vehicle communication is solved, improving the orderliness and reliability of data and enhancing the stability and security of vehicle communication.
Patent Information
- Application Number
- CN202511247008.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2025-11-18
AI Technical Summary
In secure vehicle-mounted communication, the data frames received by the receiver are out of order and may be accidentally dropped, resulting in poor data order and reliability.
By parsing the target data frame, the first message authentication code and freshness value are obtained. The receiving result is determined using the target sliding window, and verification is performed based on the bus data, freshness value, and message authentication code to ensure the correct reception of the data frame.
It improves the orderliness and reliability of data, reduces the possibility of data being accidentally discarded, avoids processing blockages caused by message delays or network fluctuations, and enhances the accuracy and stability of in-vehicle safety communication.
Smart Images

Figure CN120979768A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of vehicle communication, and more particularly, to a communication method of a vehicle and a vehicle in the technical field of vehicle communication. BACKGROUND
[0002] With the rapid development of intelligentization of the vehicle industry, the complexity of vehicle networks gradually increases, and the degree of networking of vehicles gradually deepens. Therefore, it is crucial to ensure the security of vehicle network communication information.
[0003] In the related art, the security of vehicle network communication information is ensured by security onboard communication (SecOC). Security onboard communication is a standard designed to enhance the security of vehicle network communication, which introduces various security mechanisms to protect the integrity, authenticity and confidentiality of information, thereby improving the overall security of vehicles. However, the security onboard communication in the related art uses a freshness value counter to prevent replay attacks to ensure the freshness of received messages. Due to the heterogeneity of vehicle communication networks and the priority arbitration rules based on controller area network (CAN) identification, the order of data frames received by the receiving end is chaotic, and the received data frames may be misdiscarded, resulting in low flexibility of received data, poor order and reliability of data, and other problems.
[0004] Therefore, how to reduce the possibility of misdiscarding data while improving the order and reliability of data in security onboard communication is a research hotspot. SUMMARY
[0005] The present application provides a communication method of a vehicle and a vehicle, which can reduce the possibility of misdiscarding data while improving the order and reliability of data in security onboard communication. The technical solution is as follows: In a first aspect, a communication method of a vehicle is provided, which comprises: obtaining a target data frame sent by a sending end to parse the target data frame to obtain a first message authentication code, a first freshness value and bus data, the first message authentication code being a message authentication code after interception; determining a receiving result of the target data frame based on the first freshness value through a target sliding window; in a case where the receiving result represents that the target data frame needs to be received, determining a verification result corresponding to the target data frame based on the bus data, the first freshness value and the first message authentication code.
[0006] In this implementation, by parsing the target data frame sent by the sending end, a first message authentication code, a first freshness value and bus data are obtained, and then based on the first freshness value, a receiving result of the target data frame is determined through a target sliding window, so that in the case that the receiving result represents that the target data frame needs to be received, a verification result corresponding to the target data frame is determined based on the bus data, the first freshness value and the first message authentication code. The sliding window is adopted to provide fault tolerance for receiving data, so that the data frames received can be received even if the order of the received data frames is different from the order when they are sent, the possibility of mis-discarding data by the receiving end is reduced, and the process of receiving data frames is flexible, processing blockage caused by message delay or network fluctuation is avoided, the efficiency of data processing is improved, the accuracy, stability and reliability of vehicle safety communication are enhanced on the premise of ensuring safe communication.
[0007] In combination with the first aspect, in some possible implementation manners, the determining the receiving result of the target data frame based on the first freshness value through the target sliding window comprises: in the case that the first freshness value is located in the target sliding window, regarding receiving the target data frame as the receiving result; in the case that the first freshness value is greater than a highest sequence number corresponding to the target sliding window, regarding receiving the target data frame as the receiving result and sliding the target sliding window; and in the case that the first freshness value is less than a lowest sequence number corresponding to the target sliding window, regarding discarding the target data frame as the receiving result.
[0008] In this implementation, the receiving result corresponding to the target data frame is determined according to different cases between the first freshness value and the target sliding window, which can cover different scenarios of actual data transmission and improve the flexibility of the receiving end in receiving data.
[0009] In combination with the first aspect and the above implementation manners, in some possible implementation manners, the determining the verification result corresponding to the target data frame based on the bus data, the first freshness value and the first message authentication code comprises: obtaining a second freshness value based on the first freshness value, the first freshness value being a freshness value with a length of N bytes, the second freshness value being a freshness value with a length of M bytes, the N being a positive integer, and the M being a positive integer greater than the N; and determining the verification result corresponding to the target data frame based on the bus data, the second freshness value and the first message authentication code.
[0010] In this implementation, a second freshness value is obtained based on a first freshness value. The verification result corresponding to the target data frame is determined based on bus data, the second freshness value, and the first message authentication code. The received data frame is detected in real time at the receiving end, ensuring the integrity and real-time performance of the target data frame and significantly improving the security and reliability of the vehicle network.
[0011] In conjunction with the first aspect and the above implementation methods, in some possible implementation methods, determining the verification result corresponding to the target data frame based on the bus data, the first freshness value, and the first message authentication code includes: obtaining a third freshness value, wherein the third freshness value is the complete freshness value before truncation; if the value of the third freshness value and the value of the first freshness value satisfy a threshold condition, obtaining a second message authentication code based on the second freshness value and the bus data, and performing verification processing based on the first message authentication code and the second message authentication code to determine the verification result corresponding to the target data frame, wherein the second message authentication code is a complete message authentication code; if the value of the third freshness value and / or the value of the first freshness value does not satisfy the threshold condition, determining at least one candidate freshness value, and performing verification processing based on the candidate freshness value on the first message authentication code to determine the verification result corresponding to the target data frame.
[0012] In this implementation, depending on whether the values of the third freshness value and the first freshness value meet the threshold conditions, the verification process is performed on the second message authentication code obtained based on the second freshness value and the bus data, or the verification process is performed on the first message authentication code based on the candidate freshness value. The verification result corresponding to the target data frame is determined. Different processes can be selected to determine the verification result according to the actual situation, which improves the real-time performance, compatibility and security reliability of the vehicle bus data frame.
[0013] In conjunction with the first aspect and the above implementation methods, in some possible implementation methods, the step of performing verification processing based on the first message authentication code and the second message authentication code to determine the verification result corresponding to the target data frame includes: truncating the second message authentication code to obtain a third message authentication code, wherein the third message authentication code is the highest Q byte in the second message authentication code, and Q is a positive integer; and performing verification processing based on the first message authentication code and the third message authentication code to determine the verification result corresponding to the target data frame.
[0014] In this implementation, the second message authentication code is intercepted to obtain the third message authentication code. Verification is then performed based on the first message authentication code and the third message authentication code to determine the verification result corresponding to the target data frame. The most significant byte of the second message authentication code can be taken as the third message authentication code, thereby completing fast and reliable security verification without increasing additional transmission overhead.
[0015] In conjunction with the first aspect and the above implementation methods, in some possible implementation methods, the step of performing verification processing based on the first message authentication code and the third message authentication code to determine the verification result corresponding to the target data frame includes: if the first message authentication code and the third message authentication code are the same, taking the verification as the verification result corresponding to the target data frame; if the first message authentication code and the third message authentication code are different, taking the verification as the verification result corresponding to the target data frame and discarding the target data frame.
[0016] In this implementation, depending on whether the first message authentication code and the third message authentication code are the same or different, the verification result corresponding to the target data frame is taken as either successful or unsuccessful, which improves the real-time performance of the vehicle bus data frame verification and ensures the reliability of the data received.
[0017] In combination with the first aspect and the above implementation, in some possible implementations, determining at least one candidate freshness value includes: determining a fourth freshness value based on the third freshness value, wherein the fourth freshness value is the highest P byte among the third freshness values, and P is a positive integer; and determining at least one candidate freshness value based on the fourth freshness value and the first freshness value.
[0018] In this implementation, at least one candidate freshness value is determined by the fourth freshness value and the first freshness value, which are determined by the high-byte portion of the third freshness value. This allows for the extraction of partial data and utilization of the inherent structure of the data, avoiding unnecessary full data calculations and improving the flexibility and reliability of the candidate freshness value.
[0019] In conjunction with the first aspect and the above implementation methods, in some possible implementation methods, the candidate freshness value includes a first candidate freshness value, a second candidate freshness value, and a third candidate freshness value. The step of determining at least one candidate freshness value based on the fourth freshness value and the first freshness value includes: concatenating the fourth freshness value and the first freshness value to obtain the first candidate freshness value; incrementing the fourth freshness value to concatenate the incremented fourth freshness value and the first freshness value to obtain the second candidate freshness value; and decrementing the fourth freshness value to concatenate the decremented fourth freshness value and the first freshness value to obtain the third candidate freshness value.
[0020] In this implementation, by concatenating the fourth freshness value, the incremented fourth freshness value, and the decremented fourth freshness value with the first freshness value, a candidate freshness value including a first candidate freshness value, a second candidate freshness value, and a third candidate freshness value is obtained. This improves the robustness and flexibility of the receiver's evaluation of the target data frame, avoids evaluation bias that may be caused by a single value, and improves the reliability of the verification results.
[0021] In combination with the first aspect and the above implementation methods, in some possible implementation methods, the step of verifying the first message authentication code based on the candidate freshness value to determine the verification result corresponding to the target data frame includes: determining at least one candidate message authentication code based on the candidate freshness value; and performing verification processing based on the candidate message authentication code and the first message authentication code to determine the verification result corresponding to the target data frame.
[0022] In this implementation, verification is performed using at least one candidate message authentication code and a first message authentication code determined by the candidate freshness value to determine the verification result corresponding to the target data frame. This allows for the introduction of a parallel verification mechanism using multiple candidate message authentication codes, effectively avoiding misjudgments caused by a single freshness value deviation or transmission error, and improving the integrity and security of data transmission.
[0023] In combination with the first aspect and the above implementation methods, in some possible implementation methods, the method further includes: determining the network performance of the receiving end, wherein the network performance is used to characterize the latency of receiving data; and determining the window size corresponding to the target sliding window based on the network performance of the receiving end.
[0024] In this implementation, the window size corresponding to the target sliding window is determined by the network performance of the receiving end. The appropriate window size of the target sliding window can be selected according to different situations of the receiving end, which reduces the waste of data resources and improves the flexibility of data transmission.
[0025] Secondly, a vehicle communication device is provided, the device comprising: The acquisition module is used to acquire the target data frame sent by the sending end; The parsing module is used to parse the target data frame to obtain a first message authentication code, a first freshness value, and bus data, wherein the first message authentication code is the intercepted message authentication code; The determination module is used to determine the reception result of the target data frame through a target sliding window based on the first freshness value. If the reception result indicates that the target data frame needs to be received, the module determines the verification result corresponding to the target data frame based on the bus data, the first freshness value, and the first message authentication code.
[0026] In conjunction with the second aspect, in some possible implementations, the determining module is configured to: receive the target data frame as the receiving result when the first freshness value is within the target sliding window; receive the target data frame as the receiving result and slide the target sliding window when the first freshness value is greater than the highest sequence number corresponding to the target sliding window; and discard the target data frame as the receiving result when the first freshness value is less than the lowest sequence number corresponding to the target sliding window.
[0027] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, the determining module is used to obtain a second freshness value based on the first freshness value, wherein the first freshness value is a freshness value of length N bytes, the second freshness value is a freshness value of length M bytes, where N is a positive integer and M is a positive integer greater than N; and to determine the verification result corresponding to the target data frame based on the bus data, the second freshness value, and the first message authentication code.
[0028] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, the acquisition module is used to acquire a third freshness value, wherein the third freshness value is the complete freshness value before truncation; the determination module is used to, when the value of the third freshness value and the value of the first freshness value satisfy a threshold condition, obtain a second message authentication code based on the second freshness value and the bus data, and perform verification processing based on the first message authentication code and the second message authentication code to determine the verification result corresponding to the target data frame, wherein the second message authentication code is a complete message authentication code; when the value of the third freshness value and / or the value of the first freshness value do not satisfy the threshold condition, determine at least one candidate freshness value, and perform verification processing based on the candidate freshness value to determine the verification result corresponding to the target data frame.
[0029] In combination with the second aspect and the above implementation methods, in some possible implementation methods, the determining module is used to intercept the second message authentication code to obtain a third message authentication code, wherein the third message authentication code is the highest Q byte in the second message authentication code, and Q is a positive integer; and to perform verification processing based on the first message authentication code and the third message authentication code to determine the verification result corresponding to the target data frame.
[0030] In combination with the second aspect and the above implementation methods, in some possible implementation methods, the determining module is used to, when the first message authentication code and the third message authentication code are the same, take the verification as the verification result corresponding to the target data frame; when the first message authentication code and the third message authentication code are different, take the verification as the verification result corresponding to the target data frame and discard the target data frame.
[0031] In combination with the second aspect and the above implementation, in some possible implementations, the determining module is used to determine a fourth freshness value based on the third freshness value, wherein the fourth freshness value is the highest P byte among the third freshness values, and P is a positive integer; and to determine at least one candidate freshness value based on the fourth freshness value and the first freshness value.
[0032] In conjunction with the second aspect and the above implementation methods, in some possible implementation methods, the candidate freshness value includes a first candidate freshness value, a second candidate freshness value, and a third candidate freshness value. The determining module is used to concatenate the fourth freshness value and the first freshness value to obtain the first candidate freshness value; to increment the fourth freshness value, and then concatenate the incremented fourth freshness value and the first freshness value to obtain the second candidate freshness value; and to decrement the fourth freshness value, and then concatenate the decremented fourth freshness value and the first freshness value to obtain the third candidate freshness value.
[0033] In combination with the second aspect and the above implementation methods, in some possible implementation methods, the determining module is used to determine at least one candidate message authentication code based on the candidate freshness value; perform verification processing based on the candidate message authentication code and the first message authentication code to determine the verification result corresponding to the target data frame.
[0034] In combination with the second aspect and the above implementation methods, in some possible implementation methods, the determining module is used to determine the network performance of the receiving end, the network performance being used to characterize the latency of receiving data; and based on the network performance of the receiving end, to determine the window size corresponding to the target sliding window.
[0035] Thirdly, a vehicle is provided, the vehicle including one or more processors and one or more memories, the one or more memories storing at least one piece of program code, the program code being loaded and executed by the one or more processors to implement the operations performed by the communication method of the vehicle.
[0036] Fourthly, a computer-readable storage medium is provided, wherein at least one piece of program code is stored therein, the program code being loaded and executed by a processor to implement the operations performed by the communication method of the vehicle.
[0037] The technical solution provided in this application involves parsing the target data frame sent by the transmitting end to obtain a first message authentication code, a first freshness value, and bus data. Then, based on the first freshness value, a target sliding window is used to determine the reception result of the target data frame. This allows for the determination of the verification result corresponding to the target data frame based on the bus data, the first freshness value, and the first message authentication code, even if the reception result indicates that the target data frame needs to be received. The sliding window provides fault tolerance for received data, allowing reception even if the order of received data frames differs from their original sending order. This reduces the possibility of the receiving end accidentally discarding data. Simultaneously, it makes the data frame reception process flexible, avoiding processing blockages caused by message delays or network fluctuations, thus improving data processing efficiency. While ensuring secure communication, it enhances the accuracy, stability, and reliability of in-vehicle safety communication. Attached Figure Description
[0038] Figure 1 This is a flowchart illustrating how a transmitter sends a data frame, as provided in an embodiment of this application. Figure 2 This is a flowchart illustrating how a receiver receives a data frame, as provided in an embodiment of this application. Figure 3 This is a flowchart of a message verification code verification method provided in an embodiment of this application; Figure 4 This is a flowchart of a vehicle communication method provided in an embodiment of this application; Figure 5 This is a flowchart of another vehicle communication method provided in an embodiment of this application; Figure 6 This is a schematic diagram illustrating the use of a sliding window according to an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a vehicle communication device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a vehicle provided in an embodiment of this application. Detailed Implementation
[0039] The technical solutions in this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0040] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0041] In order to illustrate the technical solutions provided in the embodiments of this application, some terms involved in the embodiments of this application will be explained below.
[0042] Freshness score: This refers to the timeliness or updateability of data relative to the current time. It reflects the length of time from data generation to its availability for user querying, and is a key indicator in fields such as big data processing, database management, and information retrieval, especially important in applications requiring real-time or near-real-time decision-making. Furthermore, freshness score can also be understood as the real-time nature of information; as time goes on, the staleness of data increases.
[0043] Message Authentication Code (MAC): A MAC is a short message generated using a specific algorithm to check message integrity and authenticate identity. MACs can be used to check whether a message has been altered during transmission, whether accidentally or through a deliberate attack. A key feature of a MAC is the use of a private key K to condense a variable-length message M into a fixed-length authentication token.
[0044] Sliding window: is an efficient algorithmic technique used to process linear data structures such as arrays or strings. It solves various problems by maintaining a variable or fixed-size "window" that slides across the data sequence.
[0045] With the rapid development of intelligent vehicle manufacturing, the complexity of vehicle networks is gradually increasing, and the degree of vehicle connectivity is deepening. Therefore, ensuring the security of in-vehicle network communication information has become crucial.
[0046] In related technologies, secure vehicular communication (V2V) ensures the security of in-vehicle network communication information. Secure V2V is a standard designed to enhance the security of in-vehicle network communication by introducing multiple security mechanisms to protect the integrity, authenticity, and confidentiality of information. By implementing secure V2V, vehicle manufacturers can better protect in-vehicle network communications from unauthorized access and attacks, thereby improving the overall security of the vehicle. However, in related technologies, secure V2V uses a freshness value counter to prevent replay attacks and ensure the freshness of received messages. Due to the heterogeneity of in-vehicle communication networks and the priority arbitration rules based on serial communication protocol identifiers, the order of data frames received by the receiving end is disordered. Furthermore, received data frames may be mistakenly discarded, resulting in low flexibility in data reception, poor data ordering, and low reliability.
[0047] Therefore, how to reduce the possibility of data loss while improving the orderliness and reliability of data in safe vehicle communication is a hot research topic.
[0048] Figure 1 This is a flowchart of a data frame transmission method provided in an embodiment of this application.
[0049] For example, application 10 combines the unprocessed bus data 11, the second freshness value 12, and the CAN ID 13 into a message frame. Then, the message frame is processed by the message verification code calculation module 14, which uses the symmetric key 16 of the key management module 15 to generate a second message authentication code 17. The highest 8 bytes of the second message authentication code 17 are extracted to obtain the first message authentication code 18. Simultaneously, the last 2 bytes of the second freshness value 12 are extracted by the Original Equipment Manufacturer (OEM) key management module 19 to obtain the first freshness value 110. Finally, the CAN ID 13, bus data 11, first message authentication code 18, and first freshness value 110 are concatenated to obtain the target data frame. The second freshness value 12 is generated by the OEM key management module 19.
[0050] Figure 2 This is a flowchart of a receiving end receiving a data frame, provided in an embodiment of this application.
[0051] For example, after receiving the target data frame, the receiving end parses the target data frame to obtain CAN ID 13, first message authentication code 18, first freshness value 110, and bus data 11. Then, through the target sliding window in the sliding window freshness management module 20, the receiving result of the target data frame is determined. If the receiving result indicates that the target data frame needs to be received, the sliding window freshness management module 20 generates a second freshness value 12 using the first freshness value 110, so as to form a message frame based on CAN ID 13, bus data 11, and second freshness value 12. Then, through the message verification code calculation module 14, the symmetric key 16 of the key management module 15 is used to generate a second message authentication code 17 based on the bus data 11 and second freshness value 12 in the message frame. Then, the highest 8 bytes of the second message authentication code 17 are extracted to obtain a third message authentication code 21. The first message authentication code 19 and the third message authentication code 21 are verified 22. If the first message authentication code 19 and the third message authentication code 21 are the same, the verification is passed and taken as the verification result corresponding to the target data frame. If the first message authentication code 19 and the third message authentication code 21 are different, the failure to verify will be taken as the verification result corresponding to the target data frame and the target data frame will be discarded. The verification result output after verification processing 22 will be fed back to the application 10 for use.
[0052] Figure 3 This is a flowchart of a message verification code verification method provided in an embodiment of this application.
[0053] For example, after the start, a communication security frame (corresponding to the target data frame) is received, triggering S31 to check whether the value of the first freshness value is equal to 0xFFFF and whether the value of the third freshness value is equal to FFFFFFFFFFFF. This mainly involves two verification logics, as detailed below: In the first scenario: if yes, proceed to S32 to calculate the third message authentication code, then proceed to S33 to verify if the third message authentication code is correct. If yes, proceed to S34 to update the local freshness value and the freshness value of the target sliding window, and S35 to accept the communication security frame. If no, proceed to S36 to increment the error counter and S37 to check if the communication security frame is lost, and finally end.
[0054] The second scenario: After determining whether to proceed to S38 FFV1 = MSB | LSB_FV, further proceed to S39 to check if the fourth freshness value is less than 0xFFFFFFFF. If yes, proceed to S310 FFV2 = (MSB+1) | LSB_FV. If no, proceed to S311 FFV2 = MSB | LSB_FV. Further proceed to S312 to check if the fourth freshness value is greater than 0. If yes, proceed to S313 FFV3 = (MSB-1) | LSB_FV. If no, proceed to S314 FFV3 = MSB | LSB_FV. Through this process, three candidate freshness values are calculated. Further, proceed to S315 to calculate the first candidate message authentication code, then proceed to S316 to check if the first freshness value is greater than the least significant bit stored locally. If yes, proceed to S317 to calculate the third candidate message authentication code; if no, proceed to S318 to calculate the second candidate message authentication code. Then proceed to S319 to verify if the first candidate message authentication code is correct. If yes in S319, proceed to S320 to check if FFV1 is in the list of received freshness values. If yes in S320, proceed to S34 to update the local freshness value and the freshness value of the target sliding window, and S35 to receive the communication security frame. If no in S320, proceed to S36 to increment the error counter and S37 to check if the communication security frame is lost, and finally end. Furthermore, in S319, the process proceeds to S321 to determine if the first freshness value is less than or equal to the least significant bit stored locally. If S321 is correct, the process proceeds to S322 to determine if the second candidate message authentication code is verified correctly. If S322 is correct, the process proceeds to S34 to update the local freshness value and the freshness value of the target sliding window, and to S35 to receive the communication security frame. If S322 is not correct, the process proceeds to S36 to increment the error counter and to S37 to determine if the communication security frame is lost, and then the process ends. If S321 is true, proceed to S323 to check if the first freshness value is greater than the least significant bit stored locally. If S323 is true, proceed to S324 to check if the third candidate message authentication code is verified correctly. If S324 is true, proceed to S325 to check if FFV3 is in the list of received freshness values. If S325 is true, proceed to S34 to update the local freshness value and the freshness value of the target sliding window, and S35 to accept the communication security frame. If S323, S324, and S325 are false, proceed to S36 to increment the error counter and S37 to check if the communication security frame is lost, and finally end.
[0055] Here, the first candidate freshness value is denoted as FFV1, the second candidate freshness value as FFV2, the third candidate freshness value as FFV3, the fourth freshness value as MSB, the first freshness value as LSB_FV, MSB+1 indicates that the fourth freshness value is incremented by 1, and MSB-1 indicates that the fourth freshness value is decremented by 1.
[0056] The application scenarios of the technical solutions provided in the embodiments of this application are described below. The technical solutions provided in the embodiments of this application can be applied to different types of vehicles, such as hybrid vehicles, electric vehicles, and pure fuel vehicles. Of course, with the development of science and technology, other types of vehicles may also emerge, and the technical solutions provided in the embodiments of this application are also applicable to other types of vehicles.
[0057] After adopting the technical solution provided in this application embodiment, the target data frame sent by the transmitting end is parsed to obtain the first message authentication code, the first freshness value, and the bus data. Then, based on the first freshness value, the receiving result of the target data frame is determined through a target sliding window. In cases where the receiving result indicates that the target data frame needs to be received, the verification result corresponding to the target data frame is determined based on the bus data, the first freshness value, and the first message authentication code. The sliding window provides fault tolerance for received data, allowing reception even if the order of received data frames differs from their sending order, reducing the possibility of the receiving end accidentally discarding data. Simultaneously, it makes the data frame receiving process flexible, avoiding processing blockages caused by message delays or network fluctuations, improving data processing efficiency, and enhancing the accuracy, stability, and reliability of in-vehicle safety communication while ensuring secure communication.
[0058] After introducing the application scenarios of the embodiments of this application, the technical solutions provided by the embodiments of this application will be described below. (See also...) Figure 4 The executing entity is the receiving end, and the method includes the following steps.
[0059] 401. Obtain the target data frame sent by the sending end, and parse the target data frame to obtain the first message authentication code, the first freshness value and the bus data. The first message authentication code is the intercepted message authentication code.
[0060] In this context, the sending end is the primary data transmitter in secure vehicle-to-everything (V2X) communication. The target data frame is the data frame sent by the sending end. In some embodiments, the target data frame is an AutoSAR Protocol Data Unit (PDU). The first message authentication code is the intercepted message authentication code. In some embodiments, the sending end first generates a 16-byte message authentication code, and then intercepts this code to obtain the first message authentication code. The first message authentication code can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. The first freshness value is the low byte of the freshness value. The first freshness value can be any suitable size, such as 99, 63, etc. The first freshness value can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. The Controller Area Network (CAN) bus is a serial communication protocol bus used for real-time applications. It can use twisted-pair cables to transmit signals and is one of the most widely used fieldbuses in the world. Bus data is the actual data from the application layer that has not undergone secure communication processing. In some embodiments, the upper layer of the sending application obtains the real bus data and freshness value without secure communication processing, generates a first message authentication code based on the bus data and freshness value, and further generates a target data frame based on the freshness value, the first message authentication code, the bus data, and the CAN ID. It should be noted that the vehicle communication method in this application improves the process of the receiving end receiving the data frame; therefore, this application does not limit the method by which the sending end encapsulates and sends the data frame. In some embodiments, the sending end splits the target data frame according to the number of bytes of different data types to parse the target data frame and obtain the first message authentication code, the first freshness value, and the bus data.
[0061] 402. Based on the first freshness value, determine the reception result of the target data frame through the target sliding window.
[0062] The target sliding window is a window in the receiving end used to process linear data structures such as arrays or strings. In some embodiments, the window size corresponding to the target sliding window can be any suitable size, such as 64 or 32. The reception result of the target data frame is used to characterize the receiving end's reception status of the target data frame. In some embodiments, the content characterized by the reception result of the target data frame includes, but is not limited to, one of the following: the target data frame needs to be received, or the target data frame needs to be discarded. In some embodiments, the receiving end includes a sliding window freshness management module, which can determine the reception result of the target data frame based on a first freshness value through the target sliding window.
[0063] 403. If the received result indicates that the target data frame needs to be received, the verification result corresponding to the target data frame is determined based on the bus data, the first freshness value, and the first message authentication code.
[0064] The verification result corresponding to the target data frame is used to indicate whether the target data frame is a correct data frame. In some embodiments, if the verification result corresponding to the target data frame indicates that the target data frame is correct, the receiving end accepts the target data frame and further determines whether it is necessary to update the local freshness value and the freshness value of the target sliding window. If the verification result corresponding to the target data frame indicates that the target data frame is incorrect, the receiving end discards the target data frame and increments the error counter by one.
[0065] The technical solution provided in this application involves parsing the target data frame sent by the transmitting end to obtain a first message authentication code, a first freshness value, and bus data. Then, based on the first freshness value, a target sliding window is used to determine the reception result of the target data frame. This allows for the determination of the verification result corresponding to the target data frame based on the bus data, the first freshness value, and the first message authentication code, even if the reception result indicates that the target data frame needs to be received. The sliding window provides fault tolerance for received data, allowing reception even if the order of received data frames differs from their original sending order. This reduces the possibility of the receiving end accidentally discarding data. Simultaneously, it makes the data frame reception process flexible, avoiding processing blockages caused by message delays or network fluctuations, thus improving data processing efficiency. While ensuring secure communication, it enhances the accuracy, stability, and reliability of in-vehicle safety communication.
[0066] It should be noted that steps 401-403 above are a simplified description of the vehicle communication method provided in the embodiments of this application. The following will provide a more detailed description of the vehicle communication method provided in the embodiments of this application, using some examples. See [link to relevant documentation]. Figure 5 Taking the executing entity as the receiving end as an example, the method includes the following steps.
[0067] 501. Obtain the target data frame sent by the sending end, and parse the target data frame to obtain the first message authentication code, the first freshness value and the bus data. The first message authentication code is the intercepted message authentication code.
[0068] In this context, the sending end is the primary data transmitter in secure vehicle-to-everything (V2X) communication. The target data frame is the data frame sent by the sending end. The first message authentication code (CAC) is the intercepted CAC. In some embodiments, the sending end first generates a 16-byte CAC and then intercepts it to obtain the first CAC. The first CAC can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. The first freshness value is the low byte of the freshness value. The first freshness value can be any suitable size, such as 63, 101, etc. In some embodiments, the first CAC can be any suitable number of bytes, such as 2 bytes, 4 bytes, etc. The Controller Area Network (CAN) bus is a serial communication protocol bus used for real-time applications. It can use twisted-pair cables to transmit signals and is one of the most widely used fieldbuses in the world. Bus data is the real data from the application layer that has not undergone secure communication processing. In some embodiments, the sending end's application layer obtains the real bus data and freshness value without secure communication processing, generates the first CAC based on the bus data and freshness value, and further generates the target data frame based on the freshness value, the first CAC, the bus data, and the CAN ID. It should be noted that the vehicle communication method in this application improves the process of receiving data frames at the receiving end. Therefore, this application does not limit the way the sending end encapsulates and sends data frames. In some embodiments, the sending end splits the target data frame according to the number of bytes of different data, so as to parse the target data frame and obtain the first message authentication code, the first freshness value, and bus data.
[0069] 502. Based on the first freshness value, determine the reception result of the target data frame through the target sliding window.
[0070] The target sliding window is a window used by the receiving end to process linear data structures such as arrays or strings. In some embodiments, different values in the target sliding window represent acceptable freshness values for that target sliding window. The window size corresponding to the target sliding window can be any suitable size, such as 64 or 32. The reception result of the target data frame is used to characterize the receiving end's reception status of the target data frame. In some embodiments, the reception result of the target data frame represents, but is not limited to, one of the following: the target data frame needs to be received, or the target data frame needs to be discarded.
[0071] In one possible implementation, if the first freshness value is within the target sliding window, the target data frame is received as the reception result; if the first freshness value is greater than the highest sequence number corresponding to the target sliding window, the target data frame is received as the reception result and the target sliding window is slid; if the first freshness value is less than the lowest sequence number corresponding to the target sliding window, the target data frame is discarded as the reception result.
[0072] Here, "first freshness value within the target sliding window" means that the first freshness value falls within the acceptable freshness value range of the target sliding window. For example, if the first freshness value of the target data frame is 63, and the acceptable freshness value range of the target sliding window is 2-65, then the first freshness value is within the target sliding window. In this case, the target data frame is received, and the received target data frame is taken as the reception result. It should be noted that even if the first freshness value is within the target sliding window, but the target sliding window has already received the target data frame, the target data frame still needs to be discarded, and the discarded target data frame is taken as the reception result.
[0073] The highest sequence number corresponding to the target sliding window refers to the maximum acceptable freshness value of the sliding window at present. In some embodiments, the highest sequence number corresponding to the target sliding window can be any suitable size, such as 68, 164, etc. A first freshness value greater than the highest sequence number corresponding to the target sliding window means that the first freshness value does not fall within the acceptable freshness values of the target sliding window and is greater than the maximum acceptable freshness value of the target sliding window. For example, if the first freshness value of the target data frame is 166, and the acceptable freshness value range of the target sliding window is 101-164, satisfying the condition that the first freshness value is greater than the highest sequence number corresponding to the target sliding window, then the received target data frame is taken as the reception result, and the target sliding window is slid.
[0074] The first freshness value being within the target sliding window means that the first freshness value does not fall within the acceptable freshness values of the target sliding window and is less than the minimum acceptable freshness value of the target sliding window. For example, if the first freshness value of the target data frame is 99, and the acceptable freshness value range of the target sliding window is 101-164, then the first freshness value is less than the lowest sequence number corresponding to the target sliding window. In this case, the target data frame is discarded, and the discarded target data frame is taken as the reception result.
[0075] Figure 6 This is a schematic diagram of a sliding window provided in an embodiment of this application.
[0076] For example, the target sliding window 60 has a window length of 64, and the range of acceptable freshness values for the target sliding window 60 is 101-164. The figure shows four first freshness values. Specifically, for first freshness values of 165 and 166, if the first freshness value is greater than the highest sequence number corresponding to the target sliding window, the target data frame is received as the reception result, and the target sliding window slides. For a first freshness value of 99, if the first freshness value is less than the lowest sequence number corresponding to the target sliding window, the target data frame is discarded, and the discarded target data frame is taken as the reception result. For a first freshness value of 161, if the first freshness value is within the target sliding window, the target data frame is received, and the received target data frame is taken as the reception result.
[0077] It should be noted that due to the sliding window's sliding characteristic, when the first freshness value is greater than the highest sequence number corresponding to the target sliding window, sliding can change the range of acceptable freshness values for the target sliding window, thus ensuring the first freshness value falls within the target sliding window. Ultimately, the target data frame is received, and this received data frame is taken as the reception result. However, when the first freshness value is less than the lowest sequence number corresponding to the target sliding window, even if sliding changes the range of acceptable freshness values for the target sliding window, the changed range may not allow the first freshness value to fall within the target sliding window. Therefore, the target data frame must be discarded, and this discarded target data frame is taken as the reception result.
[0078] In this implementation, the receiving result corresponding to the target data frame is determined according to the different situations between the first freshness value and the target sliding window, which can cover different scenarios of actual data transmission and improve the flexibility of the receiving end in receiving data.
[0079] 503. When the received result indicates that the target data frame needs to be received, a second freshness value is obtained based on the first freshness value. The first freshness value is a freshness value with a length of N bytes, and the second freshness value is a freshness value with a length of M bytes. N is a positive integer, and M is a positive integer greater than N.
[0080] The verification result corresponding to the target data frame is used to characterize whether the target data frame is a correct data frame. In some embodiments, if the reception result indicates that the target data frame needs to be discarded, the receiving end discards the target data frame and increments the error counter by one. The second freshness value is a number of low-order bytes in the freshness value. The second freshness value can be any suitable size, such as 106, 45, etc. In some embodiments, the first freshness value is a freshness value of length N bytes, and the second freshness value is a freshness value of length M bytes, where N and M are both positive integers and M is greater than N, that is, the length of the second freshness value is greater than the length of the first freshness value. In some embodiments, the receiving end includes a sliding window freshness management module, which can determine the reception result of the target data frame through a target sliding window based on the first freshness value, and obtain the second freshness value based on the first freshness value if the reception result indicates that the target data frame needs to be received.
[0081] In some embodiments, a first freshness value is used to query a first relational table to obtain a second freshness value.
[0082] The first relationship table stores multiple first freshness values and corresponding second freshness values. By querying the first relationship table using a first freshness value, the corresponding second freshness value can be obtained. This first relationship table is calibrated by a technician according to actual conditions, and this embodiment of the application does not limit it.
[0083] 504. Based on the bus data, the second freshness value, and the first message authentication code, determine the verification result corresponding to the target data frame.
[0084] The verification result corresponding to the target data frame is used to characterize whether the target data frame is a correct data frame. The first message authentication code is the intercepted message authentication code. In some embodiments, the sending end first generates a 16-byte message authentication code, and then intercepts the message authentication code to obtain the first message authentication code. The first message authentication code can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. In some embodiments, if the verification result corresponding to the target data frame indicates that the target data frame is correct, the receiving end accepts the target data frame and further determines whether it is necessary to update the local freshness value and the freshness value of the target sliding window. If the verification result corresponding to the target data frame indicates that the target data frame is incorrect, the receiving end discards the target data frame and increments the error counter by one. In some embodiments, the bus data and the second freshness value are verified based on the first message verification code to determine the verification result corresponding to the target data frame.
[0085] In this implementation, a second freshness value is obtained based on a first freshness value. The verification result corresponding to the target data frame is determined based on bus data, the second freshness value, and the first message authentication code. The received data frame is detected in real time at the receiving end, ensuring the integrity and real-time performance of the target data frame and significantly improving the security and reliability of the vehicle network.
[0086] In one possible implementation, a third freshness value is obtained, which is the complete, unabridged freshness value. If the value of the third freshness value and the value of the first freshness value satisfy a threshold condition, a second message authentication code is obtained based on the second freshness value and the bus data. Verification processing is then performed based on the first message authentication code and the second message authentication code to determine the verification result corresponding to the target data frame. The second message authentication code is a complete message authentication code. If the value of the third freshness value and / or the value of the first freshness value do not satisfy the threshold condition, at least one candidate freshness value is determined. Verification processing is then performed based on the candidate freshness value to determine the verification result corresponding to the target data frame.
[0087] To provide a clearer explanation of the above implementation methods, the process of determining the verification result corresponding to the target data frame in the above implementation methods will be described in three parts below.
[0088] Part 1: Obtaining the third freshness value.
[0089] The third freshness value is the complete freshness value before truncation. In some embodiments, the third freshness value can be any suitable size, such as 195, 33, etc. The third freshness value can be 16 bytes. In some embodiments, the receiving end includes non-volatile memory (NVM) for storing the third freshness value, which can be retrieved from the non-volatile memory. The non-volatile memory can be any suitable type, such as electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), etc. This application does not limit the type of non-volatile memory.
[0090] The second part involves obtaining a second message authentication code based on the second freshness value and the bus data when the values of the third freshness value and the first freshness value meet the threshold condition. Then, a verification process is performed based on the first message authentication code and the second message authentication code to determine the verification result corresponding to the target data frame.
[0091] The threshold condition may include, but is not limited to, one of the following: greater than a preset value, equal to a preset value, etc. In some embodiments, different threshold conditions are set for the third freshness value and the first freshness value, and each is judged separately. For example, the threshold condition is: the value of the first freshness value is equal to 0xFFFF and the value of the third freshness value is equal to FFFFFFFFFFFF. If the value of the third freshness value is equal to 0xFFFF and the value of the third freshness value is equal to FFFFFFFFFFFF, then it is determined that the value of the third freshness value and the value of the first freshness value satisfy the threshold condition. The second message authentication code is a complete message authentication code.
[0092] In some embodiments, the second message authentication code is a 16-byte message authentication code. The receiving end includes a message authentication code calculation module and an original equipment manufacturer (OEM) key management module. The message authentication code calculation module can obtain a symmetric key from the OEM key management module, and then decrypt the second freshness value and bus data based on the symmetric key to obtain the second message authentication code.
[0093] In some embodiments, verification processing is performed based on a first message authentication code and a second message authentication code. If some fixed bytes of the message authentication code in the first message authentication code and the second message authentication code are the same, the verification will pass and be used as the verification result corresponding to the target data frame. Conversely, if some fixed bytes of the message authentication code in the first message authentication code and the second message authentication code are different, the verification will fail and be used as the verification result corresponding to the target data frame. In this way, the verification result corresponding to the target data frame can be determined.
[0094] In one possible implementation, the second message authentication code is truncated to obtain a third message authentication code, which is the highest Q byte of the second message authentication code, where Q is a positive integer. Verification processing is then performed based on the first and third message authentication codes to determine the verification result corresponding to the target data frame.
[0095] The third message authentication code is obtained by truncating the second message authentication code. In some embodiments, the length of the first message authentication code and the length of the third message authentication code are the same. The third message authentication code is the highest Q byte in the second message authentication code, where Q is a positive integer. Q can be any suitable size, such as 8, 16, etc. The methods for truncating the second message authentication code may include, but are not limited to: truncating the second message authentication code by matching patterns using regular expressions, truncating the second message authentication code by splitting and slicing strings, etc.
[0096] In some embodiments, the first message authentication code and the third message authentication code are queried in the second relation table to verify the first message authentication code and the third message authentication code, thereby obtaining the verification result corresponding to the target data frame.
[0097] The second relation table stores multiple first message authentication codes and third message authentication codes, as well as the corresponding verification results for each first message authentication code and third message authentication code. By querying the second relation table using the first message authentication code and the third message authentication code, the verification result corresponding to the target data frame can be obtained. This second relation table is labeled by technicians according to actual conditions, and this application embodiment does not limit it.
[0098] In this implementation, the second message authentication code is intercepted to obtain the third message authentication code. Verification is then performed based on the first message authentication code and the third message authentication code to determine the verification result corresponding to the target data frame. The most significant byte of the second message authentication code can be taken as the third message authentication code, thereby completing fast and reliable security verification without increasing additional transmission overhead.
[0099] In one possible implementation, if the first authentication code and the third authentication code are the same, the verification will be passed and the verification result corresponding to the target data frame will be accepted. If the first authentication code and the third authentication code are different, the verification will fail and the target data frame will be discarded.
[0100] In this process, since the receiving and sending ends use symmetric encryption to transmit the target data frame, the receiving end, based on the second freshness value and the second message authentication code obtained from the bus data, further intercepts the third message authentication code. Therefore, the target data frame is considered correct only if the first and third message authentication codes are the same, and the verification result is passed. Conversely, if the first and third message authentication codes are different, the target data frame is considered incorrect, and the verification result is failed, resulting in the target data frame being discarded. In some embodiments, if the verification result indicates that the target data frame is incorrect, the receiving end discards the target data frame and increments the error counter by one.
[0101] In this implementation, depending on whether the first message authentication code and the third message authentication code are the same or different, the verification result corresponding to the target data frame is taken as either successful or unsuccessful, which improves the real-time performance of the vehicle bus data frame verification and ensures the reliability of the data received.
[0102] The third part involves determining at least one candidate freshness value if the value of the third freshness value and / or the value of the first freshness value do not meet the threshold condition, and then performing verification processing on the first message authentication code based on the candidate freshness value to determine the verification result corresponding to the target data frame.
[0103] The threshold condition may include, but is not limited to, one of the following: greater than a preset value, equal to a preset value, etc. In some embodiments, different threshold conditions are set for the third freshness value and the first freshness value, and each is judged separately. For example, the threshold condition is: the value of the first freshness value is equal to 0xFFFF and the value of the third freshness value is equal to FFFFFFFFFFFF. If the value of the third freshness value is equal to 0xFFFF and the value of the first freshness value is equal to 000FFFFFFFFF, it is determined that the value of the third freshness value and the value of the first freshness value do not meet the threshold condition.
[0104] The candidate freshness value is a determined freshness value used for verifying the first message authentication code. In some embodiments, the number of candidate freshness values is at least one, and the values of different candidate freshness values may be the same or different. In some embodiments, at least one candidate authentication code is determined based on at least one candidate freshness value, and the first message authentication code is verified based on at least one candidate authentication code to determine the verification result corresponding to the target data frame.
[0105] In this implementation, depending on whether the values of the third freshness value and the first freshness value meet the threshold conditions, the verification process is performed on the second message authentication code obtained based on the second freshness value and the bus data, or the verification process is performed on the first message authentication code based on the candidate freshness value. The verification result corresponding to the target data frame is determined. Different processes can be selected to determine the verification result according to the actual situation, which improves the real-time performance, compatibility and security reliability of the vehicle bus data frame.
[0106] In one possible implementation, a fourth freshness value is determined based on the third freshness value, the fourth freshness value being the highest P byte among the third freshness values, where P is a positive integer. At least one candidate freshness value is determined based on the fourth freshness value and the first freshness value.
[0107] The third freshness value is the complete freshness value before truncation. In some embodiments, the third freshness value can be any suitable size, such as 195, 33, etc. The third freshness value can be 16 bytes. The fourth freshness value is the freshness value obtained by truncating the high byte of the third freshness value. In some embodiments, the fourth freshness value is the highest P byte in the third freshness value. P can be any suitable positive integer, such as 4, 6, etc. In some embodiments, the receiving end includes a sliding window freshness management module, which can truncate the third freshness value to determine the fourth freshness value based on the third freshness value.
[0108] The candidate freshness value is a determined freshness value used for verifying the first message authentication code. The first freshness value is the low byte of the freshness value. The first freshness value can be any suitable size, such as 99, 63, etc. The first freshness value can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. In some embodiments, the number of candidate freshness values is at least one, and the values of different candidate freshness values may be the same or different. By incrementing or decrementing the fourth freshness value to obtain fourth freshness values of different values, and then concatenating the different values of the fourth freshness value with the first freshness value, at least one candidate freshness value can be determined.
[0109] In this implementation, at least one candidate freshness value is determined by the fourth freshness value and the first freshness value, which are determined by the high-byte portion of the third freshness value. This allows for the extraction of partial data and utilization of the inherent structure of the data, avoiding unnecessary full data calculations and improving the flexibility and reliability of the candidate freshness value.
[0110] In one possible implementation, the candidate freshness value includes a first candidate freshness value, a second candidate freshness value, and a third candidate freshness value. The fourth freshness value and the first freshness value are concatenated to obtain the first candidate freshness value. The fourth freshness value is incremented, and the incremented fourth freshness value is then concatenated with the first freshness value to obtain the second candidate freshness value. The fourth freshness value is decremented, and the decremented fourth freshness value is then concatenated with the first freshness value to obtain the third candidate freshness value.
[0111] To provide a clearer explanation of the above implementation methods, the process of determining the candidate freshness value in the above implementation methods will be described in three parts below.
[0112] The first part involves concatenating the fourth freshness value and the first freshness value to obtain the first candidate freshness value.
[0113] The first candidate freshness value is obtained by directly concatenating the fourth freshness value and the first freshness value. In some embodiments, the first candidate freshness value can be any suitable size, such as 133, 65, etc. The first candidate freshness value can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc.
[0114] In some embodiments, when concatenating the fourth freshness value and the first freshness value, the fourth freshness value is placed in the high byte position and the first freshness value is placed in the low byte position, and the first candidate freshness value can be obtained by directly concatenating them sequentially. For example, if the first candidate freshness value is denoted as FFV1, the fourth freshness value is denoted as MSB, and the first freshness value is denoted as LSB_FV, then FFV1 = MSB | LSB_FV.
[0115] The second part involves concatenating the fourth freshness value (after incremental processing) with the first freshness value to obtain the second candidate freshness value.
[0116] The second candidate freshness value is obtained by concatenating the incremented fourth freshness value and the first freshness value. In some embodiments, the second candidate freshness value can be any suitable size, such as 98, 25, etc. The second candidate freshness value can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. The length of the second candidate freshness value is the same as the length of the first candidate freshness value, and the numerical value of the second candidate freshness value can be the same as or different from the numerical value of the first candidate freshness value.
[0117] In some embodiments, the fourth freshness value is incremented by any suitable positive integer (e.g., 1, 2, etc.). When concatenating the incremented fourth freshness value with the first freshness value, the incremented fourth freshness value is placed in the high byte position, and the first freshness value is placed in the low byte position. The second candidate freshness value is obtained by directly concatenating them sequentially. For example, if the second candidate freshness value is denoted as FFV2, the fourth freshness value as MSB, and the first freshness value as LSB_FV, then FFV2 = (MSB+1) | LSB_FV.
[0118] In some embodiments, if the value of the fourth freshness value meets the first preset condition, there is no need to increment the fourth freshness value; the freshness value obtained by concatenating the fourth freshness value and the first freshness value is directly used as the second candidate freshness value. The value of the fourth freshness value meeting the first preset condition can be MSB = 0xFFFFFFFF. It should be noted that when the value of the fourth freshness value meets the first preset condition, the value of the fourth freshness value reaches its maximum value; therefore, there is no need to increment the fourth freshness value.
[0119] The third part involves reducing the fourth freshness value, then concatenating the reduced fourth freshness value with the first freshness value to obtain the third candidate freshness value.
[0120] The third candidate freshness value is obtained by concatenating the fourth freshness value (after a decrease in freshness) and the first freshness value. In some embodiments, the third candidate freshness value can be any suitable size, such as 96, 110, etc. The third candidate freshness value can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. The lengths of the second candidate freshness value, the first candidate freshness value, and the third candidate freshness value are the same, and the numerical value of the third candidate freshness value can be the same as or different from the numerical value of the first candidate freshness value.
[0121] In some embodiments, the fourth freshness value is decreased by any suitable positive integer (e.g., 1, 2, etc.) to perform a decrementing process. When concatenating the decremented fourth freshness value and the first freshness value, the decremented fourth freshness value is placed in the high byte position, and the first freshness value is placed in the low byte position. The third candidate freshness value is obtained by directly concatenating them sequentially. For example, if the third candidate freshness value is denoted as FFV3, the fourth freshness value as MSB, and the first freshness value as LSB_FV, then FFV3 = (MSB-1) | LSB_FV.
[0122] In some embodiments, if the value of the fourth freshness value meets the second preset condition, there is no need to decrement the fourth freshness value; the freshness value obtained by concatenating the fourth freshness value and the first freshness value is directly used as the third candidate freshness value. The value of the fourth freshness value meeting the second preset condition can be MSB = 0x00000000. It should be noted that when the value of the fourth freshness value meets the second preset condition, the value of the fourth freshness value reaches its minimum value; therefore, there is no need to decrement the fourth freshness value.
[0123] In this implementation, by concatenating the fourth freshness value, the incremented fourth freshness value, and the decremented fourth freshness value with the first freshness value, a candidate freshness value including a first candidate freshness value, a second candidate freshness value, and a third candidate freshness value is obtained. This improves the robustness and flexibility of the receiver's evaluation of the target data frame, avoids evaluation bias that may be caused by a single value, and improves the reliability of the verification results.
[0124] In one possible implementation, at least one candidate message authentication code is determined based on the candidate freshness value. Verification processing is then performed based on the candidate message authentication code and the first message authentication code to determine the verification result corresponding to the target data frame.
[0125] The candidate message authentication code is determined based on the candidate freshness value. In some embodiments, the number of candidate message authentication codes is at least one, and the number of candidate message authentication codes is the same as the candidate freshness value, with each candidate freshness value having a corresponding candidate message authentication code. The candidate message authentication code can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. In some embodiments, the receiving end includes a message authentication code calculation module and an original equipment manufacturer (OEM) key management module. The message authentication code calculation module can obtain a symmetric key from the OEM key management module, and then decrypt the candidate freshness value and bus data based on the symmetric key to obtain at least one intermediate message authentication code. Then, the at least one intermediate message authentication code is truncated to obtain at least one candidate message authentication code.
[0126] The verification result corresponding to the target data frame is used to characterize whether the target data frame is a correct data frame. In some embodiments, if the verification result corresponding to the target data frame indicates that the target data frame is correct, the receiving end accepts the target data frame and further determines whether it is necessary to update the local freshness value and the freshness value of the target sliding window. If the verification result corresponding to the target data frame indicates that the target data frame is incorrect, the receiving end discards the target data frame and increments the error counter by one.
[0127] The first message authentication code is the intercepted message authentication code. In some embodiments, the sender first generates a 16-byte message authentication code, and then intercepts this message authentication code to obtain the first message authentication code. The first message authentication code can be any suitable number of bytes, such as 8 bytes, 6 bytes, etc. The length of the first message authentication code is the same as the length of the candidate message authentication codes.
[0128] In some embodiments, when verifying the candidate message authentication code and the first message authentication code, if there is a candidate message authentication code that is the same as the first message authentication code, the verification will be passed and the verification result will be used for the target data frame. If there is no candidate message authentication code that is the same as the first message authentication code, the verification will be failed and the target data frame will be discarded.
[0129] In this implementation, verification is performed using at least one candidate message authentication code and a first message authentication code determined by the candidate freshness value to determine the verification result corresponding to the target data frame. This allows for the introduction of a parallel verification mechanism using multiple candidate message authentication codes, effectively avoiding misjudgments caused by a single freshness value deviation or transmission error, and improving the integrity and security of data transmission.
[0130] In one possible implementation, the network performance of the receiving end is determined, which characterizes the latency of received data. Based on the network performance of the receiving end, the window size corresponding to the target sliding window is determined.
[0131] In this context, the network performance of the receiving end refers to the capabilities and quality indicators exhibited by the data from its arrival at the receiving end, within the local protocol stack, until its delivery to the application. Network performance characterizes the latency of received data. The window size corresponding to the target sliding window can be any suitable value, such as 64, 128, 32, etc. In some embodiments, the network performance of the receiving end and the window size corresponding to the target sliding window are inversely proportional; that is, the better the network performance of the receiving end, the smaller the window size corresponding to the target sliding window, and vice versa. In some embodiments, the latency of data reception at the receiving end is determined based on the network performance of the receiving end, and the window size corresponding to the target sliding window is determined based on the latency of data reception at the receiving end.
[0132] In some embodiments, the window size corresponding to the target sliding window is obtained by querying a third relation table based on the data reception delay at the receiving end.
[0133] The third relation table stores the data reception delay information of multiple receiving ends and the corresponding window size for each receiving end's data reception delay. By querying the third relation table using the data reception delay information of each receiving end, the window size corresponding to the target sliding window can be obtained. This third relation table is calibrated by technicians according to actual conditions, and this application embodiment does not limit it.
[0134] In this implementation, the window size corresponding to the target sliding window is determined by the network performance of the receiving end. The appropriate window size of the target sliding window can be selected according to different situations of the receiving end, which reduces the waste of data resources and improves the flexibility of data transmission.
[0135] Figure 7 This is a schematic diagram of the structure of a vehicle communication device provided in an embodiment of this application. See also... Figure 7 The device includes: The acquisition module 701 is used to acquire the target data frame sent by the sending end; The parsing module 702 is used to parse the target data frame to obtain the first message authentication code, the first freshness value and bus data. The first message authentication code is the intercepted message authentication code. The determination module 703 is used to determine the reception result of the target data frame through the target sliding window based on the first freshness value. If the reception result indicates that the target data frame needs to be received, the module determines the verification result corresponding to the target data frame based on the bus data, the first freshness value and the first message authentication code.
[0136] In one possible implementation, the determining module 703 is configured to: receive the target data frame as the receiving result when the first freshness value is within the target sliding window; receive the target data frame as the receiving result and slide the target sliding window when the first freshness value is greater than the highest sequence number corresponding to the target sliding window; and discard the target data frame as the receiving result when the first freshness value is less than the lowest sequence number corresponding to the target sliding window.
[0137] In one possible implementation, the determining module 703 is used to obtain a second freshness value based on the first freshness value, wherein the first freshness value is a freshness value of length N bytes and the second freshness value is a freshness value of length M bytes, where N is a positive integer and M is a positive integer greater than N; and to determine the verification result corresponding to the target data frame based on the bus data, the second freshness value and the first message authentication code.
[0138] In one possible implementation, the acquisition module 701 is used to acquire a third freshness value, which is a complete freshness value that has not been truncated; the determination module 703 is used to, if the value of the third freshness value and the value of the first freshness value satisfy a threshold condition, obtain a second message authentication code based on the second freshness value and the bus data, and perform verification processing based on the first message authentication code and the second message authentication code to determine the verification result corresponding to the target data frame, wherein the second message authentication code is a complete message authentication code; if the value of the third freshness value and / or the value of the first freshness value do not satisfy the threshold condition, determine at least one candidate freshness value, and perform verification processing based on the candidate freshness value to determine the verification result corresponding to the target data frame.
[0139] In one possible implementation, the determining module 703 is used to intercept the second message authentication code to obtain a third message authentication code, wherein the third message authentication code is the highest Q byte in the second message authentication code, and Q is a positive integer; and to perform verification processing based on the first message authentication code and the third message authentication code to determine the verification result corresponding to the target data frame.
[0140] In one possible implementation, the determining module 703 is configured to, if the first message authentication code and the third message authentication code are the same, accept the verification as the verification result corresponding to the target data frame; if the first message authentication code and the third message authentication code are different, accept the verification as the verification result corresponding to the target data frame and discard the target data frame.
[0141] In one possible implementation, the determining module 703 is configured to determine a fourth freshness value based on the third freshness value, the fourth freshness value being the highest P byte among the third freshness values, where P is a positive integer; and to determine at least one candidate freshness value based on the fourth freshness value and the first freshness value.
[0142] In one possible implementation, the candidate freshness value includes a first candidate freshness value, a second candidate freshness value, and a third candidate freshness value. The determining module 703 is used to perform a concatenation process on the fourth freshness value and the first freshness value to obtain the first candidate freshness value; to perform an incrementing process on the fourth freshness value, and then to perform a concatenation process on the incremented fourth freshness value and the first freshness value to obtain the second candidate freshness value; and to perform a decrementing process on the fourth freshness value, and then to perform a concatenation process on the decremented fourth freshness value and the first freshness value to obtain the third candidate freshness value.
[0143] In one possible implementation, the determining module 703 is used to determine at least one candidate message authentication code based on the candidate freshness value; and to perform verification processing based on the candidate message authentication code and the first message authentication code to determine the verification result corresponding to the target data frame.
[0144] In one possible implementation, the determining module 703 is used to determine the network performance of the receiving end, which is used to characterize the latency of receiving data; and based on the network performance of the receiving end, to determine the window size corresponding to the target sliding window.
[0145] It should be noted that the vehicle communication device provided in the above embodiments is only illustrated by the division of the above functional modules when controlling the vehicle. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the vehicle communication device and the vehicle communication method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0146] The technical solution provided in this application involves parsing the target data frame sent by the transmitting end to obtain a first message authentication code, a first freshness value, and bus data. Then, based on the first freshness value, a target sliding window is used to determine the reception result of the target data frame. This allows for the determination of the verification result corresponding to the target data frame based on the bus data, the first freshness value, and the first message authentication code, even if the reception result indicates that the target data frame needs to be received. The sliding window provides fault tolerance for received data, allowing reception even if the order of received data frames differs from their original sending order. This reduces the possibility of the receiving end accidentally discarding data. Simultaneously, it makes the data frame reception process flexible, avoiding processing blockages caused by message delays or network fluctuations, thus improving data processing efficiency. While ensuring secure communication, it enhances the accuracy, stability, and reliability of in-vehicle safety communication.
[0147] This application also provides a vehicle. Figure 8 This is a schematic diagram of the structure of a vehicle provided in an embodiment of this application.
[0148] Typically, vehicle 800 includes one or more processors 801 and one or more memories 802.
[0149] Processor 801 may include one or more processing cores, such as a quad-core processor, a penta-core processor, etc. Processor 801 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 801 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 801 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 801 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0150] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 802 are used to store at least one computer program, which is executed by the processor 801 to implement the vehicle communication method provided in the method embodiments of this application.
[0151] Those skilled in the art will understand that Figure 8 The structure shown does not constitute a limitation on vehicle 800 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0152] In addition, the device provided in the embodiments of this application may specifically be a chip, component or module. The chip may include a connected processor and a memory. The memory is used to store instructions. When the processor calls and executes the instructions, the chip can execute a vehicle communication method provided in the above embodiments.
[0153] This embodiment also provides a computer-readable storage medium storing computer program code. When the computer program code is run on a computer, the computer executes the aforementioned method steps to implement a vehicle communication method provided in the above embodiment.
[0154] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned related steps to implement a vehicle communication method provided in the above embodiment.
[0155] In this embodiment, the device, computer-readable storage medium, computer program product, or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0156] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0157] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0158] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A vehicle communication method, characterized in that, The method is applied at the receiving end, and the method includes: The target data frame sent by the sending end is obtained, and the target data frame is parsed to obtain the first message authentication code, the first freshness value and the bus data. The first message authentication code is the intercepted message authentication code. Based on the first freshness value, the reception result of the target data frame is determined through a target sliding window; If the received result indicates that the target data frame needs to be received, the verification result corresponding to the target data frame is determined based on the bus data, the first freshness value, and the first message authentication code.
2. The method according to claim 1, characterized in that, The step of determining the reception result of the target data frame through the target sliding window based on the first freshness value includes: If the first freshness value is within the target sliding window, the target data frame will be received as the receiving result. If the first freshness value is greater than the highest sequence number corresponding to the target sliding window, the target data frame will be received as the receiving result and the target sliding window will be slid. If the first freshness value is less than the lowest sequence number corresponding to the target sliding window, the target data frame will be discarded as the receiving result.
3. The method according to claim 1, characterized in that, The step of determining the verification result corresponding to the target data frame based on the bus data, the first freshness value, and the first message authentication code includes: Based on the first freshness value, a second freshness value is obtained. The first freshness value is a freshness value with a length of N bytes, and the second freshness value is a freshness value with a length of M bytes, where N is a positive integer and M is a positive integer greater than N. Based on the bus data, the second freshness value, and the first message authentication code, the verification result corresponding to the target data frame is determined.
4. The method according to claim 3, characterized in that, The step of determining the verification result corresponding to the target data frame based on the bus data, the first freshness value, and the first message authentication code includes: Obtain a third freshness value, which is the complete freshness value before truncation; If the values of the third freshness value and the first freshness value meet the threshold condition, a second message authentication code is obtained based on the second freshness value and the bus data. Verification processing is then performed based on the first message authentication code and the second message authentication code to determine the verification result corresponding to the target data frame. The second message authentication code is a complete message authentication code. If the value of the third freshness value and / or the value of the first freshness value do not meet the threshold condition, at least one candidate freshness value is determined, and the first message authentication code is verified based on the candidate freshness value to determine the verification result corresponding to the target data frame.
5. The method according to claim 4, characterized in that, The verification process based on the first message authentication code and the second message authentication code to determine the verification result corresponding to the target data frame includes: The second message authentication code is truncated to obtain the third message authentication code, which is the highest Q byte in the second message authentication code, where Q is a positive integer. Verification processing is performed based on the first message authentication code and the third message authentication code to determine the verification result corresponding to the target data frame.
6. The method according to claim 5, characterized in that, The verification process based on the first message authentication code and the third message authentication code to determine the verification result corresponding to the target data frame includes: If the first message authentication code and the third message authentication code are the same, the verification result will be passed and used as the verification result corresponding to the target data frame. If the first message authentication code and the third message authentication code are different, the verification failure will be taken as the verification result for the target data frame and the target data frame will be discarded.
7. The method according to claim 4, characterized in that, Determining at least one candidate freshness value includes: Based on the third freshness value, a fourth freshness value is determined, wherein the fourth freshness value is the highest P byte among the third freshness values, and P is a positive integer; Based on the fourth freshness value and the first freshness value, at least one candidate freshness value is determined.
8. The method according to claim 7, characterized in that, The candidate freshness values include a first candidate freshness value, a second candidate freshness value, and a third candidate freshness value. Determining at least one candidate freshness value based on the fourth freshness value and the first freshness value includes: The fourth freshness value and the first freshness value are concatenated to obtain the first candidate freshness value; The fourth freshness value is incremented, and the incremented fourth freshness value and the first freshness value are then concatenated to obtain the second candidate freshness value. The fourth freshness value is decremented, and then the decremented fourth freshness value and the first freshness value are concatenated to obtain the third candidate freshness value.
9. The method according to claim 4, characterized in that, The step of verifying the first message authentication code based on the candidate freshness value to determine the verification result corresponding to the target data frame includes: Based on the candidate freshness values, at least one candidate message authentication code is determined; Verification processing is performed based on the candidate message authentication code and the first message authentication code to determine the verification result corresponding to the target data frame.
10. The method according to any one of claims 1 to 9, characterized in that, The method further includes: Determine the network performance of the receiving end, whereby the network performance is used to characterize the latency of receiving data; Based on the network performance of the receiving end, the window size corresponding to the target sliding window is determined.
11. A vehicle, characterized in that, The vehicles include: Memory, used to store executable program code; A processor for calling and running the executable program code from the memory, causing the vehicle to perform the method as described in any one of claims 1 to 10.