Electronic control unit file flashing method and related device
By using the technology of key matching and grouping encryption in file flushing of electronic control unit, the problem of low security of flashing data is solved, and higher security and legality are achieved.
Patent Information
- Application Number
- CN202510154535.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-05-27
AI Technical Summary
When writing remote electronic control unit files, the data is not safe and is easily obtained by other technicians, making it difficult to maintain the data on the assisting side.
By obtaining and generating keys, the electronic control unit files are encrypted in group and key matching is performed between the flashing device assisting end and the controlled end, ensuring that flashing operations can only be performed under legal and authorized circumstances.
Improve the security of file flushing of electronic control unit, prevent unauthorized access and data leakage, and ensure the legality and security of flashing operations.
Smart Images

Figure CN120050032A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle diagnosis, and particularly to a method for flashing an electronic control unit file and related devices. Background Art
[0002] During remote flashing, the assisting end transfers the electronic control unit file to the controlled end, and stores the data in a folder by hiding the save path. However, the stored data is easily obtained by other technicians, and the data of the assisting end cannot be well maintained, resulting in low security for flashing the electronic control unit file. Therefore, how to improve the security of flashing the electronic control unit file is an urgent problem to be solved. Summary of the Invention
[0003] The embodiments of the present application provide a method for flashing an electronic control unit file and related devices, which improve the security of flashing the electronic control unit file.
[0004] In a first aspect, the embodiments of the present application provide a method for flashing an electronic control unit file, which is applied to the assisting end of a flashing device. The method includes:
[0005] Obtain a flashing file and a first string for the flashing file;
[0006] Generate a first secret key based on the first string;
[0007] Send the first secret key to the controlled end of the flashing device;
[0008] Group-encrypt the flashing file to obtain n groups of encrypted flashing files; each encrypted flashing file corresponds to an electronic control unit; n is an integer greater than 1;
[0009] Send the n groups of encrypted flashing files to the controlled end of the flashing device;
[0010] Obtain a second string for a target electronic control unit;
[0011] Generate a second secret key based on the second string;
[0012] Send the second secret key to the controlled end of the flashing device, so that the controlled end of the flashing device matches the first secret key and the second secret key, and generates a corresponding instruction;
[0013] If a flashing failure instruction is received from the controlled end of the flashing device, generate a flashing failure prompt message;
[0014] If a programming success instruction is received from the controlled end of the programming device, obtain a target programming file corresponding to the target electronic control unit, and perform a programming operation on the target electronic control unit based on the target programming file; the target programming file corresponds to a target encrypted programming file, and the target encrypted programming file is one of the n groups of encrypted programming files.
[0015] In a second aspect, an embodiment of the present application provides a method for programming an electronic control unit file, which is applied to the controlled end of a programming device. The method includes:
[0016] Receive a first secret key corresponding to a first string from the assisting end of the programming device;
[0017] Receive the n groups of encrypted programming files from the assisting end of the programming device, and store the n groups of encrypted programming files in the local storage area of the controlled end of the programming device; each encrypted programming file corresponds to an electronic control unit; n is an integer greater than 1;
[0018] Receive a second secret key corresponding to a second string from the assisting end of the programming device; the second string is a string input to the assisting end of the programming device for the target electronic control unit;
[0019] Match the first secret key with the second secret key;
[0020] If the matching fails, delete the n groups of encrypted programming files, and send a programming failure instruction to the assisting end of the programming device;
[0021] If the matching is successful, decrypt the n groups of encrypted programming files based on the second secret key to obtain n decrypted programming files, obtain a target programming file corresponding to the target electronic control unit from the n decrypted programming files, and send the target programming file to the assisting end of the programming device, and send a programming success instruction to the assisting end of the programming device.
[0022] In a third aspect, an embodiment of the present application provides a programming device for an electronic control unit file. The device includes: an obtaining unit and a processing unit;
[0023] The obtaining unit is configured to obtain a programming file and a first string for the programming file;
[0024] The processing unit is configured to generate a first secret key based on the first string;
[0025] Send the first secret key to the controlled end of the programming device;
[0026] Group-encrypt the flashing file to obtain n groups of encrypted flashing files; each encrypted flashing file corresponds to an electronic control unit; n is an integer greater than 1;
[0027] Send the n groups of encrypted flashing files to the controlled end of the flashing device;
[0028] The obtaining unit is used to obtain a second string for the target electronic control unit;
[0029] The processing unit is used to generate a second secret key based on the second string;
[0030] Send the second secret key to the controlled end of the flashing device, so that the controlled end of the flashing device matches the first secret key and the second secret key, and generates a corresponding instruction;
[0031] If a flashing failure instruction is received from the controlled end of the flashing device, generate a flashing failure prompt message;
[0032] If a flashing success instruction is received from the controlled end of the flashing device, obtain the target flashing file corresponding to the target electronic control unit, and perform a flashing operation on the target electronic control unit based on the target flashing file; the target flashing file corresponds to a target encrypted flashing file, and the target encrypted flashing file is one of the n groups of encrypted flashing files.
[0033] In a fourth aspect, an embodiment of the present application provides a flashing device for an electronic control unit file, and the device includes: a receiving unit and a processing unit;
[0034] The receiving unit is used to receive a first secret key corresponding to a first string from the assisting end of the flashing device;
[0035] Receive the n groups of encrypted flashing files from the assisting end of the flashing device, and store the n groups of encrypted flashing files in the local storage area of the controlled end of the flashing device; each encrypted flashing file corresponds to an electronic control unit; n is an integer greater than 1;
[0036] Receive a second secret key corresponding to a second string from the assisting end of the flashing device; the second string is a string input to the assisting end of the flashing device for the target electronic control unit;
[0037] The processing unit is used to match the first secret key with the second secret key;
[0038] If the matching fails, delete the n groups of encrypted flashing files, and send a flashing failure instruction to the assisting end of the flashing device;
[0039] If the matching is successful, decrypt the n groups of encrypted flashing files based on the second secret key to obtain n decrypted flashing files, obtain the target flashing file corresponding to the target electronic control unit from the n decrypted flashing files, and send the target flashing file to the flashing device assistant end, and send a flashing success instruction to the flashing device assistant end.
[0040] In a fifth aspect, an embodiment of the present invention provides an electronic device, including: a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the processor so that the electronic device executes the methods in the first aspect and the second aspect.
[0041] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the methods in the first aspect and the second aspect.
[0042] In a seventh aspect, an embodiment of the present invention provides a computer program product, and the computer program product includes a non-transitory computer-readable storage medium storing a computer program, so that a computer executes the methods in the first aspect and the second aspect.
[0043] Implementing the embodiments of the present invention has the following beneficial effects:
[0044] It can be seen that the method for flashing the electronic control unit file described in the embodiments of the present invention is applied to the assisting end of the flashing device and the controlled end of the flashing device. First, the flashing file and the first string for the flashing file are obtained at the assisting end of the flashing device, the first secret key is generated based on the first string, and then the first secret key is sent to the controlled end of the flashing device. The controlled end of the flashing device receives the first secret key corresponding to the first string from the assisting end of the flashing device. The assisting end of the flashing device performs grouped encryption on the flashing file to obtain n groups of encrypted flashing files, where each encrypted flashing file corresponds to an electronic control unit, and n is an integer greater than 1. Then, the n groups of encrypted flashing files are sent to the controlled end of the flashing device. The controlled end of the flashing device receives the n groups of encrypted flashing files from the assisting end of the flashing device and stores the n groups of encrypted flashing files in the local storage area of the controlled end of the flashing device. The assisting end of the flashing device obtains the second string for the target electronic control unit, generates the second secret key based on the second string, and sends the second secret key to the controlled end of the flashing device, so as to match the first secret key and the second secret key through the controlled end of the flashing device and generate corresponding instructions. The controlled end of the flashing device receives the second secret key corresponding to the second string from the assisting end of the flashing device, and matches the first secret key and the second secret key. If the matching fails, the n groups of encrypted flashing files are deleted, and a flashing failure instruction is sent to the assisting end of the flashing device. If the matching is successful, the n groups of encrypted flashing files are decrypted based on the second secret key to obtain n decrypted flashing files, the target flashing file corresponding to the target electronic control unit is obtained from the n decrypted flashing files, and the target flashing file is sent to the assisting end of the flashing device, and a flashing success instruction is sent to the assisting end of the flashing device. If the assisting end of the flashing device receives a flashing failure instruction from the controlled end of the flashing device, a flashing failure prompt message is generated. If the assisting end of the flashing device receives a flashing success instruction from the controlled end of the flashing device, the target flashing file corresponding to the target electronic control unit is obtained, and the target electronic control unit is flashed based on the target flashing file, thereby improving the security of flashing the electronic control unit file. Description of the Drawings
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background art, the drawings required for use in the embodiments of the present application or the background art will be described below.
[0046] Figure 1 It is a schematic structural diagram of a flashing device provided by an embodiment of the present application;
[0047] Figure 2 It is a flowchart of a method for flashing an electronic control unit file provided by an embodiment of the present application;
[0048] Figure 3 It is a flowchart of a method for determining n groups of encrypted programming files provided by an embodiment of the present application;
[0049] Figure 4 It is a schematic structural diagram of a programming failure prompt message provided by an embodiment of the present application;
[0050] Figure 5 It is a flowchart of another method for programming an electronic control unit file provided by an embodiment of the present application;
[0051] Figure 6 It is a schematic structural diagram of a device for programming an electronic control unit file provided by an embodiment of the present application;
[0052] Figure 7 It is a schematic structural diagram of another device for programming an electronic control unit file provided by an embodiment of the present application;
[0053] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Specific embodiments
[0054] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without making creative efforts shall fall within the protection scope of the present application.
[0055] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally further include steps or units not listed, or may optionally further include other steps or units inherent to these processes, methods, products or devices.
[0056] Referring to "embodiment" in this context means that a specific feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The phrase appears at various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0057] First, the relevant terms involved in this application are explained as follows:
[0058] ECU: Electronic Control Unit (ECU), which is an important component in an automobile. In fact, it is a microcomputer with the functions of processing input signals, calculating and making decisions according to a preset program, and outputting control instructions. In an automobile, there are multiple ECUs with different functions, such as Engine Control Unit (ECU), Transmission Control Unit (TCU), Anti-lock Braking System Control Unit (ABS ECU), etc. Taking the engine control unit as an example, it receives signals from various sensors (such as oxygen sensors, intake air flow sensors, throttle position sensors, etc.), and these signals contain information about the engine operating state, such as speed, load, temperature, etc. The ECU calculates and analyzes according to these input signals through the control programs and algorithms stored internally, and then sends control instructions to actuators (such as fuel injectors, ignition coils, etc.) to achieve precise control of the engine, thereby optimizing the engine performance, fuel economy, emissions, etc.
[0059] Please refer to Figure 1 , Figure 1 which is a schematic structural diagram of a flashing device provided by an embodiment of this application. The flashing device 10 includes a flashing device assistance end 101 and a flashing device controlled end 102.
[0060] In this embodiment, first, the assisting end 101 of the flashing device obtains a flashing file and a first string for the flashing file, generates a first secret key based on the first string, and then sends the first secret key to the controlled end 102 of the flashing device. The controlled end 102 of the flashing device receives the first secret key corresponding to the first string from the assisting end 101 of the flashing device. The assisting end 101 of the flashing device performs grouped encryption on the flashing file to obtain n groups of encrypted flashing files, where each encrypted flashing file corresponds to an electronic control unit, and n is an integer greater than 1. Then, the n groups of encrypted flashing files are sent to the controlled end 102 of the flashing device. The controlled end 102 of the flashing device receives the n groups of encrypted flashing files from the assisting end 101 of the flashing device and stores the n groups of encrypted flashing files in the local storage area of the controlled end 102 of the flashing device. The assisting end 101 of the flashing device obtains a second string for the target electronic control unit, generates a second secret key based on the second string, and sends the second secret key to the controlled end 102 of the flashing device, so as to match the first secret key and the second secret key through the controlled end 102 of the flashing device and generate corresponding instructions. The controlled end 102 of the flashing device receives the second secret key corresponding to the second string from the assisting end 101 of the flashing device and matches the first secret key with the second secret key. If the matching fails, the n groups of encrypted flashing files are deleted, and a flashing failure instruction is sent to the assisting end 101 of the flashing device. If the matching is successful, the n groups of encrypted flashing files are decrypted based on the second secret key to obtain n decrypted flashing files, the target flashing file corresponding to the target electronic control unit is obtained from the n decrypted flashing files, and the target flashing file is sent to the assisting end 101 of the flashing device, and a flashing success instruction is sent to the assisting end 101 of the flashing device. If the assisting end 101 of the flashing device receives a flashing failure instruction from the controlled end 102 of the flashing device, a flashing failure prompt message is generated. If the assisting end 101 of the flashing device receives a flashing success instruction from the controlled end 102 of the flashing device, the target flashing file corresponding to the target electronic control unit is obtained, and a flashing operation is performed on the target electronic control unit based on the target flashing file, thereby improving the security of flashing the electronic control unit file.
[0061] Please refer to Figure 2 , Figure 2 is a flowchart of a method for flashing an electronic control unit file provided by an embodiment of the present application, including but not limited to the following steps:
[0062] S201: Obtain a flashing file and a first string for the flashing file.
[0063] In this embodiment, the flashing file is a flashing file related to the electronic control unit, that is, the ECU flashing file, which is a specific file used to update or modify the internal program and data of the automotive electronic control unit. It is used to update, repair, or optimize the software program and related parameters inside the electronic control unit. As the core control component in a vehicle or other electronic devices, the electronic control unit stores programs and configuration data for controlling various functions and operations. With the progress of technology, improvement of functions, or repair of known problems, it is necessary to change these contents of the electronic control unit. The flashing file is usually generated by automotive manufacturers, equipment producers, or professional technical teams, and includes new control logics and algorithms for improving the control mode of the electronic control unit over related systems to enhance performance, efficiency, or reliability. It also includes calibration and configuration parameters, such as the time and amount of fuel injection, ignition advance angle, valve timing, etc., to adapt to different working conditions and requirements. It also includes fault diagnosis codes and handling procedures for updating or adding detection and response measures for newly emerging faults. It also includes system compatibility and adaptation information to ensure that the flashing file can match a specific model of the electronic control unit and other hardware and software components of the vehicle.
[0064] In this embodiment, a specific input interface can be provided at the assisting end of the flashing device. The management personnel of the flashing device can directly input the first string in this interface through input devices such as keyboards and touchscreens. They can also upload a text file containing the first string to the assisting end of the flashing device. Through network connection, the management personnel of the flashing device can also input the first string in a remote web form, and then the data is transmitted to the assisting end of the flashing device. The management personnel of the flashing device can also enter the first string in a database management system associated with the assisting end of the flashing device. Using a dedicated mobile application, the management personnel of the flashing device can also input the first string on a mobile device and then synchronize it to the assisting end of the flashing device through the network.
[0065] The first string adopts the form of a combination of numbers and English letters, which means that this string can be composed of numbers (0 - 9) and English letters (including both uppercase and lowercase, such as A - Z, a - z). This combination form provides a greater possibility and flexibility. For example, "123abc", "AbC456", "XyZ098", etc. can all be first strings that meet the requirements. Compared with pure numbers or letters, the combination of numbers and letters increases the complexity of the string, improves security, and reduces the risk of being guessed or cracked. Through reasonable combination, such as combining meaningful words with numbers, it can be convenient for management personnel to remember to a certain extent, while also having a certain uniqueness and being easy to distinguish from other similar strings. It can also be flexibly customized according to different rules, coding systems, or identification requirements.
[0066] S202: Generate a first secret key based on the first string.
[0067] In this embodiment, the Advanced Encryption Standard (AES) algorithm can be used to generate a first secret key based on the first string. Specifically, first, necessary cleaning and formatting are performed on the input first string, such as removing spaces and converting to a specific encoding format. Then, the secret key length is determined. The secret key length can be 128 bits (16 bytes), 192 bits (24 bytes), or 256 bits (32 bytes), which is not limited here. If the length of the first string is insufficient to reach the selected secret key length, extension and padding are required. Apply a secure hash function, such as SHA-256 or SHA-512, to the preprocessed and padded string. The output of the hash function is a fixed-length digest value. According to the selected AES secret key length, the corresponding length of bytes is intercepted from the hash digest value as the final first secret key, or further conversion and processing are performed on the hash digest value to meet the requirements of the AES secret key. For example, if the first string is "SecretKey123", after preprocessing and padding, the hash value is calculated using SHA-256, and assume a 32-byte hash result is obtained. If a 128-bit AES secret key is selected, the first 16 bytes are intercepted from these 32 bytes as the final first secret key.
[0068] The first string can also be processed using a secure hash function (such as SHA-256, SHA-512, etc.), and the obtained hash value can be used as the first secret key. Or, using the secret key generation mechanism of a symmetric encryption algorithm (such as AES) or an asymmetric encryption algorithm (such as RSA), first preprocess the first string (such as padding, encoding conversion, etc.), and then pass it as an input parameter to the secret key generation function to generate the first secret key. Or, a randomly generated "salt" (a random character sequence) can be added to the first string first, and then the salted string is processed to generate the secret key, which can increase the randomness and security of the secret key. Or, operations such as character rearrangement, replacement, and encoding conversion are performed on the first string, and then combined with some mathematical operations (such as exclusive OR, modulo operation, etc.) to generate the final first secret key.
[0069] S203: Send the first secret key to the controlled end of the flashing device.
[0070] In this embodiment, the first secret key can be sent from the assisting end of the flashing device to the controlled end of the flashing device in the following ways: Network connection, establish a connection through network methods such as Ethernet and Wi-Fi, and use a secure communication protocol to encrypt and transmit the secret key data; Bluetooth connection, if both the assisting end and the controlled end of the flashing device support the Bluetooth function, the secret key can be transmitted after Bluetooth pairing; Storage medium transfer, store the first secret key on a removable storage device, and then transfer the storage medium from the assisting end of the flashing device to the controlled end for reading.
[0071] S204: Group-encrypt the flashing file to obtain n groups of encrypted flashing files.
[0072] In this embodiment, each encrypted flashing file corresponds to an electronic control unit, and n is an integer greater than 1. Please refer to Figure 3 , Figure 3 which is a flowchart of a method for determining n groups of encrypted flashing files provided by an embodiment of the present application, including but not limited to the following steps:
[0073] S301: Determine m encrypted file transfer channels between the assisting end of the flashing device and the controlled end of the flashing device.
[0074] In this embodiment, m is an integer greater than or equal to n. The available transfer channels can be determined by analyzing the network protocols supported by the assisting end of the flashing device and the controlled end of the flashing device. When the two end devices are in the same network environment, a port scanning tool can be used to scan the ports within a certain range to discover the open ports available for data transfer, so as to determine the potential transfer channels. The hardware interfaces of the two end devices can also be checked, such as Bluetooth modules and serial ports, which can serve as different transfer channels. The system configuration information of the device can also be viewed to understand the installed communication services and application programs. For example, some specific file transfer services or remote control software may provide specific encrypted transfer channels. If the device is in a complex network environment, the available transfer channels can also be determined by analyzing the network topology structure, determining the possible routing paths and intermediate nodes, and thus inferring the available transfer channels, so as to obtain m encrypted file transfer channels between the assisting end of the flashing device and the controlled end of the flashing device.
[0075] S302: Determine the transfer quality value corresponding to each encrypted file transfer channel among the m encrypted file transfer channels to obtain m transfer quality values.
[0076] In this embodiment, first, determine the transmission quality value corresponding to the first encrypted file transmission channel. Then, according to the method for determining the transmission quality value corresponding to the first encrypted file transmission channel, the transmission quality values corresponding to each of the m encrypted file transmission channels can be determined, and m transmission quality values are obtained.
[0077] Exemplarily, determine the data transmission rate corresponding to the first encrypted file transmission channel. The first encrypted file transmission channel is any one of the m encrypted file transmission channels. Specifically, network speed measurement tools can be installed on the assisting end and the controlled end of the flashing device respectively, and then tests are carried out through the first encrypted file transmission channel. The tool will give the corresponding data transmission rate. It is also possible to send a file of a known size from the assisting end to the controlled end and record the time taken for the transmission. The transmission rate can be calculated by dividing the file size by the transmission time. It is also possible to use network monitoring software to capture the data packets passing through this transmission channel and analyze the size and transmission time of the data packets, so as to calculate the data transmission rate corresponding to the first encrypted file transmission channel.
[0078] Exemplarily, determine the reference transmission quality value corresponding to the data transmission rate. Specifically, it can be a preset mapping relationship between the data transmission rate and the transmission quality value. Based on this mapping relationship, the reference transmission quality value corresponding to the data transmission rate can be determined.
[0079] Exemplarily, obtain the historical transmission data of the first encrypted file transmission channel. Specifically, first, it is necessary to determine whether there are relevant log records during the transmission. These logs may be stored in the local storage of the transmission device or on a specific server in the network. If so, access these logs through the corresponding permissions and interfaces. It is also possible to use data collection tools or software, which can collect relevant information on the transmission data from network devices (such as routers, switches), operating systems or applications. If there is a dedicated network monitoring system, this system may already be continuously collecting historical data on each transmission channel, including the first encrypted file transmission channel.
[0080] Exemplarily, the packet loss rate of the first encrypted file transfer channel is determined based on the historical transfer data. Specifically, from the obtained historical transfer data, the total number of packets sent and the number of successfully received packets are respectively counted, which can be achieved by analyzing the identification field or sequence number of the packets. Then, the number of lost packets is obtained by subtracting the number of successfully received packets from the total number of packets sent. Finally, the packet loss rate of the first encrypted file transfer channel is obtained by dividing the number of lost packets by the total number of packets sent. Since a high packet loss rate means that some data fails to be successfully transmitted to the destination, this will result in an incomplete or incorrect file received at the receiving end, affecting the accuracy and availability of the data. Since the lost packets need to be retransmitted, this will increase the transmission time and resource consumption, reducing the overall transmission efficiency. For applications with high real-time requirements, such as video calls or online games, packet loss will cause problems such as lag, delay, and picture distortion, seriously affecting the user experience. Frequent packet loss will make the receiving party doubt the reliability of the transmission and reduce the trust in this transmission channel. Therefore, it is necessary to first determine the packet loss rate of the first encrypted file transfer channel.
[0081] Exemplarily, a target adjustment parameter corresponding to the packet loss rate is determined. Specifically, it can be a preset mapping relationship between the packet loss rate and the adjustment parameter. Based on this mapping relationship, the target adjustment parameter corresponding to the packet loss rate can be determined.
[0082] Exemplarily, the reference transmission quality value is adjusted based on the target adjustment parameter to obtain the transmission quality value corresponding to the first encrypted file transfer channel. The specific calculation formula is as follows: The transmission quality value corresponding to the first encrypted file transfer channel = reference transmission quality value × (1 + target adjustment parameter); According to the above formula, the transmission quality value corresponding to the first encrypted file transfer channel can be obtained.
[0083] It can be seen that by comprehensively considering key factors such as data transmission rate and packet loss rate, the transmission quality of the first encrypted file transfer channel can be evaluated more comprehensively and accurately, avoiding the limitations of single-index evaluation. The corresponding reference transmission quality value is determined according to different data transmission rates, and adjustments are made in combination with the actual packet loss rate, so that the evaluation and optimization of transmission quality can adapt to different transmission conditions and requirements. By determining the target adjustment parameter corresponding to the packet loss rate to adjust the transmission quality value, it helps to timely discover and solve possible transmission problems, improve the reliability of data transmission, and accurately evaluating the transmission quality can better allocate and utilize network resources, avoiding wasting too many resources on channels with poor transmission quality.
[0084] After determining the transmission quality value corresponding to the first encrypted file transmission channel, the transmission quality value corresponding to each encrypted file transmission channel among the m encrypted file transmission channels can be determined according to the determination method of the transmission quality value corresponding to the first encrypted file transmission channel, and m transmission quality values are obtained.
[0085] S303: Determine n transmission quality values among the m transmission quality values that are greater than a preset transmission quality value.
[0086] In this embodiment, by analyzing the transmission quality data of past similar transmission channels, a quality level that can meet most normal transmission situations is found and set as the preset value. By determining the transmission quality values greater than the preset transmission quality value, those transmission channels with better performance and higher reliability can be screened out. This helps to preferentially select these high-quality channels for data transmission in subsequent operations, improving transmission efficiency and stability, understanding which channels have better transmission quality, and being able to allocate resources more reasonably. For example, important data with high requirements for transmission quality can be allocated to these high-quality channels to ensure the accurate and timely transmission of data. By comparing with the preset value, the performance of each transmission channel can be clearly understood, the overall quality level of the transmission channels in the current system can be evaluated, and a basis for system optimization and improvement can be provided. For those channels whose transmission quality values do not meet the preset standards, key investigations can be carried out to find possible problems and make improvements to enhance the transmission performance of the flashing device.
[0087] S304: Determine the n encrypted file transmission channels corresponding to the n transmission quality values.
[0088] In this embodiment, a mapping table can be created to associate each transmission quality value with the identifier of the corresponding encrypted file transmission channel, or a unique and clear identifier can be assigned to each encrypted file transmission channel to accurately identify and distinguish them. After determining the n transmission quality values, the identifiers of the corresponding n encrypted file transmission channels can be found by looking up and matching in the mapping table.
[0089] S305: Group the flashing files based on the n encrypted file transmission channels to obtain n groups of flashing sub-files.
[0090] In this embodiment, a set of flashing files is allocated to each of the n encrypted file transfer channels, and n sets of flashing sub-files can be obtained. Among them, each set of flashing files corresponds to an encrypted file transfer channel. By selecting better channels according to the transmission quality values for grouped transmission, the high speed and stability of high-quality channels can be fully utilized, the overall transmission speed of the flashing files can be accelerated, the transmission efficiency can be improved, the files are grouped and corresponding to channels with higher quality, the risk of data loss and errors during transmission is reduced, the reliability of the flashing file transmission is ensured, the situation where all data is concentrated in a few channels for transmission is avoided, the load is evenly distributed on multiple channels, the pressure on a single channel is alleviated, which helps to maintain the stable operation of the flashing device. If the transmission quality of some channels changes during the transmission process, the grouping strategy can be flexibly adjusted and the files can be reallocated to adapt to the new transmission conditions. The flashing sub-files of different groups are transmitted through different encrypted channels. Even if a security problem occurs in a certain channel, the risk of the entire flashing file leakage can be reduced, and the overall security of the data is improved.
[0091] S306: Encrypt the n sets of flashing sub-files to obtain the n sets of encrypted flashing files.
[0092] In this embodiment, for each set of flashing sub-files, an encryption operation is performed using the selected encryption algorithm and secret key. The encryption method can be encryption methods such as the Advanced Encryption Standard and asymmetric encryption algorithms. If it is symmetric encryption, the shared secret key is used to perform encryption calculation on the file content to convert the plaintext into ciphertext. If it is asymmetric encryption, the public key of the recipient is used to encrypt the file. To ensure that the encrypted file is not tampered with during transmission or storage, a message authentication code or digital signature can be added, which can be achieved by calculating the hash value of the encrypted file and signing the hash value with the private key. For example, the basic steps of encrypting a set of flashing sub-files using the Advanced Encryption Standard encryption algorithm are as follows: First, generate a 128-bit, 192-bit, or 256-bit AES secret key. Then, read the data of the flashing sub-files into the memory and group them according to the requirements of the Advanced Encryption Standard algorithm (usually 128 bits per group). Next, use the secret key to perform encryption calculation on each group to obtain the corresponding ciphertext group. Finally, combine all the ciphertext groups to form the encrypted flashing sub-files.
[0093] It can be seen that by screening out channels with transmission quality values higher than the preset value and performing grouping and transmission based on these channels, high-quality transmission resources can be fully utilized, avoiding wasting time and resources on channels with poor quality, only selecting high-quality channels for grouped transmission, reducing problems such as data retransmission and delay caused by poor channel quality, thus significantly improving the overall transmission speed and efficiency, ensuring that data is transmitted in more reliable channels, reducing the risk of data loss, damage or error, and guaranteeing the integrity and accuracy of the flashing file.
[0094] S205: Send the n groups of encrypted flashing files to the controlled end of the flashing device.
[0095] In this embodiment, the n groups of encrypted flashing files can be sent to the controlled end of the flashing device through the n encrypted file transmission channels. By using multiple channels for parallel transmission, different groups of files can be sent simultaneously, thus accelerating the overall transmission process and reducing the transmission time. If a problem occurs in a certain channel during transmission, other channels can still continue to transmit data, reducing the risk of transmission failure caused by a single-channel failure. By allocating file groups of corresponding sizes according to the transmission quality of different channels, the available network bandwidth resources can be utilized more fully. Encrypted transmission can effectively prevent data from being stolen or tampered with during transmission, ensuring the confidentiality and integrity of the flashing file.
[0096] S206: Obtain a second string for the target electronic control unit.
[0097] In this embodiment, a dedicated input box can be set on the operation interface of the assisting end of the flashing device to prompt the technician to input the second string. A barcode scanner can also be used to allow the technician to scan a QR code or barcode containing the second string to obtain relevant information. An external input device, such as a keyboard or touch screen, can also be connected to enable the technician to directly input the second string. If the flashing device is connected to the server for networking, the technician can input the second string through the web page, and then the data is transmitted to the assisting end of the flashing device, enabling the assisting end of the flashing device to obtain the second string for the target electronic control unit.
[0098] S207: Generate a second secret key based on the second string.
[0099] In this embodiment, the generation method of the first secret key can be similar to that of the second secret key. Specifically, the second secret key can be generated based on the second string using the Advanced Encryption Standard (AES) algorithm. Specifically, first, necessary cleaning and formatting are performed on the input second string, such as removing spaces and converting to a specific encoding format. Then, the key length is determined. The key length can be 128 bits (16 bytes), 192 bits (24 bytes), or 256 bits (32 bytes), which is not limited herein. If the length of the second string is not sufficient to reach the selected key length, extension and padding are required. A secure hash function, such as SHA-256 or SHA-512, is applied to the preprocessed and padded string. The output of the hash function is a fixed-length digest value. According to the selected AES key length, the corresponding number of bytes is intercepted from the hash digest value as the final second secret key, or further conversion and processing are performed on the hash digest value to meet the requirements of the AES key. For example, if the second string is "SecretKey123", after preprocessing and padding, the hash value is calculated using SHA-256. Suppose a 32-byte hash result is obtained. If a 128-bit AES key is selected, the first 16 bytes are intercepted from these 32 bytes as the final second secret key.
[0100] S208: Send the second secret key to the controlled end of the flashing device, so as to match the first secret key and the second secret key through the controlled end of the flashing device and generate corresponding instructions.
[0101] In this embodiment, through a secure network connection, the second secret key is sent to the controlled end in the form of a data packet. After the controlled end of the flashing device receives the second secret key, it matches the first secret key and the second secret key. If the match is successful, an instruction allowing the flashing operation to be executed may be generated. If the match fails, an instruction for rejecting the operation or reporting an error may be generated.
[0102] S209: If a flashing failure instruction is received from the controlled end of the flashing device, generate a flashing failure prompt message.
[0103] In this embodiment, after the assisting end of the flashing device sends flashing-related operation instructions and data to the controlled end, it will wait for the feedback from the controlled end. If the controlled end encounters problems during the flashing operation, resulting in a flashing failure, it will send a specific flashing failure instruction to the assisting end. Once the assisting end receives this flashing failure instruction, it will start the program for generating a flashing failure prompt message. Please refer to Figure 4 , Figure 4It is a schematic structural diagram of a flashing failure prompt message provided by an embodiment of the present application. Words such as "Flashing failed!" will be displayed on the display interface 40 of the assisting end of the flashing device, and then the reason for the flashing failure, "Key mismatch", will be displayed.
[0104] S2010: If a flashing success instruction is received from the controlled end of the flashing device, obtain a target flashing file corresponding to the target electronic control unit, and perform a flashing operation on the target electronic control unit based on the target flashing file.
[0105] In this embodiment, the target flashing file corresponds to a target encrypted flashing file, and the target encrypted flashing file is one of the n groups of encrypted flashing files. When the assisting end of the flashing device receives a flashing success instruction from the controlled end of the flashing device, it means that the key matching is successful. Next, obtain the target flashing file corresponding to the target electronic control unit. After obtaining the target flashing file, perform an actual flashing operation on the target electronic control unit based on this file.
[0106] It should be noted that the first key has a time limit. When a certain time is reached, the first key becomes invalid, and a new key needs to be determined again. Exemplarily, determine the first moment when the first key is sent to the controlled end of the flashing device, delete the first key at the second moment, and re-obtain the third string for the flashing file. Among them, the time difference between the first moment and the second moment is a preset time difference. The third string is re-entered by the management personnel of the flashing device. The preset time difference is the time that the first key can be used after it is generated. When this time is reached, the first key will become invalid. Therefore, the first key is deleted at the second moment, and the third string for the flashing file is re-obtained.
[0107] Exemplarily, a third secret key is generated based on the third string, so that the second secret key and the third secret key are matched by the controlled end of the flashing device, and corresponding instructions are generated. Specifically, the generation method of the third secret key corresponding to the third string is the same as that of the first secret key. First, necessary cleaning and formatting are performed on the input third string, such as removing spaces and converting to a specific encoding format. Then, the secret key length is determined. The secret key length can be 128 bits (16 bytes), 192 bits (24 bytes), and 256 bits (32 bytes), which is not limited herein. If the length of the third string is not sufficient to reach the selected secret key length, extension and padding are required. Apply a secure hash function, such as SHA-256 or SHA-512, to the preprocessed and padded string. The output of the hash function is a fixed-length digest value. According to the selected AES secret key length, the corresponding number of bytes is intercepted from the hash digest value as the final third secret key, or the hash digest value is further transformed and processed to meet the requirements of the AES secret key. For example, if the third string is "SecretKey123", after preprocessing and padding, the hash value is calculated using SHA-256. Assuming a 32-byte hash result is obtained, if a 128-bit AES secret key is selected, the first 16 bytes are intercepted from these 32 bytes as the final third secret key.
[0108] Exemplarily, the third secret key is sent to the controlled end of the flashing device. Specifically, since the first secret key has expired, the third secret key needs to be sent to the controlled end of the flashing device, so that the controlled end of the flashing device matches the second secret key and the third secret key and generates corresponding instructions.
[0109] Exemplarily, if a flashing failure instruction is received from the controlled end of the flashing device, a flashing failure prompt message is generated. If a flashing success instruction is received from the controlled end of the flashing device, the step of obtaining the target flashing file corresponding to the target electronic control unit and performing a flashing operation on the target electronic control unit based on the target flashing file is executed.
[0110] Please refer to Figure 5 , Figure 5 which is a flowchart of another method for flashing an electronic control unit file provided by the embodiment of the present application, including but not limited to the following steps:
[0111] S501: Receive a first secret key corresponding to a first string from the assisting end of the flashing device.
[0112] In this embodiment, when the assisting end of the flashing device generates the first secret key corresponding to the first string and sends the secret key to the controlled end of the flashing device, the controlled end of the flashing device receives the first secret key corresponding to the first string from the assisting end of the flashing device.
[0113] S502: Receive the n groups of encrypted flashing files from the assisting end of the flashing device, and store the n groups of encrypted flashing files in the local storage area of the controlled end of the flashing device.
[0114] In this embodiment, each encrypted flashing file corresponds to an electronic control unit, and n is an integer greater than 1. A dedicated directory can be created in the local storage of the controlled end of the flashing device to store these encrypted flashing files for easy management and search. The controlled end of the flashing device writes the received data into the local storage medium (such as a hard disk, flash memory, etc.) group by group according to specific file formats and storage rules. Receiving and storing n groups of encrypted flashing files at one time avoids frequently obtaining data from the assisting end during the flashing process, reduces the number and time of network transmissions, improves the overall efficiency. Even when there is a short interruption or instability in the network, since the files are already stored locally, the flashing operation can continue without being affected by network problems, increasing the stability and reliability of the system. Storing the encrypted files locally can better control access permissions and reduce the risk of data being stolen or tampered with during transmission.
[0115] S503: Receive the second secret key corresponding to the second string from the assisting end of the flashing device.
[0116] In this embodiment, the second string is a string input to the assisting end of the flashing device for the target electronic control unit. After the assisting end of the flashing device generates the second secret key corresponding to the second string and sends the secret key to the controlled end of the flashing device, the controlled end of the flashing device receives the second secret key corresponding to the second string from the assisting end of the flashing device.
[0117] S504: Match the first secret key with the second secret key.
[0118] In this embodiment, if the secret keys are represented in numerical form, the numerical values of the two secret keys can be directly compared. For example, if the secret keys are simple integers or floating-point numbers, directly determine whether they are equal; or calculate the hash values of the first secret key and the second secret key respectively first, and then compare whether the two hash values are the same. This method is often used for longer or more complex secret keys to improve the comparison efficiency; or use specific encryption algorithms and shared parameters to perform encryption operations on the first secret key and the second secret key. If the resulting ciphertexts are the same, it is considered that the secret keys match; if the secret keys exist in string form, compare whether the two strings are exactly the same character by character.
[0119] S505: If the matching fails, delete the n groups of encrypted flashing files, and send a flashing failure instruction to the assisting end of the flashing device.
[0120] In this embodiment, when the operation of matching the first key and the second key fails, that is, the two keys are inconsistent or do not meet the matching conditions, the controlled end of the flashing device will delete all the n groups of encrypted flashing files received and stored locally before. This is for the consideration of data security and prevention of unauthorized use. Because the key mismatch may mean that the current operation lacks legitimacy or security. Secondly, a specific flashing failure instruction is sent to the assisting end of the flashing device. The purpose of this instruction is to inform the assisting end of the flashing device that the current flashing operation fails the verification of key matching, so that the assisting end knows that the flashing is not successful and may need to take further measures, such as re-performing authorization verification or checking relevant configurations, etc.
[0121] S506: If the matching is successful, decrypt the n groups of encrypted flashing files based on the second key to obtain n decrypted flashing files, obtain the target flashing file corresponding to the target electronic control unit from the n decrypted flashing files, and send the target flashing file to the assisting end of the flashing device, and send a flashing success instruction to the assisting end of the flashing device.
[0122] In this embodiment, if the matching of the first key and the second key is successful, it means that the current operation has the corresponding permissions and security. Next, use the second key to decrypt the n groups of encrypted flashing files received before. Through decryption, the originally encrypted files are converted into a readable and usable plaintext form, thus obtaining n decrypted flashing files. Then, from these n decrypted flashing files, screen and obtain the specific target flashing file corresponding to the target electronic control unit. This target flashing file is specially prepared for the target electronic control unit. After obtaining the target flashing file, send it to the assisting end of the flashing device so that the assisting end can use this file for subsequent operations. Finally, send a flashing success instruction to the assisting end of the flashing device. This instruction is a clear signal to inform the assisting end that the entire process of decrypting, obtaining, and sending the target flashing file is successfully completed and subsequent flashing-related operations can continue.
[0123] It can be seen that through the mechanism of key matching and decryption, it is ensured that the flashing files can be obtained and used only under legal and authorized circumstances, effectively preventing unauthorized access and data leakage. Specific processing is carried out for the target electronic control unit, avoiding operating on unnecessary files, improving the accuracy and pertinence of flashing. When the matching fails, the encrypted flashing files are deleted in time to avoid the retention of invalid or incorrect data, reducing the occupation of system resources and potential error interference, and being able to adapt to the flashing requirements of multiple electronic control units. By corresponding different strings and keys to different operations, the flexibility and scalability of the system are increased.
[0124] It should be noted that it is also necessary to determine the first moment of receiving the first secret key from the assisting end of the flashing device, delete the first secret key at the second moment, and receive the third secret key corresponding to the third string. The time difference between the first moment and the second moment is a preset time difference. After the second moment, the second secret key and the third secret key are matched. If the matching fails, the n groups of encrypted flashing files are deleted, and a flashing failure instruction is sent to the assisting end of the flashing device. If the matching is successful, the n groups of encrypted flashing files are decrypted based on the second secret key to obtain n decrypted flashing files. The target flashing file corresponding to the target electronic control unit is obtained from the n decrypted flashing files, and the target flashing file is sent to the assisting end of the flashing device, and a flashing success instruction is sent to the assisting end of the flashing device. Specifically, the first secret key has timeliness, so the specific time point of receiving the first secret key from the assisting end of the flashing device is determined, and this time point is marked as the first moment. After a preset time difference, the second moment is reached. At this second moment, the previously received first secret key is deleted, and the third secret key corresponding to the third string is received. After the second moment, the second secret key and the newly received third secret key are matched. If the matching of the second secret key and the third secret key fails, the previously stored n groups of encrypted flashing files are deleted, and a flashing failure instruction is sent to the assisting end of the flashing device, indicating that this operation is not successful. If the second secret key and the third secret key match successfully, the n groups of encrypted flashing files received and stored locally before are decrypted based on the second secret key to obtain n decrypted flashing files. Then, from these n decrypted flashing files, the target flashing file corresponding to the target electronic control unit is found, sent to the assisting end of the flashing device, and a flashing success instruction is sent to the assisting end of the flashing device, indicating that subsequent related operations can be carried out.
[0125] In summary, implementing the embodiments of the present invention has the following beneficial effects:
[0126] It can be seen that the method for flashing the electronic control unit file described in the embodiments of the present invention is applied to the assisting end of the flashing device and the controlled end of the flashing device. First, the flashing file and the first string for the flashing file are obtained at the assisting end of the flashing device, and the first secret key is generated based on the first string. Then, the first secret key is sent to the controlled end of the flashing device. The controlled end of the flashing device receives the first secret key corresponding to the first string from the assisting end of the flashing device. The assisting end of the flashing device performs grouped encryption on the flashing file to obtain n groups of encrypted flashing files, where each encrypted flashing file corresponds to an electronic control unit, and n is an integer greater than 1. Then, the n groups of encrypted flashing files are sent to the controlled end of the flashing device. The controlled end of the flashing device receives the n groups of encrypted flashing files from the assisting end of the flashing device and stores the n groups of encrypted flashing files in the local storage area of the controlled end of the flashing device. The assisting end of the flashing device obtains the second string for the target electronic control unit, generates the second secret key based on the second string, and sends the second secret key to the controlled end of the flashing device to match the first secret key and the second secret key through the controlled end of the flashing device and generate corresponding instructions. The controlled end of the flashing device receives the second secret key corresponding to the second string from the assisting end of the flashing device and matches the first secret key with the second secret key. If the match fails, the n groups of encrypted flashing files are deleted, and a flashing failure instruction is sent to the assisting end of the flashing device. If the match is successful, the n groups of encrypted flashing files are decrypted based on the second secret key to obtain n decrypted flashing files, the target flashing file corresponding to the target electronic control unit is obtained from the n decrypted flashing files, and the target flashing file is sent to the assisting end of the flashing device, and a flashing success instruction is sent to the assisting end of the flashing device. If the assisting end of the flashing device receives a flashing failure instruction from the controlled end of the flashing device, a flashing failure prompt message is generated. If the assisting end of the flashing device receives a flashing success instruction from the controlled end of the flashing device, the target flashing file corresponding to the target electronic control unit is obtained, and the target electronic control unit is flashed based on the target flashing file, thereby improving the security of flashing the electronic control unit file.
[0127] Please refer to Figure 6 , Figure 6 FIG. is a schematic structural diagram of a flashing device for an electronic control unit file provided by an embodiment of the present application. The flashing device 600 for the electronic control unit file includes: an obtaining unit 601 and a processing unit 602;
[0128] The obtaining unit 601 is configured to obtain a flashing file and a first string for the flashing file;
[0129] The processing unit 602 is configured to generate a first secret key based on the first string;
[0130] Send the first secret key to the controlled end of the flashing device;
[0131] Group-encrypt the flashing file to obtain n groups of encrypted flashing files; each encrypted flashing file corresponds to an electronic control unit; n is an integer greater than 1;
[0132] Send the n groups of encrypted flashing files to the controlled end of the flashing device;
[0133] The obtaining unit 601 is configured to obtain a second string for a target electronic control unit;
[0134] The processing unit 602 is configured to generate a second secret key based on the second string;
[0135] Send the second secret key to the controlled end of the flashing device, so as to match the first secret key and the second secret key through the controlled end of the flashing device and generate a corresponding instruction;
[0136] If a flashing failure instruction is received from the controlled end of the flashing device, generate a flashing failure prompt message;
[0137] If a flashing success instruction is received from the controlled end of the flashing device, obtain a target flashing file corresponding to the target electronic control unit, and perform a flashing operation on the target electronic control unit based on the target flashing file; the target flashing file corresponds to a target encrypted flashing file, and the target encrypted flashing file is one of the n groups of encrypted flashing files.
[0138] In some possible implementation manners, in terms of group-encrypting the flashing file to obtain n groups of encrypted flashing files, the processing unit 602 is specifically configured to:
[0139] Determine m encrypted file transfer channels between the assisting end and the controlled end of the flashing device; m is an integer greater than or equal to n;
[0140] Determine the transmission quality value corresponding to each encrypted file transfer channel in the m encrypted file transfer channels to obtain m transmission quality values;
[0141] Determine n transmission quality values greater than a preset transmission quality value among the m transmission quality values;
[0142] Determine the n encrypted file transfer channels corresponding to the n transmission quality values;
[0143] Group the flashing file based on the n encrypted file transfer channels to obtain n groups of flashing sub-files; each group of flashing files corresponds to an encrypted file transfer channel;
[0144] Encrypt the n groups of flashing sub-files to obtain the n groups of encrypted flashing files.
[0145] In some possible implementation manners, in determining the transmission quality value corresponding to each encrypted file transmission channel among the m encrypted file transmission channels to obtain m transmission quality values, the processing unit 602 is specifically configured to:
[0146] Determine the data transmission rate corresponding to the first encrypted file transmission channel; the first encrypted file transmission channel is any one of the m encrypted file transmission channels;
[0147] Determine the reference transmission quality value corresponding to the data transmission rate;
[0148] Obtain the historical transmission data of the first encrypted file transmission channel;
[0149] Determine the packet loss rate of the first encrypted file transmission channel based on the historical transmission data;
[0150] Determine the target adjustment parameter corresponding to the packet loss rate;
[0151] Adjust the reference transmission quality value based on the target adjustment parameter to obtain the transmission quality value corresponding to the first encrypted file transmission channel.
[0152] In some possible implementation manners, the processing unit 602 is further specifically configured to:
[0153] Determine the first moment to send the first secret key to the controlled end of the flashing device;
[0154] Delete the first secret key at the second moment and re-obtain the third string for the flashing file; the time difference between the first moment and the second moment is a preset time difference;
[0155] Generate a third secret key based on the third string, so as to match the second secret key and the third secret key through the controlled end of the flashing device and generate corresponding instructions;
[0156] Send the third secret key to the controlled end of the flashing device;
[0157] If a flashing failure instruction is received from the controlled end of the flashing device, generate a flashing failure prompt message;
[0158] If a flashing success instruction is received from the controlled end of the flashing device, execute the step of obtaining the target flashing file corresponding to the target electronic control unit and performing a flashing operation on the target electronic control unit based on the target flashing file.
[0159] Please refer toFigure 7 , Figure 7 is a schematic structural diagram of another device for flashing an electronic control unit file provided by an embodiment of the present application. The device 700 for flashing an electronic control unit file includes: a receiving unit 701 and a processing unit 702;
[0160] The receiving unit 701 is configured to receive a first secret key corresponding to a first string from an assisting end of a flashing device;
[0161] receive the n groups of encrypted flashing files from the assisting end of the flashing device, and store the n groups of encrypted flashing files in a local storage area of a controlled end of the flashing device; each encrypted flashing file corresponds to an electronic control unit; n is an integer greater than 1;
[0162] receive a second secret key corresponding to a second string from the assisting end of the flashing device; the second string is a string input to the assisting end of the flashing device for a target electronic control unit;
[0163] The processing unit 702 is configured to match the first secret key with the second secret key;
[0164] If the matching fails, delete the n groups of encrypted flashing files, and send a flashing failure instruction to the assisting end of the flashing device;
[0165] If the matching is successful, decrypt the n groups of encrypted flashing files based on the second secret key to obtain n decrypted flashing files, obtain a target flashing file corresponding to the target electronic control unit from the n decrypted flashing files, and send the target flashing file to the assisting end of the flashing device, and send a flashing success instruction to the assisting end of the flashing device.
[0166] In some possible implementation manners, the processing unit 702 is further specifically configured to:
[0167] determine a first moment when receiving the first secret key from the assisting end of the flashing device;
[0168] delete the first secret key at a second moment, and receive a third secret key corresponding to a third string; a time difference between the first moment and the second moment is a preset time difference;
[0169] After the second moment, match the second secret key with the third secret key;
[0170] If the matching fails, delete the n groups of encrypted flashing files, and send a flashing failure instruction to the assisting end of the flashing device;
[0171] If the match is successful, decrypt the n groups of encrypted flashing files based on the second key to obtain n decrypted flashing files, obtain the target flashing file corresponding to the target electronic control unit from the n decrypted flashing files, and send the target flashing file to the flashing device assisting end, and send a flashing success instruction to the flashing device assisting end.
[0172] Please refer to Figure 8 , Figure 8 which is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. As Figure 8 shown, the electronic device 800 includes a transceiver 801, a processor 802, and a memory 803. They are connected through a bus 804. The memory 803 is used to store computer programs and data, and the transceiver 801 can transmit the data stored in the memory 803 to the processor 802. The above program includes instructions for performing the following steps:
[0173] Obtain a flashing file and a first string for the flashing file;
[0174] Generate a first key based on the first string;
[0175] Send the first key to the controlled end of the flashing device;
[0176] Perform grouped encryption on the flashing file to obtain n groups of encrypted flashing files; each encrypted flashing file corresponds to an electronic control unit; n is an integer greater than 1;
[0177] Send the n groups of encrypted flashing files to the controlled end of the flashing device;
[0178] Obtain a second string for the target electronic control unit;
[0179] Generate a second key based on the second string;
[0180] Send the second key to the controlled end of the flashing device to match the first key and the second key through the controlled end of the flashing device and generate corresponding instructions;
[0181] If a flashing failure instruction is received from the controlled end of the flashing device, generate a flashing failure prompt message;
[0182] If a flashing success instruction is received from the controlled end of the flashing device, obtain the target flashing file corresponding to the target electronic control unit, and perform a flashing operation on the target electronic control unit based on the target flashing file; the target flashing file corresponds to the target encrypted flashing file, and the target encrypted flashing file is one of the n groups of encrypted flashing files.
[0183] The above program further includes instructions for performing the following steps:
[0184] Receiving a first secret key corresponding to a first string from the assisting end of the flashing device;
[0185] Receiving the n groups of encrypted flashing files from the assisting end of the flashing device and storing the n groups of encrypted flashing files in the local storage area of the controlled end of the flashing device; each encrypted flashing file corresponds to an electronic control unit; n is an integer greater than 1;
[0186] Receiving a second secret key corresponding to a second string from the assisting end of the flashing device; the second string is a string input to the assisting end of the flashing device for a target electronic control unit;
[0187] Matching the first secret key with the second secret key;
[0188] If the matching fails, deleting the n groups of encrypted flashing files and sending a flashing failure instruction to the assisting end of the flashing device;
[0189] If the matching succeeds, decrypting the n groups of encrypted flashing files based on the second secret key to obtain n decrypted flashing files, obtaining a target flashing file corresponding to the target electronic control unit from the n decrypted flashing files, and sending the target flashing file to the assisting end of the flashing device and sending a flashing success instruction to the assisting end of the flashing device.
[0190] In some possible implementation manners, in terms of performing grouped encryption on the flashing files to obtain n groups of encrypted flashing files, the above program includes instructions for performing the following steps:
[0191] Determining m encrypted file transfer channels between the assisting end of the flashing device and the controlled end of the flashing device; m is an integer greater than or equal to n;
[0192] Determining a transmission quality value corresponding to each encrypted file transfer channel in the m encrypted file transfer channels to obtain m transmission quality values;
[0193] Determining n transmission quality values greater than a preset transmission quality value among the m transmission quality values;
[0194] Determining the n encrypted file transfer channels corresponding to the n transmission quality values;
[0195] Grouping the flashing files based on the n encrypted file transfer channels to obtain n groups of flashing sub-files; each group of flashing files corresponds to an encrypted file transfer channel;
[0196] Encrypting the n groups of flashing sub-files to obtain the n groups of encrypted flashing files.
[0197] In some possible embodiments, in determining the transmission quality value corresponding to each encrypted file transmission channel among the m encrypted file transmission channels to obtain m transmission quality values, the above program includes instructions for performing the following steps:
[0198] Determine the data transmission rate corresponding to the first encrypted file transmission channel; the first encrypted file transmission channel is any one of the m encrypted file transmission channels;
[0199] Determine the reference transmission quality value corresponding to the data transmission rate;
[0200] Obtain the historical transmission data of the first encrypted file transmission channel;
[0201] Determine the packet loss rate of the first encrypted file transmission channel based on the historical transmission data;
[0202] Determine the target adjustment parameter corresponding to the packet loss rate;
[0203] Adjust the reference transmission quality value based on the target adjustment parameter to obtain the transmission quality value corresponding to the first encrypted file transmission channel.
[0204] In some possible embodiments, the above program includes instructions for performing the following steps:
[0205] Determine the first moment to send the first secret key to the controlled end of the flashing device;
[0206] Delete the first secret key at the second moment and re-obtain the third string for the flashing file; the time difference between the first moment and the second moment is a preset time difference;
[0207] Generate a third secret key based on the third string, so as to match the second secret key and the third secret key through the controlled end of the flashing device and generate corresponding instructions;
[0208] Send the third secret key to the controlled end of the flashing device;
[0209] If a flashing failure instruction is received from the controlled end of the flashing device, generate a flashing failure prompt message;
[0210] If a flashing success instruction is received from the controlled end of the flashing device, execute the step of obtaining the target flashing file corresponding to the target electronic control unit and performing a flashing operation on the target electronic control unit based on the target flashing file.
[0211] In some possible implementation manners, the above program includes instructions for performing the following steps:
[0212] Determine a first moment when receiving the first secret key from the assisting end of the flashing device;
[0213] Delete the first secret key at a second moment and receive a third secret key corresponding to a third string; a time difference between the first moment and the second moment is a preset time difference;
[0214] After the second moment, match the second secret key and the third secret key;
[0215] If the matching fails, delete the n groups of encrypted flashing files and send a flashing failure instruction to the assisting end of the flashing device;
[0216] If the matching succeeds, decrypt the n groups of encrypted flashing files based on the second secret key to obtain n decrypted flashing files, obtain a target flashing file corresponding to the target electronic control unit from the n decrypted flashing files, and send the target flashing file to the assisting end of the flashing device and send a flashing success instruction to the assisting end of the flashing device.
[0217] It should be understood that the electronic devices in this application may include smart phones (such as Android phones, iOS phones, Windows Phone phones, etc.), tablet computers, palmtop computers, laptop computers, mobile Internet devices MID (Mobile Internet Devices, abbreviated as: MID) or wearable devices, or servers, edge computing nodes, etc. The above electronic devices are only examples, not exhaustive, and include but are not limited to the above electronic devices.
[0218] This application implementation manner also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement some or all of the steps of flashing any one of the electronic control unit files as recorded in the above method implementation manner.
[0219] This application implementation manner also provides a computer program product. The computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps of flashing any one of the electronic control unit files as recorded in the above method implementation manner.
[0220] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0221] In the above embodiments, the descriptions of the various embodiments have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0222] In the several embodiments provided by this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.
[0223] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0224] In addition, in each embodiment of this application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software program modules.
[0225] When the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned memory includes: various media such as USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), external hard drives, magnetic disks, or optical discs that can store program codes.
[0226] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program. This program can be stored in a computer-readable memory, and the memory can include: flash drives, read-only memories (English: Read-Only Memory, abbreviated: ROM), random access memories (English: Random Access Memory, abbreviated: RAM), magnetic disks, or optical discs, etc.
[0227] The above has introduced the embodiments of this application in detail. Specific examples are used in this article to elaborate on the principles and embodiments of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific embodiments and application scopes. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A method for flashing an electronic control unit file, characterized in that: Applied to the flashing device assistant, the method includes: Obtain a flash file and a first character string for the flash file; Generate a first secret key based on the first character string; Sending the first secret key to the controlled end of the flashing device; Encrypting the flash files in groups to obtain n groups of encrypted flash files; each encrypted flash file corresponds to an electronic control unit; n is an integer greater than 1; Sending the n groups of encrypted flash files to the controlled end of the flash device; Obtaining a second character string for a target electronic control unit; generating a second secret key based on the second character string; Sending the second secret key to the controlled end of the flashing device, so that the first secret key and the second secret key are matched by the controlled end of the flashing device, and a corresponding instruction is generated; If a flash failure instruction is received from the controlled end of the flash device, a flash failure prompt message is generated; If a flash success instruction is received from the controlled end of the flash device, a target flash file corresponding to the target electronic control unit is obtained, and a flash operation is performed on the target electronic control unit based on the target flash file; the target flash file corresponds to a target encrypted flash file, and the target encrypted flash file is a group of encrypted flash files among the n groups of encrypted flash files.
2. The method according to claim 1, characterized in that The step of grouping and encrypting the flash files to obtain n groups of encrypted flash files includes: Determine m encrypted file transmission channels between the flashing device assisting end and the flashing device controlled end; m is an integer greater than or equal to n; Determine a transmission quality value corresponding to each of the m encrypted file transmission channels to obtain m transmission quality values; Determining n transmission quality values among the m transmission quality values that are greater than a preset transmission quality value; Determining n encrypted file transmission channels corresponding to the n transmission quality values; The flash files are grouped based on the n encrypted file transmission channels to obtain n groups of flash sub-files; each group of flash files corresponds to one encrypted file transmission channel; The n groups of flash sub-files are encrypted to obtain the n groups of encrypted flash files.
3. The method according to claim 2, characterized in that The determining of the transmission quality value corresponding to each of the m encrypted file transmission channels to obtain m transmission quality values includes: Determine a data transmission rate corresponding to a first encrypted file transmission channel; the first encrypted file transmission channel is any one of the m encrypted file transmission channels; determining a reference transmission quality value corresponding to the data transmission rate; Acquire historical transmission data of the first encrypted file transmission channel; Determine a data packet loss rate of the first encrypted file transmission channel based on the historical transmission data; Determining a target adjustment parameter corresponding to the packet loss rate; The reference transmission quality value is adjusted based on the target adjustment parameter to obtain a transmission quality value corresponding to the first encrypted file transmission channel.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Determining a first time to send the first secret key to the controlled end of the flashing device; At a second moment, the first secret key is deleted, and a third character string for the flash file is reacquired; the time difference between the first moment and the second moment is a preset time difference; Generate a third secret key based on the third character string, so as to match the second secret key with the third secret key through the controlled end of the flashing device and generate a corresponding instruction; Sending the third secret key to the controlled end of the flashing device; If a flash failure instruction is received from the controlled end of the flash device, a flash failure prompt message is generated; If a flash success instruction is received from the controlled end of the flash device, the steps of obtaining a target flash file corresponding to the target electronic control unit and performing a flash operation on the target electronic control unit based on the target flash file are executed.
5. A method for flashing an electronic control unit file, characterized in that: Applied to the controlled end of the flashing device, the method includes: receiving a first secret key corresponding to the first character string from the flashing device assistant; Receive the n groups of encrypted flash files from the flash device assisting end, and store the n groups of encrypted flash files in the local storage area of the flash device controlled end; each encrypted flash file corresponds to an electronic control unit; n is an integer greater than 1; receiving a second secret key corresponding to a second character string from the flashing device assistant terminal; the second character string is a character string input to the flashing device assistant terminal for a target electronic control unit; Matching the first secret key with the second secret key; If the match fails, the n groups of encrypted flash files are deleted, and a flash failure instruction is sent to the flash device assistant; If the match is successful, the n groups of encrypted flash files are decrypted based on the second secret key to obtain n decrypted flash files, the target flash file corresponding to the target electronic control unit is obtained from the n decrypted flash files, and the target flash file is sent to the flash device assistant end, and a flash success instruction is sent to the flash device assistant end.
6. The method according to claim 5, characterized in that The method further comprises: Determining a first time instant of receiving the first secret key from the flashing device assisting end; At a second moment, the first secret key is deleted, and a third secret key corresponding to a third character string is received; the time difference between the first moment and the second moment is a preset time difference; After the second moment, matching the second secret key with the third secret key; If the match fails, the n groups of encrypted flash files are deleted, and a flash failure instruction is sent to the flash device assistant; If the match is successful, the n groups of encrypted flash files are decrypted based on the second secret key to obtain n decrypted flash files, the target flash file corresponding to the target electronic control unit is obtained from the n decrypted flash files, and the target flash file is sent to the flash device assistant end, and a flash success instruction is sent to the flash device assistant end.
7. A device for flashing files of an electronic control unit, characterized in that: The electronic control unit file flashing device is used for executing the instructions of the steps in the method according to any one of claims 1 to 4, and the device comprises: an acquisition unit and a processing unit; The acquisition unit is used to acquire a flash file and a first character string for the flash file; The processing unit is configured to generate a first secret key based on the first character string; Sending the first secret key to the controlled end of the flashing device; Encrypting the flash files in groups to obtain n groups of encrypted flash files; each encrypted flash file corresponds to an electronic control unit; n is an integer greater than 1; Sending the n groups of encrypted flash files to the controlled end of the flash device; The acquisition unit is used to acquire a second character string for a target electronic control unit; The processing unit is configured to generate a second secret key based on the second character string; Sending the second secret key to the controlled end of the flashing device, so that the first secret key and the second secret key are matched by the controlled end of the flashing device, and a corresponding instruction is generated; If a flash failure instruction is received from the controlled end of the flash device, a flash failure prompt message is generated; If a flash success instruction is received from the controlled end of the flash device, a target flash file corresponding to the target electronic control unit is obtained, and a flash operation is performed on the target electronic control unit based on the target flash file; the target flash file corresponds to a target encrypted flash file, and the target encrypted flash file is a group of encrypted flash files among the n groups of encrypted flash files.
8. A device for flashing files of an electronic control unit, characterized in that: The electronic control unit file flashing device is used for executing the instructions of the steps in the method of claim 5 or claim 6, and the device comprises: a receiving unit and a processing unit; The receiving unit is used to receive a first secret key corresponding to the first character string from the flashing device assisting end; Receive the n groups of encrypted flash files from the flash device assisting end, and store the n groups of encrypted flash files in the local storage area of the flash device controlled end; each encrypted flash file corresponds to an electronic control unit; n is an integer greater than 1; receiving a second secret key corresponding to a second character string from the flashing device assistant terminal; the second character string is a character string input to the flashing device assistant terminal for a target electronic control unit; The processing unit is configured to match the first secret key with the second secret key; If the match fails, the n groups of encrypted flash files are deleted, and a flash failure instruction is sent to the flash device assistant; If the match is successful, the n groups of encrypted flash files are decrypted based on the second secret key to obtain n decrypted flash files, the target flash file corresponding to the target electronic control unit is obtained from the n decrypted flash files, and the target flash file is sent to the flash device assistant end, and a flash success instruction is sent to the flash device assistant end.
9. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the one or more programs include methods for executing any one of claims 1-6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 6.