CN112544052B - Key agreement method and device - Google Patents

Key agreement method and device Download PDF

Info

Publication number
CN112544052B
CN112544052B CN202080004392.2A CN202080004392A CN112544052B CN 112544052 B CN112544052 B CN 112544052B CN 202080004392 A CN202080004392 A CN 202080004392A CN 112544052 B CN112544052 B CN 112544052B
Authority
CN
China
Prior art keywords
key
random number
viu
temporary
communication
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202080004392.2A
Other languages
Chinese (zh)
Other versions
CN112544052A (en
Inventor
郭志鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN112544052A publication Critical patent/CN112544052A/en
Application granted granted Critical
Publication of CN112544052B publication Critical patent/CN112544052B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Abstract

The application provides a key agreement method and a device. The method comprises the following steps: after a first VIU negotiates a common first random number with other VIUs in an in-vehicle electronic control system, a second random number, a temporary shared key and a temporary common private key are determined according to the first random number, a temporary common public key is generated according to the temporary common private key, then a communication key and a random number seed are authenticated and negotiated with a DC according to the second random number, the temporary common public key and an equipment private key preset by the first VIU, authentication is carried out on the communication encryption key and the communication authentication key with the first ECU according to the random number seed and an authentication key preset by the first VIU, and after the communication encryption key and the communication authentication key are determined to be successfully authenticated with the first ECU, the communication encryption key and the communication authentication key are encrypted through the communication key and then sent to the first DC. Therefore, key agreement under the CCA framework is realized, and the safe communication can be established between each DC and each ECU.

Description

Key agreement method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a key agreement method and apparatus.
Background
Nowadays, intellectualization, networking, electromotion and sharing have become development trends in the automobile field, and the development trends are usually realized by depending on an in-vehicle electronic control system, which mainly includes electronic control elements such as a Domain Controller (DC) and an Electronic Control Unit (ECU). The DC is used for controlling a plurality of automobile parts in the functional domain, the ECU has an electronic control function, the automobile parts can be controlled based on control information, and data to be transmitted in the automobile parts can be processed. Along with the development of networking and intellectualization of automobiles, various network safety hazards come along, such as network attack, data leakage, even remote control of vehicles and the like. Therefore, a perfect key management system is urgently needed by the in-vehicle electronic control system to provide safety guarantee for the vehicle and the user.
Key Management System (KMS) is used to generate, distribute, and manage devices and applicationsIn a centralized network architecture based on a central gateway, each functional domain has a DC, the specific function is completed by an ECU in a DC control domain, and cross-domain communication interaction is carried out between the DCs through the central gateway. In the prior art, an onboard KMS is deployed on a central gateway, which is responsible for distributing shared keys between the ECUs and the DC, so that secure communication can be established between each DC and each ECU. The process of generating the communication key by the ECU in the vehicle comprises the following steps: first, an ECUiGenerating a random number Ri and sending the random number Ri to a central gateway, generating a random number seed S after the central gateway receives Ri, and then generating an ECU (electronic control Unit) according to the identifier of the central gatewayiThe identifier, Ri, S and a preset initial key K are subjected to Hash operation to obtain a first message authentication code, and then the first message authentication code and the S are sent to the ECUi,ECUiFirst, the first message authentication code is authenticated, and the ECU is authenticated after the first message authentication code passesiGenerates a communication key by a key derivation function based on preset long-term shared keys GK and S, and then an ECUiAnd obtaining a second message authentication code through Hash operation according to the identifier of the central gateway and a preset initial key K, obtaining a third message authentication code through Hash operation according to the identifier of the central gateway and the communication key, and finally sending the second message authentication code and the third message authentication code to the central gateway for authentication. The in-vehicle DC generates the communication key in the same process as the ECU generates the communication key. The random number seed S based on which the communication key is generated is uniformly given by the central gateway, that is, the same S is received in the process of generating the communication key by all the ECUs and the DC of the whole vehicle, so that the same communication key can be guaranteed to be shared between all the ECUs and the DC of the whole vehicle.
However, in order to adapt to the trend of intelligent networking of automobiles, the in-vehicle electronic and electrical Architecture is gradually shifted from a centralized network Architecture based on a Central gateway to a distributed Central Computing Architecture (CCA). The CCA architecture distributes electronic control elements (including DC and ECU) of a Vehicle into a plurality of areas, each area is deployed with a Vehicle Integrated Unit (VIU) responsible for managing the ECUs in the area, and the VIUs are interconnected through a high-speed ethernet to complete Vehicle high-speed communication. In the CCA architecture, the central gateway is replaced by a plurality of VIUs, and in the above scheme, all ECUs and DCs in a whole vehicle have the same communication key and depend on a unique S given by the midnet gateway, where S is randomly generated at each key update, and the uniqueness of a plurality of VIUs and S in the CCA architecture cannot be guaranteed, so the above scheme is not applicable to the CCA architecture. Under the CCA architecture, how to negotiate the key is an urgent problem to be solved.
Disclosure of Invention
The application provides a key negotiation method and device, which are used for solving the problem of how to perform key negotiation under a CCA framework.
In a first aspect, the present application provides a key agreement method, including: after a first vehicle integrated unit VIU negotiates a common first random number with other VIUs in a vehicle electronic control system, a second random number, a temporary shared key and a temporary common private key are determined according to the first random number, a temporary common public key is generated according to the temporary common private key, the first VIU authenticates and negotiates a communication key and a random number seed with a first DC according to the second random number, the temporary common public key and a device private key preset by the first VIU, the first DC is one DC in the vehicle electronic control system, the first VIU authenticates and negotiates a communication encryption key and a communication authentication key with a first electronic control unit ECU according to the random number seed and an authentication key preset by the first VIU, and after the first VIU determines that the authentication with the first ECU succeeds, the communication encryption key and the communication authentication key are encrypted through the communication key and then sent to the first DC.
According to the key negotiation method provided by 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, the temporary shared key and the temporary common private key are determined according to the first random number, and the temporary common public key is generated according to the temporary common private key. Because the second random number, the temporary shared key and the temporary common key are shared by all the VIUs, the DC and any one of the VIUs can negotiate to obtain the same communication key and random number seed, after negotiation is completed, the DC and each VIU can use the same communication key to carry out secure communication, and secure communication connection does not need to be established between the DC and each VIU. And then the first VIU authenticates and negotiates a communication encryption key and a communication authentication key with the first ECU according to the random number seed and an authentication key preset by the VIU, and finally the communication encryption key and the communication authentication key are encrypted by the communication key and then sent to the first DC, wherein the communication encryption key and the communication authentication key are used between each DC and each ECU to establish secure communication. Therefore, key agreement under the CCA framework is realized, and the safe communication can be established between each DC and each ECU.
In one possible design, the first VIU authenticates and negotiates the communication key and the random number seed with the first domain control unit DC according to the second random number, the temporary common public key, and a device private key preset by the first VIU, and may be:
the first VIU receives a third random number, a temporary public key and a signature value sent by the first DC;
the first VIU verifies the signature value according to the equipment public key, the third random number and the temporary public key of the first DC;
after the first VIU verifies the signature value, calculating a digital signature value according to the second random number, the temporary common public key and the equipment 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, the first DC verifies the digital signature value according to the second random number, the temporary common public key and the equipment public key of the first VIU, and a communication key is determined according to the temporary private key and the temporary common public key after verification is successful;
and the first VIU determines a communication key according to the temporary public key and the temporary common private key, and determines a 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 functional domain identifier of the first VIU.
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, since the random number seed is determined by the first VIU according to the third random number, the second random number, and the functional domain identifier of the first VIU, and the identifiers of different functional domains are different, the random number seeds corresponding to different functional domains are different. The random number seeds are used for key distribution between the VIU and the ECU, different random number seeds are used when the ECU of different functional domains is subjected to key distribution, different communication encryption keys and different communication authentication keys in different functional domains can be realized, the use range of the keys is reduced, and the safety is higher.
In one possible design, after the first VIU sends the second random number, the temporary common public key, the digital signature value, and a device certificate preset by the first VIU to the first DC, the method may further include:
the first VIU calculates a first check value according to the third random number, the temporary public key and the temporary shared key;
and 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, and is used for calculating a second check value according to the third random number, the temporary public key and the temporary shared key by the other VIUs, determining a communication key according to the temporary public key and the temporary public key when the first check value is confirmed to be the same as the second check value, and determining the random number seed according to the third random number and the second random number, or determining the random number seed according to the third random number, the second random number and the functional domain identification of the other VIUs.
In one possible design, the first VIU root random number seed and the authentication key preset by the first VIU, which authenticate and negotiate the communication encryption key and the communication authentication key with the first ECU, may be:
the first VIU receives a fourth random number sent by the first ECU;
and 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 an authentication key preset by the first VIU.
In one possible design, the first vu 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 an authentication key preset by the first vu, and may be:
the first VIU calculates a third check value according to the fourth random number, the random number seed and an authentication key preset by the first VIU;
the first VIU sends the random number seed and the third check value to the first ECU, and the first ECU is used for authenticating the third check value;
the first VIU receives a first message authentication code and a second message authentication code which are sent after the first ECU authenticates the third check value, the first message authentication code is obtained by the first ECU through calculation according to the random number seed and an authentication key preset by the first ECU, and the second message authentication code is obtained by the first ECU through calculation according to the communication encryption key and the communication authentication key;
the first VIU determines a communication encryption key and a communication authentication key according to a long-term shared key and a random number seed preset by the first VIU;
the first VIU authenticates the first message authentication code and the second message authentication code.
In one possible design, the first VIU authenticates the first message authentication code and the second message authentication code, and may be:
the first VIU calculates a third message authentication code according to the random number seed and an authentication key preset by the first VIU, and calculates a 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 determines that the authentication with the first ECU is successful, and the method comprises the following steps:
and 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.
With the key agreement method provided in this embodiment, in a manner of determining the random number seed from the third random number, the second random number, and the functional domain identifier of the first VIU, the key distributed to the ECU by the first VIU is related to the random number seed, and the random number seed is related to the functional domain identifier, so the communication encryption key and the communication authentication key distributed to the ECU by the first VIU are distinguished by the functional domain, and the communication encryption key and the communication authentication key in different functional domains are different, so that the communication encryption key and the communication authentication key in different functional domains can be different, the use range of the key is reduced, and the security is higher.
In one possible design, the communication encryption key and the communication authentication key are sent to the first DC after being encrypted by the communication key, and may be:
the first VIU encrypts the communication encryption key and the communication authentication key through the communication key to obtain an encrypted ciphertext;
the first VIU sends the second message authentication code and the encrypted ciphertext to the first DC.
By the key agreement method provided by the embodiment, the first DC does not need to store a long-term shared key, but the first VIU encrypts and sends the communication encryption key and the communication authentication key to the first DC at the end stage of the whole agreement process, so that the leakage of the whole vehicle shared key GK caused by the attack of the DC can be avoided.
In a second aspect, 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, wherein the first DC is one DC in the in-vehicle electronic control system; the first DC authenticates the first vehicle integrated unit VIU and negotiates a communication key according to the temporary public key, the third random number and a device private key preset by the first DC; and the first DC receives a communication encryption key and a communication authentication key which are sent by the first VIU and encrypted by the communication key, wherein the communication encryption key and the communication authentication key are obtained by the first VIU through authentication and negotiation with the first ECU according to the random number seed and an authentication key preset by the first VIU.
According to the key agreement method provided by the second aspect, a temporary private key and a third random number are generated through a first DC, a corresponding temporary public key is generated according to the temporary private key, the first DC authenticates a first VIU and negotiates a communication key according to the temporary public key, the third random number and an equipment private key preset by the first DC, and finally the first DC receives a communication encryption key and a communication authentication key which are sent by the first VIU and encrypted through the communication key, wherein the communication encryption key and the communication authentication key are used between each DC and each ECU and can establish secure communication. Therefore, key agreement under the CCA framework is realized, and the safe communication can be established between each DC and each ECU.
In one possible design, the first DC performs authentication and negotiates a communication key with the first vehicle integrated unit VIU according to the temporary public key, the third random number, and a device private key preset by the first DC, and may be:
the first DC carries out digital signature on the temporary public key and the third random number by using an equipment private key preset by the first DC 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 a second random number, a temporary common public key and a digital signature value sent by the first VIU, wherein the digital signature value is obtained by the first VIU through calculation according to the second random number, the temporary common public key and a preset device private key of the first VIU, 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 equipment public key of the first VIU;
and after the first DC verifies the digital signature value, determining a communication key according to the temporary private key and the temporary common public key.
According to the key agreement method provided by the 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, the second random number, the temporary shared key and the temporary common private key are determined by the first VIU according to the first random number, so that the second random number, the temporary shared key and the temporary common key are shared by all the VIUs, the DC and any one of the VIUs can negotiate to obtain the same communication key and random number seed, the DC and each VIU can use the same communication key to perform secure communication after negotiation is completed, and secure communication connection does not need to be established between the DC and each VIU.
In a third aspect, the present application provides a key agreement apparatus, including:
the determining module is used for determining 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 generating a temporary common public key according to the temporary common private key;
the first authentication negotiation module is used for authenticating and negotiating 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 an equipment private key preset by the first VIU, wherein the first DC is one DC in the in-vehicle electronic control system;
the second authentication negotiation module is used for authenticating with the first electronic control unit ECU and negotiating a communication encryption key and a communication authentication key according to the random number seed and an authentication key preset by the first VIU;
and the transmitting module is used for transmitting the communication encryption key and the communication authentication key to the first DC after encrypting the communication encryption key and the communication authentication key through the communication key after determining that the authentication with the first ECU is successful.
In one possible design, the first authentication negotiation module includes:
a receiving unit, configured to receive a third random number, a temporary public key, and a signature value sent by the first DC;
a verification unit, configured to verify the signature value according to the device public key of the first DC, the third random number, and the temporary public key;
the computing unit is used for computing the digital signature value according to the second random number, the temporary common public key and the equipment private key of the first VIU after the signature value is verified;
a sending unit, configured to send the second random number, the temporary common public key, and the digital signature value to the first DC, where 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 determines a communication key according to the temporary private key and the temporary common public key after successful verification;
and the determining unit is used for determining the communication key according to the temporary public key and the temporary common private key, and determining the random number seed according to the third random number and the second random number, or determining the random number seed according to the third random number, the second random number and the functional domain identifier of the first VIU.
In one possible design, the computing unit is further configured to: after the transmitting unit transmits the second random number, the temporary common public key, and the digital signature value to the first DC, calculating a first check value according to the third random number, the temporary public key, and the temporary shared key;
the sending unit is further configured to: and sending the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system, wherein the other VIUs are used for calculating a second check value according to the third random number, the temporary public key and the temporary shared key, determining a communication key according to the temporary public key and the temporary common private key when the first check value is confirmed to be the same as the second check value, and determining the random number seed according to the third random number and the second random number or determining the random number seed according to the third random number, the second random number and the functional domain identification of other VIUs.
In one possible design, the second authentication negotiation module includes:
the receiving unit is used for receiving the fourth random number sent by the first ECU;
and the authentication negotiation unit is used for authenticating with the first ECU and negotiating 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.
In one possible design, the authentication negotiation unit is configured to:
calculating a third check value according to the fourth random number, the random number seed and an authentication key preset by the first VIU;
sending the random number seed and the third check value to the first ECU for the first ECU to authenticate the third check value;
receiving a first message authentication code and a second message authentication code which are sent after the first ECU authenticates the third check value, wherein the first message authentication code is obtained by the first ECU through calculation according to the random number seed and an authentication key preset by the first ECU, and the second message authentication code is obtained by the first ECU through calculation according to a communication encryption key and a communication authentication key;
determining a communication encryption key and a communication authentication key according to a long-term shared key and a random number seed preset by a first VIU;
and authenticating the first message authentication code and the second message authentication code.
In one possible design, the authentication negotiation unit is configured to:
calculating a third message authentication code according to the random number seed and an authentication key preset by the first VIU, and calculating a 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 for:
and 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, determining that the first ECU is successfully authenticated.
In one possible design, the sending module is configured to:
encrypting the communication encryption key and the communication authentication key through the communication key to obtain an encrypted ciphertext;
the second message authentication code and the encrypted ciphertext are sent to the first DC.
The beneficial effects of the key agreement device provided in the third aspect and each possible design of the third aspect may refer to the beneficial effects brought by each possible implementation manner of the first aspect, and are not described herein again.
In a fourth aspect, the present application provides a key agreement apparatus, including:
the generating module is used for generating a temporary private key and a third random number and generating a corresponding temporary public key according to the temporary private key, wherein the first DC is one DC in the in-vehicle electronic control system;
the authentication negotiation module is used for authenticating with the first vehicle integrated unit VIU and negotiating a communication key according to the temporary public key, the third random number and a device private key preset by the first DC;
and the receiving module is used for receiving a communication encryption key and a communication authentication key which are sent by the first VIU and encrypted by the communication key, wherein the communication encryption key and the communication authentication key are obtained by the first VIU through authentication and negotiation with the first ECU according to the random number seed and an authentication key preset by the first VIU.
In one possible design, the authentication negotiation module includes:
the digital signature unit is used for digitally signing the temporary public key and the third random number by using a 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;
the receiving unit is used for receiving a second random number, a temporary common public key and a digital signature value sent by the first VIU, wherein the digital signature value is obtained by the first VIU through calculation according to the second random number, the temporary common public key and a preset device private key of the first VIU, 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 is used for verifying the digital signature value according to the second random number, the temporary common public key and the equipment public key of the first VIU;
and the determining unit is used for determining 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 beneficial effects of the key agreement device provided in the fourth aspect and each possible design of the fourth aspect may refer to the beneficial effects brought by each possible implementation manner of the second aspect, and are not described herein again.
In a fifth aspect, the present application provides a key agreement apparatus, including: a memory and a processor;
the memory is used for storing program instructions;
the processor is configured to invoke program instructions in the memory to perform the key agreement method of the first aspect and any one of the possible designs of the first aspect.
In a sixth aspect, the present application provides a readable storage medium, where an execution instruction is stored, and when the execution instruction is executed by at least one processor of a key agreement device, the key agreement device executes the method in any one of the possible designs of the first aspect and the first aspect.
In a seventh aspect, the present application provides a program product comprising execution instructions stored in a readable storage medium. The executable instructions may be read by at least one processor of the key agreement device from a readable storage medium, and execution of the executable instructions by the at least one processor causes the key agreement device to implement the method of the first aspect and any one of the possible designs of the first aspect.
Drawings
Fig. 1 is a schematic structural diagram of an in-vehicle electronic control system of a CCA architecture;
fig. 2 is an interaction flowchart of an embodiment of a key agreement method provided in the present application;
fig. 3 is a schematic flowchart illustrating an embodiment of pairwise authentication and negotiation between a first VIU and a first DC between 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 vu authenticating with a first ECU and negotiating a communication encryption key and a communication authentication key according to the present application;
fig. 5 is an interaction flowchart of an embodiment of a key agreement method provided in the present application;
fig. 6 is a schematic structural diagram of an embodiment of a key agreement apparatus provided in the present application;
fig. 7 is a schematic structural diagram of an embodiment of a key agreement apparatus provided in the present application;
fig. 8 is a schematic structural diagram of an embodiment of a key agreement apparatus provided in the present application;
fig. 9 is a schematic structural diagram of an embodiment of a key agreement apparatus provided in the present application;
fig. 10 is a schematic structural diagram of an embodiment of a key agreement apparatus provided in the present application;
fig. 11 is a schematic diagram of a key agreement apparatus provided in the present application.
Detailed Description
In this application, the terms "exemplary" or "such as" are used to indicate that any embodiment or aspect described as "exemplary" or "such as" in this application is not to be construed as preferred or advantageous over other embodiments or aspects. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
In the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone, wherein A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The key agreement method can be applied to an in-vehicle electronic control system of a CCA framework, under the CCA framework, electronic control elements (including DC and ECU) of a vehicle are distributed in a plurality of areas, each area is provided with a VIU for managing the ECU in the area, and the VIUs are interconnected through a high-speed Ethernet, so that high-bandwidth (high-definition camera and high-definition display), low-delay and high-reliability processing capacity are realized. Fig. 1 is a schematic structural diagram of an in-vehicle electronic control system with a CCA architecture, as shown in fig. 1, the number of the vus deployed in the vehicle is illustrated as 4, and 4 vus are deployed in the vehicle: the VIUs 0, the VIUs 1, the VIUs 2 and the VIUs 3 are interconnected through a high-speed Ethernet, each VIU manages the ECUs in one region, each VIU is connected with the ECUs in one region through a bus, for example, the VIU0 is connected with the ECUs 0, the ECUs 1, the ECUs 2 and the ECUs 3 through one bus, the VIU1 is connected with the ECUs 5, the ECUs 6, the ECUs 7 and the ECUs 8 through one bus, the VIU2 is connected with the ECUs 13, the ECUs 14, the ECUs 15 and the ECUs 16 through one bus, the VIU3 is connected with the ECUs 9, the ECUs 10, the ECUs 11 and the ECUs 12 through one bus, the VIUs 0 and the VIUs 3 are connected with the DC1, and the VIUs 1 and the VIU2 are connected with the DC 2. According to the key agreement method, the VIU deployed in each area is responsible for distributing the shared key between the ECU and the DC, so that secure communication can be established between each DC and each ECU.
The electronic control unit referred to in the present application mainly includes a VIU, an ECU and a DC, and it is understood that the number of the VIU, the ECU and the DC is one or more, and the ECU is used for eachi、VIUjAnd DCkWherein i, j and k are positive integers and are the numbers of VIU, ECU and DC respectively. ECU (electronic control Unit)i、VIUjAnd DCkIn which security credentials, in particular an ECU, are preset and storediThe preset security credentials are long-term shared key GK and authentication key Ki。VIUjThe preset security certificate is the device private key skVIUjDevice certificate CertVIUj(including the device public key pkVIUj) Root certificate Cert0(vehicle-wide unification for verifying the validity of the device certificate), long-term shared secret key GK and ECUiIn the authentication key K preset iniCorresponding authentication key KiOr, VIUjThe preset security certificate is the device private key skVIUj、DCkThe device public key or the hash value of the device public key, the root certificate Cert0(vehicle-wide unification for verifying the validity of the device certificate), long-term shared secret key GK and ECUiIn the authentication key K preset iniCorresponding authentication key Ki。DCkThe preset security certificate is the device private key skDCkDevice certificate CertDCk(including the device public key pkDCk) And root certificate Cert0(vehicle-wide unification, used to verify the legitimacy of the device certificate). Based on these pre-set security credentials, authentication, negotiation and distribution of authentication and encryption keys between the VIU and VIU, between the VIU and the DC, and between the VIU and the ECUs are used to enable secure communications to be established between each DC and each ECU.
In the prior art, in a centralized network architecture based on a central gateway, all ECUs and a DC in a whole vehicle receive the same random number seed S in a process of generating communication keys, so that it is ensured that all ECUs and the DC in the whole vehicle share the same communication key. However, there are multiple VIUs under the CCA architecture, the central gateway is replaced by multiple VIUs, and S is randomly generated at each key update, so that uniqueness of S cannot be guaranteed, and thus the existing scheme is not applicable to the CCA architecture. In order to solve the problem, the present application provides a key agreement method and apparatus, when a key update process starts, multi-party key agreement is first completed between N VIUs under a CCA architecture, to obtain a first random number shared by the N VIUs, 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 the VIUs, a DC and any one of the VIUs can negotiate to obtain the same communication key and random number seed, after the agreement is completed, the DC and each VIU can use the same communication key to perform secure communication, and a secure communication connection does not need to be established between the DC and each VIU. And then each VIU authenticates and negotiates a communication encryption key and a communication authentication key with the ECU or other ECUs in the management area of the VIU according to the random number seed and the authentication key preset by the VIU, and finally the communication encryption key and the communication authentication key are encrypted through the communication key and then sent to the DC, wherein the communication encryption key and the communication authentication key are used between each DC and each ECU to establish secure communication. Therefore, key agreement under the CCA framework is realized, and the safe communication can be established between each DC and each ECU. The following describes a key agreement method and apparatus provided in the present application in detail with reference to the accompanying drawings.
Fig. 2 is an interaction flowchart of an embodiment of a key agreement method provided in the present application, and as shown in fig. 2, the method of the present embodiment may include:
s101, after the first VIU and other VIUs in the in-vehicle electronic control system negotiate a common first random number, 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.
Specifically, it can be understood that the first VIU is any one of the VIUs in the electronic control system, all the VIUs in the electronic control system may perform multi-party key agreement using a multi-party key agreement protocol, negotiate a common first random number, and may use any common multi-party key agreement protocol, such as a multi-party key exchange protocol (eliptic currve Diffie-Hellman ECDH) protocol.
The first VIU determines a second random number, a temporary shared key, and a temporary common private key according to the first random number, may 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 | KeyVIUKDF (r), where KDF is a Key derivation function (Key derivation function), the Key derivation function may generate data of any length according to input data, and nonce is a second random number, and Key is a KeyVIUTo temporarily share the key eSK is a temporary common private key, then temporary common public key ePK is generated from temporary common private key eSK. Wherein, the temporary shared secret KeyVIUFor secure communications between all the VIUs, a temporary common private key eSK and a temporary common public key ePK are used for key agreement between each VIU and each DC. The key agreement between each VIU and each DC uses the same temporary private key eSK and temporary public key ePK, so the keys agreed upon by all VIUs and DCs are the same.
In this embodiment, the first random number, the second random number, the temporary common private key, and the temporary common public key shared by the multiple vus in the vehicle are negotiated, so that the external logic is unified, and the DC does not need to care about the specific deployment details (such as the number, the distribution position, and connected ECUs) of the vus, so that the authentication negotiation processing logic of the DC is decoupled from the actual deployment details of the vus, and the processing logic is simplified.
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.
The first DC is one DC in an in-vehicle electronic control system, namely any DC.
And 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 a device private key preset by the first VIU.
Wherein, the random number Seed is SeedkDCommunication key distribution for a first ECU within a first VIU management area.
Specifically, because the VIUs have a common temporary public key, the first DC and any one of the VIUs may negotiate out the same communication key and random number seed, and after negotiation is completed, the first DC and each of the VIUs may perform secure communication using the same communication key without establishing a plurality of secure connections.
Specifically, in S103, the authenticating and negotiating the communication key and the random number seed with the first DC by the first VIU according to the second random number, the temporary common public key, and the device private key preset by the first VIU may be:
and S1031, the first VIU receives the third random number, the temporary public key and the signature value sent by the first DC.
And 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.
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 implementable manners, where the first manner is a certificate transfer manner, the second manner is a manner in which the device public key of the first DC is prestored, and the third manner is a manner in which the device public key or a device public key hash value of the first DC is prestored in the first VIU, and the first VIU verifies the received device public key of the first DC. The following is described in detail:
the first method is as follows: 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, and the device public key of the first DC is included in the device certificate of the first DC.
And the first VIU verifies the validity of the equipment certificate of the first DC according to a root certificate preset by the first VIU, and verifies the signature value according to the third random number and the temporary public key.
The second method comprises the following steps: the first VIU receives the third random number, the temporary public key, and the signature value sent by the first DC.
And 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.
The third method comprises the following steps: the first VIU receives the third random number, the temporary public key, the signature value, and the device public key of the first DC transmitted by the first DC.
And the first VIU verifies the received device public key of the first DC according to a pre-stored device public key or a device public key Hash value of the first DC, and verifies the signature value according to the third random number, the temporary public key and the device public key of the first DC after the verification is successful.
And S1033, after the first VIU verifies the signature value, calculating the digital signature value according to the second random number, the temporary common public key and the device private key of the first VIU.
S1034, the first VIU sends the second random number, the temporary common public key, and the digital signature value to the first DC.
And S1035, the first DC verifies the digital signature value according to the second random number, the temporary common public key and the equipment public key of the first VIU, and determines a communication key according to the temporary private key and the temporary common public key after the digital signature value is verified.
In particular, the first DC may also determine the communication key based on the temporary private key and the temporary public key, as well as other information, such as any of the identity of the first VIU, the identity of the first DC, and the identity of the vehicle.
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 similar to the manner in which the first VIU obtains the device public key of the first DC in S1032, there are three implementable manners, which are described in detail below:
the first method is as follows: and the first DC receives the second random number, the temporary common public key, the digital signature value and the preset device certificate of the first VIU, which are 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.
And the first DC verifies the validity of the equipment certificate of the first VIU according to a preset root certificate of the first DC, and verifies the digital signature value according to the second random number and the temporary common public key.
In a second mode, 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, the second random number and the temporary common public key of the first VIU.
The third method comprises the following steps: 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.
And the first DC verifies the received equipment public key of the first VIU according to a pre-stored equipment public key or equipment public key Hash value of the first VIU, and verifies the digital signature value according to the second random number, the temporary public key and the equipment public key of the first VIU after the verification is successful.
S1036, the first VIU determines a communication key according to the temporary private key and the temporary common public key, and determines a 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 function domain identifier of the first VIU.
And 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 a device private key preset by the first DC.
Wherein the communication key is used for secure communication between the first VIU and the first DC.
In an implementable manner, S103 may also be that the first DC authenticates with the first VIU according to the temporary public key, the third random number, the first DC preset device certificate, and the first DC preset device private key, and negotiates a communication key with the first VIU after the authentication is successful.
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 determines the communication key according to the temporary private key and the temporary common public key after the verification is successful.
And S105, the first VIU authenticates with the first ECU and negotiates a communication encryption key and a communication authentication key according to the random number seed and an authentication key preset by the first VIU.
The first ECU may be an ECU in the first vu management area, or may be another ECU.
Optionally, the first VIU may further authenticate and negotiate a communication encryption key and a communication authentication key with the first ECU according to the identifier of the first VIU, the random number seed, and an authentication key preset by the first VIU.
And S106, after the first VIU determines that the first ECU is successfully authenticated, the communication encryption key and the communication authentication key are encrypted through the communication key and then sent to the first DC.
Specifically, the first VIU sends the communication encryption key and the communication authentication key to the first DC after encrypting with the communication key, which may be:
the first VIU encrypts the communication encryption key and the communication authentication key through 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.
Alternatively, the identity of the first ECU may also be sent simultaneously.
In this embodiment, the first DC does not need to store the long-term shared key, but the first VIU encrypts and sends the communication encryption key and the communication authentication key to the first DC at the end of the entire negotiation process, so that leakage of the entire vehicle shared key GK due to attack on the DC can be avoided.
In the key agreement method provided in this embodiment, after the first VIU negotiates a common first random number with other VIUs in the in-vehicle electronic control system, a second random number, a temporary shared key, and a temporary common private key are determined according to the first random number, and a temporary common public key is generated according to the temporary common private key. Because the second random number, the temporary shared key and the temporary common key are shared by all the VIUs, the DC and any one of the VIUs can negotiate to obtain the same communication key and random number seed, after negotiation is completed, the DC and each VIU can use the same communication key to carry out secure communication, and secure communication connection does not need to be established between the DC and each VIU. And then the first VIU authenticates and negotiates a communication encryption key and a communication authentication key with the first ECU according to the random number seed and an authentication key preset by the VIU, and finally the communication encryption key and the communication authentication key are encrypted by the communication key and then sent to the first DC, wherein the communication encryption key and the communication authentication key are used between each DC and each ECU to establish secure communication. Therefore, key agreement under the CCA framework is realized, and the safe communication can be established between each DC and each ECU.
Fig. 3 is a schematic flow chart of an embodiment of the present application, in which the first VIU and the first DC perform pairwise authentication and negotiate a communication key and a random number seed, and the method of this embodiment may include:
s201, the first DC carries out digital signature on the temporary public key and the third random number by using a device private key preset by the first DC to obtain a signature value.
In particular, the signature value Sigk=Sign(rk||ePKk,skDC),skDCDevice private key preset for first DC, ePKkIs a temporary public key, rkIs a third random number.
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.
And S203, the first VIU verifies the received device public key of the first DC according to the pre-stored device public key or the device public key Hash value of the first DC, and verifies the signature value according to the third random number, the temporary public key and the device public key of the first DC after the verification is successful.
In another practical manner, S202 may be: the first DC sends the temporary public key, the third random number, and the signature value to the first VIU.
Accordingly, S203 may be: and the first VIU verifies the signature value according to the pre-stored device public key, the third random number and the temporary public key of the first DC.
In another practical manner, S202 may be: the first DC sends the third random number, the temporary public key, the signature value and a device certificate preset by the first DC to the first VIU.
Accordingly, S203 may be: and the first VIU verifies the validity of the equipment certificate of the first DC according to a root certificate preset by the first VIU, and verifies the signature value according to the third random number and the temporary public key.
Specifically, if the verification fails, the key updating process is stopped, and if the verification succeeds, S204 is executed.
And S204, after the first VIU is successfully verified, calculating a digital signature value according to the second random number, the temporary common public key and the equipment private key of the first VIU.
In particular, the calculation process may be a digital signature value Sig0=Sign(nonce||ePK,skVIUj0) Wherein ePK is the temporary common public key, skVIUj0Is the device private key of the first VIU and the nonce is the second random number.
S205, the first VIU sends the second random number, the temporary common public key, and the digital signature value to the first DC.
S206, the first VIU determines a communication key according to the temporary public key and the temporary common private key, and determines a 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 functional domain identifier of the first VIU.
Specifically, the first VIU sends the third random number rkTemporary public key ePKkAnd check value MACkThen, according to the temporary public key ePKkPerforming hash operation on the temporary common private Key eSK to obtain a communication Key KeyVDk=HASH(ePKkeSK) and according to the third random number rkCalculating Seed by using the second random number nonce and the domain identifier DIDkDThe calculation process is SeedkD=HASH(rk||nonce||DID)。
In this embodiment, in the manner of determining the random number seed according to the third random number, the second random number, and the function domain identifier of the first VIU, since the random number seed is determined by the first VIU according to the third random number, the second random number, and the function domain identifier of the first VIU, and the identifiers of different function domains are different, the random number seeds corresponding to different function domains are different. The random number seeds are used for key distribution between the VIU and the ECU, different random number seeds are used when the ECU of different functional domains is subjected to key distribution, different communication encryption keys and different communication authentication keys in different functional domains can be realized, the use range of the keys is reduced, and the safety is higher.
Optionally, in S206, the first VIU may also determine the communication key according to the temporary private key and the temporary public key, and determine the random number seed according to the third random number and the second random number, that is, the random number seeds may not be distinguished according to the functional domain.
And S207, the first DC verifies the digital signature value according to the pre-stored equipment public key, the second random number and the temporary common public key of the first VIU, and determines a communication key according to the temporary private key and the temporary common public key after the verification is successful.
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 stops the key update process if the verification fails; after successful verification, the communication key is determined from the temporary private key and the temporary common public key, which may be determined by the first DC from the temporary public key ePKkPerforming hash operation on the temporary common public Key ePK to obtain a communication Key KeyVDk=HASH(eSKkePK), communication KeyVDkFor secure communication between the first DC and the respective VIU, wherein the HASH is a HASH operation.
In another implementation 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.
Accordingly, S207 may be: and the first DC verifies the received equipment public key of the first VIU according to a pre-stored equipment public key or equipment public key Hash value of the first VIU, and verifies the digital signature value according to the second random number, the temporary public key and the equipment public key of the first VIU after the verification is successful.
In another implementation manner, S205 may be: and the first VIU sends the device certificate preset by the first VIU, the second random number, the temporary common public key and the digital signature value to the first DC, wherein the device public key of the first VIU is included in the device certificate preset by the first VIU.
Accordingly, S207 may be: and the first DC verifies the validity of the equipment certificate of the first VIU according to a preset root certificate of the first DC, and verifies the digital signature value according to the second random number and the temporary common public key.
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:
and S208, the first VIU calculates a first check value according to the third random number, the temporary public key and the temporary shared key.
In particular, it may be based on a third random number rkTemporary public key ePKkAnd temporary shared secret KeyVIUCarrying out Hash operation to obtain a first check value MACk=HASH(rk||ePKk||KeyVIU)。
And 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, the other VIUs calculate a second check value according to the third random number, the temporary public key and the temporary shared key, determine a communication key according to the temporary public key and the temporary common private key when the first check value is confirmed to be the same as the second check value, determine a 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 function domain identification of the other VIUs.
Specifically, other VIUs receive the third random number rkTemporary public key ePKkAnd a first check value MACkThen, according to the third random number rkTemporary public key ePKkAnd temporary shared secret KeyVIUPerforming a HASH operation to obtain a second check value MAC ═ HASH (r)k||ePKk||KeyVIU) And combining MAC' and MACkThe values are compared. If the comparison fails, stopping the key updating process; if the comparison is successful, i.e. the first check value is the same as the second check value, then other VIUs are according to the temporary public key ePKkPerforming hash operation on the temporary common private Key eSK to obtain a communication Key KeyVDk=HASH(ePKkeSK), communication KeyVDkFor secure communication between the first DC and the respective VIU. While other VIUs are based on a third random number rkCalculating random number Seed by using the second random number nonce and the other VIU's domain identification DIDkDThe calculation process may be SeedkD=HASH(rkDID), where DID is the domain identifier of the VIU, DID is used forDifferent functional domains (e.g., power domain, chassis domain, body domain, etc.) are identified. SeedkDThe method is used for key distribution between the VIU and the ECU, and different random number Seed is used when the key distribution is carried out on the ECUs of different functional domainskDThe method can realize the difference between the communication encryption key and the communication authentication key in different functional domains, thereby reducing the use range of the key and having higher safety.
An implementable manner of authenticating and negotiating the communication encryption key and the communication authentication key by the first VIU with the first ECU, that is, an implementable manner of S105, is described below with reference to fig. 4, where fig. 4 is a schematic flow chart of an embodiment of authenticating and negotiating the communication encryption key and the communication authentication key by the first VIU with the first ECU provided by the present application, and as shown in fig. 4, the method of the present embodiment may include:
s301, the first ECU generates a fourth random number.
And S302, the first ECU sends the fourth random number to the first VIU, and the first VIU is directly connected with the first ECU.
Optionally, the first ECU may also send an identification of the first ECU to the first VIU.
And S303, the first VIU calculates a third check value according to the fourth random number, the random number seed and an authentication key preset by the first VIU.
Optionally, the first VIU may further calculate a 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 an 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 is higher.
And S304, the first VIU sends the random number seed and the third check value to the first ECU.
Optionally, an identification of the first VIU may also be sent.
And S305, the first ECU authenticates the third check value.
And S306, after the first ECU authenticates the third check value, the first ECU sends a first message authentication code and a second message authentication code to the first VIU, wherein the first message authentication code is obtained by the first ECU through calculation according to the random number seed and an authentication key preset by the first ECU, the second message authentication code is obtained by the first ECU through calculation according to the communication encryption key and the communication authentication key, or the first message authentication code is obtained by the first ECU through calculation according to the identification of the first ECU, the random number seed and the authentication key preset by the first ECU, and the second message authentication code is obtained by the first ECU through calculation according to the identification of the first ECU, the communication encryption key and the communication authentication key.
And S307, the first VIU determines a communication encryption key and a communication authentication key according to a long-term shared key and a random number seed preset by the first VIU.
Specifically, S307 may be: the first VIU is based on the long-term shared key GK and random number Seed preset in the first VIUkDCalculating to obtain a communication encryption key EK and a communication authentication key AK through a key derivation function KDF, specifically (EK | | AK) ═ KDF (Seed)kD,GK)。
S308, the first VIU authenticates the first message authentication code and the second message authentication code.
Specifically, the authenticating the first message authentication code and the second message authentication code by the first VIU may specifically be: and the first VIU calculates a third message authentication code according to the random number seed and an authentication key preset by the first VIU, calculates a fourth message authentication code according to the communication encryption key and the communication authentication key, 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 determines that the authentication with the first ECU is successful, and specifically may be: and 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.
In this embodiment, the first VIU distributes the key and the random number Seed to the ECUkDRelated, SeedkDThe communication encryption key and the communication authentication key distributed to the ECU by the first VIU are distinguished according to the functional domain, and the communication encryption key and the communication authentication key in different functional domains are different, so that the communication encryption key and the communication authentication key in different functional domains can be different, the use range of the keys is reduced, and the safety is higher.
The following describes the technical solution of the method embodiment shown in fig. 2-4 in detail by using a specific embodiment.
Fig. 5 is an interaction flowchart of an embodiment of a key agreement method provided in this application, which is described in this embodiment by taking a total of 4 VIUs in an in-vehicle electronic control system as an example, and as shown in fig. 5, the method of this embodiment may include:
s401, the first VIU and other VIUs in the in-vehicle electronic control system conduct multi-party key agreement to obtain a first random number R shared by 4 VIUs in the in-vehicle electronic control system.
Specifically, all the VIUs in the electronic control system may perform multi-party key agreement using a multi-party key agreement protocol, and may use any common multi-party key agreement protocol, such as a multi-party key exchange protocol (eliptic currve Diffie-Hellman ECDH) protocol.
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.
Specifically, the first VIU may derive the second random number, the temporary shared key, and the temporary common private key through a key derivation function according to the first random number R, and the calculation process is as follows: (nonce | KeyVIUKDF (r), where KDF is a Key derivation function (Key derivation function), the Key derivation function may generate data of any length according to input data, and nonce is a second random number, and Key is a KeyVIUTo temporarily share the key eSK is a temporary common private key, then temporary common public key ePK is generated from temporary common private key eSK. Wherein, the temporary shared secret KeyVIUFor all VIUsjSecure communication between, temporary common private key eSK and temporary common public key ePK for the VIUjAnd DCkKey agreement between. All VIUjAnd DCkAll using the same temporary private key eSK and temporary public key ePK, so all VIUsjAnd DCkThe negotiated keys are all the same.
S403, the first VIU and the first DC carry out authentication and cooperationCommercial communication key and random number SeedkDA first DC connected to the first VIU, a communication key for secure communication between the first VIU and the first DC, and a random number SeedkDCommunication key distribution for a first ECU within a first VIU management area.
The authenticating and negotiating the communication key and the random number seed by the first VIU and the first DC may specifically include:
s4031, first DC randomly generates temporary private key eSKkAnd a third random number rkAnd based on the temporary private key eSKkGenerate corresponding temporary public keys ePKk
S4032, the first DC uses a device private key sk preset by the first DCDCTo temporary public key ePKkAnd a third random number rkPerforming digital signature, and calculating to obtain signature value Sigk=Sign(rk||ePKk,skDC)。
S4033, the first DC will temporarily public key ePKkA third random number rkSignature value SigkAnd a device certificate Cert preset by the first DCDCkSent to the first VIU.
S4034, first VIU receives temporary public key ePKkA third random number rkSignature value SigkAnd a device certificate Cert preset by the first DCDCkThen, according to the root certificate Cert preset by the first VIU0Verifying a device certificate Cert of a first DCDCkThen according to the third random number rkAnd temporary public key ePKkFor the signature value SigkAnd (6) carrying out verification. If the verification fails, the key updating process is stopped, and if the verification succeeds, the first VIU performs verification according to the second random number nonce, the temporary common public key ePK and the device private key sk of the first VIUVIUj0Calculating a digital signature value Sig0The calculation process is Sig0=Sign(nonce||ePK,skVIUj0) Then, S4035 is executed.
S4035, the first VIU sends the second random number nonce, the temporary common public key ePK and the digital signature value Sig0And a device certificate Cert of the first VIUVIUj0To the first DC.
S4036, firstA DC receives the second random number nonce, the temporary common public key ePK, the digital signature value Sig0And a device certificate Cert of the first VIUVIUj0Then, according to a root certificate Cert preset by the first DC0Verifying a device certificate Cert of a first VIUVIUj0Then the digital signature value Sig according to the second random number nonce and the provisional common public key ePK0And (6) carrying out verification. If the verification fails, stopping the key updating process; if the verification is successful, the first DC is based on temporary private key eSKkComputing a communication Key with temporary common public Key ePKVDkThe calculation process is based on the temporary public key ePK and the temporary private key eSKkCarrying out Hash operation to obtain a communication Key KeyVDk=HASH(eSKkePK), communication KeyVDkFor secure communication between the first DC and the respective VIU, wherein the HASH is a HASH operation.
S4037, the first VIU sends the second random number nonce, the temporary common public key ePK and the digital signature value Sig0And a device certificate Cert of the first VIUVIUj0Then, according to the third random number rkTemporary public key ePKkAnd temporary shared secret KeyVIUCalculating a first check value MACkIn particular according to a third random number rkTemporary public key ePKkAnd temporary shared secret KeyVIUCarrying out Hash operation to obtain a first check value MACk=HASH(rk||ePKk||KeyVIU)。
S4038, first VIU sends third random number rkTemporary public key ePKkAnd a first check value MACkTo other VIUs.
S4039, other VIUs receive the third random number rkTemporary public key ePKkAnd a first check value MACkThen, according to the third random number rkTemporary public key ePKkAnd temporary shared secret KeyVIUPerforming a HASH operation to obtain a second check value MAC ═ HASH (r)k||ePKk||KeyVIU) And combining MAC' and MACkThe values are compared. If the comparison fails, stopping the key updating process; if the comparison is successful, i.e. the first check value is the same as the second check value, thenOther VIUs are based on temporary public key ePKkPerforming hash operation on the temporary common private Key eSK to obtain a communication Key KeyVDk=HASH(ePKkeSK), communication KeyVDkFor secure communication between the first DC and the respective VIU. While other VIUs are based on a third random number rkCalculating random number Seed by the second random number nonce and the functional domain identifier DIDkDThe calculation process is SeedkD=HASH(rkA DID), wherein the DID is a function domain identifier, and the DID is used to identify different function domains (e.g., a power domain, a chassis domain, a vehicle body domain, etc.). SeedkDFor key distribution between the VIU and the ECU.
S4040, the first VIU sends the third random number rkTemporary public key ePKkAnd check value MACkThen, according to the temporary public key ePKkPerforming hash operation on the temporary common private Key eSK to obtain a communication Key KeyVDk=HASH(ePKkeSK) and according to the third random number rkCalculating Seed by using the second random number nonce and the domain identifier DIDkDThe calculation process is SeedkD=HASH(rk||nonce||DID)。
S404, the first VIU and the first ECU carry out authentication and generate a communication encryption key EK and a communication authentication key AK.
Where the first ECU is an ECU within the first VIU management area, it will be appreciated that the number of first ECUs is at least one.
Specifically, S404 may include:
s4041, the first ECU generates a fourth random number RiAnd a fourth random number RiAnd an identification ID of the first ECUiTo a first VIU directly connected to the first ECU.
S4042, the first VIU identifies ID according to the first VIUVIUjID of the first ECUiA fourth random number RiRandom SeedkDAnd authentication key K preset by first VIUiCalculating a third check value MAC1, specifically, performing a HASH operation to obtain MAC1 ═ HASH (ID)i||IDVIUj||Ri||SeedkD||Ki) And of the first VIUIdentification IDVIUjRandom SeedkDAnd the third check value MAC1 to the first ECU.
S4043, the first ECU receives the ID of the first VIUVIUjRandom SeedkDAfter the checksum value MAC1 is added, the ID of the first VIU is determinedVIUjID of the first ECUiA fourth random number RiRandom SeedkDAnd an authentication key K preset by the first ECUiCalculating a check value MAC 1', specifically, obtaining MAC1 ═ HASH (ID) by HASH operationi||IDVIUj||Ri||SeedkD||Ki) And MAC1 and MAC 1' are aligned. If the comparison fails, stopping the key updating process; if the comparison is successful, the first ECU according to a long-term shared key GK and a random number Seed preset in the first ECUkDCalculating to obtain a communication encryption key EK and a communication authentication key AK through a key derivation function KDF, specifically (EK | | AK) ═ KDF (Seed)kDGK). Next, a first message authentication code MAC2 and a second message authentication code MAC3 are calculated, MAC2 ═ HASH (ID)i||SeedkD||Ki),MAC3=HASH(IDiEK AK) and sends the first message authentication code MAC2 and the second message authentication code MAC3 to the first VIU.
S4044, after receiving the first message authentication code MAC2 and the second message authentication code MAC3, the first VIU sends a message to the second VIU according to the long-term shared key GK and the random number Seed preset in the first VIUkDCalculating to obtain a communication encryption key EK and a communication authentication key AK through a key derivation function KDF, specifically (EK | | AK) ═ KDF (Seed)kD,GK)。
S4045, and then calculates a third message authentication code MAC2 ═ HASH (ID)i||SeedkD||Ki) And a fourth message authentication code MAC3 ═ HASH (ID)iIi, EK AK), comparing MAC2 'and MAC 3' with MAC2 and MAC3, respectively, if a pair of MAC2 'and MAC2 and a pair of MAC 3' and MAC3 are different, failing to compare, and stopping the key updating process; if MAC2 'is identical to MAC2 and MAC 3' is identical to MAC3, the comparison is successful.
S405, the first VIU assists the first DC to generate a consistent communication encryption key EK and a consistent communication authentication key AK, and communication key consistency verification is completed.
Specifically, S405 may include:
s4051, the first VIU identifies the first ECUiA second message authentication code MAC3 and an encrypted ciphertext Enc (EK AK, Key)VDk) To the first DC.
S4052, the first DC calculates MAC3 ═ HASH (ID)i||EKi||AKi) And MAC 3' is compared to MAC 3. If the comparison fails, the key updating process is stopped. If the comparison is successful, the whole key updating process is completed.
Fig. 6 is a schematic structural diagram of an embodiment of a key agreement device provided in the present application, and as shown in fig. 6, the device of the present embodiment may include: a determination module 11, a first authentication negotiation module 12, a second authentication negotiation module 13, and a transmission module 14, wherein,
the determining module 11 is configured to determine a second random number, a temporary shared key, and a temporary common private key according to a first random number after negotiating with another VIU in the in-vehicle electronic control system to obtain a common first random number, and generate a temporary common public key according to the temporary common private key;
the first authentication negotiation module 12 is configured to authenticate and negotiate a communication key and a random number seed with a first domain control unit DC according to a second random number, a temporary common public key, and an equipment private key preset by a first VIU, where the first DC is one DC in an in-vehicle electronic control system;
the second authentication negotiation module 13 is configured to authenticate and negotiate a communication encryption key and a communication authentication key with the first electronic control unit ECU according to the random number seed and an authentication key preset by the first VIU;
the transmission module 14, after determining that the authentication with the first ECU is successful, transmits the communication encryption key and the communication authentication key to the first DC after encrypting with the communication key.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 7 is a schematic structural diagram of an embodiment of a key agreement device provided in the present application, and as shown in fig. 7, on the basis of the device shown in fig. 6, further, in the device of the present embodiment, the first authentication negotiation module 12 may include: a receiving unit 121, a verification unit 122, a calculation unit 123, a sending unit 124 and a determination 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 of the first DC, the third random number, and the temporary public key;
the calculating unit 123 is 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 signature value passes verification;
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, where 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 determines a communication key according to the temporary private key and the temporary common public key after successful verification;
the determining unit 125 is configured to determine the communication key according to the temporary public key and the temporary common private 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 functional domain identifier of the first VIU.
Further, the calculating unit 123 is further configured to: after the transmitting unit 124 transmits the second random number, the temporary common public key, and the digital signature value to the first DC, a first check value is calculated from the third random number, the temporary public key, and the temporary shared key;
the sending unit 124 is further configured to: and sending the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system, wherein the other VIUs are used for calculating a second check value according to the third random number, the temporary public key and the temporary shared key, determining a communication key according to the temporary public key and the temporary common private key when the first check value is confirmed to be the same as the second check value, and determining the random number seed according to the third random number and the second random number or determining the random number seed according to the third random number, the second random number and the functional domain identification of other VIUs.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 8 is a schematic structural diagram of an embodiment of a key agreement device provided in the present application, as shown in fig. 8, on the basis of the devices shown in fig. 6-7, the present embodiment takes the basis of the device shown in fig. 6 as an example, and further, the second authentication negotiation module 13 in the device of the present embodiment may include: a receiving unit 131 and an authentication negotiation unit 132, wherein,
the receiving unit 131 is configured to receive a fourth random number sent by the first ECU;
the authentication negotiation unit 132 is configured to authenticate and negotiate a communication encryption key and a communication authentication key with the first ECU according to the fourth random number, the random number seed, and an authentication key preset by the first VIU.
Further, the authentication negotiation unit 132 is configured to:
calculating a third check value according to the fourth random number, the random number seed and an authentication key preset by the first VIU;
sending the random number seed and the third check value to the first ECU for the first ECU to authenticate the third check value;
receiving a first message authentication code and a second message authentication code which are sent after the first ECU authenticates the third check value, wherein the first message authentication code is obtained by the first ECU through calculation according to the random number seed and an authentication key preset by the first ECU, and the second message authentication code is obtained by the first ECU through calculation according to a communication encryption key and a communication authentication key;
determining a communication encryption key and a communication authentication key according to a long-term shared key and a random number seed preset by a first VIU;
and authenticating the first message authentication code and the second message authentication code.
Further, the authentication negotiation unit 132 is configured to: calculating a third message authentication code according to the random number seed and an authentication key preset by the first VIU, and calculating a 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 13 is configured to:
and 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, determining that the first ECU is successfully authenticated.
Further, the sending module 15 is configured to:
encrypting the communication encryption key and the communication authentication key through the communication key to obtain an encrypted ciphertext;
the second message authentication code and the encrypted ciphertext are sent to the first DC.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 9 is a schematic structural diagram of an embodiment of a key agreement device provided in this application, and as shown in fig. 9, the device of this embodiment may include: a generating module 21, an authentication negotiation module 22 and a receiving module 23, wherein,
the generating module 21 is 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, where 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 integrated unit VIU according to the temporary public key, the third random number, and a device private key preset by the first DC;
the receiving module 23 is configured to receive a communication encryption key and a communication authentication key, which are sent by the first VIU and encrypted by the communication key, where the communication encryption key and the communication authentication key are obtained by the first VIU performing authentication and negotiation with the first ECU according to the random number seed and an authentication key preset by the first VIU.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 10 is a schematic structural diagram of an embodiment of a key agreement device provided in the present application, and as shown in fig. 10, on the basis of the device shown in fig. 9, further, the authentication negotiation module 22 in the device of the present embodiment may include: a digital signature unit 221, a transmission unit 222, a reception unit 223, a verification unit 224, and a determination unit 225, wherein,
the digital signature unit 221 is configured to digitally sign the temporary public key and the third random number using an equipment private key preset by the first DC, so as 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 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 calculated by the first VIU according to the second random number, the temporary common public key, and an equipment private key preset by the first VIU, 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 another VIU 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.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 11 is a schematic diagram of a key agreement device 100 provided in the present application, where the key agreement device includes:
a memory 101 and a processor 102;
a memory 101 for storing a computer program;
a processor 102, configured to execute the computer program stored in the memory to implement the key agreement method in the foregoing embodiments. Reference may be made in particular to the description relating to the method embodiments described above.
Alternatively, the memory 101 may be separate or integrated with the processor 102.
When the memory 101 is a device independent of the processor 102, the key agreement apparatus 100 may further include:
a bus 103 for connecting the memory 101 and the processor 102.
Optionally, this embodiment further includes: a communication interface 104, the communication interface 104 being connectable to the processor 102 via a bus 103. The processor 102 may control the communication interface 103 to implement the above-described acquired function of the key agreement device 100.
The apparatus may be configured to perform the various steps and/or flows of the above-described method embodiments.
The present application further provides a readable storage medium, in which an execution instruction is stored, and when the execution instruction is executed by at least one processor of the key agreement apparatus, the key agreement apparatus executes the key agreement method provided in the above-mentioned various embodiments.
The present application also provides a program product comprising execution instructions stored in a readable storage medium. The at least one processor of the key agreement device may read the executable instructions from the readable storage medium, and the execution of the executable instructions by the at least one processor causes the key agreement device to implement the key agreement methods provided by the various embodiments described above.
Those of ordinary skill in the art will understand that: in the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the invention are brought about in whole or in part when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, wireless, microwave, etc.). The 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, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.

Claims (20)

1. A method of key agreement, comprising:
after a first vehicle integrated unit VIU negotiates a common first random number with other VIUs in a vehicle electronic control system, 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;
the first VIU authenticates and negotiates a communication key and a random number seed with a first domain control unit DC according to the second random number, the temporary common public key and an equipment private key preset by the first VIU, wherein the first DC is one of the in-vehicle electronic control systems;
the first VIU authenticates with a first Electronic Control Unit (ECU) and negotiates a communication encryption key and a communication authentication key according to the random number seed and an authentication key preset by the first VIU;
and after the first VIU determines that the first ECU is successfully authenticated, the first VIU transmits the communication encryption key and the communication authentication key to the first DC after encrypting the communication encryption key and the communication authentication key through the communication key.
2. The method of claim 1, wherein the first VIU authenticating and negotiating a communication key and a nonce seed with a first domain control unit DC according to the second nonce, the temporary common public key, and a device private key preset by the first VIU comprises:
the first VIU receives a third random number, a temporary public key and a signature value sent by the first DC;
the first VIU verifies the signature value according to the equipment public key, the third random number and the temporary public key of the first DC;
after the first VIU verifies the signature value, calculating a digital signature value according to the second random number, the temporary common public key and an equipment 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, 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 the communication key is determined according to the temporary private key and the temporary common public key after verification is successful;
and the first VIU determines the communication key according to the temporary public key and the temporary common private 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 function domain identifier of the first VIU.
3. The method of claim 2, wherein after the first VIU sends the second random number, the temporary common public key, the digitally signed value, and a device certificate preset by the first VIU to the first DC, the method further comprises:
the first VIU calculates a first check value according to the third random number, the temporary public key and the temporary shared key;
and 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, so that the other VIUs can calculate a second check value according to the third random number, the temporary public key and the temporary shared key, determine the communication key according to the temporary public key and the temporary public private key when confirming that the first check value is the same as the second check value, 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 functional domain identifiers of the other VIUs.
4. The method according to any of claims 1-3, wherein the first VIU authenticates and negotiates a communication encryption key and a communication authentication key with the first ECU based on the random number seed and an authentication key preset by the first VIU, comprising:
the first VIU receives a fourth random number sent by the first ECU;
and 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 an authentication key preset by the first VIU.
5. The method of claim 4, wherein the first VIU authenticating and negotiating with the first ECU a communication encryption key and a communication authentication key based on the fourth random number, the random number seed, and an authentication key preset by the first VIU comprises:
the first VIU calculates a third check value according to the fourth random number, the random number seed and an authentication key preset by the first VIU;
the first VIU sends the random number seed and the third check value to the first ECU, and the first ECU is used for authenticating the third check value;
the first VIU receives a first message authentication code and a second message authentication code which are sent after the first ECU authenticates the third check value, wherein the first message authentication code is obtained by the first ECU through calculation according to the random number seed and an authentication key preset by the first ECU, and the second message authentication code is obtained by the first ECU through calculation 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 a long-term shared key and a random number seed preset by the first VIU;
the first VIU authenticates the first message authentication code and the second message authentication code.
6. The method of claim 5, wherein authenticating the first and second message authentication codes by the first VIU comprises:
the first VIU calculates a third message authentication code according to the random number seed and an authentication key preset by the first VIU, and calculates a 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 determining that authentication with the first ECU is successful includes:
and 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 first ECU is successfully authenticated.
7. The method of claim 6, wherein the sending the traffic encryption key and the traffic authentication key to the first DC after encrypting with the traffic key comprises:
the first VIU encrypts the communication encryption key and the communication authentication key through the communication key to obtain an encrypted ciphertext;
the first VIU sends the second message authentication code and the encrypted ciphertext to the first DC.
8. A method of key agreement, comprising:
a 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, wherein the first DC is one DC in an in-vehicle electronic control system;
the first DC authenticates the first vehicle integrated unit VIU and negotiates a communication key according to the temporary public key, the third random number and a device private key preset by the first DC;
and the first DC receives a communication encryption key and a communication authentication key which are sent by the first VIU and encrypted by the communication key, wherein the communication encryption key and the communication authentication key are obtained by the first VIU through authentication and negotiation with the first ECU according to the random number seed and an authentication key preset by the first VIU.
9. The method of claim 8, wherein the first DC authenticates and negotiates a communication key with a first vehicle integrated unit, VIU, according to the temporary public key, the third random number, and a device private key preset by the first DC, comprising:
the first DC carries out digital signature on the temporary public key and the third random number by using an equipment private key preset by the first DC to obtain a signature value;
the first DC sending the temporary public key, the third random number, and the signature value to a first VIU;
the first DC receives a second random number, a temporary common public key and a digital signature value sent by the first VIU, wherein the digital signature value is obtained by the first VIU through calculation according to the second random number, the temporary common public key and a preset device private key of the first VIU, the second random number is determined by the first VIU according to a first random number, and the first random number is a common random number negotiated by the first VIU and other VIUs in an 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;
and after the first DC passes the verification of the digital signature value, determining the communication key according to the temporary private key and the temporary common public key.
10. A key agreement apparatus, comprising:
the determining module is used for determining 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 generating a temporary common public key according to the temporary common private key;
the first authentication negotiation module is used for authenticating and negotiating a communication key and a random number seed with a first domain control unit DC according to the second random number, the temporary common public key and an equipment private key preset by a first VIU, wherein the first DC is one DC in the in-vehicle electronic control system;
the second authentication negotiation module is used for authenticating with the first electronic control unit ECU and negotiating a communication encryption key and a communication authentication key according to the random number seed and the authentication key preset by the first VIU;
and the sending module is used for sending the communication encryption key and the communication authentication key to the first DC after encrypting the communication encryption key and the communication authentication key through the communication key after determining that the authentication with the first ECU is successful.
11. The apparatus of claim 10, wherein the first authentication negotiation module comprises:
a receiving unit, configured to receive a third random number, a temporary public key, and a signature value sent by the first DC;
a verification unit, configured to verify the signature value according to a device public key of the first DC, the third random number, and the temporary public key;
a computing unit, configured to compute a digital signature value according to the second random number, the temporary common public key, and an equipment private key of the first VIU after the signature value is verified;
a sending unit, configured to send the second random number, the temporary common public key, and the digital signature value to the first DC, where the first DC verifies the digital signature value according to the second random number, the temporary common public key, and an equipment public key of the first VIU, and determines the communication key according to the temporary private key and the temporary common public key after successful verification;
a determining unit, configured to determine the communication key according to the temporary public key and the temporary common private 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 a function domain identifier of the first VIU.
12. The apparatus of claim 11,
the computing unit is further to: calculating a first check value from the third random number, the temporary public key, and the temporary shared key after the transmitting unit transmits the second random number, the temporary public key, and the digital signature value to the first DC;
the sending unit is further configured to: and sending the third random number, the temporary public key and the first check value to other VIUs in the in-vehicle electronic control system, wherein the other VIUs are used for calculating a second check value according to the third random number, the temporary public key and the temporary shared key, determining the communication key according to the temporary public key and the temporary common private key when the first check value is confirmed to be the same as the second check value, determining the random number seed according to the third random number and the second random number, or determining the random number seed according to the third random number, the second random number and the functional domain identification of the other VIUs.
13. The apparatus according to any of claims 10-12, wherein the second authentication negotiation module comprises:
a receiving unit, configured to receive a fourth random number sent by the first ECU;
and the authentication negotiation unit is used for authenticating and negotiating a communication encryption key and a communication authentication key with the first ECU according to the fourth random number, the random number seed and an authentication key preset by the first VIU.
14. The apparatus of claim 13, wherein the authentication negotiation unit is configured to:
calculating a third check value according to the fourth random number, the random number seed and an authentication key preset by the first VIU;
sending the random number seed and the third check value to the first ECU, so that the first ECU can authenticate the third check value;
receiving a first message authentication code and a second message authentication code which are sent after the first ECU authenticates the third check value, wherein the first message authentication code is obtained by the first ECU through calculation according to the random number seed and an authentication key preset by the first ECU, and the second message authentication code is obtained by the first ECU through calculation according to the communication encryption key and the communication authentication key;
determining the communication encryption key and the communication authentication key according to a long-term shared key and a random number seed preset by the first VIU;
and authenticating the first message authentication code and the second message authentication code.
15. The apparatus of claim 14, wherein the authentication negotiation unit is configured to:
calculating a third message authentication code according to the random number seed and an authentication key preset by the first VIU, and calculating a 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 configured to:
and 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, determining that the first ECU is successfully authenticated.
16. The apparatus of claim 10, wherein the sending module is configured to:
encrypting the communication encryption key and the communication authentication key through the communication key to obtain an encrypted ciphertext;
sending the second message authentication code and the encrypted ciphertext to the first DC.
17. A key agreement apparatus, comprising:
the generating module is used for generating a temporary private key and a third random number and generating a corresponding temporary public key according to the temporary private key, wherein the first DC is one DC in an in-vehicle electronic control system;
the authentication negotiation module is used for authenticating with a first Vehicle Integrated Unit (VIU) and negotiating a communication key according to the temporary public key, the third random number and a device private key preset by the first DC;
and the receiving module is used for receiving a communication encryption key and a communication authentication key which are sent by the first VIU and encrypted by the communication key, wherein the communication encryption key and the communication authentication key are obtained by the first VIU through authentication and negotiation with the first ECU according to the random number seed and an authentication key preset by the first VIU.
18. The apparatus of claim 17, wherein the authentication negotiation module comprises:
the digital signature unit is used for digitally signing the temporary public key and the third random number by using a 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 a 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 obtained by the first VIU through calculation according to the second random number, the temporary common public key, and an equipment private key preset by the first VIU, the second random number is determined by the first VIU according to a first random number, and the first random number is a common random number negotiated by the first VIU and another VIU in an 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;
and the determining unit is used for determining 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 apparatus, comprising:
a memory for storing program instructions;
a processor for performing the key agreement method of any one of claims 1-7 or 8-9 when the program instructions in the memory are invoked and executed.
20. A readable storage medium having stored thereon execution instructions, which when executed by at least one processor of a key agreement device, cause the key agreement device to perform a key agreement method according to any one of claims 1-7 or 8-9.
CN202080004392.2A 2020-07-30 2020-07-30 Key agreement method and device Active CN112544052B (en)

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 (2)

Publication Number Publication Date
CN112544052A CN112544052A (en) 2021-03-23
CN112544052B true CN112544052B (en) 2022-03-11

Family

ID=75017365

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202080004392.2A Active CN112544052B (en) 2020-07-30 2020-07-30 Key agreement method and device

Country Status (2)

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

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220103354A1 (en) * 2020-09-25 2022-03-31 Renesas Electronics Corporation Secure encryption 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 浙江广厦建设职业技术大学 Online engineering quotation safety interaction method and system
CN115001764B (en) * 2022-05-23 2023-07-11 中国科学技术大学 Cross-domain key negotiation method and system based on consensus database under hierarchical system
CN114785529B (en) * 2022-06-20 2022-10-04 广东名阳信息科技有限公司 Method and system for establishing trusted communication link based on block chain
CN117436043A (en) * 2023-12-20 2024-01-23 鼎铉商用密码测评技术(深圳)有限公司 Method and device for verifying source of file to be executed and readable storage medium

Family Cites Families (7)

* 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
CN106302379B (en) * 2015-06-26 2020-02-21 比亚迪股份有限公司 Authentication method, system and device for vehicle-mounted electric appliance
CN105187205B (en) * 2015-08-05 2018-05-15 北京航空航天大学 The authentication key agreement method and negotiating system based on level identity base without certificate
SG10201705960QA (en) * 2017-07-20 2019-02-27 Huawei Int Pte Ltd System and method for managing secure communications between modules in a controller area network
JP6625293B2 (en) * 2017-08-21 2019-12-25 三菱電機株式会社 Key management device and communication equipment
CN110943957B (en) * 2018-09-21 2022-04-15 郑州信大捷安信息技术股份有限公司 Safety communication system and method for vehicle intranet
CN111416712B (en) * 2020-04-01 2023-03-24 南京如般量子科技有限公司 Quantum secret communication identity authentication system and method based on multiple mobile devices

Also Published As

Publication number Publication date
WO2022021193A1 (en) 2022-02-03
CN112544052A (en) 2021-03-23

Similar Documents

Publication Publication Date Title
CN112544052B (en) Key agreement method and device
CN111953705B (en) Internet of things identity authentication method and device and power Internet of things identity authentication system
CN110474875B (en) Discovery method and device based on service architecture
CN109479049B (en) System, apparatus and method for key provisioning delegation
US20180183587A1 (en) Blockchain-Assisted Public Key Infrastructure for Internet of Things Applications
EP2264940B1 (en) Authentication information management method in home network and an apparatus therefor
US20090240941A1 (en) Method and apparatus for authenticating device in multi domain home network environment
KR20160121546A (en) Assisted device provisioning in a network
WO2019041809A1 (en) Registration method and apparatus based on service-oriented architecture
CN108141458B (en) Method and system for securing first contact establishment of a mobile device with a device
US10411886B1 (en) Authenticating secure channel establishment messages based on shared-secret
US9998287B2 (en) Secure authentication of remote equipment
CN101129014A (en) System and method for multi-session establishment
CN109005032B (en) Routing method and device
CN111654481B (en) Identity authentication method, identity authentication device and storage medium
WO2008002081A1 (en) Method and apparatus for authenticating device in multi domain home network environment
CN111756530B (en) Quantum service mobile engine system, network architecture and related equipment
CN109995723B (en) Method, device and system for DNS information interaction of domain name resolution system
CN113626794A (en) Authentication and key agreement method, system and application in client/server mode
KR20090002328A (en) Method for joining new device in wireless sensor network
CN113766450A (en) Vehicle virtual key sharing method, mobile terminal, server and vehicle
KR20170090008A (en) METHOD AND APPARATUS FOR PLUG-IN DEVICE AUTHENTICATION IN AN OPEN-SOURCE PLUG-AND-PLAY(PnP) PLATFORM OF A CAR
CN100589384C (en) Safety interacting method for user terminal access softswitch system
CN113329003B (en) Access control method, user equipment and system for Internet of things
CN114301593B (en) EAP authentication system and method based on quantum key

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant