Vehicle ECU encrypted file secure flashing method and system and medium
The segmented and encrypted ECU flashing method solves the efficiency and security problems of remote ECU upgrades in existing technologies, and achieves efficient and secure remote ECU file flashing.
Patent Information
- Application Number
- CN202511516999.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-23
- Publication Date
- 2026-01-23
AI Technical Summary
In existing technologies, ECU remapping can only be performed on-site by the ECU manufacturer, making it difficult to remotely upgrade vehicles that have already been sold. Furthermore, full-package remapping is prone to failure, lacks security, is easily cracked, and affects upgrade efficiency.
The file to be written is segmented and a message counter is added. A hash algorithm and public-private key encryption strategy are used to perform secure writing through segment counting unit, hash encryption unit, private key encryption unit, public key decryption unit and packet verification unit to ensure file integrity and security.
It improves the efficiency and security of remote ECU upgrades, prevents data tampering, reduces recovery time after a failed flash, and ensures the correctness and unbreakability of the flashing files.
Smart Images

Figure CN121387328A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of remote software upgrading of automobile ECU, and particularly relates to a vehicle ECU encrypted file safe flashing method and system and a medium. BACKGROUND
[0002] In the prior art, for safety and performance considerations, ECU flashing can only be performed by ECU manufacturers, and the retry time for flashing failure is long, and ECU flashing also needs to be performed by staff on site using special equipment. If the vehicles are not concentrated or the ECU of a sold vehicle needs to be upgraded, on-site flashing is almost impossible to achieve, and the difficulty is too great. Therefore, remote OTA needs to be used for upgrading, and the whole package flashing currently used is prone to failure and the encryption algorithm is relatively simple and easy to be damaged, and even the to-be-flashed file can be cracked. In addition, after a vehicle downloads a large number of data packages, if the content of the flashing file is tampered with by a malicious user, the verification fails, which greatly affects the efficiency of remote upgrading of automobile ECU. SUMMARY
[0003] In view of the above-mentioned shortcomings of the prior art, the purpose of the present application is to provide a vehicle ECU encrypted file safe flashing method and system and a medium, which can improve the efficiency and security of remote upgrading of automobile ECU.
[0004] To achieve the above-mentioned purpose, the present application adopts the following technical solutions.
[0005] The present application provides a vehicle ECU encrypted file safe flashing method in the first aspect, comprising: dividing the to-be-flashed file package into one or more data segments, and adding a message counter in each data segment to correspond to each to-be-flashed file; the file information in each to-be-flashed file includes the data segment and the message counter; wherein the value of the message counter is set according to the order of each data segment in the to-be-flashed file package; encrypting each to-be-flashed file through a hash algorithm to obtain a corresponding hash value, and adding file information to each to-be-flashed file; the file information, the hash value, and each to-be-flashed file form a new to-be-verified flashing file; encrypting each to-be-verified flashing file through a private key to form each encrypted to-be-flashed file, and downloading the encrypted to-be-flashed file to the vehicle ECU to be flashed; decrypting each encrypted to-be-flashed file downloaded to the vehicle ECU through a public key, and obtaining each to-be-flashed file after decryption is completed; packaging each to-be-flashed file according to the order of the message counter in each to-be-flashed file, and verifying the file information and the hash value of each to-be-flashed file at the same time, and completing the safe flashing of the to-be-flashed file package after packaging.
[0006] As an optional implementation, a message counter is added at the end of each data segment, corresponding to the composition of each to-be-flashed file; the value of the message counter of the first data segment is 1, and the value of the message counter of the subsequent data segments is sequentially increased by 1. When performing signature verification in the vehicle ECU, each to-be-flashed file is packaged in ascending order of the value of the message counter in each to-be-flashed file.
[0007] As an optional implementation, when the message counter is added in each data segment, it further includes: A reset counter is added at the end of each data segment, corresponding to the composition of one or more to-be-flashed files, each to-be-flashed file including data segments, message counters, and reset counters, and the reset counter is used to count the number of verification failures.
[0008] As an optional implementation, each encrypted to-be-flashed file is encrypted by signing each to-be-flashed file package with a private key, and the encrypted to-be-flashed file includes file information, a hash value, signature information, data segments, message counters, and reset counters.
[0009] As an optional implementation, each to-be-flashed file is packaged in order of the message counter in each to-be-flashed file, and the file information and hash value of each to-be-flashed file are verified simultaneously, including: Verify the file information of each to-be-flashed file. If there is a to-be-flashed file verification failure, feedback to the remote platform OTA server, and the remote platform OTA server increases the reset counter of the to-be-flashed file verification failure by 1 and then retransmits; Stop flashing until transmission is successful or the reset counter is greater than the preset number of retransmissions.
[0010] As an optional implementation, before dividing the to-be-flashed file package into one or more data segments and adding a message counter in each data segment, corresponding to the composition of each to-be-flashed file, it includes: Encrypt the random data with a hash value, and send the encrypted random data to the in-vehicle master control unit; The in-vehicle master control unit performs hash verification on the encrypted random data; Determine whether to perform a flashing request based on the result of the hash verification.
[0011] As an optional implementation, the secure flashing of the to-be-flashed file package after packaging includes: Connect to the to-be-flashed vehicle ECU through the USD protocol and the flashing control protocol, and when flashing, first erase the corresponding program storage area, and then write the new program.
[0012] As an optional implementation, the file information comprises VIN information and software version information.
[0013] As an optional implementation, the private key is provided by a manufacturer, and the manufacturer can encrypt the private key by itself or through a supplier; and the public key is stored in an ECU to be flashed or a master control unit of a vehicle.
[0014] The second aspect of the present application provides a vehicle ECU encrypted file security flashing system, comprising: a segment counting unit, which is used for at least segmenting a file package to be flashed into one or more data segments and adding a message counter in each data segment, so as to form each file to be flashed; file information in each file to be flashed comprises the data segment and the message counter; and the value of the message counter is set according to the order of each data segment in the file package to be flashed; a hash encryption unit, which is used for at least encrypting each file to be flashed by a hash algorithm to obtain a corresponding hash value, adding file information in a header of each file to be flashed, and combining the file information, the hash value and each file to be flashed to form a new file to be verified and flashed; a private key encryption unit, which is used for at least verifying and encrypting each file to be verified and flashed by a private key to form each encrypted file to be flashed, and downloading the encrypted file to be flashed into an ECU to be flashed of a vehicle; a public key decryption unit, which is used for at least verifying and decrypting each encrypted file to be flashed downloaded into the ECU of the vehicle by a public key, and obtaining each file to be flashed after decryption; a package verification unit, which is used for at least packaging each file to be flashed according to the order of the message counter in each file to be flashed, and verifying file information and a hash value of each file to be flashed at the same time, and completing security flashing of the file package to be flashed after packaging.
[0015] The third aspect of the present application provides an electronic device, comprising at least one processor and at least one memory connected with the processor, wherein the memory stores program instructions executable by the processor, and the processor calling the program instructions can execute the steps of the method according to the first aspect of the present application.
[0016] The fourth aspect of the present application provides a readable storage medium, which stores a computer program, and the computer program is executed by a processor to execute the steps of the method according to the first aspect of the present application.
[0017] The present application has at least the following technical effects: 1. The present application adopts a segmented refreshing strategy, improves the recovery time after refreshing failure, guarantees refreshing efficiency, and realizes the security of the vehicle ECU encrypted file; 2. The application can make the security of the flashing better through the asymmetric encryption strategy of the public and private key pair, and the flashing is not easy to be cracked; 3. The whole security flashing method provided by the application does not need on-site flashing, and improves the efficiency of vehicle software upgrading; 4. The application simultaneously performs the encryption hash algorithm on the to-be-flashed file, can guarantee the data integrity of the to-be-flashed file after being downloaded into the vehicle ECU, can well prevent the data from being tampered in the data transmission process, and can ensure that the version of the flashing software is correct. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0019] Figure 1 is a flowchart of a vehicle ECU encrypted file security flashing method according to an embodiment of the present application.
[0020] Figure 2 is a transmission process diagram of a to-be-flashed file package according to an embodiment of the present application.
[0021] Figure 3 is a data encryption flowchart of a to-be-flashed file package according to an embodiment of the present application.
[0022] Figure 4 is a block diagram of a vehicle ECU encrypted file security flashing system according to an embodiment of the present application.
[0023] Figure 5 is a structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application. In addition, it should be understood that the specific embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application.
[0025] It should be noted that the sequence of the following embodiments is not as a limitation on the preferred sequence of the embodiments of the present application. And in the following embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0026] As shown in Figures 1-3 , the first aspect of the present application provides a vehicle ECU encrypted file security flashing method, comprising the following steps.
[0027] Step S100: The to-be-flashed file package is divided into one or more data segments, and a message counter is added in each data segment, corresponding to each to-be-flashed file; the file information in each to-be-flashed file includes data segments and message counters; wherein the value of the message counter is set according to the order of each data segment in the to-be-flashed file package.
[0028] Specifically, as shown in Figure 2 , the to-be-flashed file is placed in the remote platform OTA server.
[0029] Specifically, as shown in Figure 3 , the to-be-flashed file package can also be understood as the initial to-be-flashed file, before upgrading, the to-be-flashed file package is divided into several or N data segments, which are the segmented to-be-flashed files shown in Figure 2 , and a message counter is added in each data segment, wherein the function of the message counter is to count in order, for subsequent data segment packaging, to prevent problems such as out-of-order during packaging.
[0030] Specifically, each to-be-flashed file includes corresponding data segments and message counters with corresponding values, and the values of the message counters in each data segment are different.
[0031] Step S200: Each to-be-flashed file is encrypted by a hash algorithm to obtain a corresponding hash value, and file information is added to each to-be-flashed file; the file information, hash value, and each to-be-flashed file are combined to form a new to-be-signed flashing file.
[0032] Specifically, file information is added to each to-be-flashed file, including VIN information, software version information, etc., and the to-be-signed flashing file includes file information, hash value, data segment, and message counter.
[0033] Step S300: Each to-be-signed flashing file is signed and encrypted by a private key, to form each encrypted to-be-flashed file, and the encrypted to-be-flashed files are downloaded to the vehicle ECU to be flashed.
[0034] Specifically, the encrypted to-be-flashed files include file information, hash value, signature information, data segment, message counter, and reset counter.
[0035] As shown in Figure 2 The encrypted to-be-flashed file 1, the encrypted to-be-flashed file 1, and the encrypted to-be-flashed file n are examples of the encrypted to-be-flashed files.
[0036] As shown in Figure 3 The specific composition of each encrypted to-be-flashed file includes a segmented to-be-flashed file (i.e., a data segment), a message counter, a reset counter, a hash value, and file information.
[0037] Step S400: Each encrypted to-be-flashed file downloaded into the vehicle ECU is verified and decrypted by a public key, and after decryption, each to-be-flashed file is obtained.
[0038] Specifically, the private key and the public key form an asymmetric algorithm of a public-private key pair, and such an asymmetric encryption strategy can make the flashing more secure and less likely to be cracked.
[0039] Specifically, when verifying, the manufacturer uses the private key to verify and encrypt the to-be-verified file package, and the signature data generated by the encryption and the previous to-be-verified flashed file form the encrypted to-be-flashed file. The manufacturer will use a public-private key pair, and the public key will be stored in the vehicle ECU to be flashed, and the encrypted to-be-flashed file is decrypted when it is downloaded into the vehicle ECU. The private key is provided by the manufacturer and can be encrypted by the manufacturer or given to the supplier for help with encryption, which is flexible. The public-private key encryption algorithm is an asymmetric algorithm, which can greatly protect the to-be-flashed file and is difficult to crack without cracking the private key. Moreover, by simultaneously performing the encryption hash algorithm on the to-be-flashed file, the integrity of the data after the to-be-flashed file is downloaded into the vehicle ECU can be ensured, and the data can be well protected from tampering during transmission. File information and the like can ensure the correct version of the flashed software.
[0040] Step S500: The to-be-flashed files are packaged in the order of the message counters in the to-be-flashed files, and the file information and the hash value of each to-be-flashed file are verified at the same time, and after packaging, the security flashing of the to-be-flashed file package is completed.
[0041] In this application, the segmented refreshing strategy is adopted to improve the recovery time after refreshing failure, ensure the refreshing efficiency, and realize the security of the vehicle ECU encrypted file. The asymmetric encryption strategy of the public-private key pair can make the flashing more secure and less likely to be cracked. In addition, the overall security flashing method provided by the application is not easy to be cracked, and does not need to be flashed on site, which improves the efficiency of vehicle software upgrading. At the same time, the encryption hash algorithm is performed on the to-be-flashed file, which can ensure the integrity of the data after the to-be-flashed file is downloaded into the vehicle ECU, and can well prevent the data from being tampered during transmission. File information and the like can ensure the correct version of the flashed software.
[0042] In an embodiment of the present application, a message counter is added at the end of each data segment, and a reset counter is added at the end of each data segment, which correspond to constitute each to-be-flashed file, and the reset counter is used to count the number of verification failures; wherein the value of the message counter of the first data segment is 1, and the initial value of the reset counter is 0; the value of the message counter of the subsequent data segments is sequentially increased by 1; when signature verification is performed in the vehicle ECU, each to-be-flashed file is packaged in ascending order of the value of the message counter in each to-be-flashed file.
[0043] Specifically, as shown in Figure 3 After the segmentation strategy and the addition of the corresponding counters, each to-be-flashed file includes a segmented to-be-flashed file, a message counter, and a reset counter.
[0044] In an embodiment of the present application, each to-be-flashed file is packaged in the order of the message counter in each to-be-flashed file, and the file information and the hash value of each to-be-flashed file are verified at the same time, including: verifying the file information of each to-be-flashed file; If a to-be-flashed file fails to be verified, the remote platform OTA server is fed back, and the remote platform OTA server increases the reset counter of the to-be-flashed file that fails to be verified by 1 and then retransmits; until the transmission is successful or the reset counter is greater than a preset retransmission number, the flashing is stopped.
[0045] For example, taking the reception of a single data segment as an example, after the reception of the data segment fails, the value of the reset counter is increased by 1, and the maximum value is 3 (which can be set according to actual conditions, and is not required here), when the reset counter reaches the maximum value of 3, the current flashing fails, that is, the current flashing is stopped, and the next flashing request is waited for.
[0046] Here, the message counter and the reset counter are added to ensure that the encrypted key is different each time and to analyze the cause of the error after the error, thereby ensuring secure flashing.
[0047] In an embodiment of the present application, in order to ensure that the network link is smooth and free from interference, before the to-be-flashed file packet is divided into one or more data segments and the message counter is added in each data segment to correspond to constitute each to-be-flashed file, including: encrypting the random data through the hash value, and sending the encrypted random data to the in-vehicle master control unit; the in-vehicle master control unit performs hash verification on the encrypted random data; determining whether to perform a flashing request based on the result of the hash verification.
[0048] In an application scenario of the application, a string of 32-byte random numbers and hash values thereof encrypted by hash are transmitted, and verification is performed in the internal master control unit of the vehicle. After the verification is passed, a feedback signal is fed back to the remote platform OTA server. After the remote platform OTA server confirms that the network channel is good and is not interfered, the to-be-flashed file package is segmented, a message counter and a reset counter are added to the tail of each segmented data packet, and the segmented data packet, the message counter and the reset counter are encrypted together. The real encrypted to-be-flashed file is transmitted, and signature verification is performed in the internal master control unit of the vehicle. After the complete data packet transmission is completed, the data packets are packaged in the order of the message counter from small to large. The file information and the hash value of each encrypted to-be-flashed file need to be verified during the packaging. After the packaging is completed, the to-be-flashed file is flashed. If the verification is not passed, the remote platform OTA server is fed back, the reset counter of the encrypted to-be-flashed file is increased by 1, and then retransmission is performed. Until the transmission is successful or the reset counter is greater than 3, the flashing is stopped. Subsequently, the USD protocol and the flashing control protocol are connected with the to-be-flashed vehicle ECU. During the flashing, the corresponding program storage area is erased, and then the new program is written.
[0049] In this way, the application can verify the network channel in advance, reduce the flashing failure caused by network failure, improve the recovery time after flashing failure by using the segmented flashing strategy, and ensure the flashing efficiency. In addition, the message counter and the reset counter are used to ensure that the encryption key is different each time and to analyze the cause after an error. The asymmetric encryption strategy is also used to make the flashing more secure and less likely to be cracked, thereby avoiding the problem of malicious user tampering with the flashing file content, verification failure and affecting the efficiency of remote upgrading.
[0050] As shown in Figure 4 the second aspect of the application provides a vehicle ECU encrypted file safe flashing system, comprising: a segmentation counting unit, which is used for at least segmenting a to-be-flashed file package into one or more data segments, adding a message counter in each data segment, and corresponding to constitute each to-be-flashed file. The file information in each to-be-flashed file includes the data segment and the message counter. The value of the message counter is set according to the order of each data segment in the to-be-flashed file package. a hash encryption unit, which is used for at least encrypting each to-be-flashed file by a hash algorithm to obtain a corresponding hash value, adding file information in the head of each to-be-flashed file, and constituting a new to-be-verified signature flashing file by the file information, the hash value and each to-be-flashed file. a private key encryption unit, which is used for at least verifying and encrypting each to-be-verified signature flashing file by a private key to constitute each encrypted to-be-flashed file, and downloading the encrypted to-be-flashed file to a to-be-flashed vehicle ECU. A public key decryption unit is configured to decrypt each encrypted to-be-flashed file downloaded into the vehicle ECU by using a public key, and obtain each to-be-flashed file after decryption. A package verification unit is configured to package each to-be-flashed file in the order of the message counter in each to-be-flashed file, and verify the file information and the hash value of each to-be-flashed file at the same time, and perform secure flashing of the to-be-flashed file package after packaging.
[0051] Specifically, in order to ensure that the network link is smooth and free from interference, the vehicle ECU encrypted file secure flashing system further comprises a pre-verification unit configured to encrypt random data by using a hash value, and send the encrypted random data to the in-vehicle master control unit. The in-vehicle master control unit performs hash verification on the encrypted random data. It is determined whether to perform a flashing request based on the result of the hash verification.
[0052] In an embodiment of the present application, the segmented counting unit further comprises a message counter added at the tail of each data segment, which corresponds to each to-be-flashed file; wherein the value of the message counter of the first data segment is 1, and the value of the message counter of the subsequent data segments is increased by 1 successively.
[0053] Correspondingly, the package verification unit further comprises packaging each to-be-flashed file in the order of the value of the message counter in each to-be-flashed file from small to large when performing signature verification in the vehicle ECU.
[0054] In an embodiment of the present application, the segmented counting unit further comprises a reset counter added at the tail of each data segment, which corresponds to one or more to-be-flashed files, and each to-be-flashed file comprises each data segment, a message counter and a reset counter; wherein the initial value of the reset counter is 0.
[0055] In an embodiment of the present application, the private key encryption unit further comprises encrypting each to-be-flashed file package by using a private key to form each encrypted to-be-flashed file, and each encrypted to-be-flashed file comprises file information, a hash value, signature information, a data segment, a message counter and a reset counter.
[0056] In an embodiment of the present application, the package verification unit further comprises verifying the file information of each to-be-flashed file. If there is a to-be-flashed file verification failure, the remote platform OTA server is fed back, and the remote platform OTA server increases the reset counter of the to-be-flashed file verification failure by 1 and then retransmits; Until the transmission is successful or the reset counter is greater than a preset retransmission number, the flashing is stopped.
[0057] In this way, the application can verify the network path in advance, reduce the refreshing failure caused by network failure, adopt the segmented refreshing strategy, improve the recovery time after refreshing failure, and ensure the refreshing efficiency; in addition, the message counter and the reset counter are used to ensure that the encrypted key is different each time, and the cause analysis after the error; the asymmetric encryption strategy is also used, so that the refreshing security is better, and it is not easy to be cracked, avoiding the problem that the malicious user tampers with the flashing file content, the verification fails, and the efficiency of remote upgrading is affected.
[0058] As Figure 5 The third aspect of the application provides an electronic device, comprising: at least one processor; and at least one memory connected with the processor in communication, wherein: the memory stores program instructions executable by the processor, and the processor invoking the program instructions can execute the steps of the method according to any one of the above embodiments.
[0059] The fourth aspect of the application discloses a readable storage medium, which stores a computer program, and the computer program is executed by a processor to perform the steps of the method according to any one of the above embodiments.
[0060] The computer readable storage medium can include any entity or device capable of carrying the computer program, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution medium. The computer program includes computer program code. The computer program code can be in the form of source code, object code, executable file or some intermediate form. The computer readable storage medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution medium.
[0061] Any process or method descriptions in flow charts or described elsewhere herein can be understood as representing one or more steps of a method, portions of code, or modules, which can include executable instructions for performing a particular logical function or step, and the scope of embodiments of the application encompasses many alternatives, modifications, and equivalents. As will be apparent to those of ordinary skill in the art, many different combinations of the above-described elements and / or methods can be used without departing from the scope of the application.
[0062] The logic and / or steps represented in flow diagrams or otherwise described herein, for example, can be considered as a sequence of executable instructions, and can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions, or a combination of the above. The logic and / or steps can also be implemented in programmable logic or electronic hardware, such as an FPGA or ASIC.
[0063] The above embodiments are only used to illustrate the technical solutions of the present application, not limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for securely flashing encrypted files of a vehicle ECU, characterized in that, include: Divide the file package to be written into one or more data segments, and add a message counter to each data segment to form each file to be written. The file information in each file to be flashed includes a data segment and a message counter; the value of the message counter is set according to the order of the data segments in the file package to be flashed. Each file to be written is encrypted using a hash algorithm to obtain a corresponding hash value, and file information is added to each file to be written; the file information, hash value and each file to be written are combined to form a new file to be verified and written. Each file to be verified and written is encrypted using a private key to form an encrypted file to be written, and the encrypted file to be written is downloaded to the ECU of the vehicle to be written. The encrypted files to be flashed are decrypted by using a public key to verify the signature of each file downloaded to the vehicle's ECU. After decryption, the files to be flashed are obtained. The files to be flashed are packaged according to the message counters in each file in order, and the file information and hash value of each file are verified at the same time. After packaging, the secure flashing of the file package is completed.
2. The method for securely flashing encrypted vehicle ECU files according to claim 1, characterized in that, A message counter is added to the end of each data segment to form each file to be written; the message counter value of the first data segment is 1, and the message counter value of the subsequent data segments increases by 1 in turn. During signature verification within the vehicle's ECU, the files to be flashed are grouped according to their message counter values from smallest to largest.
3. The method for securely flashing encrypted vehicle ECU files according to claim 1, characterized in that, When adding message counters to each data segment, the following is also included: A reset counter is added to the end of each data segment, forming one or more files to be written. Each file to be written includes each data segment, a message counter, and a reset counter. The reset counter is used to count the number of verification failures.
4. The method for securely flashing encrypted vehicle ECU files according to claim 3, characterized in that, Each encrypted file to be written is composed of a private key used to verify and encrypt each file package to be written. Each encrypted file to be written includes file information, hash value, signature information, data segment, message counter, and reset counter.
5. The method for securely flashing encrypted vehicle ECU files according to claim 3, characterized in that, The process of assembling the files to be written according to the message counter order in each file, and simultaneously verifying the file information and hash value of each file to be written, includes: Verify the file information of each file to be flashed; If the verification of a file to be flashed fails, feedback is sent to the remote platform OTA server. The remote platform OTA server increments the reset counter of the file that failed to be flashed by 1 and then retransmits it. The refresh will stop once the transmission is successful or the reset counter exceeds the preset number of retransmissions.
6. The method for securely flashing encrypted vehicle ECU files according to claim 1, characterized in that, Before dividing the file package to be flashed into one or more data segments, and adding a message counter to each data segment to form the corresponding file to be flashed, the process includes: Random data is encrypted using a hash value, and the encrypted random data is then sent to the vehicle's main control unit. The in-vehicle main control unit performs hash verification on the encrypted random data; Whether to make a flush request is determined based on the result of hash verification.
7. The method for securely flashing encrypted vehicle ECU files according to claim 1, characterized in that, The process of assembling the package and then performing a secure flash of the file package to be flashed includes: The system connects to the ECU of the vehicle to be flashed via the USD protocol and flashing control protocol. During the flashing process, the corresponding program storage area is first erased, and then the new program is written.
8. The method for securely flashing encrypted vehicle ECU files according to claim 1, characterized in that, The file information includes VIN information and software version information.
9. The method for securely flashing encrypted vehicle ECU files according to claim 1, characterized in that, The private key is provided by the manufacturer, which can encrypt it itself or with the assistance of the supplier; the public key is stored in the vehicle's ECU or main control unit to be flashed.
10. A secure flashing system for encrypted vehicle ECU files, characterized in that, include: The segmented counting unit is used at least to divide the file package to be written into one or more data segments, and add a message counter to each data segment to form a corresponding file to be written. The file information in each file to be flashed includes a data segment and a message counter; the value of the message counter is set according to the order of the data segments in the file package to be flashed. The hash encryption unit is used at least to encrypt each file to be written using a hash algorithm to obtain the corresponding hash value, and to add file information to the header of each file to be written; and to combine the file information, hash value and each file to be written into a new file to be verified and written. The private key encryption unit is used to encrypt each file to be verified and written using a private key, forming each encrypted file to be written, and downloading each encrypted file to be written into the ECU of the vehicle to be written. The public key decryption unit is used at least to verify and decrypt each encrypted file to be flashed downloaded to the vehicle ECU using a public key. After decryption, each file to be flashed is obtained. The packet assembly and verification unit is used to assemble each file to be flashed in the order of the message counters in each file to be flashed, and at the same time verify the file information and hash value of each file to be flashed, so as to complete the secure flashing of the file packets after assembly.
11. An electronic device, characterized in that, include: At least one processor; And at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor invokes the program instructions to perform the steps of the vehicle ECU encrypted file secure flashing method as described in any one of claims 1-9.
12. A readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor using the steps of the secure flashing method for vehicle ECU encrypted files as described in any one of claims 1-9.
Citation Information
Cited By
Safe flashing method and system for vehicle, client side and server side
CN121637478A