Software upgrading method and device, computer program product, storage medium and vehicle
By using a security key to have hash calculation and signature verification during the software upgrade process, the problem that software upgrade packages in the existing technology cannot verify integrity and authentication is solved, and the security and reliability of vehicle controller software upgrades are achieved. Sex improvement.
Patent Information
- Application Number
- CN202411095118.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-12-17
AI Technical Summary
The existing technology cannot effectively verify the integrity and authentication of the software upgrade package, resulting in hidden dangers in information security of intelligent connected vehicles.
During the software upgrade process, the server generates a security key, performs hash calculation and signature verification, generates an upgrade file, and authenticates it through the public key and upgrade file to ensure the legality and integrity of the software upgrade.
Through signature verification and version comparison, we ensure the security and reliability of software upgrades, prevent the software version from being tampered with or downgraded, and improve the software upgrade security of vehicle controllers.
Smart Images

Figure CN119149064A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle technology, and in particular to a software upgrading method, device, computer program product, storage medium, and vehicle. Background Art
[0002] With the gradual application and promotion of autonomous driving technology in intelligent connected vehicles, how to ensure the security of firmware flashing of vehicle microcontroller units (MCU) becomes extremely important. At present, the traditional flashing method is to flash the entire new software upgrade package into the MCU by a diagnostic instrument through the on-board diagnostic system (OBD) or over-the-air technology (OTA). In order to prevent transmission errors caused by electronic and electrical characteristics during data transmission, the existing technology usually uses a cyclic redundancy check (CRC) or a checksum verification method. However, the existing verification method can only ensure that the software upgrade package has no errors caused by transmission, and cannot verify the identity of the sender and whether it has been tampered with. Therefore, the existing technology cannot guarantee the integrity and authentication of the software upgrade package, cannot meet the information security requirements of intelligent connected vehicles, and has great information security risks.
[0003] From the above analysis, it can be seen that the above-mentioned prior art can only verify whether an error occurs in the data transmission process of the upgrade software package, resulting in poor security of the software upgrade process. Currently, no effective solution has been proposed. Summary of the invention
[0004] Embodiments of the present invention provide a software upgrade method, device, computer program product, storage medium, and vehicle to at least solve the technical problem that the prior art can only verify whether an upgrade software package has an error during data transmission, resulting in poor security of the software upgrade process.
[0005] According to one aspect of an embodiment of the present invention, there is provided a software upgrade method applied to a server, comprising:
[0006] Generate a security key to be used, wherein the security key includes a private key and a public key; perform hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller side; use the private key to sign the first message digest to obtain a signature value; generate an upgrade file based on the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is the target version number of the software to be upgraded represented by the software upgrade package; transmit the public key and the upgrade file to the vehicle controller side, so that the vehicle controller side upgrades the software to be upgraded according to the public key and the upgrade file.
[0007] According to another aspect of an embodiment of the present invention, there is provided a software upgrade method applied to a vehicle controller, comprising:
[0008] Receive a public key and an upgrade file from a server, wherein the upgrade file is generated according to a software upgrade package, a first message digest, a signature value, and a first version number, the first version number being a target version number of the software to be upgraded represented by the software upgrade package, the software upgrade package being used to upgrade the software to be upgraded on the vehicle controller side, the first message digest being obtained by performing a hash calculation on the software upgrade package, and the signature value being obtained by signing the first message digest using a private key of the server; and upgrade the software to be upgraded according to the public key and the upgrade file.
[0009] Optionally, upgrading the software to be upgraded according to the public key and the upgrade file includes: obtaining a first version number from the upgrade file; comparing the first version number with the second version number to obtain a first comparison result, wherein the second version number is the current version number of the software to be upgraded on the vehicle controller side; in response to the first comparison result, determining that the first version number is greater than the second version number, decrypting the signature value using the public key to obtain a second message digest; comparing the first message digest with the second message digest to obtain a second comparison result; in response to the second comparison result, determining that the first message digest is equal to the second message digest, writing the software upgrade package to the vehicle controller side, and performing a hash calculation on the software upgrade package to obtain a third message digest; comparing the first message digest with the third message digest to obtain a third comparison result; in response to the third comparison result, determining that the first message digest is equal to the third message digest, completing the software upgrade.
[0010] Optionally, the above-mentioned software upgrade method also includes: terminating the current software upgrade process in response to satisfying one of the following conditions: determining based on the first comparison result that the first version number is less than or equal to the second version number; determining based on the second comparison result that the first message digest is not equal to the second message digest; determining based on the third comparison result that the first message digest is not equal to the third message digest.
[0011] According to another aspect of an embodiment of the present invention, there is further provided a software upgrade device, comprising:
[0012] The first generation module is used to generate a security key to be used, wherein the security key includes a private key and a public key; the calculation module is used to perform hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller side; the processing module is used to sign the first message digest using the private key to obtain a signature value; the second generation module is used to generate an upgrade file according to the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is the target version number of the software to be upgraded represented by the software upgrade package; the communication module is used to transmit the public key and the upgrade file to the vehicle controller side, so that the vehicle controller side upgrades the software to be upgraded according to the public key and the upgrade file.
[0013] According to another aspect of an embodiment of the present invention, there is further provided a software upgrade device, comprising:
[0014] A receiving module is used to receive a public key and an upgrade file from a server, wherein the upgrade file is generated according to a software upgrade package, a first message digest, a signature value and a first version number, the first version number being a target version number of the software to be upgraded represented by the software upgrade package, the software upgrade package being used to upgrade the software to be upgraded on the vehicle controller side, the first message digest being obtained by performing a hash calculation on the software upgrade package, and the signature value being obtained by signing the first message digest using a private key of the server; an upgrading module is used to upgrade the software to be upgraded according to the public key and the upgrade file.
[0015] Optionally, the above-mentioned upgrade module is also used to: obtain a first version number from the upgrade file; compare the first version number with the second version number to obtain a first comparison result, wherein the second version number is the current version number of the software to be upgraded on the vehicle controller side; in response to the first comparison result, determine that the first version number is greater than the second version number, use the public key to decrypt the signature value to obtain a second message digest; compare the first message digest with the second message digest to obtain a second comparison result; in response to the second comparison result, determine that the first message digest is equal to the second message digest, write the software upgrade package to the vehicle controller side, and perform hash calculation on the software upgrade package to obtain a third message digest; compare the first message digest with the third message digest to obtain a third comparison result; in response to the third comparison result, determine that the first message digest is equal to the third message digest, and complete the software upgrade.
[0016] Optionally, the above-mentioned software upgrade device also includes: a termination module, used to terminate the current software upgrade process in response to satisfying one of the following conditions: determining that the first version number is less than or equal to the second version number based on the first comparison result; determining that the first message digest is not equal to the second message digest based on the second comparison result; determining that the first message digest is not equal to the third message digest based on the third comparison result.
[0017] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, any one of the aforementioned software upgrade methods is implemented.
[0018] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the software upgrade method of any one of the preceding claims.
[0019] According to another aspect of an embodiment of the present invention, a vehicle is provided, comprising an on-board memory and an on-board processor, wherein a computer program is stored in the on-board memory, and the on-board processor is configured to run the computer program to execute the software upgrade method of any one of the preceding claims.
[0020] In an embodiment of the present invention, the server first generates a security key to be used, wherein the security key includes a private key and a public key, then performs a hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller, and then uses the private key to sign the first message digest to obtain a signature value, and then generates an upgrade file according to the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is the target version number of the software to be upgraded represented by the software upgrade package, and further, the server transmits the public key and the upgrade file to the vehicle controller, so that the vehicle controller upgrades the software to be upgraded according to the public key and the upgrade file. By performing signature verification and software version comparison before writing the software upgrade package into the vehicle controller, the purpose of ensuring the legitimacy of the source of the software written into the vehicle controller and preventing the software version from being downgraded is achieved, thereby achieving the technical effect of improving the security and reliability of the vehicle controller software upgrade, thereby solving the technical problem that the prior art can only verify whether the upgrade software package has an error during the data transmission process, resulting in poor security of the software upgrade process. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0022] Figure 1 is a hardware structure block diagram of a vehicle terminal for a software upgrade method according to an optional embodiment of the present invention;
[0023] Figure 2 is a flow chart of a software upgrade method applied to a server according to an embodiment of the present invention;
[0024] Figure 3 is a flow chart of a software upgrade method applied to a vehicle controller according to an embodiment of the present invention;
[0025] Figure 4 is a schematic diagram of a software upgrade process according to an embodiment of the present invention;
[0026] Figure 5 is a structural block diagram of a software upgrading device applied to a server according to an embodiment of the present invention;
[0027] Figure 6 The present invention is a structural block diagram of a software upgrade device applied to a vehicle controller according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] According to an embodiment of the present invention, a method embodiment of a software upgrade method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0031] Figure 1 is a hardware structure block diagram of a vehicle terminal for a software upgrade method according to an embodiment of the present invention, such as Figure 1As shown, the vehicle terminal (or mobile device) may include one or more processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor (Microcontroller Unit, MCU) or a programmable logic device (FieldProgrammable Gate Array, FPGA)), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display device 110, an input and output device 108 (i.e., an IO device), a Universal Serial Bus (USB) port (which may be included as one of the ports of a computer bus, not shown in the figure), a network interface (not shown in the figure), a power supply (not shown in the figure) and / or a camera (not shown in the figure). It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the vehicle terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0032] It should be noted that the one or more processors 102 and / or other data processing circuits may be embodied in whole or in part as software, hardware, firmware or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be integrated in whole or in part into any of the other components in the vehicle terminal (or mobile device).
[0033] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the software upgrade method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the above-mentioned software upgrade method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the vehicle terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0034] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the vehicle terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0035] Under the above operating environment, the embodiment of the present invention provides the following Figure 2 The software upgrade method shown is Figure 2 is a flow chart of a software upgrade method applied to a server according to an embodiment of the present invention. Figure 2 As shown, the method includes the following implementation steps:
[0036] Step S201, generating a security key to be used, wherein the security key includes a private key and a public key;
[0037] Step S202, performing hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller end;
[0038] Step S203, using the private key to sign the first message digest to obtain a signature value;
[0039] Step S204, generating an upgrade file according to the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is the target version number of the software to be upgraded represented by the software upgrade package;
[0040] Step S205, transmitting the public key and the upgrade file to the vehicle controller, so that the vehicle controller upgrades the software to be upgraded according to the public key and the upgrade file.
[0041] The following combination Figure 4 The above method is further explained.
[0042] Figure 4 is a schematic diagram of a software upgrade process according to an embodiment of the present invention, such as Figure 4As shown, in the present invention, when performing software upgrade on the vehicle controller, the server side can use an encryption algorithm to generate a security key, and the encryption algorithm may include but is not limited to: a symmetric encryption algorithm (such as: Advanced Encryption Standard, Data Encryption Standard), an asymmetric encryption algorithm (such as: Digital Signature Algorithm), preferably, the present invention uses an asymmetric encryption algorithm to generate a security key. It should be noted that the private key in the security key can be used to encrypt and digitally sign important data (such as: software upgrade package) for transmission, and the public key in the security key can be stored in the memory (such as: non-volatile memory) of the vehicle controller by diagnosing the vehicle controller offline. It can be understood that in the vehicle controller, the public key can only be read but not changed.
[0043] Furthermore, since the software upgrade package may be relatively large, in order to reduce the time of software upgrade verification, a hash algorithm (or hash function) can be used to perform hash calculation on the software upgrade package to obtain the first message digest H1. It should be noted here that the hash algorithm used for hash calculation can be the SHA256 algorithm.
[0044] Next, the server uses the generated private key to digitally sign the first message digest H1 to obtain the signature value S1. It should be noted here that the signature algorithm used for digital signature can be the RSA-2048 algorithm. After obtaining the first message digest H1 and the signature value S1, an upgrade file is generated according to the software upgrade package, the first message digest H1, the signature value S1 and the first version number V1 represented by the software upgrade package, and the upgrade file is transmitted to the vehicle controller via the controller area network bus (Controller Area Network, CAN) using OBD or OTA. After receiving the upgrade file, the vehicle controller performs identity authentication and upgrades the software to be upgraded after the authentication is passed.
[0045] In the above operating environment, the embodiment of the present invention also provides the following Figure 3 The software upgrade method shown is Figure 3 is a flow chart of a software upgrade method applied to a vehicle controller according to an embodiment of the present invention. Figure 3 As shown, the method includes the following implementation steps:
[0046] Step S301, receiving a public key and an upgrade file from a server, wherein the upgrade file is generated according to a software upgrade package, a first message digest, a signature value, and a first version number, the first version number being a target version number of the software to be upgraded represented by the software upgrade package, the software upgrade package being used to upgrade the software to be upgraded on the vehicle controller, the first message digest being obtained by performing a hash calculation on the software upgrade package, and the signature value being obtained by signing the first message digest using a private key of the server;
[0047] Step S302: Upgrade the software to be upgraded according to the public key and the upgrade file.
[0048] Still Figure 4 As shown, after the vehicle controller receives the upgrade file transmitted by the server, it extracts the upgrade information in the upgrade file and verifies the upgrade information, so as to upgrade the software to be upgraded using the software upgrade package after the verification passes.
[0049] In an embodiment of the present invention, the server first generates a security key to be used, wherein the security key includes a private key and a public key, then performs a hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller, and then uses the private key to sign the first message digest to obtain a signature value, and then generates an upgrade file according to the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is the target version number of the software to be upgraded represented by the software upgrade package, and further, the server transmits the public key and the upgrade file to the vehicle controller, so that the vehicle controller upgrades the software to be upgraded according to the public key and the upgrade file. By performing signature verification and software version comparison before writing the software upgrade package into the vehicle controller, the purpose of ensuring the legitimacy of the source of the software written into the vehicle controller and preventing the software version from being downgraded is achieved, thereby achieving the technical effect of improving the security and reliability of the vehicle controller software upgrade, thereby solving the technical problem that the prior art can only verify whether the upgrade software package has an error during the data transmission process, resulting in poor security of the software upgrade process.
[0050] The above method of the embodiment of the present invention is further introduced below.
[0051] In an optional embodiment, in step S302, upgrading the software to be upgraded according to the public key and the upgrade file includes:
[0052] Step S321, obtaining a first version number from the upgrade file;
[0053] Step S322, comparing the first version number with the second version number to obtain a first comparison result, wherein the second version number is the current version number of the software to be upgraded on the vehicle controller side;
[0054] Step S323, in response to the first comparison result determining that the first version number is greater than the second version number, decrypting the signature value using the public key to obtain a second message digest;
[0055] Step S324, comparing the first message digest with the second message digest to obtain a second comparison result;
[0056] Step S325, in response to the second comparison result determining that the first message digest is equal to the second message digest, writing the software upgrade package to the vehicle controller end, and performing a hash calculation on the software upgrade package to obtain a third message digest;
[0057] Step S326, comparing the first message digest with the third message digest to obtain a third comparison result;
[0058] Step S327: In response to the third comparison result determining that the first message digest is equal to the third message digest, the software upgrade is completed.
[0059] Still Figure 4 As shown, after the vehicle controller receives the upgrade file, it first extracts the first version number V1 in the upgrade file, and compares the first version number V1 with the current version number (second version number V2) of the software to be upgraded. Specifically, the release time of the first version number V1 can be compared with the release time of the second version number V2. When the release time of the first version number V1 is earlier than the release time of the second version number V2, it is determined that the first version number V1 is greater than the second version number V2, and the signature value S1 is decrypted using the public key pre-stored in the memory to obtain the second message digest H2. Then, the first message digest H1 is compared with the second message digest H2. When the comparison determines that the first message digest H1 is equal to the second message digest H2, it indicates that the software upgrade package is issued by the server, that is, it indicates that the software upgrade package transmitted to the vehicle controller is legal and valid. Furthermore, the software upgrade package is started to be written into the vehicle controller end, and the SHA256 algorithm can be used to perform hash calculation on the software upgrade package to obtain a third message digest H3, and then the third message digest H3 is compared with the first message digest H1 to see whether the two are equal. When the comparison determines that the third message digest H3 is equal to the first message digest H1, it indicates that the software upgrade package has not been tampered with during the transmission process, and the software to be upgraded can be securely upgraded.
[0060] In an optional embodiment, the software upgrade method applied to the vehicle controller side further includes:
[0061] Step S303, in response to satisfying one of the following conditions, terminate the current software upgrade process: determining based on the first comparison result that the first version number is less than or equal to the second version number; determining based on the second comparison result that the first message digest is not equal to the second message digest; determining based on the third comparison result that the first message digest is not equal to the third message digest.
[0062] Still Figure 4As shown, during the verification of the upgrade information on the vehicle controller side, when the comparison determines that the first version number V1 is less than or equal to the second version number V2 (such as: the release time of the first version number V1 is later than or equal to the release time of the second version number V2), or when the comparison determines that the first message digest H1 is not equal to the second message digest H2, or when the comparison determines that the first message digest H1 is not equal to the third message digest H3, the vehicle controller side abandons the current upgrade and waits for the next upgrade.
[0063] In an embodiment of the present invention, the server first generates a security key to be used, wherein the security key includes a private key and a public key, then performs a hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller, and then uses the private key to sign the first message digest to obtain a signature value, and then generates an upgrade file according to the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is the target version number of the software to be upgraded represented by the software upgrade package, and further, the server transmits the public key and the upgrade file to the vehicle controller, so that the vehicle controller upgrades the software to be upgraded according to the public key and the upgrade file. By performing signature verification and software version comparison before writing the software upgrade package into the vehicle controller, the purpose of ensuring the legitimacy of the source of the software written into the vehicle controller and preventing the software version from being downgraded is achieved, thereby achieving the technical effect of improving the security and reliability of the vehicle controller software upgrade, thereby solving the technical problem that the prior art can only verify whether the upgrade software package has an error during the data transmission process, resulting in poor security of the software upgrade process.
[0064] In this embodiment, a software upgrade device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, a "module" is a combination of software and / or hardware that can implement a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0065] Figure 5 is a structural block diagram of a software upgrade device applied to a server according to an embodiment of the present invention. Figure 5 As shown, the device comprises:
[0066] A first generating module 501 is used to generate a security key to be used, wherein the security key includes a private key and a public key;
[0067] A calculation module 502 is used to perform a hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller end;
[0068] The processing module 503 is used to sign the first message digest using the private key to obtain a signature value;
[0069] A second generating module 504 is used to generate an upgrade file according to the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is a target version number of the software to be upgraded represented by the software upgrade package;
[0070] The communication module 505 is used to transmit the public key and the upgrade file to the vehicle controller end, so that the vehicle controller end upgrades the software to be upgraded according to the public key and the upgrade file.
[0071] Figure 6 is a structural block diagram of a software upgrade device applied to a vehicle controller according to an embodiment of the present invention. Figure 6 As shown, the device comprises:
[0072] The receiving module 601 is used to receive a public key and an upgrade file from a server, wherein the upgrade file is generated according to a software upgrade package, a first message digest, a signature value and a first version number, the first version number is a target version number of the software to be upgraded represented by the software upgrade package, the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller, the first message digest is obtained by performing a hash calculation on the software upgrade package, and the signature value is obtained by signing the first message digest using a private key of the server;
[0073] The upgrade module 602 is used to upgrade the software to be upgraded according to the public key and the upgrade file.
[0074] Optionally, the above-mentioned upgrade module 602 is also used to: obtain a first version number from the upgrade file; compare the first version number with the second version number to obtain a first comparison result, wherein the second version number is the current version number of the software to be upgraded on the vehicle controller side; in response to the first comparison result, determine that the first version number is greater than the second version number, use the public key to decrypt the signature value to obtain a second message digest; compare the first message digest with the second message digest to obtain a second comparison result; in response to the second comparison result, determine that the first message digest is equal to the second message digest, write the software upgrade package to the vehicle controller side, and perform hash calculation on the software upgrade package to obtain a third message digest; compare the first message digest with the third message digest to obtain a third comparison result; in response to the third comparison result, determine that the first message digest is equal to the third message digest, and complete the software upgrade.
[0075] Optionally, the above-mentioned software upgrade device also includes: a termination module 603, which is used to terminate the current software upgrade process in response to satisfying one of the following conditions: determining that the first version number is less than or equal to the second version number based on the first comparison result; determining that the first message digest is not equal to the second message digest based on the second comparison result; determining that the first message digest is not equal to the third message digest based on the third comparison result.
[0076] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0077] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, any one of the aforementioned software upgrade methods is implemented.
[0078] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the software upgrade method of any one of the preceding claims.
[0079] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0080] Step S41, generating a security key to be used, wherein the security key includes a private key and a public key;
[0081] Step S42, performing hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller end;
[0082] Step S43, using the private key to sign the first message digest to obtain a signature value;
[0083] Step S44, generating an upgrade file according to the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is a target version number of the software to be upgraded represented by the software upgrade package;
[0084] Step S45, transmitting the public key and the upgrade file to the vehicle controller end, so that the vehicle controller end upgrades the software to be upgraded according to the public key and the upgrade file.
[0085] Or, optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0086] Step S51, receiving a public key and an upgrade file from a server, wherein the upgrade file is generated according to a software upgrade package, a first message digest, a signature value, and a first version number, the first version number being a target version number of the software to be upgraded represented by the software upgrade package, the software upgrade package being used to upgrade the software to be upgraded on the vehicle controller, the first message digest being obtained by performing a hash calculation on the software upgrade package, and the signature value being obtained by signing the first message digest using a private key of the server;
[0087] Step S52: Upgrade the software to be upgraded according to the public key and the upgrade file.
[0088] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0089] According to another aspect of an embodiment of the present invention, a vehicle is provided, comprising an on-board memory and an on-board processor, wherein a computer program is stored in the on-board memory, and the on-board processor is configured to run the computer program to execute the software upgrade method of any one of the preceding claims.
[0090] Optionally, in this embodiment, the vehicle-mounted processor may be configured to perform the following steps through a computer program:
[0091] Step S41, generating a security key to be used, wherein the security key includes a private key and a public key;
[0092] Step S42, performing hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller end;
[0093] Step S43, using the private key to sign the first message digest to obtain a signature value;
[0094] Step S44, generating an upgrade file according to the software upgrade package, the first message digest, the signature value and the first version number, wherein the first version number is a target version number of the software to be upgraded represented by the software upgrade package;
[0095] Step S45, transmitting the public key and the upgrade file to the vehicle controller end, so that the vehicle controller end upgrades the software to be upgraded according to the public key and the upgrade file.
[0096] Alternatively, optionally, in this embodiment, the vehicle-mounted processor may be configured to perform the following steps through a computer program:
[0097] Step S51, receiving a public key and an upgrade file from a server, wherein the upgrade file is generated according to a software upgrade package, a first message digest, a signature value, and a first version number, the first version number being a target version number of the software to be upgraded represented by the software upgrade package, the software upgrade package being used to upgrade the software to be upgraded on the vehicle controller, the first message digest being obtained by performing a hash calculation on the software upgrade package, and the signature value being obtained by signing the first message digest using a private key of the server;
[0098] Step S52: Upgrade the software to be upgraded according to the public key and the upgrade file.
[0099] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiment and its optional implementation modes, and this embodiment will not be described in detail here.
[0100] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0101] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0102] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0103] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0104] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0105] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, magnetic disk or optical disk, etc., various media that can store program codes.
[0106] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A software upgrade method, It is characterized in that include: Generate a security key to be used, wherein the security key includes a private key and a public key; Performing hash calculation on the software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller end; Signing the first message digest using the private key to obtain a signature value; Generate an upgrade file according to the software upgrade package, the first message digest, the signature value and a first version number, wherein the first version number is a target version number of the software to be upgraded represented by the software upgrade package; The public key and the upgrade file are transmitted to the vehicle controller end, so that the vehicle controller end upgrades the software to be upgraded according to the public key and the upgrade file.
2. A software upgrade method, It is characterized in that include: Receive a public key and an upgrade file from a server, wherein the upgrade file is generated according to a software upgrade package, a first message digest, a signature value, and a first version number, wherein the first version number is a target version number of the software to be upgraded represented by the software upgrade package, the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller, the first message digest is obtained by performing a hash calculation on the software upgrade package, and the signature value is obtained by signing the first message digest using the private key of the server; The software to be upgraded is upgraded according to the public key and the upgrade file.
3. The software upgrade method according to claim 2, It is characterized in that Upgrading the software to be upgraded according to the public key and the upgrade file includes: Obtain the first version number from the upgrade file; Comparing the first version number with the second version number to obtain a first comparison result, wherein the second version number is the current version number of the software to be upgraded at the vehicle controller end; In response to determining that the first version number is greater than the second version number as a result of the first comparison, decrypting the signature value using the public key to obtain a second message digest; comparing the first message digest with the second message digest to obtain a second comparison result; In response to determining that the first message digest is equal to the second message digest as a result of the second comparison, writing the software upgrade package to the vehicle controller end, and performing a hash calculation on the software upgrade package to obtain a third message digest; comparing the first message digest with the third message digest to obtain a third comparison result; In response to the third comparison result determining that the first message digest is equal to the third message digest, the software upgrade is completed.
4. The software upgrade method according to claim 3, It is characterized in that The software upgrade method further includes: The current software upgrade process is terminated if one of the following conditions is met: Determining, based on the first comparison result, that the first version number is less than or equal to the second version number; determining, based on the second comparison result, that the first message digest is not equal to the second message digest; Based on the third comparison result, it is determined that the first message digest is not equal to the third message digest.
5. A software upgrade device, It is characterized in that include: A first generating module, used to generate a security key to be used, wherein the security key includes a private key and a public key; A calculation module, used for performing hash calculation on a software upgrade package to obtain a first message digest, wherein the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller end; A processing module, configured to sign the first message digest using the private key to obtain a signature value; A second generating module, configured to generate an upgrade file according to the software upgrade package, the first message digest, the signature value and a first version number, wherein the first version number is a target version number of the software to be upgraded represented by the software upgrade package; The communication module is used to transmit the public key and the upgrade file to the vehicle controller end, so that the vehicle controller end upgrades the software to be upgraded according to the public key and the upgrade file.
6. A software upgrade device, It is characterized in that include: a receiving module, configured to receive a public key and an upgrade file from a server, wherein the upgrade file is generated according to a software upgrade package, a first message digest, a signature value, and a first version number, wherein the first version number is a target version number of the software to be upgraded represented by the software upgrade package, the software upgrade package is used to upgrade the software to be upgraded on the vehicle controller, the first message digest is obtained by performing a hash calculation on the software upgrade package, and the signature value is obtained by signing the first message digest using the private key of the server; An upgrade module is used to upgrade the software to be upgraded according to the public key and the upgrade file.
7. The software upgrade device according to claim 6, It is characterized in that The upgrade module is also used to: obtain the first version number from the upgrade file; compare the first version number with the second version number to obtain a first comparison result, wherein the second version number is the current version number of the software to be upgraded at the vehicle controller end; in response to the first comparison result, determine that the first version number is greater than the second version number, use the public key to decrypt the signature value to obtain a second message digest; compare the first message digest with the second message digest to obtain a second comparison result; in response to the second comparison result, determine that the first message digest is equal to the second message digest, write the software upgrade package to the vehicle controller end, and perform hash calculation on the software upgrade package to obtain a third message digest; compare the first message digest with the third message digest to obtain a third comparison result; in response to the third comparison result, determine that the first message digest is equal to the third message digest, and complete the software upgrade.
8. The software upgrade device according to claim 7, It is characterized in that The software upgrade device also includes: a termination module, used to terminate the current software upgrade process in response to satisfying one of the following conditions: determining that the first version number is less than or equal to the second version number based on the first comparison result; determining that the first message digest is not equal to the second message digest based on the second comparison result; determining that the first message digest is not equal to the third message digest based on the third comparison result.
9. A computer program product comprising a computer program, It is characterized in that The computer program implements the software upgrade method of claim 1 when executed by a processor, or the computer program implements the software upgrade method of any one of claims 2 to 4 when executed by a processor.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the software upgrade method of claim 1, or when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the software upgrade method of any one of claims 2 to 4.
11. A vehicle, It is characterized in that The invention comprises an on-board memory and an on-board processor, wherein the on-board memory stores a computer program, and the on-board processor is configured to run the computer program to execute the software upgrade method of claim 1, or the on-board processor is configured to run the computer program to execute the software upgrade method of any one of claims 2 to 4.
Citation Information
Cited By
Diagnostic apparatus, control method, storage medium, and program product
CN119882567A
