Upgrade data packet encryption method, upgrade data packet decryption method, firmware upgrade method, electronic device, and storage medium

By splitting, encrypting and encrypting the upgraded data packets in a separate way, the problem of the security of upgrading files cannot be guaranteed during the firmware upgrade process is solved, and the security of packet transmission is achieved.

WO2025044152A1PCT designated stage expired Publication Date: 2025-03-06SANSURE BIOTECH INC
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/081825
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-28
Filing Date
2024-03-15
Publication Date
2025-03-06

AI Technical Summary

Technical Problem

During the firmware upgrade process, the upgrade file may be stolen, tampered with or maliciously used by unauthorized personnel, resulting in the security of the upgrade file being unable to be guaranteed.

Method used

An encryption method for upgrading data packets is adopted. By splitting the upgraded data packet into multiple data packets and encrypting each data packet separately, the overall data packet is finally encrypted as a whole to ensure the security of the data packet during transmission.

Benefits of technology

It effectively prevents theft and tampering of upgrade files during transmission, and ensures the security of packet transmission during firmware upgrade.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024081825_06032025_PF_FP_ABST
    Figure CN2024081825_06032025_PF_FP_ABST
Patent Text Reader

Abstract

Provided are an upgrade data packet encryption method, an upgrade data packet decryption method, a firmware upgrade method, an electronic device, and a storage medium. The upgrade data packet encryption method comprises: splitting an upgrade data packet according to a preset packet length to obtain a plurality of data packets (S310); separately encrypting each data packet among the plurality of data packets to obtain a plurality of separately encrypted data packets (S320); generating an integral data packet on the basis of the plurality of separately encrypted data packets (S330); and integrally encrypting the integral data packet to obtain an integrally encrypted data packet (S340). In a firmware upgrade process, first, an upgrade data packet is split, each data packet among the plurality of data packets is separately encrypted, and finally, an integral data packet generated on the basis of the plurality of separately encrypted data packets is integrally encrypted, thereby effectively ensuring the security of an upgrade file in the firmware upgrade process.
Need to check novelty before this filing date? Find Prior Art

Description

Upgrade data packet encryption method, upgrade data packet decryption method, firmware upgrade method, electronic device and storage medium Technical Field

[0001] The present application relates to the technical field of firmware upgrade, and in particular to an encryption method for an upgrade data packet, a decryption method for an upgrade data packet, a firmware upgrade method, an electronic device, and a storage medium. Background Art

[0002] Firmware refers to the software embedded in a hardware device. A firmware upgrade is the process of updating or upgrading the firmware in a device or system. The firmware upgrade process involves the transmission or storage of upgrade files. However, upgrade files may contain sensitive code, configuration information, or user data. During transmission or storage, these files may be stolen, tampered with, or used maliciously by unauthorized personnel, making the security of the upgrade files during the firmware upgrade process impossible to guarantee.

[0003] Summary of the Invention

[0004] The purpose of the embodiments of the present application is to provide an encryption method for an upgrade data packet, a decryption method for an upgrade data packet, a firmware upgrade method, an electronic device and a storage medium, which are used to effectively ensure the security of the upgrade file during the firmware upgrade process.

[0005] In order to achieve the above-mentioned purpose, the first aspect of an embodiment of the present application provides an encryption method for an upgrade data packet, which is applied to an encryption device. The encryption method for the upgrade data packet includes: splitting the upgrade data packet according to a preset packet length to obtain multiple data packets; encrypting each of the multiple data packets separately to obtain multiple separately encrypted data packets; generating an overall data packet based on multiple separately encrypted data packets; and encrypting the overall data packet as a whole to obtain an overall encrypted data packet.

[0006] A second aspect of an embodiment of the present application provides a decryption method for an upgrade data packet, which is applied to an upgrade control device. The decryption method for the upgrade data packet includes: decrypting the entire encrypted data packet as a whole to obtain an entire data packet; splitting the entire data packet according to a preset packet length to obtain multiple individually encrypted data packets; and sending at least one of the multiple individually encrypted data packets to the device to be upgraded.

[0007] A third aspect of an embodiment of the present application provides another method for decrypting an upgrade data packet, which is applied to a device to be upgraded. The method for decrypting an upgrade data packet includes: receiving at least one separately encrypted data packet sent by an upgrade control device; and separately decrypting each separately encrypted data packet in the at least one separately encrypted data packet to obtain at least one data packet.

[0008] The fourth aspect of an embodiment of the present application provides a firmware upgrade method, which is applied to a device to be upgraded. The firmware upgrade method includes: executing the decryption method of the upgrade data packet as any one of the third aspects to obtain at least one data packet; and upgrading the firmware based on the at least one data packet.

[0009] A fifth aspect of an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores executable code, and the processor is configured to execute the executable code to implement any one of the methods described in any one of the first to fourth aspects.

[0010] A sixth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute any one of the methods described in the first to fourth aspects above.

[0011] Through the above technical solution, during the firmware upgrade process, the upgrade data packet is first split to obtain multiple data packets, and each data packet in the multiple data packets is encrypted separately to obtain multiple individually encrypted data packets. Finally, the overall data packet generated based on the multiple individually encrypted data packets is encrypted as a whole, effectively ensuring the security of the upgrade file during the firmware upgrade process. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementation methods, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application.

[0013] FIG1 is an example diagram of a system framework provided in an embodiment of the present application.

[0014] FIG2 a is an architecture diagram of a wireless upgrade system provided in an embodiment of the present application.

[0015] FIG2 b is an architecture diagram of a wired upgrade system provided in an embodiment of the present application.

[0016] FIG3 is an overall flow chart of an encryption method for an upgrade data packet provided in an embodiment of the present application.

[0017] FIG4 is an overall flow chart of a first decryption method for an upgrade data packet provided in an embodiment of the present application.

[0018] FIG5 is an overall flow chart of a second decryption method for an upgrade data packet provided in an embodiment of the present application.

[0019] FIG6 is an overall flow chart of a firmware upgrade method provided in an embodiment of the present application.

[0020] FIG7 is an overall flow chart of an upgrade data packet encryption method, a first upgrade data packet decryption method, a second upgrade data packet decryption method, and a firmware upgrade method provided in an embodiment of the present application.

[0021] FIG8 is an overall flow chart of an encryption method for an upgrade data packet, a first decryption method for an upgrade data packet, a second decryption method for an upgrade data packet, and a firmware upgrade method provided in another embodiment of the present application.

[0022] FIG9 is an overall flow chart of an encryption method for an upgrade data packet, a first decryption method for an upgrade data packet, a second decryption method for an upgrade data packet, and a firmware upgrade method provided in yet another embodiment of the present application.

[0023] FIG10 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following describes the specific implementation of the embodiment of the present application in detail with reference to the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the embodiment of the present application and is not intended to limit the embodiment of the present application.

[0025] During firmware upgrades, upgrade files can be transferred or stored via storage media such as a USB flash drive or a wireless network. For example, the firmware in a device or system can obtain updated firmware or software via storage media such as a USB flash drive. Alternatively, the firmware in a device or system can directly download and install updated firmware or software from a remote server via a wireless network.

[0026] Upgrade files may contain sensitive code, configuration information, or user data. If this data is not encrypted during transmission or storage, it may be stolen, tampered with, or used maliciously by unauthorized personnel. Therefore, an encryption method is urgently needed to ensure the security of upgrade files during the firmware upgrade process.

[0027] The following describes in detail the system architecture for the application scenarios of the various methods mentioned in the embodiments of this application, in conjunction with Figure 1. As shown in Figure 1, the application scenarios provided in the embodiments of this application involve an encryption device 10, an upgrade control device 20, and a device to be upgraded 30. The encryption device 10 is connected to the upgrade control device 20, which is in turn connected to the device to be upgraded 30.

[0028] In one embodiment, the encryption device 10 and the upgrade control device 20 are communicatively connected, and the upgrade control device 20 and the device to be upgraded 30 are communicatively connected, that is, the encryption device 10 and the upgrade control device 20 can be connected by wired or wireless means, such as cables or Wi-Fi; similarly, the upgrade control device 20 and the device to be upgraded 30 can be connected by wired or wireless means, such as cables or Wi-Fi.

[0029] In one embodiment, the encryption device 10 can be any device with encryption function, such as an encryption server, an encryption chip, an encryption module or encryption hardware; the upgrade control device 20 can be any device with decryption function and control of the upgrade process, such as an upgrade server or a device containing upgrade tools or upgrade management software; the device to be upgraded 30 can be any device that requires firmware or software upgrades, such as intelligent instruments, internal components of instruments or local area network devices.

[0030] It should be understood that the upgrade control device 20 is not limited to hardware, but can also be a platform built through a server, and the platform can be a platform to be upgraded or a network control platform.

[0031] The encryption device 10 is configured to execute an encryption method for an upgrade data packet. For example, the encryption method includes: splitting the upgrade data packet according to a preset packet length to obtain multiple data packets; encrypting each of the multiple data packets separately to obtain multiple separately encrypted data packets; generating an overall data packet based on the multiple separately encrypted data packets; and encrypting the overall data packet as a whole to obtain an overall encrypted data packet.

[0032] The upgrade control device 20 is configured to execute a first decryption method for the upgrade data packet. For example, the first decryption method includes: decrypting the entire encrypted data packet as a whole to obtain an entire data packet; splitting the entire data packet according to a preset packet length to obtain multiple individually encrypted data packets; and sending at least one of the multiple individually encrypted data packets to the device to be upgraded.

[0033] The device to be upgraded 30 is configured to execute a second decryption method for the upgrade data packet and a firmware upgrade method. For example, the second decryption method includes: receiving at least one individually encrypted data packet sent by the upgrade control device; and individually decrypting each of the at least one individually encrypted data packet to obtain at least one data packet. For example, the upgrade method includes: executing the second decryption method to obtain at least one data packet; and upgrading the firmware based on the at least one data packet.

[0034] In the specific firmware upgrade scenario of this embodiment, the firmware can be upgraded by Over-The-Air Technology (OTA) upgrade, Universal Serial Bus (USB) upgrade, USB flash drive or other storage media upgrade, or Universal Asynchronous Receiver / Transmitter (UART) upgrade.

[0035] Referring to Figure 2a, in the first embodiment, the firmware is upgraded by OTA upgrade. OTA upgrade is a technology for upgrading firmware or software via a wireless network. It sends upgrade data packets to remote devices through a cloud server, thereby updating the firmware or software of the device. If the firmware is upgraded by OTA upgrade, the upgrade control device 20 can be a cloud platform, that is, the entire decryption is performed by the cloud platform, and the individual decryption is performed by the device to be upgraded 30. The encryption device 10 and the upgrade control device 20 are connected wirelessly, such as Wi-Fi or a cellular network, and the upgrade control device 20 and the device to be upgraded 30 are connected wirelessly, such as Wi-Fi or a cellular network.

[0036] 2b, in the second embodiment, in a scenario where the firmware is upgraded using USB upgrade or UART upgrade, the upgrade control device 20 is connected to the encryption device 10 by wire, and the upgrade control device 20 is connected to the device to be upgraded 30 by wire.

[0037] USB upgrades involve connecting to the device to be upgraded 30 via a USB port and using specialized upgrade tools or software to upgrade the firmware or software. The upgrade control device 20 can be a computer, and the upgrade control device 20 and the encryption device 10 are connected via a USB cable. The upgrade control device 20 is also connected to the device to be upgraded 30 via a USB cable.

[0038] UART upgrades involve connecting to the device to be upgraded 30 via a serial port and upgrading the firmware or software using specialized upgrade tools or software. The upgrade control device 20 can be a computer, connected to the encryption device 10 via a wired serial cable. The upgrade control device 20 also connects to the device to be upgraded 30 via a wired serial cable.

[0039] In the third embodiment, a storage medium such as a USB flash drive may be used for firmware upgrade, that is, the device to be upgraded 30 may be upgraded through an upgrade program or software in the storage medium.

[0040] It should be noted that the connection relationship between the encryption device 10 and the upgrade control device 20, and the connection relationship between the device to be upgraded 30 and the upgrade control device 20 are not limited to the above three embodiments. That is, the connection relationship between the encryption device 10 and the upgrade control device 20 can be a wireless connection or a wired connection. Similarly, the connection relationship between the device to be upgraded 30 and the upgrade control device 20 can be a wireless connection or a wired connection, which is not limited here.

[0041] The system provided in the embodiment of the present application realizes the encryption and decryption process of the upgrade data packet during the firmware upgrade process through the communication between the encryption device 10 and the upgrade control device 20, and the communication between the upgrade control device 20 and the device to be upgraded 30, thereby effectively ensuring the security of the upgrade file during the firmware upgrade process.

[0042] 1 , the various methods mentioned in the embodiments of the present application in FIG. 3 to FIG. 9 are described in detail below.

[0043] Figure 3 is a flowchart of an overall method for encrypting an upgrade data packet provided by an embodiment of the present application. The upgrade data packet encryption method of Figure 3 is executed by the encryption device 10 mentioned in Figure 1. As shown in Figure 3, the method includes the following steps.

[0044] S310: Split the upgrade data packet according to a preset packet length to obtain multiple data packets.

[0045] Before splitting the upgrade data packet, the encryption device 10 may obtain the upgrade data packet.

[0046] An upgrade data package refers to a data set of a new version or patch of a software or system, and generally includes modified program files, configuration files, or library files, etc. In this embodiment, the upgrade data package is used to upgrade the device 30 to be upgraded mentioned in FIG1 .

[0047] The preset packet length refers to the fixed length of each data packet that is pre-set when the upgrade data packet is split. After obtaining the upgrade data packet, the upgrade data packet is split into multiple data packets according to the preset packet length. The length of each data packet can be consistent or inconsistent, and this embodiment of the application does not specifically limit this.

[0048] S320: Encrypt each of the multiple data packets separately to obtain multiple separately encrypted data packets.

[0049] The encryption device 10 uses an encryption algorithm to encrypt each split data packet separately. In this embodiment, the encryption algorithm uses the AES128 encryption algorithm. AES refers to the Advanced Encryption Standard. There are three common AES schemes: AES-128, AES-192, and AES-256. The difference lies in the key length. The key length of AES-128 is 16 bytes, the key length of AES-192 is 24 bytes, and the key length of AES-256 is 32 bytes. The longer the key, the higher the security strength. In this embodiment, the AES128 encryption algorithm is used. In addition, other encryption algorithms can also be used, which will not be described in detail here.

[0050] S330: Generate an overall data packet based on multiple individually encrypted data packets.

[0051] The encryption device 10 combines multiple individually encrypted data packets into a single data packet. After each data packet is encrypted individually, all of the individually encrypted data packets may be combined into a single data packet, or some of the individually encrypted data packets may be combined into a single data packet. For example, if each data packet is encrypted individually, resulting in 10 individually encrypted data packets, the 10 individually encrypted data packets may be combined into a single data packet, or six individually encrypted data packets may be combined into a single data packet.

[0052] S340: Encrypt the entire data packet as a whole to obtain an encrypted data packet as a whole.

[0053] The encryption device 10 uses an encryption algorithm to encrypt the entire data packet to obtain an encrypted data packet. For example, the encryption algorithm in this embodiment uses the AES128 encryption algorithm, and other encryption algorithms can also be used, which will not be described in detail here.

[0054] The upgrade data packet encryption method provided in this embodiment employs a double encryption method during the firmware upgrade process. Specifically, each of the multiple data packets obtained by splitting the upgrade data packet is individually encrypted to generate multiple individually encrypted data packets. Finally, the overall data packet generated from the multiple individually encrypted data packets is encrypted as a whole, effectively ensuring the security of the upgrade file during the firmware upgrade process. Furthermore, compared to single-pass encryption, the double encryption method employed in this application offers enhanced security.

[0055] In one implementation of this embodiment, in order for the device to be upgraded 30 in Figure 1 to be able to determine whether to upgrade the firmware based on at least one data packet among multiple data packets, after the encryption device 10 obtains the upgrade data packet, the encryption method of the upgrade data packet also includes the following steps: the encryption device 10 verifies the upgrade data packet to obtain a first verification code.

[0056] In this embodiment, encryption device 10 uses the CRC32 checksum algorithm to verify the update data packet. CRC32 is a cyclic redundancy check (Cyclic Redundancy Check) that detects errors in data transmission or storage. It also generates a 32-bit checksum by performing a polynomial division on the data to verify the integrity and accuracy of the data. Other checksum algorithms may also be used for verification, which will not be discussed here.

[0057] Since the upgrade data packet may be damaged or lost during transmission, after obtaining the upgrade data packet, the upgrade data packet can be verified to obtain a first verification code, which is used for subsequent data integrity verification of the upgrade data packet.

[0058] In one implementation of this embodiment, in order for the device to be upgraded 30 in Figure 1 to be able to individually decrypt each individually encrypted data packet in at least one individually encrypted data packet, after the encryption device 10 obtains multiple individually encrypted data packets, the encryption method for the upgrade data packet also includes the following steps: the encryption device 10 verifies at least one individually encrypted data packet in the multiple individually encrypted data packets to obtain at least one individually encrypted verification code.

[0059] One individually encrypted data packet corresponds to one individually encrypted verification code, that is, each individually encrypted data packet in the at least one individually encrypted data packet is individually verified.

[0060] The encryption device 10 uses a verification algorithm to perform a separate verification on each individually encrypted data packet. In this embodiment, the encryption device 10 uses a CRC32 verification algorithm to perform a separate verification on each individually encrypted data packet and generate at least one individual encryption verification code. In addition, other verification algorithms can also be used for verification, which will not be elaborated here.

[0061] Since individually encrypted data packets may be damaged or lost during transmission, after obtaining the individually encrypted data packets, the individually encrypted data packets can be verified to obtain an individually encrypted verification code, which is used for subsequent data integrity verification of the individually encrypted data packets.

[0062] In one implementation of this embodiment, in order to be able to subsequently transmit the verification code between different devices and prevent the data packet from being mistakenly sent to an unmatched device to be upgraded, after the encryption device 10 obtains the overall encrypted data packet, the encryption method of the upgrade data packet also includes the following steps: the encryption device 10 imports the device information frame into the overall encrypted data packet.

[0063] In this embodiment, the device information frame includes information related to the device (eg, the device to be upgraded 30 in FIG. 1 ), such as board type, hardware version, or firmware version. In addition, the device information frame also includes a preset packet length.

[0064] In one implementation of this embodiment, in order for the upgrade control device 20 in Figure 1 to be able to decrypt the entire encrypted data packet as a whole, after the encryption device 10 imports the device information frame into the overall encrypted data packet, the encryption method of the upgrade data packet also includes the following steps: the encryption device 10 verifies the overall encrypted data packet including the device information frame to obtain a second verification code.

[0065] The encryption device 10 uses a verification algorithm to verify the entire encrypted data packet including the device information frame. In this embodiment, the encryption device 10 uses a CRC32 verification algorithm to verify the entire encrypted data packet including the device information frame, and then generates a second verification code. In addition, other verification algorithms can also be used for verification, which will not be repeated here.

[0066] Because the entire encrypted data packet including the device information frame may be damaged or lost during transmission, after obtaining the entire encrypted data packet including the device information frame, the entire encrypted data packet including the device information frame can be verified to obtain a second verification code. The second verification code is then used to verify the data integrity of the entire encrypted data packet including the device information frame. In addition, verifying the entire encrypted data packet including the device information frame effectively ensures the integrity and accuracy of the data in the entire encrypted data packet.

[0067] In one implementation of this embodiment, to enable the subsequent transmission of the verification code between different devices as described above, the upgrade data packet encryption method further includes at least one of the following steps: the encryption device 10 writes the first verification code into the device information frame, the encryption device 10 writes the second verification code into the device information frame, or the encryption device 10 writes at least one separately encrypted verification code into the device information frame. In other words, different verification codes are also transmitted along with the transmission of the device information frame.

[0068] Therefore, the device information frame also includes at least one of the following verification codes: a first verification code obtained by verifying the upgrade data packet, a second verification code obtained by verifying the overall encrypted data packet including the device information frame, or at least one individually encrypted verification code obtained by verifying at least one individually encrypted data packet among multiple individually encrypted data packets.

[0069] When only the first verification code and the second verification code are written into the device information frame, the format of the device information frame is as follows.

[0070] The board type refers to the device type of the device to be upgraded. In this embodiment, there are two types of device types: the first is the device class and the second is the module class. The device type is represented by hexadecimal data, for example, 0x01 is used to represent the device class.

[0071] The hardware version refers to the version of the device 30 to be upgraded, and is used to distinguish different hardware devices or configurations.

[0072] The firmware version refers to the version of the software firmware running on the device under test and is used to distinguish different software firmware versions.

[0073] The firmware length refers to the total byte length of the entire encrypted data packet.

[0074] The start address refers to the start address of the firmware.

[0075] After the first verification code, the second verification code, and at least one separately encrypted verification code are all written into the device information frame, the format of the device information frame is as follows.

[0076] In one implementation of this embodiment, in order for the upgrade control device 20 in Figure 1 to determine whether to send at least one separate encrypted data packet to the device to be upgraded 30, after the encryption device 10 obtains the overall encrypted data packet and before the encryption device 10 imports the device information frame into the overall encrypted data packet, the encryption method of the upgrade data packet also includes the following steps: the encryption device 10 verifies the overall encrypted data packet to obtain an overall encryption verification code.

[0077] The encryption device 10 uses a verification algorithm to verify the entire encrypted data packet. In this embodiment, the encryption device 10 uses a CRC32 verification algorithm to verify the entire encrypted data packet and generate an overall encryption verification code. In addition, other verification algorithms can also be used for verification, which will not be repeated here.

[0078] In order to be able to transmit the overall encryption verification code between different devices, the encryption device 10 can also write the overall encryption verification code into the device information frame. Therefore, in addition to the first verification code, the second verification code and at least one separate encryption verification code, the device information frame also includes the overall encryption verification code. The format of the device information frame is as follows.

[0079] It should be noted that the device information frame changes dynamically, and each time the device information frame is written, the content of the device information frame changes. For example, when verifying the entire encrypted data packet including the device information frame to obtain a second check code, the device information frame may include the first check code, at least one individual encrypted check code, or at least one check code from the overall encrypted check code. In this way, the first check code, at least one individual encrypted check code, or at least one check code from the overall encrypted check code can be verified, thereby preventing these check codes from being tampered with during transmission. The embodiments of the present application are not limited to the content included in the device information frame when verifying the entire encrypted data packet including the device information frame.

[0080] In addition, in order to facilitate the subsequent use of the second verification code to decrypt the entire data packet including the device information frame, the second verification code can be written to the first address of the device information frame, and the above-mentioned board type to first verification code, at least one individual encryption verification code or at least one verification code in the overall encryption verification code can be written to the first address of the device information frame. However, the embodiment of the present application does not limit the writing position of the above-mentioned board type to first verification code, at least one individual encryption verification code or at least one verification code in the overall encryption verification code in the device information frame, as long as it is located after the second verification code.

[0081] In one implementation of this embodiment, since the Bin file format is used for upgrading the firmware, but the data format of the above-mentioned upgrade data packet is the HEX file format, after obtaining the upgrade data packet, the encryption method of the upgrade data packet also includes the following steps: the encryption device 10 converts the data format of the upgrade data packet from the HEX file format to the Bin file format based on a preset data format conversion algorithm.

[0082] In this embodiment, the data format conversion algorithm is the Hex2Bin algorithm, which is used to convert hexadecimal numbers to binary numbers. The HEX file format is a text file format used to represent the hexadecimal representation of binary data; the Bin file format is a binary file format used to store and transmit binary data. Unlike the HEX file format, the Bin file format stores data directly in binary form and has no specific structure, metadata, or address information. Therefore, the Bin file format can be used for firmware upgrades.

[0083] In the above steps, when the upgrade data packet is verified and the first verification code is obtained, the upgrade data packet is in a Bin file format.

[0084] Figure 4 is a flowchart of a first decryption method for an upgrade data packet according to one embodiment of the present application. The first decryption method for the upgrade data packet in Figure 4 is executed by the upgrade control device 20 mentioned in Figure 1. The first decryption method for the upgrade data packet shown in Figure 4 corresponds to the encryption method described above and includes the following steps.

[0085] S410: Decrypt the entire encrypted data packet to obtain the entire data packet.

[0086] Before performing the overall decryption, the upgrade control device 20 may obtain the overall encrypted data packet. For example, the upgrade control device 20 obtains the overall encrypted data packet through a preset interface.

[0087] The upgrade control device 20 uses a decryption algorithm to decrypt the entire encrypted data packet. In this embodiment, if the encryption device 10 uses the AES128 encryption algorithm for overall encryption, the upgrade control device 20 also uses the AES128 decryption algorithm for overall decryption. That is, the overall decryption algorithm corresponds to the encryption algorithm used for overall encryption. After the overall encrypted data packet is decrypted, the entire data packet is obtained.

[0088] It should be understood that the entire data packet mentioned in step S410 is the data packet after overall decryption, and the entire data packet mentioned in step S330 is the data packet before overall encryption. The object of overall decryption is the entire encrypted data packet. The entire encrypted data packet mentioned here may or may not include the device information frame, and this embodiment of the application does not specifically limit this.

[0089] Since overall encryption involves encrypting an overall data packet generated from multiple individually encrypted data packets to obtain an overall encrypted data packet, overall decryption involves decrypting the overall encrypted data packet to obtain an overall data packet generated from multiple individually encrypted data packets. It should be understood that when a combined approach is used to generate an overall data packet, the overall data packet generated from multiple individually encrypted data packets is the overall data packet formed by combining the multiple individually encrypted data packets.

[0090] S420: Split the entire data packet according to the preset packet length to obtain multiple individually encrypted data packets.

[0091] After obtaining the entire data packet, the upgrade control device 20 splits the entire data packet according to a preset packet length to obtain multiple individually encrypted data packets.

[0092] It should be understood that when the overall encrypted data packet includes a device information frame, since the device information frame includes a preset packet length, it can be directly split using the preset packet length in the device information frame; when the overall encrypted data packet does not include a device information frame, the device information frame can be obtained first, for example, by obtaining the device information frame through a preset interface, so that after obtaining the device information frame, it can be split using the preset packet length in the device information frame.

[0093] Since the overall data packet is based on multiple individual encrypted data packets, for example, is formed by merging multiple individual encrypted data packets, multiple individual encrypted data packets will be obtained after the overall data packet is split.

[0094] S430: Send at least one individually encrypted data packet among the multiple individually encrypted data packets to the device to be upgraded.

[0095] It should be understood that after obtaining multiple separate encrypted data packets, the upgrade control device 20 can send multiple separate encrypted data packets to the device to be upgraded 30 in Figure 1, or the upgrade control device 20 can only send one separate encrypted data packet to the device to be upgraded 30. The embodiment of the present application does not make specific limitations on this.

[0096] When the upgrade control device 20 sends multiple individually encrypted data packets to the device to be upgraded 30, in order to ensure the accuracy of the individually encrypted data packets during transmission and prevent transmission errors, the upgrade control device 20 can send multiple individually encrypted data packets to the device to be upgraded 30 one by one.

[0097] It should be noted that the first decryption method for the upgrade data packet provided in this embodiment is used to decrypt the overall encryption in the encryption method of the above-mentioned upgrade data packet, that is, first decrypt the overall encrypted data packet as a whole to obtain the overall data packet, and then split the overall data packet to obtain at least one separately encrypted data packet, and finally send at least one separately encrypted data packet to the device to be upgraded, which effectively ensures the security of data packet transmission during the firmware upgrade process.

[0098] In one implementation of this embodiment, since the device information frame also includes a second verification code, when decrypting the entire encrypted data packet as a whole, the upgrade control device 20 can use the second verification code to perform overall decryption. Specifically, step S410 includes the following steps: the upgrade control device 20 verifies the entire encrypted data packet including the device information frame to obtain a third verification code; if the third verification code is consistent with the second verification code, the upgrade control device 20 decrypts the entire encrypted data packet as a whole to obtain the entire data packet.

[0099] During encryption, the second verification code is obtained by the encryption device 10 by verifying the entire encrypted data packet including the device information frame and is written into the device information frame; during decryption, the upgrade control device 20 verifies the entire encrypted data packet including the device information frame to obtain the third verification code.

[0100] The upgrade control device 20 uses a verification algorithm to verify the overall encrypted data packet including the device information frame. In this embodiment, if after overall encryption, the encryption device 10 uses a CRC32 verification algorithm to verify the overall encrypted data packet including the device information frame, then before overall decryption, the upgrade control device 20 uses a CRC32 verification algorithm to verify the overall encrypted data packet including the device information frame, that is, the verification algorithm used during overall encryption and overall decryption remains consistent.

[0101] If the third verification code is consistent with the second verification code, it indicates that the verification is successful. At this time, the upgrade control device 20 decrypts the entire encrypted data packet including the device information frame as a whole to obtain the entire data packet.

[0102] If the third verification code is inconsistent with the second verification code, it indicates that the verification has failed. At this time, the determination process ends, that is, the upgrade control device 20 stops decrypting the entire encrypted data packet.

[0103] In this embodiment, the second check code obtained after the overall encryption is compared with the third check code obtained before the overall decryption to ensure the integrity and accuracy of the overall encrypted data packet. Only after determining that the overall encrypted data packet is correct will it be decrypted as a whole, thereby ensuring the security of data packet transmission during the firmware upgrade process.

[0104] In one implementation manner of this embodiment, before the upgrade control device 20 sends at least one of multiple separately encrypted data packets to the device to be upgraded 30, the first decryption method also includes the following steps: the upgrade control device 20 sends a device information frame to the device to be upgraded 30; if the matching information received by the upgrade control device 20 from the device to be upgraded 30 is a successful matching information, the upgrade control device 20 sends a start upgrade command to the device to be upgraded 30.

[0105] The upgrade control device 20 sends the device information frame to the device to be upgraded 30 mainly for the device to be upgraded 30 to generate matching information according to the device information frame and the device information of the device to be upgraded 30 .

[0106] The device information of the device to be upgraded 30 includes the hardware version of the device to be upgraded 30, and the matching information includes matching success information and matching failure information. Since the device information frame includes the hardware version of the device to be upgraded 30, if the hardware version in the device information of the device to be upgraded 30 is consistent with the hardware version in the device information frame, it indicates that the match is successful. In this case, the device to be upgraded 30 generates matching success information. If the hardware version in the device information of the device to be upgraded 30 is inconsistent with the hardware version in the device information frame, it indicates that the match failed. In this case, the device to be upgraded 30 generates matching failure information, determines that the process is terminated, and stops executing subsequent steps. For example, the upgrade control device 20 stops executing the step of sending the upgrade start command to the device to be upgraded.

[0107] The upgrade control device 20 sends the upgrade start command to the device to be upgraded 30 mainly for the device to be upgraded 30 to determine whether to shake hands with the upgrade control device 20 .

[0108] If the upgrade control device 20 receives a successful match from the device to be upgraded 30, it sends a start upgrade command to the device to be upgraded 30, instructing the device to be upgraded 30 to start the upgrade. The device to be upgraded 30 shakes hands with the host computer (i.e., the upgrade control device) according to the start upgrade command and feeds back handshake information, which includes handshake success information and handshake failure information.

[0109] The handshake between the device to be upgraded 30 and the upgrade control device 20 is a communication and confirmation process between the two devices to ensure a normal communication connection and prepare for the upgrade operation. If the handshake is successful, the device to be upgraded 30 sends a handshake success message back to the upgrade control device 20; if the handshake fails, the device to be upgraded 30 sends a handshake failure message back to the upgrade control device 20.

[0110] By sending the device information frame by the upgrade control device 20 and generating matching information by the device to be upgraded 30, it is effectively prevented that a separate encrypted data packet is mistakenly sent to an unmatched device to be upgraded, thereby improving the accuracy of the upgrade.

[0111] The upgrade control device 20 sends at least one separately encrypted data packet to the device to be upgraded 30 when the upgrade control device 20 receives a handshake success message from the device to be upgraded 30. That is, if the handshake message received by the upgrade control device 20 from the device to be upgraded 30 is a handshake success message, the upgrade control device 20 sends at least one separately encrypted data packet to the device to be upgraded 30.

[0112] It should be noted that the timing for the upgrade control device 20 to send at least one individually encrypted data packet to the device to be upgraded 30 can be determined not only when the upgrade control device 20 receives a handshake success message from the device to be upgraded 30, but also through verification. For example, as mentioned above, after obtaining the overall encrypted data packet and before importing the device information frame into the overall encrypted data packet, the encryption device 10 verifies the overall encrypted data packet to obtain an overall encryption verification code. In this embodiment, after splitting the overall data packet into multiple individually encrypted data packets, the upgrade control device 20 performs an overall verification on the multiple individually encrypted data packets to obtain an overall decryption verification code, and compares the overall decryption verification code with the overall encryption verification code. If the overall decryption verification code matches the overall encryption verification code, the upgrade control device 20 executes the step of sending at least one individually encrypted data packet to the device to be upgraded 30. If the overall decryption verification code does not match the overall encryption verification code, the determination process ends and no further operations are performed. In other words, the upgrade control device 20 can also send at least one individually encrypted data packet to the device to be upgraded 30 when the overall decryption verification code matches the overall encryption verification code.

[0113] The timing when the upgrade control device 20 sends at least one separately encrypted data packet to the device to be upgraded 30 can also include the above two timings at the same time, that is, when the upgrade control device 20 receives a handshake success message from the device to be upgraded 30 and the overall decryption verification code is consistent with the overall encryption verification code, the upgrade control device 20 sends at least one separately encrypted data packet to the device to be upgraded 30, but the embodiment of the present application does not limit the execution order of these two timings.

[0114] However, regardless of the timing when the upgrade control device 20 sends at least one separately encrypted data packet to the device to be upgraded 30, and regardless of whether there is a timing when the upgrade control device 20 sends at least one separately encrypted data packet to the device to be upgraded 30, when the upgrade control device 20 sends multiple separately encrypted data packets to the device to be upgraded 30, the upgrade control device 20 can send multiple separately encrypted data packets to the device to be upgraded 30 one by one.

[0115] The upgrade control device 20 sends multiple individual encrypted data packets to the device to be upgraded 30 one by one, including the following steps: the upgrade control device 20 sends multiple individual encrypted data packets to the device to be upgraded 30 one by one in a preset order.

[0116] The preset order is determined based on the order of the multiple individual encrypted data packets formed when the overall data packet is split. The multiple individual encrypted data packets can be transmitted in the preset order during the transmission process to avoid transmission errors.

[0117] The one-by-one sending of multiple individually encrypted data packets can be completed by the following steps. For example, the upgrade control device 20 sends the first individually encrypted data packet among the multiple individually encrypted data packets to the device to be upgraded 30 (step a). If the upgrade control device 20 receives a successful reply message from the device to be upgraded 30, the upgrade control device 20 sends the second individually encrypted data packet among the multiple individually encrypted data packets to the device to be upgraded 30 (step b). The above steps a) and b) are repeated until the upgrade control device 20 completes the one-by-one sending of the multiple individually encrypted data packets.

[0118] The first separately encrypted data packet and the second separately encrypted data packet are two adjacent separately encrypted data packets formed when the whole decrypted data packet is split. If the handshake information received by the upgrade control device 20 from the device to be upgraded 30 is a handshake success information, the upgrade control device 20 executes step a).

[0119] After receiving the first separately encrypted data packet, the device to be upgraded 30 first determines the format, integrity, or version of the first separately encrypted data packet. If the format, integrity, or version of the encrypted data packet all meet the requirements, the device to be upgraded 30 feeds back a successful reply message to the upgrade control device 20; if any one of the format, integrity, or version of the encrypted data packet does not meet the requirements, the device to be upgraded 30 feeds back a failed reply message to the upgrade control device 20. However, it should be noted that the embodiments of the present application do not specifically limit the feedback conditions for the successful reply message and the failed reply message. For example, if at least one of the format, integrity, or version of the encrypted data packet meets the requirements, the device to be upgraded 30 feeds back a successful reply message to the upgrade control device 20; if all of the format, integrity, or version of the encrypted data packet do not meet the requirements, the device to be upgraded 30 feeds back a failed reply message to the upgrade control device 20.

[0120] If the upgrade control device 20 receives a success reply message from the device to be upgraded 30 , the upgrade control device 20 sends the next separately encrypted data packet (ie, the second separately encrypted data packet) to the device to be upgraded 30 in sequence.

[0121] By receiving successful reply information from the device to be upgraded, multiple individually encrypted data packets are transmitted one by one, effectively reducing the risk of multiple individually encrypted data packets being tampered with or intercepted, and ensuring the security of the transmission of multiple individually encrypted data packets.

[0122] In one implementation of this embodiment, the first decryption method also includes the following steps: if the upgrade control device 20 does not receive a successful reply message from the device to be upgraded 30, the upgrade control device 20 resends the start upgrade command to the device to be upgraded 30 at every preset time period; if the number of times the start upgrade command is resent reaches a preset number threshold, the upgrade control device 20 outputs an error message.

[0123] The present embodiment does not specifically limit the preset time period, and those skilled in the art can select it according to actual needs. For example, the preset time period is 5 seconds. The present embodiment does not specifically limit the preset number of times threshold, and those skilled in the art can select it according to actual needs. For example, the preset number of times threshold is 3 times.

[0124] If the upgrade control device 20 does not receive a successful response from the device to be upgraded 30, it resends the start-upgrade command at preset intervals. This ensures that the upgrade process can be retriggered in the device to be upgraded 30 if the response is lost due to communication failures or other reasons, thereby helping to improve the stability and success rate of the upgrade process. When the upgrade control device 20 resends the start-upgrade command a preset threshold number of times, it outputs an error message, effectively avoiding infinite retries and preventing the upgrade process from falling into an endless loop or a long waiting state. The error message is used to alert the operator or system administrator to intervene or repair the problem.

[0125] Figure 5 is a flowchart of a second decryption method for an upgrade data packet according to one embodiment of the present application. The second decryption method for the upgrade data packet in Figure 5 is executed by the upgrade-to-be-upgraded device 30 mentioned in Figure 1 . The second decryption method for the upgrade data packet shown in Figure 5 corresponds to both the encryption method and the first decryption method described above. The second decryption method includes the following steps.

[0126] S510: Receive at least one separately encrypted data packet sent by an upgrade control device.

[0127] The device to be upgraded 30 receives at least one separately encrypted data packet sent by the upgrade control device 20. In the embodiment of the present application, the device to be upgraded 30 may be a medical device.

[0128] S520: Decrypt each individually encrypted data packet in at least one individually encrypted data packet separately to obtain at least one data packet.

[0129] The device to be upgraded 30 uses a decryption algorithm to decrypt each of the at least one individually encrypted data packets, obtaining at least one data packet. In this embodiment, if the encryption device 10 uses the AES128 encryption algorithm during individual encryption, the decryption algorithm used by the device to be upgraded 30 during individual decryption is also the AES128 decryption algorithm. That is, the individual decryption algorithm corresponds to the encryption algorithm used during individual encryption. After each individually encrypted data packet is decrypted, at least one data packet is obtained.

[0130] It should be understood that the at least one data packet mentioned in step S520 is a data packet after being individually decrypted, and the multiple data packets mentioned in step S310 are data packets before being individually encrypted.

[0131] It should be noted that the second decryption method for an upgrade data packet provided in this embodiment is used to decrypt the individual encryption in the above-mentioned encryption method for the upgrade data packet, that is, first receiving at least one individual encrypted data packet sent by the upgrade control device, and individually decrypting each individual encrypted data packet in the at least one individual encrypted data packet to obtain at least one data packet, thereby effectively ensuring the security of data packet transmission during the firmware upgrade process.

[0132] In the above-mentioned upgrade data packet encryption method, both overall encryption and individual encryption are performed on encryption device 10. In the above-mentioned first decryption method for an upgrade data packet, overall decryption corresponding to overall encryption is performed on upgrade control device 20. In the above-mentioned second decryption method for an upgrade data packet, individual decryption corresponding to individual encryption is performed on device 30 to be upgraded. The above-mentioned encryption method is performed on encryption device 10, while the decryption method is distributed across upgrade control device 20 and device 30 to be upgraded. This effectively reduces the risk of data packets being eavesdropped and tampered with during transmission. Furthermore, if the decryption method is performed on a single device, it would increase the device load and thus reduce upgrade efficiency. Therefore, the present embodiment distributes the decryption method across different devices, effectively improving upgrade efficiency.

[0133] In one implementation of this embodiment, before the device to be upgraded 30 receives at least one separately encrypted data packet sent by the upgrade control device 20, the second decryption method also includes the following steps: if the device information frame corresponding to at least one separately encrypted data packet matches the device information of the device to be upgraded 30, the device to be upgraded 30 generates a matching success message and sends the matching success message to the upgrade control device 20; if the device to be upgraded 30 receives the upgrade start command sent by the upgrade control device 20, the device to be upgraded 30 shakes hands with the upgrade control device 20.

[0134] Before matching the device information frame with the device information of the device to be upgraded 30, the device to be upgraded 30 may receive the device information frame sent by the upgrade control device 20. When the upgrade control device 20 transmits at least one separately encrypted data packet to the device to be upgraded 20, the device to be upgraded 30 receives the device information frame.

[0135] The device to be upgraded 30 generates matching success information and sends the matching success information to the upgrade control device 20 . The upgrade control device 20 is mainly used to determine whether to send an upgrade start command to the device to be upgraded 30 .

[0136] The device information includes the board type and hardware version of the device 30 to be upgraded. If the board type and hardware version in the device information match the board type and hardware version in the device information frame, the device information frame and the device information match. If the device information frame and the device information match, the device 30 to be upgraded generates a successful match message and sends the successful match message to the upgrade control device 20.

[0137] The upgrade control device 30 is configured to send an upgrade start command to the device 30 to be upgraded based on the successful match information. If the device 30 to be upgraded receives the upgrade start command from the upgrade control device 20, it performs a handshake with the upgrade control device 20. At this point, the device 30 to be upgraded can provide handshake information back to the upgrade control device 20. The handshake information includes handshake success information and handshake failure information. If the handshake between the device 30 to be upgraded and the upgrade control device 20 is successful, the device 30 to be upgraded sends a handshake success message to the upgrade control device 20. If the handshake between the device 30 to be upgraded and the upgrade control device 20 fails, the device 30 to be upgraded sends a handshake failure message to the upgrade control device 20.

[0138] The device to be upgraded 30 receives the at least one individually encrypted data packet sent by the upgrade control device 20 when the device to be upgraded 30 sends a handshake success message to the upgrade control device 20. The handshake success message sent by the device to be upgraded 30 to the upgrade control device 20 is used by the upgrade control device 20 to determine whether to send the at least one individually encrypted data packet to the device to be upgraded 30. That is, after the upgrade control device 20 receives the handshake success message, it sends the at least one individually encrypted data packet to the device to be upgraded 30. At this time, the device to be upgraded 30 receives the at least one individually encrypted data packet sent by the upgrade control device 20.

[0139] In other words, the device to be upgraded 30 receives at least one individually encrypted data packet sent by the control device to be upgraded 20 and undergoes a device information matching and handshake process, thereby ensuring the integrity and accuracy of the at least one individually encrypted data packet received.

[0140] However, regardless of whether there is an opportunity for the device to be upgraded 30 to receive at least one individually encrypted data packet sent by the upgrade control device 20, when the device to be upgraded 30 receives multiple individually encrypted data packets sent by the upgrade control device 20, the device to be upgraded 30 can receive the multiple individually encrypted data packets sent by the upgrade control device 20 one by one. It should be understood that the aforementioned transmission of the multiple individually encrypted data packets one by one by the upgrade control device 20 corresponds to the reception of the multiple individually encrypted data packets one by one by the device to be upgraded 30.

[0141] The device to be upgraded 30 receives the multiple individual encrypted data packets sent by the upgrade control device 20 one by one, including the following steps: the device to be upgraded 30 receives the multiple individual encrypted data packets sent by the upgrade control device 20 one by one in a preset order.

[0142] During the transmission of multiple individually encrypted data packets one by one, they can be transmitted in a preset order to avoid transmission errors.

[0143] In response to the above-mentioned upgrade control device 20 repeating steps a) and b), the device to be upgraded 30 can complete the one-by-one reception of multiple individually encrypted data packets by repeatedly executing the following steps c) and d). Specifically, the device to be upgraded 30 receives the first individually encrypted data packet among the multiple individually encrypted data packets sent by the upgrade control device 20, and sends a success reply message to the upgrade control device 20, so that the upgrade control device 20 sends the second individually encrypted data packet among the multiple individually encrypted data packets to the device to be upgraded 30 according to the success reply message (step c), and the device to be upgraded 30 receives the second individually encrypted data packet sent by the upgrade control device 20 (step d), and repeats the above steps c) and d) until the device to be upgraded 30 completes the one-by-one reception of multiple individually encrypted data packets.

[0144] After the device to be upgraded 30 receives the first separately encrypted data packet, it will judge the format, integrity or version of the first separately encrypted data packet as described above one by one to obtain a successful reply message, and feed back the successful reply message to the upgrade control device 20. After the upgrade control device 20 receives the successful reply message, it will send a second separately encrypted data packet to the device to be upgraded 30. At this time, the device to be upgraded 30 receives the second separately encrypted data packet sent by the upgrade control device 20.

[0145] Since the upgrade control device 20 transmits multiple individually encrypted data packets to the device to be upgraded 30 one by one, after receiving a individually encrypted data packet transmitted by the upgrade control device 20, the device to be upgraded 30 repeats the loop steps until all individually encrypted data packets are received.

[0146] By sending a success reply message to the upgrade control device, multiple individually encrypted data packets are transmitted one by one, effectively reducing the risk of multiple individually encrypted data packets being tampered with or intercepted, and ensuring the security of the transmission of multiple individually encrypted data packets.

[0147] In one implementation of this embodiment, when the device to be upgraded is equipped with a memory, after the device to be upgraded 30 obtains at least one data packet, the second decryption method further includes the following steps: the device to be upgraded 30 stores the at least one data packet in a preset memory.

[0148] Of course, the second decryption method may not include the step of storing at least one data packet in a preset memory. The step of storing at least one data packet in a preset memory may be performed in the upgrade method described below. The embodiment of the present application does not specifically limit this.

[0149] The device to be upgraded 30 stores at least one data packet in a preset memory, so that the device to be upgraded 30 calls at least one data packet in the preset memory for upgrading.

[0150] It should be understood that when the device to be upgraded 30 receives multiple individually encrypted data packets one by one, the device to be upgraded 30 can immediately perform the subsequent steps of individually decrypting and storing the data in the preset memory after receiving an individually encrypted data packet. The device to be upgraded 30 can also perform the subsequent steps of individually decrypting and storing the data in the preset memory on some of the individually encrypted data packets after receiving them. The embodiments of the present application do not make specific limitations on this.

[0151] As described above, after the device to be upgraded 30 receives the first separately encrypted data packet sent by the upgrade control device 20, a success reply message is sent to the upgrade control device 20. The timing for the device to be upgraded 30 to send the success reply message may be after the device to be upgraded 30 completes the steps of separately decrypting and storing the first separately encrypted data packet in the preset memory. After receiving the success reply message, the upgrade control device 20 sends a second separately encrypted data packet to the device to be upgraded 30. The embodiment of the present application does not specifically limit the timing for the device to be upgraded 30 to send the success reply message. The success reply message may also be sent immediately after the device to be upgraded 30 receives the first separately encrypted data packet sent by the upgrade control device 20.

[0152] In one implementation of this embodiment, since the device information frame corresponding to at least one individually encrypted data packet includes at least one individually encrypted verification code, when each individually encrypted data packet in the at least one individually encrypted data packet is individually decrypted, the device to be upgraded 30 can use at least one individually encrypted verification code for individual decryption. Specifically, step S520 includes the following steps: the device to be upgraded 30 verifies at least one individually encrypted data packet to obtain at least one individual decryption verification code; if the at least one individual decryption verification code is consistent with the at least one individual encryption verification code, the device to be upgraded 30 decrypts each individually encrypted data packet in the at least one individually encrypted data packet to obtain at least one data packet.

[0153] The at least one individual encryption verification code is obtained by the encryption device 10 verifying the at least one individual encrypted data packet.

[0154] It should be noted that in the encryption method of the upgrade data packet, after the encryption device 10 separately encrypts multiple data packets, it obtains multiple separately encrypted data packets, verifies at least one separately encrypted verification code in the multiple separately encrypted data packets to obtain at least one separately encrypted verification code, and writes the at least one separately encrypted verification code into the device information frame. Then, in the second decryption method of the upgrade data packet provided in this embodiment, after the device 30 to be upgraded receives the at least one separately encrypted data packet sent by the upgrade control device 20 and before the device 30 to be upgraded separately decrypts the at least one separately encrypted data packet, the device 30 to be upgraded can verify the at least one separately encrypted data packet to obtain at least one separately decrypted verification code, and determine whether the at least one separately decrypted verification code is consistent with the at least one separately encrypted verification code. If the at least one separately decrypted verification code is consistent with the at least one separately encrypted verification code, the device 30 to be upgraded will perform the step of separately decrypting the at least one separately encrypted data packet. If the at least one separately decrypted verification code is inconsistent with the at least one separately encrypted verification code, the determination process ends and no operation is performed. For example, when at least one individual decryption verification code includes multiple individual decryption verification codes, and at least one individual encryption verification code includes multiple individual encryption verification codes, it is determined whether the multiple individual decryption verification codes are respectively consistent with the multiple individual encryption verification codes. If the multiple individual decryption verification codes are all consistent with the multiple individual encryption verification codes, the upgraded device 30 will execute the step of separately decrypting the multiple individually encrypted data packets. If there is a separate decryption verification code that is inconsistent with the corresponding separate encryption verification code, the determination process ends and no operation is performed.

[0155] Figure 6 is a flowchart of a firmware upgrade method according to one embodiment of the present application. The firmware upgrade method of Figure 6 is executed by the device to be upgraded 30 mentioned in Figure 1 . The firmware upgrade method shown in Figure 6 corresponds to the above-mentioned upgrade data packet encryption method and includes the above-mentioned first decryption method. The upgrade method includes the following steps.

[0156] S610: Execute the first decryption method as described above to obtain at least one data packet.

[0157] It should be understood that in the first decryption method described above, the device 30 to be upgraded may receive only one single encrypted data packet, or the device 30 to be upgraded may receive multiple single encrypted data packets.

[0158] The effects brought about when the device to be upgraded 30 executes the first decryption method as described above and the detailed description of the first decryption method are mentioned above and will not be repeated here.

[0159] S620: Upgrade the firmware based on at least one data packet.

[0160] When the device to be upgraded 30 receives only one single encrypted data packet, the number of data packets obtained by single decryption is one, and the firmware is upgraded based on one data packet; when the device to be upgraded 30 receives multiple data packets, the number of data packets obtained by single decryption is multiple, and the firmware is upgraded based on multiple data packets.

[0161] When the firmware is upgraded based on multiple data packets, the multiple data packets can be verified to obtain a fourth verification code. If the fourth verification code is consistent with the first verification code, the firmware is upgraded based on at least one data packet in the multiple data packets.

[0162] The device information frames corresponding to the multiple individually encrypted data packets include the first verification code, which is obtained by the encryption device verifying the upgrade data packet.

[0163] The device to be upgraded 30 uses a verification algorithm to verify multiple data packets to obtain a fourth verification code. In this embodiment, if the verification algorithm used to verify the upgrade data packet after the encryption device 10 obtains the upgrade data packet is the CRC32 verification algorithm, then when the device to be upgraded 30 verifies multiple data packets, the verification algorithm used is also the CRC32 verification algorithm.

[0164] It should be understood that the device to be upgraded 30 performs overall verification on multiple data packets to obtain the fourth verification code.

[0165] If the fourth check code is consistent with the first check code, indicating that the multiple data packets have not been tampered with or damaged, the device to be upgraded 30 upgrades the firmware based on at least one of the multiple data packets. In other words, the timing for upgrading the firmware based on at least one data packet is when the fourth check code is consistent with the first check code.

[0166] It should be noted that the firmware upgrade method provided in this embodiment first verifies multiple data packets to obtain a fourth verification code, and compares the fourth verification code with the first verification code to determine whether to upgrade the firmware, thereby effectively ensuring the integrity and accuracy of the data packets.

[0167] It should be understood that when the device to be upgraded is equipped with a memory, the multiple data packets may be stored in a preset memory before being verified.

[0168] In one implementation of this embodiment, regardless of whether there is an opportunity to upgrade the firmware, when the device to be upgraded is configured with a memory, step S620 includes the following steps: the device to be upgraded 30 reads the program update flag of the firmware application based on a preset upgrade program; the device to be upgraded 30 determines the flag position of the upgrade flag according to the program update flag; if the flag position of the upgrade flag is set, the device to be upgraded 30 calls at least one data packet stored in the preset memory based on the preset upgrade program to upgrade the firmware application.

[0169] In this embodiment, the upgrade program is a bootloader. The bootloader is a piece of startup code located in a pre-set memory that is used to load and start the operating system or other applications when the device 30 to be upgraded is powered on or restarted. The program update flag is used to indicate whether an update is available for the firmware application. The firmware application can be understood as the software code on the device 30 to be upgraded, that is, the code on the firmware.

[0170] Based on the program update flag, the device 30 to be upgraded determines whether the flag bit of the upgrade flag is set or not set. When the flag bit of the upgrade flag is set, it indicates that the device 30 to be upgraded needs to be upgraded. There is a difference between the version of the application program of the firmware on the device 30 to be upgraded and the available update version. An update can be performed to keep the application program of the firmware up to date. When the flag bit of the upgrade flag is not set, it indicates that the device 30 to be upgraded does not need to be upgraded. There is no difference between the version of the application program of the firmware on the device 30 to be upgraded and the available update version. No update is required.

[0171] In other words, if the flag bit of the upgrade flag is set, the device to be upgraded 30 upgrades the firmware application according to the upgrade program; if the flag bit of the upgrade flag is not set, the device to be upgraded 30 cancels the upgrade of the firmware application and jumps to the application startup address of the firmware to start the existing application of the firmware.

[0172] Therefore, when the application program of the firmware is upgraded, it is determined whether to upgrade the application program of the firmware according to the program update flag and the upgrade flag, thereby ensuring that the application program of the firmware is always at the latest version.

[0173] Figure 7 is a flowchart illustrating an upgrade data packet encryption method, a first decryption method for an upgrade data packet, a second decryption method for an upgrade data packet, and a firmware upgrade method, provided in one embodiment of the present application. The encryption device, upgrade control device, and device to be upgraded in Figure 7 may correspond to encryption device 10, upgrade control device 20, and device to be upgraded 30 in Figure 1, respectively. For the sake of brevity, repeated descriptions are omitted.

[0174] As shown in FIG7 , in step S710, the encryption device 10 splits the upgrade data packet according to the preset packet length to obtain multiple data packets; in step S720, the encryption device 10 encrypts each of the multiple data packets separately to obtain multiple individually encrypted data packets; in step S730, the encryption device 10 generates an overall data packet based on the multiple individually encrypted data packets; in step S740, the encryption device 10 encrypts the overall data packet as a whole to obtain an overall encrypted data packet; in step S750, the encryption device 10 sends the overall encrypted data packet to the upgrade control device 20; in step S760, the upgrade control device 20 receives the overall encrypted data packet and performs an overall encryption on the overall encrypted data packet. The upgrade control device 20 decrypts the whole data packet to obtain the whole data packet; in step S770, the upgrade control device 20 splits the whole data packet according to the preset packet length to obtain multiple separately encrypted data packets; in step S780, the upgrade control device 20 sends at least one separately encrypted data packet of the multiple separately encrypted data packets to the device 30 to be upgraded; in step S790, the device 30 to be upgraded receives the at least one separately encrypted data packet sent by the upgrade control device 20; in step S791, the device 30 to be upgraded decrypts each separately encrypted data packet in the at least one separately encrypted data packet separately to obtain at least one data packet; in step S792, the device 30 to be upgraded upgrades the firmware based on the at least one data packet.

[0175] Figure 8 is a flowchart illustrating an upgrade data packet encryption method, a first decryption method for the upgrade data packet, a second decryption method for the upgrade data packet, and a firmware upgrade method, provided in another embodiment of the present application. The encryption device, upgrade control device, and device to be upgraded in Figure 8 may correspond to encryption device 10, upgrade control device 20, and device to be upgraded 30 in Figure 1, respectively. For the sake of brevity, repeated descriptions are omitted.

[0176] As shown in FIG8 , in step S801, the encryption device 10 verifies the upgrade data packet, obtains a first verification code, and writes the first verification code into the device information frame; in step S802, the encryption device 10 splits the upgrade data packet according to the preset packet length to obtain multiple data packets; in step S803, the encryption device 10 separately encrypts each of the multiple data packets to obtain multiple separately encrypted data packets; in step S804, the encryption device 10 verifies at least one separately encrypted data packet among the multiple separately encrypted data packets, obtains at least one separately encrypted verification code, and writes the at least one separately encrypted verification code into the device information frame; in step S805, the encryption device 10 generates an entire encrypted data packet based on the multiple separately encrypted data packets. In step S806, the encryption device 10 encrypts the entire data packet as a whole to obtain an overall encrypted data packet; in step S807, the encryption device 10 verifies the entire encrypted data packet to obtain an overall encryption verification code, and writes the overall encryption verification code into the device information frame; in step S808, the encryption device 10 imports the device information frame into the overall encrypted data packet; in step S809, the encryption device 10 verifies the overall encrypted data packet including the device information frame to obtain a second verification code, and writes the second verification code into the device information frame; in step S810, the encryption device 10 sends the overall encrypted data packet including the device information frame to the upgrade control device 20; in step S820, the upgrade control device 20 receives the data packet including the device information frame. The entire encrypted data packet of the device information frame; in step S830, the upgrade control device 20 verifies the entire encrypted data packet including the device information frame to obtain a third verification code, and when the third verification code is consistent with the second verification code, the entire encrypted data packet is decrypted as a whole to obtain an entire data packet; in step S840, the upgrade control device 20 splits the entire data packet according to the preset packet length to obtain multiple individual encrypted data packets; in step S850, the upgrade control device 20 verifies the multiple individual encrypted data packets to obtain an overall decryption verification code; in step S860, when the overall decryption verification code is consistent with the overall encryption verification code, the upgrade control device 20 sends at least one of the multiple individual encrypted data packets to the device to be upgraded 30 individually encrypted data packets; in step S870, the device 30 to be upgraded receives at least one individually encrypted data packet; in step S880, the device 30 to be upgraded verifies the at least one individually encrypted data packet to obtain at least one individual decryption verification code, and when the at least one individual decryption verification code is consistent with the at least one individual encryption verification code, each individually encrypted data packet in the at least one individually encrypted data packet is individually decrypted to obtain at least one data packet; in step S890, when the at least one data packet includes multiple data packets, the device 30 to be upgraded verifies the multiple data packets to obtain a fourth verification code, and when the fourth verification code is consistent with the first verification code, the firmware is upgraded based on at least one data packet in the multiple data packets.

[0177] Figure 9 is a flowchart illustrating an upgrade data packet encryption method, a first decryption method for the upgrade data packet, a second decryption method for the upgrade data packet, and a firmware upgrade method, according to another embodiment of the present application. The encryption device, upgrade control device, and device to be upgraded in Figure 9 may correspond to encryption device 10, upgrade control device 20, and device to be upgraded 30 in Figure 1, respectively. For the sake of brevity, repeated descriptions are omitted.

[0178] As shown in FIG9 , in step S901, the encryption device 10 verifies the upgrade data packet, obtains a first verification code, and writes the first verification code into the device information frame; in step S902, the encryption device 10 splits the upgrade data packet according to the preset packet length to obtain multiple data packets; in step S903, the encryption device 10 separately encrypts each of the multiple data packets to obtain multiple separately encrypted data packets; in step S904, the encryption device 10 verifies at least one separately encrypted data packet among the multiple separately encrypted data packets, obtains at least one separately encrypted verification code, and writes the at least one separately encrypted verification code into the device information frame; in step S905, the encryption device 10 Based on multiple individually encrypted data packets, an overall data packet is generated; in step S906, the encryption device 10 encrypts the overall data packet as a whole to obtain the overall encrypted data packet, and imports the device information frame into the overall encrypted data packet; in step S907, the encryption device 10 verifies the overall encrypted data packet including the device information frame to obtain a second verification code, and writes the second verification code into the device information frame; in step S908, the encryption device 10 sends the overall encrypted data packet including the device information frame to the upgrade control device 20; in step S909, the upgrade control device 20 receives the overall encrypted data packet including the device information frame; in step S910, the upgrade control device 20 verifies the overall encrypted data packet including the device information frame The entire encrypted data packet is verified to obtain a third verification code, and when the third verification code is consistent with the second verification code, the entire encrypted data packet is decrypted as a whole to obtain the entire data packet; in step S920, the upgrade control device 20 splits the entire data packet according to the preset packet length to obtain multiple separate encrypted data packets; in step S930, the upgrade control device 20 sends a device information frame to the device to be upgraded 30; in step S940, the device to be upgraded 30 receives the device information frame, and generates a matching success message when the device information frame matches its device information; in step S950, the device to be upgraded 30 sends a matching success message to the upgrade control device 20; in step S960, the upgrade control device 20 sends a matching success message to the upgrade control device 20; The control device 20 receives the matching success message; in step S970, the upgrade control device 20 sends a start-up upgrade command to the device to be upgraded 30; in step S980, the device to be upgraded 30 receives the start-up upgrade command and performs a handshake with the upgrade control device 20, generating a handshake success message; in step S990, the device to be upgraded 30 sends a handshake success message to the upgrade control device 20; in step S991, the upgrade control device 20 receives the handshake success message; in step S992, the upgrade control device 20 sends at least one individually encrypted data packet from a plurality of individually encrypted data packets to the device to be upgraded 30; in step S993, the device to be upgraded 30 receives the at least one individually encrypted data packet;In step S994, the device to be upgraded 30 verifies the at least one individually encrypted data packet to obtain at least one individually decrypted verification code. If the at least one individually decrypted verification code matches the at least one individually encrypted verification code, each individually encrypted data packet in the at least one individually encrypted data packet is individually decrypted to obtain at least one data packet. In step S995, if the at least one data packet includes multiple data packets, the device to be upgraded 30 verifies the multiple data packets to obtain a fourth verification code. If the fourth verification code matches the first verification code, the firmware is upgraded based on at least one data packet in the multiple data packets.

[0179] The following describes in detail the specific application scenarios of the various methods of this application, taking the device to be upgraded as an internal component of an instrument to be upgraded or a device within a local area network as an example. The above-mentioned upgrade data packet encryption method, upgrade data packet first decryption method, upgrade data packet second decryption method, and firmware upgrade method are applicable to upgrading the internal components of an instrument to be upgraded or upgrading a device within a local area network.

[0180] For the upgrade application scenario of the internal components of the instrument to be upgraded, the upgrade process is as follows.

[0181] In a first embodiment, internal components of an instrument to be upgraded may be upgraded.

[0182] In the first stage, the upgrade data packet is imported into the firmware upgrade encryption software tool of the encryption device. The encryption device uses the firmware upgrade encryption software tool to split the upgrade data packet according to the preset packet length, and encrypts the multiple split data packets separately to obtain multiple individually encrypted data packets. The overall data packet generated based on the multiple individually encrypted data packets is encrypted as a whole to obtain an overall encrypted data packet.

[0183] In the second stage, the encryption device imports the device information frame into the overall encrypted data packet. The overall encrypted data packet imported into the device information frame is the firmware upgrade data packet.

[0184] In the third stage, the firmware upgrade data package is compressed to obtain a compressed file, which is then transferred to the upgrade control device via a storage medium such as a USB flash drive or a cloud platform. The upgrade control device can be a server.

[0185] In the fourth stage, the upgrade control device obtains the compressed file, decompresses the compressed file, obtains the firmware upgrade data packet, and obtains the device information frame in the firmware upgrade data packet.

[0186] In the fifth stage, the upgrade control device obtains the information of the entire encrypted data packet through the device information frame and decrypts the entire encrypted data packet to obtain the decrypted entire data packet. The information of the entire encrypted data packet includes information such as component model, firmware version, hardware version or firmware length.

[0187] In the sixth stage, the upgrade control device verifies the decrypted data packet. If the verification code obtained is consistent with the corresponding verification code stored in the device information frame, the upgrade control device matches the internal components of the instrument to be upgraded based on the component model in the device information frame. If the match is successful, the upgrade control device sends the device information frame. The internal components of the instrument to be upgraded determine whether the device information (e.g., hardware version) of the internal components is consistent with the device information frame (e.g., hardware version). If the device information (e.g., hardware version) of the internal components is consistent with the device information frame (e.g., hardware version), the internal components of the instrument to be upgraded and the upgrade control device perform a handshake. After the handshake is successful, the upgrade control device transmits at least one separately encrypted data packet, which is obtained by splitting the entire data packet according to the preset packet length, to the internal components of the instrument to be upgraded. The verification code obtained by verifying the decrypted data packet is consistent with the third verification code in the above-mentioned decryption method of the upgrade data packet. The corresponding verification code stored in the device information frame is the second verification code obtained by the above-mentioned encryption method of the upgrade data packet.

[0188] In the seventh stage, each time the internal component of the instrument to be upgraded obtains a separate encrypted data packet, it will decrypt the separate encrypted data packet separately and store the decrypted data packet into the internal FLASH of the preset chip.

[0189] In the eighth stage, after receiving all individually decrypted data packets, the internal components of the instrument to be upgraded verify all data packets in the chip's internal FLASH. If the resulting verification code matches the corresponding verification code stored in the device information frame, the internal components of the instrument to be upgraded initiate the firmware upgrade function and upgrade themselves. The chip's internal FLASH is a non-volatile memory within the chip. The verification code obtained from verifying all data packets in the chip's internal FLASH matches the fourth verification code in the aforementioned firmware upgrade method. The corresponding verification code stored in the device information frame is the first verification code obtained through the aforementioned upgrade data packet encryption method.

[0190] In the second embodiment, multiple internal components of the instrument to be upgraded can be upgraded.

[0191] The first to seventh stages in the second embodiment are the same as those in the first embodiment, and are performed sequentially.

[0192] In the eighth stage, the multiple internal components of the instrument to be upgraded sequentially verify all data packets in the internal FLASH of the corresponding chip in a preset order. Upon successful verification, the upgrade control device controls the corresponding internal component to upgrade. The upgrade concludes after all internal components have been upgraded. It should be understood that the preset order can be pre-written in a configuration table and transmitted to the instrument to be upgraded along with the individually encrypted data packets, allowing the multiple internal components of the instrument to determine the order in which they will perform the upgrade.

[0193] For the upgrade application scenario of LAN devices in the same LAN, the upgrade process is as follows.

[0194] In the first embodiment, a local area network device may be upgraded.

[0195] In the first stage, the upgrade data packet is imported into the firmware upgrade encryption software tool of the encryption device. The encryption device uses the firmware upgrade encryption software tool to split the upgrade data packet according to the preset packet length, and encrypts the multiple split data packets separately to obtain multiple individually encrypted data packets. The overall data packet generated based on the multiple individually encrypted data packets is encrypted as a whole to obtain an overall encrypted data packet.

[0196] In the second stage, the encryption device imports the device information frame into the overall encrypted data packet. The overall encrypted data packet imported into the device information frame is the firmware upgrade data packet.

[0197] In the third stage, the firmware upgrade data package is compressed to obtain a compressed file, which is then transferred to the platform to be upgraded / network control platform via a storage medium such as a USB flash drive or a cloud platform. The platform to be upgraded / network control platform can be a platform built by a server.

[0198] In the fourth stage, the platform to be upgraded / network central control platform obtains the compressed file, decompresses the compressed file, obtains the firmware upgrade data packet, and obtains the device information frame in the firmware upgrade data packet.

[0199] In the fifth stage, the platform to be upgraded / network control platform obtains the information of the entire encrypted data packet through the device information frame and decrypts the entire encrypted data packet to obtain the decrypted entire data packet. The information of the entire encrypted data packet includes information such as device model, firmware version, hardware version or firmware length.

[0200] In the sixth stage, the platform to be upgraded / network central control platform verifies the decrypted data packet. If the verification code obtained is consistent with the corresponding verification code stored in the device information frame, the platform to be upgraded / network central control platform matches the LAN device based on the device model in the device information frame. After the match is successful, the platform to be upgraded / network central control platform sends the device information frame. The LAN device determines whether the device information (e.g., hardware version) of the LAN device is consistent with the device information frame (e.g., hardware version). If the device information (e.g., hardware version) of the LAN device is consistent with the device information frame (e.g., hardware version), the LAN device and the platform to be upgraded / network central control platform perform a handshake. After the handshake is successful, the platform to be upgraded / network central control platform transmits at least one separately encrypted data packet after the overall data packet is split according to the preset packet length to the LAN device. The verification code obtained by verifying the decrypted data packet is consistent with the third verification code in the above-mentioned decryption method of the upgrade data packet. The corresponding verification code stored in the device information frame is the second verification code obtained by the above-mentioned encryption method of the upgrade data packet.

[0201] In the seventh stage, each time the LAN device obtains a separate encrypted data packet, it will decrypt the separate encrypted data packet separately and store the decrypted data packet in the internal FLASH of the preset chip.

[0202] In the eighth stage, after receiving all individually decrypted data packets, the LAN device verifies all data packets in the chip's internal flash memory. If the resulting verification code matches the corresponding verification code stored in the device information frame, the LAN device initiates its own firmware upgrade function and upgrades itself. The chip's internal flash memory is a non-volatile memory within the chip. The verification code obtained by verifying all data packets in the chip's internal flash memory matches the fourth verification code in the aforementioned firmware upgrade method. The corresponding verification code stored in the device information frame is the first verification code obtained by the aforementioned encryption method for the upgrade data packet.

[0203] In the second embodiment, multiple LAN devices may be upgraded.

[0204] The first to seventh stages in the second embodiment are the same as those in the first embodiment, and are performed sequentially.

[0205] In the eighth stage, multiple LAN devices sequentially verify all data packets in the internal FLASH of their corresponding chips in a preset order. Upon successful verification, the upgrade platform / network control platform controls the corresponding LAN device to perform the upgrade. The upgrade concludes after all LAN devices have completed the upgrade. It should be understood that the preset order can be pre-written in a configuration table and transmitted to the multiple LAN devices along with the individually encrypted data packets, allowing the multiple LAN devices to determine the order in which they will perform the upgrade.

[0206] The method embodiment of the present application is described in detail above in conjunction with Figures 1 to 9 , and the device embodiment of the present application is described in detail below in conjunction with Figure 10 . It should be understood that the description of the method embodiment corresponds to the description of the device embodiment, and therefore, for portions not described in detail, reference can be made to the above method embodiment.

[0207] Figure 10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Electronic device 1000 may be a mobile terminal or a server. Electronic device 1000 may include a memory 1010 and a processor 1020. Memory 1010 may be used to store executable code. Processor 1020 may be used to execute the executable code stored in memory 1010 to implement the steps in each method described above. In some embodiments, electronic device 1000 may further include a network interface 1030, through which data exchange between processor 1020 and external devices may be implemented.

[0208] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or other arbitrary combinations. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. Available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, digital video discs (DVDs)), or semiconductor media (eg, solid state disks (SSDs)).

[0209] The embodiments of the present application further disclose a computer-readable storage medium, and the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the various methods in the above embodiments are adopted.

[0210] A computer program can be stored in a computer-readable storage medium. The computer program includes computer program code. The computer program code can be in the form of source code, object code, executable file or certain middleware, etc. Computer-readable storage media include any entity or device that can carry computer program code, recording media, USB flash drives, mobile hard drives, magnetic disks, optical disks, computer memories, read-only memories (ROMs), random access memories (RAMs), electrical carrier signals, telecommunication signals and software distribution media, etc. It should be noted that machine-readable media include but are not limited to the above-mentioned components.

[0211] Through this computer-readable storage medium, each method in the above embodiments is stored in the computer-readable storage medium, and is loaded and executed on the processor to facilitate the storage and application of the above methods.

[0212] It should be noted that the encryption method of the upgrade data packet, the first decryption method of the upgrade data packet, the second decryption method of the upgrade data packet and the firmware upgrade method of the embodiment of the present application can be stored separately in different computer-readable storage media, or all of them can be stored in one computer-readable storage medium.

[0213] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.

Claims

1. A method for encrypting an upgrade data packet, characterized in that: Applied to encryption equipment, the encryption method of the upgrade data packet includes: According to the preset packet length, the upgrade data packet is split to obtain multiple data packets; Encrypting each of the multiple data packets individually to obtain multiple individually encrypted data packets; generating an overall data packet based on the plurality of individually encrypted data packets; The entire data packet is encrypted as a whole to obtain an entire encrypted data packet.

2. The method for encrypting an upgrade data packet according to claim 1, characterized in that: Also includes: The upgrade data packet is verified to obtain a first verification code, which is used by the device to be upgraded to determine whether to upgrade the firmware based on at least one data packet among the multiple data packets using the first verification code.

3. The method for encrypting an upgrade data packet according to claim 1 or 2, characterized in that: Also includes: At least one of the multiple individually encrypted data packets is verified to obtain at least one individually encrypted verification code, which is used by the device to be upgraded to individually decrypt each of the at least one individually encrypted data packet using the at least one individually encrypted verification code.

4. The method for encrypting an upgrade data packet according to any one of claims 1 to 3, characterized in that: Also includes: Importing a device information frame into the overall encrypted data packet, wherein the device information frame includes the preset packet length.

5. The method for encrypting an upgrade data packet according to claim 4, characterized in that: Also includes: The whole encrypted data packet including the device information frame is verified to obtain a second verification code, which is used for upgrading the control device to decrypt the whole encrypted data packet as a whole using the second verification code.

6. The method for encrypting an upgrade data packet according to claim 4 or 5, characterized in that: The device information frame includes at least one of the following check codes: A first verification code obtained by verifying the upgrade data packet, a second verification code obtained by verifying the overall encrypted data packet including the device information frame, or at least one individual encrypted verification code obtained by verifying at least one individual encrypted data packet among the multiple individual encrypted data packets.

7. A method for decrypting an upgrade data packet, characterized in that: Applied to upgrading control equipment, the decryption method of the upgrade data packet includes: Decrypting the entire encrypted data packet as a whole to obtain the entire data packet; According to a preset packet length, the overall data packet is split to obtain a plurality of separately encrypted data packets; At least one individually encrypted data packet among the multiple individually encrypted data packets is sent to the device to be upgraded.

8. The method for decrypting an upgrade data packet according to claim 7, characterized in that: The step of decrypting the entire encrypted data packet as a whole to obtain the entire data packet includes: Verifying the entire encrypted data packet including the device information frame to obtain a third verification code; If the third verification code is consistent with the second verification code, the entire encrypted data packet is decrypted as a whole to obtain the entire data packet, wherein the device information frame includes the preset packet length, and the device information frame also includes the second verification code, and the second verification code is obtained by the encryption device verifying the entire encrypted data packet including the device information frame.

9. The method for decrypting an upgrade data packet according to claim 8, characterized in that: Also includes: Sending the device information frame to the device to be upgraded, so that the device to be upgraded generates matching information according to the device information frame and the device information of the device to be upgraded; If the matching information received from the device to be upgraded is the matching success information, sending a start upgrade command to the device to be upgraded, so that the device to be upgraded determines whether to shake hands with the upgrade control device. The step of sending at least one of the plurality of individually encrypted data packets to the device to be upgraded comprises: If the handshake information received from the device to be upgraded is handshake success information, the at least one separately encrypted data packet is sent to the device to be upgraded.

10. A method for decrypting an upgrade data packet, characterized in that: Applied to the device to be upgraded, the decryption method of the upgrade data packet includes: receiving at least one separately encrypted data packet sent by the upgrade control device; Each individually encrypted data packet in the at least one individually encrypted data packet is individually decrypted to obtain at least one data packet.

11. The method for decrypting an upgrade data packet according to claim 10, characterized in that: Also includes: If the device information frame corresponding to the at least one separately encrypted data packet matches the device information of the device to be upgraded, a matching success message is generated, and the matching success message is sent to the upgrade control device, so that the upgrade control device determines whether to send an upgrade start command to the device to be upgraded; If the upgrade start command sent by the upgrade control device is received, a handshake is performed with the upgrade control device. The receiving of at least one separately encrypted data packet sent by the upgrade control device comprises: If the handshake with the upgrade control device is successful, sending handshake success information to the upgrade control device, so that the upgrade control device can determine whether to send the at least one separately encrypted data packet to the device to be upgraded; The at least one separately encrypted data packet sent by the upgrade control device is received.

12. The method for decrypting an upgrade data packet according to claim 10 or 11, characterized in that: The step of separately decrypting each of the at least one separately encrypted data packet to obtain at least one data packet comprises: Verifying the at least one individually encrypted data packet to obtain at least one individual decryption verification code; If the at least one individual decryption verification code is consistent with the at least one individual encryption verification code, each individual encrypted data packet in the at least one individual encrypted data packet is decrypted individually to obtain the at least one data packet, wherein the device information frame corresponding to the at least one individual encrypted data packet includes the at least one individual encryption verification code, and the at least one individual encryption verification code is obtained by the encryption device verifying the at least one individual encrypted data packet.

13. A method for upgrading firmware, characterized in that: Applied to the device to be upgraded, the firmware upgrade method includes: Execute the decryption method of the upgrade data packet according to any one of claims 10 to 12 to obtain at least one data packet; The firmware is upgraded based on the at least one data packet.

14. The firmware upgrade method according to claim 13, characterized in that: Also includes: Verifying the plurality of data packets to obtain a fourth verification code, wherein when the at least one individually encrypted data packet includes a plurality of individually encrypted data packets, the at least one data packet includes the plurality of data packets, The step of upgrading the firmware based on the at least one data packet includes: If the fourth verification code is consistent with the first verification code, the firmware is upgraded based on at least one of the multiple data packets, wherein the device information frame corresponding to the multiple individually encrypted data packets includes the first verification code, and the first verification code is obtained by the encryption device verifying the upgrade data packet.

15. An electronic device, comprising a memory and a processor, wherein the memory stores an executable code, and the processor is configured to execute the executable code to implement the method according to any one of claims 1 to 14. 16 . A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the method according to claim 1 .

Citation Information

Patent Citations

  • Data transmission method, battery management system and storage medium

    CN110896387A

  • Data packet selection encryption method and device

    CN115208701A

  • Firmware upgrading method, electronic equipment and storage medium

    CN115543390A

  • Confidential transmission method and device of upgrade data packet, electronic equipment and storage medium

    CN116506848A

  • Direct access to object state in a shared logsegmentation of encrypted segments in overlay networks

    US20190132296A1