[go: up one dir, main page]

WO2022021193A1 - Key negotiation method and apparatus - Google Patents

Key negotiation method and apparatus Download PDF

Info

Publication number
WO2022021193A1
WO2022021193A1 PCT/CN2020/105736 CN2020105736W WO2022021193A1 WO 2022021193 A1 WO2022021193 A1 WO 2022021193A1 CN 2020105736 W CN2020105736 W CN 2020105736W WO 2022021193 A1 WO2022021193 A1 WO 2022021193A1
Authority
WO
WIPO (PCT)
Prior art keywords
key
random number
viu
temporary
communication
Prior art date
Application number
PCT/CN2020/105736
Other languages
French (fr)
Chinese (zh)
Inventor
郭志鹏
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2020/105736 priority Critical patent/WO2022021193A1/en
Priority to CN202080004392.2A priority patent/CN112544052B/en
Publication of WO2022021193A1 publication Critical patent/WO2022021193A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/0838Key agreement, i.e. key establishment technique in which a shared key is derived by parties as a function of information contributed by, or associated with, each of these
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures

Definitions

  • the present application relates to the field of communication technologies, and in particular, to a key agreement method and device.
  • the in-vehicle electronic control systems mainly include domain control units (domain controllers, DCs). ) and electronic control units (electronic control unit, ECU) and other electronic control components.
  • DC domain controllers
  • ECU electronic control unit
  • the DC is used to control multiple auto parts in the functional domain
  • the ECU has the electronic control function, which can control the auto parts based on the control information, and can also perform data processing on the data to be transmitted in the auto parts.
  • various network security risks also follow, such as network attacks, data leakage and even remote control of vehicles. Therefore, the in-vehicle electronic control system urgently needs a perfect key management system to provide security for vehicles and users.
  • KMS Key Management System
  • each functional domain has a DC
  • the ECUs in the DC control domain perform specific functions, and the DCs conduct cross-domain communication and interaction through the central gateway.
  • an on-board KMS is deployed on a central gateway, and the on-board KMS is responsible for distributing a shared key between ECUs and DCs, so that secure communication can be established between each DC and each ECU.
  • the process of generating the communication key by the in-vehicle ECU is as follows: First, ECU i generates a random number Ri and sends it to the central gateway.
  • the central gateway After receiving Ri, the central gateway generates a random number seed S, and then according to the identification of the central gateway, the identification of ECU i , Ri, S
  • the first message authentication code and the preset initial key K are obtained through hash operation, and then the first message authentication code and S are sent to ECU i .
  • ECU i first authenticates the first message authentication code .
  • the set long-term shared keys GK and S generate the communication key through the key derivation function, and then ECU i obtains the second message authentication code through hash operation according to the identity of the central gateway and the pre-set initial key K, and according to the central gateway
  • the identifier and communication key of the device are subjected to hash operation to obtain the third message authentication code, and finally the second message authentication code and the third message authentication code are sent to the central gateway for authentication.
  • the process of generating the communication key by the in-vehicle DC is the same as the process of generating the communication key by the ECU.
  • the random number seed S on which the communication key is generated is uniformly given by the central gateway, that is to say, all ECUs and DCs in the whole vehicle receive the same S during the process of generating the communication key, so as to ensure the communication between all ECUs and DCs in the whole vehicle. share the same communication key.
  • the electronic and electrical architecture in the vehicle is gradually transformed from a centralized network architecture based on a central gateway to a distributed central computing architecture (CCA).
  • the CCA architecture distributes the electronic control elements (including DC and ECU) of the vehicle into multiple areas, and each area deploys a Vehicle Integrated/Integration Unit (VIU) to manage the ECUs in the area.
  • High-speed Ethernet is connected to complete the high-speed communication of the whole vehicle.
  • the central gateway is replaced by multiple VIUs.
  • all ECUs and DCs in the whole vehicle have the same communication key, which depends on the unique S given by the central network gateway, and S is random every time the key is updated. generated, and there are multiple VIUs under the CCA architecture, the uniqueness of S cannot be guaranteed, so the above solution is not applicable to the CCA architecture.
  • how to negotiate keys is an urgent problem to be solved.
  • the present application provides a key negotiation method and apparatus to solve how to perform key negotiation under the CCA architecture.
  • the present application provides a method for key negotiation, including: after a first vehicle integration unit VIU negotiates a first random number in common with other VIUs in an in-vehicle electronic control system, determining a first random number according to the first random number. Two random numbers, a temporary shared key and a temporary common private key, and generate a temporary common public key according to the temporary common private key, the first VIU uses the second random number, the temporary common public key and the device private key preset by the first VIU, Authenticate and negotiate the communication key and random number seed with the first DC, the first DC is a DC in the electronic control system in the vehicle, and the first VIU communicates with the first VIU according to the random number seed and the authentication key preset by the first VIU.
  • the electronic control unit ECU performs authentication and negotiates the communication encryption key and the communication authentication key. After the first VIU determines that the authentication with the first ECU is successful, the communication encryption key and the communication authentication key are encrypted by the communication key and sent to the first VIU. DC.
  • the second random number and the temporary shared key are determined according to the first random number and the temporary common private key, and generate the temporary common public key according to the temporary common private key. Since the second random number, temporary shared key and temporary common key are shared by all VIUs, the DC and any one of the VIUs can negotiate the same communication key and random number seed. The same communication key can be used for secure communication without establishing a secure communication connection between the DC and each VIU.
  • the first VIU authenticates and negotiates the communication encryption key and the communication authentication key with the first ECU according to the random number seed and the authentication key preset by the VIU, and finally encrypts the communication encryption key and the communication authentication key with the communication key
  • the communication encryption key and the communication authentication key are used to establish secure communication between each DC and each ECU. In this way, the key negotiation under the CCA architecture is realized, which ensures the establishment of secure communication between each DC and each ECU.
  • the first VIU authenticates and negotiates the communication key and random number seed with the first domain control unit DC according to the second random number, the temporary common public key and the device private key preset by the first VIU, Can be:
  • the first VIU receives the third random number, the temporary public key and the signature value sent by the first DC;
  • the first VIU verifies the signature value according to the device public key, the third random number and the temporary public key of the first DC;
  • the digital signature value is calculated according to the second random number, the temporary common public key and the device private key of the first VIU;
  • the first VIU sends the second random number, the temporary common public key and the digital signature value to the first DC, so that the first DC can digitally sign the value according to the second random number, the temporary common public key and the device public key of the first VIU Perform verification, and determine the communication key according to the temporary private key and the temporary common public key after the verification is successful;
  • the first VIU determines the communication key according to the temporary private key and the temporary common public key, and determines the random number seed according to the third random number and the second random number, or according to the functions of the third random number, the second random number and the first VIU
  • the domain ID determines the random number seed.
  • the random number seed is the first VIU according to the third random number.
  • the random number, the second random number, and the functional domain identifiers of the first VIU are determined, and the identifiers of different functional domains are different, so the random number seeds corresponding to different functional domains are different.
  • the random number seed is used for key distribution between the VIU and ECU. Different random number seeds are used when distributing keys to ECUs in different functional domains, which can realize different communication encryption keys and communication authentication keys in different functional domains, reducing the need for The scope of use of the key is increased, and the security is higher.
  • the method may further include:
  • the first VIU calculates the first check value according to the third random number, the temporary public key and the temporary shared key
  • the first VIU sends the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system for other VIUs to calculate according to the third random number, the temporary public key and the temporary shared key
  • the second check value and when it is confirmed that the first check value is the same as the second check value, the communication key is determined according to the temporary public key and the temporary common private key, and the communication key is determined according to the third random number and the second random number.
  • the random number seed is determined according to the random number seed, or the random number seed is determined according to the third random number, the second random number and the functional domain identifiers of other VIUs.
  • the first VIU root random number seed and the authentication key preset by the first VIU perform authentication with the first ECU and negotiate the communication encryption key and communication authentication key, which may be:
  • the first VIU receives the fourth random number sent by the first ECU
  • the first VIU performs authentication with the first ECU and negotiates the communication encryption key and the communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU.
  • the first VIU performs authentication with the first ECU and negotiates the communication encryption key and the communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU, and can for:
  • the first VIU calculates the third check value according to the fourth random number, the random number seed and the authentication key preset by the first VIU;
  • the first VIU sends the random number seed and the third verification value to the first ECU for the first ECU to authenticate the third verification value
  • the first VIU receives the first message authentication code and the second message authentication code sent by the first ECU after passing the authentication of the third verification value.
  • the first message authentication code is preset by the first ECU according to the random number seed and the first ECU.
  • the authentication key is calculated and obtained, and the second message authentication code is calculated and obtained by the first ECU according to the communication encryption key and the communication authentication key;
  • the first VIU determines the communication encryption key and the communication authentication key according to the long-term shared key and random number seed preset by the first VIU;
  • the first VIU authenticates the first message authentication code and the second message authentication code.
  • the first VIU authenticates the first message authentication code and the second message authentication code, which may be:
  • the first VIU calculates the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and calculates the fourth message authentication code according to the communication encryption key and the communication authentication key;
  • the first VIU compares the first message authentication code with the third message authentication code, and compares the second message authentication code with the fourth message authentication code;
  • the first VIU is determined to be successfully certified with the first ECU, including:
  • the first VIU determines that the authentication with the first ECU is successful.
  • the key and the random number distributed by the first VIU to the ECU are The seed is related to the seed, and the random number seed is related to the functional domain identification. Therefore, the communication encryption key and communication authentication key distributed by the first VIU to the ECU are distinguished by functional domain.
  • the communication encryption key and communication authentication key in different functional domains are different. Different communication encryption keys and communication authentication keys in different functional domains can be realized, which reduces the use range of keys and provides higher security.
  • the communication encryption key and the communication authentication key are encrypted by the communication key and sent to the first DC, which may be:
  • the first VIU encrypts the communication encryption key and the communication authentication key through the communication key to obtain encrypted ciphertext
  • the first VIU sends the second message authentication code and the encrypted ciphertext to the first DC.
  • the first DC does not need to store the long-term shared key, but at the end of the entire negotiation process, the first VIU encrypts and sends the communication encryption key and the communication authentication key to the first DC. DC, so as to avoid the leakage of the vehicle-wide shared key GK due to the attack of the DC.
  • the present application provides a key agreement method, including:
  • the first domain control unit DC generates a temporary private key and a third random number, and generates a corresponding temporary public key according to the temporary private key, and the first DC is a DC in the in-vehicle electronic control system; the first DC is based on the temporary public key, The third random number and the device private key preset by the first DC authenticate with the first vehicle integration unit VIU and negotiate the communication key; the first DC receives the communication encryption key encrypted by the communication key sent by the first VIU key and communication authentication key, the communication encryption key and communication authentication key are obtained by the first VIU through authentication and negotiation with the first ECU according to the random number seed and the authentication key preset by the first VIU.
  • a temporary private key and a third random number are generated by the first DC, and a corresponding temporary public key is generated according to the temporary private key, and the first DC is based on the temporary public key, the third random number and the
  • the device private key preset by the first DC authenticates and negotiates a communication key with the first VIU, and finally the first DC receives the communication encryption key and the communication authentication key encrypted by the communication key sent by the first VIU, and communicates Encryption keys and communication authentication keys are used to establish secure communication between each DC and each ECU.
  • the key negotiation under the CCA architecture is realized, which ensures the establishment of secure communication between each DC and each ECU.
  • the first DC authenticates and negotiates a communication key with the first vehicle integration unit VIU according to the temporary public key, the third random number and the device private key preset by the first DC, which may be:
  • the first DC uses the device private key preset by the first DC to digitally sign the temporary public key and the third random number to obtain a signature value
  • the first DC sends the temporary public key, the third random number and the signature value to the first VIU;
  • the first DC receives the second random number, the temporary common public key and the digital signature value sent by the first VIU, and the digital signature value is the device private key preset by the first VIU according to the second random number, the temporary common public key and the first VIU Calculated, the second random number is determined by the first VIU according to the first random number, and the first random number is a common random number negotiated by the first VIU and other VIUs in the in-vehicle electronic control system;
  • the first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU;
  • the communication key is determined according to the temporary private key and the temporary common public key.
  • the first random number is a common random number negotiated by the first VIU and other VIUs in the in-vehicle electronic control system, and the second random number, the temporary shared key and the temporary shared private key
  • the key is determined by the first VIU according to the first random number, so the second random number, the temporary shared key and the temporary shared key are shared by all VIUs, and the DC can negotiate with any one of the VIUs to negotiate the same communication key and random number.
  • the DC and each VIU can use the same communication key for secure communication without establishing a secure communication connection between the DC and each VIU.
  • the present application provides a key agreement device, including:
  • the determining module is used to determine the second random number, the temporary shared key and the temporary common private key according to the first random number after negotiating the common first random number with other VIUs in the in-vehicle electronic control system, and according to the temporary common
  • the private key generates a temporary common public key
  • the first authentication negotiation module is used to authenticate and negotiate the communication key and random number seed with the first domain control unit DC according to the second random number, the temporary common public key and the device private key preset by the first VIU, and the first DC It is a DC in the electronic control system in the car;
  • the second authentication negotiation module is configured to perform authentication with the first electronic control unit ECU and negotiate the communication encryption key and the communication authentication key according to the random number seed and the authentication key preset by the first VIU;
  • the sending module after determining that the authentication with the first ECU is successful, encrypts the communication encryption key and the communication authentication key with the communication key and sends them to the first DC.
  • the first authentication negotiation module includes:
  • a receiving unit configured to receive the third random number, the temporary public key and the signature value sent by the first DC;
  • a verification unit configured to verify the signature value according to the device public key, the third random number and the temporary public key of the first DC;
  • a calculation unit configured to calculate the digital signature value according to the second random number, the temporary common public key and the device private key of the first VIU after the signature value is verified and passed;
  • the sending unit is configured to send the second random number, the temporary common public key and the digital signature value to the first DC, for the first DC to pair the digital data with the second random number, the temporary common public key and the device public key of the first VIU
  • the signature value is verified, and after the verification is successful, the communication key is determined according to the temporary private key and the temporary common public key;
  • a determination unit configured to determine the communication key according to the temporary private key and the temporary common public key, and determine the random number seed according to the third random number and the second random number, or determine the random number seed according to the third random number, the second random number and the first VIU
  • the functional domain identifier determines the random number seed.
  • the computing unit is further configured to: after the sending unit sends the second random number, the temporary public public key and the digital signature value to the first DC, according to the third random number, the temporary public key and the temporary shared The key calculates the first check value;
  • the sending unit is also used for: sending the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system, for the other VIUs to share according to the third random number, the temporary public key and the temporary sharing
  • the key calculates the second check value, and when it is confirmed that the first check value is the same as the second check value, the communication key is determined according to the temporary public key and the temporary common private key, and the communication key is determined according to the third random number and the second random number.
  • the random number seed is determined according to the random number seed, or the random number seed is determined according to the third random number, the second random number and the functional domain identifiers of other VIUs.
  • the second authentication negotiation module includes:
  • a receiving unit configured to receive the fourth random number sent by the first ECU
  • the authentication negotiation unit is configured to perform authentication with the first ECU and negotiate the communication encryption key and the communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU.
  • the authentication negotiation unit is used to:
  • the first message authentication code is the authentication key preset by the first ECU according to the random number seed and the first ECU Calculated, the second message authentication code is calculated by the first ECU according to the communication encryption key and the communication authentication key;
  • the first message authentication code and the second message authentication code are authenticated.
  • the authentication negotiation unit is used to:
  • the authentication negotiation module is used to:
  • first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, it is determined that the authentication with the first ECU is successful.
  • the transmit module is used to:
  • the present application provides a key agreement apparatus, including:
  • the generation module is used to generate a temporary private key and a third random number, and generate a corresponding temporary public key according to the temporary private key, and the first DC is a DC in the electronic control system in the vehicle;
  • the authentication negotiation module is used to authenticate and negotiate the communication key with the first vehicle integration unit VIU according to the temporary public key, the third random number and the device private key preset by the first DC;
  • the receiving module is configured to receive the communication encryption key and the communication authentication key encrypted by the communication key and sent by the first VIU.
  • the set authentication key is obtained through authentication and negotiation with the first ECU.
  • the authentication negotiation module includes:
  • a digital signature unit for digitally signing the temporary public key and the third random number using the device private key preset by the first DC to obtain a signature value
  • a sending unit configured to send the temporary public key, the third random number and the signature value to the first VIU;
  • a receiving unit configured to receive a second random number, a temporary common public key and a digital signature value sent by the first VIU, where the digital signature value is a device preset by the first VIU according to the second random number, the temporary common public key and the first VIU The private key is calculated and obtained, the second random number is determined by the first VIU according to the first random number, and the first random number is a common random number negotiated by the first VIU and other VIUs in the in-vehicle electronic control system;
  • a verification unit configured to verify the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU;
  • the determining unit is configured to determine the communication key according to the temporary private key and the temporary common public key after the verification unit passes the verification of the digital signature value.
  • the present application provides a key agreement apparatus, including: a memory and a processor;
  • memory is used to store program instructions
  • the processor is configured to invoke the program instructions in the memory to execute the key agreement method in the first aspect and any possible design of the first aspect.
  • the present application provides a readable storage medium, in which an execution instruction is stored, and when at least one processor of the key agreement apparatus executes the execution instruction, the key agreement apparatus executes the first aspect and the first aspect.
  • an execution instruction is stored, and when at least one processor of the key agreement apparatus executes the execution instruction, the key agreement apparatus executes the first aspect and the first aspect.
  • the present application provides a program product, the program product includes execution instructions, and the execution instructions are stored in a readable storage medium.
  • At least one processor of the key agreement apparatus may read the execution instruction from the readable storage medium, and the at least one processor executes the execution instruction to cause the key agreement apparatus to implement the first aspect and any possible design of the first aspect. method.
  • FIG. 1 is a schematic structural diagram of an in-vehicle electronic control system of a CCA architecture
  • FIG. 2 is an interactive flowchart of an embodiment of a key agreement method provided by the present application
  • FIG. 3 is a schematic flowchart of an embodiment of a first VIU and a first DC performing pairwise authentication and negotiating a communication key and a random number seed according to the present application;
  • FIG. 4 is a schematic flowchart of an embodiment of a first VIU and a first ECU performing authentication and negotiating a communication encryption key and a communication authentication key according to the present application;
  • FIG. 5 is an interactive flowchart of an embodiment of a key agreement method provided by the present application.
  • FIG. 6 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application.
  • FIG. 7 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application.
  • FIG. 8 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application.
  • FIG. 9 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application.
  • FIG. 10 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application.
  • FIG. 11 is a schematic diagram of a key agreement apparatus provided by this application.
  • words such as “exemplary” or “for example” are used to represent any embodiment or solution described as “exemplary” or “for example” in the embodiments of the present application It should not be construed as preferred or advantageous over other embodiments or arrangements. Rather, the use of words such as “exemplary” or “such as” is intended to present the related concepts in a specific manner.
  • “at least one” means one or more, and “plurality” means two or more.
  • “And/or”, which describes the association relationship of the associated objects, indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the associated objects are an "or" relationship.
  • FIG. 1 is a schematic diagram of the structure of an in-vehicle electronic control system with a CCA architecture, as shown in Figure 1.
  • VIU0, VIU1 , VIU2 and VIU3, 4 VIUs are interconnected through high-speed Ethernet, each VIU manages ECUs in one area, and each VIU is connected to ECUs in one area through a bus, such as VIU0 through a bus to connect ECU0, ECU1, ECU2 and ECU3, VIU1 connects ECU5, ECU6, ECU7 and ECU8 through a bus, VIU2 connects ECU13, ECU14, ECU15 and ECU16 through a bus, VIU3 connects ECU9, ECU10, ECU11 and ECU12 through a bus, VIU0 and VIU3 are both connected to DC1 , both VIU1 and VIU2 are connected to DC2.
  • the VIU deployed in each region is responsible for distributing the shared key between the ECUs and the DCs, so that secure communication can
  • the electronic control components involved in this application mainly include VIU, ECU and DC. It is understood that the number of VIU, ECU and DC is one or more, which are represented by ECU i , VIU j and DC k respectively, where i, j and k are positive integers, which are the numbers of VIU, ECU, and DC, respectively.
  • Security credentials are preset and stored in ECU i , VIU j and DC k . Specifically, the security credentials preset in ECU i are a long-term shared key GK and an authentication key K i .
  • the pre-set security credentials in VIU j are the device private key sk VIUj , the device certificate Cert VIUj (which includes the device public key pk VIUj ), the root certificate Cert 0 (unified for the whole vehicle, used to verify the legitimacy of the device certificate), the long-term shared secret key GK and the authentication key K i corresponding to the authentication key K i preset in the ECU i , or the security credential preset in the VIU j is the device private key sk VIUj , the device public key or the device public key of DC k Hash value, root certificate Cert 0 (unified for the whole vehicle, used to verify the validity of the device certificate), long-term shared key GK and authentication key K i corresponding to the authentication key K i preset in ECU i .
  • the security credentials preset in the DC k are the device private key sk DCk , the device certificate Cert DCk (which contains the device public key pk DCk ), and the root certificate Cert 0 (unified throughout the vehicle, used to verify the validity of the device certificate). Based on these pre-set security credentials, authentication, negotiation and distribution of authentication keys and encryption keys between VIU and VIU, between VIU and DC, and between VIU and ECU for each DC and each ECU Ability to establish secure communication.
  • the random number seed S received by all ECUs and DCs in the whole vehicle in the process of generating the communication key is the same, so as to ensure that all ECUs and DCs in the whole vehicle share the same communication key.
  • the central gateway is replaced by multiple VIUs, and S is randomly generated every time the key is updated, so the uniqueness of S cannot be guaranteed, so the existing solution is not applicable to the CCA architecture.
  • the present application provides a method and device for key negotiation, by first completing multi-party key negotiation among N VIUs under the CCA architecture at the beginning of the key update process, to obtain the first key agreement shared by the N VIUs.
  • each VIU derives a second random number, a temporary shared key and a temporary common key according to the first random number. Since the second random number, the temporary shared key and the temporary common key are shared by all VIUs, The same communication key and random number seed can be negotiated between the DC and any of the VIUs. After the negotiation is completed, the DC and each VIU can use the same communication key for secure communication. Establish a secure communication connection.
  • each VIU authenticates and negotiates the communication encryption key and communication authentication key with the ECU or other ECUs in its management area according to the random number seed and the authentication key preset by the VIU, and finally converts the communication encryption key and communication authentication key
  • the communication encryption key and the communication authentication key are used to establish secure communication between each DC and each ECU.
  • the key negotiation under the CCA architecture is realized, which ensures the establishment of secure communication between each DC and each ECU.
  • FIG. 2 is an interaction flowchart of an embodiment of a key agreement method provided by the present application. As shown in FIG. 2 , the method of this embodiment may include:
  • the first VIU negotiates with other VIUs in the in-vehicle electronic control system to negotiate a common first random number, determine a second random number, a temporary shared key and a temporary common private key according to the first random number, and determine a second random number, a temporary shared key and a temporary common private key according to the first random number, The private key generates a temporary common public key.
  • the first VIU is any VIU in the electronic control system, and all the VIUs in the electronic control system can use the multi-party key agreement protocol to perform multi-party key negotiation to negotiate a common first random number
  • Any common multi-party key agreement protocol can be used, such as the multi-party key exchange protocol (Elliptic Curve Diffie–Hellman ECDH) protocol.
  • the first VIU determines the second random number, the temporary shared key and the temporary common private key according to the first random number, which may be derived from the first random number R to obtain the second random number, the temporary shared key and the temporary common private key, which may The second random number, the temporary shared key and the temporary shared private key are derived from the first random number R through the key derivation function.
  • the calculation process is: (nonce
  • eSK) KDF(R), where KDF is the key derivation function, which can generate data of any length according to the input data, nonce is the second random number, Key VIU is the temporary shared key, eSK is the temporary common private key, and then, according to The temporary common private key eSK generates a temporary common public key ePK.
  • the temporary shared key Key VIU is used for secure communication among all VIUs, and the temporary common private key eSK and the temporary common public key ePK are used for key negotiation between each VIU and each DC.
  • the key negotiation between each VIU and each DC uses the same ephemeral private key eSK and ephemeral public key ePK, so all VIUs and DCs negotiate the same key.
  • the first random number, the second random number, the temporary common private key, and the temporary common public key shared by multiple VIUs in the vehicle through negotiation are logically unified to the outside world, and the DC does not need to care about the specific deployment details of the VIUs (such as number, distribution location, connected ECUs, etc.) to decouple the authentication negotiation processing logic of the DC from the actual deployment details of the VIU, simplifying the processing logic.
  • the first DC generates a temporary private key and a third random number, and generates a corresponding temporary public key according to the temporary private key.
  • the first DC is a DC in the in-vehicle electronic control system, that is, any DC.
  • the first VIU authenticates and negotiates a communication key and a random number seed with the first DC according to the second random number, the temporary common public key, and the device private key preset by the first VIU.
  • the random number seed Seed kD is used for the communication key distribution of the first ECU in the first VIU management area.
  • the first DC and any VIU can negotiate the same communication key and random number seed. After the negotiation is completed, the first DC and each VIU can The same communication key can be used for secure communication, eliminating the need to establish multiple secure connections.
  • the first VIU authenticates and negotiates the communication key and random number seed with the first DC according to the second random number, the temporary common public key and the device private key preset by the first VIU, which may be:
  • the first VIU receives the third random number, the temporary public key and the signature value sent by the first DC.
  • the first VIU verifies the signature value according to the device public key, the third random number, and the temporary public key of the first DC.
  • the first VIU verifies the signature value according to the device public key, the third random number, and the temporary public key of the first DC, and there are three possible ways. It is a method of pre-storing the device public key of the first DC. In the third method, the device public key or device public key hash value of the first DC is pre-stored in the first VIU, and the first VIU verifies the received device public key of the first DC. The way. The following is a detailed description:
  • Manner 1 The first VIU receives the third random number, the temporary public key, the signature value and the device certificate of the first DC sent by the first DC, where the device public key of the first DC is included in the device certificate of the first DC.
  • the first VIU verifies the validity of the device certificate of the first DC according to the root certificate preset by the first VIU, and verifies the signature value according to the third random number and the temporary public key.
  • Manner 2 The first VIU receives the third random number, the temporary public key and the signature value sent by the first DC.
  • the first VIU verifies the signature value according to the pre-stored device public key of the first DC, the third random number and the temporary public key.
  • Manner 3 The first VIU receives the third random number, the temporary public key, the signature value and the device public key of the first DC sent by the first DC.
  • the first VIU verifies the received device public key of the first DC according to the pre-stored device public key of the first DC or the hash value of the device public key.
  • the device public key verifies the signature value.
  • the first VIU sends the second random number, the temporary common public key and the digital signature value to the first DC.
  • the first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU, and after the verification of the digital signature value is passed, determines the communication password according to the temporary private key and the temporary common public key. key.
  • the first DC may also be a communication key determined according to the temporary private key, the temporary common public key, and other information, where other information may be, for example, the identity of the first VIU, the identity of the first DC, and the identity of the vehicle any of the.
  • the manner in which the first DC obtains the device public key of the first VIU is the same as that of the first DC in S1032.
  • the way the VIU obtains the device public key of the first DC is similar, and there are three possible ways, which are described in detail below:
  • Mode 1 The first DC receives the second random number, the temporary common public key, the digital signature value and the device certificate preset by the first VIU sent by the first VIU, and the device public key of the first VIU is included in the preset device certificate of the first VIU. in the device certificate.
  • the first DC verifies the validity of the device certificate of the first VIU according to the root certificate preset by the first DC, and verifies the digital signature value according to the second random number and the temporary common public key.
  • Manner 2 The first DC receives the second random number, the temporary common public key and the digital signature value sent by the first VIU.
  • the first DC verifies the digital signature value according to the pre-stored device public key of the first VIU, the second random number and the temporary common public key.
  • Manner 3 The first DC receives the second random number, the temporary common public key, the digital signature value, and the device public key of the first VIU sent by the first VIU.
  • the first DC verifies the received device public key of the first VIU according to the pre-stored device public key of the first VIU or the hash value of the device public key.
  • the device's public key verifies the digital signature value.
  • the first VIU determines the communication key according to the temporary private key and the temporary common public key, and determines the random number seed according to the third random number and the second random number, or determines the random number seed according to the third random number, the second random number and the first VIU
  • the functional domain identifier determines the random number seed.
  • the first DC authenticates and negotiates a communication key with the first VIU according to the temporary public key, the third random number, and the device private key preset by the first DC.
  • the communication key is used for secure communication between the first VIU and the first DC.
  • S103 may also be that the first DC performs a communication with the first VIU according to the temporary public key, the third random number, the device certificate preset by the first DC, and the device private key preset by the first DC Authentication, negotiate a communication key with the first VIU after successful authentication.
  • the first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU, and after successful verification, determines the communication key according to the temporary private key and the temporary common public key.
  • the first VIU authenticates with the first ECU according to the random number seed and the authentication key preset by the first VIU, and negotiates the communication encryption key and the communication authentication key.
  • the first ECU may be an ECU in the management area of the first VIU, or may be other ECUs.
  • the first VIU may also perform authentication with the first ECU and negotiate the communication encryption key and the communication authentication key according to the identifier of the first VIU, the random number seed and the authentication key preset by the first VIU.
  • the communication encryption key and the communication authentication key are encrypted by the communication key and then sent to the first DC.
  • the first VIU sends the communication encryption key and the communication authentication key to the first DC after encrypting the communication key, which may be:
  • the first VIU encrypts the communication encryption key and the communication authentication key with the communication key to obtain an encrypted ciphertext, and the first VIU sends the second message authentication code and the encrypted ciphertext to the first DC.
  • the identifier of the first ECU may also be sent at the same time.
  • the first DC does not need to store the long-term shared key, but at the end of the entire negotiation process, the first VIU encrypts and sends the communication encryption key and the communication authentication key to the first DC, thereby avoiding The attack on the DC led to the disclosure of the vehicle-wide shared key GK.
  • the second random number, the temporary shared key and the key are determined according to the first random number.
  • the temporary common private key is generated, and the temporary common public key is generated according to the temporary common private key. Since the second random number, temporary shared key and temporary common key are shared by all VIUs, the DC and any one of the VIUs can negotiate the same communication key and random number seed. The same communication key can be used for secure communication without establishing a secure communication connection between the DC and each VIU.
  • the first VIU authenticates and negotiates the communication encryption key and the communication authentication key with the first ECU according to the random number seed and the authentication key preset by the VIU, and finally encrypts the communication encryption key and the communication authentication key with the communication key
  • the communication encryption key and the communication authentication key are used to establish secure communication between each DC and each ECU. In this way, the key negotiation under the CCA architecture is realized, which ensures the establishment of secure communication between each DC and each ECU.
  • FIG. 3 is the present application.
  • the method of this embodiment may include:
  • the first DC uses the device private key preset by the first DC to digitally sign the temporary public key and the third random number to obtain a signature value.
  • the signature value Sig k Sign(rk
  • the first DC sends the temporary public key, the third random number, the signature value, and the device public key of the first DC to the first VIU.
  • the first VIU verifies the received device public key of the first DC according to the pre-stored device public key of the first DC or the hash value of the device public key, and after the verification is successful, according to the third random number, the temporary public key and the first The DC's device public key verifies the signature value.
  • S202 may be: the first DC sends the temporary public key, the third random number and the signature value to the first VIU.
  • S203 may be: the first VIU verifies the signature value according to the pre-stored device public key of the first DC, the third random number, and the temporary public key.
  • S202 may be: the first DC sends the third random number, the temporary public key, the signature value and the device certificate preset by the first DC to the first VIU.
  • S203 may be: the first VIU verifies the validity of the device certificate of the first DC according to the root certificate preset by the first VIU, and verifies the signature value according to the third random number and the temporary public key.
  • the digital signature value is calculated according to the second random number, the temporary common public key, and the device private key of the first VIU.
  • S205 The first VIU sends the second random number, the temporary common public key and the digital signature value to the first DC.
  • the first VIU determines the communication key according to the temporary private key and the temporary common public key, and determines the random number seed according to the third random number and the second random number, or determines the random number seed according to the third random number, the second random number and the first VIU
  • the functional domain identifier determines the random number seed.
  • the second random number As determined from the functional domain identifier of the first VIU, the identifiers of different functional domains are different, so the random number seeds corresponding to different functional domains are different.
  • the random number seed is used for key distribution between the VIU and ECU. Different random number seeds are used when distributing keys to ECUs in different functional domains, which can realize different communication encryption keys and communication authentication keys in different functional domains, reducing the need for The scope of use of the key is increased, and the security is higher.
  • the first VIU may also determine the communication key according to the temporary private key and the temporary common public key, and determine the random number seed according to the third random number and the second random number, that is to say, the random number seed is also It may not be distinguished by functional domain.
  • the first DC verifies the digital signature value according to the pre-stored device public key of the first VIU, the second random number, and the temporary common public key, and after successful verification, determines the communication key according to the temporary private key and the temporary common public key.
  • the first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU. If the verification fails, the key update process is stopped;
  • the Key VDk is used for secure communication between the first DC and each VIU, where HASH is a hash operation.
  • S205 may be: the first VIU sends the device public key, the second random number, the temporary common public key and the digital signature value of the first VIU to the first DC.
  • S207 may be: the first DC verifies the received device public key of the first VIU according to the pre-stored device public key of the first VIU or the hash value of the device public key, and after the verification is successful, according to the second random number, temporary The digital signature value is verified by the common public key and the device public key of the first VIU.
  • S205 may be: the first VIU sends the device certificate, the second random number, the temporary common public key and the digital signature value preset by the first VIU to the first DC, and the first VIU's The device public key is included in the device certificate preset by the first VIU.
  • S207 may be: the first DC verifies the validity of the device certificate of the first VIU according to the root certificate preset by the first DC, and verifies the digital signature value according to the second random number and the temporary common public key.
  • the method of this embodiment may further include:
  • the first VIU calculates the first check value according to the third random number, the temporary public key, and the temporary shared key.
  • the first VIU sends the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system.
  • Other VIUs calculate the second check value according to the third random number, the temporary public key and the temporary shared key, and when confirming that the first check value is the same as the second check value, calculate the second check value according to the temporary public key and the temporary shared key.
  • the private key determines the communication key, and simultaneously determines the random number seed according to the third random number and the second random number, or simultaneously determines the random number seed according to the third random number, the second random number and the functional domain identifiers of other VIUs.
  • other VIUs calculate the random number seed Seed kD according to the third random number r k , the second random number nonce and the functional domain identifier DID of other VIUs.
  • FIG. 4 is provided for this application.
  • the first ECU generates a fourth random number.
  • the first ECU sends the fourth random number to the first VIU, and the first VIU is directly connected to the first ECU.
  • the first ECU may also send the identifier of the first ECU to the first VIU.
  • the first VIU calculates a third check value according to the fourth random number, the random number seed, and the authentication key preset by the first VIU.
  • the first VIU may also calculate the third check value according to the identifier of the first VIU, the identifier of the first ECU, the fourth random number, the random number seed, and the authentication key preset by the first VIU. If the identification of the first VIU and the identification of the first ECU are added, the accuracy will be higher.
  • the first VIU sends the random number seed and the third check value to the first ECU.
  • the identifier of the first VIU may also be sent.
  • the first ECU authenticates the third verification value.
  • the first ECU After the first ECU passes the authentication on the third verification value, it sends the first message authentication code and the second message authentication code to the first VIU, where the first message authentication code is the first ECU pre-predicted according to the random number seed and the first ECU.
  • the second message authentication code is calculated by the first ECU according to the communication encryption key and the communication authentication key, or the first message authentication code is calculated by the first ECU according to the first ECU's identification, random number
  • the seed and the authentication key preset by the first ECU are calculated, and the second message authentication code is calculated by the first ECU according to the identification of the first ECU, the communication encryption key and the communication authentication key.
  • the first VIU determines the communication encryption key and the communication authentication key according to the long-term shared key and random number seed preset by the first VIU.
  • S307 may be: the first VIU obtains the communication encryption key EK and the communication authentication key AK by calculating the key derivation function KDF according to the long-term shared key GK and the random number seed Seed kD preset in the first VIU, specifically is (EK
  • AK) KDF(Seed kD , GK).
  • the first VIU authenticates the first message authentication code and the second message authentication code.
  • the first VIU authenticates the first message authentication code and the second message authentication code, which may specifically be: the first VIU calculates the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and The fourth message authentication code is calculated according to the communication encryption key and the communication authentication key, and the first VIU compares the first message authentication code with the third message authentication code, and compares the second message authentication code with the fourth message authentication code right.
  • the first VIU determines that the authentication with the first ECU is successful, specifically: if the first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, the first VIU determines that the authentication code is the same as the third message authentication code. An ECU authentication is successful.
  • the key distributed by the first VIU to the ECU is related to the random number seed Seed kD
  • the Seed kD is related to the functional domain identifier. Therefore, the communication encryption key and communication authentication key distributed by the first VIU to the ECU are determined by function Domain distinction, the communication encryption key and communication authentication key in different functional domains are different, and the communication encryption key and communication authentication key in different functional domains can be different, which reduces the use range of the key and provides higher security.
  • FIG. 5 is an interaction flow chart of an embodiment of a key agreement method provided by this application.
  • Example methods could include:
  • the first VIU performs multi-party key negotiation with other VIUs in the in-vehicle electronic control system to obtain a first random number R shared by the four VIUs in the in-vehicle electronic control system.
  • all VIUs in the electronic control system can use the multi-party key agreement protocol for multi-party key agreement, and can use any common multi-party key agreement protocol, such as the multi-party key exchange protocol (Elliptic Curve Diffie–Hellman ECDH) protocol.
  • the multi-party key exchange protocol Elliptic Curve Diffie–Hellman ECDH
  • the first VIU derives a second random number, a temporary shared key and a temporary common private key according to the first random number R, and generates a temporary common public key according to the temporary common private key.
  • the first VIU can derive the second random number, the temporary shared key and the temporary common private key according to the first random number R through a key derivation function, and the calculation process is: (nonce
  • eSK) KDF(R), where KDF is the key derivation function, which can generate data of any length according to the input data, nonce is the second random number, Key VIU is the temporary shared key, and eSK is the temporary The common private key is then used to generate a temporary common public key ePK according to the temporary common private key eSK.
  • the temporary shared key Key VIU is used for secure communication between all VIU j
  • the temporary common private key eSK and the temporary common public key ePK are used for key negotiation between VIU j and DC k . All key negotiations between VIU j and DC k use the same ephemeral private key eSK and ephemeral public key ePK, so all VIU j and DC k negotiate the same key.
  • the first VIU and the first DC perform authentication and negotiate a communication key and a random number seed Seed kD
  • the first DC is connected to the first VIU
  • the communication key is used for secure communication between the first VIU and the first DC
  • the random number seed Seed kD is used for the communication key distribution of the first ECU in the first VIU management area.
  • the first VIU and the first DC perform authentication and negotiate a communication key and a random number seed, which may specifically include:
  • the first DC randomly generates a temporary private key eSK k and a third random number r k , and generates a corresponding temporary public key ePK k according to the temporary private key eSK k .
  • the first DC sends the temporary public key ePK k , the third random number r k , the signature value Sig k and the device certificate Cert DCk preset by the first DC to the first VIU.
  • the first VIU After receiving the temporary public key ePK k , the third random number r k , the signature value Sig k and the device certificate Cert DCk preset by the first DC, the first VIU verifies the first VIU according to the root certificate Cert 0 preset by the first VIU The validity of the device certificate Cert DCk of a DC, and then the signature value Sig k is verified according to the third random number r k and the temporary public key ePK k . If the verification fails, the key update process is stopped.
  • the first VIU sends the second random number nonce, the temporary common public key ePK, the digital signature value Sig 0 , and the device certificate Cert VIUj0 of the first VIU to the first DC.
  • the first VIU sends the third random number rk , the temporary public key ePK k and the first check value MAC k to other VIUs .
  • Seed kD HASH(r k
  • the first VIU and the first ECU perform authentication and generate a communication encryption key EK and a communication authentication key AK.
  • the first ECU is an ECU in the management area of the first VIU, and it can be understood that the number of the first ECU is at least one.
  • S404 may include:
  • the first ECU generates a fourth random number Ri, and sends the fourth random number Ri and the identification ID i of the first ECU to the first VIU directly connected to the first ECU.
  • the first ECU obtains the communication encryption key by calculating the key derivation function KDF according to the long-term shared key GK and the random number seed Seed kD preset in the first ECU EK and communication authentication key AK, specifically (EK
  • K i ), MAC3 HASH(ID i
  • the first VIU After receiving the first message authentication code MAC2 and the second message authentication code MAC3, the first VIU obtains the communication through the key derivation function KDF according to the preset long-term shared key GK and random number seed Seed kD in the first VIU
  • the encryption key EK and the communication authentication key AK are specifically (EK
  • AK) KDF(Seed kD , GK).
  • the first VIU assists the first DC to generate a consistent communication encryption key EK and communication authentication key AK, and completes the communication key consistency check.
  • S405 may include:
  • the first VIU sends the identifier ID i of the first ECU, the second message authentication code MAC3 and the encrypted ciphertext Enc(EK
  • FIG. 6 is a schematic structural diagram of an embodiment of a key negotiation apparatus provided by the present application.
  • the apparatus of this embodiment may include: a determination module 11 , a first authentication negotiation module 12 , and a second authentication negotiation module 13 and sending module 14, wherein,
  • the determination module 11 is used to determine the second random number, the temporary shared key and the temporary shared private key according to the first random number after negotiating with other VIUs in the in-vehicle electronic control system to obtain a shared first random number, and according to the temporary shared key.
  • the private key generates a temporary common public key;
  • the first authentication negotiation module 12 is configured to authenticate and negotiate a communication key and a random number seed with the first domain control unit DC according to the second random number, the temporary common public key and the device private key preset by the first VIU, and the first DC It is a DC in the electronic control system in the car;
  • the second authentication negotiation module 13 is configured to perform authentication with the first electronic control unit ECU and negotiate the communication encryption key and the communication authentication key according to the random number seed and the authentication key preset by the first VIU;
  • the sending module 14 After determining that the authentication with the first ECU is successful, the sending module 14 encrypts the communication encryption key and the communication authentication key with the communication key and sends them to the first DC.
  • FIG. 7 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application.
  • the first authentication negotiation module 12 in the apparatus of this embodiment is It may include: a receiving unit 121, a verification unit 122, a computing unit 123, a sending unit 124 and a determining unit 125, wherein,
  • the receiving unit 121 is configured to receive the third random number, the temporary public key and the signature value sent by the first DC;
  • the verification unit 122 is configured to verify the signature value according to the device public key, the third random number and the temporary public key of the first DC;
  • the calculation unit 123 is used to calculate the digital signature value according to the second random number, the temporary common public key and the device private key of the first VIU after the signature value is verified and passed;
  • the sending unit 124 is configured to send the second random number, the temporary common public key and the digital signature value to the first DC, for the first DC to pair the digital data with the second random number, the temporary common public key and the device public key of the first VIU.
  • the signature value is verified, and after the verification is successful, the communication key is determined according to the temporary private key and the temporary common public key;
  • the determining unit 125 is configured to determine the communication key according to the temporary private key and the temporary common public key, and determine the random number seed according to the third random number and the second random number, or determine the random number seed according to the third random number, the second random number and the first VIU
  • the functional domain identifier determines the random number seed.
  • calculation unit 123 is further configured to: after the sending unit 124 sends the second random number, the temporary public public key and the digital signature value to the first DC, calculate the calculation according to the third random number, the temporary public key and the temporary shared key the first check value;
  • the sending unit 124 is further configured to: send the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system, for the other VIUs to use the third random number, the temporary public key and the temporary
  • the shared key calculates the second check value, and when it is confirmed that the first check value is the same as the second check value, the communication key is determined according to the temporary public key and the temporary common private key, and at the same time according to the third random number and
  • the second random number determines the random number seed, or simultaneously determines the random number seed according to the third random number, the second random number and the functional domain identifiers of other VIUs.
  • FIG. 8 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application. As shown in FIG. 8 , on the basis of the apparatus shown in FIG. 6 or FIG. Taking the basic example as an example, further, the second authentication negotiation module 13 in the apparatus of this embodiment may include: a receiving unit 131 and an authentication negotiation unit 132, wherein,
  • the receiving unit 131 is configured to receive the fourth random number sent by the first ECU;
  • the authentication negotiation unit 132 is configured to perform authentication with the first ECU and negotiate the communication encryption key and the communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU.
  • authentication negotiation unit 132 is used for:
  • the first message authentication code is the authentication key preset by the first ECU according to the random number seed and the first ECU Calculated, the second message authentication code is calculated by the first ECU according to the communication encryption key and the communication authentication key;
  • the first message authentication code and the second message authentication code are authenticated.
  • the authentication negotiation unit 132 is configured to: calculate the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and calculate the fourth message authentication code according to the communication encryption key and the communication authentication key;
  • the second authentication negotiation module 13 is used for:
  • first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, it is determined that the authentication with the first ECU is successful.
  • the sending module 15 is used for:
  • FIG. 9 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application.
  • the apparatus of this embodiment may include: a generating module 21 , an authentication negotiation module 22 and a receiving module 23 , wherein,
  • the generation module 21 is used to generate a temporary private key and a third random number, and generate a corresponding temporary public key according to the temporary private key, and the first DC is a DC in the in-vehicle electronic control system;
  • the authentication negotiation module 22 is configured to authenticate and negotiate a communication key with the first vehicle integration unit VIU according to the temporary public key, the third random number and the device private key preset by the first DC;
  • the receiving module 23 is configured to receive the communication encryption key and the communication authentication key encrypted by the communication key and sent by the first VIU.
  • the set authentication key is obtained through authentication and negotiation with the first ECU.
  • FIG. 10 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application.
  • the authentication negotiation module 22 in the apparatus of this embodiment may include : digital signature unit 221, sending unit 222, receiving unit 223, verifying unit 224 and determining unit 225, wherein,
  • the digital signature unit 221 is used to digitally sign the temporary public key and the third random number using the device private key preset by the first DC to obtain a signature value;
  • the sending unit 222 is configured to send the temporary public key, the third random number and the signature value to the first VIU;
  • the receiving unit 223 is configured to receive the second random number, the temporary common public key and the digital signature value sent by the first VIU, where the digital signature value is the device preset by the first VIU according to the second random number, the temporary common public key and the first VIU
  • the private key is calculated and obtained, the second random number is determined by the first VIU according to the first random number, and the first random number is a common random number negotiated by the first VIU and other VIUs in the in-vehicle electronic control system;
  • the verification unit 224 is configured to verify the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU;
  • the determining unit 225 is configured to determine the communication key according to the temporary private key and the temporary common public key after the verification unit passes the verification of the digital signature value.
  • FIG. 11 is a schematic diagram of a key agreement apparatus provided by this application, and the key agreement apparatus 100 includes:
  • memory 101 for storing computer programs
  • the processor 102 is configured to execute the computer program stored in the memory to implement the key agreement method in the above embodiment. For details, refer to the relevant descriptions in the foregoing method embodiments.
  • the memory 101 may be independent or integrated with the processor 102 .
  • the key agreement apparatus 100 may further include:
  • the bus 103 is used to connect the memory 101 and the processor 102 .
  • this embodiment further includes: a communication interface 104 , where the communication interface 104 can be connected to the processor 102 through the bus 103 .
  • the processor 102 can control the communication interface 103 to realize the above-mentioned acquisition function of the key agreement apparatus 100 .
  • the apparatus may be used to execute each step and/or process in the above method embodiments.
  • the present application further provides a readable storage medium, where an execution instruction is stored in the readable storage medium.
  • an execution instruction is stored in the readable storage medium.
  • the key agreement apparatus executes the execution instructions provided by the above-mentioned various embodiments. Key agreement method.
  • the present application also provides a program product including execution instructions stored in a readable storage medium.
  • At least one processor of the key agreement apparatus can read the execution instruction from the readable storage medium, and the at least one processor executes the execution instruction to cause the key agreement apparatus to implement the key agreement methods provided by the various embodiments described above.
  • all or part of them may be implemented by software, hardware, firmware or any combination thereof.
  • software When implemented in software, it can be implemented in whole or in part in the form of a computer program product.
  • a computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the embodiments of the present invention result in whole or in part.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g. coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.) to another website site, computer, server, or data center.
  • a computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media.
  • Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Power Engineering (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The present application provides a key negotiation method and apparatus. Said method comprises: after negotiating a common first random number with other VIUs in an in-vehicle electronic control system, a first VIU determining a second random number, a temporary shared key and a temporary common private key according to the first random number, and generating a temporary common public key according to the temporary common private key; then according to the second random number, the temporary common public key and a device private key preset by the first VIU, authenticating with a DC and negotiating a communication key and a random number seed; then according to the random number seed and an authentication key preset by the first VIU, authenticating with a first ECU and negotiating a communication encryption key and a communication authentication key; and after determining that the authentication with the first ECU is successful, encrypting the communication encryption key and the communication authentication key by means of the communication key and then sending same to a first DC. Thus, key negotiation under the CCA architecture is implemented, ensuring the establishment of secure communication between each DC and each ECU.

Description

密钥协商方法及装置Key agreement method and device 技术领域technical field
本申请涉及通信技术领域,尤其涉及一种密钥协商方法及装置。The present application relates to the field of communication technologies, and in particular, to a key agreement method and device.
背景技术Background technique
当今,智能化、网联化、电动化、共享化已经成为汽车领域的发展趋势,上述发展趋势通常依赖于车内电子控制系统实现,车内电子控制系统主要包括域控制单元(domain controller,DC)和电子控制单元(electronic control unit,ECU)等电子控制元件。其中,DC用于对功能域内的多个汽车零部件进行控制,ECU具有电子控制功能,可以基于控制信息对汽车零部件进行控制,还可以对汽车零部件中待传输的数据进行数据处理。伴随着汽车网联化和智能化的发展,各种网络安全隐患也随之而来,例如网络攻击、数据泄露甚至远程控制车辆等。因此,车内电子控制系统迫切需要一个完善的密钥管理系统来为车辆和用户提供安全保障。Today, intelligence, networking, electrification, and sharing have become the development trends in the automotive field. The above development trends are usually realized by in-vehicle electronic control systems. The in-vehicle electronic control systems mainly include domain control units (domain controllers, DCs). ) and electronic control units (electronic control unit, ECU) and other electronic control components. Among them, the DC is used to control multiple auto parts in the functional domain, and the ECU has the electronic control function, which can control the auto parts based on the control information, and can also perform data processing on the data to be transmitted in the auto parts. With the development of connected and intelligent vehicles, various network security risks also follow, such as network attacks, data leakage and even remote control of vehicles. Therefore, the in-vehicle electronic control system urgently needs a perfect key management system to provide security for vehicles and users.
密钥管理系统(Key Management System,KMS)是用于生成、分发和管理设备和应用程序的密钥的一种集成手段,在基于中央网关的集中式网络架构中,各个功能域有一个DC,由DC控制域内ECU来完成特定功能,DC之间通过中央网关进行跨域通信交互。现有技术中,在中央网关上部署车载KMS,由车载KMS负责在ECU和DC间分配共享密钥,以便每个DC和每个ECU之间能够建立安全通信。车内ECU生成通信密钥的过程为:首先ECU i生成随机数Ri发送给中央网关,中央网关接收到Ri后生成随机数种子S,接着根据中央网关的标识、ECU i的标识、Ri、S和预先设置的初始密钥K经过哈希运算得到第一消息认证码,然后将第一消息认证码和S发送给ECU i,ECU i先认证第一消息认证码,认证通过后ECU i根据预先设置的长期共享密钥GK和S通过密钥派生函数生成通信密钥,接着ECU i根据中央网关的标识和预先设置的初始密钥K经过哈希运算得到第二消息认证码,并根据中央网关的标识和通信密钥经过哈希运算得到第三消息认证码,最后将第二消息认证码和第三消息认证码发送给中央网关认证。车内DC生成通信密钥的过程与ECU生成通信密钥的过程相同。生成通信密钥基于的随机数种子S由中央网关统一给出,即就是说,全车所有ECU和DC生成通信密钥的过程中接收到的S相同,才能保证全车所有ECU和DC之间共享相同的通信密钥。 Key Management System (KMS) is an integrated means for generating, distributing and managing keys for devices and applications. In a centralized network architecture based on a central gateway, each functional domain has a DC, The ECUs in the DC control domain perform specific functions, and the DCs conduct cross-domain communication and interaction through the central gateway. In the prior art, an on-board KMS is deployed on a central gateway, and the on-board KMS is responsible for distributing a shared key between ECUs and DCs, so that secure communication can be established between each DC and each ECU. The process of generating the communication key by the in-vehicle ECU is as follows: First, ECU i generates a random number Ri and sends it to the central gateway. After receiving Ri, the central gateway generates a random number seed S, and then according to the identification of the central gateway, the identification of ECU i , Ri, S The first message authentication code and the preset initial key K are obtained through hash operation, and then the first message authentication code and S are sent to ECU i . ECU i first authenticates the first message authentication code . The set long-term shared keys GK and S generate the communication key through the key derivation function, and then ECU i obtains the second message authentication code through hash operation according to the identity of the central gateway and the pre-set initial key K, and according to the central gateway The identifier and communication key of the device are subjected to hash operation to obtain the third message authentication code, and finally the second message authentication code and the third message authentication code are sent to the central gateway for authentication. The process of generating the communication key by the in-vehicle DC is the same as the process of generating the communication key by the ECU. The random number seed S on which the communication key is generated is uniformly given by the central gateway, that is to say, all ECUs and DCs in the whole vehicle receive the same S during the process of generating the communication key, so as to ensure the communication between all ECUs and DCs in the whole vehicle. share the same communication key.
然而,为了适应汽车智能化网联化的趋势,车内电子电气架构从基于中央网关的集中式网络架构逐步向分布式的中央计算架构(Central Computing Architecture,CCA)转变。CCA架构将车辆的电子控制元件(包括DC和ECU)分布到多个区域中,每个区域部署一个整车集成单元(Vehicle Integrated/Integration Unit,VIU)负责管理区域中的ECU,VIU之间通过高速以太网进行互联,完成整车高速通信。在CCA架构下, 中央网关被多个VIU替代,上述方案中,全车所有ECU和DC拥有相同的通信密钥依赖于中网网关给出的唯一的S,S是每次密钥更新时随机生成的,而CCA架构下有多个VIU,S的唯一性无法保证,因此上述方案对于CCA架构不适用。在CCA架构下,如何进行密钥的协商,是亟需解决的问题。However, in order to adapt to the trend of intelligent networking of automobiles, the electronic and electrical architecture in the vehicle is gradually transformed from a centralized network architecture based on a central gateway to a distributed central computing architecture (CCA). The CCA architecture distributes the electronic control elements (including DC and ECU) of the vehicle into multiple areas, and each area deploys a Vehicle Integrated/Integration Unit (VIU) to manage the ECUs in the area. High-speed Ethernet is connected to complete the high-speed communication of the whole vehicle. Under the CCA architecture, the central gateway is replaced by multiple VIUs. In the above scheme, all ECUs and DCs in the whole vehicle have the same communication key, which depends on the unique S given by the central network gateway, and S is random every time the key is updated. generated, and there are multiple VIUs under the CCA architecture, the uniqueness of S cannot be guaranteed, so the above solution is not applicable to the CCA architecture. Under the CCA architecture, how to negotiate keys is an urgent problem to be solved.
发明内容SUMMARY OF THE INVENTION
本申请提供一种密钥协商方法及装置,以解决在CCA架构下如何进行密钥的协商。The present application provides a key negotiation method and apparatus to solve how to perform key negotiation under the CCA architecture.
第一方面,本申请提供一种密钥协商方法,包括:第一整车集成单元VIU与车内电子控制系统中的其它VIU协商出共有的第一随机数后,根据第一随机数确定第二随机数、临时共享密钥和临时共同私钥,并根据临时共同私钥生成临时共同公钥,第一VIU根据第二随机数、临时共同公钥和第一VIU预设的设备私钥,与第一DC认证并协商通信密钥和随机数种子,第一DC为车内电子控制系统中的一个DC,第一VIU根据随机数种子和第一VIU预设的认证密钥,与第一电子控制单元ECU进行认证并协商通信加密密钥和通信认证密钥,第一VIU确定与第一ECU认证成功后,将通信加密密钥和通信认证密钥通过通信密钥加密后发送给第一DC。In a first aspect, the present application provides a method for key negotiation, including: after a first vehicle integration unit VIU negotiates a first random number in common with other VIUs in an in-vehicle electronic control system, determining a first random number according to the first random number. Two random numbers, a temporary shared key and a temporary common private key, and generate a temporary common public key according to the temporary common private key, the first VIU uses the second random number, the temporary common public key and the device private key preset by the first VIU, Authenticate and negotiate the communication key and random number seed with the first DC, the first DC is a DC in the electronic control system in the vehicle, and the first VIU communicates with the first VIU according to the random number seed and the authentication key preset by the first VIU. The electronic control unit ECU performs authentication and negotiates the communication encryption key and the communication authentication key. After the first VIU determines that the authentication with the first ECU is successful, the communication encryption key and the communication authentication key are encrypted by the communication key and sent to the first VIU. DC.
通过第一方面提供的密钥协商方法,通过第一VIU与车内电子控制系统中的其它VIU协商出共有的第一随机数后,根据第一随机数确定第二随机数、临时共享密钥和临时共同私钥,并根据临时共同私钥生成临时共同公钥。由于第二随机数、临时共享密钥和临时共同密钥由所有VIU共享,DC和其中任意一个VIU协商都可协商出相同的通信密钥和随机数种子,协商完成后DC和每个VIU都可以使用相同的通信密钥进行安全通信,无需DC和每个VIU之间都建立安全通信连接。然后第一VIU根据随机数种子和VIU预设的认证密钥,与第一ECU认证并协商通信加密密钥和通信认证密钥,最后将通信加密密钥和通信认证密钥通过通信密钥加密后发送给第一DC,通信加密密钥和通信认证密钥用于每个DC和每个ECU之间能够建立安全通信。从而实现了CCA架构下的密钥协商,保证了每个DC和每个ECU之间能够建立安全通信。With the key negotiation method provided in the first aspect, after the first VIU negotiates a common first random number with other VIUs in the in-vehicle electronic control system, the second random number and the temporary shared key are determined according to the first random number and the temporary common private key, and generate the temporary common public key according to the temporary common private key. Since the second random number, temporary shared key and temporary common key are shared by all VIUs, the DC and any one of the VIUs can negotiate the same communication key and random number seed. The same communication key can be used for secure communication without establishing a secure communication connection between the DC and each VIU. Then the first VIU authenticates and negotiates the communication encryption key and the communication authentication key with the first ECU according to the random number seed and the authentication key preset by the VIU, and finally encrypts the communication encryption key and the communication authentication key with the communication key After being sent to the first DC, the communication encryption key and the communication authentication key are used to establish secure communication between each DC and each ECU. In this way, the key negotiation under the CCA architecture is realized, which ensures the establishment of secure communication between each DC and each ECU.
在一种可能的设计中,第一VIU根据第二随机数、临时共同公钥和第一VIU预设的设备私钥,与第一域控制单元DC认证并协商通信密钥和随机数种子,可以为:In a possible design, the first VIU authenticates and negotiates the communication key and random number seed with the first domain control unit DC according to the second random number, the temporary common public key and the device private key preset by the first VIU, Can be:
第一VIU接收第一DC发送的第三随机数、临时公钥和签名值;The first VIU receives the third random number, the temporary public key and the signature value sent by the first DC;
第一VIU根据第一DC的设备公钥、第三随机数和临时公钥对签名值进行验证;The first VIU verifies the signature value according to the device public key, the third random number and the temporary public key of the first DC;
第一VIU对签名值验证通过后,根据第二随机数、临时共同公钥和第一VIU的设备私钥计算数字签名值;After the first VIU passes the verification of the signature value, the digital signature value is calculated according to the second random number, the temporary common public key and the device private key of the first VIU;
第一VIU将第二随机数、临时共同公钥和数字签名值发送给第一DC,用于第一DC根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证,验证成功后根据临时私钥和临时共同公钥确定通信密钥;The first VIU sends the second random number, the temporary common public key and the digital signature value to the first DC, so that the first DC can digitally sign the value according to the second random number, the temporary common public key and the device public key of the first VIU Perform verification, and determine the communication key according to the temporary private key and the temporary common public key after the verification is successful;
第一VIU根据临时私钥和临时共同公钥确定通信密钥,并根据第三随机数和第二随机数确定随机数种子,或者根据第三随机数、第二随机数和第一VIU的功能域标识确定随机数种子。The first VIU determines the communication key according to the temporary private key and the temporary common public key, and determines the random number seed according to the third random number and the second random number, or according to the functions of the third random number, the second random number and the first VIU The domain ID determines the random number seed.
通过本实施例方式提供的密钥协商方法,在根据第三随机数、第二随机数和第一VIU的功能域标识确定随机数种子的方式中,由于随机数种子是第一VIU根据第三随 机数、第二随机数和第一VIU的功能域标识确定,不同的功能域的标识不同,因此不同功能域对应的随机数种子不同。而随机数种子用于VIU和ECU之间的密钥分发,对不同功能域ECU进行密钥分发时使用不同随机数种子,可实现不同功能域内的通信加密密钥和通信认证密钥不同,减少了密钥的使用范围,安全性更高。With the key agreement method provided in this embodiment, in the method of determining the random number seed according to the third random number, the second random number and the functional domain identifier of the first VIU, since the random number seed is the first VIU according to the third random number The random number, the second random number, and the functional domain identifiers of the first VIU are determined, and the identifiers of different functional domains are different, so the random number seeds corresponding to different functional domains are different. The random number seed is used for key distribution between the VIU and ECU. Different random number seeds are used when distributing keys to ECUs in different functional domains, which can realize different communication encryption keys and communication authentication keys in different functional domains, reducing the need for The scope of use of the key is increased, and the security is higher.
在一种可能的设计中,第一VIU将第二随机数、临时共同公钥、数字签名值和第一VIU预设的设备证书发送给第一DC之后,方法还可以包括:In a possible design, after the first VIU sends the second random number, the temporary common public key, the digital signature value and the device certificate preset by the first VIU to the first DC, the method may further include:
第一VIU根据第三随机数、临时公钥和临时共享密钥计算第一校验值;The first VIU calculates the first check value according to the third random number, the temporary public key and the temporary shared key;
第一VIU将第三随机数、临时公钥和第一校验值发送给车内电子控制系统中的其它VIU,用于其它VIU根据根据第三随机数、临时公钥和临时共享密钥计算第二校验值,并在确认第一校验值与第二校验值相同时,根据临时公钥和临时共同私钥确定通信密钥,同时根据第三随机数和第二随机数确定所述随机数种子,或者同时根据第三随机数、第二随机数和其它VIU的功能域标识确定随机数种子。The first VIU sends the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system for other VIUs to calculate according to the third random number, the temporary public key and the temporary shared key The second check value, and when it is confirmed that the first check value is the same as the second check value, the communication key is determined according to the temporary public key and the temporary common private key, and the communication key is determined according to the third random number and the second random number. The random number seed is determined according to the random number seed, or the random number seed is determined according to the third random number, the second random number and the functional domain identifiers of other VIUs.
在一种可能的设计中,第一VIU根随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商通信加密密钥和通信认证密钥,可以为:In a possible design, the first VIU root random number seed and the authentication key preset by the first VIU perform authentication with the first ECU and negotiate the communication encryption key and communication authentication key, which may be:
第一VIU接收第一ECU发送的第四随机数;The first VIU receives the fourth random number sent by the first ECU;
第一VIU根据第四随机数、随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商通信加密密钥和通信认证密钥。The first VIU performs authentication with the first ECU and negotiates the communication encryption key and the communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU.
在一种可能的设计中,第一VIU根据第四随机数、随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商通信加密密钥和通信认证密钥,可以为:In a possible design, the first VIU performs authentication with the first ECU and negotiates the communication encryption key and the communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU, and can for:
第一VIU根据第四随机数、随机数种子和第一VIU预设的认证密钥计算第三校验值;The first VIU calculates the third check value according to the fourth random number, the random number seed and the authentication key preset by the first VIU;
第一VIU将随机数种子和第三校验值发送给第一ECU,用于第一ECU对第三校验值进行认证;The first VIU sends the random number seed and the third verification value to the first ECU for the first ECU to authenticate the third verification value;
第一VIU接收第一ECU对第三校验值认证通过后发送的第一消息认证码和第二消息认证码,第一消息认证码为第一ECU根据随机数种子和第一ECU预设的认证密钥计算得到,第二消息认证码为第一ECU根据通信加密密钥和通信认证密钥计算得到;The first VIU receives the first message authentication code and the second message authentication code sent by the first ECU after passing the authentication of the third verification value. The first message authentication code is preset by the first ECU according to the random number seed and the first ECU. The authentication key is calculated and obtained, and the second message authentication code is calculated and obtained by the first ECU according to the communication encryption key and the communication authentication key;
第一VIU根据第一VIU预设的长期共享密钥和随机数种子确定通信加密密钥和通信认证密钥;The first VIU determines the communication encryption key and the communication authentication key according to the long-term shared key and random number seed preset by the first VIU;
第一VIU对第一消息认证码和第二消息认证码进行认证。The first VIU authenticates the first message authentication code and the second message authentication code.
在一种可能的设计中,第一VIU对第一消息认证码和第二消息认证码进行认证,可以为:In a possible design, the first VIU authenticates the first message authentication code and the second message authentication code, which may be:
第一VIU根据随机数种子和第一VIU预设的认证密钥计算第三消息认证码,并根据通信加密密钥和通信认证密钥计算第四消息认证码;The first VIU calculates the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and calculates the fourth message authentication code according to the communication encryption key and the communication authentication key;
第一VIU将第一消息认证码与第三消息认证码进行比对,将第二消息认证码与第四消息认证码进行比对;The first VIU compares the first message authentication code with the third message authentication code, and compares the second message authentication code with the fourth message authentication code;
第一VIU确定与第一ECU认证成功,包括:The first VIU is determined to be successfully certified with the first ECU, including:
若第一消息认证码与第三消息认证码相同,且第二消息认证码与第四消息认证码相同,则第一VIU确定与第一ECU认证成功。If the first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, the first VIU determines that the authentication with the first ECU is successful.
通过本实施方式提供的密钥协商方法,在根据第三随机数、第二随机数和第一VIU 的功能域标识确定随机数种子的方式中,第一VIU分发给ECU的密钥与随机数种子有关,而随机数种子与功能域标识有关,因此第一VIU分发给ECU的通信加密密钥和通信认证密钥按功能域区分,不同功能域内的通信加密密钥和通信认证密钥不同,可实现不同功能域内的通信加密密钥和通信认证密钥不同,减少了密钥的使用范围,安全性更高。With the key agreement method provided in this embodiment, in the manner of determining the random number seed according to the third random number, the second random number, and the functional domain identifier of the first VIU, the key and the random number distributed by the first VIU to the ECU are The seed is related to the seed, and the random number seed is related to the functional domain identification. Therefore, the communication encryption key and communication authentication key distributed by the first VIU to the ECU are distinguished by functional domain. The communication encryption key and communication authentication key in different functional domains are different. Different communication encryption keys and communication authentication keys in different functional domains can be realized, which reduces the use range of keys and provides higher security.
在一种可能的设计中,将通信加密密钥和通信认证密钥通过通信密钥加密后发送给第一DC,可以为:In a possible design, the communication encryption key and the communication authentication key are encrypted by the communication key and sent to the first DC, which may be:
第一VIU将通信加密密钥和通信认证密钥通过通信密钥加密,得到加密密文;The first VIU encrypts the communication encryption key and the communication authentication key through the communication key to obtain encrypted ciphertext;
第一VIU将第二消息认证码和加密密文发送给第一DC。The first VIU sends the second message authentication code and the encrypted ciphertext to the first DC.
通过本实施方式提供的密钥协商方法,第一DC中不需要存储长期共享密钥,而是在整个协商流程末尾阶段由第一VIU将通信加密密钥和通信认证密钥加密发送给第一DC,从而可以避免因DC受到攻击导致全车共享密钥GK泄露。With the key negotiation method provided in this embodiment, the first DC does not need to store the long-term shared key, but at the end of the entire negotiation process, the first VIU encrypts and sends the communication encryption key and the communication authentication key to the first DC. DC, so as to avoid the leakage of the vehicle-wide shared key GK due to the attack of the DC.
第二方面,本申请提供一种密钥协商方法,包括:In a second aspect, the present application provides a key agreement method, including:
第一域控制单元DC生成临时私钥和第三随机数,并根据临时私钥生成对应的临时公钥,第一DC为车内电子控制系统中的一个DC;第一DC根据临时公钥、第三随机数和第一DC预设的设备私钥,与第一整车集成单元VIU进行认证并协商通信密钥;第一DC接收第一VIU发送的通过通信密钥加密后的通信加密密钥和通信认证密钥,通信加密密钥和通信认证密钥为第一VIU根据随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商得到。The first domain control unit DC generates a temporary private key and a third random number, and generates a corresponding temporary public key according to the temporary private key, and the first DC is a DC in the in-vehicle electronic control system; the first DC is based on the temporary public key, The third random number and the device private key preset by the first DC authenticate with the first vehicle integration unit VIU and negotiate the communication key; the first DC receives the communication encryption key encrypted by the communication key sent by the first VIU key and communication authentication key, the communication encryption key and communication authentication key are obtained by the first VIU through authentication and negotiation with the first ECU according to the random number seed and the authentication key preset by the first VIU.
通过第二方面提供的密钥协商方法,通过第一DC生成临时私钥和第三随机数,并根据临时私钥生成对应的临时公钥,第一DC根据临时公钥、第三随机数和第一DC预设的设备私钥,与第一VIU进行认证并协商通信密钥,最后第一DC接收第一VIU发送的通过通信密钥加密后的通信加密密钥和通信认证密钥,通信加密密钥和通信认证密钥用于每个DC和每个ECU之间能够建立安全通信。从而实现了CCA架构下的密钥协商,保证了每个DC和每个ECU之间能够建立安全通信。Using the key agreement method provided in the second aspect, a temporary private key and a third random number are generated by the first DC, and a corresponding temporary public key is generated according to the temporary private key, and the first DC is based on the temporary public key, the third random number and the The device private key preset by the first DC authenticates and negotiates a communication key with the first VIU, and finally the first DC receives the communication encryption key and the communication authentication key encrypted by the communication key sent by the first VIU, and communicates Encryption keys and communication authentication keys are used to establish secure communication between each DC and each ECU. In this way, the key negotiation under the CCA architecture is realized, which ensures the establishment of secure communication between each DC and each ECU.
在一种可能的设计中,第一DC根据临时公钥、第三随机数和第一DC预设的设备私钥,与第一整车集成单元VIU进行认证并协商通信密钥,可以为:In a possible design, the first DC authenticates and negotiates a communication key with the first vehicle integration unit VIU according to the temporary public key, the third random number and the device private key preset by the first DC, which may be:
第一DC使用第一DC预设的设备私钥对临时公钥和第三随机数进行数字签名,得到签名值;The first DC uses the device private key preset by the first DC to digitally sign the temporary public key and the third random number to obtain a signature value;
第一DC将临时公钥、第三随机数和签名值发送给第一VIU;The first DC sends the temporary public key, the third random number and the signature value to the first VIU;
第一DC接收第一VIU发送的第二随机数、临时共同公钥和数字签名值,数字签名值为第一VIU根据第二随机数、临时共同公钥和第一VIU预设的设备私钥计算得到,第二随机数为第一VIU根据第一随机数确定,第一随机数为第一VIU与车内电子控制系统中的其它VIU协商出的共有的随机数;The first DC receives the second random number, the temporary common public key and the digital signature value sent by the first VIU, and the digital signature value is the device private key preset by the first VIU according to the second random number, the temporary common public key and the first VIU Calculated, the second random number is determined by the first VIU according to the first random number, and the first random number is a common random number negotiated by the first VIU and other VIUs in the in-vehicle electronic control system;
第一DC根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证;The first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU;
第一DC对数字签名值验证通过后,根据临时私钥和临时共同公钥确定通信密钥。After the first DC has passed the verification of the digital signature value, the communication key is determined according to the temporary private key and the temporary common public key.
通过本实施方式提供的密钥协商方法,第一随机数为第一VIU与车内电子控制系统中的其它VIU协商出的共有的随机数,第二随机数、临时共享密钥和临时共同私钥由第一VIU根据第一随机数确定,从而第二随机数、临时共享密钥和临时共同密钥由 所有VIU共享,DC和其中任意一个VIU协商都可协商出相同的通信密钥和随机数种子,协商完成后DC和每个VIU都可以使用相同的通信密钥进行安全通信,无需DC和每个VIU之间都建立安全通信连接。With the key agreement method provided in this embodiment, the first random number is a common random number negotiated by the first VIU and other VIUs in the in-vehicle electronic control system, and the second random number, the temporary shared key and the temporary shared private key The key is determined by the first VIU according to the first random number, so the second random number, the temporary shared key and the temporary shared key are shared by all VIUs, and the DC can negotiate with any one of the VIUs to negotiate the same communication key and random number. After the negotiation is completed, the DC and each VIU can use the same communication key for secure communication without establishing a secure communication connection between the DC and each VIU.
第三方面,本申请提供一种密钥协商装置,包括:In a third aspect, the present application provides a key agreement device, including:
确定模块,用于与车内电子控制系统中的其它VIU协商出共有的第一随机数后,根据第一随机数确定第二随机数、临时共享密钥和临时共同私钥,并根据临时共同私钥生成临时共同公钥;The determining module is used to determine the second random number, the temporary shared key and the temporary common private key according to the first random number after negotiating the common first random number with other VIUs in the in-vehicle electronic control system, and according to the temporary common The private key generates a temporary common public key;
第一认证协商模块,用于根据第二随机数、临时共同公钥和第一VIU预设的设备私钥,与第一域控制单元DC认证并协商通信密钥和随机数种子,第一DC为车内电子控制系统中的一个DC;The first authentication negotiation module is used to authenticate and negotiate the communication key and random number seed with the first domain control unit DC according to the second random number, the temporary common public key and the device private key preset by the first VIU, and the first DC It is a DC in the electronic control system in the car;
第二认证协商模块,用于根据随机数种子和第一VIU预设的认证密钥,与第一电子控制单元ECU进行认证并协商通信加密密钥和通信认证密钥;The second authentication negotiation module is configured to perform authentication with the first electronic control unit ECU and negotiate the communication encryption key and the communication authentication key according to the random number seed and the authentication key preset by the first VIU;
发送模块,在确定与第一ECU认证成功后,将通信加密密钥和通信认证密钥通过通信密钥加密后发送给第一DC。The sending module, after determining that the authentication with the first ECU is successful, encrypts the communication encryption key and the communication authentication key with the communication key and sends them to the first DC.
在一种可能的设计中,第一认证协商模块包括:In a possible design, the first authentication negotiation module includes:
接收单元,用于接收第一DC发送的第三随机数、临时公钥和签名值;a receiving unit, configured to receive the third random number, the temporary public key and the signature value sent by the first DC;
验证单元,用于根据第一DC的设备公钥、第三随机数和临时公钥对签名值进行验证;a verification unit, configured to verify the signature value according to the device public key, the third random number and the temporary public key of the first DC;
计算单元,用于在对签名值验证通过后,根据第二随机数、临时共同公钥和第一VIU的设备私钥计算数字签名值;a calculation unit, configured to calculate the digital signature value according to the second random number, the temporary common public key and the device private key of the first VIU after the signature value is verified and passed;
发送单元,用于将第二随机数、临时共同公钥和数字签名值发送给第一DC,用于第一DC根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证,验证成功后根据临时私钥和临时共同公钥确定通信密钥;The sending unit is configured to send the second random number, the temporary common public key and the digital signature value to the first DC, for the first DC to pair the digital data with the second random number, the temporary common public key and the device public key of the first VIU The signature value is verified, and after the verification is successful, the communication key is determined according to the temporary private key and the temporary common public key;
确定单元,用于根据临时私钥和临时共同公钥确定通信密钥,并根据第三随机数和第二随机数确定随机数种子,或者根据第三随机数、第二随机数和第一VIU的功能域标识确定随机数种子。A determination unit, configured to determine the communication key according to the temporary private key and the temporary common public key, and determine the random number seed according to the third random number and the second random number, or determine the random number seed according to the third random number, the second random number and the first VIU The functional domain identifier determines the random number seed.
在一种可能的设计中,计算单元还用于:在发送单元将第二随机数、临时共同公钥和数字签名值发送给第一DC之后,根据第三随机数、临时公钥和临时共享密钥计算第一校验值;In a possible design, the computing unit is further configured to: after the sending unit sends the second random number, the temporary public public key and the digital signature value to the first DC, according to the third random number, the temporary public key and the temporary shared The key calculates the first check value;
发送单元还用于:将第三随机数、临时公钥和第一校验值发送给车内电子控制系统中的其它VIU,用于其它VIU根据根据第三随机数、临时公钥和临时共享密钥计算第二校验值,并在确认第一校验值与第二校验值相同时,根据临时公钥和临时共同私钥确定通信密钥,同时根据第三随机数和第二随机数确定所述随机数种子,或者同时根据第三随机数、第二随机数和其它VIU的功能域标识确定随机数种子。The sending unit is also used for: sending the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system, for the other VIUs to share according to the third random number, the temporary public key and the temporary sharing The key calculates the second check value, and when it is confirmed that the first check value is the same as the second check value, the communication key is determined according to the temporary public key and the temporary common private key, and the communication key is determined according to the third random number and the second random number. The random number seed is determined according to the random number seed, or the random number seed is determined according to the third random number, the second random number and the functional domain identifiers of other VIUs.
在一种可能的设计中,第二认证协商模块包括:In a possible design, the second authentication negotiation module includes:
接收单元,用于接收第一ECU发送的第四随机数;a receiving unit, configured to receive the fourth random number sent by the first ECU;
认证协商单元,用于根据第四随机数、随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商通信加密密钥和通信认证密钥。The authentication negotiation unit is configured to perform authentication with the first ECU and negotiate the communication encryption key and the communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU.
在一种可能的设计中,认证协商单元用于:In one possible design, the authentication negotiation unit is used to:
根据第四随机数、随机数种子和第一VIU预设的认证密钥计算第三校验值;Calculate the third check value according to the fourth random number, the random number seed and the authentication key preset by the first VIU;
将随机数种子和第三校验值发送给第一ECU,用于第一ECU对第三校验值进行认证;Sending the random number seed and the third verification value to the first ECU for the first ECU to authenticate the third verification value;
接收第一ECU对第三校验值认证通过后发送的第一消息认证码和第二消息认证码,第一消息认证码为第一ECU根据随机数种子和第一ECU预设的认证密钥计算得到,第二消息认证码为第一ECU根据通信加密密钥和通信认证密钥计算得到;Receive the first message authentication code and the second message authentication code sent by the first ECU after passing the authentication of the third check value, where the first message authentication code is the authentication key preset by the first ECU according to the random number seed and the first ECU Calculated, the second message authentication code is calculated by the first ECU according to the communication encryption key and the communication authentication key;
根据第一VIU预设的长期共享密钥和随机数种子确定通信加密密钥和通信认证密钥;Determine the communication encryption key and the communication authentication key according to the long-term shared key and random number seed preset by the first VIU;
对第一消息认证码和第二消息认证码进行认证。The first message authentication code and the second message authentication code are authenticated.
在一种可能的设计中,认证协商单元用于:In one possible design, the authentication negotiation unit is used to:
根据随机数种子和第一VIU预设的认证密钥计算第三消息认证码,并根据通信加密密钥和通信认证密钥计算第四消息认证码;Calculate the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and calculate the fourth message authentication code according to the communication encryption key and the communication authentication key;
将第一消息认证码与第三消息认证码进行比对,将第二消息认证码与第四消息认证码进行比对;comparing the first message authentication code with the third message authentication code, and comparing the second message authentication code with the fourth message authentication code;
认证协商模块用于:The authentication negotiation module is used to:
若第一消息认证码与第三消息认证码相同,且第二消息认证码与第四消息认证码相同,则确定与第一ECU认证成功。If the first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, it is determined that the authentication with the first ECU is successful.
在一种可能的设计中,发送模块用于:In one possible design, the transmit module is used to:
将通信加密密钥和通信认证密钥通过通信密钥加密,得到加密密文;Encrypt the communication encryption key and the communication authentication key through the communication key to obtain the encrypted ciphertext;
将第二消息认证码和加密密文发送给第一DC。Send the second message authentication code and encrypted ciphertext to the first DC.
上述第三方面以及上述第三方面的各可能的设计中所提供的密钥协商装置,其有益效果可以参见上述第一方面和第一方面的各可能的实施方式所带来的有益效果,在此不再赘述。For the above-mentioned third aspect and the key agreement device provided in each possible design of the above-mentioned third aspect, the beneficial effects of the above-mentioned first aspect and each possible implementation of the first aspect can be referred to. This will not be repeated here.
第四方面,本申请提供一种密钥协商装置,包括:In a fourth aspect, the present application provides a key agreement apparatus, including:
生成模块,用于生成临时私钥和第三随机数,并根据临时私钥生成对应的临时公钥,第一DC为车内电子控制系统中的一个DC;The generation module is used to generate a temporary private key and a third random number, and generate a corresponding temporary public key according to the temporary private key, and the first DC is a DC in the electronic control system in the vehicle;
认证协商模块,用于根据临时公钥、第三随机数和第一DC预设的设备私钥,与第一整车集成单元VIU进行认证并协商通信密钥;The authentication negotiation module is used to authenticate and negotiate the communication key with the first vehicle integration unit VIU according to the temporary public key, the third random number and the device private key preset by the first DC;
接收模块,用于接收第一VIU发送的通过通信密钥加密后的通信加密密钥和通信认证密钥,通信加密密钥和通信认证密钥为第一VIU根据随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商得到。The receiving module is configured to receive the communication encryption key and the communication authentication key encrypted by the communication key and sent by the first VIU. The set authentication key is obtained through authentication and negotiation with the first ECU.
在一种可能的设计中,认证协商模块包括:In one possible design, the authentication negotiation module includes:
数字签名单元,用于使用第一DC预设的设备私钥对临时公钥和第三随机数进行数字签名,得到签名值;a digital signature unit for digitally signing the temporary public key and the third random number using the device private key preset by the first DC to obtain a signature value;
发送单元,用于将临时公钥、第三随机数和签名值发送给第一VIU;a sending unit, configured to send the temporary public key, the third random number and the signature value to the first VIU;
接收单元,用于接收第一VIU发送的第二随机数、临时共同公钥和数字签名值,数字签名值为第一VIU根据第二随机数、临时共同公钥和第一VIU预设的设备私钥计算得到,第二随机数为第一VIU根据第一随机数确定,第一随机数为第一VIU与车内电子控制系统中的其它VIU协商出的共有的随机数;A receiving unit, configured to receive a second random number, a temporary common public key and a digital signature value sent by the first VIU, where the digital signature value is a device preset by the first VIU according to the second random number, the temporary common public key and the first VIU The private key is calculated and obtained, the second random number is determined by the first VIU according to the first random number, and the first random number is a common random number negotiated by the first VIU and other VIUs in the in-vehicle electronic control system;
验证单元,用于根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证;a verification unit, configured to verify the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU;
确定单元,用于在验证单元对数字签名值验证通过后,根据临时私钥和临时共同公钥确定通信密钥。The determining unit is configured to determine the communication key according to the temporary private key and the temporary common public key after the verification unit passes the verification of the digital signature value.
上述第四方面以及上述第四方面的各可能的设计中所提供的密钥协商装置,其有益效果可以参见上述第二方面和第二方面的各可能的实施方式所带来的有益效果,在此不再赘述。The above-mentioned fourth aspect and the key agreement device provided in each possible design of the above-mentioned fourth aspect, the beneficial effects of which can be referred to the beneficial effects brought by the above-mentioned second aspect and each possible implementation manner of the second aspect. This will not be repeated here.
第五方面,本申请提供一种密钥协商装置,包括:存储器和处理器;In a fifth aspect, the present application provides a key agreement apparatus, including: a memory and a processor;
存储器用于存储程序指令;memory is used to store program instructions;
处理器用于调用存储器中的程序指令执行第一方面及第一方面任一种可能的设计中的密钥协商方法。The processor is configured to invoke the program instructions in the memory to execute the key agreement method in the first aspect and any possible design of the first aspect.
第六方面,本申请提供一种可读存储介质,可读存储介质中存储有执行指令,当密钥协商装置的至少一个处理器执行该执行指令时,密钥协商装置执行第一方面及第一方面任一种可能的设计中的方法。In a sixth aspect, the present application provides a readable storage medium, in which an execution instruction is stored, and when at least one processor of the key agreement apparatus executes the execution instruction, the key agreement apparatus executes the first aspect and the first aspect. On the one hand any possible design method.
第七方面,本申请提供一种程序产品,该程序产品包括执行指令,该执行指令存储在可读存储介质中。密钥协商装置的至少一个处理器可以从可读存储介质读取该执行指令,至少一个处理器执行该执行指令使得密钥协商装置实施第一方面及第一方面任一种可能的设计中的方法。In a seventh aspect, the present application provides a program product, the program product includes execution instructions, and the execution instructions are stored in a readable storage medium. At least one processor of the key agreement apparatus may read the execution instruction from the readable storage medium, and the at least one processor executes the execution instruction to cause the key agreement apparatus to implement the first aspect and any possible design of the first aspect. method.
附图说明Description of drawings
图1为一种CCA架构的车内电子控制系统结构示意图;FIG. 1 is a schematic structural diagram of an in-vehicle electronic control system of a CCA architecture;
图2为本申请提供的一种密钥协商方法实施例的交互流程图;FIG. 2 is an interactive flowchart of an embodiment of a key agreement method provided by the present application;
图3为本申请提供的一种第一VIU与第一DC进行两两认证并协商通信密钥和随机数种子实施例的流程示意图;3 is a schematic flowchart of an embodiment of a first VIU and a first DC performing pairwise authentication and negotiating a communication key and a random number seed according to the present application;
图4为本申请提供的一种第一VIU与第一ECU进行认证并协商通信加密密钥和通信认证密钥实施例的流程示意图;4 is a schematic flowchart of an embodiment of a first VIU and a first ECU performing authentication and negotiating a communication encryption key and a communication authentication key according to the present application;
图5为本申请提供的一种密钥协商方法实施例的交互流程图;FIG. 5 is an interactive flowchart of an embodiment of a key agreement method provided by the present application;
图6为本申请提供的一种密钥协商装置实施例的结构示意图;6 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application;
图7为本申请提供的一种密钥协商装置实施例的结构示意图;7 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application;
图8为本申请提供的一种密钥协商装置实施例的结构示意图;FIG. 8 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application;
图9为本申请提供的一种密钥协商装置实施例的结构示意图;FIG. 9 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application;
图10为本申请提供的一种密钥协商装置实施例的结构示意图;10 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application;
图11为本申请提供的一种密钥协商装置示意图。FIG. 11 is a schematic diagram of a key agreement apparatus provided by this application.
具体实施方式detailed description
本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明,本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或方案不应被解释为比其它实施例或方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在 以具体方式呈现相关概念。In the embodiments of the present application, words such as "exemplary" or "for example" are used to represent any embodiment or solution described as "exemplary" or "for example" in the embodiments of the present application It should not be construed as preferred or advantageous over other embodiments or arrangements. Rather, the use of words such as "exemplary" or "such as" is intended to present the related concepts in a specific manner.
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。In this application, "at least one" means one or more, and "plurality" means two or more. "And/or", which describes the association relationship of the associated objects, indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A, B can be singular or plural. The character "/" generally indicates that the associated objects are an "or" relationship.
本申请提供的密钥协商方法可以应用于CCA架构的车内电子控制系统中,在CCA架构下,车辆的电子控制元件(包括DC和ECU)分布到多个区域中,每个区域部署一个VIU负责管理区域中的ECU,VIU之间通过高速以太网进行互联,实现高带宽(高清摄像头、高清显示)、低时延以及高可靠处理能力。图1为一种CCA架构的车内电子控制系统结构示意图,如图1所示,图1中以车内部部署的VIU数量为4个为例进行说明,车内部部署4个VIU:VIU0、VIU1、VIU2和VIU3,4个VIU之间通过高速以太网进行互联,每个VIU管理一个区域中的ECU,每个VIU通过一个总线连接一个区域中的ECU,如VIU0通过一个总线连接ECU0、ECU1、ECU2和ECU3,VIU1通过一个总线连接ECU5、ECU6、ECU7和ECU8,VIU2通过一个总线连接ECU13、ECU14、ECU15和ECU16,VIU3通过一个总线连接ECU9、ECU10、ECU11和ECU12,VIU0和VIU3均与DC1连接,VIU1和VIU2均与DC2连接。本申请提供的密钥协商方法,由每个区域部署的VIU负责在ECU和DC间分配共享密钥,以便每个DC和每个ECU之间能够建立安全通信。The key agreement method provided in this application can be applied to the in-vehicle electronic control system of the CCA architecture. Under the CCA architecture, the electronic control elements (including DC and ECU) of the vehicle are distributed in multiple areas, and each area is deployed with a VIU Responsible for managing the ECUs in the area, and the VIUs are interconnected through high-speed Ethernet to achieve high bandwidth (high-definition cameras, high-definition display), low latency, and highly reliable processing capabilities. Figure 1 is a schematic diagram of the structure of an in-vehicle electronic control system with a CCA architecture, as shown in Figure 1. In Figure 1, the number of VIUs deployed in the car is 4 as an example, and 4 VIUs are deployed in the car: VIU0, VIU1 , VIU2 and VIU3, 4 VIUs are interconnected through high-speed Ethernet, each VIU manages ECUs in one area, and each VIU is connected to ECUs in one area through a bus, such as VIU0 through a bus to connect ECU0, ECU1, ECU2 and ECU3, VIU1 connects ECU5, ECU6, ECU7 and ECU8 through a bus, VIU2 connects ECU13, ECU14, ECU15 and ECU16 through a bus, VIU3 connects ECU9, ECU10, ECU11 and ECU12 through a bus, VIU0 and VIU3 are both connected to DC1 , both VIU1 and VIU2 are connected to DC2. In the key agreement method provided in this application, the VIU deployed in each region is responsible for distributing the shared key between the ECUs and the DCs, so that secure communication can be established between each DC and each ECU.
本申请涉及的电子控制元件主要包括VIU、ECU和DC,可以理解的是,VIU、ECU和DC的数量是一个或多个,分别以ECU i、VIU j和DC k表示,其中,i、j和k均为正整数,分别是VIU、ECU和DC的编号。ECU i、VIU j和DC k中预先设置并存储安全凭证,具体地,ECU i中预先设置的安全凭证是长期共享密钥GK和认证密钥K i。VIU j中预先设置的安全凭证是设备私钥sk VIUj、设备证书Cert VIUj(其中包含设备公钥pk VIUj)、根证书Cert 0(全车统一,用于验证设备证书合法性)、长期共享密钥GK和与ECU i中预先设置的认证密钥K i对应的认证密钥K i,或者,VIU j中预先设置的安全凭证是设备私钥sk VIUj、DC k的设备公钥或设备公钥哈希值、根证书Cert 0(全车统一,用于验证设备证书合法性)、长期共享密钥GK和与ECU i中预先设置的认证密钥K i对应的认证密钥K i。DC k中预先设置的安全凭证是设备私钥sk DCk、设备证书Cert DCk(其中包含设备公钥pk DCk)和根证书Cert 0(全车统一,用于验证设备证书合法性)。基于这些预先设置的安全凭证,VIU和VIU之间,VIU和DC之间,以及VIU和ECU之间认证、协商并分发认证密钥和加密密钥,用于每个DC和每个ECU之间能够建立安全通信。 The electronic control components involved in this application mainly include VIU, ECU and DC. It is understood that the number of VIU, ECU and DC is one or more, which are represented by ECU i , VIU j and DC k respectively, where i, j and k are positive integers, which are the numbers of VIU, ECU, and DC, respectively. Security credentials are preset and stored in ECU i , VIU j and DC k . Specifically, the security credentials preset in ECU i are a long-term shared key GK and an authentication key K i . The pre-set security credentials in VIU j are the device private key sk VIUj , the device certificate Cert VIUj (which includes the device public key pk VIUj ), the root certificate Cert 0 (unified for the whole vehicle, used to verify the legitimacy of the device certificate), the long-term shared secret key GK and the authentication key K i corresponding to the authentication key K i preset in the ECU i , or the security credential preset in the VIU j is the device private key sk VIUj , the device public key or the device public key of DC k Hash value, root certificate Cert 0 (unified for the whole vehicle, used to verify the validity of the device certificate), long-term shared key GK and authentication key K i corresponding to the authentication key K i preset in ECU i . The security credentials preset in the DC k are the device private key sk DCk , the device certificate Cert DCk (which contains the device public key pk DCk ), and the root certificate Cert 0 (unified throughout the vehicle, used to verify the validity of the device certificate). Based on these pre-set security credentials, authentication, negotiation and distribution of authentication keys and encryption keys between VIU and VIU, between VIU and DC, and between VIU and ECU for each DC and each ECU Ability to establish secure communication.
现有技术中,在基于中央网关的集中式网络架构中,全车所有ECU和DC生成通信密钥的过程中接收到的随机数种子S相同,才能保证全车所有ECU和DC之间共享相同的通信密钥。而在CCA架构下有多个VIU,中央网关被多个VIU替代,S是每次密钥更新时随机生成的,因而S的唯一性无法保证,因此现有方案对于CCA架构不适用。为解决这一问题,本申请提供一种密钥协商方法及装置,通过在密钥更新过程开始时,CCA架构下的N个VIU之间先完成多方密钥协商,得到N个VIU共有的第一随机数,接着每一VIU根据第一随机数派生得到第二随机数、临时共享密钥和临时共 同密钥,由于第二随机数、临时共享密钥和临时共同密钥由所有VIU共享,DC和其中任意一个VIU协商都可协商出相同的通信密钥和随机数种子,协商完成后DC和每个VIU都可以使用相同的通信密钥进行安全通信,无需DC和每个VIU之间都建立安全通信连接。然后每一VIU根据随机数种子和VIU预设的认证密钥,与其管理区域内的ECU或者其他ECU认证并协商通信加密密钥和通信认证密钥,最后将通信加密密钥和通信认证密钥通过通信密钥加密后发送给DC,通信加密密钥和通信认证密钥用于每个DC和每个ECU之间能够建立安全通信。从而实现了CCA架构下的密钥协商,保证了每个DC和每个ECU之间能够建立安全通信。下面结合附图详细说明本申请提供的密钥协商方法及装置。In the prior art, in the centralized network architecture based on the central gateway, the random number seed S received by all ECUs and DCs in the whole vehicle in the process of generating the communication key is the same, so as to ensure that all ECUs and DCs in the whole vehicle share the same communication key. In the CCA architecture, there are multiple VIUs, the central gateway is replaced by multiple VIUs, and S is randomly generated every time the key is updated, so the uniqueness of S cannot be guaranteed, so the existing solution is not applicable to the CCA architecture. In order to solve this problem, the present application provides a method and device for key negotiation, by first completing multi-party key negotiation among N VIUs under the CCA architecture at the beginning of the key update process, to obtain the first key agreement shared by the N VIUs. A random number, then each VIU derives a second random number, a temporary shared key and a temporary common key according to the first random number. Since the second random number, the temporary shared key and the temporary common key are shared by all VIUs, The same communication key and random number seed can be negotiated between the DC and any of the VIUs. After the negotiation is completed, the DC and each VIU can use the same communication key for secure communication. Establish a secure communication connection. Then each VIU authenticates and negotiates the communication encryption key and communication authentication key with the ECU or other ECUs in its management area according to the random number seed and the authentication key preset by the VIU, and finally converts the communication encryption key and communication authentication key After the communication key is encrypted and sent to the DC, the communication encryption key and the communication authentication key are used to establish secure communication between each DC and each ECU. In this way, the key negotiation under the CCA architecture is realized, which ensures the establishment of secure communication between each DC and each ECU. The key agreement method and device provided by the present application will be described in detail below with reference to the accompanying drawings.
图2为本申请提供的一种密钥协商方法实施例的交互流程图,如图2所示,本实施例的方法可以包括:FIG. 2 is an interaction flowchart of an embodiment of a key agreement method provided by the present application. As shown in FIG. 2 , the method of this embodiment may include:
S101、第一VIU与车内电子控制系统中的其它VIU协商出共有的第一随机数后,根据第一随机数确定第二随机数、临时共享密钥和临时共同私钥,并根据临时共同私钥生成临时共同公钥。S101. After the first VIU negotiates with other VIUs in the in-vehicle electronic control system to negotiate a common first random number, determine a second random number, a temporary shared key and a temporary common private key according to the first random number, and determine a second random number, a temporary shared key and a temporary common private key according to the first random number, The private key generates a temporary common public key.
具体地,可以理解的是,第一VIU为电子控制系统中的任意一个VIU,电子控制系统中的所有VIU可以使用多方密钥协商协议进行多方密钥协商,协商出共有的第一随机数,可以使用任意常见的多方密钥协商协议,如多方密钥交换协议(Elliptic Curve Diffie–Hellman ECDH)协议。Specifically, it can be understood that the first VIU is any VIU in the electronic control system, and all the VIUs in the electronic control system can use the multi-party key agreement protocol to perform multi-party key negotiation to negotiate a common first random number, Any common multi-party key agreement protocol can be used, such as the multi-party key exchange protocol (Elliptic Curve Diffie–Hellman ECDH) protocol.
第一VIU根据第一随机数确定第二随机数、临时共享密钥和临时共同私钥,可以是根据第一随机数R派生得到第二随机数、临时共享密钥和临时共同私钥,可以根据第一随机数R通过密钥派生函数派生得到第二随机数、临时共享密钥和临时共同私钥,计算过程为:(nonce||Key VIU||eSK)=KDF(R),其中KDF为密钥派生函数(Key derivation function),密钥派生函数可以根据输入数据生成任意长度的数据,nonce为第二随机数,Key VIU为临时共享密钥,eSK为临时共同私钥,接着,根据临时共同私钥eSK生成临时共同公钥ePK。其中,临时共享密钥Key VIU用于所有VIU之间的安全通信,临时共同私钥eSK和临时共同公钥ePK用于每个VIU和每个DC之间的密钥协商。每个VIU和每个DC之间进行的密钥协商都使用相同的临时私钥eSK和临时公钥ePK,因此所有VIU和DC协商得到的密钥都相同。 The first VIU determines the second random number, the temporary shared key and the temporary common private key according to the first random number, which may be derived from the first random number R to obtain the second random number, the temporary shared key and the temporary common private key, which may The second random number, the temporary shared key and the temporary shared private key are derived from the first random number R through the key derivation function. The calculation process is: (nonce||Key VIU ||eSK)=KDF(R), where KDF is the key derivation function, which can generate data of any length according to the input data, nonce is the second random number, Key VIU is the temporary shared key, eSK is the temporary common private key, and then, according to The temporary common private key eSK generates a temporary common public key ePK. The temporary shared key Key VIU is used for secure communication among all VIUs, and the temporary common private key eSK and the temporary common public key ePK are used for key negotiation between each VIU and each DC. The key negotiation between each VIU and each DC uses the same ephemeral private key eSK and ephemeral public key ePK, so all VIUs and DCs negotiate the same key.
本实施例中,车内多个VIU之间通过协商共享的第一随机数、第二随机数、临时共同私钥和临时共同公钥,对外逻辑统一,DC无需关心VIU的具体部署细节(如数量、分布位置、连接的ECU等),使DC的认证协商处理逻辑和VIU的实际部署细节解耦,简化处理逻辑。In this embodiment, the first random number, the second random number, the temporary common private key, and the temporary common public key shared by multiple VIUs in the vehicle through negotiation are logically unified to the outside world, and the DC does not need to care about the specific deployment details of the VIUs (such as number, distribution location, connected ECUs, etc.) to decouple the authentication negotiation processing logic of the DC from the actual deployment details of the VIU, simplifying the processing logic.
S102、第一DC生成临时私钥和第三随机数,并根据临时私钥生成对应的临时公钥。S102. The first DC generates a temporary private key and a third random number, and generates a corresponding temporary public key according to the temporary private key.
其中,第一DC为车内电子控制系统中的一个DC,即为任意一个DC。The first DC is a DC in the in-vehicle electronic control system, that is, any DC.
S103、第一VIU根据第二随机数、临时共同公钥和第一VIU预设的设备私钥,与第一DC认证并协商通信密钥和随机数种子。S103. The first VIU authenticates and negotiates a communication key and a random number seed with the first DC according to the second random number, the temporary common public key, and the device private key preset by the first VIU.
其中,随机数种子Seed kD用于第一VIU管理区域内的第一ECU的通信密钥分发。 Wherein, the random number seed Seed kD is used for the communication key distribution of the first ECU in the first VIU management area.
具体来说,由于VIU之间有共同的临时公钥,第一DC和任意一个VIU之间都可 以协商出相同的通信密钥和随机数种子,协商完成后,第一DC和每个VIU都可以用相同的通信密钥进行安全通信,无需建立多个安全连接。Specifically, since the VIUs have a common temporary public key, the first DC and any VIU can negotiate the same communication key and random number seed. After the negotiation is completed, the first DC and each VIU can The same communication key can be used for secure communication, eliminating the need to establish multiple secure connections.
具体地,S103中第一VIU根据第二随机数、临时共同公钥和第一VIU预设的设备私钥,与第一DC认证并协商通信密钥和随机数种子,可以为:Specifically, in S103, the first VIU authenticates and negotiates the communication key and random number seed with the first DC according to the second random number, the temporary common public key and the device private key preset by the first VIU, which may be:
S1031、第一VIU接收第一DC发送的第三随机数、临时公钥和签名值。S1031. The first VIU receives the third random number, the temporary public key and the signature value sent by the first DC.
S1032、第一VIU根据第一DC的设备公钥、第三随机数和临时公钥对签名值进行验证。S1032. The first VIU verifies the signature value according to the device public key, the third random number, and the temporary public key of the first DC.
具体地,S1032中第一VIU根据第一DC的设备公钥、第三随机数和临时公钥对签名值进行验证,有三种可实施的方式,方式一中是证书传递的方式,方式二中是预存第一DC的设备公钥的方式,方式三中是第一VIU中预存第一DC的设备公钥或设备公钥哈希值,第一VIU验证接收到的第一DC的设备公钥的方式。下面具体描述:Specifically, in S1032, the first VIU verifies the signature value according to the device public key, the third random number, and the temporary public key of the first DC, and there are three possible ways. It is a method of pre-storing the device public key of the first DC. In the third method, the device public key or device public key hash value of the first DC is pre-stored in the first VIU, and the first VIU verifies the received device public key of the first DC. The way. The following is a detailed description:
方式一:第一VIU接收第一DC发送的第三随机数、临时公钥、签名值和第一DC的设备证书,第一DC的设备公钥包括于第一DC的设备证书中。Manner 1: The first VIU receives the third random number, the temporary public key, the signature value and the device certificate of the first DC sent by the first DC, where the device public key of the first DC is included in the device certificate of the first DC.
第一VIU根据第一VIU预设的根证书验证第一DC的设备证书的合法性,并根据第三随机数和临时公钥对签名值进行验证。The first VIU verifies the validity of the device certificate of the first DC according to the root certificate preset by the first VIU, and verifies the signature value according to the third random number and the temporary public key.
方式二:第一VIU接收第一DC发送的第三随机数、临时公钥和签名值。Manner 2: The first VIU receives the third random number, the temporary public key and the signature value sent by the first DC.
第一VIU根据预存的第一DC的设备公钥、第三随机数和临时公钥对签名值进行验证。The first VIU verifies the signature value according to the pre-stored device public key of the first DC, the third random number and the temporary public key.
方式三:第一VIU接收第一DC发送的第三随机数、临时公钥、签名值和第一DC的设备公钥。Manner 3: The first VIU receives the third random number, the temporary public key, the signature value and the device public key of the first DC sent by the first DC.
第一VIU根据预存的第一DC的设备公钥或设备公钥哈希值,验证接收到的第一DC的设备公钥,验证成功后根据第三随机数、临时公钥和第一DC的设备公钥对签名值进行验证。The first VIU verifies the received device public key of the first DC according to the pre-stored device public key of the first DC or the hash value of the device public key. The device public key verifies the signature value.
S1033、第一VIU对签名值验证通过后,根据第二随机数、临时共同公钥和第一VIU的设备私钥计算数字签名值。S1033: After the first VIU passes the verification of the signature value, the digital signature value is calculated according to the second random number, the temporary common public key, and the device private key of the first VIU.
S1034、第一VIU将第二随机数、临时共同公钥和数字签名值发送给第一DC。S1034: The first VIU sends the second random number, the temporary common public key and the digital signature value to the first DC.
S1035、第一DC根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证,对数字签名值验证通过后,根据临时私钥和临时共同公钥确定通信密钥。S1035. The first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU, and after the verification of the digital signature value is passed, determines the communication password according to the temporary private key and the temporary common public key. key.
具体来说,第一DC还可以是根据临时私钥和临时共同公钥以及其它信息确定通信密钥,此处的其它信息例如可以是第一VIU的标识、第一DC的标识和车辆的标识中的任一种。Specifically, the first DC may also be a communication key determined according to the temporary private key, the temporary common public key, and other information, where other information may be, for example, the identity of the first VIU, the identity of the first DC, and the identity of the vehicle any of the.
具体地,第一DC根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证时,第一DC获取第一VIU的设备公钥的方式与S1032中第一VIU获取第一DC的设备公钥的方式类似,也有三种可实施的方式,下面具体描述:Specifically, when the first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU, the manner in which the first DC obtains the device public key of the first VIU is the same as that of the first DC in S1032. The way the VIU obtains the device public key of the first DC is similar, and there are three possible ways, which are described in detail below:
方式一:第一DC接收第一VIU发送的第二随机数、临时共同公钥、数字签名值和第一VIU预设的设备证书,第一VIU的设备公钥包括于第一VIU预设的设备证书中。Mode 1: The first DC receives the second random number, the temporary common public key, the digital signature value and the device certificate preset by the first VIU sent by the first VIU, and the device public key of the first VIU is included in the preset device certificate of the first VIU. in the device certificate.
第一DC根据第一DC预设的根证书验证第一VIU的设备证书的合法性,并根据第二随机数和临时共同公钥对数字签名值进行验证。The first DC verifies the validity of the device certificate of the first VIU according to the root certificate preset by the first DC, and verifies the digital signature value according to the second random number and the temporary common public key.
方式二、第一DC接收第一VIU发送的第二随机数、临时共同公钥和数字签名值。Manner 2: The first DC receives the second random number, the temporary common public key and the digital signature value sent by the first VIU.
第一DC根据预存的第一VIU的设备公钥、第二随机数和临时共同公钥对数字签名值进行验证。The first DC verifies the digital signature value according to the pre-stored device public key of the first VIU, the second random number and the temporary common public key.
方式三:第一DC接收第一VIU发送的第二随机数、临时共同公钥、数字签名值和第一VIU的设备公钥。Manner 3: The first DC receives the second random number, the temporary common public key, the digital signature value, and the device public key of the first VIU sent by the first VIU.
第一DC根据预存的第一VIU的设备公钥或设备公钥哈希值,验证接收到的第一VIU的设备公钥,验证成功后根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证。The first DC verifies the received device public key of the first VIU according to the pre-stored device public key of the first VIU or the hash value of the device public key. The device's public key verifies the digital signature value.
S1036、第一VIU根据临时私钥和临时共同公钥确定通信密钥,并根据第三随机数和第二随机数确定随机数种子,或者根据第三随机数、第二随机数和第一VIU的功能域标识确定随机数种子。S1036. The first VIU determines the communication key according to the temporary private key and the temporary common public key, and determines the random number seed according to the third random number and the second random number, or determines the random number seed according to the third random number, the second random number and the first VIU The functional domain identifier determines the random number seed.
S104、第一DC根据临时公钥、第三随机数和第一DC预设的设备私钥,与第一VIU进行认证并协商通信密钥。S104. The first DC authenticates and negotiates a communication key with the first VIU according to the temporary public key, the third random number, and the device private key preset by the first DC.
其中,通信密钥用于第一VIU和第一DC之间的安全通信。The communication key is used for secure communication between the first VIU and the first DC.
在一种可实施的方式中,S103还可以是第一DC根据临时公钥、第三随机数、第一DC预设的设备证书和第一DC预设的设备私钥,与第一VIU进行认证,在认证成功后与第一VIU协商通信密钥。In an implementable manner, S103 may also be that the first DC performs a communication with the first VIU according to the temporary public key, the third random number, the device certificate preset by the first DC, and the device private key preset by the first DC Authentication, negotiate a communication key with the first VIU after successful authentication.
具体地,第一DC根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证,验证成功后根据临时私钥和临时共同公钥确定通信密钥。Specifically, the first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU, and after successful verification, determines the communication key according to the temporary private key and the temporary common public key.
S105、第一VIU根据随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商通信加密密钥和通信认证密钥。S105 , the first VIU authenticates with the first ECU according to the random number seed and the authentication key preset by the first VIU, and negotiates the communication encryption key and the communication authentication key.
其中,第一ECU可以为第一VIU管理区域内的ECU,还可以为其它ECU。Wherein, the first ECU may be an ECU in the management area of the first VIU, or may be other ECUs.
可选的,第一VIU还可以根据第一VIU的标识、随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商通信加密密钥和通信认证密钥。Optionally, the first VIU may also perform authentication with the first ECU and negotiate the communication encryption key and the communication authentication key according to the identifier of the first VIU, the random number seed and the authentication key preset by the first VIU.
S106、第一VIU确定与第一ECU认证成功后,将通信加密密钥和通信认证密钥通过通信密钥加密后发送给第一DC。S106. After the first VIU determines that the authentication with the first ECU is successful, the communication encryption key and the communication authentication key are encrypted by the communication key and then sent to the first DC.
具体地,第一VIU将通信加密密钥和通信认证密钥通过通信密钥加密后发送给第一DC,可以为:Specifically, the first VIU sends the communication encryption key and the communication authentication key to the first DC after encrypting the communication key, which may be:
第一VIU将通信加密密钥和通信认证密钥通过通信密钥加密,得到加密密文,第一VIU将第二消息认证码和加密密文发送给第一DC。The first VIU encrypts the communication encryption key and the communication authentication key with the communication key to obtain an encrypted ciphertext, and the first VIU sends the second message authentication code and the encrypted ciphertext to the first DC.
可选的,还可以同时发送第一ECU的标识。Optionally, the identifier of the first ECU may also be sent at the same time.
本实施例中,第一DC中不需要存储长期共享密钥,而是在整个协商流程末尾阶段由第一VIU将通信加密密钥和通信认证密钥加密发送给第一DC,从而可以避免因DC受到攻击导致全车共享密钥GK泄露。In this embodiment, the first DC does not need to store the long-term shared key, but at the end of the entire negotiation process, the first VIU encrypts and sends the communication encryption key and the communication authentication key to the first DC, thereby avoiding The attack on the DC led to the disclosure of the vehicle-wide shared key GK.
本实施例提供的密钥协商方法,通过第一VIU与车内电子控制系统中的其它VIU协商出共有的第一随机数后,根据第一随机数确定第二随机数、临时共享密钥和临时共同私钥,并根据临时共同私钥生成临时共同公钥。由于第二随机数、临时共享密钥和临时共同密钥由所有VIU共享,DC和其中任意一个VIU协商都可协商出相同的通信密钥和随机数种子,协商完成后DC和每个VIU都可以使用相同的通信密钥进行安全通信,无需DC和每个VIU之间都建立安全通信连接。然后第一VIU根据随机数种 子和VIU预设的认证密钥,与第一ECU认证并协商通信加密密钥和通信认证密钥,最后将通信加密密钥和通信认证密钥通过通信密钥加密后发送给第一DC,通信加密密钥和通信认证密钥用于每个DC和每个ECU之间能够建立安全通信。从而实现了CCA架构下的密钥协商,保证了每个DC和每个ECU之间能够建立安全通信。In the key negotiation method provided in this embodiment, after negotiating a common first random number with other VIUs in the in-vehicle electronic control system through the first VIU, the second random number, the temporary shared key and the key are determined according to the first random number. The temporary common private key is generated, and the temporary common public key is generated according to the temporary common private key. Since the second random number, temporary shared key and temporary common key are shared by all VIUs, the DC and any one of the VIUs can negotiate the same communication key and random number seed. The same communication key can be used for secure communication without establishing a secure communication connection between the DC and each VIU. Then the first VIU authenticates and negotiates the communication encryption key and the communication authentication key with the first ECU according to the random number seed and the authentication key preset by the VIU, and finally encrypts the communication encryption key and the communication authentication key with the communication key After being sent to the first DC, the communication encryption key and the communication authentication key are used to establish secure communication between each DC and each ECU. In this way, the key negotiation under the CCA architecture is realized, which ensures the establishment of secure communication between each DC and each ECU.
下面结合图3说明第一VIU与第一DC进行两两认证并协商通信密钥和随机数种子的一种可实施的方式,即S103-S104的一种可实施的方式,图3为本申请提供的一种第一VIU与第一DC进行两两认证并协商通信密钥和随机数种子实施例的流程示意图,如图3所示,本实施例的方法可以包括:An implementable manner of performing pairwise authentication between the first VIU and the first DC and negotiating a communication key and a random number seed, that is, an implementable manner of S103-S104, will be described below with reference to FIG. 3 . FIG. 3 is the present application. Provided is a schematic flowchart of an embodiment of the first VIU and the first DC performing pairwise authentication and negotiating a communication key and a random number seed. As shown in FIG. 3 , the method of this embodiment may include:
S201、第一DC使用第一DC预设的设备私钥对临时公钥和第三随机数进行数字签名,得到签名值。S201. The first DC uses the device private key preset by the first DC to digitally sign the temporary public key and the third random number to obtain a signature value.
具体地,签名值Sig k=Sign(r k||ePK k,sk DC),sk DC为第一DC预设的设备私钥,ePK k为临时公钥,r k为第三随机数。 Specifically, the signature value Sig k =Sign(rk ||ePK k , sk DC ), sk DC is the device private key preset by the first DC, ePK k is the temporary public key, and rk is the third random number.
S202、第一DC将临时公钥、第三随机数、签名值和第一DC的设备公钥发送给第一VIU。S202: The first DC sends the temporary public key, the third random number, the signature value, and the device public key of the first DC to the first VIU.
S203、第一VIU根据预存的第一DC的设备公钥或设备公钥哈希值,验证接收到的第一DC的设备公钥,验证成功后根据第三随机数、临时公钥和第一DC的设备公钥对签名值进行验证。S203. The first VIU verifies the received device public key of the first DC according to the pre-stored device public key of the first DC or the hash value of the device public key, and after the verification is successful, according to the third random number, the temporary public key and the first The DC's device public key verifies the signature value.
在另一种可实施的方式中,S202可以为:第一DC将临时公钥、第三随机数和签名值发送给第一VIU。In another implementable manner, S202 may be: the first DC sends the temporary public key, the third random number and the signature value to the first VIU.
相应地,S203可以为:第一VIU根据预存的第一DC的设备公钥、第三随机数、临时公钥对签名值进行验证。Correspondingly, S203 may be: the first VIU verifies the signature value according to the pre-stored device public key of the first DC, the third random number, and the temporary public key.
在另一种可实施的方式中,S202可以为:第一DC将第三随机数、临时公钥、签名值和第一DC预设的设备证书发送给第一VIU。In another implementable manner, S202 may be: the first DC sends the third random number, the temporary public key, the signature value and the device certificate preset by the first DC to the first VIU.
相应地,S203可以为:第一VIU根据第一VIU预设的根证书验证第一DC的设备证书的合法性,并根据第三随机数和临时公钥对签名值进行验证。Correspondingly, S203 may be: the first VIU verifies the validity of the device certificate of the first DC according to the root certificate preset by the first VIU, and verifies the signature value according to the third random number and the temporary public key.
具体地,若验证失败停止密钥更新流程,若验证成功,执行S204。Specifically, if the verification fails, stop the key update process, and if the verification succeeds, execute S204.
S204、第一VIU验证成功后,根据第二随机数、临时共同公钥和第一VIU的设备私钥计算数字签名值。S204. After the first VIU is successfully verified, the digital signature value is calculated according to the second random number, the temporary common public key, and the device private key of the first VIU.
具体地,计算过程为可以为数字签名值Sig 0=Sign(nonce||ePK,sk VIUj0),其中,ePK为临时共同公钥,sk VIUj0为第一VIU的设备私钥,nonce为第二随机数。 Specifically, the calculation process can be the digital signature value Sig 0 =Sign(nonce||ePK, sk VIUj0 ), where ePK is the temporary common public key, sk VIUj0 is the device private key of the first VIU, and nonce is the second random number.
S205、第一VIU将第二随机数、临时共同公钥和数字签名值发送给第一DC。S205: The first VIU sends the second random number, the temporary common public key and the digital signature value to the first DC.
S206、第一VIU根据临时私钥和临时共同公钥确定通信密钥,并根据第三随机数和第二随机数确定随机数种子,或者根据第三随机数、第二随机数和第一VIU的功能域标识确定随机数种子。S206. The first VIU determines the communication key according to the temporary private key and the temporary common public key, and determines the random number seed according to the third random number and the second random number, or determines the random number seed according to the third random number, the second random number and the first VIU The functional domain identifier determines the random number seed.
具体地,第一VIU在发送第三随机数r k、临时公钥ePK k和校验值MAC k后,根据临时公钥ePK k和临时共同私钥eSK进行哈希运算,得到通信密钥Key VDk=HASH(ePK k*eSK),并根据第三随机数r k、第二随机数nonce和功能域标识DID计算Seed kD,计算过程为Seed kD=HASH(r k||nonce||DID)。 Specifically, after sending the third random number r k , the temporary public key ePK k and the check value MAC k , the first VIU performs a hash operation according to the temporary public key ePK k and the temporary common private key eSK to obtain the communication key Key VDk =HASH(ePK k *eSK), and calculate Seed kD according to the third random number r k , the second random number nonce and the functional domain identifier DID, and the calculation process is Seed kD =HASH(r k ||nonce||DID) .
本实施例中,在根据第三随机数、第二随机数和第一VIU的功能域标识确定随机 数种子的方式中,由于随机数种子是第一VIU根据第三随机数、第二随机数和第一VIU的功能域标识确定,不同的功能域的标识不同,因此不同功能域对应的随机数种子不同。而随机数种子用于VIU和ECU之间的密钥分发,对不同功能域ECU进行密钥分发时使用不同随机数种子,可实现不同功能域内的通信加密密钥和通信认证密钥不同,减少了密钥的使用范围,安全性更高。In this embodiment, in the manner of determining the random number seed according to the third random number, the second random number and the functional domain identifier of the first VIU, since the random number seed is the first VIU according to the third random number, the second random number As determined from the functional domain identifier of the first VIU, the identifiers of different functional domains are different, so the random number seeds corresponding to different functional domains are different. The random number seed is used for key distribution between the VIU and ECU. Different random number seeds are used when distributing keys to ECUs in different functional domains, which can realize different communication encryption keys and communication authentication keys in different functional domains, reducing the need for The scope of use of the key is increased, and the security is higher.
可选的,S206中也可以是第一VIU根据临时私钥和临时共同公钥确定通信密钥,并根据第三随机数和第二随机数确定随机数种子,即就是说,随机数种子也可以不按照功能域区分。Optionally, in S206, the first VIU may also determine the communication key according to the temporary private key and the temporary common public key, and determine the random number seed according to the third random number and the second random number, that is to say, the random number seed is also It may not be distinguished by functional domain.
S207、第一DC根据预存的第一VIU的设备公钥、第二随机数和临时共同公钥对数字签名值进行验证,验证成功后根据临时私钥和临时共同公钥确定通信密钥。S207: The first DC verifies the digital signature value according to the pre-stored device public key of the first VIU, the second random number, and the temporary common public key, and after successful verification, determines the communication key according to the temporary private key and the temporary common public key.
具体地,第一DC根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证,若验证失败,停止密钥更新流程;验证成功后根据临时私钥和临时共同公钥确定通信密钥,确定过程可以为第一DC根据临时公钥ePK k和临时共同公钥ePK进行哈希运算,得到通信密钥Key VDk=HASH(eSK k*ePK),通信密钥Key VDk用于第一DC和各个VIU之间的安全通信,其中HASH为哈希运算。 Specifically, the first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU. If the verification fails, the key update process is stopped; The common public key determines the communication key, and the determination process may be that the first DC performs a hash operation according to the temporary public key ePK k and the temporary common public key ePK to obtain the communication key Key VDk =HASH(eSK k *ePK), the communication key The Key VDk is used for secure communication between the first DC and each VIU, where HASH is a hash operation.
在另一种可实施的方式中,S205可以为:第一VIU将第一VIU的设备公钥、第二随机数、临时共同公钥和数字签名值发送给第一DC。In another implementable manner, S205 may be: the first VIU sends the device public key, the second random number, the temporary common public key and the digital signature value of the first VIU to the first DC.
相应地,S207可以为:第一DC根据预存的第一VIU的设备公钥或设备公钥哈希值,验证接收到的第一VIU的设备公钥,验证成功后根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证。Correspondingly, S207 may be: the first DC verifies the received device public key of the first VIU according to the pre-stored device public key of the first VIU or the hash value of the device public key, and after the verification is successful, according to the second random number, temporary The digital signature value is verified by the common public key and the device public key of the first VIU.
在另一种可实施的方式中,S205可以为:第一VIU将第一VIU预设的设备证书、第二随机数、临时共同公钥和数字签名值发送给第一DC,第一VIU的设备公钥包括于第一VIU预设的设备证书中。In another implementable manner, S205 may be: the first VIU sends the device certificate, the second random number, the temporary common public key and the digital signature value preset by the first VIU to the first DC, and the first VIU's The device public key is included in the device certificate preset by the first VIU.
相应地,S207可以为:第一DC根据第一DC预设的根证书验证第一VIU的设备证书的合法性,并根据第二随机数和临时共同公钥对数字签名值进行验证。Correspondingly, S207 may be: the first DC verifies the validity of the device certificate of the first VIU according to the root certificate preset by the first DC, and verifies the digital signature value according to the second random number and the temporary common public key.
进一步地,S205中第一VIU将第二随机数、临时共同公钥和数字签名值发送给第一DC之后,本实施例的方法还可以包括:Further, after the first VIU sends the second random number, the temporary common public key and the digital signature value to the first DC in S205, the method of this embodiment may further include:
S208、第一VIU根据第三随机数、临时公钥和临时共享密钥计算第一校验值。S208. The first VIU calculates the first check value according to the third random number, the temporary public key, and the temporary shared key.
具体可以是根据第三随机数r k、临时公钥ePK k和临时共享密钥Key VIU进行哈希运算,得到第一校验值MAC k=HASH(r k||ePK k||Key VIU)。 Specifically, the hash operation may be performed according to the third random number rk , the temporary public key ePK k and the temporary shared key Key VIU to obtain the first check value MAC k =HASH(r k ||ePK k ||Key VIU ) .
S209、第一VIU将第三随机数、临时公钥和第一校验值发送给车内电子控制系统中的其它VIU。S209: The first VIU sends the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system.
S210、其它VIU根据根据第三随机数、临时公钥和临时共享密钥计算第二校验值,并在确认第一校验值与第二校验值相同时,根据临时公钥和临时共同私钥确定通信密钥,同时根据第三随机数和第二随机数确定随机数种子,或者同时根据第三随机数、第二随机数和其它VIU的功能域标识确定随机数种子。S210. Other VIUs calculate the second check value according to the third random number, the temporary public key and the temporary shared key, and when confirming that the first check value is the same as the second check value, calculate the second check value according to the temporary public key and the temporary shared key. The private key determines the communication key, and simultaneously determines the random number seed according to the third random number and the second random number, or simultaneously determines the random number seed according to the third random number, the second random number and the functional domain identifiers of other VIUs.
具体地,其他VIU收到第三随机数r k、临时公钥ePK k和第一校验值MAC k后,根据第三随机数r k、临时公钥ePK k和临时共享密钥Key VIU进行哈希运算,得到第二校验值MAC’=HASH(r k||ePK k||Key VIU),并将MAC’和MAC k值进行比对。若比对失败,停止密钥更新流程;若比对成功,即第一校验值与第二校验值相同,则其他VIU根据 临时公钥ePK k和临时共同私钥eSK进行哈希运算,得到通信密钥Key VDk=HASH(ePK k*eSK),通信密钥Key VDk用于第一DC和各个VIU之间的安全通信。同时其他VIU根据第三随机数r k、第二随机数nonce和其它VIU的功能域标识DID计算随机数种子Seed kD,计算过程可以为Seed kD=HASH(r k||nonce||DID),其中DID为VIU的功能域标识,DID用于标识不同的功能域(例如动力域,底盘域,车身域等)。Seed kD用于VIU和ECU之间的密钥分发,对不同功能域ECU进行密钥分发时使用不同随机数种子Seed kD,可实现不同功能域内的通信加密密钥和通信认证密钥不同,减少了密钥的使用范围,安全性更高。 Specifically, after receiving the third random number r k , the temporary public key ePK k and the first check value MAC k , the other VIUs perform Hash operation is performed to obtain the second check value MAC'=HASH(r k ||ePK k ||Key VIU ), and the MAC' and the MAC k value are compared. If the comparison fails, stop the key update process; if the comparison is successful, that is, the first check value is the same as the second check value, the other VIUs perform hash operations according to the temporary public key ePK k and the temporary common private key eSK, The communication key Key VDk =HASH(ePK k *eSK) is obtained, and the communication key Key VDk is used for the secure communication between the first DC and each VIU. At the same time, other VIUs calculate the random number seed Seed kD according to the third random number r k , the second random number nonce and the functional domain identifier DID of other VIUs. The calculation process can be Seed kD =HASH(r k ||nonce||DID), DID is the functional domain identifier of the VIU, and DID is used to identify different functional domains (such as power domain, chassis domain, body domain, etc.). Seed kD is used for key distribution between VIU and ECU. Different random number seeds are used when distributing keys to ECUs in different functional domains. Seed kD can realize different communication encryption keys and communication authentication keys in different functional domains, reducing The scope of use of the key is increased, and the security is higher.
下面结合图4说明第一VIU与第一ECU进行认证并协商通信加密密钥和通信认证密钥的一种可实施的方式,即S105的一种可实施的方式,图4为本申请提供的一种第一VIU与第一ECU进行认证并协商通信加密密钥和通信认证密钥实施例的流程示意图,如图4所示,本实施例的方法可以包括:An implementable manner in which the first VIU and the first ECU perform authentication and negotiate a communication encryption key and a communication authentication key, that is, an implementable manner of S105, will be described below with reference to FIG. 4 . FIG. 4 is provided for this application. A schematic flowchart of an embodiment of the first VIU and the first ECU performing authentication and negotiating a communication encryption key and a communication authentication key. As shown in FIG. 4 , the method of this embodiment may include:
S301、第一ECU生成第四随机数。S301. The first ECU generates a fourth random number.
S302、第一ECU将第四随机数发送给第一VIU,第一VIU与第一ECU直接相连。S302. The first ECU sends the fourth random number to the first VIU, and the first VIU is directly connected to the first ECU.
可选的,第一ECU还可以将第一ECU的标识发送给第一VIU。Optionally, the first ECU may also send the identifier of the first ECU to the first VIU.
S303、第一VIU根据第四随机数、随机数种子和第一VIU预设的认证密钥计算第三校验值。S303. The first VIU calculates a third check value according to the fourth random number, the random number seed, and the authentication key preset by the first VIU.
可选的,第一VIU还可以根据第一VIU的标识、第一ECU的标识、第四随机数、随机数种子和第一VIU预设的认证密钥计算第三校验值。若增加了第一VIU的标识和第一ECU的标识,准确性更高。Optionally, the first VIU may also calculate the third check value according to the identifier of the first VIU, the identifier of the first ECU, the fourth random number, the random number seed, and the authentication key preset by the first VIU. If the identification of the first VIU and the identification of the first ECU are added, the accuracy will be higher.
S304、第一VIU将随机数种子和第三校验值发送给第一ECU。S304. The first VIU sends the random number seed and the third check value to the first ECU.
可选的,还可以发送第一VIU的标识。Optionally, the identifier of the first VIU may also be sent.
S305、第一ECU对第三校验值进行认证。S305. The first ECU authenticates the third verification value.
S306、第一ECU对第三校验值认证通过后,向第一VIU发送第一消息认证码和第二消息认证码,第一消息认证码为第一ECU根据随机数种子和第一ECU预设的认证密钥计算得到,第二消息认证码为第一ECU根据通信加密密钥和通信认证密钥计算得到,或者,第一消息认证码为第一ECU根据第一ECU的标识、随机数种子和第一ECU预设的认证密钥计算得到,第二消息认证码为第一ECU根据第一ECU的标识、通信加密密钥和通信认证密钥计算得到。S306. After the first ECU passes the authentication on the third verification value, it sends the first message authentication code and the second message authentication code to the first VIU, where the first message authentication code is the first ECU pre-predicted according to the random number seed and the first ECU. The second message authentication code is calculated by the first ECU according to the communication encryption key and the communication authentication key, or the first message authentication code is calculated by the first ECU according to the first ECU's identification, random number The seed and the authentication key preset by the first ECU are calculated, and the second message authentication code is calculated by the first ECU according to the identification of the first ECU, the communication encryption key and the communication authentication key.
S307、第一VIU根据第一VIU预设的长期共享密钥和随机数种子确定通信加密密钥和通信认证密钥。S307. The first VIU determines the communication encryption key and the communication authentication key according to the long-term shared key and random number seed preset by the first VIU.
具体地,S307可以是:第一VIU根据第一VIU中预设的长期共享密钥GK和随机数种子Seed kD通过密钥派生函数KDF计算得到通信加密密钥EK和通信认证密钥AK,具体是(EK||AK)=KDF(Seed kD,GK)。 Specifically, S307 may be: the first VIU obtains the communication encryption key EK and the communication authentication key AK by calculating the key derivation function KDF according to the long-term shared key GK and the random number seed Seed kD preset in the first VIU, specifically is (EK||AK)=KDF(Seed kD , GK).
S308、第一VIU对第一消息认证码和第二消息认证码进行认证。S308. The first VIU authenticates the first message authentication code and the second message authentication code.
具体地,第一VIU对第一消息认证码和第二消息认证码进行认证,具体可以为:第一VIU根据随机数种子和第一VIU预设的认证密钥计算第三消息认证码,并根据通信加密密钥和通信认证密钥计算第四消息认证码,第一VIU将第一消息认证码与第三消息认证码进行比对,将第二消息认证码与第四消息认证码进行比对。Specifically, the first VIU authenticates the first message authentication code and the second message authentication code, which may specifically be: the first VIU calculates the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and The fourth message authentication code is calculated according to the communication encryption key and the communication authentication key, and the first VIU compares the first message authentication code with the third message authentication code, and compares the second message authentication code with the fourth message authentication code right.
第一VIU确定与第一ECU认证成功,具体可以为:若第一消息认证码与第三消 息认证码相同,且第二消息认证码与第四消息认证码相同,则第一VIU确定与第一ECU认证成功。The first VIU determines that the authentication with the first ECU is successful, specifically: if the first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, the first VIU determines that the authentication code is the same as the third message authentication code. An ECU authentication is successful.
本实施例中,第一VIU分发给ECU的密钥与随机数种子Seed kD有关,而Seed kD与功能域标识有关,因此第一VIU分发给ECU的通信加密密钥和通信认证密钥按功能域区分,不同功能域内的通信加密密钥和通信认证密钥不同,可实现不同功能域内的通信加密密钥和通信认证密钥不同,减少了密钥的使用范围,安全性更高。 In this embodiment, the key distributed by the first VIU to the ECU is related to the random number seed Seed kD , and the Seed kD is related to the functional domain identifier. Therefore, the communication encryption key and communication authentication key distributed by the first VIU to the ECU are determined by function Domain distinction, the communication encryption key and communication authentication key in different functional domains are different, and the communication encryption key and communication authentication key in different functional domains can be different, which reduces the use range of the key and provides higher security.
下面采用一个具体的实施例,对图2-图4所示方法实施例的技术方案进行详细说明。A specific embodiment is used below to describe in detail the technical solutions of the method embodiments shown in FIG. 2 to FIG. 4 .
图5为本申请提供的一种密钥协商方法实施例的交互流程图,本实施例中以车内电子控制系统中共有N=4个VIU为例进行说明,如图5所示,本实施例的方法可以包括:FIG. 5 is an interaction flow chart of an embodiment of a key agreement method provided by this application. In this embodiment, a total of N=4 VIUs in the in-vehicle electronic control system are used as an example for description. As shown in FIG. 5 , this embodiment Example methods could include:
S401、第一VIU与车内电子控制系统中的其它VIU进行多方密钥协商,得到车内电子控制系统中的4个VIU共有的第一随机数R。S401. The first VIU performs multi-party key negotiation with other VIUs in the in-vehicle electronic control system to obtain a first random number R shared by the four VIUs in the in-vehicle electronic control system.
具体地,电子控制系统中的所有VIU可以使用多方密钥协商协议进行多方密钥协商,可以使用任意常见的多方密钥协商协议,如多方密钥交换协议(Elliptic Curve Diffie–Hellman ECDH)协议。Specifically, all VIUs in the electronic control system can use the multi-party key agreement protocol for multi-party key agreement, and can use any common multi-party key agreement protocol, such as the multi-party key exchange protocol (Elliptic Curve Diffie–Hellman ECDH) protocol.
S402、第一VIU根据第一随机数R派生得到第二随机数、临时共享密钥和临时共同私钥,并根据临时共同私钥生成临时共同公钥。S402. The first VIU derives a second random number, a temporary shared key and a temporary common private key according to the first random number R, and generates a temporary common public key according to the temporary common private key.
具体地,第一VIU可以根据第一随机数R通过密钥派生函数派生得到第二随机数、临时共享密钥和临时共同私钥,计算过程为:(nonce||Key VIU||eSK)=KDF(R),其中KDF为密钥派生函数(Key derivation function),密钥派生函数可以根据输入数据生成任意长度的数据,nonce为第二随机数,Key VIU为临时共享密钥,eSK为临时共同私钥,接着,根据临时共同私钥eSK生成临时共同公钥ePK。其中,临时共享密钥Key VIU用于所有VIU j之间的安全通信,临时共同私钥eSK和临时共同公钥ePK用于VIU j和DC k之间的密钥协商。所有VIU j和DC k之间进行的密钥协商都使用相同的临时私钥eSK和临时公钥ePK,因此所有VIU j和DC k协商得到的密钥都相同。 Specifically, the first VIU can derive the second random number, the temporary shared key and the temporary common private key according to the first random number R through a key derivation function, and the calculation process is: (nonce||Key VIU ||eSK)= KDF(R), where KDF is the key derivation function, which can generate data of any length according to the input data, nonce is the second random number, Key VIU is the temporary shared key, and eSK is the temporary The common private key is then used to generate a temporary common public key ePK according to the temporary common private key eSK. The temporary shared key Key VIU is used for secure communication between all VIU j , and the temporary common private key eSK and the temporary common public key ePK are used for key negotiation between VIU j and DC k . All key negotiations between VIU j and DC k use the same ephemeral private key eSK and ephemeral public key ePK, so all VIU j and DC k negotiate the same key.
S403、第一VIU和第一DC进行认证并协商通信密钥和随机数种子Seed kD,第一DC与第一VIU连接,通信密钥用于第一VIU和第一DC之间的安全通信,随机数种子Seed kD用于第一VIU管理区域内的第一ECU的通信密钥分发。 S403, the first VIU and the first DC perform authentication and negotiate a communication key and a random number seed Seed kD , the first DC is connected to the first VIU, and the communication key is used for secure communication between the first VIU and the first DC, The random number seed Seed kD is used for the communication key distribution of the first ECU in the first VIU management area.
其中,第一VIU和第一DC进行认证并协商通信密钥和随机数种子,具体可以包括:The first VIU and the first DC perform authentication and negotiate a communication key and a random number seed, which may specifically include:
S4031、第一DC随机生成临时私钥eSK k和第三随机数r k,并根据临时私钥eSK k生成对应的临时公钥ePK kS4031 , the first DC randomly generates a temporary private key eSK k and a third random number r k , and generates a corresponding temporary public key ePK k according to the temporary private key eSK k .
S4032、第一DC使用第一DC预设的设备私钥sk DC对临时公钥ePK k和第三随机数r k进行数字签名,计算得到签名值Sig k=Sign(r k||ePK k,sk DC)。 S4032. The first DC uses the device private key sk DC preset by the first DC to digitally sign the temporary public key ePK k and the third random number r k , and calculates the signature value Sig k =Sign(r k ||ePK k , sk DC ).
S4033、第一DC将临时公钥ePK k、第三随机数r k、签名值Sig k和第一DC预设的设备证书Cert DCk发送给第一VIU。 S4033 , the first DC sends the temporary public key ePK k , the third random number r k , the signature value Sig k and the device certificate Cert DCk preset by the first DC to the first VIU.
S4034、第一VIU收到临时公钥ePK k、第三随机数r k、签名值Sig k和第一DC预设的设备证书Cert DCk后,根据第一VIU预先设置的根证书Cert 0验证第一DC的设备 证书Cert DCk的合法性,然后根据第三随机数r k和临时公钥ePK k对签名值Sig k进行验证。若验证失败,停止密钥更新流程,若验证成功,第一VIU根据第二随机数nonce、临时共同公钥ePK和第一VIU的设备私钥sk VIUj0计算数字签名值Sig 0,计算过程为Sig 0=Sign(nonce||ePK,sk VIUj0),接着执行S4035。 S4034. After receiving the temporary public key ePK k , the third random number r k , the signature value Sig k and the device certificate Cert DCk preset by the first DC, the first VIU verifies the first VIU according to the root certificate Cert 0 preset by the first VIU The validity of the device certificate Cert DCk of a DC, and then the signature value Sig k is verified according to the third random number r k and the temporary public key ePK k . If the verification fails, the key update process is stopped. If the verification is successful, the first VIU calculates the digital signature value Sig 0 according to the second random number nonce, the temporary common public key ePK and the device private key sk VIUj0 of the first VIU, and the calculation process is Sig 0 0 =Sign(nonce||ePK,sk VIUj0 ), and then execute S4035.
S4035、第一VIU将第二随机数nonce、临时共同公钥ePK、数字签名值Sig 0和第一VIU的设备证书Cert VIUj0发送给第一DC。 S4035: The first VIU sends the second random number nonce, the temporary common public key ePK, the digital signature value Sig 0 , and the device certificate Cert VIUj0 of the first VIU to the first DC.
S4036、第一DC收到第二随机数nonce、临时共同公钥ePK、数字签名值Sig 0和第一VIU的设备证书Cert VIUj0后,根据第一DC预设的根证书Cert 0验证第一VIU的设备证书Cert VIUj0的合法性,然后根据第二随机数nonce和临时共同公钥ePK对数字签名值Sig 0进行验证。若验证失败,停止密钥更新流程;若验证成功,则第一DC根据临时私钥ePK k和临时共同公钥ePK计算通信密钥Key VDk,计算过程为根据临时公钥ePK k和临时共同公钥ePK进行哈希运算,得到通信密钥Key VDk=HASH(eSK k*ePK),通信密钥Key VDk用于第一DC和各个VIU之间的安全通信,其中HASH为哈希运算。 S4036, after the first DC receives the second random number nonce, the temporary common public key ePK, the digital signature value Sig 0 , and the device certificate Cert VIUj0 of the first VIU, it verifies the first VIU according to the preset root certificate Cert 0 of the first DC The validity of the device certificate Cert VIUj0 , and then the digital signature value Sig 0 is verified according to the second random number nonce and the temporary common public key ePK. If the verification fails, stop the key update process; if the verification succeeds, the first DC calculates the communication key Key VDk according to the temporary private key ePK k and the temporary common public key ePK, and the calculation process is based on the temporary public key ePK k and the temporary common public key. Perform a hash operation on the key ePK to obtain a communication key Key VDk =HASH(eSK k *ePK), and the communication key Key VDk is used for secure communication between the first DC and each VIU, wherein HASH is a hash operation.
S4037、第一VIU在发送第二随机数nonce、临时共同公钥ePK、数字签名值Sig 0和第一VIU的设备证书Cert VIUj0后,根据第三随机数r k、临时公钥ePK k和临时共享密钥Key VIU计算第一校验值MAC k,具体是根据第三随机数r k、临时公钥ePK k和临时共享密钥Key VIU进行哈希运算,得到第一校验值MAC k=HASH(r k||ePK k||Key VIU)。 S4037, after the first VIU sends the second random number nonce, the temporary public public key ePK, the digital signature value Sig 0 and the device certificate Cert VIUj0 of the first VIU, according to the third random number r k , the temporary public key ePK k and the temporary The shared key Key VIU calculates the first check value MAC k , and specifically performs a hash operation according to the third random number r k , the temporary public key ePK k and the temporary shared key Key VIU to obtain the first check value MAC k = HASH(r k ||ePK k ||Key VIU ).
S4038、第一VIU将第三随机数r k、临时公钥ePK k和第一校验值MAC k发送给其他VIU。 S4038 , the first VIU sends the third random number rk , the temporary public key ePK k and the first check value MAC k to other VIUs .
S4039、其他VIU收到第三随机数r k、临时公钥ePK k和第一校验值MAC k后,根据第三随机数r k、临时公钥ePK k和临时共享密钥Key VIU进行哈希运算,得到第二校验值MAC’=HASH(r k||ePK k||Key VIU),并将MAC’和MAC k值进行比对。若比对失败,停止密钥更新流程;若比对成功,即第一校验值与第二校验值相同,则其他VIU根据临时公钥ePK k和临时共同私钥eSK进行哈希运算,得到通信密钥Key VDk=HASH(ePK k*eSK),通信密钥Key VDk用于第一DC和各个VIU之间的安全通信。同时其他VIU根据第三随机数r k、第二随机数nonce和功能域标识DID计算随机数种子Seed kD,计算过程为Seed kD=HASH(r k||nonce||DID),其中DID为功能域标识,DID用于标识不同的功能域(例如动力域,底盘域,车身域等)。Seed kD用于VIU和ECU之间的密钥分发。 S4039. After receiving the third random number r k , the temporary public key ePK k and the first check value MAC k , the other VIUs perform hashing according to the third random number r k , the temporary public key ePK k and the temporary shared key Key VIU The second check value MAC'=HASH(r k ||ePK k ||Key VIU ) is obtained, and the MAC' and the MAC k value are compared. If the comparison fails, stop the key update process; if the comparison is successful, that is, the first check value is the same as the second check value, the other VIUs perform hash operations according to the temporary public key ePK k and the temporary common private key eSK, The communication key Key VDk =HASH(ePK k *eSK) is obtained, and the communication key Key VDk is used for the secure communication between the first DC and each VIU. At the same time, other VIUs calculate the random number seed Seed kD according to the third random number r k , the second random number nonce and the functional domain identifier DID. The calculation process is Seed kD =HASH(r k ||nonce||DID), where DID is the function Domain identification, DID is used to identify different functional domains (such as power domain, chassis domain, body domain, etc.). Seed kD is used for key distribution between VIU and ECU.
S4040、第一VIU在发送第三随机数r k、临时公钥ePK k和校验值MAC k后,根据临时公钥ePK k和临时共同私钥eSK进行哈希运算,得到通信密钥Key VDk=HASH(ePK k*eSK),并根据第三随机数r k、第二随机数nonce和功能域标识DID计算Seed kD,计算过程为Seed kD=HASH(r k||nonce||DID)。 S4040. After sending the third random number r k , the temporary public key ePK k and the check value MAC k , the first VIU performs a hash operation according to the temporary public key ePK k and the temporary common private key eSK to obtain the communication key Key VDk =HASH(ePK k *eSK), and calculate Seed kD according to the third random number r k , the second random number nonce and the functional domain identifier DID, and the calculation process is Seed kD =HASH(r k ||nonce||DID).
S404、第一VIU和第一ECU进行认证并生成通信加密密钥EK和通信认证密钥AK。S404, the first VIU and the first ECU perform authentication and generate a communication encryption key EK and a communication authentication key AK.
其中,第一ECU是第一VIU管理区域内的ECU,可以理解的是第一ECU的数量是至少一个。Wherein, the first ECU is an ECU in the management area of the first VIU, and it can be understood that the number of the first ECU is at least one.
具体地,S404可以包括:Specifically, S404 may include:
S4041、第一ECU生成第四随机数R i,并将第四随机数R i和第一ECU的标识ID i发送给与第一ECU直接相连的第一VIU。 S4041. The first ECU generates a fourth random number Ri, and sends the fourth random number Ri and the identification ID i of the first ECU to the first VIU directly connected to the first ECU.
S4042、第一VIU根据第一VIU的标识ID VIUj、第一ECU的标识ID i、第四随机 数R i、随机数种子Seed kD和第一VIU预先设置的认证密钥K i计算第三校验值MAC1,具体是通过哈希运算,得到MAC1=HASH(ID i||ID VIUj||R i||Seed kD||K i),并将第一VIU的标识ID VIUj、随机数种子Seed kD和第三校验值MAC1发送给第一ECU。 S4042 , the first VIU calculates the third verification key according to the identification ID VIUj of the first VIU, the identification ID i of the first ECU, the fourth random number Ri, the random number seed Seed kD and the authentication key K i preset by the first VIU Check the value MAC1, specifically through hash operation, obtain MAC1=HASH(ID i ||ID VIUj ||R i ||Seed kD ||K i ), and set the ID VIUj of the first VIU, the random number seed Seed kD and the third check value MAC1 are sent to the first ECU.
S4043、第一ECU收到第一VIU的标识ID VIUj、随机数种子Seed kD和校验值MAC1后,根据第一VIU的标识ID VIUj、第一ECU的标识ID i、第四随机数R i、随机数种子Seed kD和第一ECU预先设置的认证密钥K i计算校验值MAC1’,具体是通过哈希运算,得到MAC1’=HASH(ID i||ID VIUj||R i||Seed kD||K i),并将MAC1和MAC1’进行比对。若比对失败,停止密钥更新流程;若比对成功,第一ECU根据第一ECU中预先设置的长期共享密钥GK和随机数种子Seed kD通过密钥派生函数KDF计算得到通信加密密钥EK和通信认证密钥AK,具体是(EK||AK)=KDF(Seed kD,GK)。接着计算第一消息认证码MAC2和第二消息认证码MAC3,MAC2=HASH(ID i||Seed kD||K i),MAC3=HASH(ID i||EK||AK),并将第一消息认证码MAC2和第二消息认证码MAC3发送给第一VIU。 S4043, after the first ECU receives the identification ID VIUj of the first VIU, the random number seed Seed kD and the check value MAC1, according to the identification ID VIUj of the first VIU, the identification ID i of the first ECU, and the fourth random number R i , the random number seed Seed kD and the authentication key K i preset by the first ECU to calculate the check value MAC1', specifically through hash operation, to obtain MAC1'=HASH(ID i ||ID VIUj ||R i || Seed kD ||K i ) and align MAC1 and MAC1'. If the comparison fails, stop the key update process; if the comparison is successful, the first ECU obtains the communication encryption key by calculating the key derivation function KDF according to the long-term shared key GK and the random number seed Seed kD preset in the first ECU EK and communication authentication key AK, specifically (EK||AK)=KDF(Seed kD , GK). Then calculate the first message authentication code MAC2 and the second message authentication code MAC3, MAC2=HASH(ID i ||Seed kD ||K i ), MAC3=HASH(ID i ||EK||AK), The message authentication code MAC2 and the second message authentication code MAC3 are sent to the first VIU.
S4044、第一VIU收到第一消息认证码MAC2和第二消息认证码MAC3后,根据第一VIU中预设的长期共享密钥GK和随机数种子Seed kD通过密钥派生函数KDF计算得到通信加密密钥EK和通信认证密钥AK,具体是(EK||AK)=KDF(Seed kD,GK)。 S4044. After receiving the first message authentication code MAC2 and the second message authentication code MAC3, the first VIU obtains the communication through the key derivation function KDF according to the preset long-term shared key GK and random number seed Seed kD in the first VIU The encryption key EK and the communication authentication key AK are specifically (EK||AK)=KDF(Seed kD , GK).
S4045、接着计算第三消息认证码MAC2’=HASH(ID i||Seed kD||K i)和第四消息认证码MAC3’=HASH(ID i||EK||AK),并将MAC2’和MAC3’分别与MAC2和MAC3进行比对,若MAC2’与MAC2以及MAC3’与MAC3中有一对不同,则比对失败,停止密钥更新流程;若MAC2’与MAC2以及MAC3’与MAC3相同,则比对成功。 S4045, then calculate the third message authentication code MAC2'=HASH(ID i ||Seed kD ||K i ) and the fourth message authentication code MAC3'=HASH(ID i ||EK||AK), and set the MAC2' and MAC3' are compared with MAC2 and MAC3 respectively. If one pair of MAC2' and MAC2 and MAC3' and MAC3 are different, the comparison fails and the key update process is stopped; if MAC2' is the same as MAC2 and MAC3' is the same as MAC3, The comparison is successful.
S405、第一VIU协助第一DC生成一致的通信加密密钥EK和通信认证密钥AK,并完成通信密钥一致性校验。S405. The first VIU assists the first DC to generate a consistent communication encryption key EK and communication authentication key AK, and completes the communication key consistency check.
具体地,S405可以包括:Specifically, S405 may include:
S4051、第一VIU将第一ECU的标识ID i、第二消息认证码MAC3和加密密文Enc(EK||AK,Key VDk)发送给第一DC。 S4051. The first VIU sends the identifier ID i of the first ECU, the second message authentication code MAC3 and the encrypted ciphertext Enc(EK||AK,Key VDk ) to the first DC.
S4052、第一DC计算MAC3’=HASH(ID i||EK i||AK i),并将MAC3’与MAC3进行比对。若比对失败,停止密钥更新流程。若比对成功,则完成整个密钥更新流程。 S4052, the first DC calculates MAC3'=HASH(ID i ||EK i ||AK i ), and compares MAC3' with MAC3. If the comparison fails, stop the key update process. If the comparison is successful, the entire key update process is completed.
图6为本申请提供的一种密钥协商装置实施例的结构示意图,如图6所示,本实施例的装置可以包括:确定模块11、第一认证协商模块12、第二认证协商模块13和发送模块14,其中,FIG. 6 is a schematic structural diagram of an embodiment of a key negotiation apparatus provided by the present application. As shown in FIG. 6 , the apparatus of this embodiment may include: a determination module 11 , a first authentication negotiation module 12 , and a second authentication negotiation module 13 and sending module 14, wherein,
确定模块11用于与车内电子控制系统中的其它VIU协商出共有的第一随机数后,根据第一随机数确定第二随机数、临时共享密钥和临时共同私钥,并根据临时共同私钥生成临时共同公钥;The determination module 11 is used to determine the second random number, the temporary shared key and the temporary shared private key according to the first random number after negotiating with other VIUs in the in-vehicle electronic control system to obtain a shared first random number, and according to the temporary shared key. The private key generates a temporary common public key;
第一认证协商模块12用于根据第二随机数、临时共同公钥和第一VIU预设的设备私钥,与第一域控制单元DC认证并协商通信密钥和随机数种子,第一DC为车内电子控制系统中的一个DC;The first authentication negotiation module 12 is configured to authenticate and negotiate a communication key and a random number seed with the first domain control unit DC according to the second random number, the temporary common public key and the device private key preset by the first VIU, and the first DC It is a DC in the electronic control system in the car;
第二认证协商模块13用于根据随机数种子和第一VIU预设的认证密钥,与第一电子控制单元ECU进行认证并协商通信加密密钥和通信认证密钥;The second authentication negotiation module 13 is configured to perform authentication with the first electronic control unit ECU and negotiate the communication encryption key and the communication authentication key according to the random number seed and the authentication key preset by the first VIU;
发送模块14在确定与第一ECU认证成功后,将通信加密密钥和通信认证密钥通 过通信密钥加密后发送给第一DC。After determining that the authentication with the first ECU is successful, the sending module 14 encrypts the communication encryption key and the communication authentication key with the communication key and sends them to the first DC.
本实施例的装置,可以用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The apparatus of this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and the implementation principles and technical effects thereof are similar, and details are not described herein again.
图7为本申请提供的一种密钥协商装置实施例的结构示意图,如图7所示,在图6所示装置的基础上,进一步地,本实施例的装置中第一认证协商模块12可以包括:接收单元121、验证单元122、计算单元123、发送单元124和确定单元125,其中,FIG. 7 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application. As shown in FIG. 7 , on the basis of the apparatus shown in FIG. 6 , further, the first authentication negotiation module 12 in the apparatus of this embodiment is It may include: a receiving unit 121, a verification unit 122, a computing unit 123, a sending unit 124 and a determining unit 125, wherein,
接收单元121用于接收第一DC发送的第三随机数、临时公钥和签名值;The receiving unit 121 is configured to receive the third random number, the temporary public key and the signature value sent by the first DC;
验证单元122用于根据第一DC的设备公钥、第三随机数和临时公钥对签名值进行验证;The verification unit 122 is configured to verify the signature value according to the device public key, the third random number and the temporary public key of the first DC;
计算单元123用于在对签名值验证通过后,根据第二随机数、临时共同公钥和第一VIU的设备私钥计算数字签名值;The calculation unit 123 is used to calculate the digital signature value according to the second random number, the temporary common public key and the device private key of the first VIU after the signature value is verified and passed;
发送单元124用于将第二随机数、临时共同公钥和数字签名值发送给第一DC,用于第一DC根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字签名值进行验证,验证成功后根据临时私钥和临时共同公钥确定通信密钥;The sending unit 124 is configured to send the second random number, the temporary common public key and the digital signature value to the first DC, for the first DC to pair the digital data with the second random number, the temporary common public key and the device public key of the first VIU. The signature value is verified, and after the verification is successful, the communication key is determined according to the temporary private key and the temporary common public key;
确定单元125用于根据临时私钥和临时共同公钥确定通信密钥,并根据第三随机数和第二随机数确定随机数种子,或者根据第三随机数、第二随机数和第一VIU的功能域标识确定随机数种子。The determining unit 125 is configured to determine the communication key according to the temporary private key and the temporary common public key, and determine the random number seed according to the third random number and the second random number, or determine the random number seed according to the third random number, the second random number and the first VIU The functional domain identifier determines the random number seed.
进一步地,计算单元123还用于:在发送单元124将第二随机数、临时共同公钥和数字签名值发送给第一DC之后,根据第三随机数、临时公钥和临时共享密钥计算第一校验值;Further, the calculation unit 123 is further configured to: after the sending unit 124 sends the second random number, the temporary public public key and the digital signature value to the first DC, calculate the calculation according to the third random number, the temporary public key and the temporary shared key the first check value;
发送单元124还用于:将第三随机数、临时公钥和第一校验值发送给车内电子控制系统中的其它VIU,用于其它VIU根据根据第三随机数、临时公钥和临时共享密钥计算第二校验值,并在确认第一校验值与第二校验值相同时,根据临时公钥和临时共同私钥确定通信密钥,同时根据所述第三随机数和所述第二随机数确定所述随机数种子,或者同时根据第三随机数、第二随机数和其它VIU的功能域标识确定随机数种子。The sending unit 124 is further configured to: send the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system, for the other VIUs to use the third random number, the temporary public key and the temporary The shared key calculates the second check value, and when it is confirmed that the first check value is the same as the second check value, the communication key is determined according to the temporary public key and the temporary common private key, and at the same time according to the third random number and The second random number determines the random number seed, or simultaneously determines the random number seed according to the third random number, the second random number and the functional domain identifiers of other VIUs.
本实施例的装置,可以用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The apparatus of this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and the implementation principles and technical effects thereof are similar, and details are not described herein again.
图8为本申请提供的一种密钥协商装置实施例的结构示意图,如图8所示,在图6-或图7所示装置的基础上,本实施例以在图6所示装置的基础上为例,进一步地,本实施例的装置中第二认证协商模块13可以包括:接收单元131和认证协商单元132,其中,FIG. 8 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application. As shown in FIG. 8 , on the basis of the apparatus shown in FIG. 6 or FIG. Taking the basic example as an example, further, the second authentication negotiation module 13 in the apparatus of this embodiment may include: a receiving unit 131 and an authentication negotiation unit 132, wherein,
接收单元131用于接收第一ECU发送的第四随机数;The receiving unit 131 is configured to receive the fourth random number sent by the first ECU;
认证协商单元132用于根据第四随机数、随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商通信加密密钥和通信认证密钥。The authentication negotiation unit 132 is configured to perform authentication with the first ECU and negotiate the communication encryption key and the communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU.
进一步地,认证协商单元132用于:Further, the authentication negotiation unit 132 is used for:
根据第四随机数、随机数种子和第一VIU预设的认证密钥计算第三校验值;Calculate the third check value according to the fourth random number, the random number seed and the authentication key preset by the first VIU;
将随机数种子和第三校验值发送给第一ECU,用于第一ECU对第三校验值进行认证;Sending the random number seed and the third verification value to the first ECU for the first ECU to authenticate the third verification value;
接收第一ECU对第三校验值认证通过后发送的第一消息认证码和第二消息认证 码,第一消息认证码为第一ECU根据随机数种子和第一ECU预设的认证密钥计算得到,第二消息认证码为第一ECU根据通信加密密钥和通信认证密钥计算得到;Receive the first message authentication code and the second message authentication code sent by the first ECU after passing the authentication of the third check value, where the first message authentication code is the authentication key preset by the first ECU according to the random number seed and the first ECU Calculated, the second message authentication code is calculated by the first ECU according to the communication encryption key and the communication authentication key;
根据第一VIU预设的长期共享密钥和随机数种子确定通信加密密钥和通信认证密钥;Determine the communication encryption key and the communication authentication key according to the long-term shared key and random number seed preset by the first VIU;
对第一消息认证码和第二消息认证码进行认证。The first message authentication code and the second message authentication code are authenticated.
进一步地,认证协商单元132用于:根据随机数种子和第一VIU预设的认证密钥计算第三消息认证码,并根据通信加密密钥和通信认证密钥计算第四消息认证码;Further, the authentication negotiation unit 132 is configured to: calculate the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and calculate the fourth message authentication code according to the communication encryption key and the communication authentication key;
将第一消息认证码与第三消息认证码进行比对,将第二消息认证码与第四消息认证码进行比对;comparing the first message authentication code with the third message authentication code, and comparing the second message authentication code with the fourth message authentication code;
第二认证协商模块13用于:The second authentication negotiation module 13 is used for:
若第一消息认证码与第三消息认证码相同,且第二消息认证码与第四消息认证码相同,则确定与第一ECU认证成功。If the first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, it is determined that the authentication with the first ECU is successful.
进一步地,发送模块15用于:Further, the sending module 15 is used for:
将通信加密密钥和通信认证密钥通过通信密钥加密,得到加密密文;Encrypt the communication encryption key and the communication authentication key through the communication key to obtain the encrypted ciphertext;
将第二消息认证码和加密密文发送给第一DC。Send the second message authentication code and encrypted ciphertext to the first DC.
本实施例的装置,可以用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The apparatus of this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and the implementation principles and technical effects thereof are similar, and details are not described herein again.
图9为本申请提供的一种密钥协商装置实施例的结构示意图,如图9所示,本实施例的装置可以包括:生成模块21、认证协商模块22和接收模块23,其中,FIG. 9 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application. As shown in FIG. 9 , the apparatus of this embodiment may include: a generating module 21 , an authentication negotiation module 22 and a receiving module 23 , wherein,
生成模块21用于生成临时私钥和第三随机数,并根据临时私钥生成对应的临时公钥,第一DC为车内电子控制系统中的一个DC;The generation module 21 is used to generate a temporary private key and a third random number, and generate a corresponding temporary public key according to the temporary private key, and the first DC is a DC in the in-vehicle electronic control system;
认证协商模块22用于根据临时公钥、第三随机数和第一DC预设的设备私钥,与第一整车集成单元VIU进行认证并协商通信密钥;The authentication negotiation module 22 is configured to authenticate and negotiate a communication key with the first vehicle integration unit VIU according to the temporary public key, the third random number and the device private key preset by the first DC;
接收模块23用于接收第一VIU发送的通过通信密钥加密后的通信加密密钥和通信认证密钥,通信加密密钥和通信认证密钥为第一VIU根据随机数种子和第一VIU预设的认证密钥,与第一ECU进行认证并协商得到。The receiving module 23 is configured to receive the communication encryption key and the communication authentication key encrypted by the communication key and sent by the first VIU. The set authentication key is obtained through authentication and negotiation with the first ECU.
本实施例的装置,可以用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The apparatus of this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and the implementation principles and technical effects thereof are similar, and details are not described herein again.
图10为本申请提供的一种密钥协商装置实施例的结构示意图,如图10所示,在图9所示装置的基础上,进一步地,本实施例的装置中认证协商模块22可以包括:数字签名单元221、发送单元222、接收单元223、验证单元224和确定单元225,其中,FIG. 10 is a schematic structural diagram of an embodiment of a key agreement apparatus provided by the present application. As shown in FIG. 10 , on the basis of the apparatus shown in FIG. 9 , further, the authentication negotiation module 22 in the apparatus of this embodiment may include : digital signature unit 221, sending unit 222, receiving unit 223, verifying unit 224 and determining unit 225, wherein,
数字签名单元221用于使用第一DC预设的设备私钥对临时公钥和第三随机数进行数字签名,得到签名值;The digital signature unit 221 is used to digitally sign the temporary public key and the third random number using the device private key preset by the first DC to obtain a signature value;
发送单元222用于将临时公钥、第三随机数和签名值发送给第一VIU;The sending unit 222 is configured to send the temporary public key, the third random number and the signature value to the first VIU;
接收单元223用于接收第一VIU发送的第二随机数、临时共同公钥和数字签名值,数字签名值为第一VIU根据第二随机数、临时共同公钥和第一VIU预设的设备私钥计算得到,第二随机数为第一VIU根据第一随机数确定,第一随机数为第一VIU与车内电子控制系统中的其它VIU协商出的共有的随机数;The receiving unit 223 is configured to receive the second random number, the temporary common public key and the digital signature value sent by the first VIU, where the digital signature value is the device preset by the first VIU according to the second random number, the temporary common public key and the first VIU The private key is calculated and obtained, the second random number is determined by the first VIU according to the first random number, and the first random number is a common random number negotiated by the first VIU and other VIUs in the in-vehicle electronic control system;
验证单元224用于根据第二随机数、临时共同公钥和第一VIU的设备公钥对数字 签名值进行验证;The verification unit 224 is configured to verify the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU;
确定单元225用于在验证单元对数字签名值验证通过后,根据临时私钥和临时共同公钥确定通信密钥。The determining unit 225 is configured to determine the communication key according to the temporary private key and the temporary common public key after the verification unit passes the verification of the digital signature value.
本实施例的装置,可以用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The apparatus of this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and the implementation principles and technical effects thereof are similar, and details are not described herein again.
图11为本申请提供的一种密钥协商装置示意图,该密钥协商装置100包括:FIG. 11 is a schematic diagram of a key agreement apparatus provided by this application, and the key agreement apparatus 100 includes:
存储器101和处理器102; memory 101 and processor 102;
存储器101,用于存储计算机程序; memory 101 for storing computer programs;
处理器102,用于执行存储器存储的计算机程序,以实现上述实施例中的密钥协商方法。具体可以参见前述方法实施例中的相关描述。The processor 102 is configured to execute the computer program stored in the memory to implement the key agreement method in the above embodiment. For details, refer to the relevant descriptions in the foregoing method embodiments.
可选地,存储器101既可以是独立的,也可以跟处理器102集成在一起。Optionally, the memory 101 may be independent or integrated with the processor 102 .
当存储器101是独立于处理器102之外的器件时,密钥协商装置100还可以包括:When the memory 101 is a device independent of the processor 102, the key agreement apparatus 100 may further include:
总线103,用于连接存储器101和处理器102。The bus 103 is used to connect the memory 101 and the processor 102 .
可选地,本实施例还包括:通信接口104,该通信接口104可以通过总线103与处理器102连接。处理器102可以控制通信接口103来实现密钥协商装置100的上述的获取的功能。Optionally, this embodiment further includes: a communication interface 104 , where the communication interface 104 can be connected to the processor 102 through the bus 103 . The processor 102 can control the communication interface 103 to realize the above-mentioned acquisition function of the key agreement apparatus 100 .
该装置可以用于执行上述方法实施例中的各个步骤和/或流程。The apparatus may be used to execute each step and/or process in the above method embodiments.
本申请还提供一种可读存储介质,可读存储介质中存储有执行指令,当密钥协商装置的至少一个处理器执行该执行指令时,密钥协商装置执行上述的各种实施方式提供的密钥协商方法。The present application further provides a readable storage medium, where an execution instruction is stored in the readable storage medium. When at least one processor of the key agreement apparatus executes the execution instruction, the key agreement apparatus executes the execution instructions provided by the above-mentioned various embodiments. Key agreement method.
本申请还提供一种程序产品,该程序产品包括执行指令,该执行指令存储在可读存储介质中。密钥协商装置的至少一个处理器可以从可读存储介质读取该执行指令,至少一个处理器执行该执行指令使得密钥协商装置实施上述的各种实施方式提供的密钥协商方法。The present application also provides a program product including execution instructions stored in a readable storage medium. At least one processor of the key agreement apparatus can read the execution instruction from the readable storage medium, and the at least one processor executes the execution instruction to cause the key agreement apparatus to implement the key agreement methods provided by the various embodiments described above.
本领域普通技术人员可以理解:在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本发明实施例的流程或功能。计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。Those of ordinary skill in the art can understand that: in the above-mentioned embodiments, all or part of them may be implemented by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the embodiments of the present invention result in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server, or data center over a wire (e.g. coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.) to another website site, computer, server, or data center. A computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, or the like that includes an integration of one or more available media. Useful media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.

Claims (20)

  1. 一种密钥协商方法,其特征在于,包括:A key agreement method, comprising:
    第一整车集成单元VIU与车内电子控制系统中的其它VIU协商出共有的第一随机数后,根据所述第一随机数确定第二随机数、临时共享密钥和临时共同私钥,并根据所述临时共同私钥生成临时共同公钥;After the first vehicle integration unit VIU negotiates with other VIUs in the in-vehicle electronic control system to negotiate a shared first random number, the second random number, the temporary shared key and the temporary shared private key are determined according to the first random number, and generate a temporary common public key according to the temporary common private key;
    所述第一VIU根据所述第二随机数、所述临时共同公钥和第一VIU预设的设备私钥,与第一域控制单元DC认证并协商通信密钥和随机数种子,所述第一DC为所述车内电子控制系统中的一个DC;The first VIU authenticates and negotiates a communication key and a random number seed with the first domain control unit DC according to the second random number, the temporary common public key, and the device private key preset by the first VIU, and the The first DC is a DC in the in-vehicle electronic control system;
    所述第一VIU根据所述随机数种子和所述第一VIU预设的认证密钥,与第一电子控制单元ECU进行认证并协商通信加密密钥和通信认证密钥;The first VIU authenticates with the first electronic control unit ECU according to the random number seed and the authentication key preset by the first VIU, and negotiates a communication encryption key and a communication authentication key;
    所述第一VIU确定与所述第一ECU认证成功后,将所述通信加密密钥和通信认证密钥通过所述通信密钥加密后发送给所述第一DC。After the first VIU determines that the authentication with the first ECU is successful, the communication encryption key and the communication authentication key are encrypted by the communication key and then sent to the first DC.
  2. 根据权利要求1所述的方法,其特征在于,所述第一VIU根据所述第二随机数、所述临时共同公钥和第一VIU预设的设备私钥,与第一域控制单元DC认证并协商通信密钥和随机数种子,包括:The method according to claim 1, wherein the first VIU communicates with the first domain control unit DC according to the second random number, the temporary common public key and the device private key preset by the first VIU Authenticate and negotiate communication keys and random number seeds, including:
    所述第一VIU接收所述第一DC发送的第三随机数、临时公钥和签名值;receiving, by the first VIU, a third random number, a temporary public key and a signature value sent by the first DC;
    所述第一VIU根据第一DC的设备公钥、第三随机数和临时公钥对所述签名值进行验证;The first VIU verifies the signature value according to the device public key, the third random number and the temporary public key of the first DC;
    所述第一VIU对所述签名值验证通过后,根据所述第二随机数、所述临时共同公钥和所述第一VIU的设备私钥计算数字签名值;After the first VIU passes the verification of the signature value, calculate the digital signature value according to the second random number, the temporary common public key and the device private key of the first VIU;
    所述第一VIU将所述第二随机数、所述临时共同公钥和所述数字签名值发送给所述第一DC,用于所述第一DC根据所述第二随机数、所述临时共同公钥和所述第一VIU的设备公钥对所述数字签名值进行验证,验证成功后根据所述临时私钥和所述临时共同公钥确定所述通信密钥;The first VIU sends the second random number, the temporary common public key and the digital signature value to the first DC, for the first DC to use the second random number, the The temporary common public key and the device public key of the first VIU verifies the digital signature value, and after successful verification, the communication key is determined according to the temporary private key and the temporary common public key;
    所述第一VIU根据所述临时私钥和所述临时共同公钥确定所述通信密钥,并根据所述第三随机数和所述第二随机数确定所述随机数种子,或者根据所述第三随机数、所述第二随机数和所述第一VIU的功能域标识确定所述随机数种子。The first VIU determines the communication key according to the temporary private key and the temporary common public key, and determines the random number seed according to the third random number and the second random number, or determines the random number seed according to the third random number and the second random number. The random number seed is determined by the third random number, the second random number and the functional domain identifier of the first VIU.
  3. 根据权利要求2所述的方法,其特征在于,所述第一VIU将所述第二随机数、所述临时共同公钥、所述数字签名值和所述第一VIU预设的设备证书发送给所述第一DC之后,所述方法还包括:The method according to claim 2, wherein the first VIU sends the second random number, the temporary common public key, the digital signature value and the device certificate preset by the first VIU After giving the first DC, the method further includes:
    所述第一VIU根据所述第三随机数、所述临时公钥和所述临时共享密钥计算第一校验值;The first VIU calculates a first check value according to the third random number, the temporary public key and the temporary shared key;
    所述第一VIU将所述第三随机数、所述临时公钥和所述第一校验值发送给所述车内电子控制系统中的其它VIU,用于所述其它VIU根据根据所述第三随机数、所述临时公钥和所述临时共享密钥计算第二校验值,并在确认所述第一校验值与所述第二校验值相同时,根据所述临时公钥和所述临时共同私钥确定所述通信密钥,同时根据所述第三随机数和所述第二随机数确定所述随机数种子,或者同时根据所述第三随机数、所述第二随机数和所述其它VIU的功能域标识确定所述随机数种子。The first VIU sends the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system, for the other VIUs to use the A second check value is calculated from the third random number, the temporary public key and the temporary shared key, and when it is confirmed that the first check value is the same as the second check value, the second check value is calculated according to the temporary public key. key and the temporary common private key to determine the communication key, and simultaneously determine the random number seed according to the third random number and the second random number, or determine the random number seed according to the third random number and the second random number simultaneously. Two random numbers and functional domain identifiers of the other VIUs determine the random number seed.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述第一VIU根据所述随机数种子和所述第一VIU预设的认证密钥,与第一ECU进行认证并协商通信加密密钥和通信认证密钥,包括:The method according to any one of claims 1-3, wherein the first VIU authenticates and negotiates with the first ECU according to the random number seed and an authentication key preset by the first VIU Communication encryption keys and communication authentication keys, including:
    所述第一VIU接收所述第一ECU发送的第四随机数;receiving, by the first VIU, a fourth random number sent by the first ECU;
    所述第一VIU根据所述第四随机数、所述随机数种子和所述第一VIU预设的认证密钥,与所述第一ECU进行认证并协商通信加密密钥和通信认证密钥。The first VIU authenticates and negotiates a communication encryption key and a communication authentication key with the first ECU according to the fourth random number, the random number seed and the authentication key preset by the first VIU .
  5. 根据权利要求4所述的方法,其特征在于,所述第一VIU根据所述第四随机数、所述随机数种子和所述第一VIU预设的认证密钥,与所述第一ECU进行认证并协商通信加密密钥和通信认证密钥,包括:The method according to claim 4, wherein the first VIU communicates with the first ECU according to the fourth random number, the random number seed and an authentication key preset by the first VIU Authenticate and negotiate communication encryption keys and communication authentication keys, including:
    所述第一VIU根据所述第四随机数、所述随机数种子和所述第一VIU预设的认证密钥计算第三校验值;The first VIU calculates a third check value according to the fourth random number, the random number seed and the authentication key preset by the first VIU;
    所述第一VIU将所述随机数种子和所述第三校验值发送给所述第一ECU,用于所述第一ECU对所述第三校验值进行认证;The first VIU sends the random number seed and the third verification value to the first ECU, for the first ECU to authenticate the third verification value;
    所述第一VIU接收所述第一ECU对所述第三校验值认证通过后发送的第一消息认证码和第二消息认证码,所述第一消息认证码为所述第一ECU根据所述随机数种子和所述第一ECU预设的认证密钥计算得到,所述第二消息认证码为所述第一ECU根据所述通信加密密钥和所述通信认证密钥计算得到;The first VIU receives the first message authentication code and the second message authentication code sent by the first ECU after passing the authentication of the third check value, and the first message authentication code is the first message authentication code according to the first ECU. The random number seed and the authentication key preset by the first ECU are calculated, and the second message authentication code is calculated by the first ECU according to the communication encryption key and the communication authentication key;
    所述第一VIU根据所述第一VIU预设的长期共享密钥和随机数种子确定所述通信加密密钥和所述通信认证密钥;The first VIU determines the communication encryption key and the communication authentication key according to the long-term shared key and random number seed preset by the first VIU;
    所述第一VIU对所述第一消息认证码和所述第二消息认证码进行认证。The first VIU authenticates the first message authentication code and the second message authentication code.
  6. 根据权利要求5所述的方法,其特征在于,所述第一VIU对所述第一消息认证码和所述第二消息认证码进行认证,包括:The method according to claim 5, wherein the first VIU authenticates the first message authentication code and the second message authentication code, comprising:
    所述第一VIU根据所述随机数种子和所述第一VIU预设的认证密钥计算第三消息认证码,并根据所述通信加密密钥和所述通信认证密钥计算第四消息认证码;The first VIU calculates the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and calculates the fourth message authentication code according to the communication encryption key and the communication authentication key code;
    所述第一VIU将所述第一消息认证码与所述第三消息认证码进行比对,将所述第二消息认证码与所述第四消息认证码进行比对;The first VIU compares the first message authentication code with the third message authentication code, and compares the second message authentication code with the fourth message authentication code;
    所述第一VIU确定与所述第一ECU认证成功,包括:The first VIU determines that the authentication with the first ECU is successful, including:
    若第一消息认证码与所述第三消息认证码相同,且所述第二消息认证码与所述第四消息认证码相同,则第一VIU确定与所述第一ECU认证成功。If the first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, the first VIU determines that the authentication with the first ECU is successful.
  7. 根据权利要求6所述的方法,其特征在于,所述将所述通信加密密钥和通信认证密钥通过所述通信密钥加密后发送给所述第一DC,包括:The method according to claim 6, wherein the sending the communication encryption key and the communication authentication key to the first DC after encrypting the communication key with the communication key comprises:
    所述第一VIU将所述通信加密密钥和通信认证密钥通过所述通信密钥加密,得到加密密文;The first VIU encrypts the communication encryption key and the communication authentication key by the communication key to obtain encrypted ciphertext;
    所述第一VIU将所述第二消息认证码和所述加密密文发送给所述第一DC。The first VIU sends the second message authentication code and the encrypted ciphertext to the first DC.
  8. 一种密钥协商方法,其特征在于,包括:A key agreement method, comprising:
    第一域控制单元DC生成临时私钥和第三随机数,并根据所述临时私钥生成对应的临时公钥,所述第一DC为车内电子控制系统中的一个DC;The first domain control unit DC generates a temporary private key and a third random number, and generates a corresponding temporary public key according to the temporary private key, and the first DC is a DC in the in-vehicle electronic control system;
    所述第一DC根据所述临时公钥、所述第三随机数和所述第一DC预设的设备私钥,与第一整车集成单元VIU进行认证并协商通信密钥;The first DC authenticates and negotiates a communication key with the first vehicle integration unit VIU according to the temporary public key, the third random number and the device private key preset by the first DC;
    所述第一DC接收所述第一VIU发送的通过所述通信密钥加密后的通信加密密钥和通信认证密钥,所述通信加密密钥和通信认证密钥为所述第一VIU根据所述随机数种子和所述第一VIU预设的认证密钥,与所述第一ECU进行认证并协商得到。The first DC receives the communication encryption key and communication authentication key encrypted by the communication key and sent by the first VIU, where the communication encryption key and communication authentication key are the first VIU according to The random number seed and the authentication key preset by the first VIU are obtained through authentication and negotiation with the first ECU.
  9. 根据权利要求8所述的方法,其特征在于,所述第一DC根据所述临时公钥、所述第三随机数和所述第一DC预设的设备私钥,与第一整车集成单元VIU进行认证并协商通信密钥,包括:The method according to claim 8, wherein the first DC is integrated with the first vehicle according to the temporary public key, the third random number and the device private key preset by the first DC The unit VIU performs authentication and negotiates communication keys, including:
    所述第一DC使用所述第一DC预设的设备私钥对所述临时公钥和所述第三随机数进行数字签名,得到签名值;The first DC uses the device private key preset by the first DC to digitally sign the temporary public key and the third random number to obtain a signature value;
    所述第一DC将所述临时公钥、所述第三随机数和所述签名值发送给第一VIU;The first DC sends the temporary public key, the third random number and the signature value to the first VIU;
    所述第一DC接收所述第一VIU发送的第二随机数、临时共同公钥和数字签名值,所述数字签名值为所述第一VIU根据所述第二随机数、所述临时共同公钥和所述第一VIU预设的设备私钥计算得到,所述第二随机数为所述第一VIU根据第一随机数确定,所述第一随机数为所述第一VIU与车内电子控制系统中的其它VIU协商出的共有的随机数;The first DC receives the second random number, the temporary common public key, and the digital signature value sent by the first VIU, where the digital signature value is the first VIU according to the second random number, the temporary common public key The public key and the device private key preset by the first VIU are calculated, the second random number is determined by the first VIU according to the first random number, and the first random number is the first VIU and the vehicle. The random number negotiated by other VIUs in the internal electronic control system;
    所述第一DC根据所述第二随机数、所述临时共同公钥和所述第一VIU的设备公钥对所述数字签名值进行验证;The first DC verifies the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU;
    所述第一DC对所述数字签名值验证通过后,根据所述临时私钥和所述临时共同公钥确定所述通信密钥。After the first DC has passed the verification of the digital signature value, the communication key is determined according to the temporary private key and the temporary common public key.
  10. 一种密钥协商装置,其特征在于,包括:A key agreement device, comprising:
    确定模块,用于与车内电子控制系统中的其它VIU协商出共有的第一随机数后,根据所述第一随机数确定第二随机数、临时共享密钥和临时共同私钥,并根据所述临时共同私钥生成临时共同公钥;The determining module is used to determine a second random number, a temporary shared key and a temporary common private key according to the first random number after negotiating a common first random number with other VIUs in the in-vehicle electronic control system, and according to the The temporary common private key generates a temporary common public key;
    第一认证协商模块,用于根据所述第二随机数、所述临时共同公钥和第一VIU预设的设备私钥,与第一域控制单元DC认证并协商通信密钥和随机数种子,所述第一DC为所述车内电子控制系统中的一个DC;A first authentication negotiation module, configured to authenticate and negotiate a communication key and a random number seed with the first domain control unit DC according to the second random number, the temporary common public key and the device private key preset by the first VIU , the first DC is a DC in the in-vehicle electronic control system;
    第二认证协商模块,用于根据所述随机数种子和所述第一VIU预设的认证密钥,与第一电子控制单元ECU进行认证并协商通信加密密钥和通信认证密钥;a second authentication negotiation module, configured to perform authentication with the first electronic control unit ECU and negotiate a communication encryption key and a communication authentication key according to the random number seed and the authentication key preset by the first VIU;
    发送模块,在确定与所述第一ECU认证成功后,将所述通信加密密钥和通信认证密钥通过所述通信密钥加密后发送给所述第一DC。The sending module, after determining that the authentication with the first ECU is successful, encrypts the communication encryption key and the communication authentication key with the communication key and sends them to the first DC.
  11. 根据权利要求10所述的装置,其特征在于,所述第一认证协商模块包括:The apparatus according to claim 10, wherein the first authentication negotiation module comprises:
    接收单元,用于接收所述第一DC发送的第三随机数、临时公钥和签名值;a receiving unit, configured to receive a third random number, a temporary public key and a signature value sent by the first DC;
    验证单元,用于根据第一DC的设备公钥、第三随机数和临时公钥对所述签名值进行验证;a verification unit, configured to verify the signature value according to the device public key, the third random number and the temporary public key of the first DC;
    计算单元,用于在所述对所述签名值验证通过后,根据所述第二随机数、所述临时共同公钥和所述第一VIU的设备私钥计算数字签名值;a calculation unit, configured to calculate a digital signature value according to the second random number, the temporary common public key and the device private key of the first VIU after the verification of the signature value is passed;
    发送单元,用于将所述第二随机数、所述临时共同公钥和所述数字签名值发送给所述第一DC,用于所述第一DC根据所述第二随机数、所述临时共同公钥和所述第一VIU的设备公钥对所述数字签名值进行验证,验证成功后根据所述临时私钥和所述临时共同公钥确定所述通信密钥;A sending unit, configured to send the second random number, the temporary common public key and the digital signature value to the first DC, for the first DC to use the second random number, the Verifying the digital signature value with the temporary common public key and the device public key of the first VIU, and determining the communication key according to the temporary private key and the temporary common public key after successful verification;
    确定单元,用于根据所述临时私钥和所述临时共同公钥确定所述通信密钥,并根据所述第三随机数和所述第二随机数确定所述随机数种子,或者根据所述第三随机数、所述第二随机数和所述第一VIU的功能域标识确定所述随机数种子。a determining unit, configured to determine the communication key according to the temporary private key and the temporary common public key, and determine the random number seed according to the third random number and the second random number, or according to the The random number seed is determined by the third random number, the second random number and the functional domain identifier of the first VIU.
  12. 根据权利要求11所述的装置,其特征在于,The apparatus of claim 11, wherein:
    所述计算单元还用于:在所述发送单元将所述第二随机数、所述临时共同公钥和所述数字签名值发送给所述第一DC之后,根据所述第三随机数、所述临时公钥和所述临时共享密钥计算第一校验值;The computing unit is further configured to: after the sending unit sends the second random number, the temporary common public key and the digital signature value to the first DC, according to the third random number, The temporary public key and the temporary shared key calculate a first check value;
    所述发送单元还用于:将所述第三随机数、所述临时公钥和所述第一校验值发送给所述车内电子控制系统中的其它VIU,用于所述其它VIU根据根据所述第三随机数、所述临时公钥和所述临时共享密钥计算第二校验值,并在确认所述第一校验值与所述 第二校验值相同时,根据所述临时公钥和所述临时共同私钥确定所述通信密钥,同时根据所述第三随机数和所述第二随机数确定所述随机数种子,或者同时根据所述第三随机数、所述第二随机数和所述其它VIU的功能域标识确定所述随机数种子。The sending unit is further configured to: send the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system for the other VIUs to use according to the Calculate a second check value according to the third random number, the temporary public key and the temporary shared key, and when it is confirmed that the first check value is the same as the second check value, according to the The communication key is determined by the temporary public key and the temporary common private key, and the random number seed is determined according to the third random number and the second random number, or the third random number, The second random number and the functional domain identifiers of the other VIUs determine the random number seed.
  13. 根据权利要求10-12任一项所述的装置,其特征在于,所述第二认证协商模块包括:The apparatus according to any one of claims 10-12, wherein the second authentication negotiation module comprises:
    接收单元,用于接收所述第一ECU发送的第四随机数;a receiving unit, configured to receive the fourth random number sent by the first ECU;
    认证协商单元,用于根据所述第四随机数、所述随机数种子和所述第一VIU预设的认证密钥,与所述第一ECU进行认证并协商通信加密密钥和通信认证密钥。An authentication negotiation unit, configured to perform authentication with the first ECU and negotiate a communication encryption key and a communication authentication key according to the fourth random number, the random number seed and the authentication key preset by the first VIU key.
  14. 根据权利要求13所述的装置,其特征在于,所述认证协商单元用于:The apparatus according to claim 13, wherein the authentication negotiation unit is configured to:
    根据所述第四随机数、所述随机数种子和所述第一VIU预设的认证密钥计算第三校验值;Calculate a third check value according to the fourth random number, the random number seed and the authentication key preset by the first VIU;
    将所述随机数种子和所述第三校验值发送给所述第一ECU,用于所述第一ECU对所述第三校验值进行认证;sending the random number seed and the third verification value to the first ECU for the first ECU to authenticate the third verification value;
    接收所述第一ECU对所述第三校验值认证通过后发送的第一消息认证码和第二消息认证码,所述第一消息认证码为所述第一ECU根据所述随机数种子和所述第一ECU预设的认证密钥计算得到,所述第二消息认证码为所述第一ECU根据所述通信加密密钥和所述通信认证密钥计算得到;Receive a first message authentication code and a second message authentication code sent by the first ECU after passing the authentication of the third check value, where the first message authentication code is the seed of the random number by the first ECU and the authentication key preset by the first ECU, and the second message authentication code is calculated by the first ECU according to the communication encryption key and the communication authentication key;
    根据所述第一VIU预设的长期共享密钥和随机数种子确定所述通信加密密钥和所述通信认证密钥;Determine the communication encryption key and the communication authentication key according to the long-term shared key and random number seed preset by the first VIU;
    对所述第一消息认证码和所述第二消息认证码进行认证。The first message authentication code and the second message authentication code are authenticated.
  15. 根据权利要求14所述的装置,其特征在于,所述认证协商单元用于:The apparatus according to claim 14, wherein the authentication negotiation unit is configured to:
    根据所述随机数种子和所述第一VIU预设的认证密钥计算第三消息认证码,并根据所述通信加密密钥和所述通信认证密钥计算第四消息认证码;Calculate the third message authentication code according to the random number seed and the authentication key preset by the first VIU, and calculate the fourth message authentication code according to the communication encryption key and the communication authentication key;
    将所述第一消息认证码与所述第三消息认证码进行比对,将所述第二消息认证码与所述第四消息认证码进行比对;comparing the first message authentication code with the third message authentication code, and comparing the second message authentication code with the fourth message authentication code;
    所述第二认证协商模块用于:The second authentication negotiation module is used for:
    若第一消息认证码与所述第三消息认证码相同,且所述第二消息认证码与所述第四消息认证码相同,则确定与所述第一ECU认证成功。If the first message authentication code is the same as the third message authentication code, and the second message authentication code is the same as the fourth message authentication code, it is determined that the authentication with the first ECU is successful.
  16. 根据权利要求10所述的装置,其特征在于,所述发送模块用于:The device according to claim 10, wherein the sending module is configured to:
    将所述通信加密密钥和通信认证密钥通过所述通信密钥加密,得到加密密文;Encrypting the communication encryption key and the communication authentication key by the communication key to obtain an encrypted ciphertext;
    将所述第二消息认证码和所述加密密文发送给所述第一DC。Send the second message authentication code and the encrypted ciphertext to the first DC.
  17. 一种密钥协商装置,其特征在于,包括:A key agreement device, comprising:
    生成模块,用于生成临时私钥和第三随机数,并根据所述临时私钥生成对应的临时公钥,所述第一DC为车内电子控制系统中的一个DC;a generating module, configured to generate a temporary private key and a third random number, and generate a corresponding temporary public key according to the temporary private key, and the first DC is a DC in the in-vehicle electronic control system;
    认证协商模块,用于根据所述临时公钥、所述第三随机数和所述第一DC预设的设备私钥,与第一整车集成单元VIU进行认证并协商通信密钥;an authentication negotiation module, configured to authenticate and negotiate a communication key with the first vehicle integration unit VIU according to the temporary public key, the third random number and the device private key preset by the first DC;
    接收模块,用于接收所述第一VIU发送的通过所述通信密钥加密后的通信加密密钥和通信认证密钥,所述通信加密密钥和通信认证密钥为所述第一VIU根据所述随机数种子和所述第一VIU预设的认证密钥,与所述第一ECU进行认证并协商得到。A receiving module, configured to receive the communication encryption key and the communication authentication key encrypted by the communication key and sent by the first VIU, where the communication encryption key and the communication authentication key are the first VIU according to The random number seed and the authentication key preset by the first VIU are obtained through authentication and negotiation with the first ECU.
  18. 根据权利要求17所述的装置,其特征在于,所述认证协商模块包括:The apparatus according to claim 17, wherein the authentication negotiation module comprises:
    数字签名单元,用于使用所述第一DC预设的设备私钥对所述临时公钥和所述第三随机数进行数字签名,得到签名值;a digital signature unit, configured to digitally sign the temporary public key and the third random number using the device private key preset by the first DC to obtain a signature value;
    发送单元,用于将所述临时公钥、所述第三随机数和所述签名值发送给第一VIU;a sending unit, configured to send the temporary public key, the third random number and the signature value to the first VIU;
    接收单元,用于接收所述第一VIU发送的第二随机数、临时共同公钥和数字签名值,所述数字签名值为所述第一VIU根据所述第二随机数、所述临时共同公钥和所述第一VIU预设的设备私钥计算得到,所述第二随机数为所述第一VIU根据第一随机数确定,所述第一随机数为所述第一VIU与车内电子控制系统中的其它VIU协商出的共有的随机数;A receiving unit, configured to receive a second random number, a temporary common public key and a digital signature value sent by the first VIU, where the digital signature value is the first VIU according to the second random number, the temporary common public key The public key and the device private key preset by the first VIU are calculated, the second random number is determined by the first VIU according to the first random number, and the first random number is the first VIU and the vehicle. The random number negotiated by other VIUs in the internal electronic control system;
    验证单元,用于根据所述第二随机数、所述临时共同公钥和所述第一VIU的设备公钥对所述数字签名值进行验证;a verification unit, configured to verify the digital signature value according to the second random number, the temporary common public key and the device public key of the first VIU;
    确定单元,用于在所述验证单元对所述数字签名值验证通过后,根据所述临时私钥和所述临时共同公钥确定所述通信密钥。a determining unit, configured to determine the communication key according to the temporary private key and the temporary common public key after the verification unit passes the verification of the digital signature value.
  19. 一种密钥协商装置,其特征在于,包括:A key agreement device, comprising:
    存储器,用于存储程序指令;memory for storing program instructions;
    处理器,用于当调用并执行存储器中的程序指令时,执行如权利要求1-7或8-9任意一项密钥协商方法。The processor is configured to execute the key agreement method according to any one of claims 1-7 or 8-9 when calling and executing the program instructions in the memory.
  20. 一种可读存储介质,其特征在于,所述可读存储介质中存储有执行指令,当密钥协商装置的至少一个处理器执行该执行指令时,所述密钥协商装置执行如权利要求1-7或8-9任意一项密钥协商方法。A readable storage medium, characterized in that an execution instruction is stored in the readable storage medium, and when at least one processor of the key agreement apparatus executes the execution instruction, the key agreement apparatus executes the execution as claimed in claim 1 -7 or 8-9 any one of the key agreement methods.
PCT/CN2020/105736 2020-07-30 2020-07-30 Key negotiation method and apparatus WO2022021193A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/105736 WO2022021193A1 (en) 2020-07-30 2020-07-30 Key negotiation method and apparatus
CN202080004392.2A CN112544052B (en) 2020-07-30 2020-07-30 Key agreement method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/105736 WO2022021193A1 (en) 2020-07-30 2020-07-30 Key negotiation method and apparatus

Publications (1)

Publication Number Publication Date
WO2022021193A1 true WO2022021193A1 (en) 2022-02-03

Family

ID=75017365

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/105736 WO2022021193A1 (en) 2020-07-30 2020-07-30 Key negotiation method and apparatus

Country Status (2)

Country Link
CN (1) CN112544052B (en)
WO (1) WO2022021193A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114785529A (en) * 2022-06-20 2022-07-22 广东名阳信息科技有限公司 Method and system for establishing trusted communication link based on block chain
CN115001764A (en) * 2022-05-23 2022-09-02 中国科学技术大学 Cross-domain key agreement method and system based on consensus database under layered system
CN116301726A (en) * 2023-04-13 2023-06-23 支付宝(杭州)信息技术有限公司 Multiparty combined random seed negotiation method and device
CN117436043A (en) * 2023-12-20 2024-01-23 鼎铉商用密码测评技术(深圳)有限公司 Source verification method, equipment and readable storage medium of the file to be executed
CN118041533A (en) * 2024-04-10 2024-05-14 合肥工业大学 Safety communication method and system of ECU in vehicle
CN119577792A (en) * 2024-07-31 2025-03-07 中国移动通信集团浙江有限公司 Secure communication method, device, system, electronic device and storage medium
CN119766440A (en) * 2024-12-27 2025-04-04 中电信量子信息科技集团有限公司 Cross-domain intercom group communication system, method, device, equipment and medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12120225B2 (en) * 2020-09-25 2024-10-15 Renesas Electronics Corporation Secure key generation and management in open and secure processor environments
CN113194465B (en) * 2021-04-20 2023-11-24 歌尔股份有限公司 BLE connection verification method and device between terminals and readable storage medium
CN112910933B (en) * 2021-05-07 2021-07-13 鹏城实验室 Authentication method, authentication device, and verification device
CN114640443B (en) * 2022-03-17 2023-05-09 浙江广厦建设职业技术大学 A secure interactive method and system for online engineering quotation

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106302379A (en) * 2015-06-26 2017-01-04 比亚迪股份有限公司 The authentication method of vehicle mounted electrical apparatus, system and its apparatus
CN110943957A (en) * 2018-09-21 2020-03-31 郑州信大捷安信息技术股份有限公司 Safety communication system and method for vehicle intranet
CN110959274A (en) * 2017-07-20 2020-04-03 华为国际有限公司 System and method for managing safety communication between modules in controller local area network
US20200220724A1 (en) * 2017-08-21 2020-07-09 Mitsubishi Electric Corporation Key management device, and communication apparatus

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7590589B2 (en) * 2004-09-10 2009-09-15 Hoffberg Steven M Game theoretic prioritization scheme for mobile ad hoc networks permitting hierarchal deference
CN105187205B (en) * 2015-08-05 2018-05-15 北京航空航天大学 The authentication key agreement method and negotiating system based on level identity base without certificate
CN111416712B (en) * 2020-04-01 2023-03-24 南京如般量子科技有限公司 Quantum secret communication identity authentication system and method based on multiple mobile devices

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106302379A (en) * 2015-06-26 2017-01-04 比亚迪股份有限公司 The authentication method of vehicle mounted electrical apparatus, system and its apparatus
CN110959274A (en) * 2017-07-20 2020-04-03 华为国际有限公司 System and method for managing safety communication between modules in controller local area network
US20200220724A1 (en) * 2017-08-21 2020-07-09 Mitsubishi Electric Corporation Key management device, and communication apparatus
CN110943957A (en) * 2018-09-21 2020-03-31 郑州信大捷安信息技术股份有限公司 Safety communication system and method for vehicle intranet

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHE ZHI: "Interpretation of Huawei’s Computation + Communication (CC) Architecture: "Platform + Ecosystem" for a Whole New Future of Vehicles", OFWEEK, 28 October 2019 (2019-10-28), pages 1 - 7, XP055890264, Retrieved from the Internet <URL:https://m.ofweek.com/auto/2019-10/ART-70110-11000-30414053.html> [retrieved on 20220210] *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115001764A (en) * 2022-05-23 2022-09-02 中国科学技术大学 Cross-domain key agreement method and system based on consensus database under layered system
CN115001764B (en) * 2022-05-23 2023-07-11 中国科学技术大学 Cross-domain key agreement method and system based on consensus database under layered system
CN114785529A (en) * 2022-06-20 2022-07-22 广东名阳信息科技有限公司 Method and system for establishing trusted communication link based on block chain
CN114785529B (en) * 2022-06-20 2022-10-04 广东名阳信息科技有限公司 Method and system for establishing trusted communication link based on block chain
CN116301726A (en) * 2023-04-13 2023-06-23 支付宝(杭州)信息技术有限公司 Multiparty combined random seed negotiation method and device
CN117436043A (en) * 2023-12-20 2024-01-23 鼎铉商用密码测评技术(深圳)有限公司 Source verification method, equipment and readable storage medium of the file to be executed
CN118041533A (en) * 2024-04-10 2024-05-14 合肥工业大学 Safety communication method and system of ECU in vehicle
CN118041533B (en) * 2024-04-10 2024-06-11 合肥工业大学 A secure communication method and communication system for in-vehicle ECU
CN119577792A (en) * 2024-07-31 2025-03-07 中国移动通信集团浙江有限公司 Secure communication method, device, system, electronic device and storage medium
CN119766440A (en) * 2024-12-27 2025-04-04 中电信量子信息科技集团有限公司 Cross-domain intercom group communication system, method, device, equipment and medium

Also Published As

Publication number Publication date
CN112544052A (en) 2021-03-23
CN112544052B (en) 2022-03-11

Similar Documents

Publication Publication Date Title
WO2022021193A1 (en) Key negotiation method and apparatus
US10764040B2 (en) Dynamic domain key exchange for authenticated device to device communications
CN106664311B (en) Supports differentiated and secure communications between heterogeneous electronic devices
WO2019184924A1 (en) Identity management method, equipment, communication network, and storage medium
US20090240941A1 (en) Method and apparatus for authenticating device in multi domain home network environment
US9998287B2 (en) Secure authentication of remote equipment
US12132839B2 (en) Decentralised authentication
CN112383395B (en) Key negotiation method and device
CN116633530A (en) Quantum key transmission method, device and system
CN113285932B (en) Method for obtaining edge service, server and edge device
WO2023151427A1 (en) Quantum key transmission method, device and system
CN111654481B (en) Identity authentication method, identity authentication device and storage medium
CN111224784B (en) Role separation distributed authentication and authorization method based on hardware trusted root
WO2008002081A1 (en) Method and apparatus for authenticating device in multi domain home network environment
CN114091009A (en) Method for establishing secure link by using distributed identity
CN117439740A (en) In-vehicle network identity authentication and key negotiation method, system and terminal
CN113329003A (en) Access control method, user equipment and system for Internet of things
CN108377184A (en) A kind of intelligent automobile internal network distributed authentication encryption method
CN115361134A (en) Terminal identity authentication method, device, equipment and medium based on Hongming system
CN109995723B (en) Method, device and system for DNS information interaction of domain name resolution system
KR101802824B1 (en) METHOD AND APPARATUS FOR PLUG-IN DEVICE AUTHENTICATION IN AN OPEN-SOURCE PLUG-AND-PLAY(PnP) PLATFORM OF A CAR
CN107659409B (en) Method for providing an authenticated connection between at least two communication partners
Marasco et al. AuthentiCAN: A protocol for improved security over CAN
CN117941320A (en) Method and automation system for incorporating automation equipment
Shannon et al. Blockchain based distributed key provisioning and secure communication over CAN FD

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20946623

Country of ref document: EP

Kind code of ref document: A1