Electronic equipment upgrading method and device, upgrading equipment and storage medium

By using encrypted signature values ​​and random values ​​generated URLs during the firmware upgrade of electronic devices, the problem of upgrading installation packages being easily tampered is solved, improving the security of firmware upgrades and preventing replay attacks.

CN119806577APending Publication Date: 2025-04-11ANSJER ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411861277.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

During the firmware upgrade of electronic equipment, the upgrade installation package is easily tampered with, resulting in low security.

Method used

Ensure the security of the URL and prevent replay attacks by generating a URL containing the encrypted signature value and a random value in the server, and the electronic device downloads the upgrade installation package of the firmware to be upgraded according to the URL.

Benefits of technology

Improves security during firmware upgrade process, prevents URLs from being tampered with and replayed, and ensures the integrity and security of upgraded installation packages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806577A_ABST
    Figure CN119806577A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an electronic equipment upgrading method and device, upgrading equipment and a storage medium, and the method comprises the steps that electronic equipment sends an upgrading request to a server, so that the server sends a notification message to the electronic equipment after determining that firmware to be upgraded exists according to the upgrading request, the notification message is used for representing that the to-be-upgraded firmware exists in the server; after the electronic equipment receives the notification message, a URL corresponding to the firmware to be upgraded is obtained from a server, and the URL is generated according to basic parameters corresponding to the upgrading request, a query character string, a random value and an encrypted signature value; and downloading an upgrade installation package corresponding to the firmware to be upgraded based on the URL, and upgrading the electronic equipment according to the upgrade installation package. The security of the to-be-upgraded firmware in the upgrading process and the security of the to-be-upgraded firmware upgrading installation package are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of firmware upgrade, and in particular to an electronic equipment upgrade method, device, upgrade device and storage medium. Background Art

[0002] During the current firmware upgrade process of electronic devices, the upgrade installation package is easily tampered with, resulting in low security of the upgrade installation package. Summary of the invention

[0003] The embodiments of the present invention provide an electronic device upgrading method, apparatus, upgrading device and storage medium, aiming to improve the security of the electronic device firmware upgrading process and the security of the firmware upgrading installation package.

[0004] In a first aspect, an embodiment of the present invention provides an electronic device upgrading method, the method being applied to the electronic device, the method comprising:

[0005] The electronic device sends an upgrade request to the server, so that the server determines that there is firmware to be upgraded according to the upgrade request, and then sends a notification message to the electronic device, wherein the notification message is used to indicate that there is firmware to be upgraded in the server;

[0006] After receiving the notification message, obtaining a URL corresponding to the firmware to be upgraded from the server, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request;

[0007] The upgrade installation package corresponding to the firmware to be upgraded is downloaded based on the URL, and the electronic device is upgraded according to the upgrade installation package.

[0008] In a second aspect, an embodiment of the present invention provides an electronic device upgrade method, the method is applied to a server, and the method includes:

[0009] receiving an upgrade request sent by the electronic device, and after determining that there is firmware to be upgraded of the electronic device according to the upgrade request, sending a notification message to the electronic device, and generating a URL corresponding to the firmware to be upgraded;

[0010] After receiving the acquisition request for the URL sent by the electronic device according to the notification message, the URL is sent to the electronic device so that the electronic device can obtain the upgrade installation package corresponding to the firmware to be upgraded according to the URL for upgrading operation, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request.

[0011] In a third aspect, an embodiment of the present invention further provides an electronic device upgrade device, the electronic device upgrade device is applied to an electronic device, and the electronic device upgrade device includes:

[0012] A request sending module, used for the electronic device to send an upgrade request to the server, so that the server can send a notification message to the electronic device after determining that there is firmware to be upgraded according to the upgrade request, wherein the notification message is used to indicate that there is firmware to be upgraded in the server;

[0013] A URL acquisition module, configured to acquire a URL corresponding to the firmware to be upgraded from the server after receiving the notification message, wherein the URL is generated according to basic parameters, a query string, a random value, and an encrypted signature value corresponding to the upgrade request;

[0014] The installation package downloading module is used to download the upgrade installation package corresponding to the firmware to be upgraded based on the URL, and perform an upgrade operation on the electronic device according to the upgrade installation package.

[0015] In a fourth aspect, an embodiment of the present invention further provides an electronic device upgrade device, the electronic device upgrade device is applied to a server, and the electronic device upgrade device includes:

[0016] a message sending module, configured to receive an upgrade request sent by the electronic device, and after determining that there is firmware to be upgraded for the electronic device according to the upgrade request, send a notification message to the electronic device;

[0017] A URL generation module, used to generate a URL corresponding to the firmware to be upgraded;

[0018] A URL sending module is used to send the URL to the electronic device after receiving an acquisition request for acquiring the URL sent by the electronic device according to the notification message, so that the electronic device can acquire the upgrade installation package corresponding to the firmware to be upgraded according to the URL for upgrading operation, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request.

[0019] In a fifth aspect, an embodiment of the present invention further provides an upgrade device, comprising a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the electronic device upgrade method as described in the first aspect or the second aspect is implemented.

[0020] In a sixth aspect, an embodiment of the present invention further provides a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the electronic device upgrading method as described in the first aspect.

[0021] An embodiment of the present invention provides an electronic device upgrading method, apparatus, upgrading device and storage medium. In the embodiment of the present application, the electronic device sends an upgrade request to a server, so that after the server determines that there is firmware to be upgraded according to the upgrade request, it sends a notification message to the electronic device, and the notification message is used to indicate that there is firmware to be upgraded in the server; when the electronic device receives the notification message, it obtains a URL corresponding to the firmware to be upgraded from the server, wherein the URL is generated according to basic parameters, query strings, random values ​​and encrypted signature values ​​corresponding to the upgrade request; downloads an upgrade installation package corresponding to the firmware to be upgraded based on the URL, and performs an upgrade operation on the electronic device according to the upgrade installation package. When the firmware of an electronic device is upgraded, the URL of the firmware to be upgraded is obtained from the server. The URL carries an encrypted signature value. The security of the URL can be guaranteed by the signature value to prevent the URL from being tampered with, thereby downloading the wrong upgrade installation package, thereby ensuring the security of the upgrade process of the firmware to be upgraded. The URL also carries a random value. Because the random value is randomly generated, the random value can also be used to verify whether the URL has been used multiple times, that is, an anti-replay mechanism is added during the firmware upgrade process, thereby preventing replay attacks during the firmware upgrade process and ensuring the security of the upgrade installation package of the firmware to be upgraded. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1 is a schematic block diagram of the structure of an electronic device provided by an embodiment of the present invention;

[0024] Figure 2 It is a flowchart of an electronic device upgrading method provided by an embodiment of the present invention;

[0025] Figure 3 is a flow chart of another electronic device upgrading method provided by an embodiment of the present invention;

[0026] Figure 4 is a schematic structural block diagram of an electronic equipment upgrading device provided by an embodiment of the present invention;

[0027] Figure 5 The present invention is a schematic block diagram of another electronic equipment upgrading device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0030] It should be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0031] The embodiments of the present invention provide an electronic equipment upgrading method, apparatus, upgrading device and storage medium. The embodiments of the present invention provide a technical solution.

[0032] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0033] Figure 1 1 is a schematic block diagram of a structure of an upgrade device provided in an embodiment of the present invention, wherein the upgrade device is an electronic device or a server. In the embodiment of the present invention, the electronic device may be a mobile phone, a computer, a security device, etc., wherein the security device may be a surveillance camera, an access controller, a smoke detector, etc.

[0034] like Figure 1 As shown, the upgrade device 100 includes a processor 101 and a memory 102 , and the processor 101 and the memory 102 are connected via a bus 103 , such as an I2C (Inter-integrated Circuit) bus.

[0035] Specifically, the processor 101 is used to provide computing and control capabilities to support the operation of the entire upgrade device 100. The processor 101 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0036] Specifically, the memory 102 may be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive, or a mobile hard disk.

[0037] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the embodiment of the present invention, and does not constitute a limitation on the upgrade device to which the embodiment of the present invention is applied. The specific upgrade device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0038] Among them, when the upgrade device is an electronic device, the processor 101 is used to run a computer program stored in the memory 102. The computer program can be set in the electronic device. When the electronic device executes the computer program, it implements any one of the electronic device upgrade methods provided in the embodiments of the present invention.

[0039] In one embodiment, the processor is used to run a computer program stored in the memory, and implements the following steps when executing the computer program:

[0040] The electronic device sends an upgrade request to the server, so that the server determines that there is firmware to be upgraded according to the upgrade request, and then sends a notification message to the electronic device, wherein the notification message is used to indicate that there is firmware to be upgraded in the server;

[0041] After receiving the notification message, obtaining a URL corresponding to the firmware to be upgraded from the server, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request;

[0042] The upgrade installation package corresponding to the firmware to be upgraded is downloaded based on the URL, and the electronic device is upgraded according to the upgrade installation package.

[0043] In one embodiment, the step of downloading the upgrade installation package corresponding to the firmware to be upgraded based on the URL, and performing an upgrade operation on the electronic device according to the upgrade installation package includes:

[0044] Downloading the upgrade installation package corresponding to the firmware to be upgraded based on the URL, and performing a hash value verification on the upgrade installation package;

[0045] If the upgrade installation package passes the hash value verification, the electronic device is upgraded according to the upgrade installation package.

[0046] In one embodiment, the step of performing hash value verification on the upgrade installation package includes:

[0047] Obtaining a first hash value corresponding to the upgrade installation package from the blockchain, and obtaining a second hash value corresponding to the electronic device;

[0048] If the first Hash value and the second Hash value are the same, determining that the upgrade installation package passes the Hash value verification;

[0049] If the first Hash value and the second Hash value are different, it is determined that the upgrade installation package fails the Hash value verification.

[0050] In one embodiment, after receiving the notification message, the step of obtaining the URL corresponding to the firmware to be upgraded from the server includes:

[0051] After receiving the notification message and the challenge response value sent by the server, determining whether the electronic device meets the upgrade conditions, wherein the challenge response value is generated by the device identification of the electronic device, the version number of the firmware to be upgraded before the upgrade, and the random value;

[0052] When it is determined that the electronic device meets the upgrade condition, a URL corresponding to the firmware to be upgraded is obtained from the server.

[0053] Among them, when the upgrade device is a server, the processor 101 is used to run a computer program stored in the memory 102. The computer program can be set in the server. When the server executes the computer program, it implements any one of the electronic device upgrade methods provided in the embodiments of the present invention.

[0054] In one embodiment, the processor is used to run a computer program stored in the memory, and implements the following steps when executing the computer program:

[0055] receiving an upgrade request sent by the electronic device, and after determining that there is firmware to be upgraded of the electronic device according to the upgrade request, sending a notification message to the electronic device, and generating a URL corresponding to the firmware to be upgraded;

[0056] After receiving the acquisition request for the URL sent by the electronic device according to the notification message, the URL is sent to the electronic device so that the electronic device can obtain the upgrade installation package corresponding to the firmware to be upgraded according to the URL for upgrading operation, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request.

[0057] In one embodiment, the steps of receiving the upgrade request sent by the electronic device, after determining that there is firmware to be upgraded of the electronic device according to the upgrade request, generating a URL corresponding to the firmware to be upgraded, and sending a notification message to the electronic device include:

[0058] Receive an upgrade request sent by the electronic device, and when it is determined that the upgrade request meets the validity requirements and / or the electronic device is a legal device, and there is firmware to be upgraded for the electronic device, send a notification message to the electronic device and generate a URL corresponding to the firmware to be upgraded.

[0059] In one embodiment, the processor is further configured to implement the following steps when executing the computer program:

[0060] Obtaining a temporary token carried in the upgrade request, and verifying the validity of the temporary token;

[0061] If the temporary token is in a valid state, it is determined that the upgrade request meets the validity requirement.

[0062] In one embodiment, the processor is further configured to implement the following steps when executing the computer program:

[0063] determining identity information of the electronic device based on the upgrade request;

[0064] If the identity information passes the verification, it is determined that the electronic device is a legitimate device.

[0065] In one embodiment, the step of generating a URL corresponding to the firmware to be upgraded includes:

[0066] Obtaining basic parameters corresponding to the upgrade request;

[0067] Constructing upgrade parameters corresponding to the upgrade request, and generating a parameter dictionary based on the upgrade parameters;

[0068] Sorting the parameter dictionary, and generating a query string based on the sorted parameter dictionary;

[0069] Sign the query string to obtain a signature value corresponding to the query string, and generate a random value for the upgrade request;

[0070] The URL is generated according to the basic parameters, the query string, the signature value and the random value.

[0071] In one embodiment, after the step of sending the URL to the electronic device after receiving the acquisition request for acquiring the URL sent by the electronic device according to the notification message, the processor is further configured to implement the following steps when executing the computer program:

[0072] After receiving a download request from the electronic device to download an upgrade installation package corresponding to the firmware to be upgraded according to the URL, determining whether the random value in the URL is in an unused state;

[0073] If the random value is in an unused state, the upgrade installation package is sent to the electronic device.

[0074] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working process of the electronic device described above can refer to the corresponding process in the following electronic device upgrading method embodiment, and will not be repeated here.

[0075] The following will be combined Figure 1 The electronic device upgrade method provided by the embodiment of the present invention is described in detail. Figure 1 The upgrade device is only used to explain the electronic device upgrade method provided in the embodiment of the present invention, but does not constitute a limitation on the application scenario of the electronic device upgrade method provided in the embodiment of the present invention.

[0076] See also Figure 2 , Figure 2 It is a flowchart of an electronic device upgrading method provided by an embodiment of the present invention.

[0077] like Figure 2 As shown, the electronic device upgrading method is applied to an electronic device, and the electronic device upgrading method includes step S101, step S102 and step S103.

[0078] Step S101: The electronic device sends an upgrade request to a server, so that the server determines that there is firmware to be upgraded according to the upgrade request and then sends a notification message to the electronic device, wherein the notification message is used to indicate that there is firmware to be upgraded in the server.

[0079] In an embodiment of the present disclosure, the electronic device and the server establish communication through MQTT (Message Queuing Telemetry Transport). The user can trigger an upgrade request through an upgrade control in the electronic device, or the electronic device automatically triggers an upgrade request when it determines that an upgrade is required. When the electronic device detects the upgrade request, the electronic device sends the upgrade request to the server. In one embodiment, the upgrade request carries information such as the device ID (identification) of the electronic device, the version number of the firmware before the upgrade corresponding to the upgrade request, and a temporary token (Token), wherein different devices have different device IDs, and different electronic devices can be distinguished by the device ID; the version number is used to determine whether the electronic device has firmware to be upgraded; the temporary token is generated by the electronic device according to a specific algorithm and key when the upgrade request is detected, and is time-limited.

[0080] When the server receives the upgrade request sent by the electronic device, the server determines whether there is firmware to be upgraded based on the upgrade request. In one embodiment, the server obtains the version number in the upgrade request and obtains the current version number of the stored firmware. For ease of distinction, the version number in the upgrade request is recorded as the first version number, and the current version number of the firmware to be upgraded in the server is recorded as the second version number. If the first version number is less than the second version number, the server determines that there is firmware to be upgraded; if the first version number is greater than or equal to the second version number, the server determines that there is no firmware to be upgraded. When the server determines that there is firmware to be upgraded, the server generates a notification message and sends the notification message to the electronic device to inform the electronic device through the notification message that there is firmware to be upgraded in the server.

[0081] Step S102: after receiving the notification message, obtaining a URL corresponding to the firmware to be upgraded from the server, wherein the URL is generated according to basic parameters, a query string, a random value and an encrypted signature value corresponding to the upgrade request.

[0082] When the electronic device receives the notification message, the electronic device sends a request to the server to obtain the URL (Uniform Resource Locator) corresponding to the firmware to be upgraded from the server based on the request, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request. The process of generating the URL can refer to the description of the subsequent embodiments, which will not be repeated here.

[0083] Step S103: downloading an upgrade installation package corresponding to the firmware to be upgraded based on the URL, and performing an upgrade operation on the electronic device according to the upgrade installation package.

[0084] When the electronic device obtains the URL, the electronic device downloads the upgrade installation package corresponding to the firmware to be upgraded from the server through the URL, and performs an upgrade operation on the firmware to be upgraded according to the downloaded upgrade installation package. In one embodiment, regardless of whether the electronic device is upgraded successfully or failed, the electronic device will send an upgrade result message to the server, so that the server can determine whether the firmware to be upgraded of the electronic device is upgraded successfully based on the message.

[0085] In this embodiment, the electronic device sends an upgrade request to the server, so that the server determines that there is a firmware to be upgraded according to the upgrade request, and then sends a notification message to the electronic device, the notification message is used to indicate that there is a firmware to be upgraded in the server; when the electronic device receives the notification message, the URL corresponding to the firmware to be upgraded is obtained from the server, wherein the URL is generated according to the basic parameters corresponding to the upgrade request, the query string, the random value and the encrypted signature value; the upgrade installation package corresponding to the firmware to be upgraded is downloaded based on the URL, and the electronic device is upgraded according to the upgrade installation package. When the electronic device performs a firmware upgrade, the URL of the firmware to be upgraded is obtained from the server, and the URL carries the encrypted signature value. The signature value can ensure the security of the URL, prevent the URL from being tampered with, and thus download the wrong upgrade installation package, thereby ensuring the security of the firmware to be upgraded during the upgrade process, and the URL also carries a random value, because the random value is randomly generated, so the random value can also be used to verify whether the URL has been used multiple times, that is, an anti-replay mechanism is added during the firmware upgrade process, thereby preventing replay attacks during the firmware upgrade process, and ensuring the security of the upgrade installation package of the firmware to be upgraded.

[0086] In one embodiment, the step S103 includes:

[0087] Step a, downloading the upgrade installation package corresponding to the firmware to be upgraded based on the URL, and performing a hash value check on the upgrade installation package;

[0088] Step b: If the upgrade installation package passes the hash value verification, the electronic device is upgraded according to the upgrade installation package.

[0089] In one embodiment, after the electronic device obtains the upgrade installation package corresponding to the firmware to be upgraded based on the URL download, the electronic device performs a hash value check on the upgrade installation package. If the upgrade installation package passes the hash value check, the electronic device performs a firmware upgrade operation according to the upgrade installation package, that is, performs an upgrade operation on the electronic device according to the upgrade installation package; if the upgrade installation package fails to pass the hash value check, the electronic device refuses to perform an upgrade operation according to the upgrade installation package. In one embodiment, if the upgrade installation package fails to pass the hash value check, the electronic device can send a notification message of the hash value check failure to the server, so that the server can determine that the reason for the failure of the electronic device firmware upgrade is due to the hash value check failure.

[0090] The process of performing hash value verification on the upgrade installation package in step a includes the following steps:

[0091] Step a1, obtaining a first hash value corresponding to the upgrade installation package from the blockchain, and obtaining a second hash value corresponding to the electronic device;

[0092] In one embodiment, the process of the electronic device performing hash value verification on the upgrade installation package is as follows: the electronic device obtains the hash value corresponding to the upgrade installation package from the blockchain, and records the hash value obtained from the blockchain as the first hash value. It is understandable that the first hash value is generated by the server and then stored in the blockchain. The server stores the hash value of the upgrade installation package on the blockchain, and uses the immutability of the blockchain to ensure the security of the hash value, thereby further improving the security of the firmware upgrade process of the electronic device.

[0093] In one embodiment, the process of the server generating the first hash value is: the server performs a hash calculation on the content of the firmware upgrade installation package to be upgraded to obtain the installation package hash value. After the server obtains the installation package hash value, the server will obtain the device ID and the upgrade timestamp of the electronic device, and perform a secondary hash calculation on the installation package hash value, the device ID and the upgrade timestamp to obtain the first hash value. It can be understood that the first hash value is a multi-factor hash value. Among them, this embodiment does not limit the algorithm used for the hash calculation, such as the SHA-256 algorithm can be used for hash calculation. SHA-256 (Secure Hash Algorithm 256-bit) is a cryptographic hash function and belongs to the SHA-2 (Secure Hash Algorithm 2) family. The upgrade timestamp is the timestamp of the electronic device sending the upgrade request, and the server can obtain the device ID and upgrade timestamp from the upgrade request.

[0094] Exemplarily, if the first hash value is recorded as MultiFactorHash, the algorithm expression of the first hash value can be: MultiFactorHash=H(SHA256(PackageContent)+DeviceID+Timestamp1), where PackageContent represents the upgrade installation package, DeviceID is the device ID, Timestamp1 is the upgrade timestamp, H is a secure hash function, and SHA256 is a SHA-256 hash function.

[0095] After the server generates the first hash value, it will store the first hash value on the blockchain to ensure that the first hash value cannot be tampered with. When the electronic device needs the first hash value, it can query the blockchain to obtain the first hash value.

[0096] After receiving the upgrade installation package, the electronic device can generate a second hash value, that is, obtain the second hash value. The process of the electronic device generating the second hash value is the same as the process of the server generating the first hash value, which will not be repeated here.

[0097] Exemplarily, if the second hash value is recorded as DeviceMultiFactorHash, the algorithm expression of the second hash value may be: DeviceMultiFactorHash=H(SHA256(DownloadedPackage)+DeviceID+Timestamp1), wherein DownloadedPackage indicates that the electronic device obtains an upgraded installation package.

[0098] Step a2: if the first hash value and the second hash value are the same, determining that the upgrade installation package passes the hash value verification;

[0099] Step a3: If the first hash value and the second hash value are different, it is determined that the upgrade installation package fails the hash value verification.

[0100] After the electronic device obtains the first hash value and the second hash value, the electronic device determines whether the first hash value and the second hash value are the same. If the first hash value and the second hash value are the same, the electronic device determines that the upgrade installation package passes the hash value verification; if the first hash value and the second hash value are different, the electronic device determines that the upgrade installation package does not pass the hash value verification.

[0101] In this embodiment, after the electronic device obtains the upgrade installation package, a hash value verification is performed on the upgrade installation package. Only after the upgrade installation package passes the hash value verification, the electronic device will perform the upgrade operation based on the upgrade installation package, thereby preventing the upgrade installation package from being tampered with, thereby ensuring the integrity and security of the upgrade installation package, improving the security during the firmware upgrade process, and the success rate of the firmware upgrade, and avoiding the failure of the firmware upgrade due to an incomplete upgrade installation package.

[0102] In one embodiment, the step S102 may include:

[0103] After receiving the notification message and the challenge response value sent by the server, determining whether the electronic device meets the upgrade conditions, wherein the challenge response value is generated by the device identification of the electronic device, the version number of the firmware to be upgraded before the upgrade, and the random value;

[0104] When it is determined that the electronic device meets the upgrade condition, a URL corresponding to the firmware to be upgraded is obtained from the server.

[0105] In one embodiment, when the electronic device receives the notification message and receives the challenge response value sent by the server, the electronic device determines whether it currently meets the upgrade conditions. Wherein, the challenge response value is sent by the server to the electronic device before the electronic device downloads the upgrade installation package. When the electronic device receives the URL, it will perform a pre-verification process based on the challenge response value to determine whether it currently meets the upgrade conditions. Wherein, the challenge response value is generated by the server based on the device ID of the electronic device and the version number of the firmware to be upgraded before the upgrade. In one embodiment, the algorithm expression of the challenge response value (Challenge ResponseValue, CRV) can be: CRV = Hash (DeviceID + VersionNumber + RandomSeed), where Hash is a secure hash function, RandomSeed is a random number generated by the server, used to increase the unpredictability of CRV, DeviceID is the device ID of the electronic device, and VersionNumber is the version number of the firmware to be upgraded before the upgrade.

[0106] The process of pre-checking the electronic device based on the adjustment response value includes checking whether the current storage space, remaining power and network connection meet the upgrade conditions. If the current available storage space, remaining power and network connection all meet the upgrade conditions, it is determined that it currently meets the upgrade conditions, so as to download the upgrade installation package from the server based on the URL; if at least one of the current available storage space, remaining power and network connection does not meet the upgrade conditions, it is determined that it currently does not meet the upgrade conditions. In one embodiment, if the available storage space is greater than the preset value, it is determined that the available storage space meets the upgrade conditions, and if the available storage space is less than or equal to the preset value, it is determined that the available storage space does not meet the upgrade conditions. If the remaining power is greater than the preset power, it is determined that the remaining power meets the upgrade conditions; if the remaining power is less than or equal to the preset power, it is determined that the remaining power does not meet the upgrade conditions. If the current network connection state is good and will not be disconnected during the upgrade process, it is determined that the network connection meets the upgrade conditions; if the current network connection may be disconnected during the upgrade process, it is determined that the network connection does not meet the upgrade conditions. Whether the network connection will be disconnected during the upgrade process can be represented by the current network signal strength. The higher the network signal strength, the lower the possibility of network connection disconnection. In the embodiment of the present disclosure, the preset value and the preset power can be set according to specific needs.

[0107] When the electronic device determines that it currently meets the upgrade conditions, the electronic device will obtain a URL from the server to download the upgrade installation package through the URL to perform the upgrade operation. In one embodiment, regardless of whether the electronic device currently meets the upgrade conditions, the electronic device will send the verification result of the pre-verification process to the server. When the server determines that the electronic device currently does not meet the upgrade conditions based on the verification result, the server will not send the URL to the electronic device, but will send a termination signal to the electronic device, and the termination signal will inform the electronic device that the firmware upgrade process has been terminated. The termination signal can carry the reason for the termination of the firmware upgrade process.

[0108] This embodiment determines whether the electronic device meets the upgrade conditions before the electronic device downloads the upgrade installation package. Only when the electronic device meets the upgrade conditions, it obtains the URL corresponding to the firmware to be upgraded from the server, and downloads the upgrade installation package based on the URL to perform the firmware upgrade. This avoids the situation where the upgrade installation package is downloaded but the upgrade cannot be generated due to the reasons of the electronic device, thereby improving the success rate of the firmware upgrade of the electronic device.

[0109] In one embodiment, the electronic device upgrade method is applied to a server, and the electronic device upgrade method includes:

[0110] Step S201, receiving an upgrade request sent by the electronic device, after determining that there is firmware to be upgraded of the electronic device according to the upgrade request, sending a notification message to the electronic device, and generating a URL corresponding to the firmware to be upgraded.

[0111] In this embodiment, when the server receives an upgrade request sent by the electronic device and determines that there is firmware to be upgraded according to the upgrade request, a notification message is generated and sent to the electronic device, and a URL corresponding to the firmware to be upgraded is generated. The notification message is used to inform the electronic device that there is firmware to be upgraded in the server.

[0112] In one embodiment, the process of generating the URL corresponding to the firmware to be upgraded is: obtaining basic parameters corresponding to the upgrade request; constructing upgrade parameters corresponding to the upgrade request, and generating a parameter dictionary based on the upgrade parameters; sorting the parameter dictionary, and generating a query string based on the sorted parameter dictionary; signing the query string, obtaining a signature value corresponding to the query string, and generating a random value for the upgrade request; generating the URL according to the basic parameters, the query string, the signature value and the random value.

[0113] In one embodiment, the process of the server generating the URL corresponding to the firmware to be upgraded is as follows: the server obtains the basic parameters corresponding to the upgrade request, wherein the basic parameters include the server address and the interface path. The server constructs the upgrade parameters corresponding to the upgrade request, and the upgrade parameters include the unique request identifier generated by the server for the upgrade request, the device ID, the version number before the upgrade, the timestamp of the current time, and the specific parameters that have been authorized and authenticated by the temporary token (such as the confirmation code after the temporary token is verified, etc.). In one embodiment, the server can generate the unique identifier (Request ID) through the UUID (Universally Unique Identifier) ​​algorithm. When the server obtains the upgrade parameters, it generates a parameter dictionary based on the upgrade parameters. For example, the process of generating the parameter dictionary Params can be:

[0114] Params = {

[0115] device_id: input.device_id, device ID

[0116] version:input.version, version number

[0117] request_id:request_id, request identifier

[0118] timestamp:current_time(), current time timestamp

[0119] token_code: authorization_code, a specific parameter for temporary token authorization authentication

[0120] }.

[0121] After the server obtains the parameter dictionary, it sorts the parameter dictionary to obtain a sorted parameter dictionary, and generates a query string based on the sorted parameter dictionary. In the process of sorting the parameter dictionary, the first letter of each parameter in the parameter dictionary may be sorted, or the parameters may be sorted according to other sorting rules.

[0122] Exemplarily, the process of sorting the parameter dictionary is: sorted_params=Sort(params), that is, the sorted parameter dictionary is sorted_params. The process of generating the query string is: query_string=Encode(sorted_params), that is, the query string is query_string.

[0123] After the server generates the query string, it signs the query string, obtains the signature value corresponding to the query string, and generates a random value for the upgrade request; then the URL is generated based on the basic parameters, query string, signature value, and random value. Exemplarily, the server can sign the query string using the HMAC-SHA256 algorithm, and the process can be Signature = HMAC-SHA256 (secret_key, query_string), thereby generating a signature value Signature. The random value of the upgrade request is unique, and the random value is a random number or a non-repeating number. The random value is valid and is valid within a certain period of time. After the period of time corresponding to the random value, the random value becomes invalid.

[0124] Exemplarily, the process of the server generating a URL according to basic parameters, query string, signature value and random value can be expressed as: secure_url=base_url+"?"+query_string+"&signature="+signature+"&nonce_value="+nonce_value, where nonce_value is a random value and secure_url is the generated URL.

[0125] In this embodiment, a unique request identifier and a random value are generated by using UUID to prevent repeated upgrade requests, thereby ensuring the uniqueness of the upgrade installation package obtained by the electronic device; in the process of generating the URL, the parameters involved are encrypted to prevent the URL from being tampered with; the timestamp of the current time can be used to determine whether the random value is invalid. When the random value is invalid, it means that the URL is also invalid, thereby ensuring the security of the URL.

[0126] Step S202, after receiving the acquisition request for obtaining the URL sent by the electronic device according to the notification message, the URL is sent to the electronic device, so that the electronic device can obtain the upgrade installation package corresponding to the firmware to be upgraded according to the URL for upgrading operation, wherein the URL is generated according to the basic parameters corresponding to the upgrade request, the query string, the random value and the encrypted signature value.

[0127] When the electronic device receives the notification message sent by the server, the electronic device will send a request to obtain the URL to the server. When the server receives the acquisition request, it sends the URL to the electronic device so that the electronic device can use the URL to obtain the upgrade installation package corresponding to the firmware to be upgraded for the upgrade operation, wherein the URL is generated according to the basic parameters corresponding to the upgrade request, the query string, the random value and the encrypted signature value.

[0128] In this embodiment, the server receives an upgrade request sent by the electronic device, and after determining that there is a firmware to be upgraded of the electronic device according to the upgrade request, generates a URL corresponding to the firmware to be upgraded, and sends a notification message to the electronic device; after receiving the acquisition request for acquiring the URL sent by the electronic device according to the notification message, the URL is sent to the electronic device, so that the electronic device can acquire the upgrade installation package corresponding to the firmware to be upgraded according to the URL for the upgrade operation, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request. When the electronic device performs a firmware upgrade, the URL of the firmware to be upgraded is acquired from the server, and the URL carries the encrypted signature value. The signature value can ensure the security of the URL, prevent the URL from being tampered with, and thus download the wrong upgrade installation package, thereby ensuring the security of the firmware to be upgraded during the upgrade process, and the URL also carries a random value, because the random value is randomly generated, so the random value can also be used to verify whether the URL has been used multiple times, that is, an anti-replay mechanism is added during the firmware upgrade process, thereby preventing replay attacks during the firmware upgrade process, and ensuring the security of the upgrade installation package of the firmware to be upgraded.

[0129] In one embodiment, the step S201 further includes:

[0130] Receive an upgrade request sent by the electronic device, and when it is determined that the upgrade request meets the validity requirements and / or the electronic device is a legal device, and there is firmware to be upgraded for the electronic device, send a notification message to the electronic device and generate a URL corresponding to the firmware to be upgraded.

[0131] In one embodiment, after the server receives the upgrade request sent by the electronic device, the server determines whether the upgrade request meets the validity requirements and / or whether the electronic device is a legal device. When the server determines that the upgrade request meets the validity requirements and / or the electronic device is a legal device, and there is firmware to be upgraded for the electronic device, a notification message is sent to the electronic device, and a URL corresponding to the firmware to be upgraded is generated. In one embodiment, if the server determines that the upgrade request does not meet the validity requirements, the server will end the upgrade process. In another embodiment, if the server determines that the electronic device is not a legal device, the server will end the upgrade process.

[0132] In one embodiment, the process of determining whether the upgrade request meets the validity requirements is: obtaining a temporary token carried in the upgrade request and verifying the validity of the temporary token; if the temporary token is in a valid state, determining that the upgrade request meets the validity requirements.

[0133] The process by which the server determines that the upgrade request meets the validity requirements is as follows: obtain the temporary token carried by the upgrade request and verify the validity of the temporary token. When the temporary token has not expired and the temporary token signature matches, it is determined that the temporary token is in a valid state, that is, it is determined that the upgrade request meets the validity requirements; if the temporary token has expired, and / or the temporary token signature does not match, it can be determined that the temporary token is in an invalid state, that is, it is determined that the upgrade request does not meet the validity requirements. It can be understood that since the temporary token has a time limit, when the temporary token is generated, the generation time of the temporary token can be recorded, and then the time difference between the current time and the generation time is compared. If the time difference is greater than or equal to the duration corresponding to the time limit, it indicates that the temporary token has expired; if the time difference is less than the duration corresponding to the time limit, it indicates that the temporary token has not expired. Since the temporary token is generated by encryption, the encryption process is the signing process. In the process of determining whether the temporary token signature matches, the temporary token can be decrypted first. After obtaining the decrypted temporary token, the decrypted temporary token is encrypted based on the same encryption algorithm to obtain the encrypted token signature. If the encrypted token signature is the same as the temporary token carried in the upgrade request, it indicates that the signature of the temporary token matches. Otherwise, it indicates that the signature of the temporary token matches.

[0134] In one embodiment, the process of determining that the electronic device is a legitimate device is: determining the identity information of the electronic device based on the upgrade request; if the identity information passes the verification, determining that the electronic device is a legitimate device.

[0135] In one embodiment, the process of the server determining that the electronic device is a legal device is as follows: when the server receives an upgrade request, the server determines the identity information of the electronic device based on the upgrade request. The identity information includes an API (Application Programming Interface) key and a device certificate. When both the API key and the device certificate of the electronic device are verified, it indicates that the identity information of the electronic device is verified. At this time, it can be determined that the electronic device is a legal device; when the API key and / or the device certificate of the electronic device are not verified, it indicates that the identity information of the electronic device is not verified, and it is determined that the electronic device is not a legal device but an illegal device.

[0136] Exemplarily, the verification process of the API key is as follows: when the electronic device sends an upgrade request to the server, it carries an API key. This key is pre-assigned to the device by the server and is used to verify the legitimacy of the device. After receiving the upgrade request, the server will check whether the API key carried is consistent with the API key corresponding to the electronic device in the server record; if they are consistent, the server believes that the upgrade request comes from a known and authorized electronic device; if they are inconsistent, the server will refuse to respond to the upgrade request.

[0137] A device certificate is a digital certificate that contains the public key and some identity information of the electronic device and is issued by a trusted certificate authority (CA). When an electronic device sends an upgrade request to the server, it will attach its device certificate. The server uses the CA's public key to verify the device certificate, including whether the device certificate has been revoked, expired, and whether the signature is valid. If the device certificate verification passes, that is, the device certificate has not been revoked, has not expired, and the signature is valid, the server can determine that the upgrade request comes from the electronic device specified in the certificate and that the electronic device is authenticated. The verification process of the device certificate can refer to the relevant technology, which will not be described in detail in this embodiment.

[0138] In this embodiment, the server will send a notification message to the electronic device and generate a URL corresponding to the firmware to be upgraded only when it determines that the upgrade request meets the validity requirements and / or the electronic device is a legal device and there is firmware to be upgraded for the electronic device, thereby preventing illegal devices from obtaining the upgrade installation package, thereby ensuring the legitimacy of the firmware upgrade process on the server side.

[0139] In one embodiment, after step S202, the electronic device upgrading method further includes:

[0140] After receiving a download request from the electronic device to download an upgrade installation package corresponding to the firmware to be upgraded according to the URL, determining whether the random value in the URL is in an unused state;

[0141] If the random value is in an unused state, the upgrade installation package is sent to the electronic device.

[0142] In one embodiment, after the server receives a download request from an electronic device to download an upgrade installation package corresponding to the firmware to be upgraded according to a URL, the server determines whether the random value in the URL is in an unused state. The electronic device obtains the URL from the server, and then downloads the upgrade installation package from the server according to the URL. When the electronic device downloads the upgrade installation package from the server according to the URL triggering the download request, the download request will carry a random value. When the server receives the download request, the server will obtain the random value in the download request, and determine whether there is the same random value in other received download requests. If there is the same random value, the server determines that the random value has been used, that is, the random value is in a used state; if there is no same random value, the server determines that the random value has not been used, that is, the random value is in an unused state. When the server determines that the random value is in an unused state, the server sends the upgrade installation package to the electronic device.

[0143] In this embodiment, the upgrade installation package will be sent to the electronic device only when it is determined that the random value in the download request is in an unused state. If the random value in the download request is in a used state, the download request is rejected and the upgrade installation package is not sent to the electronic device. An anti-replay mechanism is added to the firmware upgrade process through the random value to prevent replay attacks.

[0144] In one embodiment, the server can also control the electronic devices in the designated area to upgrade according to the IP (Internet Protocol) address and regional information, so as to ensure the pertinence and effectiveness of the upgrade operation. The backend system of the server can upload the program upgrade package and edit the corresponding information to realize the centralized management and distribution of the upgrade package.

[0145] In one embodiment, if the server determines that the firmware upgrade has failed based on the feedback from the electronic device, the server will make a corresponding security response based on the error code fed back by the electronic device, such as resending the upgrade installation package, recording a log of the installation failure, etc.

[0146] When the server determines that the electronic device upgrade fails, the server may perform one or more of the following operations:

[0147] ①Error code analysis:

[0148] The server first parses the error code sent by the electronic device when the firmware upgrade fails to determine the specific error type and cause, such as authentication failure, hash value mismatch, inappropriate electronic device status, etc.

[0149] ②Record and monitor:

[0150] The server will record the error information related to the failed firmware upgrade of the electronic device, including timestamp, device ID, error code and related log information, etc., for subsequent troubleshooting.

[0151] ③ Take corresponding measures:

[0152] The server will isolate the affected electronic device. For example, if the electronic device sends an error code when the firmware upgrade fails, indicating that there is a security risk to the electronic device (such as authentication failure), the server may temporarily isolate the electronic device to prevent the electronic device from continuing sensitive operations.

[0153] ④Send feedback information to electronic devices:

[0154] The server can send feedback information to the electronic device, informing the electronic device of the specific error that occurred and suggested solutions, such as retrying authentication or checking the network connection.

[0155] ⑤Restoration and repair:

[0156] If the failure of the electronic device firmware upgrade is caused by a server system failure, the server will issue an alarm to notify technical support for repair and recovery operations.

[0157] When the server determines that the electronic device firmware upgrade fails, it will perform a series of operations to improve the success rate and security of the electronic device firmware upgrade.

[0158] See also Figure 4 , Figure 4 The present invention is a schematic block diagram of an electronic equipment upgrading device provided by an embodiment of the present invention.

[0159] like Figure 4 As shown, the electronic device upgrading device 500 is applied to an electronic device, and the electronic device upgrading device 500 includes:

[0160] The request sending module 510 is used for the electronic device to send an upgrade request to the server, so that the server can send a notification message to the electronic device after determining that there is firmware to be upgraded according to the upgrade request, wherein the notification message is used to indicate that there is firmware to be upgraded in the server;

[0161] A URL acquisition module 520 is used to acquire the URL corresponding to the firmware to be upgraded from the server after receiving the notification message, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request;

[0162] The installation package downloading module 530 is used to download the upgrade installation package corresponding to the firmware to be upgraded based on the URL, and perform an upgrade operation on the electronic device according to the upgrade installation package.

[0163] In one embodiment, the installation package download module 530 includes:

[0164] An installation package downloading unit, used to download the upgrade installation package corresponding to the firmware to be upgraded based on the URL;

[0165] An installation package verification unit, used to perform hash value verification on the upgrade installation package;

[0166] An upgrading unit is used to upgrade the electronic device according to the upgrading installation package if the upgrading installation package passes the hash value verification.

[0167] In one embodiment, the installation package verification unit is further used to obtain a first hash value corresponding to the upgrade installation package from the blockchain, and to obtain a second hash value corresponding to the electronic device; if the first hash value and the second hash value are the same, it is determined that the upgrade installation package passes the hash value verification; if the first hash value and the second hash value are different, it is determined that the upgrade installation package fails to pass the hash value verification.

[0168] In one embodiment, the URL acquisition module 520 includes:

[0169] an upgrade condition determination unit, configured to determine whether the electronic device meets the upgrade condition after receiving the notification message and the challenge response value sent by the server, wherein the challenge response value is generated by the device identification of the electronic device, the version number of the firmware to be upgraded before the upgrade, and the random value;

[0170] The URL acquisition unit is used to acquire the URL corresponding to the firmware to be upgraded from the server when it is determined that the electronic device meets the upgrade condition.

[0171] See also Figure 5 , Figure 5 The present invention is a schematic block diagram of an electronic equipment upgrading device provided by an embodiment of the present invention.

[0172] like Figure 5 As shown, the electronic device upgrading device 600 is applied to a server, and the electronic device upgrading device 600 includes:

[0173] The message sending module 610 is used to receive an upgrade request sent by the electronic device, and after determining that there is firmware to be upgraded for the electronic device according to the upgrade request, send a notification message to the electronic device;

[0174] URL generation module 620, used to generate a URL corresponding to the firmware to be upgraded;

[0175] The URL sending module 630 is used to send the URL to the electronic device after receiving the acquisition request for obtaining the URL sent by the electronic device according to the notification message, so that the electronic device can obtain the upgrade installation package corresponding to the firmware to be upgraded according to the URL for upgrading operation, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request.

[0176] In one embodiment, the message sending module 610 is also used to receive an upgrade request sent by the electronic device, and when it is determined that the upgrade request meets the validity requirements and / or the electronic device is a legal device, and there is firmware to be upgraded for the electronic device, a notification message is sent to the electronic device.

[0177] In one embodiment, the electronic device upgrading device 600 further includes:

[0178] A temporary token acquisition module, used to acquire the temporary token carried in the upgrade request;

[0179] A validity verification module, used to verify the validity of the temporary token;

[0180] The validity requirement determination module is used to determine whether the upgrade request meets the validity requirement if the temporary token is in a valid state.

[0181] In one embodiment, the electronic device upgrading device 600 further includes:

[0182] An identity information determination module, configured to determine the identity information of the electronic device based on the upgrade request;

[0183] The device determination module is used to determine that the electronic device is a legitimate device if the identity information passes the verification.

[0184] In one embodiment, the URL generation module 620 includes:

[0185] A parameter acquisition unit, used to acquire basic parameters corresponding to the upgrade request;

[0186] A parameter construction unit, used to construct an upgrade parameter corresponding to the upgrade request;

[0187] A parameter dictionary generating unit, configured to generate a parameter dictionary based on the upgrade parameters;

[0188] A character string generating unit, used for sorting the parameter dictionary and generating a query character string based on the sorted parameter dictionary;

[0189] A signature value generating unit, used to sign the query string to obtain a signature value corresponding to the query string;

[0190] A random value generating unit, used to generate a random value for an upgrade request;

[0191] A URL generating unit is used to generate the URL according to the basic parameters, the query string, the signature value and the random value.

[0192] In one embodiment, the electronic device upgrading device 600 further includes:

[0193] a state determination module, configured to determine whether the random value in the URL is in an unused state after receiving a download request from the electronic device to download an upgrade installation package corresponding to the firmware to be upgraded according to the URL;

[0194] The installation package sending module is used to send the upgrade installation package to the electronic device if the random value is in an unused state.

[0195] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working process of the electronic device upgrading device described above can refer to the corresponding process in the aforementioned electronic device upgrading method embodiment, and will not be repeated here.

[0196] An embodiment of the present invention further provides a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement any electronic device upgrading method provided in the description of the embodiment of the present invention.

[0197] The storage medium may be an internal storage unit of the electronic device described in the above embodiment, such as a hard disk or memory of the electronic device. The storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device.

[0198] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware embodiment, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0199] It should be understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0200] The serial numbers of the embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for upgrading an electronic device, characterized in that: The method is applied to an electronic device, and the method comprises: The electronic device sends an upgrade request to the server, so that the server determines that there is firmware to be upgraded according to the upgrade request, and then sends a notification message to the electronic device, wherein the notification message is used to indicate that there is firmware to be upgraded in the server; After receiving the notification message, obtaining a URL corresponding to the firmware to be upgraded from the server, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request; The upgrade installation package corresponding to the firmware to be upgraded is downloaded based on the URL, and the electronic device is upgraded according to the upgrade installation package.

2. The electronic device upgrading method according to claim 1, characterized in that: The step of downloading the upgrade installation package corresponding to the firmware to be upgraded based on the URL, and performing an upgrade operation on the electronic device according to the upgrade installation package includes: Downloading the upgrade installation package corresponding to the firmware to be upgraded based on the URL, and performing a hash value verification on the upgrade installation package; If the upgrade installation package passes the hash value verification, the electronic device is upgraded according to the upgrade installation package.

3. The electronic equipment upgrading method according to claim 2, characterized in that: The step of performing hash value verification on the upgrade installation package includes: Obtaining a first hash value corresponding to the upgrade installation package from the blockchain, and obtaining a second hash value corresponding to the electronic device; If the first Hash value and the second Hash value are the same, determining that the upgrade installation package passes the Hash value verification; If the first Hash value and the second Hash value are different, it is determined that the upgrade installation package fails the Hash value verification.

4. The electronic device upgrading method according to claim 1, characterized in that: After receiving the notification message, the step of obtaining the URL corresponding to the firmware to be upgraded from the server includes: After receiving the notification message and the challenge response value sent by the server, determining whether the electronic device meets the upgrade conditions, wherein the challenge response value is generated by the device identification of the electronic device, the version number of the firmware to be upgraded before the upgrade, and the random value; When it is determined that the electronic device meets the upgrade condition, a URL corresponding to the firmware to be upgraded is obtained from the server.

5. A method for upgrading an electronic device, characterized in that: The method is applied to a server, and the method comprises: receiving an upgrade request sent by the electronic device, and after determining that there is firmware to be upgraded of the electronic device according to the upgrade request, sending a notification message to the electronic device, and generating a URL corresponding to the firmware to be upgraded; After receiving the acquisition request for the URL sent by the electronic device according to the notification message, the URL is sent to the electronic device so that the electronic device can obtain the upgrade installation package corresponding to the firmware to be upgraded according to the URL for upgrading operation, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request.

6. The electronic equipment upgrading method according to claim 5, characterized in that: The step of receiving the upgrade request sent by the electronic device, and after determining that there is firmware to be upgraded for the electronic device according to the upgrade request, sending a notification message to the electronic device comprises: An upgrade request sent by the electronic device is received, and when it is determined that the upgrade request meets validity requirements and / or the electronic device is a legal device and there is firmware to be upgraded for the electronic device, a notification message is sent to the electronic device.

7. The electronic device upgrading method according to claim 6, characterized in that: The method further comprises: Obtaining a temporary token carried in the upgrade request, and verifying the validity of the temporary token; If the temporary token is in a valid state, it is determined that the upgrade request meets the validity requirement.

8. The electronic equipment upgrading method according to claim 6, characterized in that: The method further comprises: determining identity information of the electronic device based on the upgrade request; If the identity information passes the verification, it is determined that the electronic device is a legitimate device.

9. The electronic equipment upgrading method according to claim 5, characterized in that: The step of generating a URL corresponding to the firmware to be upgraded includes: Obtaining basic parameters corresponding to the upgrade request; Constructing upgrade parameters corresponding to the upgrade request, and generating a parameter dictionary based on the upgrade parameters; Sorting the parameter dictionary, and generating a query string based on the sorted parameter dictionary; Sign the query string to obtain a signature value corresponding to the query string, and generate a random value for the upgrade request; The URL is generated according to the basic parameters, the query string, the signature value and the random value.

10. The electronic equipment upgrading method according to claim 9, characterized in that: After receiving the acquisition request for acquiring the URL sent by the electronic device according to the notification message, the step of sending the URL to the electronic device also includes: After receiving a download request from the electronic device to download an upgrade installation package corresponding to the firmware to be upgraded according to the URL, determining whether the random value in the URL is in an unused state; If the random value is in an unused state, the upgrade installation package is sent to the electronic device.

11. An electronic equipment upgrading device, characterized in that: The electronic equipment upgrading device is applied to an electronic equipment, and the electronic equipment upgrading device comprises: A request sending module, used for the electronic device to send an upgrade request to the server, so that the server can send a notification message to the electronic device after determining that there is firmware to be upgraded according to the upgrade request, wherein the notification message is used to indicate that there is firmware to be upgraded in the server; A URL acquisition module, configured to acquire a URL corresponding to the firmware to be upgraded from the server after receiving the notification message, wherein the URL is generated according to basic parameters, a query string, a random value, and an encrypted signature value corresponding to the upgrade request; The installation package downloading module is used to download the upgrade installation package corresponding to the firmware to be upgraded based on the URL, and perform an upgrade operation on the electronic device according to the upgrade installation package.

12. An electronic equipment upgrading device, characterized in that: The electronic equipment upgrading device is applied to a server, and the electronic equipment upgrading device comprises: a message sending module, configured to receive an upgrade request sent by the electronic device, and after determining that there is firmware to be upgraded for the electronic device according to the upgrade request, send a notification message to the electronic device; A URL generation module, used to generate a URL corresponding to the firmware to be upgraded; A URL sending module is used to send the URL to the electronic device after receiving an acquisition request for acquiring the URL sent by the electronic device according to the notification message, so that the electronic device can acquire the upgrade installation package corresponding to the firmware to be upgraded according to the URL for upgrading operation, wherein the URL is generated according to the basic parameters, query string, random value and encrypted signature value corresponding to the upgrade request.

13. An upgrade device, characterized in that: The upgrading device comprises a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the electronic device upgrading method as described in any one of claims 1 to 4 or 5 to 10 is realized.

14. A storage medium for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the electronic device upgrading method according to any one of claims 1 to 4 or 5 to 10.