CN115242413A - Internet of things equipment firmware safety upgrading method and device, electronic equipment and medium - Google Patents

Internet of things equipment firmware safety upgrading method and device, electronic equipment and medium Download PDF

Info

Publication number
CN115242413A
CN115242413A CN202110368150.8A CN202110368150A CN115242413A CN 115242413 A CN115242413 A CN 115242413A CN 202110368150 A CN202110368150 A CN 202110368150A CN 115242413 A CN115242413 A CN 115242413A
Authority
CN
China
Prior art keywords
firmware
internet
upgrading
things
security
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110368150.8A
Other languages
Chinese (zh)
Inventor
刘祖臣
樊期光
石松泉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Communications Ltd Research Institute
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Communications Ltd Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Communications Ltd Research Institute filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110368150.8A priority Critical patent/CN115242413A/en
Publication of CN115242413A publication Critical patent/CN115242413A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/18Network architectures or network communication protocols for network security using different networks or channels, e.g. using out of band channels
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • H04L63/123Applying verification of the received information received data contents, e.g. message integrity

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method and a device for safely upgrading firmware of equipment of the Internet of things, electronic equipment and a medium, and belongs to the field of information safety. Wherein, the method comprises the following steps: constructing a safe upgrading channel between the networking equipment and the upper computer; receiving a firmware security upgrade package sent by the upper computer through the security upgrade channel; verifying the firmware security upgrade package; and after the verification is passed, firmware upgrading is carried out on the Internet of things equipment according to the firmware safety upgrading packet. According to the scheme in the application, the aerial safe upgrade of the equipment firmware of the Internet of things can be realized.

Description

Internet of things equipment firmware safety upgrading method and device, electronic equipment and medium
Technical Field
The invention belongs to the field of information security, and particularly relates to a method and a device for safely upgrading firmware of Internet of things equipment, electronic equipment and a computer-readable storage medium.
Background
With the rapid development of industrial informatization, small embedded internet of things devices have been applied to various fields, such as: unmanned vending machine, electron price tag, intelligent water gauge, ammeter, gas table, intelligent charging stake, intelligent house etc.. In general, in view of various factors such as cost and device size, a microcontroller with low price, small storage capacity and small number of peripheral devices is generally selected as a master controller of the small embedded internet of things device. Generally, after the internet of things equipment is deployed, the service time is long, and after a software problem occurs, the problem is repaired by adopting a manual recovery and flashing mode. Obviously, when the quantity of deployed internet of things equipment is large, the cost of later maintenance is obviously increased, and the maintenance efficiency is low. At present, many small-sized embedded internet of things devices support an air upgrading mode, software problems are repaired remotely, and the adopted air upgrading logic is simple. For professional hackers, the firmware can be easily stolen by methods such as man-in-the-middle attack and the like, corresponding information is tampered, the normal functions of the equipment are slightly influenced, the firmware with a back door can be implanted in serious cases, and the safety risk of the equipment is increased. For the internet of things equipment in the infrastructure industries such as industrial control and electric power, the potential safety risk may cause physical damage in the real world and bring safety threat to enterprise production.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for safely upgrading firmware of Internet of things equipment, electronic equipment and a computer readable storage medium, so as to solve the problem of higher safety risk in the firmware upgrading process.
In order to solve the technical problem, the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a method for safely upgrading a firmware of an internet of things device, where the method is applied to the internet of things device, and includes:
a safety upgrading channel between the construction networking equipment and the upper computer;
receiving a firmware security upgrade package sent by the upper computer through the security upgrade channel;
checking the firmware security upgrade package;
and after the verification is passed, firmware upgrading is carried out on the Internet of things equipment according to the firmware safety upgrading package.
In a second aspect, an embodiment of the present invention provides a method for safely upgrading a firmware of an internet of things device, where the method is applied to an upper computer, and the method includes:
generating a firmware security upgrade package for firmware upgrade of the Internet of things equipment;
constructing a safe upgrading channel between the networking equipment and the upper computer;
and sending the firmware security upgrade package to the Internet of things equipment through the security upgrade channel.
In a third aspect, an embodiment of the present invention provides an apparatus for securely upgrading firmware of an internet of things device, where the apparatus is applied to an internet of things device, and the apparatus includes:
the first security module is used for constructing a security upgrading channel between the Internet of things equipment and the upper computer; receiving a firmware security upgrade packet sent by the upper computer through the security upgrade channel;
the verification module is used for verifying the firmware security upgrade package;
and the execution module is used for upgrading the firmware of the Internet of things equipment according to the firmware safety upgrading package after the verification is passed.
In a fourth aspect, an embodiment of the present invention provides an internet of things device firmware security upgrading apparatus, which is applied to an upper computer, and includes:
the processing module is used for generating a firmware security upgrading package for upgrading the firmware of the Internet of things equipment;
the second safety module is used for constructing a safety upgrading channel between the Internet of things equipment and the upper computer; and sending the firmware security upgrade package to the Internet of things equipment through the security upgrade channel.
In a fifth aspect, embodiments of the present invention provide an electronic device, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, and when executed by the processor, the program or instructions implement the steps of the method according to the first aspect, or the steps of the method according to the second aspect.
In a sixth aspect, the present invention provides a computer-readable storage medium, on which a program or instructions are stored, which when executed by a processor implement the steps of the method according to the first aspect, and the steps of the method according to the second aspect.
In the embodiment of the invention, the Internet of things equipment can construct a safety upgrading channel between the Internet of things equipment and the upper computer, a firmware safety upgrading packet sent by the upper computer is received through the safety upgrading channel, the firmware safety upgrading packet is checked, and after the check is passed, the firmware upgrading is carried out on the Internet of things equipment according to the firmware safety upgrading packet. Therefore, aerial safe upgrading of the equipment firmware of the Internet of things can be achieved, manual recycling is not needed, the cost of equipment maintenance of the Internet of things can be reduced, the efficiency of equipment maintenance of the Internet of things is improved, and the overall performance of the equipment of the Internet of things is improved. The Internet of things equipment is upgraded by constructing the security upgrading channel to transmit the security upgrading packet of the firmware, so that the security risk in the firmware upgrading process can be reduced, and the firmware is effectively prevented from being eavesdropped and attacked by a man-in-the-middle in the firmware transmission process.
Drawings
Fig. 1 is a flowchart of a method for securely upgrading firmware of an internet of things device according to an embodiment of the present invention;
fig. 2 is a flowchart of an internet of things device storing new firmware in a firmware security upgrade package according to an embodiment of the present invention;
fig. 3 is a flowchart of another method for securely upgrading firmware of an internet of things device according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a host computer generating a firmware security upgrade package from new firmware versions and firmware digest information according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a secure upgrading apparatus for firmware of an internet of things device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of another apparatus for securely upgrading firmware of an internet of things device according to an embodiment of the present invention;
fig. 7 is a timing diagram of firmware upgrade performed by the internet of things device firmware security upgrade system according to the embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms first, second and the like in the description and in the claims of the present invention are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the invention may be practiced other than those illustrated or described herein, and that the objects identified as "first," "second," etc. are generally a class of objects and do not limit the number of objects, e.g., a first object may be one or more. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/", and generally means that the former and latter related objects are in an "or" relationship.
The method for safely upgrading the firmware of the internet of things device provided by the embodiment of the invention is described in detail through specific embodiments and application scenarios thereof with reference to the attached drawings.
Referring to fig. 1, fig. 1 is a flowchart of a method for securely upgrading firmware of an internet of things device according to an embodiment of the present invention, where the method is applied to an internet of things device, for example: the embodiment of the invention provides small embedded Internet of things terminal equipment such as an unmanned vending machine, an electronic price tag, an intelligent water meter, an electric meter, a gas meter, an intelligent charging pile and an intelligent home, and the type of the Internet of things equipment is not limited, as shown in figure 1, the method comprises the following steps:
and 101, constructing a secure upgrade channel between the networking equipment and the upper computer.
In the embodiment of the invention, the upper computer can be equipment which has a new firmware version and can send the new firmware version to the internet of things equipment by communicating with the internet of things equipment (also called as a lower computer) to upgrade the firmware of the internet of things equipment in the air. For example, the upper computer includes a physical server of an independent host, a virtual server borne by a host cluster, a cloud server, and other servers. Optionally, the internet of things device may be connected to the upper computer in a wireless manner, for example: wiFi, bluetooth, zigBee, etc., or may be connected by wired means, for example: the embodiment of the invention does not limit the communication mode of the Internet of things equipment and the upper computer based on the physical layer.
In the embodiment of the invention, the internet of things equipment and the upper computer can establish a safe firmware upgrading channel between the internet of things equipment and the upper computer in a mode of randomly generating the key and exchanging the randomly generated key, so that the data transmission safety in the firmware upgrading process is ensured by encrypting and decrypting the randomly generated key. In some optional examples, the upper computer may send an instruction to establish a secure upgrade channel to the internet of things device; the method comprises the steps that the Internet of things equipment receives a security upgrading channel instruction sent by an upper computer, randomly generates a first secret key, encrypts the first secret key through a preset secret key to generate a first handshake data packet, and sends the first handshake data packet to the upper computer; the upper computer receives a first handshake data packet sent by the Internet of things equipment, decrypts the first handshake data packet through a preset secret key to obtain a first secret key, randomly generates a second secret key, encrypts the second secret key through the first secret key to generate a second handshake data packet, and sends the second handshake data packet to the Internet of things equipment; the Internet of things equipment receives a second handshake data packet sent by the upper computer, the second handshake data packet is decrypted through the first key, a second key is obtained, and a secure firmware upgrading channel is established between the Internet of things equipment and the upper computer. The embodiment of the present invention does not limit the symmetric encryption algorithm for encrypting and decrypting with the first key.
Optionally, the same secret key may be preset in the internet of things device and the upper computer, that is, the first secret key is encrypted and the first handshake data packet is decrypted by using a symmetric encryption method. Or different keys can be preset in the internet of things device and the upper computer, that is, an asymmetric encryption method is adopted to encrypt the first key and decrypt the first handshake data packet. For example, a private key may be preset in the internet of things device, the first key is encrypted through the preset private key, a corresponding public key may be preset in the upper computer, and the first handshake data packet is decrypted through the preset public key.
And step 102, receiving a firmware security upgrade package sent by an upper computer through a security upgrade channel.
In the embodiment of the invention, after the construction of the security upgrade channel between the internet of things equipment and the upper computer is completed, the upper computer sends the firmware security upgrade package to the internet of things equipment through the constructed security upgrade channel, and the internet of things equipment receives the firmware security upgrade package sent by the upper computer through the security upgrade channel and stores the new version firmware in the firmware security upgrade package. In some optional examples, the internet of things device may set a preset firmware upgrade flag, and restart the internet of things device; after the internet of things equipment is restarted, the internet of things equipment can generate a receiving ready signal according to the set firmware upgrading flag bit, encrypt the receiving ready signal through a second secret key, and send the encrypted receiving ready signal to the upper computer; the upper computer receives an encrypted receiving ready signal sent by the Internet of things equipment, decrypts the encrypted receiving ready signal through a second secret key to obtain the receiving ready signal, and sends a firmware security upgrade package to the Internet of things equipment according to the receiving ready signal; the Internet of things equipment receives a firmware security upgrading package sent by the upper computer and stores new versions of firmware in the firmware security upgrading package. The embodiment of the present invention does not limit the symmetric encryption algorithm for encrypting and decrypting with the second key.
Optionally, the memory in the internet of things device may be divided into three parts in advance: the first part, namely a low address bit area, stores a boot loader (bootload) for boot program entry and firmware security upgrade; a second part, storing a main program, for executing the service content, also called area a; the third part is a spare storage area used for storing new version firmware for upgrading, a firmware upgrading flag bit, a secret key and the like. Therefore, after the internet of things equipment is restarted, the boot loader can determine whether to enter a firmware upgrading mode by checking the preset firmware upgrading flag bit. If the preset firmware upgrading flag bit is set, the Internet of things equipment enters a firmware upgrading mode and starts to wait for receiving a firmware security upgrading packet without entering a main program of the Internet of things equipment; and if the preset firmware upgrading flag bit is not set, the Internet of things equipment enters a main program.
And 103, checking the firmware security upgrade package.
In the embodiment of the invention, the equipment of the Internet of things can check the firmware security upgrade package after receiving the firmware security upgrade package sent by the upper computer through the security upgrade channel. In some optional examples, the upper computer generates a firmware security upgrade package for firmware upgrade of the internet of things device, where the firmware security upgrade package may include firmware digest information and new firmware, and the firmware digest information may include: the file header, the firmware version, the boot loader version, the firmware size, the firmware signature, and the like.
Optionally, the process of checking the firmware security upgrade package by the internet of things device may include at least one of the following:
checking the validity of the firmware safety upgrading packet according to a file header in firmware abstract information included in the firmware safety upgrading packet;
checking the version of the current main program of the Internet of things equipment according to the firmware version in the firmware abstract information included in the firmware security upgrade package;
according to the version of the boot loader in the firmware abstract information included in the firmware security upgrade package, checking the version of the current boot loader of the Internet of things equipment to determine whether the firmware upgrade is supported;
checking the size of a new version firmware in the firmware security upgrade package according to the size of the firmware in the firmware abstract information included in the firmware security upgrade package;
and verifying the integrity of the new version firmware in the firmware security upgrade package according to the firmware signature in the firmware abstract information included in the firmware security upgrade package.
The integrity of the new firmware version can be verified by calculating a digital abstract according to a preset hash algorithm for the new firmware version in the firmware security upgrade package, decrypting a firmware signature through a preset public key to obtain the digital abstract, and comparing the calculated digital abstract with the decrypted digital abstract to determine whether the new firmware version in the firmware security upgrade package is tampered in the transmission process. The firmware signature generated by the upper computer through the Hash algorithm can ensure the integrity of the firmware when the Internet of things equipment upgrades the firmware.
And 104, after the verification is passed, upgrading the firmware of the Internet of things equipment according to the firmware safety upgrade package.
In the embodiment of the invention, after the Internet of things equipment checks the firmware security upgrade package, whether the firmware of the Internet of things equipment is upgraded or not can be determined according to the check result; if the checking result is that the checking is passed, after the checking is passed, the new version firmware can be validated by modifying the entry address of the main program of the internet of things equipment into the storage address of the new version firmware, so that the firmware is safely upgraded, and at the moment, the internet of things equipment can be restarted to enter the new main program corresponding to the new version firmware. If the verification result is that the verification fails, the stored new-version firmware can be deleted after the verification fails, and the internet of things equipment can be restarted to still enter the original main program of the internet of things equipment.
Optionally, after the verification is passed, the internet of things equipment can also return information that the firmware is successfully upgraded to the upper computer, disconnect the internet of things equipment from the upper computer, and delete the stored second secret key; after the verification fails, the Internet of things equipment can also return information of firmware upgrading failure to the upper computer, disconnect the connection with the upper computer and delete the stored second secret key.
In the embodiment of the invention, the internet of things equipment receives the firmware safety upgrade package sent by the upper computer through the safety upgrade channel between the internet of things equipment and the upper computer, the firmware safety upgrade package is checked, and after the check, the firmware is upgraded according to the firmware safety upgrade package, so that the aerial safety upgrade of the firmware of the internet of things equipment is realized, manual recovery is not needed, the maintenance cost of the internet of things equipment can be reduced, the maintenance efficiency of the internet of things equipment is improved, and the overall performance of the internet of things equipment is improved. The Internet of things equipment is upgraded by constructing the security upgrade channel and transmitting the security upgrade package of the firmware, so that security risks in the firmware upgrade process can be reduced, and the firmware is effectively prevented from being eavesdropped and attacked by a man-in-the-middle in the firmware transmission process.
In some optional examples, the internet of things device receives, through the secure upgrade channel, an encrypted firmware upgrade compression packet sent by the upper computer, and at this time, after receiving the encrypted firmware upgrade compression packet, the internet of things device needs to decrypt and decompress the encrypted firmware upgrade compression packet to obtain the firmware secure upgrade packet. Referring to fig. 2, fig. 2 is a flowchart of an embodiment of obtaining a firmware security upgrade package by an internet of things device, and as shown in fig. 2, a process of obtaining a firmware security upgrade package by an internet of things device includes the following steps:
step 201, receiving an encrypted firmware upgrade compression package sent by an upper computer through a secure upgrade channel.
Step 202, generating a third key according to a pre-stored serial number of the internet of things device and/or a serial number of a CPU of the internet of things device.
And 203, decrypting and decompressing the encrypted firmware upgrading compression packet through the third secret key to obtain a firmware safety upgrading packet.
In the embodiment of the invention, when the upper computer generates the firmware security upgrade package from the new firmware and the firmware abstract information, the upper computer may first compress the new firmware and the firmware abstract information to generate the firmware upgrade compression package, then generate the third key according to a pre-stored Serial Number (SN) of the internet of things device and a Serial Number (CPU _ ID) of a CPU of the internet of things device, and encrypt the firmware upgrade compression package through the third key to obtain the encrypted firmware upgrade compression package.
Optionally, the upper computer may obtain the serial number of the CPU from the internet of things device when the internet of things device is produced and configured, and bind with the internet of things device through the obtained serial number of the internet of things device. After the internet of things equipment receives the encrypted firmware upgrade compression package through the security upgrade channel, a Serial Number (SN) of the internet of things equipment and a Serial Number (CPU _ ID) of a CPU of the internet of things equipment, which are stored in advance, can be acquired to generate a third key, and then the encrypted firmware upgrade compression package is decrypted and decompressed through the third key to obtain firmware abstract information and new firmware, and the new firmware is stored.
It can be understood that the embodiment of the present invention does not limit the implementation manner of generating the third key according to the serial number of the internet of things device and the serial number of the CPU of the internet of things device, and the symmetric encryption algorithm for encrypting and decrypting through the third key.
In this embodiment, the upper computer encrypts the firmware by using a symmetric encryption algorithm, so that the security of the firmware can be ensured when the internet of things equipment upgrades the firmware.
Referring to fig. 3, fig. 3 is a flowchart of another method for upgrading the firmware of the internet of things device safely, where the method is applied to an upper computer, and as shown in fig. 3, the method includes the following steps:
step 301, generating a firmware security upgrade package for upgrading the firmware of the internet of things device.
And step 302, constructing a safety upgrading channel between the networking equipment and the upper computer.
And 303, sending a firmware security upgrade package to the Internet of things equipment through the security upgrade channel.
In the embodiment of the present invention, the descriptions of step 301, step 302, and step 303 may refer to the descriptions of step 101, step 102, step 103, and step 104 in fig. 1, so that they are not repeated.
In the embodiment of the invention, the upper computer constructs the safety upgrading channel between the internet of things equipment and the upper computer by generating the firmware safety upgrading packet for upgrading the firmware of the internet of things equipment, and sends the firmware safety upgrading packet to the internet of things equipment through the safety upgrading channel, so that the aerial safety upgrading of the firmware of the internet of things equipment is realized, manual recovery is not needed, the maintenance cost of the internet of things equipment can be reduced, the maintenance efficiency of the internet of things equipment is improved, and the overall performance of the internet of things equipment is improved; the firmware security upgrading method comprises the steps that a security upgrading channel is constructed to transmit a firmware security upgrading packet to upgrade the firmware of the Internet of things device, so that security risks in the firmware upgrading process can be reduced, and the firmware transmission process is effectively prevented from being eavesdropped and attacked by a man-in-the-middle.
In some optional examples, the upper computer sends the encrypted firmware upgrade compression package to the internet of things device through the secure upgrade channel, and at this time, when the upper computer generates the firmware secure upgrade package from the new firmware version and the firmware digest information, the upper computer needs to generate the firmware upgrade compression package from the new firmware version and the firmware digest information first, and then encrypt the firmware upgrade compression package to obtain the encrypted firmware upgrade compression package. Referring to fig. 4, fig. 4 is a flowchart of an upper computer generating a firmware security upgrade package according to an embodiment of the present invention, and as shown in fig. 4, a process of the upper computer generating the firmware security upgrade package includes the following steps:
step 401, compressing the new firmware version and the firmware abstract information to generate a firmware upgrade compression package.
Step 402, generating a third secret key according to a pre-stored serial number of the internet of things device and/or a serial number of a CPU of the internet of things device.
And 403, encrypting the firmware upgrading compression package through a third key to obtain an encrypted firmware upgrading compression package.
In the embodiment of the present invention, the description about step 401, step 402, and step 403 may refer to the description about each step 203 of step 201 and step 202 in fig. 2, and therefore, the description will not be repeated.
Referring to fig. 7, fig. 7 is a timing diagram of a method for securely upgrading a firmware of an internet of things device according to an embodiment of the present invention, as shown in fig. 7, where a firmware upgrading process is as follows:
1. and the upper computer generates a firmware upgrading compression package of the Internet of things equipment. The firmware upgrading compression package comprises two files, firmware abstract information FWMessage and new version firmware, namely a binary file FWBin of the firmware. The firmware abstract information FWMessage is composed of a file header, a firmware version, a bootloader version, a firmware size and a firmware signature. And the upper computer compresses the firmware abstract information and the new firmware version into the same compression packet FWcompress. Wherein the firmware signature generates the digital digest using the SHA256 algorithm.
FWCompress=(FWMessage||FWBin)
2. The upper computer encrypts the firmware upgrade compression package by using an encryption algorithm to generate an encrypted firmware upgrade compression package EncryptFWcompress. The encrypted key FWKey is a combination of a CPU _ ID and a SN of the Internet of things equipment.
FWKey=(SN||CPU_ID)
EncryptFWCompress=AES_CMAC(FWCompress,FWKey)
3. And the upper computer sends a command for establishing a safety upgrading channel to the Internet of things equipment through the physical interface.
4. After receiving the instruction of establishing the security upgrading channel, the Internet of things equipment generates a random string as a first secret key, encrypts the random string by using a preset private key, generates a handshake data packet A and sends the handshake data packet A to the upper computer.
Handshake data package A = RSA (Randstring, pubKey)
5. And after receiving the handshake data packet A, the upper computer decrypts by using a preset corresponding public key to obtain RandString. And the upper computer uses a symmetric encryption algorithm, takes RandString as a key, encrypts the randomly generated secure link key SecureKey and generates a handshake data packet B. And the upper computer sends the handshake data packet B to the Internet of things equipment.
Handshake data packet B = AES _ CMAC (SecureKey, randString)
6. And after the Internet of things equipment receives the handshake data packet B, decrypting the handshake data packet B by using the previously generated RandString through a symmetric decryption algorithm to obtain a SecureKey, and writing the SecureKey into Flash for storage. The subsequent data sent by the internet of things equipment and the upper computer are encrypted by using the SecureKey. And at this point, the construction of the safe upgrading channel is finished.
7. The Internet of things equipment enters firmware upgrading preparation work, a firmware upgrading flag bit UpdateFlag preset in Flash is set, and the Internet of things equipment is restarted to enter Bootloader.
8. And starting Bootloader of the equipment of the Internet of things, checking whether a firmware upgrading flag UpdateFlag preset in Flash is set, if so, entering a firmware upgrading mode, and starting to wait for receiving firmware for upgrading without entering a main program.
9. And the Bootloader of the equipment of the Internet of things reads the SecureKey stored in the Flash, encrypts the receiving ready signal by using the SecureKey and sends the encrypted receiving ready signal to the upper computer.
10. And after receiving the encrypted receiving ready signal, the upper computer decrypts by using the SecureKey to obtain the receiving ready signal and sends the encrypted firmware upgrade compression package EncryptFWcompress.
11. And after the Internet of things equipment receives the EncryptFWCompresses, reading the SN stored in the Flash and the CPU _ ID in the register to generate a key FWKey.
12. And the Internet of things equipment decrypts EncryptFWCompresss by using the key FWKey to obtain FWCompresss. And decompressing the FWCompresss to obtain an FWBin file, and storing the FWBin file in an idle area in the Flash.
13. The internet of things equipment begins to be checked. And decompressing the Internet of things equipment to obtain the FWMessage and the FWBin. And verifying the file header, the firmware version, the bootloader version, the firmware size and the firmware signature in the firmware summary information FWMessage one by one. The file header is used for checking whether the received file is legal or not, the firmware version is used for checking the version of the current main program, the bootloader version is used for checking whether the version of the current bootloader supports firmware upgrading or not, and the firmware size is used for checking the size of the received FWBin. After the check is passed, the SHA256 calculates a digital digest of the received FWBin, decrypts the firmware signature by using a preset public key to obtain the digital digest, and compares the calculated digital digest with the decrypted digital digest to confirm whether the firmware is tampered.
14. And after the verification is passed, the Bootloader of the Internet of things equipment modifies the entry address of the main program into the address where the FWBin is located. The Internet of things equipment returns information of successful firmware upgrading to the upper computer, the connection with the upper computer is disconnected, a SecureKey stored in Flash is deleted, and the Internet of things equipment is restarted to enter a new main program.
15. And if the step 13 fails, the Bootloader of the equipment of the Internet of things erases the FWMessage and the Flash area corresponding to the FWBin. And the Internet of things equipment returns information of firmware upgrading failure to the upper computer, the connection with the upper computer is disconnected, a SecureKey stored in Flash is deleted, and the original main program is restarted.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an internet of things device firmware security upgrading apparatus provided in an embodiment of the present invention, where the apparatus is applied to an electronic device, and as shown in fig. 5, the internet of things device firmware security upgrading apparatus 500 may include:
and the first safety module 510 is used for constructing a safety upgrading channel between the Internet of things equipment and the upper computer, and receiving a firmware safety upgrading packet sent by the upper computer through the safety upgrading channel.
And the checking module 520 is used for checking the firmware security upgrade package.
And the execution module 530 is configured to perform firmware upgrade on the internet of things device according to the firmware security upgrade package after the verification is passed.
Optionally, the first security module 510 may include:
the first communication unit is used for receiving a command for establishing a safety upgrading channel sent by an upper computer;
the first security unit is used for randomly generating a first secret key, encrypting the first secret key through a preset private key and generating a first handshake data packet;
the first communication unit is also used for sending a first handshake data packet to the upper computer and receiving a second handshake data packet sent by the upper computer;
and the first safety unit is also used for decrypting the second handshake data packet through the first key to obtain a second key randomly generated by the upper computer, and establishing a safety upgrading channel.
Optionally, the verification module 520 is configured to perform at least one of:
according to a file header in firmware abstract information included in the firmware security upgrade package, checking the validity of the firmware security upgrade package;
checking the version of the current main program of the Internet of things equipment according to the firmware version in the firmware abstract information included in the firmware safety upgrade package;
checking the version of the current boot loader of the equipment of the Internet of things according to the version of the boot loader in the firmware abstract information included in the firmware safety upgrade package;
checking the size of a new version firmware in the firmware security upgrade package according to the size of the firmware in the firmware abstract information included in the firmware security upgrade package;
and verifying the integrity of the new version firmware in the firmware security upgrade package according to the firmware signature in the firmware abstract information included in the firmware security upgrade package.
Optionally, the first communication unit is further configured to receive, through the secure upgrade channel, an encrypted firmware upgrade compression packet sent by the upper computer;
the first security module 510, further comprising:
the second safety unit is used for acquiring a pre-stored serial number of the Internet of things equipment and a pre-stored serial number of a CPU (central processing unit) of the Internet of things equipment and generating a third key; and decrypting and decompressing the encrypted firmware upgrading compression packet through the third secret key to obtain a firmware safety upgrading packet.
It can be understood that the device 500 for safely upgrading firmware of internet of things equipment according to the embodiment of the present invention can implement the processes of the method embodiments shown in fig. 1 and fig. 2, and can achieve the same technical effects, and details are not repeated here to avoid repetition.
Referring to fig. 6, fig. 6 is a schematic structural diagram of another security upgrading apparatus for firmware of an internet of things device according to an embodiment of the present invention, where the apparatus is applied to an upper computer, and as shown in fig. 6, the security upgrading apparatus 600 for firmware of an internet of things device may include:
the processing module 610 is configured to generate a firmware security upgrade package for firmware upgrade of the internet of things device.
And the second security module 620 is used for constructing a security upgrade channel between the Internet of things equipment and the upper computer and sending a firmware security upgrade package to the Internet of things equipment through the security upgrade channel.
Optionally, the second security module 620 may include:
the second communication unit is used for sending a command for establishing a security upgrading channel to the Internet of things equipment and receiving a first handshake data packet sent by the Internet of things equipment;
the third safety unit is used for decrypting the first handshake data packet through a preset public key to obtain a first secret key randomly generated by the Internet of things equipment; randomly generating a second key, encrypting the second key through the first key, and generating a second handshake data packet;
and the second communication unit is also used for sending a second handshake data packet to the Internet of things equipment so as to establish a security upgrading channel.
Optionally, the firmware security upgrade package comprises: firmware summary information and new versions of firmware;
the firmware summary information includes: a file header, a firmware version, a boot loader version, a firmware size, and a firmware signature.
Optionally, the processing module 610 may include:
the compression unit is used for compressing the new firmware version and the firmware abstract information to generate a firmware upgrading compression package;
the fourth safety unit is used for generating a third key according to the pre-stored serial number of the Internet of things equipment and the serial number of the CPU of the Internet of things equipment; encrypting the firmware upgrading compression package through a third key to obtain an encrypted firmware upgrading compression package;
and the second communication unit is also used for sending the encrypted firmware upgrading compression packet to the Internet of things equipment through the security upgrading channel.
It can be understood that the device 600 for upgrading the firmware of the internet of things device according to the embodiment of the present invention can implement the processes of the method embodiments shown in fig. 3 and fig. 4, and can achieve the same technical effects, and details are not repeated here to avoid repetition.
In addition, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, may implement each process in the method embodiments shown in fig. 1 and fig. 2, or may implement each process in the method embodiments shown in fig. 3 and fig. 4, and may achieve the same technical effect, and details are not repeated here to avoid repetition.
Referring to fig. 8, an electronic device 80 according to an embodiment of the present invention further includes a bus 81, a transceiver 82, an antenna 83, a bus interface 84, a processor 85, and a memory 86.
In the embodiment of the present invention, the electronic device 80 further includes: programs or instructions stored on the memory 86 and executable on the processor 85. Optionally, when being executed by the processor 85, the program or the instruction may implement each process of the method embodiment shown in fig. 1 and fig. 2, or may implement each process of the method embodiment shown in fig. 3 and fig. 4, and may achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
In FIG. 8, a bus architecture (represented by bus 81), the bus 81 may include any number of interconnected buses and bridges, the bus 81 linking together various circuits including one or more processors, represented by processor 85, and memory, represented by memory 86. The bus 81 may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface 84 provides an interface between the bus 81 and the transceiver 82. The transceiver 82 may be one element or may be multiple elements, such as multiple receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 85 is transmitted over a wireless medium via the antenna 83. Further, the antenna 83 receives the data and transmits the data to the processor 45.
The processor 85 is responsible for managing the bus 81 and general processing, and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And the memory 46 may be used to store data used by the processor 85 in performing operations.
Alternatively, the processor 85 may be a CPU, ASIC, FPGA or CPLD.
An embodiment of the present invention further provides a computer-readable storage medium, where a program or an instruction is stored, and when the program or the instruction is executed by a processor, the process of the method embodiment shown in fig. 1 and fig. 2 may be implemented, or the process of the method embodiment shown in fig. 3 and fig. 4 may be implemented, and the same technical effect may be achieved, and in order to avoid repetition, details are not repeated here.
Computer-readable media, which include both non-transitory and non-transitory, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention or the portions contributing to the prior art may be essentially embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a service classification device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and amendments can be made without departing from the principle of the present invention, and these modifications and amendments should also be considered as the protection scope of the present invention.

Claims (12)

1. A safe upgrading method for firmware of Internet of things equipment is applied to the Internet of things equipment and is characterized by comprising the following steps:
a safety upgrading channel between the construction networking equipment and the upper computer;
receiving a firmware security upgrade package sent by the upper computer through the security upgrade channel;
verifying the firmware security upgrade package;
and after the verification is passed, firmware upgrading is carried out on the Internet of things equipment according to the firmware safety upgrading package.
2. The method of claim 1, wherein constructing a secure upgrade channel between the internet of things device and the upper computer comprises:
receiving a command for establishing a safety upgrading channel sent by the upper computer;
randomly generating a first secret key, encrypting the first secret key through a preset private key, and generating a first handshake data packet;
sending the first handshake data packet to the upper computer, and receiving a second handshake data packet sent by the upper computer;
and decrypting the second handshake data packet through the first secret key to obtain a second secret key randomly generated by the upper computer, and establishing the security upgrading channel.
3. The method of claim 2, wherein the verifying the firmware security upgrade package comprises at least one of:
checking the validity of the firmware security upgrade package according to a file header in the firmware abstract information included in the firmware security upgrade package;
checking the version of the current main program of the Internet of things equipment according to the firmware version in the firmware abstract information included in the firmware safety upgrade package;
checking the version of the current boot loader of the equipment of the Internet of things according to the version of the boot loader in the firmware abstract information included in the firmware security upgrade package;
checking the size of a new version firmware in the firmware safety upgrading packet according to the size of the firmware in the firmware abstract information included in the firmware safety upgrading packet;
and verifying the integrity of the new version firmware in the firmware security upgrade package according to the firmware signature in the firmware abstract information included in the firmware security upgrade package.
4. The method according to claim 3, wherein the receiving the firmware security upgrade package sent by the upper computer through the security upgrade channel comprises:
receiving an encrypted firmware upgrading compression packet sent by the upper computer through the secure upgrading channel;
generating a third key according to a pre-stored serial number of the internet of things equipment and/or a serial number of a Central Processing Unit (CPU) of the internet of things equipment;
and decrypting and decompressing the encrypted firmware upgrading compression packet through the third secret key to obtain the firmware safety upgrading packet.
5. A safe upgrading method for equipment firmware of the Internet of things is applied to an upper computer and is characterized by comprising the following steps:
generating a firmware security upgrade package for firmware upgrade of the Internet of things equipment;
a safety upgrading channel between the construction networking equipment and the upper computer;
and sending the firmware security upgrade package to the Internet of things equipment through the security upgrade channel.
6. The method of claim 5, wherein constructing a secure upgrade channel between the internet of things device and the upper computer comprises:
sending a command for establishing a security upgrading channel to the Internet of things equipment, and receiving a first handshake data packet sent by the Internet of things equipment;
decrypting the first handshake data packet through a preset public key to obtain a first secret key randomly generated by the Internet of things equipment;
randomly generating a second key, encrypting the second key through the first key, and generating a second handshake data packet;
and sending the second handshake data packet to the Internet of things equipment to establish the security upgrading channel.
7. The method of claim 6, wherein the firmware security upgrade package comprises: firmware summary information and new versions of firmware;
the firmware summary information includes: a file header, a firmware version, a boot loader version, a firmware size, and a firmware signature.
8. The method of claim 7, wherein generating a firmware security upgrade package for firmware upgrade of the internet of things device comprises:
compressing the new firmware version and the firmware abstract information to generate a firmware upgrading compression package;
generating a third key according to a pre-stored serial number of the Internet of things equipment and/or a serial number of a CPU (Central processing Unit) of the Internet of things equipment;
encrypting the firmware upgrading compression packet through the third secret key to obtain an encrypted firmware upgrading compression packet;
wherein, the sending the firmware security upgrade package to the internet of things device through the security upgrade channel includes:
and sending the encrypted firmware upgrading compression packet to the Internet of things equipment through the secure upgrading channel.
9. The utility model provides a thing networking equipment firmware safety upgrading device, is applied to thing networking equipment, its characterized in that includes:
the first security module is used for constructing a security upgrading channel between the Internet of things equipment and the upper computer and receiving a firmware security upgrading packet sent by the upper computer through the security upgrading channel;
the verification module is used for verifying the firmware security upgrade package;
and the execution module is used for upgrading the firmware of the Internet of things equipment according to the firmware safety upgrading package after the verification is passed.
10. The utility model provides a thing networking equipment firmware safety upgrading device, is applied to the host computer, its characterized in that includes:
the processing module is used for generating a firmware security upgrading package for upgrading the firmware of the Internet of things equipment;
and the second safety module is used for constructing a safety upgrading channel between the Internet of things equipment and the upper computer, and sending the firmware safety upgrading packet to the Internet of things equipment through the safety upgrading channel.
11. An electronic device comprising a processor, a memory, and a program or instructions stored on the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the internet of things device firmware security upgrade method according to any one of claims 1-4, or the steps of the internet of things device firmware security upgrade method according to any one of claims 5-8.
12. A computer readable storage medium, storing thereon a program or instructions which, when executed by a processor, implement the steps of the internet of things device firmware security upgrade method according to any one of claims 1-4, or the steps of the internet of things device firmware security upgrade method according to any one of claims 5-8.
CN202110368150.8A 2021-04-06 2021-04-06 Internet of things equipment firmware safety upgrading method and device, electronic equipment and medium Pending CN115242413A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110368150.8A CN115242413A (en) 2021-04-06 2021-04-06 Internet of things equipment firmware safety upgrading method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110368150.8A CN115242413A (en) 2021-04-06 2021-04-06 Internet of things equipment firmware safety upgrading method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN115242413A true CN115242413A (en) 2022-10-25

Family

ID=83666970

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110368150.8A Pending CN115242413A (en) 2021-04-06 2021-04-06 Internet of things equipment firmware safety upgrading method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN115242413A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116382740A (en) * 2023-04-10 2023-07-04 广州锦高信息科技有限公司 Automatic upgrade release system and method for application software
CN116521210A (en) * 2023-04-18 2023-08-01 宁夏隆基宁光仪表股份有限公司 Method for upgrading firmware difference of Internet of things water meter

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109600451A (en) * 2018-12-28 2019-04-09 厦门中控智慧信息技术有限公司 A kind of terminal device firmware upgrade method and system based on Websocket long connection
CN110532735A (en) * 2018-05-23 2019-12-03 霍尼韦尔环境自控产品(天津)有限公司 Firmware upgrade method
US20200151335A1 (en) * 2018-11-12 2020-05-14 Thirdwayv, Inc Secure over-the-air firmware upgrade
CN111783068A (en) * 2020-06-03 2020-10-16 中移(杭州)信息技术有限公司 Device authentication method, system, electronic device and storage medium
CN111782238A (en) * 2020-05-27 2020-10-16 华帝股份有限公司 Software upgrading method and system for intelligent household electrical appliance

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532735A (en) * 2018-05-23 2019-12-03 霍尼韦尔环境自控产品(天津)有限公司 Firmware upgrade method
US20200151335A1 (en) * 2018-11-12 2020-05-14 Thirdwayv, Inc Secure over-the-air firmware upgrade
CN109600451A (en) * 2018-12-28 2019-04-09 厦门中控智慧信息技术有限公司 A kind of terminal device firmware upgrade method and system based on Websocket long connection
CN111782238A (en) * 2020-05-27 2020-10-16 华帝股份有限公司 Software upgrading method and system for intelligent household electrical appliance
CN111783068A (en) * 2020-06-03 2020-10-16 中移(杭州)信息技术有限公司 Device authentication method, system, electronic device and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116382740A (en) * 2023-04-10 2023-07-04 广州锦高信息科技有限公司 Automatic upgrade release system and method for application software
CN116382740B (en) * 2023-04-10 2023-11-14 广州锦高信息科技有限公司 Automatic upgrade release system and method for application software
CN116521210A (en) * 2023-04-18 2023-08-01 宁夏隆基宁光仪表股份有限公司 Method for upgrading firmware difference of Internet of things water meter
CN116521210B (en) * 2023-04-18 2024-05-03 宁夏隆基宁光仪表股份有限公司 Method for upgrading firmware difference of Internet of things water meter

Similar Documents

Publication Publication Date Title
US11258792B2 (en) Method, device, system for authenticating an accessing terminal by server, server and computer readable storage medium
US9621549B2 (en) Integrated circuit for determining whether data stored in external nonvolative memory is valid
KR102618665B1 (en) Version history management using blockchain
CN108377272B (en) Method and system for managing terminal of Internet of things
CN109040063B (en) Method, device and equipment for determining vehicle ECU key and storage medium
WO2018090763A1 (en) Method and device for configuring terminal master key
CN103023862A (en) Method, server and system used for integrity protection and authentication
CN105391717A (en) APK signature authentication method and APK signature authentication system
CN110661748A (en) Log encryption method, log decryption method and log encryption device
CN115242413A (en) Internet of things equipment firmware safety upgrading method and device, electronic equipment and medium
CN108170461B (en) Differential upgrade package generation method, differential upgrade method and device
CN107872315B (en) Data processing method and intelligent terminal
CN115795513A (en) File encryption method, file decryption method, file encryption device, file decryption device and equipment
CN111427860B (en) Distributed storage system and data processing method thereof
CN112583594B (en) Data processing method, acquisition device, gateway, trusted platform and storage medium
CN111400771A (en) Target partition checking method and device, storage medium and computer equipment
CN111597537A (en) Block chain network-based certificate issuing method, related equipment and medium
CN111858094A (en) Data copying and pasting method and system and electronic equipment
CN115426106B (en) Identity authentication method, device and system, electronic equipment and storage medium
CN110780900A (en) Electric power acquisition terminal upgrading method and system and electric power acquisition terminal
CN112866195B (en) Agile data transmission method and device, computer equipment and storage medium
CN111130788B (en) Data processing method and system, data reading method and iSCSI server
CN109358875B (en) Ubuntu system-based hardware wallet offline upgrading device and method
CN116541046B (en) Energy storage system upgrading method and device, computer equipment and readable storage medium
CN117932622B (en) FOTA upgrading method, device and equipment of embedded equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination