Terminal equipment upgrading method, device, computer equipment and storage medium
By implementing the identity authentication and token mechanism in the terminal device, the problem of insufficient security of upgrade packages in the existing wireless upgrade technology is solved, and the security and legality of the device upgrade process are achieved.
Patent Information
- Application Number
- CN202111107134.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-22
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2041-09-22
AI Technical Summary
The existing wireless upgrade technology has security risks when downloading program update packages, such as the program update packages may be maliciously intercepted or dropped, resulting in the inability to ensure security during device upgrades.
By sending access request instructions to the upgrade server, receiving and parsing the authentication reply result, generating the first token, and querying and downloading the upgrade data packet based on the token, ensuring the security of the device upgrade process.
Through identity authentication and token mechanisms, this method ensures the security of device upgrades, avoids illegal access and resource loss, and ensures the legality of upgraded data packets and the security status of the device.
Smart Images

Figure CN113900684B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a terminal device upgrading method, device, computer device and storage medium. Background Art
[0002] With the development of IoT technology, more and more IoT terminals are online. However, after installation and networking at the application site, relevant maintenance personnel also need to maintain and upgrade IoT terminals according to customer needs or market changes. Since the number of IoT terminals is generally large and the installation locations are different, most manufacturers use wireless upgrade technology to perform equipment upgrades when performing maintenance and upgrades.
[0003] The existing wireless upgrade technology mainly downloads program update packages through wireless networks, and performs flash upgrades through the downloaded program update packages. Although the existing wireless upgrade technology can effectively realize device upgrades, when downloading program update packages, there may be situations where the program update packages are maliciously intercepted or dropped, so that program update packages of unknown sources may be upgraded during the upgrade, and the security of device upgrades cannot be guaranteed, which poses certain security risks. Summary of the invention
[0004] Based on this, it is necessary to provide a terminal device upgrade method, device, computer equipment and storage medium that can ensure the security of device upgrades in response to the above technical problems.
[0005] A terminal device upgrade method, the method is applied to the terminal device, comprising the following steps:
[0006] Sending an access request instruction to the upgrade server, and receiving an authentication reply result fed back by the upgrade server based on the access request instruction;
[0007] Parsing the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes access result information of the terminal device and randomly generated verification information;
[0008] Based on the access result information obtained by parsing, when confirming that the access request is successful, generating a first token based on the verification information;
[0009] Acquire device information, and transmit the first token and the device information to the upgrade server, so that the upgrade server, based on the received first token, queries the upgrade data package based on the device information when determining that the terminal device has download authority, and feeds back corresponding upgrade data package download information to the terminal device when the query is successful;
[0010] Receive the upgrade data package download information fed back by the upgrade server, and perform device upgrade according to the upgrade data package download information.
[0011] A terminal equipment upgrading device, the device comprising:
[0012] A request initiation module, configured to send an access request instruction to an upgrade server, and receive an authentication reply result fed back by the upgrade server based on the access request instruction;
[0013] A parsing module, used to parse the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes access result information of the terminal device and randomly generated verification information;
[0014] A verification processing module, configured to generate a first token based on the access result information obtained by parsing and based on the verification information when confirming that the access request is successful;
[0015] an information transmission module, configured to obtain device information, and transmit the first token and the device information to the upgrade server, so that the upgrade server can query the upgrade data package based on the device information when determining that the terminal device has the download authority according to the received first token, and when the query is successful, feedback the corresponding upgrade data package download information to the terminal device;
[0016] The device upgrade module is used to receive the upgrade data package download information fed back by the upgrade server, and perform device upgrade according to the upgrade data package download information.
[0017] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0018] Sending an access request instruction to the upgrade server, and receiving an authentication reply result fed back by the upgrade server based on the access request instruction;
[0019] Parsing the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes access result information of the terminal device and randomly generated verification information;
[0020] Based on the access result information obtained by parsing, when confirming that the access request is successful, generating a first token based on the verification information;
[0021] Acquire device information, and transmit the first token and the device information to the upgrade server, so that the upgrade server, based on the received first token, queries the upgrade data package based on the device information when determining that the terminal device has download authority, and feeds back corresponding upgrade data package download information to the terminal device when the query is successful;
[0022] Receive the upgrade data package download information fed back by the upgrade server, and perform device upgrade according to the upgrade data package download information.
[0023] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0024] Sending an access request instruction to the upgrade server, and receiving an authentication reply result fed back by the upgrade server based on the access request instruction;
[0025] Parsing the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes access result information of the terminal device and randomly generated verification information;
[0026] Based on the access result information obtained by parsing, when confirming that the access request is successful, generating a first token based on the verification information;
[0027] Acquire device information, and transmit the first token and the device information to the upgrade server, so that the upgrade server, based on the received first token, queries the upgrade data package based on the device information when determining that the terminal device has download authority, and feeds back corresponding upgrade data package download information to the terminal device when the query is successful;
[0028] Receive the upgrade data package download information fed back by the upgrade server, and perform device upgrade according to the upgrade data package download information.
[0029] In the terminal device upgrade method, device, computer device and storage medium, the terminal device sends an access request instruction to the upgrade server, and receives the authentication reply result fed back by the upgrade server based on the access request instruction. The authentication reply result includes access result information and verification information. After that, the terminal device determines based on the access result information that when the request access is confirmed to be successful, it generates a corresponding first token based on the parsed verification information to obtain the corresponding upgrade data packet through the first token. Among them, the terminal device will only interact with the upgrade server after successfully accessing the upgrade server, which can ensure the security of the interactive identity between the upgrade server and the terminal device, and also avoid the access of illegal visitors, and can ensure the security of the upgrade process. In addition, since the verification information is randomly generated, this operation can also indirectly ensure the variability of the token, so that even if an illegal visitor can steal a token of a certain upgrade stage, he cannot forge a terminal device based on the token, and then request an upgrade data packet from the upgrade server. In addition, before the upgrade server feeds back the upgrade data packet download information to the terminal device, it will also determine the download authority of the terminal device based on the received token to avoid the loss of resources caused by feeding back the upgrade data packet download information to the unauthorized device, and further ensure the security of the device upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A diagram of an application environment of a terminal device upgrade method in an embodiment;
[0031] Figure 2 A schematic diagram of a portion of a process flow of a terminal device upgrade method in one embodiment;
[0032] Figure 3 A schematic diagram of the overall process of a terminal device upgrade method in one embodiment;
[0033] Figure 4 A schematic diagram of a flow chart of the upgrade steps of an old program in one embodiment;
[0034] Figure 5 It is a structural block diagram of a terminal device upgrading device in one embodiment;
[0035] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0037] The terminal device upgrade method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal device 102 communicates with the upgrade server 104 through the network. The terminal device 102 sends an access request instruction to the upgrade server 104, and receives the authentication reply result fed back by the upgrade server 104 based on the access request instruction; the terminal device 102 parses the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes the access result information of the terminal device and the randomly generated verification information; the terminal device 102 generates a first token based on the verification information when confirming that the access request is successful based on the access result information obtained by parsing; the terminal device 102 obtains the device information, and transmits the first token and the device information to the upgrade server 104, so that the upgrade server 104, based on the received first token, when determining that the terminal device 102 has the download authority, queries the upgrade data package based on the device information, and when the query is successful, feeds back the corresponding upgrade data package download information to the terminal device 102; the terminal device 102 receives the upgrade data package download information fed back by the upgrade server 104, and performs device upgrade according to the upgrade data package download information.
[0038] The terminal device 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, portable wearable devices, and IoT terminals, and the upgrade server 106 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0039] In one embodiment, Figure 2 As shown, a terminal device upgrade method is provided, which is applied to Figure 1 The terminal device in the example is used to illustrate, including the following steps:
[0040] Step S202: sending an access request instruction to the upgrade server, and receiving an authentication response result fed back by the upgrade server based on the access request instruction.
[0041] Specifically, first, the terminal device receives the upgrade instruction sent by the application server, wherein the upgrade instruction carries the access address of the upgrade server. Secondly, the terminal device parses the received upgrade instruction, and based on the access address of the upgrade server obtained by the parsing, based on the preset communication port, sends an access request instruction to the upgrade server in a directional manner, wherein the access request instruction carries the identification number of the terminal device. Afterwards, after receiving the access request instruction, the upgrade server will parse the access request instruction to determine the identification number of the terminal device, and determine whether the terminal device has access rights based on the identification number of the terminal device obtained by the parsing, and feedback the corresponding authentication reply result to the terminal device.
[0042] In one embodiment, the identification number of the terminal device may be an IMEI (International Mobile Equipment Identity) number. It should be noted that the IMEI number is commonly referred to as a mobile phone serial number, a mobile phone "serial number", etc., which is used to identify each independent mobile phone or other communication device in the network, which is equivalent to the ID card of the terminal device.
[0043] Based on the above embodiment, the terminal device will send an access request instruction to the upgrade server through the following communication interface:
[0044] "https: / / ip:port / fota / api / authent?id={IMEI_NUM}&version={VER SION_NUM}, method=GET";
[0045] Among them, {IMEI_NUM} is the IMEI number of the terminal device; {VERSION_NUM} is the adopted protocol version. It should be noted that the above protocol version refers to the protocol used by the upgrade server to upgrade, and the specific format of the protocol version can be "letter + number", for example: V1.1, etc.
[0046] In one embodiment, after receiving the access request instruction, the upgrade server will reply the following content (i.e., the authentication reply result) to the terminal device:
[0047] "{"state":"{RESULT}","action":"authent","message":"{MESS AGE_INFO}","id":"{IMEI_NUM}","ticket":"{TICKET_NUM}"}";
[0048] Among them, (1) the {RESULT} field is the feedback access result (i.e., the access result information of the terminal device). In one embodiment, the {RESULT} field can be defined as "ok" or "error", where "ok" indicates that the terminal device access is successful, and "error" indicates that the terminal device access fails. The detailed information of the above access result is recorded in the {MESSAGE_INFO} field. It should be noted that the {MESSAGE_INFO} field is the specific content of the access result. For example, the {MESSAGE_INFO} field can record the "imei length error" information indicating the IMEI number length error. (2) {TICKET_NUM} is a randomly generated ticket value (randomly generated verification information). In one embodiment, the ticket can be a 6-bit number from 0 to 9.
[0049] Step S204, parsing the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes the access result information of the terminal device and the randomly generated verification information.
[0050] Specifically, the terminal device parses the received authentication reply result and obtains the corresponding access result information and the randomly generated verification information. Since the data structure of the authentication reply result, the meaning of the access result information representation, the meaning of the randomly generated verification information representation, and the definable form have been described in detail in the above embodiment, the embodiment of the present application will not be described in detail here.
[0051] Step S206: Based on the access result information obtained through analysis, when it is confirmed that the access request is successful, a first token is generated based on the verification information.
[0052] Specifically, based on the access result information fed back by the upgrade server, when the terminal device determines that it has successfully accessed the upgrade server, it will generate a first token through an information digest algorithm, given the known identification number of the terminal device, a preset specific character string, and verification information. It should be noted that the above-mentioned specific character string is determined in advance by the manufacturers of the terminal device and the upgrade server, and the character string does not pass through the network. Therefore, illegal visitors will not be able to obtain the character string through network monitoring and other means. The randomly generated verification information also ensures that even for the same device, the corresponding token generated each time it is upgraded is different. In addition, the use of the information digest algorithm can also ensure that the token cannot be reversed. In this way, it is ensured that illegal visitors cannot disguise themselves as terminal devices and request the upgrade server to obtain upgrade data packets, further improving the security of device upgrades.
[0053] In one embodiment, the message digest algorithm may be an MD5 (Message-Digest Algorithm, a widely used cryptographic hash function) algorithm. In one embodiment, the terminal device will calculate the terminal device identification number, a preset specific string, and verification information through the MD5 algorithm to obtain a corresponding token field. The token field is a string of characters generated by the terminal device as a token for the client to make a request. The use of the token field can also reduce the pressure on the device, reduce frequent queries to the database, and make the device more robust.
[0054] Step S208, obtain device information, and transmit the first token and device information to the upgrade server, so that the upgrade server can query the upgrade data package based on the device information when it determines that the terminal device has download permission based on the received first token, and when the query is successful, feedback the corresponding upgrade data package download information to the terminal device.
[0055] Specifically, after acquiring the device information, the terminal device transmits the first token and the device information to the upgrade server through a designated transmission interface.
[0056] In one embodiment, the transmission interface is defined as follows:
[0057] "https: / / ip:port / fota / api / check?id={IMEI_NUM}&version={VERS 0ION_NUM}&company={COMPANY}&token={MD5_TOKEN}&prod uct_name={PRODUCT_NAME}&product_version={PRODUCT_VERS ION}, method=GET";
[0058] Among them, {COMPANY} is the manufacturer of the device; {PRODUCT_NAME} is the name of the device project to which the terminal device belongs; {PRODUCT_VERSION} is the device information including the version number of the old program running in the terminal device before the device is upgraded; {MD5_TOKEN} is the verification value obtained by verifying the ticket field based on the MD5 algorithm.
[0059] Specifically, the upgrade server generates a second token based on the same method (e.g., based on an information digest algorithm) when the terminal device identification number and a specific character string agreed upon in advance with the terminal device are known, and compares the received first token with the second token to determine whether the terminal device has download permission. If the upgrade server determines that the terminal device has access rights, it will query the upgrade data package based on the received device information, and if the query is successful, it will transmit the relevant download information of the upgrade data package (e.g., download address, version number) to the terminal device.
[0060] Step S210: receiving the upgrade data package download information fed back by the upgrade server, and performing device upgrade according to the upgrade data package download information.
[0061] Specifically, the terminal device, based on the received upgrade data package download information, determines the download address corresponding to the upgrade data package, accesses the download address, and downloads the upgrade data package from the accessed resources. Subsequently, when the terminal device determines that the upgrade data package is downloaded successfully, it will perform device upgrade based on the downloaded upgrade data package.
[0062] In one embodiment, the terminal device can use the HTTPS (Hyper Text Transfer Protocol over Secure Socket Layer) protocol to access the download address of the upgrade data package, and determine to download the upgrade data package if the access is successful. Of course, in the current embodiment, the terminal device can also use other communication protocols to access the download address of the upgrade data package, such as the FTP (File Transfer Protocol) protocol, etc. The embodiment of the present application does not limit which communication protocol the terminal device uses to access the download address of the upgrade data package.
[0063] In the above terminal device upgrade method, the terminal device sends an access request instruction to the upgrade server, and receives an authentication reply result fed back by the upgrade server based on the access request instruction. The authentication reply result includes access result information and verification information. After that, the terminal device determines based on the access result information that when confirming that the request access is successful, it generates a corresponding first token based on the parsed verification information to obtain the corresponding upgrade data packet through the first token. Among them, the terminal device will only interact with the upgrade server after successfully accessing the upgrade server, which can ensure the security of the interactive identity between the upgrade server and the terminal device, and also avoid the access of illegal visitors, and can ensure the security of the upgrade process. In addition, since the verification information is randomly generated, this operation can also indirectly ensure the variability of the token, so that even if an illegal visitor can steal a token of a certain upgrade stage, he cannot forge a terminal device based on the token, and then request an upgrade data packet from the upgrade server. In addition, before feeding back the upgrade data packet download information to the terminal device, the upgrade server will also determine the download authority of the terminal device based on the received token to avoid the loss of resources caused by feeding back the upgrade data packet download information to the unauthorized device, and further ensure the security of the device upgrade.
[0064] In one embodiment, a first token is generated based on verification information, including: obtaining an identification number of a terminal device and a preset specific string; the specific string is determined in advance through negotiation between the terminal device and an upgrade server; and the identification number of the terminal device, the specific string and the verification information are calculated through an information digest algorithm to generate the first token.
[0065] Specifically, first, the terminal device obtains its own identification number and determines a preset specific string. The preset specific string is negotiated and determined in advance by the terminal device and the upgrade server, and the specific string does not pass through the network. Therefore, illegal visitors (for example, hackers) will not be able to monitor the specific string through illegal means such as network monitoring. After that, the terminal device verifies the obtained terminal device identification number, specific string and ticket field through an information digest algorithm (for example, MD5 algorithm) to obtain the corresponding token field (that is, generate the first token).
[0066] In the above embodiment, the token field is jointly determined by the identification number of the terminal device, a specific string, and a ticket randomly generated by the server. Among them, the specific string is negotiated and determined in advance by the terminal device and the upgrade server, and does not pass through the network. Therefore, illegal visitors cannot obtain it through network monitoring and other means; and the randomly generated ticket ensures that even if it is the same device, the token field is different each time it is upgraded, and the use of the information digest algorithm further ensures that the token field cannot be reversed, so that illegal visitors cannot disguise themselves as terminal devices to request the upgrade server to obtain the upgrade data packet, ensuring the security of the upgrade process.
[0067] In one embodiment, when the upgrade server determines that the terminal device has download permission based on the received first token, the upgrade server queries the upgrade data package based on the device information, including: the upgrade server compares the received first token with a second token determined based on the authentication reply result fed back to the terminal device in advance to obtain a corresponding comparison result; when the upgrade server determines that the terminal device has download permission based on the comparison result, the upgrade server queries the upgrade data package through a background query method based on the received device information; the device information includes at least one of the version number of the old program running in the terminal device before the device is upgraded, the name of the device project to which the terminal device belongs, and the manufacturer of the terminal device.
[0068] Specifically, when the upgrade server knows the identification number of the terminal device, the preset specific character string, and the ticket field (i.e., verification information) randomly generated by itself, it will calculate the above information based on the same verification method, i.e., based on the information summary algorithm, to generate a corresponding second token. Afterwards, after receiving the first token, the first token is compared with the generated second token. Based on the comparison result, when it is determined that the first token matches the second token, the upgrade data packet is queried based on the received device information. In one embodiment, the upgrade server can use a background query method to query the upgrade data packet. Of course, other query methods can also be used, such as a database query method, etc., which is not limited to the embodiments of the present application.
[0069] In one embodiment, the version number of the old program is the version that the device is running before the upgrade, such as "N311-001". The device project name to which the terminal device belongs includes but is not limited to the NWY_N311 project, etc., which is not limited in the embodiment of the present application. The upgrade server can store the upgrade data package in the database in advance in the form of {upgrade data package, device information}, and when it is determined that the terminal device has the download permission, the upgrade data package is queried from the various upgrade data pre-stored in the database using the device information as the query condition.
[0070] In the above embodiment, the upgrade server determines whether the terminal device has access rights based on token comparison, thereby preventing illegal visitors from disguising themselves as terminal devices and requesting upgrade data packets from the upgrade server, thereby ensuring the security of device upgrades.
[0071] In one embodiment, the upgrade server feeds back corresponding upgrade data packet download information to the terminal device when the query is successful, including: the upgrade server determines the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet when the corresponding upgrade data packet is queried through the background query method; the upgrade server uses the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet as the upgrade data packet download information, and feeds back the upgrade data packet download information to the terminal device.
[0072] Specifically, based on the received first token, the upgrade server will query the upgrade data package through a background query method using the device information as a search condition when it is determined that the terminal device has access rights, and when it is determined that the query is successful, the download address of the determined upgrade data package, the version number of the upgrade data package, and the token of the upgrade data package will be integrated, and the integrated upgrade data package download information will be fed back to the terminal device through the corresponding transmission interface. When it is determined that the query fails, the upgrade server will feed back information that the upgrade request has failed to the terminal device.
[0073] In one embodiment, when the upgrade server determines that the upgrade data packet search is successful, the feedback information is as follows:
[0074] "{"state":"ok","action":"check","message":"{MESSAGE_INF O}","update":true,"product_version":"{PRODUCT_VERSION}","company":"{COMPANY}","file_md5":"{FILE_MD5}","content" :"{CONTENT}","current_version":"{PRODUCT_VERSION}","date":"{DATA_TIME}","url":"{FILE_URL}","id":"{IMEI_NUM}"}";
[0075] in:
[0076] (1) “state” defines the access result of the terminal device. For example, when the content defined in “state” is “ok”, it is considered that the terminal device access is successful; when the content defined in “state” is “error”, it is considered that the terminal device access fails.
[0077] (2) "Action" defines the type of action currently executed by the upgrade service. For example, when its definition is "check", it is considered that the action type executed by the upgrade server is a query type; when its definition is "authent", it is considered that the action type executed by the upgrade server is an identity authentication type.
[0078] (3) "message" defines the detailed information of the returned result. For example, it can be "post paramerror": indicating that the request parameters transmitted are incorrect, etc.
[0079] (4) "update" defines the query result of the upgrade data package. For example, when its definition content is "true", it can be considered that the upgrade data package has been successfully queried. When its definition content is "false", it can be considered that the upgrade data package has not been queried.
[0080] (5) “Company” defines the manufacturer of the terminal equipment.
[0081] (6) “file_md5” defines the token of the upgrade data package.
[0082] (7) "Content" defines the description of the upgrade data package. For example, it can be a description of the upgrade data package. It is an optional part and the content defined therein may be empty.
[0083] (8) “current_version” defines the version number of the upgrade data package. For example, the version number of the upgrade data package defined is “N311-002”.
[0084] (9) “date” defines the time point when the upgrade server stores the corresponding upgrade data package.
[0085] "url" defines the download address of the upgrade data package. "id" defines XXX.
[0086] In one embodiment, receiving upgrade data packet download information fed back by an upgrade server and performing a device upgrade according to the upgrade data packet download information includes: receiving the upgrade data packet download information and parsing the upgrade data packet download information to determine a download address of the upgrade data packet; accessing the download address of the upgrade data packet based on a preset secure communication protocol, and downloading a real-time upgrade data packet from the currently accessed address when it is determined that the address access is successful; upgrading the old program based on the downloaded real-time upgrade data packet, and starting the corresponding upgraded new program when it is determined that the upgrade of the old device is complete.
[0087] Specifically, after receiving the upgrade data packet download information, the terminal device will parse it to obtain the download address of the upgrade data packet. After that, the download address of the upgrade data packet is accessed through a preset secure communication protocol, and the upgrade data packet is downloaded from the accessed address to obtain the corresponding real-time upgrade data packet. After that, the terminal device will upgrade the device based on the downloaded real-time upgrade data packet, and when it is determined that the device upgrade is successful, the new program is started through the preset boot loader, and the startup status of the new program is used to determine whether the device is successfully upgraded.
[0088] In one embodiment, the boot loader may be a bootloader. It should be noted that in an embedded operating system, the boot loader is run before the operating system kernel runs. It can initialize hardware devices and establish a memory space mapping map, thereby bringing the system's software and hardware environment to a suitable state, so as to prepare the correct environment for the final call to the operating system kernel. The preset secure communication protocol may be the HTTPS protocol, the FTPS protocol, etc., which is not limited in the embodiments of the present application.
[0089] In the above embodiment, when sending the upgrade data packet, a secure communication protocol is used. Therefore, even if a hacker obtains the download address of the upgrade data packet during the transmission of the upgrade data packet download information, the hacker cannot parse it, thereby optimizing the security of the upgrade data packet download process and ensuring the security of the entire communication process.
[0090] In one embodiment, before performing an upgrade step of an old program based on a downloaded real-time upgrade data packet, the method includes: parsing the upgrade data packet download information to determine the version number of the upgrade data packet and the token of the upgrade data packet; backing up and storing the parsed version number of the upgrade data packet, the token of the upgrade data packet, and the old program already running in the terminal device through a preset storage partition; determining the token of the real-time upgrade data packet, and comparing the token of the real-time upgrade data packet with the first data of the same type stored in the corresponding storage partition to obtain a corresponding first comparison result.
[0091] For details, please refer to Figure 3 Before upgrading the device, the terminal device will also use the preset storage partition to immediately store the version number of the parsed upgrade data packet, the token of the upgrade data packet, and the old program already running in the terminal device. In this way, when data (such as the version number of the upgrade data packet) needs to be compared later, and when the old program needs to be restored, the corresponding data can be directly retrieved from the storage partition, avoiding the problem that the device cannot work properly when the new program fails to start due to the failure to back up the old program. In addition, the real-time upgrade data packet can be verified based on the pre-stored version number and token of the upgrade data packet. In this way, the upgrade data packet can be prevented from being replaced during the download process, and the wrong upgrade data packet can be upgraded due to human operation errors, which can cause the device to fail to work properly.
[0092] In one embodiment, please refer to Figure 4 , based on the downloaded real-time upgrade data package, upgrading the old program, and, when it is determined that the upgrade of the old device is completed, starting the corresponding upgraded new program, including:
[0093] Step S402: based on the first comparison result, when it is determined that the token of the real-time upgrade data packet matches the first data of the same type, the old program is upgraded based on the downloaded real-time upgrade data packet.
[0094] Specifically, when the terminal device determines that the token of the real-time upgrade data packet matches the corresponding first data of the same type pre-stored in the storage partition, it will upgrade the program based on the downloaded upgrade data packet, and then determine whether the device has been successfully upgraded based on the startup status of the new program obtained by the corresponding upgrade.
[0095] Step S404, when it is determined that the old device upgrade is completed, the corresponding upgraded new program is started through the preset boot loader, and when it is determined that the new program fails to start, the corresponding backed up old program is retrieved from the storage partition and the old program is restored.
[0096] Specifically, the terminal device starts the new program through a preset boot loader, for example, a bootloader, and through the startup status of the new program, when it is determined that the startup of the new program fails, the corresponding old program is retrieved from the storage partition and the old program is restored. In one embodiment, when the terminal device determines that the new program fails, when it is determined that the upgrade server and the application server can be successfully accessed (it should be noted that the upgrade server and the application server can be two independent servers or two services of one server), the instantly generated upgrade failure information is fed back to the application server and the upgrade server, so that the above two servers can immediately take corresponding countermeasures for the current device upgrade failure status.
[0097] Step S406, when it is determined that the new program is started successfully, the version number of the corresponding upgraded new program is determined, and the version number of the new program is compared with the corresponding second data of the same type stored in the storage partition. Based on the second comparison result obtained, when the version number of the new program matches the second data of the same type, it is determined that the terminal device has been upgraded successfully.
[0098] Specifically, when the terminal device determines that the new program has been successfully started, it will verify the validity of the version number of the new program to prevent the upgrade data package in the download process from being illegally replaced without knowing it, and to prevent the wrong upgrade data package from being upgraded due to human operating errors, causing the device to fail to work properly.
[0099] In the above embodiment, when the device is upgraded, the old program is backed up and the token of the downloaded upgrade data packet is verified. After the upgrade is completed, the version number of the new program is also verified, thereby preventing the upgrade data packet in the download process from being illegally replaced without knowing it, thereby ensuring the security of the device upgrade.
[0100] It should be understood that although Figure 2-4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-4 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0101] In one embodiment, Figure 5 As shown, a terminal device upgrade apparatus 500 is provided, comprising: a request initiation module 501, a parsing module 502, a verification processing module 503, an information transmission module 504 and a device upgrade module 505, wherein:
[0102] The request initiating module 501 is used to send an access request instruction to the upgrade server, and receive an authentication reply result fed back by the upgrade server based on the access request instruction.
[0103] The parsing module 502 is used to parse the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes the access result information of the terminal device and the randomly generated verification information.
[0104] The verification processing module 503 is used to generate a first token based on the verification information when confirming that the access request is successful based on the access result information obtained by parsing.
[0105] The information transmission module 504 is used to obtain device information and transmit the first token and the device information to the upgrade server, so that the upgrade server can query the upgrade data package based on the device information when it determines that the terminal device has download permission based on the received first token, and when the query is successful, feedback the corresponding upgrade data package download information to the terminal device.
[0106] The device upgrade module 505 is used to receive the upgrade data package download information fed back by the upgrade server, and perform device upgrade according to the upgrade data package download information.
[0107] In one embodiment, the verification processing module 503 is also used to obtain the identification number of the terminal device and a preset specific character string; the specific character string is pre-negotiated and determined by the terminal device and the upgrade server; the identification number of the terminal device, the specific character string and the verification information are calculated through the information summary algorithm to generate a first token.
[0108] In one embodiment, the information transmission module 504 is also used for the upgrade server to compare the received first token with the second token determined based on the authentication reply result fed back to the terminal device in advance to obtain a corresponding comparison result; based on the comparison result, when the upgrade server determines that the terminal device has download authority, the upgrade server queries the upgrade data packet through a background query method based on the received device information; the device information includes at least one of the version number of the old program running in the terminal device before the device is upgraded, the name of the device project to which the terminal device belongs, and the manufacturer of the terminal device.
[0109] In one of the embodiments, the information transmission module 504 is also used for the upgrade server to determine the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet when the upgrade server queries the corresponding upgrade data packet through the background query method; the upgrade server uses the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet as the upgrade data packet download information, and feeds back the upgrade data packet download information to the terminal device.
[0110] In one embodiment, the device upgrade module 505 is also used to receive upgrade data packet download information and parse the upgrade data packet download information to determine the download address of the upgrade data packet; based on a preset secure communication protocol, access the download address of the upgrade data packet, and when it is determined that the address access is successful, download the real-time upgrade data packet from the currently accessed address; based on the downloaded real-time upgrade data packet, upgrade the old program, and, when it is determined that the upgrade of the old device is complete, start the corresponding upgraded new program.
[0111] In one embodiment, the device upgrade module 505 is also used to parse the upgrade data packet download information to determine the version number of the upgrade data packet and the token of the upgrade data packet; back up and store the parsed version number of the upgrade data packet, the token of the upgrade data packet, and the old program running in the terminal device through a preset storage partition; determine the token of the real-time upgrade data packet, and compare the token of the real-time upgrade data packet with the first data of the same type stored in the corresponding storage partition to obtain a corresponding first comparison result.
[0112] In one of the embodiments, the device upgrade module 505 is also used to upgrade the old program based on the downloaded real-time upgrade data packet when it is determined that the token of the real-time upgrade data packet matches the first data of the same type based on the first comparison result obtained; when it is determined that the upgrade of the old device is completed, the corresponding upgraded new program is started through a preset boot loader, and when it is determined that the startup of the new program fails, the corresponding backed-up old program is retrieved from the storage partition and the old program is restored; when it is determined that the startup of the new program is successful, the version number of the corresponding upgraded new program is determined, and the version number of the new program is compared with the corresponding second data of the same type stored in the storage partition, and based on the second comparison result obtained, when the version number of the new program matches the second data of the same type, it is determined that the terminal device upgrade is successful.
[0113] In the above terminal device upgrade device, the terminal device sends an access request instruction to the upgrade server, and receives the authentication reply result fed back by the upgrade server based on the access request instruction. The authentication reply result includes access result information and verification information. After that, the terminal device determines based on the access result information that when the request access is confirmed to be successful, it generates a corresponding first token based on the parsed verification information to obtain the corresponding upgrade data packet through the first token. Among them, the terminal device will only interact with the upgrade server after successfully accessing the upgrade server, which can ensure the security of the interactive identity between the upgrade server and the terminal device, and also avoid the access of illegal visitors, and can ensure the security of the upgrade process. In addition, since the verification information is randomly generated, this operation can also indirectly ensure the variability of the token, so that even if an illegal visitor can steal a token of a certain upgrade stage, he cannot forge a terminal device based on the token, and then request an upgrade data packet from the upgrade server. In addition, before the upgrade server feeds back the upgrade data packet download information to the terminal device, it will also determine the download authority of the terminal device based on the received token to avoid the loss of resources caused by feeding back the upgrade data packet download information to the unauthorized device, and further ensure the security of the device upgrade.
[0114] For the specific definition of the terminal device upgrade device, please refer to the definition of the terminal device upgrade method above, which will not be repeated here. Each module in the above terminal device upgrade device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0115] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a terminal device upgrade method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0116] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0117] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: sending an access request instruction to an upgrade server, and receiving an authentication reply result fed back by the upgrade server based on the access request instruction; parsing the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes access result information of the terminal device and randomly generated verification information; based on the access result information obtained by parsing, when confirming that the requested access is successful, generating a first token based on the verification information; acquiring device information, and transmitting the first token and device information to the upgrade server, so that the upgrade server, based on the received first token, queries the upgrade data package based on the device information when determining that the terminal device has download authority, and when the query is successful, feeds back the corresponding upgrade data package download information to the terminal device; receiving the upgrade data package download information fed back by the upgrade server, and performing device upgrade according to the upgrade data package download information.
[0118] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the identification number of the terminal device and a preset specific character string; the specific character string is pre-negotiated and determined by the terminal device and the upgrade server; and the identification number, specific character string and verification information of the terminal device are calculated through an information summary algorithm to generate a first token.
[0119] In one embodiment, the processor also implements the following steps when executing the computer program: the upgrade server compares the received first token with the second token determined in advance based on the authentication reply result fed back to the terminal device to obtain a corresponding comparison result; the upgrade server, based on the comparison result, when determining that the terminal device has download authority, queries the upgrade data packet through a background query method based on the received device information; the device information includes at least one of the version number of the old program running in the terminal device before the device is upgraded, the name of the device project to which the terminal device belongs, and the manufacturer of the terminal device.
[0120] In one embodiment, the processor also implements the following steps when executing the computer program: when the upgrade server queries the corresponding upgrade data packet through the background query method, it determines the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet; the upgrade server uses the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet as the upgrade data packet download information, and feeds back the upgrade data packet download information to the terminal device.
[0121] In one embodiment, the processor further implements the following steps when executing the computer program: receiving upgrade data packet download information, and parsing the upgrade data packet download information to determine the download address of the upgrade data packet; based on a preset secure communication protocol, accessing the download address of the upgrade data packet, and when it is determined that the address access is successful, downloading the real-time upgrade data packet from the currently accessed address; upgrading the old program based on the downloaded real-time upgrade data packet, and, when it is determined that the upgrade of the old device is complete, starting the corresponding upgraded new program.
[0122] In one embodiment, the processor also implements the following steps when executing the computer program: parsing the upgrade data packet download information to determine the version number of the upgrade data packet and the token of the upgrade data packet; backing up and storing the parsed version number of the upgrade data packet, the token of the upgrade data packet, and the old program running in the terminal device through a preset storage partition; determining the token of the real-time upgrade data packet, and comparing the token of the real-time upgrade data packet with the first data of the same type stored in the corresponding storage partition to obtain a corresponding first comparison result.
[0123] In one embodiment, the processor also implements the following steps when executing the computer program: based on the first comparison result obtained, when it is determined that the token of the real-time upgrade data packet matches the first data of the same type, the old program is upgraded based on the downloaded real-time upgrade data packet; when it is determined that the upgrade of the old device is completed, the corresponding upgraded new program is started through a preset boot loader, and when it is determined that the startup of the new program fails, the corresponding backed-up old program is retrieved from the storage partition and the old program is restored; when it is determined that the startup of the new program is successful, the version number of the corresponding upgraded new program is determined, and the version number of the new program is compared with the corresponding second data of the same type stored in the storage partition, and based on the second comparison result obtained, when the version number of the new program matches the second data of the same type, it is determined that the terminal device upgrade is successful.
[0124] In the above-mentioned computer device, the terminal device sends an access request instruction to the upgrade server, and receives the authentication reply result fed back by the upgrade server based on the access request instruction. The authentication reply result includes access result information and verification information. Afterwards, the terminal device determines based on the access result information that when the access request is confirmed to be successful, it generates a corresponding first token based on the verification information obtained by parsing, so as to obtain the corresponding upgrade data packet through the first token. Among them, the terminal device will only interact with the upgrade server after successfully accessing the upgrade server, which can ensure the security of the interactive identity between the upgrade server and the terminal device, and also avoid the access of illegal visitors, and can ensure the security of the upgrade process. In addition, since the verification information is randomly generated, this operation can also indirectly ensure the variability of the token, so that even if an illegal visitor can steal a token of a certain upgrade stage, he cannot forge a terminal device based on the token, and then request an upgrade data packet from the upgrade server. In addition, before the upgrade server feeds back the upgrade data packet download information to the terminal device, it will also determine the download authority of the terminal device based on the received token to avoid the loss of resources caused by feeding back the upgrade data packet download information to the unauthorized device, and further ensure the security of the device upgrade.
[0125] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program implements the following steps when executed by a processor: sending an access request instruction to an upgrade server, and receiving an authentication reply result fed back by the upgrade server based on the access request instruction; parsing the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes access result information of the terminal device and randomly generated verification information; based on the access result information obtained by parsing, when confirming that the access request is successful, generating a first token based on the verification information; obtaining device information, and transmitting the first token and the device information to the upgrade server, so that the upgrade server, based on the received first token, queries the upgrade data package based on the device information when determining that the terminal device has download authority, and when the query is successful, feeds back the corresponding upgrade data package download information to the terminal device; receiving the upgrade data package download information fed back by the upgrade server, and performing device upgrade according to the upgrade data package download information.
[0126] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the identification number of the terminal device and a preset specific character string; the specific character string is pre-negotiated and determined by the terminal device and the upgrade server; and the identification number of the terminal device, the specific character string and the verification information are calculated through an information digest algorithm to generate a first token.
[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the upgrade server compares the received first token with the second token determined in advance based on the authentication reply result fed back to the terminal device to obtain a corresponding comparison result; based on the comparison result, when the upgrade server determines that the terminal device has download authority, the upgrade server queries the upgrade data packet through a background query method based on the received device information; the device information includes at least one of the version number of the old program running in the terminal device before the device is upgraded, the name of the device project to which the terminal device belongs, and the manufacturer of the terminal device.
[0128] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the upgrade server queries the corresponding upgrade data packet through the background query method, it determines the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet; the upgrade server uses the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet as the upgrade data packet download information, and feeds back the upgrade data packet download information to the terminal device.
[0129] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: receiving upgrade data packet download information, and parsing the upgrade data packet download information to determine the download address of the upgrade data packet; based on a preset secure communication protocol, accessing the download address of the upgrade data packet, and when it is determined that the address access is successful, downloading the real-time upgrade data packet from the currently accessed address; upgrading the old program based on the downloaded real-time upgrade data packet, and, when it is determined that the upgrade of the old device is complete, starting the corresponding upgraded new program.
[0130] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: parsing the upgrade data packet download information to determine the version number of the upgrade data packet and the token of the upgrade data packet; backing up and storing the parsed version number of the upgrade data packet, the token of the upgrade data packet, and the old program running in the terminal device through a preset storage partition; determining the token of the real-time upgrade data packet, and comparing the token of the real-time upgrade data packet with the first data of the same type stored in the storage partition to obtain a corresponding first comparison result.
[0131] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the first comparison result obtained, when it is determined that the token of the real-time upgrade data packet matches the first data of the same type, the old program is upgraded based on the downloaded real-time upgrade data packet; when it is determined that the upgrade of the old device is completed, the corresponding upgraded new program is started through a preset boot loader, and when it is determined that the startup of the new program fails, the corresponding backed-up old program is retrieved from the storage partition and the old program is restored; when it is determined that the startup of the new program is successful, the version number of the corresponding upgraded new program is determined, and the version number of the new program is compared with the corresponding second data of the same type stored in the storage partition, and based on the second comparison result obtained, when the version number of the new program matches the second data of the same type, it is determined that the terminal device upgrade is successful.
[0132] In the above storage medium, the terminal device sends an access request instruction to the upgrade server, and receives the authentication reply result fed back by the upgrade server based on the access request instruction. The authentication reply result includes access result information and verification information. After that, the terminal device determines based on the access result information that when the access request is confirmed to be successful, it generates a corresponding first token based on the parsed verification information to obtain the corresponding upgrade data packet through the first token. Among them, the terminal device will only interact with the upgrade server after successfully accessing the upgrade server, which can ensure the security of the interactive identity between the upgrade server and the terminal device, and also avoid the access of illegal visitors, and can ensure the security of the upgrade process. In addition, since the verification information is randomly generated, this operation can also indirectly ensure the variability of the token, so that even if an illegal visitor can steal a token of a certain upgrade stage, he cannot forge a terminal device based on the token, and then request an upgrade data packet from the upgrade server. In addition, before the upgrade server feeds back the upgrade data packet download information to the terminal device, it will also determine the download authority of the terminal device based on the received token to avoid the loss of resources caused by feeding back the upgrade data packet download information to the unauthorized device, and further ensure the security of the device upgrade.
[0133] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0134] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0135] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A terminal device upgrade method, characterized in that: The method is applied to a terminal device and comprises the following steps: Sending an access request instruction to the upgrade server, and receiving an authentication reply result fed back by the upgrade server based on the access request instruction; Parsing the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes access result information of the terminal device and randomly generated verification information; Based on the access result information obtained by parsing, when confirming that the access request is successful, a first token is generated based on the verification information, and the first token generated each time the same terminal device is upgraded is different; Acquire device information, and transmit the first token and the device information to the upgrade server, so that the upgrade server, based on the received first token, queries the upgrade data package based on the device information when determining that the terminal device has download authority, and feeds back corresponding upgrade data package download information to the terminal device when the query is successful; Receiving the upgrade data package download information, and parsing the upgrade data package download information to determine the download address of the upgrade data package; Based on a preset secure communication protocol, access the download address of the upgrade data packet, and when it is determined that the address access is successful, download the real-time upgrade data packet from the currently accessed address; Parsing the upgrade data packet download information to determine the version number of the upgrade data packet and the token of the upgrade data packet; backing up and storing the parsed version number of the upgrade data packet, the token of the upgrade data packet, and the old program already running in the terminal device through a preset storage partition; determining the token of the real-time upgrade data packet, and comparing the token of the real-time upgrade data packet with the first data of the same type stored in the storage partition to obtain a corresponding first comparison result; Based on the first comparison result obtained, when it is determined that the token of the real-time upgrade data packet matches the first data of the same type, the old program is upgraded based on the downloaded real-time upgrade data packet; when it is determined that the upgrade of the old device is completed, the corresponding upgraded new program is started through the preset boot loader, and when it is determined that the startup of the new program fails, the corresponding backed-up old program is retrieved from the storage partition and the old program is restored; when it is determined that the startup of the new program is successful, the version number of the corresponding upgraded new program is determined, and the version number of the new program is compared with the corresponding second data of the same type stored in the storage partition, and based on the second comparison result obtained, when the version number of the new program matches the second data of the same type, it is determined that the terminal device upgrade is successful.
2. The method according to claim 1, characterized in that The step of querying the upgrade data package based on the device information when the upgrade server determines, according to the received first token, that the terminal device has the download authority comprises: The upgrade server compares the received first token with a second token determined in advance based on an authentication reply result fed back to the terminal device to obtain a corresponding comparison result; Based on the comparison result, when the upgrade server determines that the terminal device has download permission, it queries the upgrade data package through a background query method based on the received device information; the device information includes at least one of the version number of the old program running in the terminal device before the device is upgraded, the name of the device project to which the terminal device belongs, and the manufacturer of the terminal device.
3. The method according to claim 2, characterized in that The step of feeding back corresponding upgrade data package download information to the terminal device by the upgrade server when the query is successful includes: When the upgrade server finds the corresponding upgrade data package through a background query method, it determines the download address of the upgrade data package, the version number of the upgrade data package, and the token of the upgrade data package; The upgrade server uses the download address of the upgrade data package, the version number of the upgrade data package, and the token of the upgrade data package as upgrade data package download information, and feeds back the upgrade data package download information to the terminal device.
4. The method according to claim 1, characterized in that: The generating a first token based on the verification information comprises: Acquire an identification number of the terminal device and a preset specific character string; the specific character string is determined in advance through negotiation between the terminal device and the upgrade server; The identification number of the terminal device, the specific character string and the verification information are calculated by using an information digest algorithm to generate a first token.
5. A terminal equipment upgrade device, characterized in that: The device comprises: A request initiation module, configured to send an access request instruction to an upgrade server, and receive an authentication reply result fed back by the upgrade server based on the access request instruction; A parsing module, used to parse the authentication reply result to obtain corresponding identity authentication information; the identity authentication information includes access result information of the terminal device and randomly generated verification information; A verification processing module, configured to obtain, based on the access result information obtained by parsing, an identification number of the terminal device and a preset specific character string when confirming that the access request is successful; the specific character string is pre-negotiated and determined by the terminal device and the upgrade server; and to calculate the identification number of the terminal device, the specific character string and the verification information through an information digest algorithm to generate a first token, wherein the first token generated for the same terminal device each time it is upgraded is different; an information transmission module, configured to obtain device information, and transmit the first token and the device information to the upgrade server, so that the upgrade server can query the upgrade data package based on the device information when determining that the terminal device has the download authority according to the received first token, and when the query is successful, feedback the corresponding upgrade data package download information to the terminal device; The device upgrade module is used to receive the upgrade data packet download information and parse the upgrade data packet download information to determine the download address of the upgrade data packet; based on a preset secure communication protocol, access the download address of the upgrade data packet, and when it is determined that the address access is successful, download the real-time upgrade data packet from the currently accessed address; parse the upgrade data packet download information to determine the version number of the upgrade data packet and the token of the upgrade data packet; back up and store the parsed version number of the upgrade data packet, the token of the upgrade data packet, and the old program running in the terminal device through a preset storage partition; determine the token of the real-time upgrade data packet, and compare the token of the real-time upgrade data packet with the first data of the same type stored in the storage partition. Obtain a corresponding first comparison result; based on the obtained first comparison result, when it is determined that the token of the real-time upgrade data packet matches the first data of the same type, upgrade the old program based on the downloaded real-time upgrade data packet; when it is determined that the upgrade of the old device is completed, start the corresponding upgraded new program through a preset boot loader, and when it is determined that the startup of the new program fails, retrieve the corresponding backed-up old program from the storage partition and restore the old program; when it is determined that the startup of the new program is successful, determine the version number of the corresponding upgraded new program, and compare the version number of the new program with the corresponding second data of the same type stored in the storage partition, and based on the obtained second comparison result, when the version number of the new program matches the second data of the same type, determine that the terminal device upgrade is successful.
6. The device according to claim 5, characterized in that The information transmission module is also used for: The upgrade server compares the received first token with a second token determined in advance based on an authentication reply result fed back to the terminal device to obtain a corresponding comparison result; Based on the comparison result, when the upgrade server determines that the terminal device has download permission, it queries the upgrade data package through a background query method based on the received device information; the device information includes at least one of the version number of the old program running in the terminal device before the device is upgraded, the name of the device project to which the terminal device belongs, and the manufacturer of the terminal device.
7. The device according to claim 6, characterized in that The information transmission module is further used to determine the download address of the upgrade data packet, the version number of the upgrade data packet, and the token of the upgrade data packet when the upgrade server queries the corresponding upgrade data packet through the background query method; The upgrade server uses the download address of the upgrade data package, the version number of the upgrade data package, and the token of the upgrade data package as upgrade data package download information, and feeds back the upgrade data package download information to the terminal device.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Identity authentication method based on single sign on
CN103685282A
Identity authentication method and device
CN103905401A
OTA upgrade method, device and system
CN105933150A