WO2022227057A1 - 一种密钥更新方法及其相关设备 - Google Patents

一种密钥更新方法及其相关设备 Download PDF

Info

Publication number
WO2022227057A1
WO2022227057A1 PCT/CN2021/091653 CN2021091653W WO2022227057A1 WO 2022227057 A1 WO2022227057 A1 WO 2022227057A1 CN 2021091653 W CN2021091653 W CN 2021091653W WO 2022227057 A1 WO2022227057 A1 WO 2022227057A1
Authority
WO
WIPO (PCT)
Prior art keywords
key
identifier
check value
target device
server
Prior art date
Application number
PCT/CN2021/091653
Other languages
English (en)
French (fr)
Inventor
钟胤
魏卓
沙庆迪
李臻
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2021/091653 priority Critical patent/WO2022227057A1/zh
Priority to CN202180097661.9A priority patent/CN117223251A/zh
Priority to EP21938531.7A priority patent/EP4329240A4/en
Publication of WO2022227057A1 publication Critical patent/WO2022227057A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • 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
    • H04L63/062Network architectures or network communication protocols for network security for supporting key management in a packet data network for key distribution, e.g. centrally by trusted party
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • 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/0891Revocation or update of secret information, e.g. encryption key update or rekeying
    • 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/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • H04L9/16Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms the keys or algorithms being changed during operation
    • 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/3236Cryptographic 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 using cryptographic hash functions
    • H04L9/3242Cryptographic 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 using cryptographic hash functions involving keyed hash functions, e.g. message authentication codes [MACs], CBC-MAC or HMAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40267Bus for use in transportation systems
    • H04L2012/40273Bus for use in transportation systems the transportation system being a vehicle
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/84Vehicles

Definitions

  • the present application relates to the field of automobile technology, and in particular, to a key update method and related equipment.
  • the electronic control unit (ECU) in a vehicle is an important component for controlling the vehicle.
  • the vehicle may contain multiple ECUs, and different ECUs are responsible for implementing different functions, such as power, door, steering, and so on. If the ECU is invaded by an attacker, it will affect the normal operation of the vehicle. At present, the core of the ECU security protection mechanism is to use the key to ensure the security of the ECU.
  • the vehicle production center When the vehicle production center manufactures the vehicle, it can write the key to each ECU in the vehicle to ensure the safety of the ECU and the vehicle. After the vehicle is sold, each ECU in the vehicle will continue to use the original key provided by the vehicle production center to implement corresponding functions. However, over time, the original key used by the ECU may not be able to withstand the intrusion of attackers, causing the vehicle to fail to operate normally, thus threatening the safety of passengers.
  • the embodiments of the present application provide a key update method and related equipment, which can enable the key of the ECU to resist the intrusion of an attacker and maintain the normal operation of the vehicle, thereby ensuring the safety of passengers.
  • a first aspect of the embodiments of the present application provides a method for updating a key, the method includes: sending a first request to a target device, where the first request is used to obtain a first identification code and a first identifier, the first The identifier is associated with the first identifier; the information of the first key corresponding to the first identifier is obtained, and the information of the first key is used to instruct the target device to update the first key.
  • the vehicle production center or after-sales service center needs to update the key of the target device in the vehicle (that is, the ECU whose key is to be updated in the vehicle), it can first update the key to the target device through the key update device.
  • Sending the first request so that the target device obtains the vehicle identification number (VIN) of the vehicle where the target device is located and the unique identifier (UID) of the target device according to the first request, which is equivalent to obtaining the first identification code and the first identifier, and send the first identification code and the first identifier to the key update device.
  • VIN vehicle identification number
  • UID unique identifier
  • the key update device After receiving the first identification code and the first identifier sent by the target device, the key update device associates the first identification code and the first identifier, that is, associates the target device with the vehicle in which it is located. Next, the key update device may acquire the first key corresponding to the first identifier, and generate information of the first key based on the first key, where the first key is the key to be updated by the target device.
  • the key update device sends the information of the first key to the target device, so that the target device parses the information of the first key to obtain the first key, and completes the update of the first key.
  • the key update device can first send the first request to the target device in the vehicle, and the first request is used to obtain the first identification code and the first identification, the first identification code and the first identification association. After receiving the first identification code and the first identifier from the target device, the key update device obtains information of the first key corresponding to the first identifier, and sends the information of the first key to the target device, so that The target device updates the first key according to the information of the first key.
  • the vehicle production center or after-sales service center can use the key update device to make the target device update the original key to the first key, that is, the vehicle production center or after-sales service center can continuously update the key of the target device to Increase the strength of the key of the target device so that it can resist the intrusion of attackers, keep the vehicle running normally, and ensure the safety of passengers.
  • the method further includes: the first server obtains a first check value and a second check value, and both the first check value and the second check value are generated based on the first key; If the first check value is the same as the second check value, it is determined that the first key update is successful.
  • the key update apparatus includes a first server and a second server. The first server may receive the first check value sent by the second server. After the target device completes the key update, the first server may also receive the second check value sent by the target device. After obtaining the second check value, the first server can compare the first check value with the second check value. If the two are the same, it is determined that the key update is successful, and if the two are different, it is determined that the key update has failed.
  • the first check value is calculated by the second server based on the first key, and the second check value is obtained by updating the first key by the target device.
  • the second server may generate the information of the first key and the first check value based on the first key, and convert the information of the first key to the first key. and the first check value is sent to the first server.
  • the target device may also generate a second check value, and send the second check value to the first server. In this way, the first server can use the first check value and the second check value to determine whether the key update is successful.
  • the method further includes: the second server obtains a third check value, where the third check value is obtained by the target device in the process of obtaining the first identifier; when the first identifier exists In the second server, when the first identifier is associated with the first identifier, a fourth check value is generated based on the first key and the first identifier; when the third check value and the fourth check value are If the values are the same, the relationship between the first identifier and the first identifier is maintained.
  • the second server determines that the first identifier already exists in the database, and the first identifier is associated with the first identification code, it means that the target device is associated with the vehicle in which it is located, so it can be based on the data corresponding to the first identifier.
  • the first key and the first identifier generate a fourth check value, and compare the fourth check value with the third check value from the target device, if the two are the same, it means that the first identifier has not been tampered with, Then, the association relationship between the first identifier and the first identification code is maintained, that is, the association relationship between the target device and the vehicle in which it is located is maintained.
  • the method further includes: the second server obtains a third check value, where the third check value is obtained by the target device in the process of obtaining the first identifier; when the first identifier exists In the second server, when the first identifier is associated with other identifiers except the first identifier, a fourth check value is generated based on the first key and the first identifier; in the third verification If the verification value is the same as the fourth verification value, the first identifier is associated with the first identifier.
  • the second server determines that the first identifier already exists in the database, and the first identifier is associated with other identification codes except the first identification code, it means that the target device has been associated with other vehicles, so it can be based on
  • the first key corresponding to the first identifier and the first identifier generate a fourth check value, and compare the fourth check value with the third check value from the target device. If the identifier has not been tampered with, the first identifier is associated with the first identification code, that is, the target device is associated with the vehicle in which it is located.
  • the method further includes: the second server obtains a third check value, and the third check value is obtained by the target device in the process of obtaining the first identifier; when the first identifier does not exist In the case of the second server, a fifth check value is generated based on the preset second key and the first identifier, and the second key corresponds to the type of the target device; If the check values are the same, the first identifier is associated with the first identifier. In the aforementioned implementation manner, if the second server determines that the first identifier does not exist in the database, it means that the target device is not associated with any vehicle, so the fifth check value can be generated based on the preset second key and the first identifier.
  • the second server compares the fifth check value with the third check value from the target device, if the two are the same, indicating that the first identifier has not been tampered with, and associates the first identifier with the first identifier , that is, associate the target device with the vehicle it is in.
  • TK temporary key
  • the first key includes one of the following: (1) the current MEK in the master key (master ecu key, MEK) linked list; (2) the current MEK and the secure vehicle communication key ( secure onboard communication key, SK); (3) current MEK and digital device authentication key (device authentication key, DK); (4) current MEK, SK and DK.
  • generating the fourth check value based on the first key and the first identifier includes: generating the fourth check value based on any MEK in the MEK linked list and the first identifier.
  • a second aspect of the embodiments of the present application provides a method for updating a key, the method comprising:
  • the target device receives a first request from a first server of the key update apparatus, where the first request is used to obtain a first identification code and a first identifier, and the first identification code is associated with the first identifier.
  • the target device can obtain the VIN of the vehicle where the target device is located and the UID of the target device according to the first request, which is equivalent to obtaining the first identification code and the first identifier, and sending the first identification code and the first identifier to the first a server.
  • the target device receives the information of the first key corresponding to the first identifier sent by the first server, and updates the first key according to the information of the first key.
  • the key update device can first send the first request to the target device in the vehicle, and the first request is used to obtain the first identification code and the first identification, the first identification code and the first identification association. After receiving the first identification code and the first identifier from the target device, the key update device obtains information of the first key corresponding to the first identifier, and sends the information of the first key to the target device, so that The target device updates the first key according to the information of the first key.
  • the vehicle production center or after-sales service center can use the key update device to make the target device update the original key to the first key, that is, the vehicle production center or after-sales service center can continuously update the key of the target device to Increase the strength of the key of the target device so that it can resist the intrusion of attackers, keep the vehicle running normally, and ensure the safety of passengers.
  • the first key includes one of the following: (1) the current MEK in the MEK linked list; (2) the current MEK and SK; (3) the current MEK and DK; (4) the current MEK , SK and DK.
  • a third aspect of the embodiments of the present application provides a key update apparatus, the apparatus includes: a first processing module, configured to send a first request to a target device, where the first request is used to obtain a first identification code and a first identification The first identifier is associated with the first identifier; the second processing module is used to obtain information of the first key corresponding to the first identifier, and the information of the first key is used to instruct the target device to update the first key.
  • the key update device can first send the first request to the target device in the vehicle, the first request is used to obtain the first identification code and the first identification, the first identification code and the first identification association. After receiving the first identification code and the first identifier from the target device, the key update device obtains information of the first key corresponding to the first identifier, and sends the information of the first key to the target device, so that The target device updates the first key according to the information of the first key.
  • the vehicle production center or after-sales service center can use the key update device to make the target device update the original key to the first key, that is, the vehicle production center or after-sales service center can continuously update the key of the target device to Increase the strength of the key of the target device so that it can resist the intrusion of attackers, keep the vehicle running normally, and ensure the safety of passengers.
  • the first processing module is further configured to: obtain a first check value and a second check value, where both the first check value and the second check value are generated based on the first key; If the first check value is the same as the second check value, it is determined that the first key update is successful.
  • the first check value is calculated by the second processing module based on the first key, and the second check value is obtained by updating the first key by the target device.
  • the second processing module is further configured to: obtain a third check value, where the third check value is obtained by the target device in the process of obtaining the first identifier; In the case that exists in the second server, and the first identifier is associated with the first identifier, a fourth check value is generated based on the first key and the first identifier; when the third check value and the fourth check value are If the verification values are the same, the association relationship between the first identifier and the first identifier is maintained.
  • the second processing module is further configured to: obtain a third check value, where the third check value is obtained by the target device in the process of obtaining the first identifier; exists in the second server, and the first identifier is associated with other identifiers except the first identifier, a fourth check value is generated based on the first key and the first identifier; in the third If the check value is the same as the fourth check value, the first identifier is associated with the first identifier.
  • the second processing module is further configured to: obtain a third check value, where the third check value is obtained by the target device in the process of obtaining the first identifier; In the case of existing in the second server, a fifth check value is generated based on the preset second key and the first identifier, and the second key corresponds to the type of the target device; in the third check value and the first If the five check values are the same, the first identifier is associated with the first identifier.
  • the first key includes one of the following: the current MEK in the MEK linked list; the current MEK and SK; the current MEK and DK; the current MEK, SK and DK.
  • the second processing module is configured to generate a fourth check value based on any MEK in the MEK linked list and the first identifier.
  • a fourth aspect of the embodiments of the present application provides a target device, the device includes: a receiving module, configured to receive a first request from a first server, where the first request is used to obtain a first identifier and a first identifier, The first identification code is associated with the first identifier; the obtaining module is used for obtaining the information of the first key corresponding to the first identifier; and the updating module is used for updating the first key according to the information of the first key.
  • the first key includes one of the following: the current MEK in the MEK linked list; the current MEK and SK; the current MEK and DK; the current MEK, SK and DK.
  • a fifth aspect of the embodiments of the present application provides a key update device, the key update device includes a memory and a processor;
  • the memory stores code
  • the processor is configured to execute the code
  • the key update apparatus executes the method as described in the first aspect or any one of the possible implementations of the first aspect.
  • a sixth aspect of the embodiments of the present application provides a target device, where the target device includes a memory and a processor;
  • the memory stores code
  • the processor is configured to execute the code
  • the target device executes the method as described in the second aspect or any one of the possible implementations of the second aspect.
  • a seventh aspect of the embodiments of the present application provides a key update system, the system includes the key update device according to the fifth aspect and the target device according to the sixth aspect, wherein the key update device and the target device Device communication connection.
  • An eighth aspect of the embodiments of the present application provides a computer storage medium, where the computer storage medium stores a computer program, and when the program is executed by a computer, the computer can implement any one of the possible implementation manners of the first aspect and the first aspect. , the second aspect, or the method described in any one possible implementation manner of the second aspect.
  • a ninth aspect of the embodiments of the present application provides a computer program product, where the computer program product stores instructions, and when the instructions are executed by a computer, the instructions cause the computer to implement any one of the possible implementations of the first aspect, the first aspect, The method described in the second aspect or any one possible implementation manner of the second aspect.
  • a tenth aspect of the embodiments of the present application provides a chip system, where the chip system includes a processor for invoking a computer program or computer instruction stored in a memory, so that the processor executes the process described in the first aspect and the first aspect. Any one of the possible implementations, the second aspect, or the method described in any one of the possible implementations of the second aspect.
  • the processor is coupled to the memory through an interface.
  • the chip system further includes a memory, and the memory stores computer programs or computer instructions.
  • An eleventh aspect of the embodiments of the present application provides a processor, where the processor is configured to invoke a computer program or computer instructions stored in a memory, so that the processor executes any one of the first aspect and the first aspect.
  • the key update device may first send a first request to the target device in the vehicle, where the first request is used to obtain a first identification code and a first identifier, and the first identification code and the first identifier are associated .
  • the key update device After receiving the first identification code and the first identifier from the target device, the key update device obtains information of the first key corresponding to the first identifier, and sends the information of the first key to the target device, so that The target device updates the first key according to the information of the first key.
  • the vehicle production center or after-sales service center can use the key update device to make the target device update the original key to the first key, that is, the vehicle production center or after-sales service center can continuously update the key of the target device to Increase the strength of the key of the target device so that it can resist the intrusion of attackers, keep the vehicle running normally, and ensure the safety of passengers.
  • FIG. 1 is a schematic structural diagram of a key update system provided by an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a key update method provided by an embodiment of the present application.
  • FIG. 3 is another schematic flowchart of a key update method provided by an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of associating UID to VIN by a second server provided in an embodiment of the present application
  • FIG. 5 is a schematic structural diagram of a key update device provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a target device provided by an embodiment of the present application.
  • FIG. 7 is another schematic structural diagram of a key update apparatus provided by an embodiment of the present application.
  • FIG. 8 is another schematic structural diagram of a target device provided by an embodiment of the present application.
  • connection, coupling or communication in this application may be a direct connection, coupling or communication between related objects, or an indirect connection, coupling or communication through other devices, and in addition, the connection, coupling or communication between objects It can be electrical or other similar forms, which are not limited in this application.
  • Modules or sub-modules described independently may or may not be physically separated; they may be implemented by software or by hardware, and some modules or sub-modules may be implemented by software and called by the processor.
  • the software realizes the functions of this part of the modules or sub-modules, and other parts of the templates or sub-modules are realized by hardware, for example, by hardware circuits.
  • some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present application.
  • “Plural” means two or more. "And/or” describes the association relationship between associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone.
  • the electronic control unit (ECU) in a vehicle is an important component for controlling the vehicle.
  • the vehicle may contain multiple ECUs, and different ECUs are responsible for implementing different functions, such as power, door, steering, and so on. If the ECU is invaded by an attacker, it will affect the normal operation of the vehicle.
  • the core of the ECU security protection mechanism is to use the key to ensure the security of the ECU.
  • the vehicle production center When the vehicle production center manufactures the vehicle, it can write the key to each ECU in the vehicle to ensure the safety of the ECU and the vehicle. After the vehicle is sold, each ECU in the vehicle will continue to use the original key provided by the vehicle production center to implement corresponding functions. However, over time, the original key used by the ECU may not be able to withstand the intrusion of attackers, causing the vehicle to fail to operate normally, thus threatening the safety of passengers.
  • FIG. 1 is a schematic structural diagram of a key update system provided by an embodiment of the application.
  • the system includes: a target device deployed in a vehicle and a key update deployed in the background (or outside the vehicle)
  • the device, the target device and the key update device are communicatively connected.
  • the key update device may include a first server and a second server, and the first server and the second server may be deployed in the same physical machine, or may be deployed in different physical machines.
  • the second server can access the target device through the first server, so that information exchange can be realized between the second server and the target component.
  • the target device usually refers to the ECU whose key is to be updated.
  • the ECU may be an ECU newly added to the vehicle, or an old ECU already installed in the vehicle, etc., which is not limited here.
  • the background usually refers to the complete vehicle generation center, or a combination of the vehicle after-sales service center and the complete vehicle production center.
  • the first server can be presented in the form of a diagnostic instrument, that is, the second server can access the ECU whose key is to be updated through the diagnostic instrument. It should be understood that the foregoing examples are only illustratively described by taking the first server as a diagnostic instrument, and the second server may also be connected to the ECU through other tools, which does not limit the type of the first server in the embodiment of the present application.
  • the second server may include a key management system (KMS) server and an original equipment manufacturer (original equipment manufacturer, OEM) server, and communication can be implemented between the two.
  • KMS key management system
  • OEM original equipment manufacturer
  • the second server may include a dealer (dealer) server on the after-sales service center side and a KMS server on the vehicle production center side, and communication can be achieved between the two .
  • dealer dealer
  • the reseller server, KMS server and OEM server may be different physical machines, or may be cloud instances deployed on the same physical machine (or different physical machines), for example, a virtual machine (VM) ) and containers (docker), etc., there are no restrictions here.
  • the KMS server is used to generate, store and manage the keys of each ECU, such as MEK, TK, SK and DK of each ECU, etc.
  • the diagnostic instrument can request the key from the KMS server through the OEM server (or the dealer server).
  • the KMS can issue the key to the diagnostic tester through the OEM server (or dealer server), so that the diagnostic tester writes the key to the ECU, and verifies whether the key update is successful at the diagnostic tester.
  • FIG. 2 is a schematic flowchart of a key update method provided by an embodiment of the present application, and the method includes:
  • the key update apparatus sends a first request to the target device, where the first request is used to obtain a first identification code and a first identifier, and the first identification code is associated with the first identifier.
  • the key update device can be used first. Send a first request to the target device, so that the target device obtains the VIN of the vehicle where the target device is located and the UID of the target device according to the first request, which is equivalent to obtaining the first identification code and the first identifier, and the first identification code and Information such as the first identifier is sent to the key update device.
  • the key update device After receiving the first identifier and the first identifier sent by the target device, the key update device associates the first identifier with the first identifier (it can also be understood as binding the first identifier and the first identifier). set), that is, associate the target device with the vehicle it is in.
  • the key update device may acquire the first key corresponding to the first identifier, and generate information of the first key based on the first key, where the first key is the key to be updated by the target device, and the target device There may be various keys to be updated, for example, MEK, SK, DK, and so on.
  • the key update apparatus acquires information of the first key corresponding to the first identifier, where the information of the first key is used to instruct the target device to update the first key.
  • the key update device After obtaining the information of the first key, the key update device sends the information of the first key to the target device, so that the target device parses the information of the first key to obtain the first key, and updates the previously stored key. is the first key.
  • the key update device may first send a first request to the target device in the vehicle, where the first request is used to obtain a first identification code and a first identifier, and the first identification code and the first identifier are associated .
  • the key update device After receiving the first identification code and the first identifier from the target device, the key update device obtains information of the first key corresponding to the first identifier, and sends the information of the first key to the target device, so that The target device updates the first key according to the information of the first key.
  • the vehicle production center or after-sales service center can use the key update device to make the target device update the original key to the first key, that is, the vehicle production center or after-sales service center can continuously update the key of the target device to Increase the strength of the key of the target device so that it can resist the intrusion of attackers, keep the vehicle running normally, and ensure the safety of passengers.
  • FIG. 3 is another schematic flowchart of a key update method provided by an embodiment of the present application. As shown in FIG. 3 , the method includes:
  • a first server sends a first request to a target device, where the first request is used to acquire a first identification code and a first identifier.
  • the target device can be sent to the target device through the first server.
  • Send a first request the first request is used to instruct the target device to send the VIN of the vehicle where the target component is located (ie the aforementioned first identification code) and the UID of the target device (ie the aforementioned first identifier).
  • the first request may be transmitted between the first server and the target device based on the unified diagnostic services (unified diagnostic services, UDS) protocol, that is, the format of the first request conforms to the requirements of the UDS protocol.
  • UDS unified diagnostic services
  • the first server is preset with information such as the type of the target device. For example, when it is necessary to update the keys of ECU1, ECU2, and ECU3, the first server is preset with the type of ECU1, the type of ECU2, and the type of ECU3. type, etc. Information such as the type of the ECU may be preset in the first server by the second server, or may be manually preset in the first server, which is not limited here. It can be seen that when the first server sends the first request to the target device, the first server has determined the type of the target device.
  • the first server receives the first identifier and the first identifier from the target device.
  • the target device may directly read the VIN of the vehicle in which it is located based on the first request.
  • the target device can also call the function CMD_RND in a certain communication protocol, and use CMD_RND to generate a random number, which is recorded as CHALLENGE (challenge value).
  • CHALLENGE challenge value
  • the target device can also call the function CMD_GET_ID, and use CHALLENGE as the input of CMD_GET_ID to obtain the UID of the target device, the status register (SREG) of the target device, and the message authentication code (MAC) 1 (that is, the aforementioned third check value) and other information.
  • CHALLENGE challenge value
  • the target device After obtaining the information such as the VIN of the vehicle where the target device is located, the UID, CHALLENGE, SREG and MAC1 of the target device, the target device can send the VIN of the vehicle where the target device is located, the UID, SREG and MAC1 of the target device based on the UDS protocol. a server.
  • the first server sends a second request including the first identifier and the first identifier to the second server.
  • the first server After the first server receives information such as the VIN of the vehicle where the target device is located, the UID, CHALLENGE, SREG and MAC1 of the target device, it is equivalent to determining the specific information of the target device, so it can request the key of the target device from the second server. Specifically, the first server may generate a second request including information such as the type of the target device, the VIN of the vehicle where the target device is located, the UID, CHALLENGE, SREG, and MAC1 of the target device, and send the second request to the server.
  • the second server associates the first identifier with the first identifier, and acquires the first key corresponding to the first identifier.
  • the second server can parse the second request to obtain information such as the type of the target device, the VIN of the vehicle where the target device is located, the UID, CHALLENGE, SREG, and MAC1 of the target device.
  • the second server has a database that records the association between the device and the vehicle, that is, the association between the UID of the device and the VIN of the vehicle.
  • the association relationship between the equipment and the vehicle recorded in the database is briefly introduced below in conjunction with Table 1 and Table 2, as shown in Table 1 and Table 2:
  • the database of the second server records the information of vehicle 1 and vehicle 2, wherein vehicle 1 is associated with ECU1, ..., ECUn, and vehicle 2 is associated with ECUn+1, ..., ECUm, that is, VIN1 (VIN of Vehicle 1) is associated with UID1 (UID of ECU1), ..., UIDn (UID of ECUn), VIN2 (VIN of Vehicle 2) is associated with UIDn+1 (UID of ECUn+1), ..., UIDm (UID of ECUm) ) associated.
  • VIN1 VIN of Vehicle 1
  • UIDn UID of ECU1
  • UIDn UID of ECUn
  • VIN2 VIN of Vehicle 2
  • UIDn+1 UID of ECUn+1
  • UIDm UID of ECUm
  • the second server can traverse the database to determine whether the UID of the target device exists in the database. If it is determined that the UID already exists, it means that the UID has been associated with a certain VIN, that is, the target device has been associated with a certain vehicle. If the UID of the target device exists, it means that the UID is not associated with any VIN, that is, the target device is not associated with any vehicle. Regardless of whether the UID exists in the database, the second server will associate the UID with the VIN of the vehicle where the target device is located, so as to complete the association between the target device and the vehicle where the target device is located.
  • FIG. 4 is a schematic flowchart of a second server associating a UID with a VIN according to an embodiment of the present application. As shown in FIG. 4 , the second server first traverses the database to determine whether the UID of the target device exists in the database, and the following types may occur. happening:
  • the second server determines whether the UID is associated with the VIN of the vehicle where the target device is located.
  • the second server determines that the UID has been associated with the VIN of the vehicle where the target device is located, it means that the target device is associated with the vehicle where it is located, so the second server can verify the UID to determine whether the UID is in the transmission process. tampered with. Specifically, the second server can first obtain the MEK linked list corresponding to the UID.
  • the MEK linked list contains multiple MEKs, namely the current MEK (which can also be understood as the latest MEK, that is, the MEK to be written into the target device), and the MEK before the current MEK.
  • the first MEK also known as the old MEK
  • the second MEK before the current MEK and so on.
  • the second server uses any MEK in the MEK linked list as an encryption key, and calculates the UID through a cipher-based message authentication code (CMAC) algorithm to obtain MAC2 (that is, the aforementioned No. Four check values), the calculation formula of MAC2 is:
  • MAC MEK CMAC MEK (CHALLENGE ⁇ UID ⁇ SREG)
  • means that several pieces of information are connected in series to obtain new information.
  • the second server can determine whether MAC2 and MAC1 are the same. If they are the same, it means that the UID has not been tampered with, and the UID and the VIN of the vehicle where the target device is located are maintained. The associated relationship is equivalent to maintaining the relationship between the target device and its vehicle. If it is not the same, it means that the UID has been tampered with, and an error will be reported.
  • the second server may first use the current MEK as the encryption key in the MEK linked list, and use the CMAC algorithm to calculate the UID to obtain MAC2. Then, the second server can compare MAC2 and MAC1, and if the two are the same, it is determined that the UID has not been tampered with, and if the two are not the same, the first MEK before the current MEK is obtained, and the MEK is used as the encryption key, Calculate the UID through the CMAC algorithm to obtain MAC2, and compare MAC2 and MAC1 until MAC2 and MAC1 are the same. If in the MEK linked list, the MAC2 calculated based on each MEK is different from the MAC1, it is determined that the UID has been tampered with, and an error is reported.
  • the second server determines that the UID has been associated with other VINs except the VIN of the vehicle where the target device is located, it means that the target device has been associated with other vehicles, so the second server releases the association between the UID and the remaining VINs , and check the UID to determine whether the UID has been tampered with during transmission.
  • the second server may first obtain the MEK linked list corresponding to the UID.
  • the MEK linked list includes multiple MEKs, ie the current MEK, the first MEK before the current MEK, the second MEK before the current MEK, and so on. Then, the second server uses any MEK in the MEK linked list as an encryption key, and calculates the UID through the CMAC algorithm to obtain MAC2.
  • the second server can determine whether MAC2 and MAC1 are the same, if they are the same, indicating that the UID has not been tampered with, then re-associate the UID with the VIN of the vehicle where the target device is located, which is equivalent to associating the target device with the vehicle where it is located. , indicating that the UID has been tampered with, and an error is reported.
  • the second server determines that the UID does not exist, indicating that the target device has not been associated with any vehicle, it checks the UID to determine whether the UID has been tampered with during the transmission process. Specifically, the second server may first obtain the corresponding TK (ie, the aforementioned second key) based on the type of the target device. Then, using TK as the encryption key, the UID is calculated by the CMAC algorithm to obtain MAC3 (that is, the aforementioned fifth check value). The calculation formula of MAC3 is:
  • MAC TK CMAC TK (CHALLENGE ⁇ UID ⁇ SREG)
  • the second server can determine whether MAC3 and MAC1 are the same. If they are the same, it means that the UID has not been tampered with, and then associate the UID with the VIN of the vehicle where the target device is located, which is equivalent to associating the target device with the vehicle where it is located. If the UID is tampered with, an error will be reported.
  • the second server After associating the UID of the target device with the VIN of the vehicle where the target device is located, the second server can obtain the key to be written in the target device (ie, the aforementioned first key) from the database.
  • the key to be written in the target device ie, the aforementioned first key
  • the database of the second server records the Key ID , ID, C ID (counter value) and AuthID corresponding to UID1.
  • the corresponding Key IDs are different keys.
  • Key ID SK1 (which can also be understood as the latest SK).
  • AuthID is 1 regardless of the value of ID.
  • C 1 , C 4 and C 5 are different values of the counter, which can be used to prevent replay attacks.
  • the second server can obtain the Key ID , ID, C ID and AuthID corresponding to the UID.
  • the aforementioned keys written to the target device include MEK, SK, and DK, which do not limit the type of keys written to the target device in this embodiment, and can also be other keys except MEK, SK, and DK. key, etc.
  • the check value may be calculated by the CMAC algorithm, and the check value may also be calculated by other encryption algorithms, which does not limit the encryption algorithm in this embodiment.
  • the second server sends the information of the first key to the first server.
  • the second server After the second server obtains the Key ID , ID, C ID and AuthID corresponding to the UID, it can generate M1, M2, M3, M4 and M5 based on this part of the information (M1, M2 and M3 are the information of the aforementioned first key, M5 is the aforementioned first check value).
  • K1 KDF(KEY AuthID ,KEY_UPDATE_ENC_C)
  • K2 KDF(KEY AuthID , KEY_UPDATE_MAC_C)
  • K3 KDF(KEY ID , KEY_UPDATE_ENC_C)
  • K4 KDF(KEY ID , KEY_UPDATE_MAC_C)
  • the KEY AuthID can take a value from the MEK linked list.
  • the MEK linked list There are multiple MEKs in the MEK linked list.
  • the KEY AuthID is the MEK.
  • the KEY AuthID is the current MEK in the MEK linked list (because the MEK linked list is newly generated, the MEK linked list only contains one latest MEK, that is, the current MEK).
  • KEY_UPDATE_ENC_C and KEY_UPDATE_MAC_C are preset constants.
  • M1 to M5 can be generated based on K1 to K4.
  • the calculation formulas for M1 to M5 are as follows:
  • M1 is formed by concatenating UID, ID and AuthID.
  • M2 is to concatenate C ID , F ID (that is, 95 0s in the above formula) and KEY ID , and use K1 as the encryption key to encrypt the concatenated value through cipher block chaining (CBC) mode.
  • M3 is obtained by concatenating M1 and M2, using K2 as the encryption key, and calculating the concatenated value through the CMAC algorithm.
  • M4* uses K3 as the encryption key, and encrypts the C ID through the Electronic Code Book (ECB) mode.
  • EBC Electronic Code Book
  • M4 is formed by concatenating UID, ID, AuthID and M4*.
  • M5 uses K4 as the encryption key, and is obtained by calculating M4 through the CMAC algorithm.
  • the second server can obtain a set of M1 to M5. It should be understood that if the key that the target device needs to write also includes SK, the second server can also obtain the information corresponding to SK from the database, and generate another group of M1 to M5 based on this part of the information (for the generation process, refer to the aforementioned related descriptions). , will not be repeated here). Similarly, if the key to be written by the target device also includes the DK, the second server can also obtain information corresponding to the DK from the database, and generate another group of M1 to M5 based on this part of the information. It can be seen that if the key to be written by the target device contains MEK, the second server can obtain a set of M1 to M5.
  • the second server can obtain two sets of M1 to M5. If the key to be written by the target device contains MEK, SK and DK, the second server can obtain three sets of M1 to M5, etc., which will not be described in detail later.
  • the second server may send M1 to M5 to the first server.
  • the first server sends the information of the first key to the target device.
  • the first server may retain M4 and M5, and send M1 to M3 to the target device.
  • this embodiment is only illustratively described by the first server and the second server being deployed in different physical machines.
  • the second server can send M1 to M3 to the target device through the first server. It does not limit the manner in which the key update apparatus sends M1 to M3 to the target device in this embodiment.
  • the second server may directly send M1 to M3 to the target device.
  • the target device updates the first key according to the information of the first key.
  • the target device After the target device receives M1 to M3, it can call the function CMD_LOAD_KEY in a certain communication protocol. Using this function, the target device can complete the following functions: (1) Parse M1 and M2 to obtain information such as ID and KEY ID . (2) Use M3 to check whether the content in M1 and M2 has been tampered with, if it is determined that it has not been tampered with, the corresponding KEY ID can be updated according to the ID , thereby completing the key update. (3) After completing the key update, calculate M5' (ie, the aforementioned second check value), and return to the first server, so that the first server verifies whether the key update is successful according to M5'.
  • M5' ie, the aforementioned second check value
  • the storage area corresponding to the storage address 0x1 is used to store the MEK.
  • the storage area corresponding to storage address 0x4 is used to store SK.
  • the storage area corresponding to storage address 0x5 is used to store DK.
  • the target device can write the KEY ID into the corresponding storage area according to the value of the ID, thereby completing the key update.
  • ID 1
  • the current MEK and SK1 can be written into the corresponding storage areas respectively to complete the writing or updating of the key, that is, the key update is completed.
  • the target device can also generate M5' (for its generation process, refer to the generation process of M5, which will not be repeated here), and return M5' to the first server.
  • the first server compares M5' and M5, and if the two are the same, it is determined that the key update is successful, and if the two are not the same, it is determined that the key update fails and an error is reported.
  • the key update device may first send a first request to the target device in the vehicle, where the first request is used to obtain a first identification code and a first identifier, and the first identification code and the first identifier are associated .
  • the key update device After receiving the first identification code and the first identifier from the target device, the key update device obtains information of the first key corresponding to the first identifier, and sends the information of the first key to the target device, so that The target device updates the first key according to the information of the first key.
  • the vehicle production center or after-sales service center can use the key update device to make the target device update the original key to the first key, that is, the vehicle production center or after-sales service center can continuously update the key of the target device to Increase the strength of the key of the target device so that it can resist the intrusion of attackers, keep the vehicle running normally, and ensure the safety of passengers.
  • the embodiments of the present application can enable the after-sales service center and the vehicle production center to, in various scenarios (for example, write a key to a new ECU in the vehicle, or update the key of an old ECU in the vehicle, etc. Scenario), update the key to the target device with a unified, simple and standardized process to ensure the security of the target device.
  • keys such as MEK, SK, and DK are only mastered by the key update device and the target device. They are encrypted and protected at the key update device, and decrypted and updated at the target device to achieve end-to-end key security protection.
  • the first server (for example, a diagnostic instrument) verifies whether the key update is successful. At this time, the connection between the first server and the second server can be disconnected, that is, the first server.
  • the verification of the key update that can be completed offline reduces the dependence on the second server and improves the stability and reliability of the entire process.
  • FIG. 5 is a schematic structural diagram of a key update device provided by an embodiment of the application. As shown in FIG. 5 , the device includes:
  • the first processing module 501 is configured to send a first request to the target device, where the first request is used to obtain a first identification code and a first identifier, and the first identification code is associated with the first identifier.
  • the first processing module 501 may be the aforementioned first server.
  • the second processing module 502 is configured to obtain information of the first key corresponding to the first identifier, and the information of the first key is used to instruct the target device to update the first key.
  • the second processing module 502 may be the aforementioned second server.
  • the first processing module 501 is further configured to: obtain a first check value and a second check value, where both the first check value and the second check value are generated based on the first key ; In the case that the first check value is the same as the second check value, it is determined that the first key update is successful.
  • the first check value is calculated by the second processing module 502 based on the first key, and the second check value is obtained by updating the first key by the target device.
  • the second processing module 502 is further configured to: obtain a third check value, where the third check value is obtained by the target device in the process of obtaining the first identifier; When the first identifier exists in the second server and the first identifier is associated with the first identifier, a fourth check value is generated based on the first key and the first identifier; If the check values are the same, the association relationship between the first identifier and the first identifier is maintained.
  • the second processing module 502 is further configured to: obtain a third check value, where the third check value is obtained by the target device in the process of obtaining the first identifier; If the identifier exists in the second server, and the first identifier is associated with other identifiers except the first identifier, a fourth check value is generated based on the first key and the first identifier; When the third check value is the same as the fourth check value, the first identifier is associated with the first identifier.
  • the second processing module 502 is further configured to: obtain a third check value, where the third check value is obtained by the target device in the process of obtaining the first identifier; In the case that it does not exist in the second server, a fifth check value is generated based on the preset second key and the first identifier, and the second key corresponds to the type of the target device; If the fifth check value is the same, the first identifier is associated with the first identifier.
  • the first key includes one of the following: the current MEK in the MEK linked list; the current MEK and SK; the current MEK and DK; the current MEK, SK and DK.
  • the second processing module 502 is configured to generate a fourth check value based on any MEK in the MEK linked list and the first identifier.
  • FIG. 6 is a schematic structural diagram of a target device provided by an embodiment of the present application. As shown in FIG. 6 , the device includes:
  • a receiving module 601 configured to receive a first request from a first server, where the first request is used to obtain a first identification code and a first identifier, and the first identification code is associated with the first identifier;
  • an obtaining module 602 configured to obtain the information of the first key corresponding to the first identifier
  • the updating module 603 is configured to update the first key according to the information of the first key.
  • the first key includes one of the following: the current MEK in the MEK linked list; the current MEK and SK; the current MEK and DK; the current MEK, SK and DK.
  • FIG. 7 is another schematic structural diagram of a key update apparatus provided by an embodiment of the present application.
  • an embodiment of the apparatus in this embodiment of the present application may include one or more central processing units 701 , a memory 702 , an input/output interface 703 , a wired or wireless network interface 704 , and a power supply 705 .
  • the memory 702 may be short-lived or persistent storage for storing program and scene recognition files. Still further, the central processing unit 701 may be configured to communicate with the memory 702 to execute a series of instruction operations in the memory 702 on the device.
  • the central processing unit 701 may execute the method steps executed by the first server and the second server in the foregoing embodiment shown in FIG. 2 , and details are not repeated here.
  • the division of specific functional modules in the central processing unit 701 may be similar to the division of unit modules such as the first processing module and the second processing module described in FIG. 5 , which will not be repeated here.
  • FIG. 8 is another schematic structural diagram of a target device provided by an embodiment of the present application.
  • an embodiment of the apparatus in this embodiment of the present application may include one or more central processing units 801, a memory 802, an input and output interface 803, a wired or wireless network interface 804, and a power supply 805.
  • the memory 802 may be short-lived or persistent storage for storing program and scene recognition files. Further, the central processing unit 801 may be configured to communicate with the memory 802 to execute a series of instruction operations in the memory 802 on the target device.
  • the central processing unit 801 may execute the method steps executed by the target device in the foregoing embodiment shown in FIG. 2 , and details are not repeated here.
  • the division of specific functional modules in the central processing unit 801 may be similar to the division of unit modules such as the receiving module, the acquiring module, and the updating module described in FIG. 6 , which is not repeated here.
  • Embodiments of the present application also relate to a computer storage medium, including computer-readable instructions, when the computer-readable instructions are executed, the first server, the second server, and the target in the embodiment shown in FIG. 2 or FIG. 3 are implemented. Method steps performed by the device.
  • Embodiments of the present application also relate to a computer program product containing instructions, which, when run on a computer, cause the computer to execute the program executed by the first server, the second server and the target device in the embodiment shown in FIG. 2 or FIG. 3 . method steps.
  • Embodiments of the present application also relate to a chip system, where the chip system includes a processor for invoking a computer program or computer instructions stored in a memory, so that the processor executes the first step in the embodiment shown in FIG. 2 or FIG. 3 .
  • the processor is coupled to the memory through an interface.
  • the chip system further includes a memory, and the memory stores computer programs or computer instructions.
  • the embodiment of the present application also relates to a processor, which is used to invoke a computer program or computer instruction stored in a memory, so that the processor executes the first server and the second server in the embodiment shown in FIG. 2 or FIG. 3 . and the method steps performed by the target device.
  • the processor mentioned in any of the above can be a general-purpose central processing unit, a microprocessor, an application-specific integrated circuit (ASIC), or one or more of the above An integrated circuit that executes the program of the key update method in the illustrated embodiment.
  • the memory mentioned in any one of the above can be read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM), and the like.
  • the disclosed system, apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Theoretical Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Bioethics (AREA)
  • Medical Informatics (AREA)
  • Power Engineering (AREA)
  • Lock And Its Accessories (AREA)

Abstract

本申请提供了一种密钥更新方法及其相关设备,可使得电子控制单元ECU的密钥能够抵挡攻击者的入侵,保持车辆的正常运行,从而保证乘客的生命安全。本申请的方法包括:向目标设备发送第一请求,第一请求用于获得第一识别码和第一识别符,第一识别码关联第一识别符;获取第一识别符对应的第一密钥的信息,第一密钥的信息用于指示目标设备更新第一密钥。

Description

一种密钥更新方法及其相关设备 技术领域
本申请涉及汽车技术领域,尤其涉及一种密钥更新方法及其相关设备。
背景技术
车辆中的电子控制单元(electronic control unit,ECU)是控制车辆的重要部件,车辆可包含多个ECU,不同的ECU负责实现不同的功能,例如动力、车门、转向等。若ECU遭受到攻击者的入侵,将影响车辆的正常运行。目前,ECU安全防护机制的核心是使用密钥来保证ECU的安全。
整车生产中心在制造车辆时,可向车辆中的各个ECU写入密钥,以保证ECU和车辆的安全。车辆售出后,车辆中的各个ECU会持续使用整车生产中心所提供的原始密钥,实现相应的功能。然而,随着时间的推移,ECU所使用的原始密钥,可能抵挡不住攻击者的入侵,导致车辆无法正常运行,进而威胁乘客的生命安全。
发明内容
本申请实施例提供了一种密钥更新方法及其相关设备,可使得ECU的密钥能够抵挡攻击者的入侵,保持车辆的正常运行,从而保证乘客的生命安全。
本申请实施例的第一方面提供一种密钥更新方法,该方法包括:向目标设备发送第一请求,所述第一请求用于获得第一识别码和第一识别符,所述第一识别码关联所述第一识别符;获取所述第一识别符对应的第一密钥的信息,所述第一密钥的信息用于指示所述目标设备更新所述第一密钥。
也就是说,当整车生产中心或售后服务中心需对车辆内的目标设备(即可以为车辆内的待更新密钥的ECU)进行密钥更新时,可先通过密钥更新装置向目标设备发送第一请求,以使得目标设备根据第一请求,获取目标设备所在车辆的车辆识别码(vehicle identification number,VIN)以及目标设备的唯一识别符(unique identifier,UID),相当于得到第一识别码和第一识别符,并将第一识别码和第一识别符发送至密钥更新装置。
密钥更新装置接收到目标设备发送的第一识别码和第一识别符后,则将第一识别码和第一识别符关联,即将目标设备与其所在车辆关联。接着,密钥更新装置可获取第一识别符对应的第一密钥,并基于第一密钥生成第一密钥的信息,第一密钥即为目标设备所需更新的密钥。
最后,密钥更新装置将第一密钥的信息发送至目标设备,以使得目标设备解析第一密钥的信息得到第一密钥,并完成第一密钥的更新。
从上述方法可以看出:密钥更新装置可先将第一请求发送至车辆内的目标设备,第一请求用于获得第一识别码和第一识别符,第一识别码和第一识别符关联。密钥更新装置接收来自目标设备的第一识别码和第一识别符后,则获取第一识别符对应的第一密钥的信息,并将第一密钥的信息发送至目标设备,以使得目标设备根据第一密钥的信息更新第一密钥。
可见,整车生产中心或售后服务中心可通过密钥更新装置,令目标设备将原始密钥更新为第一密钥,即整车生产中心或售后服务中心可不断更新目标设备的密钥,以增加目标设备的密钥的强度,使其能够抵挡攻击者的入侵,保持车辆的正常运行,从而保证乘客的生命安全。
在一种可能的实现方式中,该方法还包括:第一服务器获取第一校验值和第二校验值,第一校验值和第二校验值均基于第一密钥生成;在第一校验值与第二校验值相同的情况下,则确定第一密钥更新成功。前述实现方式中,密钥更新装置包含第一服务器和第二服务器。第一服务器可接收第二服务器发送的第一校验值。在目标设备完成密钥更新后,第一服务器还可接收目标设备发送的第二校验值。第一服务器得到第二校验值后,可比较第一校验值和第二校验值,若二者相同,则确定密钥更新成功,若二者不相同,则确定密钥更新失败。
在一种可能的实现方式中,第一校验值为第二服务器基于第一密钥进行计算得到的,第二校验值为目标设备更新第一密钥得到的。前述实现方式中,第二服务器在获取第一识别符对应的第一密钥后,可基于第一密钥生成第一密钥的信息以及第一校验值,并将第一密钥的信息以及第一校验值发送至第一服务器。进一步地,目标设备在根据第一密钥的信息更新第一密钥时,还可生成第二校验值,并把第二校验值发送至第一服务器。如此一来,第一服务器可利用第一校验值和第二校验值,判断密钥更新是否成功。
在一种可能的实现方式中,该方法还包括:第二服务器获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到的;在第一识别符存在于第二服务器中,且第一识别符与第一识别码关联的情况下,则基于第一密钥以及第一识别符生成第四校验值;在第三校验值与第四校验值相同的情况下,则保持第一识别符与第一识别码之间的关联关系。前述实现方式中,第二服务器若确定数据库中已存在第一识别符,且第一识别符与第一识别码关联,说明目标设备与其所在的车辆已关联,故可基于第一识别符对应的第一密钥以及第一识别符生成第四校验值,并将第四校验值与来自目标设备的第三校验值进行比较,若二者相同,说明第一识别符未被篡改,则保持第一识别符与第一识别码之间的关联关系,即保持目标设备与其所在的车辆之间的关联关系。
在一种可能的实现方式中,该方法还包括:第二服务器获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到的;在第一识别符存在于第二服务器中,且第一识别符与除第一识别码之外的其余识别码关联的情况下,则基于第一密钥以及第一识别符生成第四校验值;在第三校验值与第四校验值相同的情况下,则将第一识别符关联至第一识别码。前述实现方式中,第二服务器若确定数据库中已存在第一识别符,且第一识别符与除第一识别码之外的其余识别码关联,说明目标设备与其它车辆已关联,故可基于第一识别符对应的第一密钥以及第一识别符生成第四校验值,并将第四校验值与来自目标设备的第三校验值进行比较,若二者相同,说明第一识别符未被篡改,则将第一识别符与第一识别码关联,即将目标设备与其所在的车辆关联。
在一种可能的实现方式中,该方法还包括:第二服务器获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到;在第一识别符未存在于第二服务器中的情况 下,则基于预置的第二密钥以及第一识别符生成第五校验值,第二密钥与目标设备的类型对应;在第三校验值与第五校验值相同的情况下,则将第一识别符关联至第一识别码。前述实现方式中,第二服务器若确定数据库中未存在第一识别符,说明目标设备未与任何车辆已关联,故可基于预置的第二密钥以及第一识别符生成第五校验值,其中,第二密钥可为临时密钥(temporary key,TK)。然后,第二服务器将第五校验值与来自目标设备的第三校验值进行比较,若二者相同,说明第一识别符未被篡改,则将第一识别符与第一识别码关联,即将目标设备与其所在的车辆关联。
在一种可能的实现方式中,第一密钥包括以下其中一种:(1)主密钥(master ecu key,MEK)链表中的当前MEK;(2)当前MEK以及安全车载通信密钥(secure onboard communication key,SK);(3)当前MEK以及数字化设备认证密钥(device authentication key,DK);(4)当前MEK、SK以及DK。
在一种可能的实现方式中,基于第一密钥以及第一识别符生成第四校验值包括:基于MEK链表中的任意一个MEK以及第一识别符生成第四校验值。
本申请实施例的第二方面提供了一种密钥更新方法,该方法包括:
目标设备接收来自密钥更新装置的第一服务器的第一请求,第一请求用于获得第一识别码和第一识别符,第一识别码关联第一识别符。
然后,目标设备可根据第一请求,获取目标设备所在车辆的VIN以及目标设备的UID,相当于得到第一识别码和第一识别符,并将第一识别码和第一识别符发送至第一服务器。
最后,目标设备接收第一服务器发送的与第一识别符对应的第一密钥的信息,并根据第一密钥的信息更新第一密钥。
从上述方法可以看出:密钥更新装置可先将第一请求发送至车辆内的目标设备,第一请求用于获得第一识别码和第一识别符,第一识别码和第一识别符关联。密钥更新装置接收来自目标设备的第一识别码和第一识别符后,则获取第一识别符对应的第一密钥的信息,并将第一密钥的信息发送至目标设备,以使得目标设备根据第一密钥的信息更新第一密钥。可见,整车生产中心或售后服务中心可通过密钥更新装置,令目标设备将原始密钥更新为第一密钥,即整车生产中心或售后服务中心可不断更新目标设备的密钥,以增加目标设备的密钥的强度,使其能够抵挡攻击者的入侵,保持车辆的正常运行,从而保证乘客的生命安全。
在一种可能的实现方式中,第一密钥包括以下其中一种:(1)MEK链表中的当前MEK;(2)当前MEK以及SK;(3)当前MEK以及DK;(4)当前MEK、SK以及DK。
本申请实施例的第三方面提供了一种密钥更新装置,该装置包括:第一处理模块,用于向目标设备发送第一请求,第一请求用于获得第一识别码和第一识别符,第一识别码关联第一识别符;第二处理模块,用于获取第一识别符对应的第一密钥的信息,第一密钥的信息用于指示目标设备更新第一密钥。
从上述装置可以看出:密钥更新装置可先将第一请求发送至车辆内的目标设备,第一请求用于获得第一识别码和第一识别符,第一识别码和第一识别符关联。密钥更新装置接收来自目标设备的第一识别码和第一识别符后,则获取第一识别符对应的第一密钥的信息, 并将第一密钥的信息发送至目标设备,以使得目标设备根据第一密钥的信息更新第一密钥。可见,整车生产中心或售后服务中心可通过密钥更新装置,令目标设备将原始密钥更新为第一密钥,即整车生产中心或售后服务中心可不断更新目标设备的密钥,以增加目标设备的密钥的强度,使其能够抵挡攻击者的入侵,保持车辆的正常运行,从而保证乘客的生命安全。
在一种可能的实现方式中,第一处理模块,还用于:获取第一校验值和第二校验值,第一校验值和第二校验值均基于第一密钥生成;在第一校验值与第二校验值相同的情况下,则确定第一密钥更新成功。
在一种可能的实现方式中,第一校验值为第二处理模块基于第一密钥进行计算得到的,第二校验值为目标设备更新第一密钥得到的。
在一种可能的实现方式中,第二处理模块,还用于:获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到的;在第一识别符存在于第二服务器中,且第一识别符与第一识别码关联的情况下,则基于第一密钥以及第一识别符生成第四校验值;在第三校验值与第四校验值相同的情况下,则保持第一识别符与第一识别码之间的关联关系。
在一种可能的实现方式中,第二处理模块,还用于:获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到的;在第一识别符存在于第二服务器中,且第一识别符与除第一识别码之外的其余识别码关联的情况下,则基于第一密钥以及第一识别符生成第四校验值;在第三校验值与第四校验值相同的情况下,则将第一识别符关联至第一识别码。
在一种可能的实现方式中,第二处理模块,还用于:获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到;在第一识别符未存在于第二服务器中的情况下,则基于预置的第二密钥以及第一识别符生成第五校验值,第二密钥与目标设备的类型对应;在第三校验值与第五校验值相同的情况下,则将第一识别符关联至第一识别码。
在一种可能的实现方式中,第一密钥包括以下其中一种:MEK链表中的当前MEK;当前MEK以及SK;当前MEK以及DK;当前MEK、SK以及DK。
在一种可能的实现方式中,第二处理模块,用于基于MEK链表中的任意一个MEK以及第一识别符生成第四校验值。
本申请实施例的第四方面提供了一种目标设备,该设备包括:接收模块,用于接收来自第一服务器的第一请求,第一请求用于获得第一识别码和第一识别符,第一识别码关联第一识别符;获取模块,用于获取第一识别符对应的第一密钥的信息;更新模块,用于根据第一密钥的信息更新第一密钥。
在一种可能的实现方式中,第一密钥包括以下其中一种:MEK链表中的当前MEK;当前MEK以及SK;当前MEK以及DK;当前MEK、SK以及DK。
本申请实施例的第五方面提供了一种密钥更新装置,该密钥更新装置包括存储器和处理器;
存储器存储有代码,处理器被配置为执行代码,当代码被执行时,密钥更新装置执行如第一方面或第一方面中任意一种可能的实现方式所述的方法。
本申请实施例的第六方面提供了一种目标设备,该目标设备包括存储器和处理器;
存储器存储有代码,处理器被配置为执行代码,当代码被执行时,目标设备执行如第二方面或第二方面中任意一种可能的实现方式所述的方法。
本申请实施例的第七方面提供了一种密钥更新系统,该系统包含如第五方面所述的密钥更新装置和如第六方面所述的目标设备,其中,密钥更新装置和目标设备通信连接。
本申请实施例的第八方面提供了一种计算机存储介质,计算机存储介质存储有计算机程序,该程序由计算机执行时,使得计算机实施如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。
本申请实施例的第九方面提供了一种计算机程序产品,计算机程序产品存储有指令,指令在由计算机执行时,使得计算机实施如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。
本申请实施例的第十方面提供了一种芯片系统,该芯片系统包括处理器,用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。
在一种可能的实现方式中,该处理器通过接口与存储器耦合。
在一种可能的实现方式中,该芯片系统还包括存储器,该存储器中存储有计算机程序或计算机指令。
本申请实施例的第十一方面提供了一种处理器,该处理器用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。
本申请实施例中,密钥更新装置可先将第一请求发送至车辆内的目标设备,第一请求用于获得第一识别码和第一识别符,第一识别码和第一识别符关联。密钥更新装置接收来自目标设备的第一识别码和第一识别符后,则获取第一识别符对应的第一密钥的信息,并将第一密钥的信息发送至目标设备,以使得目标设备根据第一密钥的信息更新第一密钥。可见,整车生产中心或售后服务中心可通过密钥更新装置,令目标设备将原始密钥更新为第一密钥,即整车生产中心或售后服务中心可不断更新目标设备的密钥,以增加目标设备的密钥的强度,使其能够抵挡攻击者的入侵,保持车辆的正常运行,从而保证乘客的生命安全。
附图说明
图1为本申请实施例提供的密钥更新系统的一个结构示意图;
图2为本申请实施例提供的密钥更新方法的一个流程示意图;
图3为本申请实施例提供的密钥更新方法的另一流程示意图;
图4为本申请实施例提供的第二服务器将UID关联至VIN的一个流程示意图;
图5为本申请实施例提供的密钥更新装置的一个结构示意图;
图6为本申请实施例提供的目标设备的一个结构示意图;
图7为本申请实施例提供的密钥更新装置的另一结构示意图;
图8为本申请实施例提供的目标设备的另一结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行详细描述。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。在本申请中出现的对步骤进行的命名或者编号,并不意味着必须按照命名或者编号所指示的时间/逻辑先后顺序执行方法流程中的步骤,已经命名或者编号的流程步骤可以根据要实现的技术目的变更执行次序,只要能达到相同或者相类似的技术效果即可。本申请中所出现的模块的划分,是一种逻辑上的划分,实际应用中实现时可以有另外的划分方式,例如多个模块可以结合成或集成在另一个系统中,或一些特征可以忽略,或不执行。另外,本申请中的连接、耦合或通信,可以是关联对象之间的直接连接,耦合或通信,或者是通过其他装置的间接连接、耦合或通信,此外,对象之间的连接、耦合或通信可以是电性或其他类似的形式,本申请中均不作限定。独立说明的模块或子模块可以是物理上分离的,也可以不是物理上的分离;可以是软件实现的,也可以是硬件实现的,且可以部分模块或子模块通过软件实现,由处理器调用该软件,实现这部分模块或子模块的功能,且其它部分模板或子模块通过硬件实现,例如通过硬件电路实现。此外,可以根据实际的需要选择其中的部分或全部模块来实现本申请方案的目的。
“多个”是指两个或两个以上。“和/或”描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。
随着技术的发展,汽车已经成为人们日常生活中不可或缺的交通工具。车辆中的电子控制单元(electronic control unit,ECU)是控制车辆的重要部件,车辆可包含多个ECU,不同的ECU负责实现不同的功能,例如动力、车门、转向等。若ECU遭受到攻击者的入侵,将影响车辆的正常运行。目前,ECU安全防护机制的核心是使用密钥来保证ECU的安全。
整车生产中心在制造车辆时,可向车辆中的各个ECU写入密钥,以保证ECU和车辆的安全。车辆售出后,车辆中的各个ECU会持续使用整车生产中心所提供的原始密钥,实现相应的功能。然而,随着时间的推移,ECU所使用的原始密钥,可能抵挡不住攻击者的入侵,导致车辆无法正常运行,进而威胁乘客的生命安全。
为了解决上述问题,本申请实施例提供了一种密钥更新方法,该方法可应用于密钥更新系统中。图1为本申请实施例提供的密钥更新系统的一个结构示意图,如图1所示,该系统包括:部署于车辆内的目标设备和部署于后台(或称为车辆外)的密钥更新装置,目标设备和密钥更新装置通信连接。其中,密钥更新装置可包含第一服务器和第二服务器,第一服务器和第二服务器可部署于同一物理机中,也可部署于不同物理机中。第二服务器可通过第一服务器接入目标设备,从而使得第二服务器和目标部件之间可实现信息交互。
下文将对目标设备、第一服务器和第二服务器进行简单的介绍:
在车辆内,目标设备通常指待更新密钥的ECU,该ECU可以为新添加至车辆中的ECU,也可以是已设置于车辆中的旧ECU等等,此处不做限制。
在车辆外,后台通常指整车生成中心,或,车辆的售后服务中心和整车生产中心的组合。无论后台为前述哪一种情况,第一服务器均可通过诊断仪的形式呈现,即第二服务器可通过诊断仪接入待更新密钥的ECU。应理解,前述例子仅以第一服务器为诊断仪进行示意性说明,第二服务器还可通过其他工具接入ECU,并不对本申请实施例中第一服务器的类型造成限制。
当后台为整车生产中心时,第二服务器可包括密钥管理系统(key management system,KMS)服务器和原始设备制造商(original equipment manufacturer,OEM)服务器,二者之间可实现通信。当后台为售后服务中心和整车生产中心的组合时,第二服务器可包括位于售后服务中心侧的经销商(dealer)服务器和位于整车生产中心侧的KMS服务器,二者之间可实现通信。需要说明的是,经销商服务器、KMS服务器和OEM服务器可以为不同的物理机,也可以是部署于同一台物理机(或不同物理机)上的云实例,例如,虚拟机(virtual machine,VM)和容器(docker)等等,此处不做限制。
KMS服务器用于生成、存储以及管理各个ECU的密钥,例如,各个ECU的MEK,TK,SK以及DK等等。诊断仪可通过OEM服务器(或经销商服务器),向KMS服务器请求密钥。KMS可通过OEM服务器(或经销商服务器)向诊断仪下发密钥,以使得诊断仪将密钥写入ECU,并在诊断仪处验证密钥更新是否成功。
为了进一步了解上述过程,下文结合图2对上述过程做具体介绍。图2为本申请实施例提供的密钥更新方法的一个流程示意图,该方法包括:
201、密钥更新装置向目标设备发送第一请求,第一请求用于获得第一识别码和第一识别符,第一识别码关联第一识别符。
当后台需对车辆内的目标设备进行密钥更新时(例如,向车辆中的新ECU写入密钥,或对车辆中某个旧ECU的密钥进行更新等),可先通过密钥更新装置向目标设备发送第一请求,以使得目标设备根据第一请求,获取目标设备所在车辆的VIN以及目标设备的UID,相当于得到第一识别码和第一识别符,并将第一识别码和第一识别符等信息发送至密钥更新装置。
密钥更新装置接收到目标设备发送的第一识别码和第一识别符后,则将第一识别码和第一识别符关联(也可以理解为,将第一识别码和第一识别符绑定),即将目标设备与其所在车辆关联。接着,密钥更新装置可获取第一识别符对应的第一密钥,并基于第一密钥生成第一密钥的信息,第一密钥即为目标设备所需更新的密钥,目标设备所需更新的密钥可以有多种,例如,MEK、SK和DK等等。
202、密钥更新装置获取第一识别符对应的第一密钥的信息,第一密钥的信息用于指示目标设备更新第一密钥。
得到第一密钥的信息后,密钥更新装置将第一密钥的信息发送至目标设备,以使得目标设备解析第一密钥的信息得到第一密钥,并将原先存储的密钥更新为第一密钥。
本申请实施例中,密钥更新装置可先将第一请求发送至车辆内的目标设备,第一请求用于获得第一识别码和第一识别符,第一识别码和第一识别符关联。密钥更新装置接收来自目标设备的第一识别码和第一识别符后,则获取第一识别符对应的第一密钥的信息,并 将第一密钥的信息发送至目标设备,以使得目标设备根据第一密钥的信息更新第一密钥。可见,整车生产中心或售后服务中心可通过密钥更新装置,令目标设备将原始密钥更新为第一密钥,即整车生产中心或售后服务中心可不断更新目标设备的密钥,以增加目标设备的密钥的强度,使其能够抵挡攻击者的入侵,保持车辆的正常运行,从而保证乘客的生命安全。
为了进一步理解本申请实施例提供的密钥更新方法,下文将结合图3对本申请实施例提供的密钥更新方法作进一步的介绍。图3为本申请实施例提供的密钥更新方法的另一流程示意图,如图3所示,该方法包括:
301、第一服务器向目标设备发送第一请求,第一请求用于获取第一识别码和第一识别符。
当后台需要对车辆的目标部件进行密钥更新时(例如,向车辆中的新ECU写入密钥,或对车辆中某个旧ECU的密钥进行更新等),可通过第一服务器向目标设备发送第一请求,该第一请求用于指示目标设备发送目标部件所在车辆的VIN(即前述的第一识别码),以及目标设备的UID(即前述的第一识别符)。一般地,第一服务器和目标设备之间可基于统一诊断服务(unified diagnostic services,UDS)协议传输第一请求,即第一请求的格式符合UDS协议的要求。
值得注意的是,第一服务器预置有目标设备的类型等信息,例如,当需要对ECU1、ECU2和ECU3进行密钥更新时,第一服务器则预置有ECU1的类型、ECU2的类型和ECU3的类型等信息。ECU的类型等信息可由第二服务器预置于第一服务器中,也可人工预置于第一服务器中,此处不做限制。由此可见,在第一服务器向目标设备发送第一请求时,第一服务器已确定目标设备的类型。
302、第一服务器接收来自目标设备的第一识别码和第一识别符。
示例性的,目标设备接收到第一请求后,可基于该第一请求,直接读取其所在车辆的VIN。与此同时,目标设备还可调用某通信协议中的函数CMD_RND,利用CMD_RND生成一个随机数,记为CHALLENGE(挑战值)。接着,目标设备还可调用函数CMD_GET_ID,以CHALLENGE作为CMD_GET_ID的输入,得到目标设备的UID、目标设备的状态寄存器(status register,SREG)以及消息认证码(message authentication code,MAC)1(即前述的第三校验值)等信息。
得到目标设备所在车辆的VIN、目标设备的UID、CHALLENGE、SREG以及MAC1等信息后,目标设备可基于UDS协议,将目标设备所在车辆的VIN、目标设备的UID、SREG以及MAC1等信息发送至第一服务器。
303、第一服务器将包含第一识别码和第一识别符的第二请求发送至第二服务器。
第一服务器接收到目标设备所在车辆的VIN、目标设备的UID、CHALLENGE、SREG以及MAC1等信息后,相当于确定了目标设备的具体信息,故可向第二服务器请求目标设备的密钥。具体地,第一服务器可生成包含目标设备的类型、目标设备所在车辆的VIN、目标设备的UID、CHALLENGE、SREG以及MAC1等信息的第二请求,并将该第二请求发送至服务器。
304、第二服务器将第一识别符关联至第一识别码,并获取第一识别符对应的第一密钥。
第二服务器接收到第二请求后,可解析第二请求,得到目标设备的类型、目标设备所在车辆的VIN、目标设备的UID、CHALLENGE、SREG以及MAC1等信息。第二服务器具有数据库,该数据库记录有设备与车辆之间的关联关系,即设备的UID与车辆的VIN之间的关联关系。为了便于理解前述关联关系,下文结合表1、表2对数据库记录的设备与车辆之间的关联关系进行示意性介绍,如表1和表2所示:
表1
车辆1 ECU1 ECU2 ECUn
VIN1 UID1 UID2 UIDn
表2
车辆2 ECUn+1 ECUn+2 ECUm
VIN2 UIDn+1 UIDn+2 UIDm
基于表1和表2可知,第二服务器的数据库中记录有车辆1和车辆2的信息,其中,车辆1与ECU1、…、ECUn关联,车辆2与ECUn+1、…、ECUm关联,即VIN1(车辆1的VIN)与UID1(ECU1的UID)、…、UIDn(ECUn的UID)关联,VIN2(车辆2的VIN)与UIDn+1(ECUn+1的UID)、…、UIDm(ECUm的UID)关联。
因此,第二服务器可遍历数据库,从而判断数据库中是否存在目标设备的UID,若确定已存在该UID,说明该UID已关联至某一个VIN,即目标设备已关联至某一车辆,若确定未存在目标设备的UID,说明该UID未关联至任意一个VIN,即目标设备未关联至任意车辆。无论数据库中是否存在该UID,第二服务器均会将该UID关联至目标设备所在车辆的VIN,从而完成目标设备与其所在车辆之间的关联。
为了进一步理解上述过程,下文结合图3对前述过程进行介绍。图4为本申请实施例提供的第二服务器将UID关联至VIN的一个流程示意图,如图4所示,第二服务器先遍历数据库,判断数据库中是否存在目标设备的UID,可能出现以下几种情况:
(1)第二服务器若确定已存在该UID,则判断该UID是否与目标设备所在车辆的VIN关联。
(1.1)第二服务器若确定该UID已关联至目标设备所在车辆的VIN,说明目标设备与其所在车辆已关联,故第二服务器可对该UID进行校验,以确定该UID在传输过程中是否被篡改。具体地,第二服务器可先获取该UID对应的MEK链表,MEK链表包含多个MEK,即当前MEK(也可以理解为最新的MEK,即准备写入目标设备的MEK),位于当前MEK之前的第一个MEK(也可理解为旧的MEK),位于当前MEK之前的第二个MEK等等。那么,第二服务器以MEK链表中的任意一个MEK为加密密钥,通过基于密文的消息认证码(cipher-based message authentication code,CMAC)算法对该UID进行计算,得到MAC2(即前述的第四校验值),MAC2的计算公式为:
MAC MEK=CMAC MEK(CHALLENGE丨UID丨SREG)
接着,“丨”表示将若干个信息串联得到新的信息,第二服务器可判断MAC2与MAC1是否相同,若相同,说明该UID未被篡改,则维持该UID与目标设备所在车辆的VIN之间的关联关系,相当于维持目标设备与其所在车辆之间的关联关系,若不相同,说明该UID被篡改,则报错。
为了进一步理解上述计算MAC2的过程以及校验MAC2的过程,下文结合一个具体例子进行示意性说明。例如,第二服务器可在MEK链表中,先以当前MEK为加密密钥,通过CMAC算法对该UID进行计算,得到MAC2。然后,第二服务器可比较MAC2与MAC1,若二者相同,则确定该UID未被篡改,若二者不相同,则获取位于当前MEK之前的第一个MEK,以该MEK为加密密钥,通过CMAC算法对该UID进行计算,得到MAC2,并比较MAC2与MAC1,直至MAC2与MAC1相同为止。若是MEK链表中,基于各个MEK计算的MAC2均与MAC1不相同,则确定该UID被篡改,并报错。
(1.2)第二服务器若确定该UID已关联至除目标设备所在车辆的VIN之外的其余VIN,说明目标设备与其它车辆已关联,故第二服务器解除该UID与其余VIN之间的关联关系,并对该UID进行校验,以确定该UID在传输过程中是否被篡改。具体地,第二服务器可先获取该UID对应的MEK链表,MEK链表包含多个MEK,即当前MEK,位于当前MEK之前的第一个MEK,位于当前MEK之前的第二个MEK等等。那么,第二服务器以MEK链表中的任意一个MEK为加密密钥,通过CMAC算法对该UID进行计算,得到MAC2。接着,第二服务器可判断MAC2与MAC1是否相同,若相同,说明该UID未被篡改,则重新将该UID关联至目标设备所在车辆的VIN,相当于目标设备关联至其所在车辆,若不相同,说明该UID被篡改,则报错。
上述计算MAC2的过程以及校验MAC2的过程,可参考(1.1)中所示例子的相关说明部分,此处不再赘述。
(2)第二服务器若确定未存在该UID,说明目标设备未曾与任何车辆关联,则对该UID进行校验,以确定该UID在传输过程中是否被篡改。具体地,第二服务器可先基于目标设备的类型,获取相应的TK(即前述的第二密钥)。然后,以TK作为加密密钥,通过CMAC算法对该UID进行计算,得到MAC3(即前述的第五校验值),MAC3的计算公式为:
MAC TK=CMAC TK(CHALLENGE丨UID丨SREG)
接着,第二服务器可判断MAC3与MAC1是否相同,若相同,说明该UID未被篡改,则将该UID关联至目标设备所在车辆的VIN,相当于目标设备关联至其所在车辆,若不相同,说明该UID被篡改,则报错。
第二服务器将目标设备的UID关联至目标设备所在车辆的VIN后,可从数据库中获取目标设备所需写入的密钥(即前述的第一密钥)。下文结合表3对前述过程进行示意性介绍,如表3所示:
表3
Figure PCTCN2021091653-appb-000001
基于表3可知,第二服务器的数据库中记录有UID1对应的Key ID,ID,C ID(计数器值)以及AuthID。其中,当ID不同时,相应的Key ID为不同的密钥。例如,当ID=1时,Key ID从MEK链表中取值,即Key ID=MEK链表中的当前MEK。当ID=4时,Key ID=SK1(也可理解为最新的SK)。当ID=5时,Key ID=DK1(也可以理解为最新的DK)。此外,无论ID为何种取值,AuthID均为1。C 1、C 4以及C 5为计数器的不同取值,可用于防止重放攻击。
可见,第二服务器将目标设备的UID关联至目标设备所在车辆的VIN后,可获取该UID对应的Key ID、ID、C ID以及AuthID。在实际应用中,目标设备所需写入的密钥可以为多种组合,例如,设某个ECU所需写入的密钥为MEK,第二服务器则只会从数据库中获取ID=1,AuthID=1,C 1以及Key ID=当前MEK。又如,设某个ECU所需写入的密钥为MEK以及SK,第二服务器则会从数据库中获取两组信息,其中一组为ID=1,AuthID=1,C 1以及Key ID=当前MEK,另一组为ID=4,AuthID=1,C 4以及Key ID=SK1。再如,设某个ECU所需写入的密钥为MEK以及DK,第二服务器则会从数据库中获取两组信息,其中一组为ID=1,AuthID=1,C 1以及Key ID=当前MEK,另一组为ID=5,AuthID=1,C 5以及Key ID=SK1。还如,设某个ECU所需写入的密钥为MEK、SK以及DK,第二服务器则会从数据库中获取三组信息,其中第一组为ID=1,AuthID=1,C 1以及Key ID=当前MEK,第二组为ID=4,AuthID=1,C 4以及Key ID=SK1,第三组为ID=5,AuthID=1,C 5以及Key ID=SK1等等。
应理解,对于前述例子(1)而言,由于数据库中存在目标设备的UID,故可直接获取该UID对应的Key ID、ID、C ID以及AuthID。对于前述例子(2)而言,由于数据库中不存在该UID,数据库中也就不存在该UID对应的Key ID、ID、C ID以及AuthID。因此,在出现例子(2)时,第二服务器可通过数据库生成该UID对应的Key ID、ID、C ID以及AuthID,从而得到这部分信息。
还应理解,前述写入目标设备的密钥包含MEK、SK和DK,并不对本实施例对目标设备写入的密钥类型构成限制,还可以是除MEK、SK和DK之外的其它密钥等等。
还应理解,本实施例可通过CMAC算法计算校验值,也可通过其他加密算法计算校验值,并不对本实施例中的加密算法构成限制。
305、第二服务器将第一密钥的信息发送至第一服务器。
第二服务器得到该UID对应的Key ID、ID、C ID以及AuthID后,可基于这部分信息生成M1、M2、M3、M4和M5(M1、M2和M3为前述的第一密钥的信息,M5为前述的第一校验值)。
为了便于说明,以目标设备所需写入的密钥仅为MEK进行示意性说明,故第二服务 器可从数据库中得到一组信息,即ID=1,AuthID=1,C 1以及Key ID=当前MEK。基于这部分信息,第二服务器可先利用国密SM2算法的密钥派生函数KDF生成K1、K2、K3和K4,其中,K1和K2基于KeyAuthID生成,K3和K4基于KeyID生成,K1至K4的计算公式如下:
K1=KDF(KEY AuthID,KEY_UPDATE_ENC_C)
K2=KDF(KEY AuthID,KEY_UPDATE_MAC_C)
K3=KDF(KEY ID,KEY_UPDATE_ENC_C)
K4=KDF(KEY ID,KEY_UPDATE_MAC_C)
上式中,由于AuthID=1,基于表3可知,KEY AuthID可从MEK链表中取值。MEK链表中有多个MEK,对于前述例子(1.1)和例子(1.2),若确定基于某个MEK生成的MAC2与MAC1相同,KEY AuthID则为该MEK。对于前述例子(2),KEY AuthID为MEK链表中的当前MEK(由于MEK链表是新生成的,MEK链表中仅包含一个最新的MEK,即当前MEK)。KEY_UPDATE_ENC_C和KEY_UPDATE_MAC_C为预置的常量。
得到K1至K4后,可基于K1至K4生成M1至M5。M1至M5的计算公式如下:
M1=UID|ID|AuthID
M2=ENC CBC,K1,IV=0(C ID|"0...0" 5|"0...0" 95|KEY ID)
M3=CMAC K2(M1|M2)
M4*=ENC ECB,K3(C ID)
M4=UID|ID|AuthID|M4*
M5=CMAC K4(M4)
上式中,M1通过UID、ID以及AuthID串联而成。M2是将C ID、F ID(即上式中的95个0)以及KEY ID串联后,以K1为加密密钥,通过密文分组链接(cipher block chaining,CBC)模式对串联后的值加密得到。M3是将M1和M2串联后,以K2为加密密钥,通过CMAC算法对串联后的值进行计算得到。M4*是以K3为加密密钥,经过电码本(Electronic Code Book,ECB)模式对C ID加密得到。M4是将UID、ID、AuthID以及M4*串联而成。M5是以K4为加密密钥,通过CMAC算法对M4进行计算得到。
如此一来,第二服务器可得到一组M1至M5。应理解,若目标设备所需写入的密钥还包含SK,第二服务器还可从数据库获取SK对应的信息,并基于这部分信息生成另一组M1至M5(生成过程可参考前述相关说明,此处不再赘述)。同样地,若目标设备所需写入的密钥还包含DK,第二服务器还可从数据库获取DK对应的信息,并基于这部分信息生成另一组M1至M5等等。可见,若目标设备所需写入的密钥进包含MEK,第二服务器可得到一组M1至M5,若目标设备所需写入的密钥进包含MEK和SK(也可以是MEK和DK),第二服务器可得到两组M1至M5,若目标设备所需写入的密钥进包含MEK、SK和DK,第二服务器可得到三组M1至M5等等,后续不再赘述。
第二服务器得到M1至M5后,可将M1至M5发送至第一服务器。
306、第一服务器将第一密钥的信息发送至目标设备。
第一服务器得到M1至M5后,可保留M4和M5,并将M1至M3发送至目标设备。
应理解,本实施例仅以第一服务器和第二服务器部署于不同的物理机中进行示意性说明,相应地,第二服务器可通过第一服务器向目标设备发送M1至M3也是示意性说明,并不对本实施例中密钥更新装置向目标设备发送M1至M3的方式构成限制。例如,当第一服务器和第二服务器部署于同一物理机时(相当于第一服务器和第二服务器为同一台物理机),第二服务器可直接向目标设备发送M1至M3。
307、目标设备根据第一密钥的信息更新第一密钥。
目标设备接收到M1至M3后,可调用某通信协议中的函数CMD_LOAD_KEY,利用该函数,目标设备可完成以下功能:(1)解析M1和M2,从而得到ID和KEY ID等信息。(2)利用M3校验M1和M2中的内容是否被篡改,若确定未被篡改,可根据ID更新相应的KEY ID,从而完成密钥更新。(3)完成密钥更新后,计算M5’(即前述的第二校验值),返回至第一服务器,以使得第一服务器根据M5’验证密钥更新是否成功。
为了进一步理解上述过程,下文结合表4对上述过程作进一步的介绍。在AUTOSAR协议中,密钥在ECU中的存储地址如表4所示:
表4
密钥名字 存储地址
secret key 0x0
master ecu key 0x1
boot mac key 0x2
boot mac 0x3
key1 0x4
key2 0x5
key3 0x6
key4 0x7
key5 0x8
key6 0x9
key7 0xa
key8 0xb
key9 0xc
key10 0xd
ram key 0xe
在表4中,存储地址0x1与ID=1对应,存储地址0x4与ID=4对应,存储地址0x5与ID=5对应。那么,在ECU的存储器中,与存储地址0x1对应的存储区域,则用于存储MEK。与存储地址0x4对应的存储区域,则用于存储SK。与存储地址0x5对应的存储区域,则用于存储DK。
由此可见,目标设备得到ID和KEY ID后,可根据ID的值,将KEY ID写入相应的存储区域,从而完成密钥更新。例如,设目标设备获取到ID=1,KEY ID=当前MEK,ID=4, KEY ID=SK1等信息,相当于ECU获取到了最新的MEK和SK,故ECU根据ID=1和ID=4,可分别将当前MEK和SK1写入相应的存储区域,完成密钥的写入或更新,即完成密钥更新。
完成密钥更新后,目标设备还可生成M5’(其生成过程可参考M5的生成过程,此处不再赘述),并将M5’返回至第一服务器。第一服务器比较M5’与M5,若二者相同,则确定密钥更新成功,若二者不相同,则确定密钥更新失败,并报错。
本申请实施例中,密钥更新装置可先将第一请求发送至车辆内的目标设备,第一请求用于获得第一识别码和第一识别符,第一识别码和第一识别符关联。密钥更新装置接收来自目标设备的第一识别码和第一识别符后,则获取第一识别符对应的第一密钥的信息,并将第一密钥的信息发送至目标设备,以使得目标设备根据第一密钥的信息更新第一密钥。可见,整车生产中心或售后服务中心可通过密钥更新装置,令目标设备将原始密钥更新为第一密钥,即整车生产中心或售后服务中心可不断更新目标设备的密钥,以增加目标设备的密钥的强度,使其能够抵挡攻击者的入侵,保持车辆的正常运行,从而保证乘客的生命安全。
更进一步地,本申请实施例可以使得售后服务中心和整车生产中心,在各种场景下(例如,向车辆中的新ECU写入密钥,或对车辆中旧ECU的密钥进行更新等场景),以统一、简单的标准化流程向目标设备更新密钥,从而确保目标设备的安全。
更进一步地,MEK、SK、DK等密钥只有密钥更新装置和目标设备两个实体掌握,在密钥更新装置端加密保护,在目标设备端解密更新,实现端到端的密钥安全保护。
更进一步地,目标设备完成密钥更新后,由第一服务器(例如,诊断仪)验证密钥更新是否成功,此时,第一服务器与第二服务器之间可断开连接,即第一服务器可离线完成的密钥更新的验证,降低对第二服务器的依赖,提高了整个流程的稳定性和可靠性。
以上是对本申请实施例提供的密钥更新方法所进行的详细说明,以下将对本申请实施例提供的密钥更新装置进行介绍。图5为本申请实施例提供的密钥更新装置的一个结构示意图,如图5所示,该装置包括:
第一处理模块501,用于向目标设备发送第一请求,第一请求用于获得第一识别码和第一识别符,第一识别码关联第一识别符。其中,第一处理模块501可以为前述的第一服务器。
第二处理模块502,用于获取第一识别符对应的第一密钥的信息,第一密钥的信息用于指示目标设备更新第一密钥。其中,第二处理模块502可以为前述的第二服务器。
在一种可能的实现方式中,第一处理模块501,还用于:获取第一校验值和第二校验值,第一校验值和第二校验值均基于第一密钥生成;在第一校验值与第二校验值相同的情况下,则确定第一密钥更新成功。
在一种可能的实现方式中,第一校验值为第二处理模块502基于第一密钥进行计算得到的,第二校验值为目标设备更新第一密钥得到的。
在一种可能的实现方式中,第二处理模块502,还用于:获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到的;在第一识别符存在于第二服务器中,且 第一识别符与第一识别码关联的情况下,则基于第一密钥以及第一识别符生成第四校验值;在第三校验值与第四校验值相同的情况下,则保持第一识别符与第一识别码之间的关联关系。
在一种可能的实现方式中,第二处理模块502,还用于:获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到的;在第一识别符存在于第二服务器中,且第一识别符与除第一识别码之外的其余识别码关联的情况下,则基于第一密钥以及第一识别符生成第四校验值;在第三校验值与第四校验值相同的情况下,则将第一识别符关联至第一识别码。
在一种可能的实现方式中,第二处理模块502,还用于:获取第三校验值,第三校验值为目标设备在获取第一识别符的过程中得到;在第一识别符未存在于第二服务器中的情况下,则基于预置的第二密钥以及第一识别符生成第五校验值,第二密钥与目标设备的类型对应;在第三校验值与第五校验值相同的情况下,则将第一识别符关联至第一识别码。
在一种可能的实现方式中,第一密钥包括以下其中一种:MEK链表中的当前MEK;当前MEK以及SK;当前MEK以及DK;当前MEK、SK以及DK。
在一种可能的实现方式中,第二处理模块502,用于基于MEK链表中的任意一个MEK以及第一识别符生成第四校验值。
图6为本申请实施例提供的目标设备的一个结构示意图,如图6所示,该设备包括:
接收模块601,用于接收来自第一服务器的第一请求,第一请求用于获得第一识别码和第一识别符,第一识别码关联第一识别符;
获取模块602,用于获取第一识别符对应的第一密钥的信息;
更新模块603,用于根据第一密钥的信息更新第一密钥。
在一种可能的实现方式中,第一密钥包括以下其中一种:MEK链表中的当前MEK;当前MEK以及SK;当前MEK以及DK;当前MEK、SK以及DK。
需要说明的是,上述装置各模块/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其带来的技术效果与本申请方法实施例相同,具体内容可参考本申请实施例前述所示的方法实施例中的叙述,此处不再赘述。
图7为本申请实施例提供的密钥更新装置的另一结构示意图。如图7所示,本申请实施例中装置一个实施例可以包括一个或一个以上中央处理器701,存储器702,输入输出接口703,有线或无线网络接口704,电源705。
存储器702可以是短暂存储或持久存储,用于存储程序和场景识别文件。更进一步地,中央处理器701可以配置为与存储器702通信,在该装置上执行存储器702中的一系列指令操作。
本实施例中,中央处理器701可以执行前述图2所示实施例中第一服务器和第二服务器所执行的方法步骤,具体此处不再赘述。
本实施例中,中央处理器701中的具体功能模块划分可以与前述图5中所描述的第一处理模块和第二处理模块等单元模块的划分方式类似,此处不再赘述。
图8为本申请实施例提供的目标设备的另一结构示意图。如图8所示,本申请实施例 中装置一个实施例可以包括一个或一个以上中央处理器801,存储器802,输入输出接口803,有线或无线网络接口804,电源805。
存储器802可以是短暂存储或持久存储,用于存储程序和场景识别文件。更进一步地,中央处理器801可以配置为与存储器802通信,在该目标设备上执行存储器802中的一系列指令操作。
本实施例中,中央处理器801可以执行前述图2所示实施例中目标设备所执行的方法步骤,具体此处不再赘述。
本实施例中,中央处理器801中的具体功能模块划分可以与前述图6中所描述的接收模块、获取模块和更新模块等单元模块的划分方式类似,此处不再赘述。
本申请实施例还涉及一种计算机存储介质,包括计算机可读指令,当所述计算机可读指令被执行时,实现如图2或图3所示实施例中第一服务器、第二服务器和目标设备所执行的方法步骤。
本申请实施例还涉及一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行如图2或图3所示实施例中第一服务器、第二服务器和目标设备所执行的方法步骤。
本申请实施例还涉及一种芯片系统,该芯片系统包括处理器,用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行如图2或图3所示实施例中第一服务器、第二服务器和目标设备所执行的方法步骤。
在一种可能的实现方式中,该处理器通过接口与存储器耦合。
在一种可能的实现方式中,该芯片系统还包括存储器,该存储器中存储有计算机程序或计算机指令。
本申请实施例还涉及一种处理器,该处理器用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行如图2或图3所示实施例中第一服务器、第二服务器和目标设备所执行的方法步骤。
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个用于控制上述图2所示的实施例中的密钥更新方法的程序执行的集成电路。上述任一处提到的存储器可以为只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。

Claims (24)

  1. 一种密钥更新方法,其特征在于,所述方法包括:
    向目标设备发送第一请求,所述第一请求用于获得第一识别码和第一识别符,所述第一识别码关联所述第一识别符;
    获取所述第一识别符对应的第一密钥的信息,所述第一密钥的信息用于指示所述目标设备更新所述第一密钥。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    第一服务器获取第一校验值和第二校验值,所述第一校验值和所述第二校验值均基于所述第一密钥生成;
    在所述第一校验值与所述第二校验值相同的情况下,则确定所述第一密钥更新成功。
  3. 根据权利要求2所述的方法,其特征在于,所述第一校验值为第二服务器基于所述第一密钥进行计算得到的,所述第二校验值为所述目标设备更新所述第一密钥得到的。
  4. 根据权利要求1至3任意一项所述的方法,其特征在于,所述方法还包括:
    第二服务器获取第三校验值,所述第三校验值为所述目标设备在获取所述第一识别符的过程中得到的;
    在所述第一识别符存在于所述第二服务器中,且所述第一识别符与所述第一识别码关联的情况下,则基于所述第一密钥以及所述第一识别符生成第四校验值;
    在所述第三校验值与所述第四校验值相同的情况下,则保持所述第一识别符与所述第一识别码之间的关联关系。
  5. 根据权利要求1至3任意一项所述的方法,其特征在于,所述方法还包括:
    第二服务器获取第三校验值,所述第三校验值为所述目标设备在获取所述第一识别符的过程中得到的;
    在所述第一识别符存在于所述第二服务器中,且所述第一识别符与除所述第一识别码之外的其余识别码关联的情况下,则基于所述第一密钥以及所述第一识别符生成第四校验值;
    在所述第三校验值与所述第四校验值相同的情况下,则将所述第一识别符关联至所述第一识别码。
  6. 根据权利要求1至3任意一项所述的方法,其特征在于,所述方法还包括:
    第二服务器获取第三校验值,所述第三校验值为所述目标设备在获取所述第一识别符的过程中得到;
    在所述第一识别符未存在于所述第二服务器中的情况下,则基于预置的第二密钥以及所述第一识别符生成第五校验值,所述第二密钥与所述目标设备的类型对应;
    在所述第三校验值与所述第五校验值相同的情况下,则将所述第一识别符关联至所述第一识别码。
  7. 根据权利要求4至6任意一项所述的方法,其特征在于,所述第一密钥包括以下其中一种:
    主密钥MEK链表中的当前MEK;
    所述当前MEK以及安全车载通信密钥SK;
    所述当前MEK以及数字化设备认证密钥DK;
    所述当前MEK、所述SK以及所述DK。
  8. 根据权利要求7所述的方法,其特征在于,所述基于所述第一密钥以及所述第一识别符生成第四校验值包括:
    基于所述MEK链表中的任意一个MEK以及所述第一识别符生成第四校验值。
  9. 一种密钥更新方法,其特征在于,所述方法包括:
    接收来自第一服务器的第一请求,所述第一请求用于获得第一识别码和第一识别符,所述第一识别码关联所述第一识别符;
    获取所述第一识别符对应的第一密钥的信息;
    根据所述第一密钥的信息更新所述第一密钥。
  10. 根据权利要求9所述的方法,其特征在于,所述第一密钥包括以下其中一种:
    MEK链表中的当前MEK;
    所述当前MEK以及SK;
    所述当前MEK以及DK;
    所述当前MEK、所述SK以及所述DK。
  11. 一种密钥更新装置,其特征在于,所述装置包括:
    第一处理模块,用于向目标设备发送第一请求,所述第一请求用于获得第一识别码和第一识别符,所述第一识别码关联所述第一识别符;
    第二处理模块,用于获取所述第一识别符对应的第一密钥的信息,所述第一密钥的信息用于指示所述目标设备更新所述第一密钥。
  12. 根据权利要求11所述的装置,其特征在于,所述第一处理模块,还用于:
    获取第一校验值和第二校验值,所述第一校验值和所述第二校验值均基于所述第一密钥生成;
    在所述第一校验值与所述第二校验值相同的情况下,则确定所述第一密钥更新成功。
  13. 根据权利要求12所述的装置,其特征在于,所述第一校验值为第二处理模块基于所述第一密钥进行计算得到的,所述第二校验值为所述目标设备更新所述第一密钥得到的。
  14. 根据权利要求11至13任意一项所述的装置,其特征在于,所述第二处理模块,还用于:
    获取第三校验值,所述第三校验值为所述目标设备在获取所述第一识别符的过程中得到的;
    在所述第一识别符存在于所述第二服务器中,且所述第一识别符与所述第一识别码关联的情况下,则基于所述第一密钥以及所述第一识别符生成第四校验值;
    在所述第三校验值与所述第四校验值相同的情况下,则保持所述第一识别符与所述第一识别码之间的关联关系。
  15. 根据权利要求11至13任意一项所述的装置,其特征在于,所述第二处理模块,还用于:
    获取第三校验值,所述第三校验值为所述目标设备在获取所述第一识别符的过程中得到的;
    在所述第一识别符存在于所述第二服务器中,且所述第一识别符与除所述第一识别码之外的其余识别码关联的情况下,则基于所述第一密钥以及所述第一识别符生成第四校验值;
    在所述第三校验值与所述第四校验值相同的情况下,则将所述第一识别符关联至所述第一识别码。
  16. 根据权利要求11至13任意一项所述的装置,其特征在于,所述第二处理模块,还用于:
    获取第三校验值,所述第三校验值为所述目标设备在获取所述第一识别符的过程中得到;
    在所述第一识别符未存在于所述第二服务器中的情况下,则基于预置的第二密钥以及所述第一识别符生成第五校验值,所述第二密钥与所述目标设备的类型对应;
    在所述第三校验值与所述第五校验值相同的情况下,则将所述第一识别符关联至所述第一识别码。
  17. 根据权利要求14至16任意一项所述的装置,其特征在于,所述第一密钥包括以下其中一种:
    MEK链表中的当前MEK;
    所述当前MEK以及SK;
    所述当前MEK以及DK;
    所述当前MEK、所述SK以及所述DK。
  18. 根据权利要求17所述的装置,其特征在于,所述第二处理模块,用于基于所述MEK链表中的任意一个MEK以及所述第一识别符生成第四校验值。
  19. 一种目标设备,其特征在于,所述目标设备包括:
    接收模块,用于接收来自第一服务器的第一请求,所述第一请求用于获得第一识别码和第一识别符,所述第一识别码关联所述第一识别符;
    获取模块,用于获取所述第一识别符对应的第一密钥的信息;
    更新模块,用于根据所述第一密钥的信息更新所述第一密钥。
  20. 根据权利要求19所述的装置,其特征在于,所述第一密钥包括以下其中一种:
    MEK链表中的当前MEK;
    所述当前MEK以及SK;
    所述当前MEK以及DK;
    所述当前MEK、所述SK以及所述DK。
  21. 一种密钥更新装置,其特征在于,所述密钥更新装置包括存储器和处理器;
    所述存储器存储有代码,所述处理器被配置为执行所述代码,当所述代码被执行时,所述密钥更新装置执行如权利要求1至8任意一项所述的方法。
  22. 一种目标设备,其特征在于,所述目标设备包括存储器和处理器;
    所述存储器存储有代码,所述处理器被配置为执行所述代码,当所述代码被执行时,所述目标设备执行如权利要求9或10所述的方法。
  23. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机程序,该程序由计算机执行时,使得所述计算机实施权利要求1至10任意一项所述的方法。
  24. 一种计算机程序产品,其特征在于,所述计算机程序产品存储有指令,所述指令在由计算机执行时,使得所述计算机实施权利要求1至10任意一项所述的方法。
PCT/CN2021/091653 2021-04-30 2021-04-30 一种密钥更新方法及其相关设备 WO2022227057A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/CN2021/091653 WO2022227057A1 (zh) 2021-04-30 2021-04-30 一种密钥更新方法及其相关设备
CN202180097661.9A CN117223251A (zh) 2021-04-30 2021-04-30 一种密钥更新方法及其相关设备
EP21938531.7A EP4329240A4 (en) 2021-04-30 2021-04-30 KEY UPDATE METHOD AND RELATED DEVICE

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/091653 WO2022227057A1 (zh) 2021-04-30 2021-04-30 一种密钥更新方法及其相关设备

Publications (1)

Publication Number Publication Date
WO2022227057A1 true WO2022227057A1 (zh) 2022-11-03

Family

ID=83847545

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/091653 WO2022227057A1 (zh) 2021-04-30 2021-04-30 一种密钥更新方法及其相关设备

Country Status (3)

Country Link
EP (1) EP4329240A4 (zh)
CN (1) CN117223251A (zh)
WO (1) WO2022227057A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116419217A (zh) * 2023-06-09 2023-07-11 广州万协通信息技术有限公司 Ota数据升级方法、系统、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140114497A1 (en) * 2011-07-06 2014-04-24 Hitachi Automotive Systems, Ltd. In-Vehicle Network System
US20180227120A1 (en) * 2015-08-05 2018-08-09 Kddi Corporation Management device, management system, key generation device, key generation system, key management system, vehicle, management method, key generation method, and computer program
US20190245691A1 (en) * 2016-11-10 2019-08-08 Kddi Corporation Reuse system, key generation device, data security device, in-vehicle computer, reuse method, and computer program
US20190356477A1 (en) * 2017-02-01 2019-11-21 Fujitsu Limited Encryption key distribution system, key distribution ecu and key reception ecu
CN111480314A (zh) * 2017-12-19 2020-07-31 美光科技公司 安全的车辆控制单元更新

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140114497A1 (en) * 2011-07-06 2014-04-24 Hitachi Automotive Systems, Ltd. In-Vehicle Network System
US20180227120A1 (en) * 2015-08-05 2018-08-09 Kddi Corporation Management device, management system, key generation device, key generation system, key management system, vehicle, management method, key generation method, and computer program
US20190245691A1 (en) * 2016-11-10 2019-08-08 Kddi Corporation Reuse system, key generation device, data security device, in-vehicle computer, reuse method, and computer program
US20190356477A1 (en) * 2017-02-01 2019-11-21 Fujitsu Limited Encryption key distribution system, key distribution ecu and key reception ecu
CN111480314A (zh) * 2017-12-19 2020-07-31 美光科技公司 安全的车辆控制单元更新

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4329240A4 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116419217A (zh) * 2023-06-09 2023-07-11 广州万协通信息技术有限公司 Ota数据升级方法、系统、设备及存储介质
CN116419217B (zh) * 2023-06-09 2023-09-05 广州万协通信息技术有限公司 Ota数据升级方法、系统、设备及存储介质

Also Published As

Publication number Publication date
EP4329240A1 (en) 2024-02-28
CN117223251A (zh) 2023-12-12
EP4329240A4 (en) 2024-05-22

Similar Documents

Publication Publication Date Title
CN108496322B (zh) 车载计算机系统、车辆、密钥生成装置、管理方法、密钥生成方法以及计算机可读取的记录介质
CN109726229B (zh) 一种区块链数据存储方法及装置
CN110555029B (zh) 基于区块链的票务管理方法、装置及存储介质
CN108197505B (zh) 区块链业务数据处理方法、装置及电子设备
CN109314639B (zh) 管理系统、密钥生成装置、车载计算机、管理方法以及记录介质
Nowdehi et al. In-vehicle CAN message authentication: An evaluation based on industrial criteria
JP6178390B2 (ja) 管理装置、管理システム、車両、管理方法、及びコンピュータプログラム
US8391487B2 (en) Secure remote configuration of device capabilities
CN110086755B (zh) 实现物联网服务的方法、应用服务器、物联网设备和介质
US20170302452A1 (en) Message authentication library
US10176307B2 (en) Licensing using a node locked virtual machine
CN112740212B (zh) 密钥写入方法及装置
WO2022151478A1 (zh) 车辆密钥管理方法、设备及其系统
WO2019038800A1 (ja) 鍵管理装置、通信機器および鍵共有方法
WO2022227057A1 (zh) 一种密钥更新方法及其相关设备
US20220247731A1 (en) Secure communication between an intermediary device and a network
WO2023000313A1 (zh) 一种密钥验证方法及相关装置
JP2018006782A (ja) データ提供システム、データ提供装置、車載コンピュータ、データ提供方法、及びコンピュータプログラム
US20090193224A1 (en) Techniques for reducing storage space and detecting corruption in hash-based application
WO2017126322A1 (ja) 車載コンピュータシステム、車両、鍵生成装置、管理方法、鍵生成方法、及びコンピュータプログラム
CN114265815A (zh) 交通媒体数据存储方法、服务器、存储介质及系统
JP6672243B2 (ja) データ提供システム、データ提供装置、データ提供方法、及びデータ提供プログラム
JP6454919B2 (ja) 管理システム、データ提供装置、車載コンピュータ、管理方法、及びコンピュータプログラム
JP2020053880A (ja) 鍵管理システム、車両、管理サーバ装置、端末装置、コンピュータプログラム、及び鍵管理方法
WO2022241799A1 (zh) 一种密钥生成方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21938531

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180097661.9

Country of ref document: CN

WWE Wipo information: entry into national phase

Ref document number: 2021938531

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2021938531

Country of ref document: EP

Effective date: 20231121

NENP Non-entry into the national phase

Ref country code: DE