Method, communication device and computer program product for secure communication
By generating a synthetic authentication code and transmitting the message to be transmitted and the authentication code separately, the problems of bandwidth waste and low efficiency of hardware security modules in in-vehicle communication are solved, and more efficient and reliable inter-ECU communication is achieved.
Patent Information
- Application Number
- CN202411173363.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-03-03
AI Technical Summary
In existing technologies, in-vehicle communication suffers from wasted bandwidth resources and low processing efficiency of hardware security modules, making it difficult to meet the demands of high-frequency communication, especially when there is frequent data exchange between ECUs, where performance bottlenecks are obvious.
By generating a synthetic authentication code for the sender and transmitting the message to be transmitted and the authentication code separately, the storage space for the authentication code for each message in the traditional communication protocol is freed up, improving frame utilization. Furthermore, by generating synthetic authentication codes in batches, the frequent calls to the hardware security module are reduced, thus improving computational efficiency.
It improves the efficiency and reliability of in-vehicle communication, optimizes bandwidth usage, reduces the processing burden on hardware security modules, and provides a more efficient secure communication solution between ECUs.
Smart Images

Figure CN121603236A_ABST
Abstract
Description
Technical Field
[0001] This application relates to a method for secure communication, and also to a communication device and a computer program product. Background Technology
[0002] With the increasing number of electronic control units (ECUs) in vehicles, the requirements for the reliability of in-vehicle communication are also increasing. Against this backdrop, the SecOC (Secure Onboard Communication) mechanism has emerged. As an information security component in the AUTOSAR architecture, the SecOC mechanism can generate and verify message authentication codes (MACs) for data transmitted on the bus, thereby effectively preventing data tampering and impersonation risks.
[0003] Currently, the common practice is to reserve a fixed amount of space in each CAN (Controller Area Network) frame to store the MAC address. However, this traditional transmission protocol has some significant problems. First, because each CAN frame needs to reserve space for the MAC address, this limits frame utilization and leads to wasted bandwidth resources. Second, existing hardware security modules (HSMs) have low processing efficiency and struggle to meet the demands of high-frequency communication. Especially when frequent data exchange is required between ECUs in the vehicle network, the inefficiency of the hardware security module becomes a bottleneck for system performance.
[0004] In this context, there is an expectation to provide an improved in-vehicle communication solution. Summary of the Invention
[0005] The purpose of this application is to provide a method for secure communication, a communication device, and a computer program product to at least solve some of the problems in the prior art.
[0006] According to a first aspect of this application, a method for secure communication is provided, the method comprising the following steps:
[0007] Step S1: Generate a sender composite authentication code based on multiple messages to be transmitted. The sender composite authentication code is used for the overall security verification of the multiple messages to be transmitted.
[0008] Step S2: Send multiple messages to be transmitted to the receiver as a first sending message, wherein the first sending message does not have any form of authentication code;
[0009] Step S3: The sender synthesizes the authentication code and sends it to the receiver as a second sending message. The second sending message is sent separately from the first sending message.
[0010] This application incorporates the following technical concept: by transmitting message portions and synthesizing authentication codes separately, the storage space reserved for each message authentication code in traditional communication protocols is freed up, improving frame utilization. Furthermore, by batch generating synthesized authentication codes or performing batch verification for multiple messages to be transmitted, frequent HSM calls are reduced, effectively decreasing cross-core communication requirements and improving overall computational efficiency. This design provides a more efficient and reliable solution for secure communication between ECUs.
[0011] In one exemplary embodiment, the method further includes the following steps:
[0012] Step S4: Receive another first transmission message, which includes multiple other messages to be transmitted and does not have any form of authentication code;
[0013] Step S5: Receive another second transmission message, the other second transmission message including another sender composite authentication code, the other sender composite authentication code is used for security verification of the whole composed of the plurality of other messages to be transmitted, wherein the other second transmission message and the other first transmission message are transmitted separately.
[0014] Step S6: Generate a receiver-synthesized authentication code from multiple other messages to be transmitted; and
[0015] Step S7: Perform security verification on the multiple additional messages to be transmitted based on the receiver's synthesized authentication code and another sender's synthesized authentication code.
[0016] According to a second aspect of this application, a communication device is provided, the communication device including a memory and a processor, the memory storing computer program instructions, which, when executed by the processor, enable the processor to perform the method according to the first aspect of the present invention.
[0017] According to a third aspect of this application, a communication device is provided, the communication device comprising:
[0018] The main processor is configured as follows:
[0019] • Generate a composite message based on multiple messages to be transmitted;
[0020] • Transmit the synthesized message to the hardware security module;
[0021] • Receive the synthesized authentication code from the sender from the hardware security module;
[0022] • Send multiple messages to be transmitted as a first message to the recipient, wherein the first message does not have any form of authentication code;
[0023] • The sender synthesizes the authentication code and sends it to the receiver in a second message, which is sent separately from the first message;
[0024] The hardware security module is configured as follows:
[0025] • Generate a sender-generated authentication code based on the synthesized message;
[0026] • Transmit the synthesized authentication code from the sender to the main processor.
[0027] In one exemplary embodiment, the main processor of the communication device is further configured to:
[0028] • Receive another first transmission message, which includes multiple other messages to be transmitted and does not have any form of authentication code;
[0029] • Receive another second transmission message, the other second transmission message including another sender composite authentication code, the other sender composite authentication code being used for security verification of the whole consisting of the plurality of other messages to be transmitted, wherein the other second transmission message and the other first transmission message are transmitted separately.
[0030] • Generate additional composite messages based on multiple other messages to be transmitted received;
[0031] • Transmit the additional composite message and the received additional sender's composite authentication code to the hardware security module;
[0032] The hardware security module is also configured to:
[0033] • Generate a receiver-generated authentication code based on another synthesized message;
[0034] • Securely verify the plurality of other messages to be transmitted based on the receiver's synthesized authentication code and another sender's synthesized authentication code.
[0035] According to a fourth aspect of this application, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described in the first aspect of this application. Attached Figure Description
[0036] The principles, features, and advantages of this application will be better understood below with reference to the accompanying drawings. The drawings include:
[0037] Figure 1 A flowchart illustrating a method for secure communication according to an exemplary embodiment of this application is shown;
[0038] Figure 2The flowchart of a method for secure communication according to another exemplary embodiment of this application is shown;
[0039] Figure 3 A flowchart of a method for secure communication according to another exemplary embodiment of this application is shown;
[0040] Figure 4 A flowchart of a method for secure communication according to another exemplary embodiment of this application is shown;
[0041] Figure 5 A flowchart of a method for secure communication according to another exemplary embodiment of this application is shown;
[0042] Figure 6 A data structure diagram of a first transmission message, a second transmission message, and a composite message according to an exemplary embodiment of this application is shown;
[0043] Figure 7 A schematic diagram of a communication device according to an exemplary embodiment of this application is shown;
[0044] Figure 8 A schematic diagram of a communication device according to another exemplary embodiment of this application is shown;
[0045] Figure 9 A schematic diagram of a communication system according to an exemplary embodiment of this application is shown. Detailed Implementation
[0046] To make the technical problems to be solved, the technical solutions, and the beneficial technical effects of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and several exemplary embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit the scope of protection of this application.
[0047] Figure 1 A flowchart illustrating a method for secure communication according to an exemplary embodiment of this application is shown. Figure 1 The main description focuses on the function of communication device 80 as the sender. To facilitate a more comprehensive description of the communication process, [further details are needed]. Figure 1 The diagram also shows a communication device 90 for the receiver, but the communication device 90 for the receiver does not necessarily participate actively in the execution of the method.
[0048] In step S0, multiple messages to be transmitted are acquired. For example, the sending communication device 80 can receive Authentic I-PDUs from the upper layer (i.e., the application software layer under the AUTOSAR layered architecture) and attach information to them to form messages to be transmitted. Authentic I-PDUs can also be referred to as data units that need to be protected; these include, for example, sensor data from the vehicle, control commands, or other information units that require secure transmission. The data structure of the messages to be transmitted may include, for example, the following parts: message ID, Authentic I-PDU, and Freshness Value (FV). The message ID may be, for example, a CAN-ID or an identifier defined in other ways, used to uniquely identify each message to be transmitted. The Freshness Value may be, for example, a monotonically increasing sequence or timestamp generated by a local counter of the communication device 80, used to prevent replay attacks.
[0049] In step S1, a sender composite authentication code is generated based on multiple messages to be transmitted. The sender composite authentication code is used for the overall security verification of the multiple messages to be transmitted.
[0050] For example, the sending communication device 80 serializes multiple collected messages to be transmitted—for example, arranging and concatenating them in a preset order to form a composite message. This order can be determined based on factors such as message type, priority, sending order, or the time order in which sensitive data units are received from the upper layer. Besides simple sorting and concatenation, the generation of a composite message may also involve other operations or calculations. For example, specific mathematical operations, logical combinations, or data transformations can be performed on multiple messages to be transmitted to ensure that the composite message meets specific security or communication standards. The composite message integrates all messages to be transmitted and serves as the necessary data foundation for security verification. Using the composite message, a composite authentication code is generated through an encryption algorithm and a key. This process is similar to the generation of a single message authentication code (MAC), but it applies to the composite message rather than a single message. This sender-generated composite authentication code is unique and closely related to the whole composed of all messages to be transmitted; it serves as the basis for authenticating whether multiple messages to be transmitted are secure and trustworthy.
[0051] Optionally, in step S1, an ID list can be generated based on multiple messages to be transmitted. This ID list includes the message ID corresponding to each message to be transmitted. The order in the ID list can be fixed or dynamically changing. This order determines the combination order of the messages to be transmitted when generating the synthetic authentication code. The number of IDs included can be preset or flexibly adjusted according to actual conditions to adapt to different communication needs and network conditions. Furthermore, if an ID list is generated, the generation of the sender's synthetic authentication code will strictly follow the order recorded in the ID list. This design ensures that the receiver can generate its own synthetic authentication code according to the same rules, thereby enabling the receiver to accurately verify each message.
[0052] In step S2, multiple messages to be transmitted are sent to receiver 90 as a first transmission message, which does not contain any form of authentication code. This indicates that the first transmission message does not include an individual authentication code for a single message to be transmitted, nor does it include a composite authentication code for multiple messages to be transmitted.
[0053] In one embodiment, the sending communication device 80 sends each message to be transmitted independently as a first transmission message. This means that each message to be transmitted is an independent transmission unit, sent sequentially from the sending party 80 to the receiving party 90. The transmission order of all first transmission messages can be predetermined or random. In another embodiment, the sending communication device 80 packages a series of messages to be transmitted into a single first transmission message and sends it. In yet another embodiment, the sending communication device 80 combines multiple messages to be transmitted into a single first transmission message and sends it.
[0054] The first message sent contains only the actual data to be transmitted, without the message authentication code. This design allows messages to be transmitted faster without carrying authentication information, improving communication efficiency. Furthermore, it eliminates the need to reserve space for the message authentication code in every message sent, improving frame utilization and allowing the system to use bandwidth more effectively.
[0055] In step S3, the sender synthesizes the authentication code and sends it to the receiver 90 as a second transmission message, which is sent separately from the first transmission message. The second transmission message does not include any of the messages to be transmitted, nor does it include the synthesized message generated from multiple messages to be transmitted.
[0056] In the context of this application, "sending separately" is understood as the second message being transmitted independently of the first message. This means they are physically separate, even if they may be close or consecutive in time. Sending separately also reduces the risk of authentication codes being tampered with.
[0057] In one embodiment, the sending times of the second message and the first message can be correlated. For example, the second message may be designed to be sent within a predetermined time interval after the first message. This agreed-upon time interval or sending order ensures that the first and second messages can still be correctly correlated and processed at the receiving end, even if the second message does not contain a directory or index of the messages to be transmitted.
[0058] In one embodiment, the sending time of the second message is not directly related to the sending time of the first message. This means that the second message can be sent at any time, unconstrained by the sending time of the first message. This allows the sending communication device 80 to decide when to send the second message based on network conditions or other factors. Typically, it is permissible to send the second message with a time lag after the first message. This allows the receiving party 90 to process the message to be transmitted without waiting for the synthesized authentication code, thereby reducing waiting time and improving overall communication efficiency.
[0059] In one embodiment, the second transmission message optionally includes an ID list. This ID list contains the message ID of each message to be transmitted in step S2. This indicates that the sender's synthesized authentication code and the ID list can be combined into the second transmission message. Similarly, the second transmission message optionally includes a freshness value to ensure the timeliness of the second transmission message and prevent replay attacks. In practical applications, the communication device 80 can, for example, flexibly adjust the content of the second transmission message according to network conditions and security requirements to determine whether to include the ID list and the freshness value.
[0060] In one embodiment, communication can be performed using either a traditional transmission protocol or a newly defined transmission protocol, depending on the data load in the current vehicular network. For example, when the data load on the vehicular network is low, or when the message to be transmitted has high requirements for timeliness and security, the communication device 80 can use a traditional transmission protocol. That is, it generates a separate Message Authentication Code (MAC) for each message to be sent, combines it with the message itself to form a third transmission message, and then sends it to the receiver. When the data load rate of the vehicular network is high, to improve transmission efficiency, a newly defined transmission protocol can be used, that is, the message itself to be transmitted and the composite MAC are sent separately. Thus, the most suitable transmission protocol can be selected under different circumstances, optimizing communication efficiency and bandwidth usage while ensuring security.
[0061] It should be noted that, although in Figure 1Step S2 is shown to be performed after step S1, but this order is merely exemplary. In practice, step S2 may also be performed before step S1, or steps S1 and S2 may be performed alternately or in parallel as needed.
[0062] Figure 2 A flow diagram of a method for secure communication according to another exemplary embodiment of this application is shown. In this embodiment, the communication device 80 is further shown as including a main processor 81 and a hardware security module 82, and thus the interaction process between the two is shown in more detail.
[0063] In step S0, multiple messages to be transmitted are acquired by the main processor 81 of the communication device 80. Specific operational details of this step are already provided in [the original text]. Figure 1 As described in the text, it will not be repeated here.
[0064] In step S11, the main processor 81 of the communication device 80 copies each message to be transmitted to the cache. In an optional step S12, the ID of each message to be transmitted can also be stored in the cache. For example, for each prepared message to be transmitted, the main processor 81 can be responsible for storing the message ID, sensitive data unit, and freshness value into the cache queue in sequence.
[0065] In step S21, after the message to be transmitted is copied to the buffer, the copied message is immediately sent with a first send message. Here, "send immediately" means that the transmission does not wait for the buffer list to fill up or the timer to expire, but is sent immediately after the copying is completed. This improves the real-time performance of system communication and reduces the delay in the use of related data at the receiving end caused by waiting for the generation of the synthetic authentication code.
[0066] In step S13, the main processor 81 of the communication device 80 checks whether the conditions for generating the sender's synthetic authentication code have been met.
[0067] In one embodiment, the main processor 81 may check in step S13 whether the number of cached messages to be transmitted has reached a preset threshold. If the preset threshold has been reached, further collection of messages to be transmitted may be stopped in step S14, and a composite message may be generated using all cached messages to be transmitted. If it is determined in step S13 that the number of messages in the cache queue has not reached the preset threshold, the process returns to step S11 to continue collecting messages to be transmitted until the required number is reached. This number may be preset or adjusted according to actual usage.
[0068] In another embodiment, the main processor 81 may also check in step S13 whether the sender timer has expired. If the sender timer has not expired, the process returns to the previous step S11 to continue copying the messages to be transmitted to the cache. If the sender timer has expired, the collection of messages to be transmitted is stopped in step S14, and a composite message is generated using all the cached messages to be transmitted.
[0069] This operation provides flexibility, allowing the system to decide when to generate a synthetic authentication code based on the number of messages or time conditions, thereby optimizing communication efficiency and response time.
[0070] Optionally, the sender timer used can be, for example, a periodic timer. This periodic timer has a timing start point and a preset timing period independent of external events. This means that the start and end of each timing period are based on its own internal cycle. Periodic timers do not need to be synchronized with external events, thus reducing the complexity of system synchronization and the requirements for synchronization accuracy. Furthermore, the use of periodic timers simplifies system design because no additional control logic is needed to handle event-based triggering conditions.
[0071] Optionally, the sender timer used can also be started in response to the collection of messages to be transmitted for generating the sender synthetic authentication code, and has a timing length related to the characteristics of the message to be transmitted. For example, whenever a message to be transmitted is copied to the buffer queue, the corresponding sender timer is started. The timing length of each sender timer can be determined according to the urgency of the message to be transmitted. This means that different messages to be transmitted may correspond to different timing lengths, thus allowing the system to dynamically schedule the generation of synthetic authentication codes according to the actual characteristics of the messages to be transmitted. Among all sender timers, the expiration of the earliest expiring sender timer will trigger the generation of the sender synthetic authentication code. This ensures that the generation of the sender synthetic authentication code is associated with the most urgent message to be transmitted. Through this design, the communication device 80 can flexibly handle messages of different urgency levels while ensuring security, achieving efficient and reliable data transmission.
[0072] For example, for the first message to be transmitted with lower urgency, the main processor 81 starts a sender timer for 15 milliseconds (ms). For the second message to be transmitted with higher urgency, the main processor 81 starts a sender timer for 10 milliseconds (ms). Although the second message has a shorter timer, if it enters the buffer queue only 5 milliseconds before the first message's timer expires, then the second message's timer will not be a determining factor in triggering the generation time of the synthetic authentication code. This indicates that even with a shorter timer, the system will still wait for the earliest of all started timers to expire to ensure that the authentication code can cover all buffered messages to be transmitted.
[0073] Optionally, the timing length of the sender's timer can also be dynamically adjusted according to actual network conditions and communication needs.
[0074] In step S15, the main processor 81 of the communication device 80 transmits the synthesized message generated in step S14 to the hardware security module 82 of the communication device 80.
[0075] In step S16, the hardware security module 82 calculates the sender's synthetic authentication code based on the received synthetic message. This step ensures that the hardware security module 82 can generate authentication codes in batches for sets of multiple messages to be transmitted, improving the processing efficiency of the hardware security module 82. Furthermore, this operation reduces the number of calls to the hardware security module 82, and since the hardware security module 82 typically has its own independent processor core, this also reduces the need for cross-core communication with the main processor 81.
[0076] In step S17, the generated sender composite authentication code is returned to the main processor 81 via the hardware security module 82 of the communication device 80. Finally, in step S31, the main processor 81 combines the sender composite authentication code with the (optional) ID list to form a second transmission message and sends it to the receiver 90.
[0077] It should be noted that, although in Figure 2 In the illustrated embodiment, the main processor first generates a composite message of multiple messages to be transmitted, and then the hardware security module generates a sender authentication code based on the composite message. However, it is also possible that the main processor sends multiple messages to be transmitted to the hardware security module at once or one by one, and the hardware security module performs a merging operation on the multiple messages to be transmitted, and generates a composite authentication code based on this.
[0078] Figure 3 A flowchart illustrating a method for secure communication according to another exemplary embodiment of this application is shown. Figure 3 middle, Figure 1The method shown also includes additional steps S4 to S7, and can also be performed using the communication device 80. Figure 3 The text primarily describes the function of the communication device 80 as a receiver.
[0079] It should be noted that steps S4 to S7 are sequentially numbered with steps S1 to S3 for ease of description, but they are actually independent of steps S1 to S3. In practice, steps S4 to S7 can be executed simultaneously with steps S1 to S3, alternately with them, or before or after them.
[0080] It should be noted that Figure 3 The method for secure communication shown is performed, for example, by communication device 80. To facilitate a more comprehensive description of the communication process, in... Figure 3 The diagram also shows a communication device 60 as the sender, but the communication device 60 as the sender does not necessarily participate actively in the execution of the method.
[0081] In step S4, the receiving communication device 80 receives another first transmission message, which includes multiple other messages to be transmitted and does not have any form of authentication code.
[0082] In one embodiment, the receiving communication device 80 can independently receive multiple additional first transmission messages, each of which includes one of multiple additional messages to be transmitted. The order in which the multiple additional first transmission messages arrive at the receiving communication device 80 can be predetermined or unordered. This means that the arrival order of the additional first transmission messages can be the same as or different from their transmission order at the sender 60 (this may be due to network latency, transmission strategies, or other factors). In some cases, the receiving communication device 80 needs to reorder the messages according to the content of each additional message to be transmitted (e.g., timestamp, sequence number, additional message ID, or other identifier) to ensure that they are processed in the correct order in subsequent steps. In some cases, if the generation of the authentication code by the additional sender does not depend on the order of the messages, or if the system has already defaulted to the processing logic, then the receiving communication device 80 does not need to reassemble the received additional messages to be transmitted.
[0083] In another embodiment, the receiving communication device 80 may also receive a single additional first transmission message, which includes an additional composite message generated from a plurality of additional messages to be transmitted.
[0084] In step S5, the receiving communication device 80 receives an additional second transmission message, which includes an additional sender composite authentication code used for security verification of the overall structure of multiple additional messages to be transmitted. This additional second transmission message is transmitted separately from the additional first transmission message by the sending communication device 60 to the receiving communication device 80.
[0085] Optionally, the additional second transmission message may also include an additional list of IDs, which includes additional message IDs corresponding to each additional message to be transmitted. The additional sender-synthesized authentication code in the additional second transmission message is generated, for example, in the sender's communication device 60 according to the order recorded in the additional ID list.
[0086] In step S6, a receiver-generated authentication code is generated from multiple additional messages to be transmitted.
[0087] If the second transmitted message also includes a separate list of IDs, the communication device 80 needs to generate a receiver composite authentication code according to the order recorded in the separate list of IDs to ensure correspondence with the separate sender composite authentication code. To this end, the receiver's communication device 80 can first select additional messages to be transmitted from the received first transmitted message based on the separate list of IDs. These additional messages to be transmitted are associated with the received separate sender composite authentication codes and thus serve as the basis for the receiver's security verification. Then, the receiver's communication device 80 generates a receiver composite authentication code based on the selected additional messages to be transmitted, according to the order recorded in the separate list of IDs.
[0088] For example, the receiver's communication device 80 serializes (sorts and concatenates) multiple collected additional messages to be transmitted in a preset order to form another composite message. Using this composite message, a receiver-generated authentication code can be generated through an encryption algorithm and a key. This process is similar to the sender's generation of the composite authentication code; for details, please refer to the above description. Figure 1 The description.
[0089] Alternatively, if there is no specific list of IDs to guide the message order, the receiver's communication device 80 can generate a receiver synthetic authentication code according to a standard operating procedure. This may include using a fixed algorithm or method to process the messages.
[0090] In step S7, the receiving communication device 80 performs security verification on multiple additional messages to be transmitted based on the receiver's composite authentication code and another sender's composite authentication code. This can be achieved, for example, by comparing the two composite authentication codes. This security verification mechanism effectively prevents unauthorized tampering with the additional messages to be transmitted, because any minor alteration to the messages will result in a mismatch in the authentication codes. Optionally, if it is determined in step S7 that the security verification of multiple additional messages to be transmitted fails, this security event can be reported to an upper layer.
[0091] Figure 4 A flowchart illustrating a method for secure communication according to another exemplary embodiment of this application is shown. In this embodiment, the receiver's communication device 80 is further shown as including a main processor 81 and a hardware security module 82, and thus the interaction process between the two is shown in more detail.
[0092] In step S41, the main processor 81 of the receiving communication device 80 receives another first transmission message. The specific operation and details of this step have already been described. Figure 3 As described in the text, it will not be repeated here.
[0093] In step S42, the main processor 81 buffers the additional messages to be transmitted included in the additional first transmission message.
[0094] In step S43, the main processor 81 classifies the received additional messages to be transmitted to determine whether the additional messages to be transmitted are non-blocking messages or blocking messages.
[0095] If another message to be transmitted involves a non-blocking message, the main processor 81 directly provides the other message to the upper layer in step S44, and performs security verification on it later based on the authentication code synthesized from the received other sender. Generally, non-blocking messages correspond to messages with lower security levels, and these messages usually have high timeliness requirements (e.g., navigation update information, traffic information, etc.). Upper-layer applications can use these messages immediately, and security verification is performed synchronously in the background. If verification fails, the system can take certain measures, such as warning the driver or revoking the applied control commands.
[0096] If another message to be transmitted involves a blocking message, the main processor 81 temporarily blocks the upper layer from using the other message in step S45 until it passes security verification in a subsequent step. This type of message corresponds to messages with a high security level (such as vehicle control data). Using such messages directly without verification could lead to security risks. Therefore, the main processor 81 blocks this data and only releases it to the upper-layer application after security verification is completed.
[0097] This message security level-based classification and processing mechanism optimizes data processing flow and response time while ensuring security, providing a more reliable and efficient communication solution.
[0098] In step S5, the main processor 81 of the communication device 80 receives another second transmission message. It can be seen that the second transmission message is received later than the first transmission message. However, because the design of non-blocking messages allows them to be used before security verification is completed, the delay in receiving the second transmission message has a relatively small impact on non-blocking messages.
[0099] In step S61, the main processor 81 of the communication device 80 extracts and serializes multiple additional messages to be transmitted from the cache queue based on the additional ID list in the additional second transmission message to form a composite message. For example, each additional message ID, additional sensitive data unit, and additional freshness value to be transmitted can be sequentially concatenated to ultimately form another composite message.
[0100] Next, in step S62, the main processor 81 of the communication device 80 transmits the additional composite message and the received additional sender composite authentication code to the hardware security module 82.
[0101] In step S71, the hardware security module 82 calculates the receiver's composite authentication code based on the other composite message. Next, in step S72, the hardware security module 82 compares the other sender's composite authentication code with the receiver's composite authentication code and determines if they match. If they do not match, in step S73, a security verification failure result is returned to the main processor 81. If the other sender's composite authentication code matches the receiver's composite authentication code, in step S74, a security verification success result is returned to the main processor 81.
[0102] In step S75, the main processor 81 takes appropriate action based on the security verification result. For example, if the security verification passes, the main processor 81 retrieves the blocking message from the cache queue and passes it to other components or upper layers for use. Additionally, the main processor 81 may report the security verification result to the upper layer. Exemplarily, if the security verification fails, the main processor 81 reports this security event to the upper layer. Optionally, for non-blocking messages that have already been used, the main processor 81 may also additionally report the successful security verification result to the upper layer so that the upper-layer application can take appropriate follow-up actions.
[0103] Figure 5 A flowchart of a method for secure communication according to another exemplary embodiment of this application is shown.
[0104] contrast Figure 3 The method shown, Figure 5 The method shown further includes an additional step S410 after step S4. In additional step S410, a receiver timer is started in response to the receipt of another message to be transmitted. This receiver timer allows for continuous monitoring to check if the receiver timer has timed out.
[0105] In one embodiment, for example, at least one receiver timer may be started in response to the receipt of each additional message to be transmitted, the duration of which is determined by the urgency of the additional message to be transmitted. Higher urgency results in a shorter duration. For each additional message to be transmitted received, the corresponding receiver timer is monitored independently to check for timeouts. Optionally, if a message with the same ID arrives, the timer is not reset to avoid unnecessary duplication of time.
[0106] Specifically, Figure 5 The method also includes an additional step S510, in which it is checked whether another synthesized authentication code from the sender has been received before the receiver's timer expires. If not, the receiver's timer is determined to have timed out. This check is shown to be performed after the second transmission message is received (i.e., after step S5). The receiver's timer can, for example, calculate the time difference between receiving the second transmission message and receiving the first transmission message, and determine whether the time difference is greater than a preset time threshold. If it is greater, it indicates a timeout. If a timeout is determined, the timeout event is reported to the upper layer in step S720, and the subsequent security verification process is terminated, while preventing the provision of other messages to be transmitted to the upper layer. If a timeout is determined, the subsequent security verification process can continue and the relevant timer is reset (cleared). In embodiments not shown, the additional step S510 may also be performed before or in parallel with step S5.
[0107] in addition, Figure 5 The method also includes an additional step S710, in which it is checked whether security verification of multiple additional messages to be transmitted has been completed before the receiver's timer expires. If not, the receiver's timer is determined to have timed out. If a timeout is determined, the timeout event is reported to the upper layer in additional step S720, and the provision of additional messages to be transmitted to the upper layer is prevented. If a timeout is determined, the relevant timer is reset (cleared) in step S730 to prepare for providing timing services in the next security verification cycle. This additional step is shown to be performed after step S7, but this check can also be performed before step S7 or S6, or in parallel with step S6 or S7.
[0108] exist Figure 5In the secure communication method shown, the two independent timeout checks are based on two different receiver timers. Although these two timers start at the same time, they may have different durations to accommodate different needs in the secure communication process. The first timer involved in step S510 may have a shorter duration, its purpose being to check whether the other sender's synthetic authentication code has been received within the specified period. This helps ensure the timeliness and authenticity of the data. Compared to the first timer involved in step S510, the second timer involved in step S710 generally has a longer duration, its purpose being to check whether the secure verification of multiple other messages to be transmitted has been successfully completed within the specified period. This helps ensure the high efficiency of the system processing process. If either timer times out, a timeout event can be reported to the upper layer in additional step S720, and the secure verification process can be terminated as appropriate, while preventing the other messages to be transmitted from being provided to the upper layer. Depending on the application scenario, the two timers can run in parallel, simultaneously monitoring the reception of the authentication code and the completion of the secure verification process; or they can be executed sequentially, first monitoring the expiration of the timer for receiving the synthetic authentication code, and then setting the timeout for secure verification based on it. In practical applications, the required type and number of timers can be selected and set according to actual needs.
[0109] Furthermore, if a different receiver timer is set for each additional message to be transmitted, then in steps S510 and S710 above, the timer timeout status needs to be monitored independently for each additional message to be transmitted. For example, if the receiver timer corresponding to any additional message to be transmitted times out, the communication device 80 will report a timeout event and may interrupt the subsequent security verification process of all additional messages to be transmitted to ensure that data security is not compromised. Depending on actual needs, the communication device 80 may also take corresponding measures only when a certain number of timers time out; for example, when a threshold number of timeouts occurs, a specific security policy or error recovery process will be executed. By independently monitoring the timer of each additional message to be transmitted, the communication device 80 can allocate resources more effectively and avoid the timeout of a single message affecting the processing of other messages.
[0110] Figure 6 A data structure diagram of a first sending message, a second sending message, and a composite message according to an exemplary embodiment of this application is shown.
[0111] exist Figure 6The image shows three first-transmission messages 100, 110, and 120, each containing a message to be transmitted 11, 12, and 13, respectively. Each message to be transmitted 11, 12, and 13 consists of a message ID, a sensitive data unit, and a freshness value. Other field descriptions for the first-transmission messages 110, 120, and 130 are omitted here; however, it is understood that these messages may also include other fields not listed here. Figure 6 The CAN protocol fields are detailed in the documentation, such as the CRC field and the end-of-frame flag. The message ID, for example, is used to uniquely identify the message to be transmitted; it may also contain basic information such as the source and destination addresses. The freshness value ensures the timeliness and orderliness of the messages. Sensitive data units include critical data content that needs to be transmitted confidentially or securely, and are stored in the fixed-length payload field of the first transmitted messages 100, 110, and 120.
[0112] The second message 200 includes a sender-synthesized authentication code (MAC), which is calculated based on multiple messages 11, 12, and 13 to be transmitted, and is used to verify the integrity and origin of these messages 11, 12, and 13 as a whole. The second message 200 also carries an ID list containing the message IDs of all messages to be transmitted that participated in the calculation of the MAC.
[0113] exist Figure 6 The diagram also shows a composite message 30 generated from multiple messages 11, 12, and 13 to be transmitted. Exemplarily, these messages 11, 12, and 13 are combined in a specific order to form a continuous data sequence.
[0114] Figure 7 A schematic diagram of a communication device 70 according to an exemplary embodiment of this application is shown.
[0115] In a vehicle-wide distributed communication architecture, the communication device 70 can be implemented as, for example, an electronic control unit. Alternatively, the communication device 70 can also be implemented as a domain controller or a gateway. The communication device 70 can function as both a sender and a receiver, or it can perform both functions simultaneously.
[0116] like Figure 7 As shown, the communication device 70 includes a processor 71 and a memory 72. The memory 72 stores computer program instructions. When the computer program instructions are executed by the processor, the processor 71 can, for example, execute... Figures 1 to 5The method shown is for secure communication. The computer program instructions may be stored in a computer-readable storage medium. The computer-readable storage medium may include, for example, high-speed random access memory, and may also include non-volatile memory such as hard disks, RAM, plug-in hard disks, smart memory cards, secure digital cards, flash memory cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices. The processor 71 may be a central processing unit, or it may be other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0117] Figure 8 A schematic diagram of a communication device according to another exemplary embodiment of this application is shown, which may be used, for example, by a sender.
[0118] like Figure 8 As shown, the communication device 80 includes, for example, a main processor 81 and a hardware security module 82. The main processor 81 and the hardware security module 82 are interconnected via one or more lines for data exchange; these connections can be serial or parallel, point-to-point, or implemented via a bus. In this embodiment, the main processor 81 and the hardware security module 82 may each include different processor cores. The main processor 81 and the hardware security module 82 may be arranged on the same printed circuit board (PCB), which is physically packaged, for example, to form a domain controller.
[0119] The main processor 81 is primarily responsible for exchanging data with upper-layer applications and the bus, and preparing messages for transmission. The hardware security module 82 is responsible for securely storing and managing keys, and provides data encryption, decryption, signing, and verification functions. In this embodiment, the hardware security module 82 is mainly used to generate and verify synthetic authentication codes.
[0120] Specifically, the main processor 81 receives sensitive data units from the upper layer. These sensitive data units may contain various types of information, such as sensor data, traffic information, or vehicle control information. Next, the main processor 81 processes these sensitive data units to prepare a message to be transmitted for security verification. For example, the main processor 81 can assign a freshness value and a message ID to each sensitive data unit to construct the message to be transmitted. Then, multiple messages to be transmitted are serialized (concatenated in a certain order) to generate a composite message, which is then transmitted to the hardware security module 82. Furthermore, the main processor 81 also sends multiple messages to be transmitted as first transmission messages to the receiver; these first transmission messages themselves do not contain any message authentication codes. Finally, the main processor 81 receives the composite authentication code from the hardware security module 82 and sends it to the receiver as a second transmission message, independent of the messages to be transmitted themselves.
[0121] The hardware security module 82 is configured to perform the following operations: it generates a sender synthetic authentication code based on the synthetic message received from the main processor 81, and transmits the sender synthetic authentication code back to the main processor 81.
[0122] In another embodiment, the main processor 81 may also be configured to perform the following operations: receiving independently transmitted additional first transmission messages and additional second transmission messages. The additional first transmission message carries the additional messages to be transmitted themselves, but does not include authentication codes for these messages. The second transmission message includes an additional sender-synthesized authentication code for the entire set of multiple additional messages to be transmitted. The main processor 81 also generates additional synthesized messages based on the received additional messages to be transmitted, and transmits the additional synthesized messages together with the received additional sender-synthesized authentication codes to the hardware security module 82.
[0123] In another embodiment, the hardware security module 82 may also be configured to perform the following operations: it is responsible for generating a receiver synthetic authentication code based on additional synthetic messages received from the main processor 81. The generated receiver synthetic authentication code and the received additional sender synthetic authentication code are used to perform security verification on a plurality of additional messages to be transmitted.
[0124] For specific details, please refer to the above text. Figures 1 to 5 The description will not be repeated here.
[0125] Figure 9 A schematic diagram of a communication system 1 according to an exemplary embodiment of this application is shown.
[0126] The communication system 1 is exemplarily shown as a communication system in the electrical and electronic (E / E) architecture of a modern automobile, and includes, as Figure 8 The communication device 80 is shown. In a more complex implementation, the communication system 1 may also include a gateway (GW), a domain controller (DCU), an electronic control unit (ECU), and a CAN bus. For example, the communication system 1 may be functionally divided into multiple domains (e.g., powertrain domain, chassis domain, body domain, cockpit domain, and autonomous driving domain), each domain including at least one domain controller responsible for managing multiple ECUs connected to the CAN bus and isolating the CAN domains. All these domain controllers communicate across domains via the gateway. The communication system may also include other devices, such as repeaters.
[0127] exist Figure 9 In this application, although the communication device 80 is exemplarily implemented as an ECU, the present application is not limited thereto. In practice, the communication device 80 may also be implemented as a domain controller or a gateway. The present application does not specifically limit the number and type of communication devices included in the communication system 1.
[0128] It is understood that the methods of the various embodiments of this disclosure can be implemented by computer programs / software. This software can be loaded into the processor's working memory and, when run, is used to execute the methods according to the various embodiments of this disclosure.
[0129] According to another embodiment of this disclosure, a computer program product having a computer program configured to perform methods according to embodiments of this disclosure when the computer program product is run on a computer or stored on a computer-readable storage medium (such as a CD-ROM). The machine-readable storage medium is, for example, an optical storage medium or a solid-state medium supplied together with or as part of other hardware.
[0130] Although specific embodiments of this application are described in detail herein, they are given for illustrative purposes only and should not be construed as limiting the scope of this application. Various substitutions, modifications, and alterations can be conceived without departing from the spirit and scope of this application.
Claims
1. A method for secure communication, the method comprising the following steps: Step S1: Generate a sender composite authentication code based on multiple messages to be transmitted (11, 12, 13), the sender composite authentication code being used for the overall security verification of the multiple messages to be transmitted (11, 12, 13). Step S2: Send multiple messages to be transmitted (11, 12, 13) to the receiver as a first sending message (110, 120, 130), wherein the first sending message (110, 120, 130) does not have any form of authentication code; Step S3: The sender synthesizes the authentication code and sends it to the receiver as a second sending message (200). The second sending message (200) is sent separately from the first sending message (110, 120, 130).
2. The method according to claim 1, wherein, Step S1 includes: generating an ID list based on multiple messages to be transmitted (11, 12, 13), the ID list including the message ID of each message to be transmitted (11, 12, 13), and generating the sender's synthetic authentication code based on the multiple messages to be transmitted (11, 12, 13) according to the order of the message IDs recorded in the ID list; Step S3 includes: combining the sender's synthetic authentication code and ID list into a second sending message (200), and sending the second sending message (200) to the receiver.
3. The method according to claim 1 or 2, wherein, The method includes the following steps: The main processor (81) of the communication device (80) generates a composite message based on multiple messages to be transmitted (11, 12, 13), and in particular, the message ID, sensitive data unit and freshness value of each message to be transmitted (11, 12, 13) are sequentially concatenated to form a composite message. The main processor (81) of the communication device (80) transmits the composite message to the hardware security module (82) of the communication device (80). The main processor (81) and the hardware security module (82) have different processor cores. The hardware security module (82) of the communication device (80) calculates the sender's synthetic authentication code based on the synthetic message.
4. The method according to any one of claims 1 to 3, wherein, In step S2: Multiple first transmission messages (110, 120, 130) are sent independently, each first transmission message (110, 120, 130) including one of multiple messages to be transmitted (11, 12, 13); or, a single first transmission message (110, 120, 130) is sent, the single first transmission message (110, 120, 130) including a composite message generated from the multiple messages to be transmitted (11, 12, 13). In step S3: The second transmission message (200) is transmitted in time after the first transmission message (110, 120, 130).
5. The method according to any one of claims 1 to 4, wherein, Step S1 includes: copying each message to be transmitted (11, 12, 13) to the cache; when the number of cached messages to be transmitted (11, 12, 13) reaches a preset threshold, stopping the copying and using all cached messages to be transmitted (11, 12, 13) to generate a sender synthetic authentication code. Step S2 includes: immediately after the messages to be transmitted (11, 12, 13) are copied to the buffer, the copied messages to be transmitted (11, 12, 13) are sent with a first sending message (110, 120, 130).
6. The method according to any one of claims 1 to 5, wherein, In step S1, the time point for generating the sender's synthetic authentication code is determined using the sender's timer, wherein: The message to be transmitted (11, 12, 13) is continuously copied to the buffer before the sender's timer expires; When the sender's timer expires, stop collecting messages to be transmitted (11, 12, 13) and use all cached messages to be transmitted (11, 12, 13) to generate a sender synthetic authentication code.
7. The method according to claim 6, wherein, The sender's timer is a periodic timer, which has a timing start point and a preset timing period independent of external events; or The sender timer is started in response to the collection of messages (11, 12, 13) to be transmitted for generating the sender synthetic authentication code, and has a timing length associated with the messages (11, 12, 13) to be transmitted.
8. The method according to claim 6, wherein, In response to the collection of each message to be transmitted (11, 12, 13), the corresponding sender timer is started. The duration of the sender timer is determined by the urgency of the message to be transmitted (11, 12, 13). When the earliest sender timer among all sender timers expires, a sender synthetic authentication code is generated.
9. The method according to any one of claims 1 to 8, wherein, The method includes the following steps: Step S4: Receive another first transmission message, which includes multiple other messages to be transmitted and does not have any form of authentication code; Step S5: Receive another second transmission message, the other second transmission message including another sender composite authentication code, the other sender composite authentication code is used for security verification of the whole composed of the plurality of other messages to be transmitted, wherein the other second transmission message and the other first transmission message are transmitted separately. Step S6: Generate a receiver-synthesized authentication code from multiple other messages to be transmitted; and Step S7: Perform security verification on the multiple additional messages to be transmitted based on the receiver's synthesized authentication code and another sender's synthesized authentication code.
10. The method according to claim 9, wherein, The additional second message to be sent also includes an additional list of IDs, which includes additional message IDs for each additional message to be transmitted. Step S6 includes: Based on the additional ID list, the following additional messages to be transmitted are selected from the additional first sent messages received: these additional messages to be transmitted are associated with the additional sender-generated authentication codes received. The receiver's composite authentication code is generated based on the selected multiple additional messages to be transmitted, according to the order of the additional message IDs recorded in the additional ID list.
11. The method according to claim 9 or 10, wherein, The method further includes the following steps: The main processor (81) of the communication device (80) generates additional composite messages based on multiple additional messages to be transmitted. In particular, it sequentially concatenates the additional message ID, additional sensitive data unit and additional freshness value of each additional message to be transmitted to form additional composite messages. The main processor (81) of the communication device (80) transmits the additional composite messages and the received additional sender composite authentication codes to the hardware security module (82). The main processor (81) and the hardware security module (82) have different processor cores. The hardware security module (82) of the communication device (80) calculates the receiver's composite authentication code based on the other composite message, compares the other sender's composite authentication code with the receiver's composite authentication code, and if the other sender's composite authentication code is inconsistent with the receiver's composite authentication code, the security verification fails; if the other sender's composite authentication code is consistent with the receiver's composite authentication code, the security verification passes.
12. The method according to any one of claims 8 to 11, wherein, The method further includes the following steps: After receiving another first transmission message, the other messages to be transmitted included in the other first transmission message are buffered; After receiving another second transmission message, the cached multiple other messages to be transmitted are securely verified based on the other sender's synthesized authentication code contained in the other second transmission message.
13. The method according to any one of claims 8 to 12, wherein, The method further includes the following steps: The received additional messages to be transmitted are classified into non-blocking messages and blocking messages, wherein: If another message to be transmitted involves non-blocking messages, then that other message to be transmitted is directly provided to the upper layer for use, and at a later time, a combined authentication code based on the received other sender is used to perform security verification on the other message to be transmitted involving non-blocking messages; and If another message to be transmitted involves a blocking message, the upper layer is temporarily prevented from using the other message to be transmitted involving the blocking message until the security verification is passed, at which point the other message to be transmitted involving the blocking message will be provided to the upper layer for use.
14. The method according to any one of claims 8 to 13, wherein, The method further includes the following steps: In response to receiving another message to be transmitted, a receiver timer is started, and the receiver timer is continuously checked for timeout. If the receiver timer is determined to have timed out, a timeout event is reported to the upper layer; and / or If it is determined in step S7 that the security verification of multiple other messages to be transmitted fails, a security event is reported to the upper layer.
15. The method according to claim 14, wherein, Determine if the receiver's timer has timed out using the following method: Check if another synthesized authentication code from the sender is received before the receiver's timer expires; if not, determine that the receiver's timer has timed out; and / or Check whether security verification of multiple additional messages to be transmitted has been completed before the receiver's timer expires; if not, determine that the receiver's timer has expired.
16. The method according to claim 14 or 15, wherein, In response to receiving each message to be transmitted, at least one receiver timer corresponding to it is started. The duration of the receiver timer is determined by the urgency of the other messages to be transmitted. The receiver timer corresponding to each other message to be transmitted is monitored independently to see if it times out.
17. A communication device (70) comprising a memory (72) and a processor (71), the memory (72) storing computer program instructions which, when executed by the processor (71), enable the processor (71) to perform the method according to any one of claims 1 to 16.
18. A communication device (80), the communication device (80) comprising: The main processor (81) is configured as follows: • Generate a composite message based on multiple messages to be transmitted (11, 12, 13); • Transmit the synthesized message to the hardware security module (82); • Receive the synthesized authentication code from the sender from the hardware security module (82); • Send multiple messages to be transmitted (11, 12, 13) to the receiver as a first sending message (110, 120, 130), wherein the first sending message (110, 120, 130) does not have any form of authentication code; • The sender synthesizes the authentication code and sends it to the receiver as a second sending message (200), which is sent separately from the first sending message (110, 120, 130); Hardware security module (82), which is configured as follows: • Generate a sender-generated authentication code based on the synthesized message; • Transmit the synthesized authentication code from the sender to the main processor (81).
19. The communication device (80) according to claim 18, The main processor (81) is also configured to: • Receive another first transmission message, which includes multiple other messages to be transmitted and does not have any form of authentication code; • Receive another second transmission message, the second transmission message including another sender-synthesized authentication code, the other sender-synthesized authentication code being used for security verification of the whole consisting of the plurality of other messages to be transmitted, wherein, The additional second message is transmitted separately from the additional first message; • Generate additional composite messages based on multiple other messages to be transmitted received; • Transmit the additional composite message and the received additional sender composite authentication code to the hardware security module (82); The hardware security module (82) is also configured to: • Generate a receiver-generated authentication code based on another synthesized message; • Securely verify the plurality of other messages to be transmitted based on the receiver's synthesized authentication code and another sender's synthesized authentication code.
20. The communication device (80) according to claim 18 or 19, wherein the communication device (80) is a domain controller, an electronic control unit, or a gateway.
21. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 16.