Encryption method and decryption method of upgrade data packet and upgrade system
By splitting, encrypting and encrypting the firmware upgrade data packets separately, and embedding the device information frame, the problem of insufficient security of upgrading files during firmware upgrade is solved, and the secure transmission of data packets during transmission is achieved.
Patent Information
- Application Number
- CN202311088944.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-02-28
AI Technical Summary
During the firmware upgrade process, upgrade files are easily stolen, tampered with or maliciously used by hackers or unauthorized personnel during the transmission and storage process, resulting in insufficient security.
An encryption method for upgrading data packets is adopted, by splitting, encrypting and encrypting the upgraded data packets separately, and embeding device information frames into the data packets, ensuring the security of the data packets during transmission.
It effectively ensures the security of upgrade files during firmware upgrade and prevents theft, tampering or malicious use of data packets during transmission.
Smart Images

Figure CN119538270A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of firmware upgrade, and in particular to an encryption method and a decryption method of an upgrade data packet and an upgrade system. Background Art
[0002] Firmware refers to software embedded in hardware devices. Firmware upgrade refers to the process of updating or upgrading the firmware in a device or system. During a firmware upgrade, the firmware in the device or system can obtain updated firmware or software through storage media such as USB flash drives or wireless networks. It can also directly download and install updated firmware from a remote server.
[0003] Since firmware upgrades involve the transmission and storage of firmware or software files, these files may contain sensitive code, configuration information or user data. If these data are not encrypted during transmission or storage, they may be stolen, tampered with or used maliciously by hackers or unauthorized personnel. Therefore, an encryption method is urgently needed to ensure the security of the upgrade files during the firmware upgrade process. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide an encryption method, a decryption method and an upgrade system for an upgrade data packet, 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 object, a first aspect of an embodiment of the present invention provides an encryption method for an upgrade data packet, which is applied to an encryption device. The upgrade encryption method includes:
[0006] Get the upgrade data package;
[0007] Splitting the upgrade data packet according to a preset packet length to obtain at least one data packet;
[0008] Encrypt each split data packet separately;
[0009] Merging at least one of the individually encrypted data packets into an overall data packet, and encrypting the overall data packet as a whole to obtain an overall encrypted data packet;
[0010] The device information frame is imported into the overall encrypted data packet to obtain the overall encrypted data packet including the device information frame, wherein the device information frame includes the preset packet length.
[0011] Optionally, after obtaining the upgrade data packet, the following steps are included:
[0012] Verifying the upgrade data packet to obtain a first verification code;
[0013] The first verification code is written into the device information frame.
[0014] Optionally, after importing the device information frame into the overall encrypted data packet to obtain the overall encrypted data packet including the device information frame, the method further includes:
[0015] Verifying the entire encrypted data packet including the device information frame to obtain a second verification code;
[0016] The second verification code is written into the device information frame.
[0017] A second aspect of the present invention provides a method for decrypting an upgrade data packet, which is applied to an upgrade control device. The upgrade decryption method comprises:
[0018] Get the whole encrypted data packet containing the device information frame;
[0019] Decrypting the encrypted data packet containing the device information frame as a whole to obtain a decrypted data packet;
[0020] Splitting the decrypted data packet according to the preset packet length in the device information frame to obtain at least one encrypted data packet;
[0021] The at least one encrypted data packet after being split is transmitted one by one to the device to be upgraded.
[0022] Optionally, the device information frame further includes a second verification code, and the overall decryption of the overall encrypted data packet including the device information frame to obtain the overall decrypted data packet includes:
[0023] Verifying the entire encrypted data packet including the device information frame to obtain a third verification code;
[0024] If the third verification code is consistent with the second verification code, the entire encrypted data packet including the device information frame is decrypted as a whole to obtain the entire decrypted data packet.
[0025] Optionally, transmitting the split at least one encrypted data packet to the device to be upgraded one by one includes:
[0026] Sending the device information frame to the device to be upgraded, wherein the device to be upgraded is used to generate matching information according to the device information frame and the device information of the device to be upgraded;
[0027] If the received matching information is matching success information, sending a start upgrade command to the device to be upgraded;
[0028] If the handshake information received from the device to be upgraded is a handshake success information, transmitting one of the at least one encrypted data packet after being split to the device to be upgraded;
[0029] If a successful reply message from the device to be upgraded is received, the next encrypted data packet is sent to the device to be upgraded.
[0030] Optionally, the method further includes:
[0031] If no successful reply information is received from the device to be upgraded, resending the upgrade start command to the device to be upgraded at a preset time interval;
[0032] If the number of times the start upgrade command is resent reaches a preset number threshold, an error message is output.
[0033] A third aspect of the present invention provides another method for decrypting an upgrade data packet, which is applied to a device to be upgraded. The upgrade decryption method comprises:
[0034] Receiving the split encrypted data packets sent by the upgrade control device;
[0035] Decrypting the encrypted data packet separately to obtain a separately decrypted data packet;
[0036] storing the obtained individually decrypted data packets into a preset memory;
[0037] Repeat the above steps until all individually decrypted data packets are obtained.
[0038] Optionally, the device to be upgraded includes device information, and the receiving of the split encrypted data packet sent by the upgrade control device includes:
[0039] Receive a device information frame sent by an upgrade control device;
[0040] If the device information frame matches the device information, generating matching success information, and sending the matching success information to the upgrade control device;
[0041] If a start upgrade command sent by the upgrade control device is received, handshake is performed with the upgrade control device;
[0042] If the handshake is successful, a handshake success message is sent to the upgrade control device;
[0043] Receive the split encrypted data packets sent by the upgrade control device.
[0044] Optionally, after storing the last obtained individually decrypted data packet in a preset memory, the method further comprises:
[0045] The application is upgraded based on all the data packets stored in the preset memory.
[0046] Optionally, the device information frame further includes a first check code, and the step of upgrading the application based on all data packets stored in the preset memory includes:
[0047] Verifying all data packets stored in the preset memory to obtain a fourth verification code;
[0048] If the fourth verification code is consistent with the first verification code, based on a preset upgrade program, all data packets stored in the preset memory are called to upgrade the application program.
[0049] Optionally, the step of calling all data packets stored in the preset memory to upgrade the application based on a preset upgrade program includes:
[0050] Based on the preset upgrade program, reading the program update flag of the application program;
[0051] Determine whether the flag of the upgrade flag is set or not set according to the program update flag;
[0052] If the flag of the upgrade flag is set, the application is upgraded according to the upgrade program.
[0053] Optionally, after storing the obtained separately decrypted data packet in a preset memory, the method further comprises:
[0054] Sending a success reply message to the upgrade control device, wherein the upgrade control device is used to send a next encrypted data packet to the device to be upgraded according to the success reply message.
[0055] A fourth aspect of the present invention provides an upgrade system, comprising an encryption device, an upgrade control device and a device to be upgraded, wherein the encryption device is connected to the upgrade control device, and the upgrade control device is connected to the device to be upgraded;
[0056] The encryption device is configured to execute the above-mentioned encryption method of an upgrade data packet;
[0057] The upgrade control device is configured to execute the above-mentioned decryption method of the upgrade data packet;
[0058] The device to be upgraded is configured to execute the above-mentioned another method for decrypting an upgrade data packet.
[0059] Through the above technical solution, during the firmware upgrade process, the upgrade data packet is first split, and each of the split data packets is encrypted separately, and finally the entire data packet consisting of at least one separately encrypted data packet is encrypted as a whole, which effectively ensures the security of the upgrade file during the firmware upgrade process.
[0060] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:
[0062] Figure 1 The present invention provides an overall flow chart of an encryption method for an upgrade data packet.
[0063] Figure 2 It is an overall flow chart of a first decryption method for an upgrade data packet provided by an embodiment of the present invention.
[0064] Figure 3 It is an overall flow chart of a second decryption method for an upgrade data packet provided by an embodiment of the present invention.
[0065] Figure 4 It is an overall structural diagram of an upgrade system provided by an embodiment of the present invention.
[0066] Figure 5 This is a system architecture diagram for wireless upgrades such as OTA upgrades provided by an embodiment of the present invention.
[0067] Figure 6 This is a USB upgrade or other wired upgrade system architecture diagram provided by an embodiment of the present invention.
[0068] Description of Reference Numerals
[0069] 10-encryption device; 20-upgrade control device; 30-device to be upgraded. DETAILED DESCRIPTION
[0070] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.
[0071] The embodiment of the present application discloses a method for encrypting an upgrade data packet.
[0072] Reference Figure 1, an encryption method for upgrading data packets, applied to encryption equipment, comprising the following steps:
[0073] S110: Obtain an upgrade data package.
[0074] The upgrade data packet refers to a data set of a new version or patch of a software or system, and generally includes modified program files, configuration files, library files, etc. In this embodiment, the upgrade data packet is used to upgrade the terminal to be upgraded.
[0075] S120: Split the upgrade data packet according to a preset packet length to obtain at least one data packet.
[0076] The preset packet length refers to the fixed length of each data packet preset when splitting the data packet. After obtaining the upgrade data packet, the upgrade data packet is split according to the preset packet length into at least one data packet, and the length of each data packet is consistent.
[0077] S130, encrypting each split data packet separately.
[0078] Specifically, an encryption algorithm is used to encrypt each data packet after splitting separately. The encryption algorithm in this embodiment adopts the AES128 encryption algorithm. AES refers to the Advanced Encryption Standard. There are three common AES schemes, namely 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 AES-128 scheme, i.e., the AES128 encryption algorithm, is adopted. In addition, other encryption algorithms can also be adopted, which will not be repeated here.
[0079] S140, merging at least one individually encrypted data packet into an overall data packet, and encrypting the overall data packet as a whole to obtain an overall encrypted data packet.
[0080] After each data packet is encrypted separately, all the separately encrypted data packets can be merged into a whole data packet, or at least one separately encrypted data packet can be merged into a whole data packet, and the merged whole data packet is encrypted as a whole using an encryption algorithm to obtain a whole encrypted data packet. Specifically, 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.
[0081] S150, importing the device information frame into the overall encrypted data packet to obtain the overall encrypted data packet including the device information frame, wherein the device information frame includes a preset packet length.
[0082] In this embodiment, the device information frame includes the board type, hardware version, firmware version and other equipment related information, in addition, the device information frame also includes a preset packet length. The device information frame is imported into the overall encrypted data packet to obtain the overall encrypted data packet containing the device information frame.
[0083] The encryption method for the upgrade data packet provided in this embodiment first splits the upgrade data packet during the firmware upgrade process, and encrypts each of the split data packets separately, and finally encrypts the entire data packet composed of at least one separately encrypted data packet as a whole, thereby effectively ensuring the security of the upgrade file during the firmware upgrade process.
[0084] In one implementation of this embodiment, after obtaining the upgrade data package, the following steps are included:
[0085] S210: Verify the upgrade data packet to obtain a first verification code.
[0086] S220. Write the first verification code into the device information frame.
[0087] After obtaining the upgrade data packet, the upgrade data packet is verified, and a first verification code is obtained after verification, and the first verification code is written into the device information frame. Specifically, in this embodiment, the CRC32 verification algorithm is used to verify the upgrade data packet. The CRC32 verification refers to a cyclic redundancy check (Cyclic Redundancy Check), which is used to detect errors in data transmission or storage, and generates a 32-bit verification value by performing a polynomial division operation on the data to verify the integrity and accuracy of the data. In addition, other verification algorithms can also be used for verification, which will not be described in detail here.
[0088] In a specific implementation, since the upgrade data packet may be damaged or lost during transmission, the upgrade data packet needs to be verified after being acquired, and the obtained first verification code is used for subsequent data integrity verification of the upgrade data packet.
[0089] In one implementation of this embodiment, after the device information frame is imported into the overall encrypted data packet to obtain the overall encrypted data packet including the device information frame, the following steps are included:
[0090] S310: Verify the entire encrypted data packet including the device information frame to obtain a second verification code.
[0091] S320, writing the second verification code into the device information frame.
[0092] After obtaining the overall encrypted data packet including the device information frame, the overall encrypted data packet including the device information frame is verified to obtain a second verification code, and the second verification code is written into the first address of the device information frame. Specifically, a verification algorithm is used to verify the overall encrypted data packet including the device information frame. In this embodiment, a CRC32 verification algorithm is used to verify the overall encrypted data packet including the device information frame to generate a second verification code. In addition, other verification algorithms can also be used for verification, which will not be described in detail here.
[0093] In a specific implementation, since the overall encrypted data packet containing the device information frame may be damaged or lost during transmission, after obtaining the overall encrypted data packet containing the device information frame, the overall encrypted data packet containing the device information frame needs to be verified, and the second verification code obtained is used for subsequent data integrity verification of the overall encrypted data packet containing the device information frame.
[0094] The overall encrypted data packet containing the device information frame is verified, effectively ensuring the integrity and accuracy of the data in the overall encrypted data packet.
[0095] In one implementation of this embodiment, the data format of the upgrade data packet is a HEX file format. After obtaining the upgrade data packet, the following steps are included:
[0096] S410: Based on a preset data format conversion algorithm, convert the data format of the upgrade data packet from the HEX file format to the Bin file format.
[0097] In this embodiment, the data format conversion algorithm is the Hex2Bin algorithm, which is used to convert hexadecimal numbers into 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 directly stores data in binary form, and the Bin file format has no specific structure or metadata, nor address information. When upgrading the firmware, the Bin file format must be used for upgrading.
[0098] In the above step S210, when the upgrade data packet is verified and the first verification code is obtained, the upgrade data packet is in a Bin file format.
[0099] In the first embodiment of this embodiment, after the device information frame is imported into the overall encrypted data packet, the format of the device information frame is as follows:
[0100]
[0101] 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 type is the device type, and the second type is the module type. The device type is represented by hexadecimal data, for example, 0x01 is used to represent the device type.
[0102] The hardware version refers to the version of the device to be upgraded, which is used to distinguish different hardware devices or configurations.
[0103] The firmware version refers to the version of the software firmware running on the device under test, which is used to distinguish different software firmware versions.
[0104] The firmware length refers to the total byte length of the entire encrypted data packet.
[0105] The start address refers to the start address of the firmware execution.
[0106] In the second embodiment of the present embodiment, after each split data packet is encrypted separately, all the separately encrypted data packets are verified as a whole to obtain a separately encrypted verification code, and the separately encrypted verification code is written into the device information frame; after the entire data packet is encrypted as a whole to obtain an overall encrypted data packet, the overall encrypted data packet is verified to obtain an overall encryption verification code, and the overall encryption verification code is written into the device information frame. After the device information frame is imported into the overall encrypted data packet, the format of the device information frame is as follows:
[0107]
[0108] Reference Figure 2 Corresponding to the above-mentioned encryption method of the upgrade data packet, the embodiment of the present application further discloses a first decryption method of the upgrade data packet, which is applied to the upgrade control device, and includes the following steps:
[0109] S510: Obtain an overall encrypted data packet including a device information frame.
[0110] The upgrade control device can obtain the overall encrypted data packet containing the device information frame through a preset interface. In the embodiment of the present application, the upgrade control device can be a server, but the decryption method of the upgrade data packet is not limited to the upgrade control device, but can also be a platform built by the server, which can be a platform to be upgraded or a network control platform.
[0111] S520: decrypt the entire encrypted data packet including the device information frame as a whole to obtain the entire decrypted data packet.
[0112] The decryption algorithm is used to decrypt the entire encrypted data packet containing the device information frame. If the encryption algorithm used for the overall encryption is the AES128 encryption algorithm, the decryption algorithm used for the overall decryption is the AES128 decryption algorithm, that is, the decryption algorithm must correspond to the encryption algorithm used for the overall encryption. After the overall encrypted data packet containing the device information frame is decrypted as a whole, the overall decrypted data packet can be obtained.
[0113] Since overall encryption is to encrypt an overall data packet formed by merging at least one individually encrypted data packet to obtain an overall encrypted data packet, overall decryption is to decrypt the overall encrypted data packet to obtain an overall data packet formed by merging at least one individually encrypted data packet.
[0114] S530: Split the decrypted data packet according to a preset packet length in the device information frame to obtain at least one encrypted data packet.
[0115] After obtaining the overall decrypted data packet, the overall data packet is split according to the preset packet length in the device information frame, so as to obtain at least one encrypted data packet.
[0116] Since the overall data packet is formed by merging at least one individually encrypted data packet, after splitting the overall data packet, at least one individually encrypted data packet, ie, an encrypted data packet, will be obtained.
[0117] S540: Transmit the split at least one encrypted data packet to the device to be upgraded one by one.
[0118] After obtaining at least one encrypted data packet, in order to ensure the accuracy of the encrypted data packet during transmission and prevent transmission errors, in this embodiment, the at least one encrypted data packet after splitting is transmitted one by one to the device to be upgraded.
[0119] 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, the overall encrypted data packet is first decrypted as a whole to obtain the overall data packet, and the overall data packet is split to obtain at least one encrypted data packet, and finally the at least one encrypted data packet after the split is transmitted one by one to the device to be upgraded, which effectively ensures the security of data packet transmission during the firmware upgrade process.
[0120] In one implementation of this embodiment, the device information frame further includes a second verification code, and the entire encrypted data packet including the device information frame is decrypted as a whole to obtain the entire decrypted data packet, including the following steps:
[0121] S610: Verify the entire encrypted data packet including the device information frame to obtain a third verification code.
[0122] During encryption, the second verification code is obtained by verifying the entire encrypted data packet including the device information frame and is written into the device information frame; during decryption, the entire encrypted data packet including the device information frame is verified to obtain the third verification code.
[0123] In this embodiment, a verification algorithm is used to verify the overall encrypted data packet containing the device information frame. If the CRC32 verification algorithm is used to verify the overall encrypted data packet containing the device information frame after the overall encryption, then before the overall decryption, the verification algorithm used to verify the overall encrypted data packet containing the device information frame is the CRC32 verification algorithm, that is, the verification algorithm used for the overall encryption and the overall decryption is consistent.
[0124] S620: If the third verification code is consistent with the second verification code, the entire encrypted data packet including the device information frame is decrypted as a whole to obtain the entire decrypted data packet.
[0125] If the third verification code is consistent with the second verification code, it indicates that the verification is successful. At this time, the entire encrypted data packet including the device information frame is decrypted as a whole to obtain the entire decrypted data packet.
[0126] If the third verification code is inconsistent with the second verification code, it indicates that the verification fails. At this time, the determination process ends, that is, the step of overall decryption of the overall encrypted data packet containing the device information frame is stopped.
[0127] In this embodiment, the second verification code obtained after the overall encryption is compared with the third verification code obtained before the overall decryption to ensure the integrity and accuracy of the overall encrypted data packet containing the device information frame. After determining that the overall encrypted data packet containing the device information frame is correct, it is decrypted as a whole, thereby ensuring the security of data packet transmission during the firmware upgrade process.
[0128] In one implementation of this embodiment, transmitting the split at least one encrypted data packet to the device to be upgraded one by one includes the following steps:
[0129] S710: Send a device information frame to the device to be upgraded, wherein the device to be upgraded is used to generate matching information according to the device information frame and device information of the device to be upgraded.
[0130] The device information of the device to be upgraded includes the hardware version of the device to be upgraded, 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, if the hardware version in the device information of the device to be upgraded is consistent with the hardware version in the device information frame, it indicates that the matching is successful, and the device to be upgraded generates matching success information; if the hardware version in the device information of the device to be upgraded is inconsistent with the hardware version in the device information frame, it indicates that the matching fails, and the device to be upgraded generates matching failure information, and determines that the process ends, and stops executing subsequent steps.
[0131] S720: If the received matching information is matching success information, send a start upgrade command to the device to be upgraded.
[0132] If the received matching information is matching success information, a start upgrade command is sent to the device to be upgraded to instruct the device to be upgraded to start the upgrade. The device to be upgraded shakes hands with the upper computer, i.e., the upgrade control device, according to the start upgrade command, and feeds back handshake information, wherein the handshake information includes handshake success information and handshake failure information.
[0133] The handshake between the device to be upgraded and the upgrade control device refers to the process of communication and confirmation between the device to be upgraded and the upgrade control device to ensure that the communication connection between the two parties is normal and ready for the upgrade operation. If the handshake is successful, the device to be upgraded will feedback the handshake success information to the upgrade control device; if the handshake fails, the device to be upgraded will feedback the handshake failure information to the upgrade control device.
[0134] S730: If the handshake information received from the device to be upgraded is handshake success information, transmit one of the at least one encrypted data packet after being split to the device to be upgraded.
[0135] If the handshake information received from the device to be upgraded is a handshake success message, one of the at least one encrypted data packet after the split is transmitted to the device to be upgraded, wherein the encrypted data packets need to be transmitted in a preset order during the transmission process one by one to avoid transmission errors.
[0136] After the device to be upgraded receives the encrypted data packet, it first judges the format, integrity or version of the encrypted data packet. If the format, integrity or version of the encrypted data packet meet the requirements, a success reply message is fed back to the upgrade control device; if any of the format, integrity or version of the encrypted data packet does not meet the requirements, a failure reply message is fed back to the upgrade control device.
[0137] S740: If a successful response message is received from the device to be upgraded, the next encrypted data packet is sent to the device to be upgraded.
[0138] If a successful reply message is received from the device to be upgraded, the next encrypted data packet is sent to the device to be upgraded in sequence.
[0139] By sending device information frames and generating matching information, it effectively prevents erroneous encrypted data packets from being sent to unmatched devices to be upgraded, thereby improving the accuracy of the upgrade; by splitting encrypted data packets and transmitting them one by one, it effectively reduces the risk of encrypted data packets being tampered with or intercepted, thereby ensuring the security of encrypted data packet transmission.
[0140] In one implementation of this embodiment, the following steps are also included:
[0141] S810: If no successful reply information is received from the device to be upgraded, resend the upgrade start command to the device to be upgraded at a preset time interval.
[0142] S820: If the number of times the upgrade start command is resent reaches a preset number threshold, an error message is output.
[0143] If no successful reply information is received from the device to be upgraded, the startup upgrade command is resent to the device to be upgraded at a preset time interval. Specifically, the preset time interval is 5s. If the number of times the startup upgrade command is resent reaches a preset number threshold, an error message is output. In this embodiment, the number threshold is 3 times.
[0144] It should be noted that if after obtaining the overall encrypted data packet and before importing the device information frame into the overall encrypted data packet, the overall encrypted data packet is verified to obtain an overall encryption verification code, then in this embodiment, after the overall decrypted data packet is split according to the preset packet length in the device information frame to obtain at least one encrypted data packet, all the split encrypted data packets are verified as a whole to obtain an overall decryption verification code, and the overall decryption verification code is compared with the overall encryption verification code. If they are consistent, the step of transmitting at least one split encrypted data packet to the device to be upgraded one by one is executed; if they are inconsistent, the determination process ends and no operation is performed.
[0145] If no successful reply is received from the device to be upgraded, the upgrade start command is resent at preset time intervals to ensure that the upgrade process of the device can be re-triggered in the event of a communication failure or other reasons leading to loss of the reply, which helps to improve the stability and success rate of the upgrade process. When the number of times the upgrade start command is resent reaches the threshold, an error message is output to effectively avoid infinite retries and prevent the upgrade process from falling into an endless loop or a long waiting state. The error message is used to remind the operator or system administrator to intervene or repair.
[0146] Reference Figure 3, corresponding to the encryption method and decryption method of the upgrade data packet described above, the embodiment of the present application further discloses a second decryption method of the upgrade data packet, which is applied to the device to be upgraded and includes the following steps:
[0147] S910: Receive the split encrypted data packets sent by the upgrade control device.
[0148] In the embodiment of the present application, the device to be upgraded may be a medical device.
[0149] S920. Decrypt the encrypted data packet separately to obtain a separately decrypted data packet.
[0150] Use the decryption algorithm to decrypt the encrypted data packet separately to obtain the separately decrypted data packet. If the encryption algorithm used in the separate encryption is the AES128 encryption algorithm, the decryption algorithm used for the separate decryption is the AES128 decryption algorithm, that is, the decryption algorithm must correspond to the encryption algorithm during the overall encryption. After the encrypted data packet is decrypted separately, the separately decrypted data packet can be obtained.
[0151] S930: Store the obtained individually decrypted data packet into a preset memory.
[0152] The individually decrypted data packets are stored in a preset memory so that the device to be upgraded can call all the data packets in the preset memory for upgrading.
[0153] S940, repeat the above steps until all individually decrypted data packets are obtained.
[0154] Since the upgrade control device transmits encrypted data packets to the device to be upgraded one by one, after receiving an encrypted data packet transmitted by the upgrade control device, the device to be upgraded repeats the loop steps until all the individually decrypted data packets are received.
[0155] It should be noted that the second decryption method for an upgrade data packet provided in this embodiment is used to decrypt the separate encryption in the above-mentioned encryption method for the upgrade data packet, that is, first receiving the encrypted data packet sent by the upgrade control device, and decrypting the encrypted data packet separately, and finally storing the obtained separately decrypted data packet into a preset memory, which effectively ensures the security of data packet transmission during the firmware upgrade process.
[0156] In the above-mentioned encryption method of the upgrade data packet, both the overall encryption and the individual encryption are performed on the encryption device. In the above-mentioned decryption method of the upgrade data packet, the overall decryption corresponding to the overall encryption is performed on the upgrade control device. In the above-mentioned second decryption method of the upgrade data packet, the individual decryption corresponding to the individual encryption is performed on the device to be upgraded. The above-mentioned encryption method is performed on the encryption device, and the decryption method is distributed to the upgrade control device and the device to be upgraded. This effectively reduces the risk of the data packet being stolen and tampered with during transmission. In addition, if the decryption method is performed on one device, it will increase the device load and reduce the upgrade efficiency. Therefore, this embodiment distributes the decryption method to different devices, which effectively improves the upgrade efficiency.
[0157] In one implementation of this embodiment, the device to be upgraded includes device information, and receiving the split encrypted data packet sent by the upgrade control device includes the following steps:
[0158] S1010: Receive a device information frame sent by an upgrade control device.
[0159] When the upgrade control device transmits the split at least one encrypted data packet to the device to be upgraded one by one, the device to be upgraded receives the device information frame.
[0160] S1020: If the device information frame matches the device information, generate matching success information, and send the matching success information to the upgrade control device.
[0161] The device information includes the board type, hardware version, etc. of the device to be upgraded. If the board type, hardware version, etc. in the device information correspond to the board type, hardware version, etc. in the device information frame, it indicates that the device information frame matches the device information. If the device information frame matches the device information, the device to be upgraded generates a successful match message and sends the successful match message to the upgrade control device. The upgrade control device is used to send a start upgrade command to the device to be upgraded based on the successful match message.
[0162] S1030: If an upgrade start command sent by the upgrade control device is received, a handshake is performed with the upgrade control device.
[0163] If the upgrade start command sent by the upgrade control device is received, a handshake is performed with the upgrade control device, and handshake information is fed back to the upgrade control device, wherein the handshake information includes handshake success information and handshake failure information.
[0164] S1040: If the handshake is successful, send a handshake success message to the upgrade control device.
[0165] If the handshake is successful, a handshake success message is sent to the upgrade control device; if the handshake fails, a handshake failure message is sent to the upgrade control device.
[0166] S1050: Receive the split encrypted data packets sent by the upgrade control device.
[0167] After receiving the handshake success information, the upgrade control device sends the split encrypted data packets to the devices to be upgraded one by one. At this time, the devices to be upgraded receive the split encrypted data packets sent by the upgrade control device.
[0168] The device to be upgraded receives the split encrypted data packet sent by the control device to be upgraded, and needs to go through the process of device information matching and handshake to ensure the integrity and accuracy of the received split encrypted data packet.
[0169] In one implementation of this embodiment, after storing the last independently decrypted data packet in the preset memory, the following steps are included:
[0170] S1110. Upgrade the application based on all data packets stored in the preset memory.
[0171] Specifically, based on a preset upgrade program, calling all data packets stored in a preset memory to upgrade the application program includes the following steps:
[0172] S1120: Based on a preset upgrade program, read a program update flag of the application program.
[0173] In this embodiment, the upgrade program is a bootloader, which is a startup code located in a preset memory and is used to load and start an operating system or other applications when the device is powered on or restarted. The program update flag refers to an identifier used to indicate whether an application has an available update.
[0174] S1130: Determine whether the upgrade flag is set or not set according to the program update flag.
[0175] When the upgrade flag is set, it means that the device to be upgraded needs to be upgraded, indicating that there is a difference between the application version on the device to be upgraded and the available update version, and an update is required to keep the application up to date; when the upgrade flag is not set, it means that the device to be upgraded does not need to be upgraded, indicating that there is no difference between the application version on the device to be upgraded and the available update version, and no update is required.
[0176] S1140: If the flag of the upgrade flag is set, the application is upgraded according to the upgrade program.
[0177] If the flag of the upgrade flag is set, the application is upgraded according to the upgrade program.
[0178] If the flag bit of the upgrade flag is not set, the application upgrade is canceled, and the application startup address is jumped to start the existing application.
[0179] When upgrading an application, whether to upgrade the application is determined based on the program update flag and the upgrade flag, so as to ensure that the application is always at the latest version.
[0180] In one implementation of this embodiment, the device information frame further includes a first verification code, and upgrading the application based on all data packets stored in the preset memory includes the following steps:
[0181] S1210: Verify all data packets stored in the preset memory to obtain a fourth verification code.
[0182] A verification algorithm is used to verify all data packets stored in the preset memory to obtain a fourth verification code. If, after obtaining the upgrade data packet, the verification algorithm used to verify the upgrade data packet is the CRC32 verification algorithm, then when verifying all data packets stored in the preset memory, the verification algorithm used is also the CRC32 verification algorithm.
[0183] S1220: If the fourth verification code is consistent with the first verification code, based on a preset upgrade program, all data packages stored in a preset memory are called to upgrade the application program.
[0184] If the fourth verification code is consistent with the first verification code, indicating that the data packet has not been tampered with or damaged, then based on the upgrade program, all data packets stored in the preset memory are called to upgrade the application program.
[0185] First, the data packet stored in the preset memory is verified, and the obtained fourth verification code is compared with the first verification code to determine whether to upgrade the application program, so as to effectively ensure the integrity and accuracy of the data packet.
[0186] In one implementation of this embodiment, after the individually decrypted data packet is stored in a preset memory, the following steps are included:
[0187] S1310: Send a success reply message to the upgrade control device, wherein the upgrade control device is used to send a next encrypted data packet to the device to be upgraded according to the success reply message.
[0188] After storing the individually decrypted data packet in the preset memory, if the next encrypted data packet needs to be received, the terminal to be upgraded needs to send a success reply message to the upgrade control device. At this time, after receiving the success reply message, the upgrade control device sends the next encrypted data packet to the device to be upgraded.
[0189] It should be noted that in the encryption method of the upgrade data packet, if after each split data packet is encrypted separately, all the separately encrypted data packets are verified as a whole to obtain a separately encrypted verification code, and the separately encrypted verification code is written into the device information frame, then in the decryption method of the upgrade data packet provided in this embodiment, after receiving the split encrypted data packet sent by the upgrade control device, and before the encrypted data packet is separately decrypted to obtain the separately decrypted data packet, the split encrypted data packet needs to be separately decrypted and verified to obtain a separately decrypted verification code, and it is determined whether the separately decrypted verification code is consistent with the separately encrypted verification code. If they are consistent, the step of separately decrypting the encrypted data packet to obtain the separately decrypted data packet is executed. If they are inconsistent, the determination process ends and no operation is performed.
[0190] The device to be upgraded can be an internal component of the instrument to be upgraded or a device within the local area network. For specific application scenarios, the encryption method of the upgrade data packet, the first decryption method of the upgrade data packet and the second decryption method of the upgrade data packet can be applicable to the upgrade of internal components of the instrument or the upgrade of local area network devices. The upgrade application scenarios of internal components of the instrument and local area network devices are described in detail below.
[0191] For the upgrade application scenario of the internal components of the instrument to be upgraded, the upgrade process is as follows:
[0192] In the first embodiment, the internal components of an instrument to be upgraded can be upgraded:
[0193] S1410. Import the upgrade data packet into the firmware upgrade encryption software tool of the encryption device. The encryption device splits the upgrade data packet according to the preset packet length through the firmware upgrade encryption software tool, and separately encrypts at least one of the split data packets, and encrypts the overall data packet formed by merging at least one separately encrypted data packet as a whole to obtain an overall encrypted data packet.
[0194] S1420. After overall encryption, the encryption device imports the device information frame into the overall encrypted data packet, wherein the overall encrypted data packet into which the device information frame is imported is a firmware upgrade data packet.
[0195] S1430. Compress the firmware upgrade data packet to obtain a compressed file, and transmit the compressed file to an upgrade control device via a storage medium such as a USB flash drive or a cloud platform; wherein the upgrade control device may be a server.
[0196] S1440: The upgrade control device obtains a compressed file, decompresses the compressed file, obtains a firmware upgrade data packet, and obtains a device information frame in the firmware upgrade data packet.
[0197] S1450. Obtain information of the overall encrypted data packet through the device information frame, and decrypt the overall encrypted data packet to obtain the overall decrypted data packet, wherein the information of the overall encrypted data packet includes component model, firmware version, hardware version, firmware length and other information.
[0198] S1460. Verify the overall data packet after the overall decryption. If the obtained verification code 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 according to the component model in the device information frame. After the match is successful, the device information frame is sent to shake hands with the internal components of the instrument to be upgraded. After the handshake is successful, the split encrypted data packet is transmitted to the internal components of the instrument to be upgraded according to the preset packet length. The verification code obtained by verifying the overall data packet after the overall decryption is consistent with the third verification code in the decryption method of the above-mentioned upgrade data packet, and the corresponding verification code stored in the device information frame is the second verification code obtained by the encryption method of the above-mentioned upgrade data packet.
[0199] S1470. Whenever the internal components of the instrument to be upgraded obtain an encrypted data packet, the encrypted data packet will be individually decrypted, and the individually decrypted data packet will be stored in the internal FLASH of the preset chip.
[0200] S1480. After all the individually decrypted data packets are obtained, the internal components of the instrument to be upgraded verify all the data packets in the internal FLASH of the chip. If the obtained verification code is consistent with the corresponding verification code stored in the device information frame, the firmware upgrade function of the internal components of the instrument to be upgraded is started to upgrade itself, wherein the internal FLASH of the chip is a non-volatile memory in the chip, and the verification code obtained by verifying all the data packets in the internal FLASH of the chip is consistent with the fourth verification code in the second decryption method of the above-mentioned upgrade data packet, and the corresponding verification code stored in the device information frame is the first verification code obtained by the encryption method of the above-mentioned upgrade data packet.
[0201] In the second embodiment, internal components of two or more instruments to be upgraded may be upgraded:
[0202] Execute the above steps S1410 to S1470 in sequence;
[0203] S1490. If there are two or more internal components of the instruments to be upgraded, the internal components of the instruments to be upgraded check all data packets in the internal FLASH of the corresponding chip in sequence according to a preset order, and control the corresponding internal components to be upgraded after the verification is successful. After all internal components are upgraded, the upgrade is completed.
[0204] For the upgrade application scenario of LAN devices in the same LAN, the upgrade process is as follows:
[0205] In the first embodiment, a local area network device can be upgraded:
[0206] S1510. Import the upgrade data packet into the firmware upgrade encryption software tool of the encryption device. The encryption device splits the upgrade data packet according to the preset packet length through the firmware upgrade encryption software tool, and separately encrypts at least one of the split data packets, and encrypts the overall data packet formed by merging at least one separately encrypted data packet as a whole to obtain an overall encrypted data packet.
[0207] S1520. After overall encryption, the encryption device imports the device information frame into the overall encrypted data packet, wherein the overall encrypted data packet into which the device information frame is imported is a firmware upgrade data packet.
[0208] S1530. Compress the firmware upgrade data packet to obtain a compressed file, and transmit the compressed file to the platform to be upgraded / network central control platform via a storage medium such as a USB flash drive or a cloud platform; wherein the platform to be upgraded / network central control platform can be a platform built by a server.
[0209] S1540: The platform to be upgraded / network central control platform obtains the compressed file, decompresses the compressed file, obtains a firmware upgrade data packet, and obtains a device information frame in the firmware upgrade data packet.
[0210] S1550, obtaining information of the overall encrypted data packet after overall encryption through the device information frame, and overall decrypting the overall encrypted data packet after overall encryption to obtain an overall decrypted data packet, wherein the information of the overall encrypted data packet includes information such as device model, firmware version, hardware version, and firmware length;
[0211] S1560, verifying the overall decrypted data packet, if the obtained verification code 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 according to the device model of the device information frame, and after the matching is successful, sends the device information frame to shake hands with the LAN device, and after the handshake is successful, transmits the split encrypted data packet to the LAN device according to the preset packet length, wherein the verification code obtained by verifying the overall decrypted data packet is consistent with the third verification code in the above-mentioned decryption method of the upgrade data packet, and 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;
[0212] S1570. Whenever the local area network device obtains an encrypted data packet, it will decrypt the encrypted data packet separately and store the separately decrypted data packet in the internal FLASH of the preset chip.
[0213] S1580. After obtaining all the individually decrypted data packets, the LAN device verifies all the data packets in the internal FLASH of the chip. If the obtained verification code is consistent with the corresponding verification code stored in the device information frame, the firmware upgrade function of the LAN device is started to upgrade itself, wherein the internal FLASH of the chip is a non-volatile memory in the chip, and the verification code obtained by verifying all the data packets in the internal FLASH of the chip is consistent with the fourth verification code in the second decryption method of the above-mentioned upgrade data packet, and the corresponding verification code stored in the device information frame is the first verification code obtained by the encryption method of the above-mentioned upgrade data packet.
[0214] In the second embodiment, two or more LAN devices may be upgraded:
[0215] Execute the above steps S1510 to S1570 in sequence;
[0216] S1590. If there are two or more LAN devices to be upgraded, all data packets in the internal FLASH of the corresponding chip are checked in sequence according to a preset order, and the corresponding LAN device is controlled to be upgraded after the verification is successful. After all LAN devices are upgraded, the upgrade is completed.
[0217] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0218] Reference Figure 4 , the embodiment of the present application also discloses an upgrade system, including 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, and the upgrade control device 20 is connected to the device to be upgraded 30;
[0219] The encryption device 10 is configured to execute the encryption method of the upgrade data packet described above;
[0220] The upgrade control device 20 is configured to execute the first decryption method of the upgrade data packet;
[0221] The device to be upgraded 30 is configured to execute the second decryption method of the upgrade data packet.
[0222] Specifically, the encryption device 10 is communicatively connected with the upgrade control device 20, and the upgrade control device 20 is communicatively connected with the device to be upgraded 30, that is, the encryption device 10 and the upgrade control device 20 can be connected by wire or wireless means, such as cables, Wi-Fi, etc.; similarly, the upgrade control device 20 and the device to be upgraded 30 can be connected by wire or wireless means, such as cables, Wi-Fi, etc.
[0223] In this embodiment, the encryption device 10 can be any device with encryption function, such as an encryption server, an encryption chip, an encryption module, encryption hardware, etc.; the upgrade control device 20 can be any device with decryption function and control of the upgrade process, such as an upgrade server, and a device containing an upgrade tool or upgrade management software, etc.; the device to be upgraded 30 can be any device that requires firmware or software upgrades, such as intelligent instruments, internal components of instruments, and local area network devices, etc.
[0224] In a specific implementation, the upgrade control device 20 is not limited to hardware, but can also be a platform built by a server, and the platform can be a platform to be upgraded or a network central control platform.
[0225] In the specific firmware upgrade scenario of this embodiment, the firmware can be upgraded by OTA upgrade, USB upgrade, storage medium upgrade such as USB flash drive, UART upgrade, etc.
[0226] Reference Figure 5 In the first embodiment, the firmware is upgraded by OTA upgrade. OTA upgrade (Over-The-Air upgrade) is a technology for upgrading firmware or software through a wireless network. It sends upgrade data packets to remote devices through cloud servers, 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 overall decryption is performed through the cloud platform, and the individual decryption is performed through the device to be upgraded 30. Among them, the encryption device 10 and the upgrade control device 20 are connected wirelessly, such as Wi-Fi, cellular network, etc., and the upgrade control device 20 and the device to be upgraded 30 are connected wirelessly, such as Wi-Fi, cellular network, etc.
[0227] Reference Figure 6 In the second embodiment, in the scenario where the firmware is upgraded by USB upgrade, UART upgrade, etc., 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.
[0228] Specifically, USB upgrade refers to connecting the device to be upgraded 30 via a USB interface and using a special upgrade tool or software to upgrade the firmware or software. In this case, the upgrade control device 20 can be a computer, and the upgrade control device 20 and the encryption device 10 are connected by a USB cable, and the upgrade control device 20 is connected by a USB cable to the device to be upgraded 30.
[0229] UART upgrade refers to connecting to the device to be upgraded 30 via a serial port, and using a special upgrade tool or software to upgrade the firmware or software. At this time, the upgrade control device 20 can be a computer, and the upgrade control device 20 and the encryption device 10 are wired connected via a serial cable, and the upgrade control device 20 is wired connected to the device to be upgraded 30 via a serial cable.
[0230] 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.
[0231] 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.
[0232] The upgrade system provided in this embodiment 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.
[0233] An embodiment of the present application also discloses a machine-readable storage medium, and the machine-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the encryption method of the upgrade data packet, the first decryption method of the upgrade data packet, and the second decryption method of the upgrade data packet in the above-mentioned embodiment are adopted.
[0234] Among them, the computer program can be stored in a machine-readable 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. The machine-readable medium includes any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the machine-readable medium includes but is not limited to the above-mentioned components.
[0235] Among them, through this machine-readable storage medium, the encryption method of the upgrade data packet, the decryption method of the upgrade data packet and another decryption method of the upgrade data packet in the above-mentioned embodiment are stored in the machine-readable storage medium, and are loaded and executed on the processor to facilitate the storage and application of the above-mentioned method.
[0236] It should be noted that the encryption method of the upgrade data packet, the first decryption method of the upgrade data packet and the second decryption method of the upgrade data packet in the embodiment of the present application can be stored separately in different machine-readable storage media, or all can be stored in one machine-readable storage medium.
[0237] An embodiment of the present application also discloses a computing device processor for running a program, wherein when the program is run, it is used to execute the encryption method of the upgrade data packet, the first decryption method of the upgrade data packet, and the second decryption method of the upgrade data packet in the above-mentioned embodiment.
[0238] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0239] The above are only 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 modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should 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 upgrade method includes: Get the upgrade data package; Splitting the upgrade data packet according to a preset packet length to obtain at least one data packet; Encrypt each split data packet separately; Merging at least one of the individually encrypted data packets into an overall data packet, and encrypting the overall data packet as a whole to obtain an overall encrypted data packet; The device information frame is imported into the overall encrypted data packet to obtain the overall encrypted data packet including the device information frame, wherein the device information frame includes the preset packet length.
2. The method for encrypting an upgrade data packet according to claim 1, characterized in that: After obtaining the upgrade data package, the following steps are included: Verifying the upgrade data packet to obtain a first verification code; The first verification code is written into the device information frame.
3. The method for encrypting an upgrade data packet according to claim 1, characterized in that: After the device information frame is imported into the overall encrypted data packet to obtain the overall encrypted data packet including the device information frame, the method further comprises: Verifying the entire encrypted data packet including the device information frame to obtain a second verification code; The second verification code is written into the device information frame.
4. A method for decrypting an upgrade data packet, characterized in that: Applied to upgrading control equipment, the upgrading decryption method includes: Get the whole encrypted data packet containing the device information frame; Decrypting the encrypted data packet containing the device information frame as a whole to obtain a decrypted data packet; Splitting the decrypted data packet according to the preset packet length in the device information frame to obtain at least one encrypted data packet; The at least one encrypted data packet after being split is transmitted one by one to the device to be upgraded.
5. The method for decrypting an upgrade data packet according to claim 4, characterized in that: The device information frame further includes a second verification code, and the overall decryption of the overall encrypted data packet including the device information frame to obtain the overall decrypted 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 including the device information frame is decrypted as a whole to obtain the entire decrypted data packet.
6. The method for decrypting an upgrade data packet according to claim 4, characterized in that: The step of transmitting the split at least one encrypted data packet to the device to be upgraded one by one includes: Sending the device information frame to the device to be upgraded, wherein the device to be upgraded is used to generate matching information according to the device information frame and the device information of the device to be upgraded; If the received matching information is matching success information, sending a start upgrade command to the device to be upgraded; If the handshake information received from the device to be upgraded is a handshake success information, transmitting one of the at least one encrypted data packet after being split to the device to be upgraded; If a successful reply message from the device to be upgraded is received, the next encrypted data packet is sent to the device to be upgraded.
7. The method for decrypting an upgrade data packet according to claim 6, characterized in that: The method further comprises: If no successful reply information is received from the device to be upgraded, resending the upgrade start command to the device to be upgraded at a preset time interval; If the number of times the start upgrade command is resent reaches a preset number threshold, an error message is output.
8. A method for decrypting an upgrade data packet, characterized in that: Applied to the device to be upgraded, the upgrade decryption method includes: Receiving the split encrypted data packets sent by the upgrade control device; Decrypting the encrypted data packet separately to obtain a separately decrypted data packet; storing the obtained individually decrypted data packets into a preset memory; Repeat the above steps until all individually decrypted data packets are obtained.
9. The method for decrypting an upgrade data packet according to claim 8, characterized in that: The device to be upgraded includes device information, and the receiving of the split encrypted data packet sent by the upgrade control device includes: Receive a device information frame sent by an upgrade control device; If the device information frame matches the device information, generating matching success information, and sending the matching success information to the upgrade control device; If a start upgrade command sent by the upgrade control device is received, handshake is performed with the upgrade control device; If the handshake is successful, a handshake success message is sent to the upgrade control device; Receive the split encrypted data packets sent by the upgrade control device.
10. The method for decrypting an upgrade data packet according to claim 9, characterized in that: After storing the last obtained individually decrypted data packet into the preset memory, the method includes: The application is upgraded based on all the data packets stored in the preset memory.
11. The method for decrypting an upgrade data packet according to claim 10, characterized in that: The device information frame further includes a first verification code, and the upgrading of the application based on all data packets stored in the preset memory includes: Verifying all data packets stored in the preset memory to obtain a fourth verification code; If the fourth verification code is consistent with the first verification code, based on a preset upgrade program, all data packets stored in the preset memory are called to upgrade the application program.
12. The method for decrypting an upgrade data packet according to claim 11, characterized in that: The preset upgrade program based on the preset memory calls all the data packets stored in the preset memory to upgrade the application program, including: Based on the preset upgrade program, reading the program update flag of the application program; Determine whether the flag of the upgrade flag is set or not set according to the program update flag; If the flag of the upgrade flag is set, the application is upgraded according to the upgrade program.
13. The method for decrypting an upgrade data packet according to claim 8, characterized in that: After storing the obtained separately decrypted data packets into a preset memory, the method further comprises: Sending a success reply message to the upgrade control device, wherein the upgrade control device is used to send a next encrypted data packet to the device to be upgraded according to the success reply message.
14. An upgrade system, characterized in that: It comprises an encryption device (10), an upgrade control device (20) and a device to be upgraded (30), wherein the encryption device (10) is connected to the upgrade control device (20), and the upgrade control device (20) is connected to the device to be upgraded (30); The encryption device (10) is configured to execute the encryption method of the upgrade data packet according to any one of claims 1 to 3; The upgrade control device (20) is configured to execute the upgrade data packet decryption method according to any one of claims 4 to 7; The device to be upgraded (30) is configured to execute the method for decrypting an upgrade data packet according to any one of claims 8 to 13.