Vehicle-mounted message safety communication method, system, equipment and medium

By using session keys and encryption algorithms to process messages in in-vehicle SOME/IP communications, security risks in in-vehicle communications are solved and secure transmission and integrity protection of data are achieved.

CN118764289APending Publication Date: 2024-10-11HUIZHOU DESAY SV INTELLIGENT TRANSPORTATION TECH INST CO LTD

Patent Information

Application Number
CN202410999629.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

In-vehicle SOME/IP communication lacks a security protection mechanism, and there are risks of information leakage, tampering, identity spoofing and replay attacks, resulting in serious security risks.

Method used

By establishing a session key between the sending node and the receiving node, the SOME/IP message is encrypted according to the preset encryption algorithm and message security level, the target transmission message is generated, and the receiving node performs authentication and decryption to ensure data secure transmission.

Benefits of technology

Significantly improves the security protection of in-vehicle SOME/IP communications, preventing information leakage, tampering and replay attacks, and ensuring data integrity and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764289A_ABST
    Figure CN118764289A_ABST
Patent Text Reader

Abstract

The invention discloses a vehicle-mounted message safety communication method, system and device and a medium. The method comprises the following steps: sending a session establishment request message to a receiving node, and in response to a session establishment response message transmitted by the receiving node, checking the session establishment response message and decrypting a session key by using a private key; obtaining an SOME / IP message to be transmitted; a corresponding message security level is pre-configured for the SOME / IP message to be transmitted; and encrypting the SOME / IP message to be transmitted according to the session key, the message security level and a preset encryption algorithm to obtain a target transmission message. According to the embodiment of the invention, the corresponding message security level is configured for the to-be-transmitted SOME / IP message, the to-be-transmitted SOME / IP message is encrypted according to the session key, the message security level and the preset encryption algorithm to obtain the target transmission message, and the target transmission message is transmitted, so that the problem of security risk of vehicle-mounted SOME / IP communication can be solved; the security communication protection between the sending node and the receiving node is greatly improved, and the security communication of the vehicle-mounted SOME / IP is realized under the condition of ensuring the data integrity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of vehicle-mounted communication technology, and in particular to a vehicle-mounted message secure communication method, system, equipment and medium. Background Art

[0002] With the rapid development of intelligent connected vehicles, intelligent connected vehicles are developing towards automation and networking. More and more sensors are installed in vehicles, and the amount of data that needs to be transmitted in the car has increased significantly. In order to meet the transmission requirements of large amounts of data, in-vehicle Ethernet is introduced into the in-vehicle communication network. SOME / IP (Scalable service-oriented MiddlewarEover IP) is an application layer protocol introduced by in-vehicle Ethernet communication. It is a service-oriented middleware protocol designed for the automotive industry to simplify communication and service interactions in complex automotive systems. SOME / IP has been widely used in intelligent connected vehicles. However, since the SOME / IP protocol itself does not consider the security protection mechanism, the SOME / IP protocol itself lacks a security protection mechanism and has a large security risk. The SOME / IP protocol mainly relies on the lower-layer communication protocol for protection. If the lower-layer security protection mechanism is lacking or imperfect, it will bring information security problems. The following security risks may exist: 1) Information leakage risk: attackers steal a large number of communication messages and perform data analysis. When data is transmitted in plain text, it is easy to be cracked and cause information leakage; 2) Information tampering risk: After the attacker invades the in-vehicle network, he can send the tampered information to each in-vehicle terminal to achieve the purpose of controlling the vehicle; 3) Identity deception risk: The attacker impersonates other in-vehicle terminals and accesses the in-vehicle network to steal information and even control the vehicle; 4) Replay attack risk: The attacker steals the message and replays it to achieve the purpose of controlling the vehicle. In summary, there are serious security risks in the current in-vehicle SOME / IP communication, and secure communication protection is needed. Summary of the invention

[0003] In view of this, the present invention provides a method, system, device and medium for secure communication of in-vehicle messages, which can solve the problem of serious security risks in in-vehicle SOME / IP communication, greatly improve the security communication protection between the sending node and the receiving node, and realize secure communication of in-vehicle SOME / IP while ensuring data integrity.

[0004] According to one aspect of the present invention, an embodiment of the present invention provides a vehicle-mounted message security communication method, which is applied to a sending node, and the method includes:

[0005] Sending a session establishment request message to a receiving node, and in response to a session establishment response message transmitted by the receiving node, verifying the session establishment response message and decrypting the session key with a private key;

[0006] Acquire a SOME / IP message to be transmitted; wherein the SOME / IP message to be transmitted includes a message header and a message body; the SOME / IP message to be transmitted is pre-configured with a corresponding message security level;

[0007] The SOME / IP message to be transmitted is encrypted according to the session key, the message security level and the preset encryption algorithm to obtain a target transmission message, and the target transmission message is sent to a receiving node; wherein the target message body in the target transmission message includes an initialization vector IV and a message authentication code MAC.

[0008] According to one aspect of the present invention, an embodiment of the present invention provides a vehicle-mounted message security communication method, which is applied to a receiving node, and the method includes:

[0009] receiving a session establishment request message transmitted by a sending node, verifying the session establishment request message, generating a session key, and sending a session establishment response message to the sending node;

[0010] The target transmission message transmitted by the sending node is obtained, and the target transmission message is authenticated and decrypted; wherein the target transmission message includes a target message header and a target message body.

[0011] According to another aspect of the present invention, an embodiment of the present invention further provides a vehicle-mounted message safety communication system, the system comprising: a sending node and a receiving node;

[0012] The sending node is specifically used for:

[0013] Sending a session establishment request message to a receiving node, and in response to a session establishment response message transmitted by the receiving node, verifying the session establishment response message and decrypting the session key with a private key;

[0014] Acquire a SOME / IP message to be transmitted; wherein the SOME / IP message to be transmitted includes a message header and a message body; the SOME / IP message to be transmitted is pre-configured with a corresponding message security level;

[0015] The SOME / IP message to be transmitted is encrypted according to the session key, the message security level and the preset encryption algorithm to obtain a target transmission message, and the target transmission message is sent to a receiving node; wherein the target message body in the target transmission message includes an initialization vector IV and a message authentication code MAC.

[0016] The receiving node is specifically used for:

[0017] receiving a session establishment request message transmitted by a sending node, verifying the session establishment request message, generating a session key, and sending a session establishment response message to the sending node;

[0018] Acquire the target transmission message transmitted by the sending node, and authenticate and decrypt the target transmission message; wherein the target transmission message includes a target message header and a target message body

[0019] According to another aspect of the present invention, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0020] at least one processor; and

[0021] a memory communicatively connected to the at least one processor; wherein,

[0022] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the in-vehicle message safety communication method described in any embodiment of the present invention.

[0023] According to another aspect of the present invention, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the in-vehicle message safety communication method described in any embodiment of the present invention when executed.

[0024] The technical solution of the embodiment of the present invention can solve the problem of serious security risks in vehicle-mounted SOME / IP communication by configuring the corresponding message security level for the SOME / IP message to be transmitted, and encrypting the SOME / IP message to be transmitted according to the session key, the message security level and the preset encryption algorithm to obtain the target transmission message, greatly improve the security communication protection between the sending node and the receiving node, and realize the secure communication of the vehicle-mounted SOME / IP while ensuring the integrity of the data.

[0025] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0027] Figure 1 A flow chart of a vehicle-mounted message security communication method provided by one embodiment of the present invention;

[0028] Figure 2 A flowchart of a handshake negotiation between a sending node and a receiving node for a key provided by an embodiment of the present invention;

[0029] Figure 3 A flowchart of another vehicle-mounted message security communication method provided by an embodiment of the present invention;

[0030] Figure 4 A flowchart of another vehicle-mounted message security communication method provided by an embodiment of the present invention;

[0031] Figure 5 A flowchart of another vehicle-mounted message security communication method provided by an embodiment of the present invention;

[0032] Figure 6 A structural block diagram of a vehicle-mounted message safety communication system provided by an embodiment of the present invention;

[0033] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0034] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0036] In one embodiment, Figure 1A flow chart of a method for secure vehicle message communication provided in one embodiment of the present invention. This embodiment can be applied to the situation when secure communication is performed on a vehicle-mounted SOME / IP. The method can be executed by a vehicle-mounted message secure communication system. The vehicle-mounted message secure communication system can be implemented in the form of hardware and / or software. The vehicle-mounted message secure communication system can be configured in an electronic device.

[0037] like Figure 1 As shown, the vehicle-mounted message security communication method in this embodiment is applied to a sending node, and the specific steps of the method include:

[0038] S110 , sending a session establishment request message to a receiving node, and in response to a session establishment response message transmitted by the receiving node, verifying the session establishment response message and decrypting the session key with a private key.

[0039] Among them, the receiving node can be understood as the communication node in the vehicle communication, and the receiving node can also be called the receiving end or the server end; the sending node can be understood as the sending node in the vehicle communication opposite to the receiving node, and the sending node can also be called the sending end or the client end.

[0040] In this embodiment, before the receiving node and the sending node formally communicate, they need to handshake, authenticate their identities, and negotiate the keys used for formal communication. It can be understood that the client sends a request for an encrypted handshake protocol to the server, requesting to establish a secure connection. The server sends a response to the client containing the server authentication information (certificate) and the encryption algorithm selected by the server. The client verifies the legitimacy of the certificate and generates a symmetric encryption key. The client encrypts the key using the server's public key and sends it to the server. The server uses the private key to decrypt the key sent by the client. The client and the server both hold the same symmetric key for subsequent communication data encryption and decryption. After identity authentication and key negotiation are performed, the identity authentication function is realized. After the key negotiation process is completed, the two parties can communicate securely normally.

[0041] In this embodiment, the sending node sends a session establishment request message to the receiving node, and the session establishment request message includes at least the sending node certificate and the request message signature. The receiving node receives the session establishment request message, verifies it and sends a session establishment response message. The sending node responds to the session establishment response message transmitted by the receiving node, verifies the session establishment response message and decrypts the session key with a private key. The session establishment response message includes at least: the receiving node certificate, the response message signature, and the session key encrypted with the sending node public key.

[0042] In this embodiment, in order to better understand the process in which the sending node and the receiving node first perform identity authentication and key negotiation to communicate normally, Figure 2A flowchart of a handshake and key negotiation between a sending node and a receiving node provided in an embodiment of the present invention. Specifically: Session establishment, when the client finds that the service it requested is available, it will initiate a session establishment process. The execution process is as follows: the client sends a session request message to the client, and the message includes the client certificate, message signature, etc.; the server verifies the client certificate with the root certificate, and verifies the message with the client certificate; after successful verification, the server generates a session key (symmetric key), and then sends a session establishment response message to the client, and the message includes the server certificate, message signature, and session key encrypted with the client public key, etc.; the client verifies the server certificate with the root certificate, and verifies the message with the server certificate.

[0043] S120, obtaining a SOME / IP message to be transmitted; wherein the SOME / IP message to be transmitted includes a message header and a message body; and the SOME / IP message to be transmitted is pre-configured with a corresponding message security level.

[0044] The SOME / IP message to be transmitted can be understood as a SOME / IP message that needs to be transmitted securely. The message includes a message header and a message body. The corresponding message security level can be pre-configured according to the security level of the SOME / IP message to be transmitted.

[0045] In one embodiment, the message header of the SOME / IP message to be transmitted includes: message identifier, message length, request identifier, protocol version number, service interface version number, message type and return code; wherein, the request identifier includes the sending node identifier and the session identifier; the message body of the SOME / IP message to be transmitted includes: message content. In this embodiment, the message header can also be called Header; the message body can also be called Payload or effective load, which is the message content, and its length is usually variable, that is, the relevant data to be transmitted; the message identifier can also be called message ID, including the service ID and the method ID. When the message is of Method type, it is composed of Service ID and Method ID; when the message is of Event type, it is composed of Service ID and Event ID. The message type is used to identify the type of the message, and the return code is used to identify whether the request is successfully processed. Different message types carry different Return Codes when they are transmitted. In order to better understand the original SOME / IP message format, Table 1 is a SOME / IP message format table provided by this embodiment. The message is divided into two parts: Header (message header) and Payload (message body); each part includes corresponding field information.

[0046] Table 1: Original SOME / IP message format

[0047]

[0048] In this embodiment, different SOME / IP messages to be transmitted may correspond to the same or different message security levels, and the message security level may be defined by the demand or the importance of the communication, wherein the message security level includes the first security level, the second security level and the third security level; the first security level is lower than the second security level; the second security level is lower than the third security level. In one embodiment, the pre-configuration of the message security level includes: by modifying the field information of the message type in the message header to determine the identification bit of the security protection type of the transmitted SOME / IP message; determining the message security level according to the identification bit; wherein the identification bit may characterize the message security level protection type; it can be understood that by modifying the message type field in the message header to distinguish different protection levels, specifically, the bits in the original message type may be modified on the basis of the message type defined by the original protocol to serve as the identification bit of the security protection type, and illustratively, the 2nd bit and the 3rd bit in the original message type are used as the identification bit of the security protection type. Exemplarily, 00 indicates no security protection, 01 indicates authentication protection, 10 indicates encryption protection, and 11 is reserved. Exemplarily, in order to facilitate a better understanding of modifying the field information of the message type in the message header to determine the security protection level, the message protection level is divided into three levels: No security protection: This security level has no security measures. Authentication: Implement data integrity protection. Authentication + encryption: Data integrity protection and encryption functions. Table 2 is a message type definition table of an original protocol provided in an embodiment of the present invention; Table 3 is a message type definition table for confirming the security level provided in an embodiment of the present invention. The original request message type is 0x00, the no security protection type of the message is 0x00, the message type with authentication protection is 0x08, and the message type with authentication + encryption protection is 0x0C.

[0049] Table 2: Message type definition table of the original protocol

[0050] Message Type value REQUEST 0x00 REQUESTNO_RETURN 0x01 NOTIFICATION 0x02 RESPONSE 0x80 ERROR 0x81 TP_REQUEST 0x20 TP_REQUEST_NO_RETURN 0x21 TP_NOTIFlCATlON 0x22 TP_RESPONSE 0xA0 TP_ERROR 0xA1

[0051] Table 3: Definition of message types for confirming security level

[0052] Message Type No security protection Certification encryption REQUEST 0x00 0x04 0x0C REQUEST_NO_RETURN 0x01 0x05 0x0D NOTIFICATION 0x02 0x06 0x0E RESPONSE 0x80 0x84 0x8C ERROR 0x81 0x85 0x8D TP_REQUEST 0x20 0x24 0x2C TP_REOUEST_NO_RETURN 0x21 0x25 0x2D TP_NOTIFlCATlON 0x22 0x26 0x2E TP_RESPONSE 0xA0 0xA4 0xAC TP_ERROR 0xA1 0xA5 0xAD

[0053] S130, encrypting the SOME / IP message to be transmitted according to the session key, the message security level and the preset encryption algorithm to obtain a target transmission message, and sending the target transmission message to the receiving node.

[0054] The preset encryption algorithm may include an authentication encryption algorithm for ADAE associated data, which is an encryption mode that can simultaneously ensure the confidentiality, integrity and authenticity of data. The target transmission message includes a target message body and a target message header, wherein the target message body includes an initialization vector IV and a message authentication code MAC, and the message type in the target message header corresponds to the corresponding message security level.

[0055] In this embodiment, the message security level corresponding to the SOME / IP message to be transmitted is determined. After the message security level is defined, the sending node can encrypt the message body in the SOME / IP message to be transmitted according to the session key, the message security level and the preset encryption algorithm to obtain the target transmission message; it can be understood that during secure communication, the sender needs to perform serialization operation on the payload to be sent, that is, fill in each field according to the message format defined by the protocol, and when serializing, it is necessary to perform authentication or encryption operation according to the currently negotiated security level; in this embodiment, it is necessary to add an initialization vector (IV) and a message authentication code (MAC) field in the Payload according to the message security level and the encryption algorithm used; wherein IV is an input value of a fixed length, which is composed of a communication session ID and a counter value, and can be used to implement anti-replay attack. Specifically, a specific message is constructed according to the current security protection level. When the message security level is the first security level, the identification bit of the message type in the message header is set to the first type identification bit, and the SOME / IP message to be transmitted is filled in according to the message format defined by the original SOME / IP protocol; when the message security level is the second security level, the identification bit of the message type is set to the second type identification bit, and the original message + IV + MAC is used as the payload to construct the message and send it. When the message security level is the third security level, the identification bit of the message type is set to the third type identification bit, and the encrypted ciphertext + IV + MAC is used as the payload to construct the message and send it to the receiving end. In some embodiments, a message authentication code can also be generated according to the plaintext and the attached data, combined with the IV and the shared key; a key stream is generated according to the message authentication code and the IV combined with the shared key; the plaintext is encrypted according to the key stream, and the obtained ciphertext, message authentication code and IV are sent to the receiving end.

[0056] The technical solution of the embodiment of the present invention can solve the problem of serious security risks in vehicle-mounted SOME / IP communication by configuring the corresponding message security level for the SOME / IP message to be transmitted, and encrypting the SOME / IP message to be transmitted according to the session key, the message security level and the preset encryption algorithm to obtain the target transmission message, greatly improve the security communication protection between the sending node and the receiving node, and realize the secure communication of the vehicle-mounted SOME / IP while ensuring the integrity of the data.

[0057] In one embodiment, Figure 3 A flowchart of another in-vehicle message security communication method provided for an embodiment of the present invention. Based on the above embodiments, this embodiment further refines the encryption of the SOME / IP message to be transmitted according to the session key, the message security level and the preset encryption algorithm to obtain the target transmission message.

[0058] like Figure 3 As shown, the vehicle-mounted message security communication method in this embodiment is applied to a sending node and may specifically include the following steps:

[0059] S310: Send a session establishment request message to a receiving node, and in response to a session establishment response message transmitted by the receiving node, verify the session establishment response message and decrypt the session key with a private key.

[0060] S320, obtaining a SOME / IP message to be transmitted; wherein the SOME / IP message to be transmitted includes a message header and a message body; and the SOME / IP message to be transmitted is pre-configured with a corresponding message security level.

[0061] S330: When the message security level is the first security level, set the message type identification bit in the message header to the first type identification bit, and fill the SOME / IP message to be transmitted according to the message format defined by the original SOME / IP protocol to obtain the target transmission message.

[0062] Among them, the first type identification bit can be understood as an identification bit corresponding to the first security level. For example, the identification bit 00 represents the first security level. The first security level can be a message whose communication level reaches a preset first security level. For example, there is no security protection or the encryption level does not require a very high communication security level.

[0063] In this embodiment, when the message security level is the first security level, the message type identification bit in the message header is set to the first type identification bit, and the SOME / IP message to be transmitted is filled in accordance with the message format defined by the original SOME / IP protocol to obtain the target transmission message; it can be understood that if the security level of message transmission is the first security level, it can be serialized according to the original SOMEIP protocol, without adding IV and MAC to the end of the message, and the SOME / IP message to be transmitted is directly filled in accordance with the message format defined by the original SOME / IP protocol to obtain the target transmission message. It should be noted that when filling the message, the SOME / IP message to be transmitted can be directly copied to the corresponding memory space, and then the target transmission message is sent to the receiving node. Exemplarily, if there is no security protection or the encryption level required for the communication security level is not very high, the total length of the first message of the SOME / IP message to be transmitted is counted; wherein, the total length of the first message includes: the message header length HL, the message body length PL, and the memory space of the total length is applied, and P0 is used to represent the starting address pointing to the memory space, and the original load is directly copied to the memory space pointed to by P0+HL.

[0064] S340. When the message security level is the second security level, set the message type identification bit to the second type identification bit, and randomly generate an initialization vector IV, determine the first message authentication code MAC of the SOME / IP message to be transmitted according to a preset MAC algorithm, and append the initialization vector IV and the first message authentication code MAC to the message body in the SOME / IP message to be transmitted to obtain a target transmission message.

[0065] Among them, the preset MAC algorithm is the MAC algorithm in the prior art, for example, it can be the HMAC algorithm, which is a MAC based on the hash function; this embodiment will not be explained in detail; the second type identification bit can be understood as the identification bit corresponding to the second security level. For example, the identification bit 01 represents the second security level, and the first security level can be the message that needs to be authenticated and protected.

[0066] In this embodiment, the initialization vector IV is the initialization vector IV generated by the sending node, which is used as the initial vector of the encryption algorithm and is used together with the key to ensure that different results are generated each time data is encrypted. The first message authentication code MAC can be understood as the MAC value of the message calculated under the second security level.

[0067] It should be noted that the IV value is 12 bytes long, byte0~byte1: reserved, set to 0; byte2~byte3: session ID, identifies each communication connection, assigned by the server to the client during the handshake phase; byte4~byte7: 32-bit counter 1, starting from 0, incremented by 1 for each message; byte8~byte11: 32-bit counter 2, starting from 0, incremented by 1 every time counter 1 is full. Table 4 shows the IV value length of 12 bytes, and the specific allocation is as follows:

[0068] Table 4: IV value length 12 bytes

[0069]

[0070] In this embodiment, the first message authentication code MAC of the SOME / IP message to be transmitted can be determined by a preset MAC algorithm, which can be understood as using a preset MAC algorithm to calculate the first message authentication code MAC value of the SOME / IP message to be transmitted, and attaching the initialization vector IV and the first message authentication code MAC to the message body in the SOME / IP message to be transmitted to obtain the target transmission message; in this embodiment, the SOME / IP message to be transmitted is not encrypted as an original message, and the MAC operation is performed on the SOME / IP message to be transmitted to obtain the corresponding MAC value, and then the MAC value, and then the initialization vector IV and the first message authentication code MAC are attached to the message body in the SOME / IP message to be transmitted to obtain the target transmission message. Exemplarily, if the message security level is authentication protection, that is, the second security level, first set the 2nd and 3rd bits of the message type (Messge Type) to 1 and 0, then obtain the current randomly generated IV value, calculate the MAC value of the original load using the preset MAC algorithm, and finally attach the IV value and the MAC value to the end of the message to obtain the target transmission message and transmit the target transmission message to the receiving node.

[0071] In one embodiment, appending the initialization vector IV and the first message authentication code MAC to the message body in the SOME / IP message to be transmitted includes:

[0072] Count the total length of the first message of the SOME / IP message to be transmitted; wherein the total length of the first message includes: the message header length HL, the message body length PL, the initialization vector IV length IL corresponding to the initialization vector IV, and the first message authentication code MAC length ML corresponding to the first message authentication code MAC;

[0073] Copying the field information corresponding to the message header in the SOME / IP message to be transmitted to the pre-configured first memory space in sequence; wherein the first memory space corresponds to the corresponding first space starting address;

[0074] According to the second security level, the message body in the SOME / IP message to be transmitted is copied to the corresponding first memory space; wherein the message body includes an initialization vector IV and a first message authentication code MAC.

[0075] The first message total length is the total length of the SOME / IP message to be transmitted at the second security level.

[0076] In this embodiment, by counting the message header length HL, the message body length PL, the initialization vector IV length IL corresponding to the initialization vector IV, and the message authentication code MAC length ML corresponding to the first message authentication code MAC of the SOME / IP message to be transmitted, the first memory space of the total length of the first message is configured; wherein the first memory space corresponds to the corresponding first space starting address, and P0 is used to represent the starting address pointing to the first memory space, and according to the message format defined by the original SOME / IP protocol, the field information corresponding to the message header in the SOME / IP message to be transmitted is copied to the first memory space pointed to by P0 in sequence, and the message body in the SOME / IP message to be transmitted is copied to the corresponding first memory space according to the message security level; wherein the message body includes the initialization vector IV and the first message authentication code MAC. It can be understood that if it is authentication protection, the original load is first copied to the memory space pointed to by P0+HL, and then the IV value is copied to the memory space pointed to by P0+HL+PL, and finally the MAC value is copied to the memory space pointed to by P0+HL+PL+IL.

[0077] S350. When the message security level is the third security level, the identification bit of the message type is set to the third type identification bit, and an initialization vector IV is randomly generated. The ciphertext of the SOME / IP message to be transmitted is determined based on the authentication encryption ADAE algorithm of the session key and preset associated data, and the second message authentication code MAC of the ciphertext is determined by the preset MAC algorithm. The initialization vector IV and the second message authentication code MAC are attached to the message body in the ciphertext to obtain the target transmission message.

[0078] Among them, the authentication encryption ADAE algorithm of the preset associated data is a symmetric encryption algorithm in the prior art, and the preset MAC algorithm is the MAC algorithm mentioned above, which is used to calculate the MAC value corresponding to the encrypted ciphertext. The third type of identification bit can be understood as an identification bit corresponding to the third security level. For example, the identification bit 10 represents the third security level, and the third security level can be a message that needs to be authenticated and encrypted. In this embodiment, the initialization vector IV is an initialization vector IV randomly generated by the sending node.

[0079] In this embodiment, when the message security level is the third security level, the identification bit of the message type is set to the third type identification bit, and the initialization vector IV is randomly generated, and the ciphertext of the SOME / IP message to be transmitted is determined according to the authentication encryption ADAE algorithm of the session key and the preset associated data, and the second message authentication code MAC of the ciphertext is determined by the preset MAC algorithm, and the initialization vector IV and the second message authentication code MAC are attached to the message body in the ciphertext to obtain the target transmission message. It can be understood that the original message and the IV value are used as input, and the symmetric encryption algorithm in the AEAD mode is used to calculate the encrypted ciphertext and MAC of the original message. In this embodiment, the original SOME / IP message to be transmitted needs to be encrypted to obtain a ciphertext, a preset MAC algorithm is used to calculate the second message authentication code MAC corresponding to the ciphertext, and the initialization vector IV and the second message authentication code MAC are attached to the message body in the ciphertext to obtain the target transmission message; specifically, the session key includes a key pair, and the key pair includes a public key and a private key. The sending node can use the public key in the key pair and the AEAD symmetric encryption algorithm to encrypt the SOME / IP message to be transmitted to obtain an encrypted ciphertext, and the receiving node can use the private key to decrypt the encrypted ciphertext to obtain the corresponding original message; illustratively, if the current protection is encryption, first set the 2nd and 3rd bits of the message type (Messge Type) to 1 and 1, then obtain the currently randomly generated IV value, use the AEAD symmetric encryption algorithm to calculate the encrypted ciphertext of the original payload, and calculate the MAC value of the ciphertext, and finally replace the original payload with the ciphertext and attach the IV value and the MAC value to the end of the message.

[0080] In one embodiment, appending an initialization vector IV and a second message authentication code MAC to a message body in the ciphertext includes:

[0081] Count the total length of the second message of the ciphertext; wherein the total length of the second message includes: the length of the message header, the length of the message body, the length of the initialization vector IV corresponding to the initialization vector IV, and the length of the second message authentication code MAC corresponding to the second message authentication code MAC;

[0082] Copying the field information corresponding to the message header in the ciphertext into the pre-configured second memory space in sequence; wherein the second memory space corresponds to the corresponding second space starting address;

[0083] The message body in the ciphertext is copied to the corresponding second memory space according to the third message security level; wherein the message body includes an initialization vector IV and a second message authentication code MAC.

[0084] In this embodiment, the second memory space corresponding to the total length of the second message is configured by counting the message header length, message body length, initialization vector IV length corresponding to the initialization vector IV, and message authentication code MAC length corresponding to the second message authentication code MAC of the ciphertext; wherein the second memory space corresponds to the corresponding second space starting address, and P1 is used to represent the starting address pointing to the second memory space. According to the message format defined by the original SOME / IP protocol, the field information corresponding to the message header in the ciphertext is copied to the second memory space pointed to by P1 in sequence, and the message body in the ciphertext is copied to the corresponding second memory space according to the message security level; wherein the message body includes the initialization vector IV and the second message authentication code MAC; exemplarily, if it is encrypted protection, the encrypted ciphertext after the load is first copied to the memory space pointed to by P0+HL, and then the IV value is copied to the memory space pointed to by P0+HL+PL, and finally the MAC value is copied to the memory space pointed to by P0+HL+PL+IL.

[0085] In one embodiment, when the message security level is the first security level, the SOME / IP message to be transmitted is directly copied to the corresponding memory space; when the message security level is the second security level, the SOME / IP message to be transmitted is respectively copied to the first memory space pointed to by the first space starting address and the message header length HL, and the initialization vector IV is copied to the first memory space pointed to by the first space starting address, the message header length HL and the message body length PL, and the first message authentication code MAC is copied to the first memory space pointed to by the first space starting address, the message header length HL, the message body length PL and the initialization vector IV length IL; when the message security level is the third security level, the encrypted ciphertext after the payload is respectively copied to the second memory space pointed to by the second space starting address and the message header length HL, and the initialization vector IV is copied to the second memory space pointed to by the second space starting address, the message header length HL and the message body length PL, and the second message authentication code MAC is copied to the second memory space pointed to by the starting address, the message header length HL, the message body length PL and the initialization vector IV length IL.

[0086] In one embodiment, in order to better understand the addition of IV and MAC fields to the message body Payload (i.e., the data, message body or payload to be transmitted) in the SOME / IP message to be transmitted to obtain the corresponding target transmission message, Table 5 is a message format table of the target transmission message after adding IV and MAC fields to Payload provided by an embodiment of the present invention. In this embodiment, the security level of the message type is added to the message header of the SOME / IP message to be transmitted, and the IV and MAC fields are added to the message body of the SOME / IP message to be transmitted to obtain the target transmission message. In this embodiment, the SOME / IP message to be transmitted can be encrypted to obtain the ciphertext before adding the IV and MAC fields, or the IV and MAC fields can be directly added to the SOME / IP message to be transmitted. It can be set according to the message level, and this embodiment does not limit it here.

[0087] Table 5: Message format of target transmission message after adding IV and MAC fields in Payload

[0088]

[0089] The above technical solution in this embodiment, in the case of the first security level, sets the identification bit of the message type in the message header as the first type identification bit, and fills the SOME / IP message to be transmitted according to the message format defined by the original SOME / IP protocol to obtain the target transmission message, in the case of the second security level, sets the identification bit of the message type as the second type identification bit, and randomly generates an initialization vector IV, determines the first message authentication code MAC of the SOME / IP message to be transmitted according to a preset MAC algorithm, and appends the initialization vector IV and the first message authentication code MAC to the message body in the SOME / IP message to be transmitted to obtain the target transmission message, and in the case of the third security level, sets the message type identification bit as the second type identification bit, and randomly generates an initialization vector IV, determines the first message authentication code MAC of the SOME / IP message to be transmitted according to a preset MAC algorithm, and appends the initialization vector IV and the first message authentication code MAC to the message body in the SOME / IP message to be transmitted to obtain the target transmission message. The identification bit of the type is the third type identification bit, and the initialization vector IV is randomly generated. The ciphertext of the SOME / IP message to be transmitted is determined based on the authentication encryption ADAE algorithm of the session key and preset associated data, and the second message authentication code MAC of the ciphertext is determined by the preset MAC algorithm, and the initialization vector IV and the second message authentication code MAC are appended to the message body in the ciphertext to obtain the target transmission message, which can further solve the problem of security risks in vehicle-mounted SOME / IP communication, greatly improve the security communication protection between the sending node and the receiving node, and realize the secure communication of the vehicle-mounted SOME / IP while ensuring data integrity, and realize identity authentication, data encryption, data integrity, and anti-replay attack protection.

[0090] In one embodiment, Figure 4A flowchart of another vehicle-mounted message security communication method provided for an embodiment of the present invention. This embodiment can be applicable to the situation when secure communication is performed on a vehicle-mounted SOME / IP. The method can be executed by a vehicle-mounted message security communication system. The vehicle-mounted message security communication system can be implemented in the form of hardware and / or software. The vehicle-mounted message security communication system can be configured in an electronic device.

[0091] like Figure 4 As shown, the vehicle-mounted message security communication method in this embodiment is applied to a receiving node, and the method specifically includes the following steps:

[0092] S410: Receive a session establishment request message transmitted by a sending node, verify the session establishment request message, generate a session key, and send a session establishment response message to the sending node.

[0093] S420, obtaining a target transmission message transmitted by the sending node, and authenticating and decrypting the target transmission message according to a message security level corresponding to the target transmission message; wherein the target transmission message includes a target message header and a target message body.

[0094] In this embodiment, the target transmission message transmitted by the sending node is obtained, and the target transmission message is authenticated and decrypted using the session key; wherein, the target transmission message includes a target message header and a target message body. That is, after receiving the message, the recipient of the secure communication performs authentication and decryption, MAC value comparison and IV value comparison; specifically, when the message security level is the first security level, it is deserialized according to the original SOME / IP message format to obtain the decryption result; when the message security level is the second security level, authentication and decryption are performed to obtain the plaintext corresponding to the target transmission message, the initialization vector IV corresponding to the plaintext and the first message authentication code MAC as the first decryption result, and the message authentication code MAC is calculated on the first decryption result to obtain the target first message authentication code MAC, the first message authentication code MAC is compared with the target first message authentication code MAC, and the local storage is performed. Whether the initialization vector IV and the decrypted initialization vector IV are consistent, if both are consistent, it is determined that the authentication is successful; when the message security level is the third security level, double decryption of authentication and encryption is performed to obtain the ciphertext corresponding to the target transmission message, the initialization vector IV corresponding to the ciphertext and the second message authentication code MAC as the second decryption result, and the message authentication code MAC is calculated on the second decryption result to obtain the target second message authentication code MAC, and the second message authentication code MAC and the target second message authentication code MAC are compared, as well as whether the locally stored initialization vector IV and the decrypted initialization vector IV are consistent, if both are consistent, it is determined that the authentication is successful.

[0095] The embodiment of the present invention verifies the session establishment request message, generates a session key, sends a session establishment response message to the sending node, obtains the target transmission message transmitted by the sending node, and authenticates and decrypts the target transmission message according to the message security level corresponding to the target transmission message. This can solve the problem of serious security risks in vehicle-mounted SOME / IP communication, greatly improve the security communication protection between the sending node and the receiving node, and realize the secure communication of the vehicle-mounted SOME / IP while ensuring data integrity, thereby realizing identity authentication, data encryption, data integrity, and protection against replay attacks.

[0096] In one embodiment, Figure 5 A flowchart of another in-vehicle message secure communication method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment further refines the authentication and decryption of the target transmission message.

[0097] like Figure 5 As shown, the vehicle-mounted message security communication method in this embodiment is applied to a receiving node and may specifically include the following steps:

[0098] S510: Receive a session establishment request message transmitted by a sending node, verify the session establishment request message, generate a session key, and send a session establishment response message to the sending node.

[0099] S520: Obtain a target transmission message transmitted by a sending node, and determine a message security level corresponding to the target transmission message according to an identification bit of a message type in a header of the target message.

[0100] In this embodiment, the receiving node obtains the target transmission message transmitted by the sending node, and can determine the message security level corresponding to the target transmission message based on the identification bit of the message type in the target message header in the target transmission message. Specifically, first, according to the identification bit of the message type, for example, it can be the 2nd and 3rd bits, to obtain the security level of the current message, when the identification bit is the first type identification bit, the message security level corresponding to the target transmission message is determined to be the first security level; when the identification bit is the second type identification bit, the message security level corresponding to the target transmission message is determined to be the second security level; when the identification bit is the third type identification bit, the message security level corresponding to the target transmission message is determined to be the third security level.

[0101] S530: When the message security level is the first security level, deserialization is performed according to the original SOME / IP message format to obtain a decryption result.

[0102] In this embodiment, when the message security level is the first security level, deserialization is performed according to the original SOME / IP message format to obtain a decryption result. It can be understood that if there is no security protection, deserialization is performed according to the original SOMEIP message format to obtain a payload.

[0103] S540. When the message security level is the second security level, the target transmission message is authenticated and decrypted to obtain the target transmission message original text, the initialization vector IV corresponding to the target transmission message original text, and the first message authentication code MAC as the first decryption result, and the message authentication code MAC is calculated on the target transmission message original text to obtain the target first message authentication code MAC, and the first message authentication code MAC and the target first message authentication code MAC are compared, as well as the locally cached local initialization vector IV and the decrypted initialization vector IV to see if they are consistent. When both are consistent, it is determined that the authentication is successful.

[0104] In this embodiment, when the message security level is the second security level, authentication decryption is performed to obtain the plaintext corresponding to the target transmission message, the initialization vector IV corresponding to the plaintext, and the first message authentication code MAC as the first decryption result, and the message authentication code MAC is calculated on the first decryption result to obtain the target first message authentication code MAC, and the first message authentication code MAC and the target first message authentication code MAC are compared, as well as whether the locally stored initialization vector IV and the decrypted initialization vector IV are consistent. When both are consistent, it is determined that the authentication is passed. Specifically, if it is authentication protection, deserialization is performed according to the secure SOMEIP message format to obtain the plaintext payload, IV and MAC value, and then the symmetric encryption algorithm in AEAD mode is used to calculate the MAC value corresponding to the plaintext payload, and finally the calculated MAC value is compared with the received MAC value to see if they are consistent.

[0105] S550. When the message security level is the third security level, the target transmission message is authenticated and the ciphertext encrypted, and double decryption is performed to obtain the corresponding target transmission message original text, the initialization vector IV corresponding to the ciphertext, and the second message authentication code MAC as the second decryption result. The message authentication code MAC is calculated on the target transmission message original text to obtain the target second message authentication code MAC. The second message authentication code MAC and the target second message authentication code MAC are compared, as well as the locally cached local initialization vector IV and the decrypted initialization vector IV to see if they are consistent. If both are consistent, it is determined that the authentication is successful.

[0106] In this embodiment, when the message security level is the third security level, double decryption of authentication and encryption is performed to obtain the ciphertext corresponding to the target transmission message, the initialization vector IV corresponding to the ciphertext, and the second message authentication code MAC as the second decryption result, and the message authentication code MAC is calculated for the target transmission message original text in the second decryption result to obtain the target second message authentication code MAC, and the second message authentication code MAC and the target second message authentication code MAC are compared, as well as the initialization vector IV stored locally and the decrypted initialization vector IV. If both are consistent, it is determined that the authentication is passed. Specifically, if it is encrypted protection, it is deserialized according to the secure SOMEIP message format to obtain the ciphertext payload, IV and MAC value, and then the symmetric encryption algorithm in the AEAD mode is used to perform the decryption operation. If the decryption algorithm is decrypted successfully, it means that the IV value and MAC value match the current ciphertext payload (the verification of the MAC value is completed at this time), and the plaintext payload is obtained.

[0107] In some embodiments, the length of the initialization vector IV is 12 bytes, wherein byte0 to byte1 are reserved and set to 0; byte2 to byte3 are session IDs, which identify each communication connection and are assigned by the receiving node to the sending node; byte4 to byte7 are counter 1, which starts from 0 and increases by 1 for each message; byte8 to byte11 are counter 2, which starts from 0 and increases by 1 each time counter 1 is full. In this embodiment, the counter is a 32-bit counter.

[0108] In some embodiments, the comparison process of the locally stored initialization vector IV and the decrypted initialization vector IV includes:

[0109] In the case where it is not the first time to receive the target transmission message, the decrypted initialization vector IV in the target transmission message is obtained, the decrypted initialization vector IV is used as the current initialization vector IV, and it is determined whether byte0 to byte1 of the current initialization vector IV are 0;

[0110] If byte0~byte1 of the current initialization vector IV is 0, the session ID is obtained according to byte2~byte3 of the current initialization vector IV, and the previous initialization vector IV decrypted in the previous target transmission message is searched in the local initialization vector IV in the local cache according to the session ID; when the previous initialization vector IV is searched, the value of counter 2 is compared, and if the current initialization vector IV is greater than the previous initialization vector IV, the verification is successful; if the current initialization vector IV is equal to the previous initialization vector IV, the value of counter 1 is compared, and if the current initialization vector IV is less than or equal to the previous initialization vector IV, the verification fails and an error is reported; if the current initialization vector IV is greater than the previous initialization vector IV, the verification succeeds, indicating that the target transmission message is not a replay of the previous message; if the current initialization vector IV is less than the previous initialization vector IV, the verification fails and an error is reported;

[0111] If byte0 to byte1 are not 0, the verification fails and an error is reported.

[0112] In this embodiment, it is determined whether the target transmission message is received for the first time. If it is the first time, the values ​​of the counter 1 and the counter 2 of the previous initialization vector IV decrypted from the previous target transmission message stored locally are 0, the decrypted initialization vector IV in the target transmission message is obtained, the initialization vector IV is used as the current initialization vector IV, and it is determined whether byte0 to byte1 of the current initialization vector IV are 0; if byte0 to byte1 are 0, the session ID is obtained according to byte2 to byte3 of the current initialization vector IV, and the previous initialization vector IV decrypted from the previous target transmission message is searched in the local cache according to the session ID; after the previous initialization vector IV is searched, If the current initialization vector IV is larger than the previous initialization vector IV, the check is successful; if the current initialization vector IV is equal to the previous initialization vector IV, the value of counter 1 is compared (byte4~7). If the current initialization vector IV is smaller than or equal to the previous initialization vector IV, the check fails and an error is reported; if the current initialization vector IV is larger than the previous initialization vector IV, the check succeeds, indicating that the target transmission message is not a replay of the previous message; if the current initialization vector IV is smaller than the previous initialization vector IV, the check fails and an error is reported; if byte0~byte1 is not 0, the check fails and an error is reported.

[0113] In one embodiment, Figure 6This is a structural block diagram of a vehicle-mounted message safety communication system provided by an embodiment of the present invention. The system is applicable to the situation when the vehicle-mounted message is safely communicated. The device can be implemented by hardware / software. It can be configured in an electronic device to implement a vehicle-mounted message safety communication method in an embodiment of the present invention.

[0114] like Figure 6 As shown, the system includes a sending node 610 and a receiving node 620;

[0115] The sending node 610 is specifically used for:

[0116] Sending a session establishment request message to the receiving node 620, and in response to a session establishment response message transmitted by the receiving node 620, verifying the session establishment response message and decrypting the session key using a private key;

[0117] Acquire a SOME / IP message to be transmitted; wherein the SOME / IP message to be transmitted includes a message header and a message body; the SOME / IP message to be transmitted is pre-configured with a corresponding message security level;

[0118] The SOME / IP message to be transmitted is encrypted according to the session key, the message security level and a preset encryption algorithm to obtain a target transmission message, and the target transmission message is sent to the receiving node; wherein the target message body in the target transmission message includes an initialization vector IV and a message authentication code MAC.

[0119] The receiving node 620 is specifically configured to:

[0120] Receive a session establishment request message transmitted by the sending node 610, verify the session establishment request message, generate a session key, and send a session establishment response message to the sending node 610;

[0121] The target transmission message transmitted by the sending node 610 is obtained, and the target transmission message is authenticated and decrypted according to the message security level corresponding to the target transmission message; wherein the target transmission message includes a target message header and a target message body.

[0122] The vehicle-mounted message safety communication system provided by the embodiment of the present invention can execute the vehicle-mounted message safety communication processing method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0123] In one embodiment, Figure 7A schematic diagram of the structure of an electronic device provided for an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0124] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0125] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0126] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the vehicle-mounted message safety communication method.

[0127] In some embodiments, the in-vehicle message safety communication method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the in-vehicle message safety communication method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the in-vehicle message safety communication method in any other appropriate manner (e.g., by means of firmware).

[0128] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0129] The computer programs for implementing the method of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable vehicle-mounted message safety communication device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0130] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0131] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0132] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0133] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0134] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0135] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A vehicle-mounted message security communication method, characterized in that: Applied to a sending node, the method comprises: Sending a session establishment request message to a receiving node, and in response to a session establishment response message transmitted by the receiving node, verifying the session establishment response message and decrypting the session key with a private key; Acquire a SOME / IP message to be transmitted; wherein the SOME / IP message to be transmitted includes a message header and a message body; the SOME / IP message to be transmitted is pre-configured with a corresponding message security level; The SOME / IP message to be transmitted is encrypted according to the session key, the message security level and a preset encryption algorithm to obtain a target transmission message, and the target transmission message is sent to the receiving node.

2. The method according to claim 1, characterized in that The pre-configuration of the message security level includes: By modifying the field information of the message type in the message header, an identification bit of the security protection type of the SOME / IP message to be transmitted is determined; Determining the message security level according to the identification bit; The message security level includes a first security level, a second security level and a third security level; the first security level is lower than the second security level; the second security level is lower than the third security level.

3. The method according to claim 1, characterized in that The message header includes: message identifier, message length, request identifier, protocol version number, service interface version number, message type and return code; wherein the request identifier includes a sending node identifier and a session identifier; the message body includes: message content.

4. The method according to claim 3, characterized in that The step of encrypting the SOME / IP message to be transmitted according to the session key, the message security level and a preset encryption algorithm to obtain a target transmission message includes: When the message security level is the first security level, setting the message type identification bit in the message header to the first type identification bit, and filling the SOME / IP message to be transmitted according to the message format defined by the original SOME / IP protocol to obtain a target transmission message; When the message security level is the second security level, the identification bit of the message type is set to the second type identification bit, and an initialization vector IV is randomly generated, a first message authentication code MAC of the SOME / IP message to be transmitted is determined according to a preset MAC algorithm, and the initialization vector IV and the first message authentication code MAC are attached to the message body in the SOME / IP message to be transmitted to obtain a target transmission message; When the message security level is the third security level, the identification bit of the message type is set to the third type identification bit, and an initialization vector IV is randomly generated. The encrypted ciphertext of the SOME / IP message to be transmitted is determined based on the authentication encryption ADAE algorithm of the session key and preset associated data, and the second message authentication code MAC of the ciphertext is determined by the preset MAC algorithm. The initialization vector IV and the second message authentication code MAC are appended to the message body in the ciphertext to obtain the target transmission message.

5. The method according to claim 4, characterized in that The step of attaching the initialization vector IV and the first message authentication code MAC to the message body in the SOME / IP message to be transmitted includes: Counting the total length of the first message of the SOME / IP message to be transmitted; wherein the total length of the first message includes: the message header length HL, the message body length PL, the initialization vector IV length IL corresponding to the initialization vector IV, and the first message authentication code MAC length ML corresponding to the first message authentication code MAC; Copying the field information corresponding to the message header in the SOME / IP message to be transmitted into a pre-configured first memory space in sequence; wherein the first memory space corresponds to the corresponding first space starting address; The message body in the SOME / IP message to be transmitted is copied to the corresponding first memory space according to the second security level; wherein the message body includes the initialization vector IV and the first message authentication code MAC.

6. The method according to claim 4, characterized in that The step of appending the initialization vector IV and the second message authentication code MAC to the message body in the ciphertext includes: Counting the total length of the second message of the ciphertext; wherein the total length of the second message includes: the length of the message header, the length of the message body, the length of the initialization vector IV corresponding to the initialization vector IV, and the length of the second message authentication code MAC corresponding to the second message authentication code MAC; Copying the field information corresponding to the message header in the ciphertext into a pre-configured second memory space in sequence; wherein the second memory space corresponds to the corresponding second space starting address; The message body in the ciphertext is copied to the corresponding second memory space according to the third security level; wherein the message body includes the initialization vector IV and the second message authentication code MAC.

7. The method according to any one of claims 4, 5 or 6, characterized in that: In the case where the message security level is the first security level, directly copying the SOME / IP message to be transmitted to the corresponding memory space; In the case where the message security level is the second security level, the SOME / IP message to be transmitted is copied to the first memory space pointed to by the first space starting address and the message header length HL, and the initialization vector IV is copied to the first memory space pointed to by the first space starting address, the message header length HL and the message body length PL, and the first message authentication code MAC is copied to the first memory space pointed to by the first space starting address, the message header length HL, the message body length PL and the initialization vector IV length IL; When the message security level is the third security level, the encrypted ciphertext of the payload is copied to the second memory space pointed to by the starting address of the second space and the message header length HL, and the initialization vector IV is copied to the second memory space pointed to by the starting address of the second space, the message header length HL and the message body length PL, and the second message authentication code MAC is copied to the second memory space pointed to by the starting address, the message header length HL, the message body length PL and the initialization vector IV length IL.

8. The method according to claim 1, characterized in that The session establishment request message at least includes a sending node certificate and a request message signature; The session establishment response message at least includes: a receiving node certificate, a response message signature, and a session key encrypted with a sending node public key.

9. A vehicle-mounted message security communication method, characterized in that: Applied to a receiving node, the method comprises: receiving a session establishment request message transmitted by a sending node, verifying the session establishment request message, generating a session key, and sending a session establishment response message to the sending node; The target transmission message transmitted by the sending node is obtained, and the target transmission message is authenticated and decrypted according to the message security level corresponding to the target transmission message; wherein the target transmission message includes a target message header and a target message body.

10. The method according to claim 9, characterized in that The authenticating and decrypting the target transmission message according to the message security level corresponding to the target transmission message includes: Determining a message security level corresponding to the target transmission message according to an identification bit of a message type in a header of the target message; When the message security level is the first security level, deserialization is performed according to the original SOME / IP message format to obtain a decryption result; In the case where the message security level is the second security level, the target transmission message is authenticated and decrypted to obtain the target transmission message original, the initialization vector IV corresponding to the target transmission message original, and the first message authentication code MAC as the first decryption result, and the message authentication code MAC is calculated on the target transmission message original to obtain the target first message authentication code MAC, and the first message authentication code MAC is compared with the target first message authentication code MAC, as well as the locally cached local initialization vector IV and the decrypted initialization vector IV to see if they are consistent, and if both are consistent, it is determined that the authentication is passed; When the message security level is the third security level, the target transmission message is authenticated and decrypted for ciphertext encryption to obtain the corresponding target transmission message original text, the initialization vector IV corresponding to the ciphertext and the second message authentication code MAC as the second decryption result, and the message authentication code MAC is calculated for the target transmission message original text to obtain the target second message authentication code MAC, and the second message authentication code MAC is compared with the target second message authentication code MAC, as well as the locally cached local initialization vector IV and the decrypted initialization vector IV to see if they are consistent. If both are consistent, it is determined that the authentication is successful.

11. The method according to claim 10, characterized in that The length of the initialization vector IV is 12 bytes; among them, byte0~byte1: reserved, set to 0; byte2~byte3: session ID, identifying each communication connection, assigned by the receiving node to the sending node; byte4~byte7: counter 1, starting from 0, incremented by 1 for each message; byte8~byte11: counter 2, starting from 0, incremented by 1 every time counter 1 counts full.

12. The method according to claim 9, characterized in that The comparison process between the locally cached local initialization vector IV and the decrypted initialization vector IV includes: In the case where it is not the first time to receive the target transmission message, obtaining the decrypted initialization vector IV in the target transmission message, using the decrypted initialization vector IV as the current initialization vector IV, and determining whether byte0 to byte1 of the current initialization vector IV are 0; If byte0-byte1 of the current initialization vector IV is 0, the session ID is obtained according to byte2-byte3 of the current initialization vector IV, and the previous initialization vector IV decrypted in the previous target transmission message is searched in the local initialization vector IV in the local cache according to the session ID; when the previous initialization vector IV is searched, the value of counter 2 is compared, and if the current initialization vector IV is greater than the previous initialization vector IV, the verification is successful; if the current initialization vector IV is equal to the previous initialization vector IV, the value of counter 1 is compared, and if the current initialization vector IV is less than or equal to the previous initialization vector IV, the verification fails and an error is reported; if the current initialization vector IV is greater than the previous initialization vector IV, the verification succeeds, indicating that the target transmission message is not a replay of the previous message; if the current initialization vector IV is less than the previous initialization vector IV, the verification fails and an error is reported; If byte0 to byte1 are not 0, the verification fails and an error is reported.

13. A vehicle-mounted message safety communication system, characterized in that: The system includes a sending node and a receiving node; The sending node is specifically used for: Sending a session establishment request message to a receiving node, and in response to a session establishment response message transmitted by the receiving node, verifying the session establishment response message and decrypting the session key with a private key; Acquire a SOME / IP message to be transmitted; wherein the SOME / IP message to be transmitted includes a message header and a message body; the SOME / IP message to be transmitted is pre-configured with a corresponding message security level; Encrypting the SOME / IP message to be transmitted according to the session key, the message security level and the preset encryption algorithm to obtain a target transmission message, and sending the target transmission message to the receiving node; wherein the target message body in the target transmission message includes an initialization vector IV and a message authentication code MAC; The receiving node is specifically used for: receiving a session establishment request message transmitted by a sending node, verifying the session establishment request message, generating a session key, and sending a session establishment response message to the sending node; The target transmission message transmitted by the sending node is obtained, and the target transmission message is authenticated and decrypted according to the message security level corresponding to the target transmission message; wherein the target transmission message includes a target message header and a target message body.

14. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the in-vehicle message safety communication method described in any one of claims 1-8 or 10-12.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the in-vehicle message safety communication method described in any one of claims 1-8 or 10-12 when executed.

Citation Information

Patent Citations

  • Gateway system design method for converting CAN bus into vehicle-mounted Ethernet bus

    CN113900429A

  • Security access control method based on automobile SOA

    CN115102772A

  • Message data transmission method and device, electronic equipment and storage medium

    CN117640091A

  • Self-adaptive safety vehicle-mounted communication method, system and equipment under vehicle-mounted domain centralized architecture and medium

    CN118265034A

Cited By

  • Code stream secure transmission method based on data dynamic grading and electronic equipment

    CN119316234A

  • A code stream security transmission method based on dynamic data classification and electronic equipment

    CN119316234B

  • Data distribution method and device, communication equipment and storage medium

    CN119696921A

  • Message data security improvement method and device, equipment, storage medium and computer program product

    CN120378197A

  • Message transmission method and device, electronic equipment and computer storage medium

    CN120583065A