Embedded device upgrading method supporting multiple hardware platforms
By using upgrade mirrors with digital signatures and application verification files during the embedded device upgrade process, security risks and hardware platform compatibility issues during the device upgrade process are solved, and higher security and compatibility are achieved.
Patent Information
- Application Number
- CN202411690401.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-04-22
AI Technical Summary
Embedded devices have security risks during the upgrade process, including the introduction of malware and incompatibility of hardware platforms, which lead to damage to the device's functions or inability to work.
An embedded device upgrade method that supports multiple hardware platforms is adopted. Upgrade images with file digital signatures and application digital signatures are generated through the server. The embedded device parses the image and performs verification to ensure that the new application is compatible with the hardware platform, and generates application verification files for storage.
Improves the security and compatibility of embedded device upgrades, avoids illegal or incomplete new applications to perform upgrade operations, reduces unnecessary upgrade operations, and improves the stability of device operation.
Smart Images

Figure CN119862577A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded device upgrade management, and in particular to an embedded device upgrade method supporting multiple hardware platforms. Background Art
[0002] After the embedded device is released, it needs to be upgraded due to software updates or hardware platform changes, that is, the new application is parsed from the upgrade image for installation. However, there are the following security risks during the upgrade process:
[0003] 1. Attackers may modify the upgrade image, add malicious functions or introduce security vulnerabilities, and publish it on unofficial websites. If an illegal upgrade image is obtained from an untrusted source, the embedded device will run the application parsed by the upgrade image, which will damage the normal function of the embedded device. For some embedded devices that contain sensitive information during operation, it may even be used to eavesdrop on sensitive information, steal data or other malicious purposes.
[0004] 2. Replace the hardware platform. The old application is incompatible with the new hardware platform, which increases the difficulty of application version management and adaptation. Updates require the production of upgrade images for different hardware platforms. If the embedded device is upgraded using an incompatible upgrade image, the embedded device will not work.
[0005] 3. Attackers can exploit security vulnerabilities in various embedded devices to tamper with applications, such as exploiting vulnerabilities or weak passwords to access FTP servers on embedded devices, replace or modify applications, and use Telnet (remote login and control protocol) to send commands to modify applications.
[0006] Therefore, how to provide an embedded device upgrade method that supports multiple hardware platforms to improve the security and compatibility of embedded device upgrades has become a technical problem that needs to be solved urgently. Summary of the invention
[0007] The technical problem to be solved by the present invention is to provide an embedded device upgrade method supporting multiple hardware platforms, so as to improve the security and compatibility of embedded device upgrades.
[0008] The present invention is implemented as follows: a method for upgrading an embedded device supporting multiple hardware platforms, comprising the following steps:
[0009] Step S1, the server generates an upgrade image based on a file header information, a number of new applications corresponding to different hardware platforms and a file digital signature;
[0010] The file header information includes a magic number, a date, a reserved field and some application information;
[0011] The application information includes an application name, an application size, an application offset, and an application digital signature;
[0012] Step S2: The server sends the upgrade image to the embedded device to be upgraded. The embedded device parses the received upgrade image to obtain file header information, new application program and file digital signature, and verifies the file digital signature.
[0013] Step S3: the embedded device traverses the application name carried in the file header information, and searches for the application information matching the hardware platform based on the application name;
[0014] Step S4, the embedded device searches for the corresponding new application based on the application information, appends the application name in the application information to the header of the new application, appends the application digital signature in the application information to the tail of the new application, generates an application verification file based on the application name, the new application and the application digital signature, and deletes the upgrade image;
[0015] Step S5: the embedded device verifies the new application based on the application digital signature;
[0016] Step S6: The embedded device verifies the old application based on the application digital signature;
[0017] Step S7: The embedded device performs an upgrade operation based on the new application.
[0018] Furthermore, in step S1, the magic number is used to identify the file type and format of the upgrade image;
[0019] The date is used to identify the generation time of the upgrade image;
[0020] The reserved field is used to reserve space for extension;
[0021] The application name is used for matching the hardware platform;
[0022] The application size is used to identify the length of the new application program, in bytes;
[0023] The application offset is used to identify the starting address of the new application in the upgrade image, in bytes;
[0024] The application digital signature is used to verify the new application program.
[0025] Furthermore, in step S1, the process of generating the file digital signature is as follows:
[0026] Performing hash calculation on the file header information and each new application using the SHA-256 algorithm to obtain a first hash value, and signing the first hash value using a preset private key to obtain a file digital signature;
[0027] The generation process of the application digital signature is as follows:
[0028] The new application is hashed using the SHA-256 algorithm to obtain a second hash value, and the second hash value is signed using a preset private key to obtain an application digital signature.
[0029] Furthermore, in step S1, the length of the file digital signature is 256 bytes, the length of the magic number is 4 bytes, the length of the date is 24 bytes, the length of the reserved field is 104 bytes, the length of the application name is 24 bytes, the length of the application size is 4 bytes, the length of the application offset is 4 bytes, and the length of the application digital signature is 256 bytes.
[0030] Furthermore, the step S2 is specifically as follows:
[0031] The server sends the upgrade image to the embedded device to be upgraded, and the embedded device stores the received upgrade image in an upgrade directory. After restarting, the upgrade image is automatically read from the upgrade directory and parsed to obtain file header information, new application and file digital signature, and the file digital signature is verified by a preset public key to obtain a first hash value, and the file header information and the new application are integrity checked by the first hash value.
[0032] Furthermore, the step S4 is specifically as follows:
[0033] The embedded device searches for the corresponding new application based on the application size and application offset carried by the application information, appends the application name in the application information to the header of the new application, appends the application digital signature in the application information to the tail of the new application, generates an application verification file based on the application name, the new application and the application digital signature, stores it in the upgrade directory, and deletes the upgrade image.
[0034] Furthermore, the step S5 is specifically as follows:
[0035] The embedded device verifies the application digital signature with a preset public key to obtain a second hash value, and performs integrity verification on the new application with the second hash value. If the verification succeeds, the process proceeds to step S6; if the verification fails, the process ends.
[0036] Furthermore, the step S6 is specifically as follows:
[0037] The embedded device verifies the application digital signature with a preset public key to obtain a second hash value, and performs integrity verification on the installed old application with the second hash value. If the verification fails, the process proceeds to step S7; if the verification succeeds, the process ends.
[0038] Furthermore, the step S7 is specifically as follows:
[0039] The embedded device parses the application verification file to obtain a new application program, and stores the new application program in the running directory where the old application program is installed, so as to perform an upgrade operation.
[0040] The advantages of the present invention are:
[0041] 1. Generate an upgrade image through a server based on file header information, several new applications corresponding to different hardware platforms and a file digital signature; the file header information includes a magic number, a date, a reserved field and several application information; the application information includes an application name, an application size, an application offset and an application digital signature; the server sends the upgrade image to the embedded device to be upgraded, the embedded device parses the upgrade image to obtain the file header information, the new application and the file digital signature, after verifying the file digital signature, traverse the application name carried in the file header information, search for application information matching the hardware platform based on the application name, search for the corresponding new application based on the application information, append the application name in the application information to the header of the new application, append the application digital signature in the application information to the tail of the new application, based on the application name, the new application and the application digital signature Generate an application verification file and delete the upgrade image; then the embedded device verifies the new application and the old application in turn based on the application digital signature, and finally performs the upgrade operation based on the new application; that is, add a file digital signature and an application digital signature to the upgrade image, which are used to verify the upgrade image and the new application respectively, so as to avoid performing upgrade operations based on illegal or incomplete new applications. The application digital signature can also be used to verify the old application. If the verification passes, it means that no upgrade is required, so as to reduce unnecessary upgrade operations and improve the stability of the embedded device operation; by setting up several new applications in the upgrade image and setting corresponding application information for each new application, before the embedded device is upgraded, it can be quickly determined whether the new application matches the hardware platform based on the application name carried in the application information, which ultimately greatly improves the security and compatibility of the embedded device upgrade.
[0042] 2. By setting the magic number and date in the file header information of the upgrade image, the file type, format and timeliness of the upgrade image can be verified to further improve the security of embedded device upgrades.
[0043] 3. Hashing is performed using the SHA-256 algorithm, and then the calculated hash value is signed using a private key. Double security measures are taken, which greatly improves the reliability of subsequent upgrade images and new application verification.
[0044] 4. By appending the application name to the header of the new application and the application digital signature to the end of the new application, an application verification file is generated based on the application name, the new application and the application digital signature and stored in the upgrade directory, and the upgrade image is deleted. That is, only the application verification file useful for the local upgrade is retained, which greatly saves the limited storage space of the embedded device. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.
[0046] Figure 1 The invention discloses a flow chart of an embedded device upgrade method supporting multiple hardware platforms. DETAILED DESCRIPTION
[0047] The technical solution in the embodiments of the present application has the following overall idea: adding a file digital signature and an application digital signature to the upgrade image, which are used to verify the upgrade image and the new application respectively, to avoid performing upgrade operations based on illegal or incomplete new applications. The application digital signature can also be used to verify the old application. If the verification passes, it means that no upgrade is required, thereby reducing unnecessary upgrade operations and improving the stability of embedded device operation; by setting up several new applications in the upgrade image, and setting corresponding application information for each new application, before the embedded device is upgraded, it can be quickly determined whether the new application matches the hardware platform based on the application name carried in the application information, thereby improving the security and compatibility of the embedded device upgrade.
[0048] Please refer to Figure 1 As shown, a preferred embodiment of the method for upgrading an embedded device supporting multiple hardware platforms of the present invention comprises the following steps:
[0049] Step S1, the server generates an upgrade image based on a file header information, a number of new applications corresponding to different hardware platforms and a file digital signature;
[0050] The file header information includes a magic number, a date, a reserved field and some application information;
[0051] By setting the magic number and date in the file header information of the upgrade image, the file type, format and timeliness of the upgrade image can be verified, further improving the security of embedded device upgrades.
[0052] The application information includes an application name, an application size, an application offset, and an application digital signature;
[0053] Step S2: The server sends the upgrade image to the embedded device to be upgraded. The embedded device parses the received upgrade image to obtain file header information, new application program and file digital signature, and verifies the file digital signature.
[0054] Step S3: the embedded device traverses the application name carried in the file header information, and searches for the application information matching the hardware platform based on the application name;
[0055] Step S4, the embedded device searches for the corresponding new application based on the application information, appends the application name in the application information to the header of the new application, appends the application digital signature in the application information to the tail of the new application, generates an application verification file based on the application name, the new application and the application digital signature, and deletes the upgrade image;
[0056] Step S5: the embedded device verifies the new application based on the application digital signature;
[0057] Step S6: The embedded device verifies the old application based on the application digital signature;
[0058] Step S7: The embedded device performs an upgrade operation based on the new application.
[0059] In step S1, the magic number is used to identify the file type and format of the upgrade image;
[0060] The date is used to identify the generation time of the upgrade image;
[0061] The reserved field is used to reserve space for extension;
[0062] The application name is used for matching the hardware platform;
[0063] The application size is used to identify the length of the new application program, in bytes;
[0064] The application offset is used to identify the starting address of the new application in the upgrade image, in bytes;
[0065] The application digital signature is used to verify the new application program.
[0066] In step S1, the process of generating the file digital signature is as follows:
[0067] Performing hash calculation on the file header information and each new application using the SHA-256 algorithm to obtain a first hash value, and signing the first hash value using a preset private key to obtain a file digital signature;
[0068] The generation process of the application digital signature is as follows:
[0069] The new application is hashed using the SHA-256 algorithm to obtain a second hash value, and the second hash value is signed using a preset private key to obtain an application digital signature.
[0070] Hashing is performed using the SHA-256 algorithm, and the calculated hash value is signed using a private key. This double security measure greatly improves the reliability of subsequent upgrade images and new application verification.
[0071] In step S1, the length of the file digital signature is 256 bytes, the length of the magic number is 4 bytes, the length of the date is 24 bytes, the length of the reserved field is 104 bytes, the length of the application name is 24 bytes, the length of the application size is 4 bytes, the length of the application offset is 4 bytes, and the length of the application digital signature is 256 bytes.
[0072] The step S2 is specifically as follows:
[0073] The server sends the upgrade image to the embedded device to be upgraded, and the embedded device stores the received upgrade image in an upgrade directory. After restarting, the upgrade image is automatically read from the upgrade directory and parsed to obtain file header information, new application and file digital signature, and the file digital signature is verified by a preset public key to obtain a first hash value, and the file header information and the new application are integrity checked by the first hash value.
[0074] The step S4 is specifically as follows:
[0075] The embedded device searches for the corresponding new application based on the application size and application offset carried by the application information, appends the application name in the application information to the header of the new application, appends the application digital signature in the application information to the tail of the new application, generates an application verification file based on the application name, the new application and the application digital signature, stores it in the upgrade directory, and deletes the upgrade image.
[0076] By appending the application name to the header of the new application and the application digital signature to the end of the new application, an application verification file is generated based on the application name, the new application and the application digital signature and stored in the upgrade directory, and the upgrade image is deleted, that is, only the application verification file useful for the local upgrade is retained, which greatly saves the limited storage space of the embedded device.
[0077] The step S5 is specifically as follows:
[0078] The embedded device verifies the application digital signature with a preset public key to obtain a second hash value, and performs integrity verification on the new application with the second hash value. If the verification succeeds, the process proceeds to step S6; if the verification fails, the process ends.
[0079] The step S6 is specifically as follows:
[0080] The embedded device verifies the application digital signature with a preset public key to obtain a second hash value, and performs integrity verification on the installed old application with the second hash value. If the verification fails, the process proceeds to step S7; if the verification succeeds, the process ends.
[0081] The private key and the public key are a pair of paired keys generated based on the RSA algorithm. Since the RSA algorithm is based on mathematical problems, such as the difficulty of large prime number decomposition and discrete logarithm problems, it has high security and is very effective in protecting sensitive information.
[0082] The step S7 is specifically as follows:
[0083] The embedded device parses the application verification file to obtain a new application program, and stores the new application program in the running directory where the old application program is installed, so as to perform an upgrade operation.
[0084] In summary, the advantages of the present invention are:
[0085] 1. Generate an upgrade image through a server based on file header information, several new applications corresponding to different hardware platforms and a file digital signature; the file header information includes a magic number, a date, a reserved field and several application information; the application information includes an application name, an application size, an application offset and an application digital signature; the server sends the upgrade image to the embedded device to be upgraded, the embedded device parses the upgrade image to obtain the file header information, the new application and the file digital signature, after verifying the file digital signature, traverse the application name carried in the file header information, search for application information matching the hardware platform based on the application name, search for the corresponding new application based on the application information, append the application name in the application information to the header of the new application, append the application digital signature in the application information to the tail of the new application, based on the application name, the new application and the application digital signature Generate an application verification file and delete the upgrade image; then the embedded device verifies the new application and the old application in turn based on the application digital signature, and finally performs the upgrade operation based on the new application; that is, add a file digital signature and an application digital signature to the upgrade image, which are used to verify the upgrade image and the new application respectively, so as to avoid performing upgrade operations based on illegal or incomplete new applications. The application digital signature can also be used to verify the old application. If the verification passes, it means that no upgrade is required, so as to reduce unnecessary upgrade operations and improve the stability of the embedded device operation; by setting up several new applications in the upgrade image and setting corresponding application information for each new application, before the embedded device is upgraded, it can be quickly determined whether the new application matches the hardware platform based on the application name carried in the application information, which ultimately greatly improves the security and compatibility of the embedded device upgrade.
[0086] 2. By setting the magic number and date in the file header information of the upgrade image, the file type, format and timeliness of the upgrade image can be verified to further improve the security of embedded device upgrades.
[0087] 3. Hashing is performed using the SHA-256 algorithm, and then the calculated hash value is signed using a private key. Double security measures are taken, which greatly improves the reliability of subsequent upgrade images and new application verification.
[0088] 4. By appending the application name to the header of the new application and the application digital signature to the end of the new application, an application verification file is generated based on the application name, the new application and the application digital signature and stored in the upgrade directory, and the upgrade image is deleted. That is, only the application verification file useful for the local upgrade is retained, which greatly saves the limited storage space of the embedded device.
[0089] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A method for upgrading an embedded device supporting multiple hardware platforms, characterized in that: The steps include: Step S1, the server generates an upgrade image based on a file header information, a number of new applications corresponding to different hardware platforms and a file digital signature; The file header information includes a magic number, a date, a reserved field and some application information; The application information includes an application name, an application size, an application offset, and an application digital signature; Step S2: The server sends the upgrade image to the embedded device to be upgraded. The embedded device parses the received upgrade image to obtain file header information, new application program and file digital signature, and verifies the file digital signature. Step S3: the embedded device traverses the application name carried in the file header information, and searches for the application information matching the hardware platform based on the application name; Step S4, the embedded device searches for the corresponding new application based on the application information, appends the application name in the application information to the header of the new application, appends the application digital signature in the application information to the tail of the new application, generates an application verification file based on the application name, the new application and the application digital signature, and deletes the upgrade image; Step S5: the embedded device verifies the new application based on the application digital signature; Step S6: The embedded device verifies the old application based on the application digital signature; Step S7: The embedded device performs an upgrade operation based on the new application.
2. The method for upgrading an embedded device supporting multiple hardware platforms as claimed in claim 1, characterized in that: In step S1, the magic number is used to identify the file type and format of the upgrade image; The date is used to identify the generation time of the upgrade image; The reserved field is used to reserve space for extension; The application name is used for matching the hardware platform; The application size is used to identify the length of the new application program, in bytes; The application offset is used to identify the starting address of the new application in the upgrade image, in bytes; The application digital signature is used to verify the new application program.
3. The method for upgrading an embedded device supporting multiple hardware platforms as claimed in claim 1, characterized in that: In step S1, the process of generating the file digital signature is as follows: Performing hash calculation on the file header information and each new application using the SHA-256 algorithm to obtain a first hash value, and signing the first hash value using a preset private key to obtain a file digital signature; The generation process of the application digital signature is as follows: The new application is hashed using the SHA-256 algorithm to obtain a second hash value, and the second hash value is signed using a preset private key to obtain an application digital signature.
4. The method for upgrading an embedded device supporting multiple hardware platforms as claimed in claim 1, characterized in that: In step S1, the length of the file digital signature is 256 bytes, the length of the magic number is 4 bytes, the length of the date is 24 bytes, the length of the reserved field is 104 bytes, the length of the application name is 24 bytes, the length of the application size is 4 bytes, the length of the application offset is 4 bytes, and the length of the application digital signature is 256 bytes.
5. The method for upgrading an embedded device supporting multiple hardware platforms as claimed in claim 1, characterized in that: The step S2 is specifically as follows: The server sends the upgrade image to the embedded device to be upgraded, and the embedded device stores the received upgrade image in an upgrade directory. After restarting, the upgrade image is automatically read from the upgrade directory and parsed to obtain file header information, new application and file digital signature, and the file digital signature is verified by a preset public key to obtain a first hash value, and the file header information and the new application are integrity checked by the first hash value.
6. The method for upgrading an embedded device supporting multiple hardware platforms as claimed in claim 1, characterized in that: The step S4 is specifically as follows: The embedded device searches for the corresponding new application based on the application size and application offset carried by the application information, appends the application name in the application information to the header of the new application, appends the application digital signature in the application information to the tail of the new application, generates an application verification file based on the application name, the new application and the application digital signature, stores it in the upgrade directory, and deletes the upgrade image.
7. The method for upgrading an embedded device supporting multiple hardware platforms as claimed in claim 1, characterized in that: The step S5 is specifically as follows: The embedded device verifies the application digital signature with a preset public key to obtain a second hash value, and performs integrity verification on the new application with the second hash value. If the verification succeeds, the process proceeds to step S6; if the verification fails, the process ends.
8. The method for upgrading an embedded device supporting multiple hardware platforms as claimed in claim 1, characterized in that: The step S6 is specifically as follows: The embedded device verifies the application digital signature with a preset public key to obtain a second hash value, and performs integrity verification on the installed old application with the second hash value. If the verification fails, the process proceeds to step S7; if the verification succeeds, the process ends.
9. The method for upgrading an embedded device supporting multiple hardware platforms as claimed in claim 1, characterized in that: The step S7 is specifically as follows: The embedded device parses the application verification file to obtain a new application program, and stores the new application program in the running directory where the old application program is installed, so as to perform an upgrade operation.