Method and system for upgrading vehicle controller through OTA
Technical Field
The invention relates to the technical field of OTA upgrading of vehicles, in particular to a technology for upgrading a vehicle controller by using OTA.
Background
The english full name of OTA technology is Over the Air Technology, the over-the-air technology is that the system is upgraded by mobile communication technology, and the OTA of the vehicle-end system is that the related system and the controller of the vehicle are upgraded by a pointer.
The more the controllers on the automobile become, the more and more complex the functions, the more the controllers are, the defects of part of the controllers are found to be unavoidable after leaving the factory along with the whole automobile or in the use process of users, the related controllers of the dispatched automobile are updated and the defects are repaired through an OTA technology, so that the user experience can be improved for manufacturers, the operation cost is reduced, the OTA of the automobile controllers tends to be frequent, the automobile model for realizing the whole automobile OTA is continuously developed, the legal regulations related to OTA are not perfected, the automobile is particularly careful for the safety problem, the related to the life and property safety of customers is directly carried out, and the information potential safety hazard for the OTA upgrade is gradually highlighted in application.
Disclosure of Invention
The invention aims to provide a method and a system for upgrading a vehicle controller by OTA, which solve the technical problems: in the related art, potential safety hazards exist in upgrading a vehicle controller through OTA.
In order to solve the technical problems, the invention adopts the following technical scheme: a method of OTA upgrading a vehicle controller comprising the steps of:
s01: the OTA server side uploads a controller upgrade package organized by a private protocol;
s02: the PKI server carries out symmetric algorithm encryption on the controller upgrade package;
S03: the PKI server calculates the HASH value of the controller upgrade package, and encrypts the HASH value as the signature of the upgrade package through an asymmetric algorithm private key corresponding to the corresponding service certificate ID according to the HASH value;
s04: the vehicle-end networking equipment collects version information related to the vehicle controller and communicates with the OTA server through configuration private network according to SSL standard link protocol;
s05: the vehicle-end networking equipment sends the relevant version information of the vehicle controller to the OTA server;
S06: the OTA server side judges whether the relevant version information of the vehicle controller is the latest version or not, if not, the vehicle-side networking equipment is informed to download the controller upgrading packet;
s07: the vehicle-end networking equipment verifies the integrity of the controller upgrade package;
S08: the vehicle-end networking equipment inquires SubMaster service certificate information corresponding to the controller to be upgraded according to the configuration topology information;
S09: the vehicle-end networking equipment deploys a controller upgrade package to corresponding SubMaster equipment, and the SubMaster equipment performs signature verification on the controller upgrade package by using a public key of an asymmetric algorithm of a corresponding service certificate;
S10: the vehicle-end networking equipment inquires the corresponding SubMaster encryption ID, if the SubMaster equipment does not have the key required by decrypting the controller upgrade package currently, the vehicle-end networking equipment updates the key and the corresponding initial value information to the SubMaster, and the key passes the verification of the service certificate public key of the SubMaster equipment;
s11: after the controller upgrade package and the secret key pass verification, the SubMaster equipment informs the vehicle-end networking equipment of preparing for upgrade, and the vehicle-end networking equipment checks the vehicle upgrade condition and further informs the SubMaster equipment of upgrading;
S12: and the SubMaster equipment decrypts the controller upgrading package, analyzes the content of the controller upgrading package according to a private upgrading package organization analysis protocol, and performs brushing upgrading on the controller to be upgraded.
Preferably, the method comprises the steps of,
In S02, the PKI server performs symmetric algorithm encryption on the controller upgrade package, and records and stores a corresponding key ID.
Preferably, the method comprises the steps of,
In the step S08, if SubMaster devices do not have the service certificate required by the controller upgrade package verification, the vehicle-end networking device updates the service certificate to the SubMaster devices, and the service certificate passes the verification of the root certificate public key built in the SubMaster.
Preferably, the method comprises the steps of,
In S11, the vehicle upgrade condition includes a vehicle speed, an engine state, a vehicle power supply gear, a hand brake state, and a battery level.
Preferably, the method comprises the steps of,
In S12, the private upgrade package organization and analysis protocol includes version information of the upgrade package of the controller, a type of the upgrade package, a baud rate, a diagnostic ID, a data block size, a reception, a transmission, and a latency.
The invention also provides a system for upgrading the vehicle controller by OTA, which comprises:
the uploading module is used for uploading a controller upgrade package organized by a private protocol by the OTA server;
The first encryption module is used for carrying out symmetric algorithm encryption on the controller upgrade package by the PKI server;
the calculation module is used for calculating the HASH value of the controller upgrade package by the PKI server;
The second encryption module is used for encrypting the HASH value through an asymmetric algorithm private key corresponding to the corresponding service certificate ID according to the HASH value to be used as a signature of the upgrade package;
The collection module is used for collecting the relevant version information of the vehicle controller by the vehicle-end networking equipment;
the sending module is used for sending the relevant version information of the vehicle controller to the OTA server by the vehicle-end networking equipment;
The first judging module is used for judging whether the related version information of the vehicle controller is the latest version or not by the OTA server, and if not, notifying the vehicle-end networking equipment to download the controller upgrading packet;
the verification module is used for verifying the integrity of the controller upgrade package by the vehicle-end networking equipment;
the first query module is used for querying SubMaster service certificate information corresponding to the controller to be upgraded according to the topology information by the vehicle-end networking equipment;
the signature verification module is used for carrying out signature verification on the public key of the asymmetric algorithm of the corresponding service certificate for the controller upgrade package by SubMaster equipment;
The second query module is configured to query the corresponding SubMaster encrypted ID by the vehicle-end networking device, if the SubMaster device does not have a key required for parsing the controller upgrade package currently, the vehicle-end networking device updates the key and corresponding initial value information to the SubMaster, and the key passes the verification of the service certificate public key of the SubMaster device;
the second judging module is used for checking the vehicle upgrading conditions by the vehicle-end networking equipment and further informing SubMaster equipment to upgrade;
the decryption module is used for decrypting the controller upgrade package by the SubMaster equipment;
And the analysis module is used for analyzing the content of the upgrade package of the controller according to the private upgrade package organization analysis protocol.
Preferably, the method comprises the steps of,
In the first encryption module, the PKI server performs symmetric algorithm encryption on the controller upgrade package, and records and stores a corresponding key ID.
Preferably, the method comprises the steps of,
In the first query module, if SubMaster devices do not have the service certificate required by the controller upgrade package verification, the vehicle-end networking device updates the service certificate to SubMaster devices, and the service certificate passes the verification of the root certificate public key built in SubMaster.
Preferably, the method comprises the steps of,
In the second judging module, the vehicle upgrading conditions comprise a vehicle speed, an engine state, a vehicle power supply gear, a hand brake state and a storage battery electric quantity.
Preferably, the method comprises the steps of,
In the parsing module, the private upgrade package organization parsing protocol includes version information of the upgrade package of the controller, a type of writing, a baud rate, a diagnostic ID, a data block size, a receiving, transmitting and waiting delay.
By adopting the technical scheme, the invention has the beneficial technical effects that: in the invention, the security upgrade of the vehicle end needs to be matched with the OTA server end, and the OTA server end provides the following services aiming at the whole scheme: generating and updating a service certificate; generating and updating a symmetric key, and carrying out symmetric encryption on a controller upgrade package; the vehicle end and the OTA server end are communicated through a private network under an operator network, the vehicle end and the OTA server end are connected through a standard SSL protocol, a security chip is arranged in vehicle end networking equipment and SubMaster equipment, a root public key certificate is arranged in the security chip and cannot be changed, an update service certificate is verified and replaced by the root certificate, after the OTA server end uploads a controller upgrade packet, the OTA server end encrypts the controller upgrade packet by adopting a symmetric algorithm, the symmetric key is stored in a SubMaster equipment encryption chip, the symmetric key can be updated by encrypting and decrypting by an asymmetric encryption algorithm of the service certificate which passes verification, an initial value of each symmetric encryption and decryption is updated, each upgrade packet generates a signature by using the service certificate at SubMaster equipment after transmission is completed, the content of an upload packet format of the OTA server is organized by adopting a private protocol, analysis and writing are performed at SubMaster equipment, the information security performance of the OTA is effectively improved, and the safety of OTA upgrade of the vehicle is ensured.
Drawings
FIG. 1 is a diagram of a system security architecture of the present invention;
Fig. 2 is a schematic diagram of a controller safety start-up verification of the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
As shown in fig. 1, the OTA server/PKI server and the vehicle-end networking device/Master communicate with each other through 4G/WiFi, the vehicle-end networking device/Master is built with an HSM, and the vehicle-end networking device/Master is connected with each controller through CAN/CANFD/Ethernet.
Specifically, the method for upgrading the vehicle controller by using the OTA comprises the following steps:
Firstly, uploading a controller upgrade package organized by a private protocol by an OTA server, carrying out symmetric algorithm encryption on the controller upgrade package by the OTA server/PKI server, and recording and storing corresponding information such as a key ID; the PKI server calculates the HASH value of the controller upgrade package and encrypts the HASH value according to the HASH value through an asymmetric algorithm private key corresponding to the corresponding service certificate ID to serve as a signature of the controller upgrade package.
And secondly, the vehicle-end networking equipment collects version information related to the vehicle controller, communicates with the OTA server end by configuring a private network according to an SSL standard link protocol, and starts the version information of the vehicle end to the OTA server end.
And thirdly, the OTA server receives and compares the version information of the background and the version information of the vehicle end, and if the version information is found not to be up to date, the OTA server informs the vehicle end network connection equipment to download a controller upgrade package to be upgraded.
And fourthly, the vehicle-end network connection equipment downloads the controller upgrade package, and checks the integrity of the controller upgrade package, if the integrity is checked, the controller upgrade package needs to be downloaded again.
Fifthly, the vehicle-end network equipment inquires SubMaster service certificate information corresponding to the upgrade controller according to the configuration topology information, if SubMaster equipment does not have the service certificate required by the verification of the upgrade package of the controller currently, the vehicle-end network equipment item SubMaster updates the service certificate, the service certificate is verified through a SubMater built-in root certificate public key, the vehicle-end network equipment deploys the upgrade package of the controller to corresponding SubMaster equipment, subMaster equipment performs verification on the upgrade package of the controller by using the public key of an asymmetric algorithm of the corresponding service certificate, and if the verification is not passed, the upgrade package of the controller is required to be redeployed again for verification.
Sixth, the vehicle-end networking device queries the corresponding SubMaster encrypted ID, if SubMaster device does not have the key required for decrypting the upgrade package currently, the vehicle-end networking device item SubMaster updates the key and the corresponding information such as the initial value, and the key needs to pass the verification of the service certificate public key of SubMaster.
Seventh, after the controller upgrade package and the secret key pass verification, subMaster equipment prepares to upgrade through Master equipment, the Master equipment checks the vehicle upgrade condition, the specific condition is set according to the vehicle type, the specific condition comprises the vehicle speed, the state of a transmitter, the power supply gear of the vehicle, the hand brake state, the electric quantity of a storage battery and the like, and SubMaster equipment is informed to upgrade if the specific condition is met.
And eighth step, subMaster equipment decrypts the controller upgrade package and analyzes the content of the controller upgrade package according to a private upgrade package organization analysis protocol, and the controller to be upgraded is subjected to updating by brushing, wherein the private upgrade package organization analysis protocol comprises information such as version information, updating type, baud rate, diagnosis ID, data block size, receiving, sending, waiting time delay and the like of the controller upgrade package, can modify flexible construction versions of configuration files according to different views of a backstop, analyzes the version content, controls updating rhythm, and has strong expandability and is configurable.
And ninth, after the controller is started, verifying the authenticity and the integrity of the Bootloader and the application program.
As shown in fig. 2, in particular, the controller verifies Booloader the authenticity integrity via the bootable program, and then verifies the application authenticity integrity based on the sampling mechanism, after which the verification can be initiated.
The invention also provides a system for upgrading the vehicle controller by OTA, which comprises:
the uploading module is used for uploading a controller upgrade package organized by a private protocol by the OTA server;
The first encryption module is used for carrying out symmetric algorithm encryption on the controller upgrade package by the PKI server;
the calculation module is used for calculating the HASH value of the controller upgrade package by the PKI server;
The second encryption module is used for encrypting the HASH value as a signature of the upgrade package through an asymmetric algorithm private key corresponding to the corresponding service certificate ID according to the HASH value;
The collection module is used for collecting the relevant version information of the vehicle controller by the vehicle-end networking equipment;
the transmitting module is used for transmitting the relevant version information of the vehicle controller to the OTA server by the vehicle-end networking equipment;
The first judging module is used for judging whether the related version information of the vehicle controller is the latest version or not by the OTA server, and if not, notifying the vehicle-end networking equipment to download the controller upgrade package;
The verification module is used for verifying the integrity of the upgrade package of the controller by the vehicle-end networking equipment;
The first query module is used for querying SubMaster service certificate information corresponding to the controller to be upgraded according to the topology information by the vehicle-end networking equipment;
the signature verification module is used for carrying out signature verification on the public key of the asymmetric algorithm of the corresponding service certificate for the controller upgrade package by SubMaster equipment;
The second query module is used for querying the corresponding SubMaster encrypted ID by the vehicle-end networking device, if SubMaster equipment does not have the key required by the analysis of the controller upgrade package currently, the vehicle-end networking device updates the key and the corresponding initial value information to SubMaster, and the key passes the verification of the service certificate public key of SubMaster equipment;
the second judging module is used for checking the vehicle upgrading conditions by the vehicle-end networking equipment and further informing SubMaster equipment to upgrade;
the decryption module is used for SubMaster equipment to decrypt the controller upgrade package;
And the analysis module is used for analyzing the content of the upgrade package of the controller according to the private upgrade package organization analysis protocol.
In particular, the method comprises the steps of,
In the first encryption module, the PKI server performs symmetric algorithm encryption on the controller upgrade package, and records and stores the corresponding key ID.
In particular, the method comprises the steps of,
In the first query module, if SubMaster devices do not have the service certificate required by the controller upgrade package verification, the vehicle-end networking device updates the service certificate to SubMaster devices, and the service certificate passes the verification of the root certificate public key built in SubMaster.
In particular, the method comprises the steps of,
In the second determination module, the vehicle upgrade condition includes a vehicle speed, an engine state, a vehicle power supply gear, a hand brake state, and a battery charge.
In particular, the method comprises the steps of,
In the analysis module, the private upgrade package organization analysis protocol comprises version information, a refreshing type, a baud rate, a diagnosis ID, a data block size, receiving, transmitting and waiting delay of the controller upgrade package.