WO2021097611A1 - 刷机方法及相关装置 - Google Patents

刷机方法及相关装置 Download PDF

Info

Publication number
WO2021097611A1
WO2021097611A1 PCT/CN2019/119184 CN2019119184W WO2021097611A1 WO 2021097611 A1 WO2021097611 A1 WO 2021097611A1 CN 2019119184 W CN2019119184 W CN 2019119184W WO 2021097611 A1 WO2021097611 A1 WO 2021097611A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
flashing
terminal device
hash value
message digest
Prior art date
Application number
PCT/CN2019/119184
Other languages
English (en)
French (fr)
Inventor
郭明强
张志龙
尚玉栋
裴磊
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN201980100613.3A priority Critical patent/CN114424163A/zh
Priority to PCT/CN2019/119184 priority patent/WO2021097611A1/zh
Publication of WO2021097611A1 publication Critical patent/WO2021097611A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • This application relates to the field of computer technology, and in particular to a method of brushing and related devices.
  • the embodiments of the present application provide a flashing method and related devices, which are beneficial to improve the security and adaptability of the flashing of the terminal equipment.
  • an embodiment of the present application provides a method for flashing a phone, which is applied to a terminal device, and the method includes:
  • an embodiment of the present application provides a method for brushing, which is applied to an electronic device, and the method includes:
  • the terminal device Sending response information to the terminal device, where the response information includes a request for obtaining device information of the terminal device;
  • an embodiment of the present application provides a device for brushing, which is applied to a terminal device.
  • the device for brushing includes a processing unit and a communication unit, wherein:
  • the processing unit is configured to receive a digitally signed first form sent by an electronic device through the communication unit, where the first form includes at least one message digest; and digital signature information used to verify the first form; And for determining the version information of the flashing package according to the first form if the digital signature information of the first form is verified; and for determining whether the flashing package is a preset version according to the version information And, if so, perform a data verification operation to fully verify the flashing package; and for upgrading the firmware of the mobile terminal according to the verified flashing package.
  • the embodiments of the present application provide a flashing device, which is applied to electronic equipment, and the flashing device includes a processing unit and a communication unit, wherein:
  • the processing unit is configured to receive the flashing request information sent by the terminal device through the communication unit; and is configured to send response information to the terminal device through the communication unit, and the response information includes the device that obtains the terminal device.
  • Information request ; and for receiving the first device information sent by the terminal device through the communication unit; and for sending the first device information and the second device information to the server, and the second device refers to all The device information of the electronic device; and for receiving the authorization information sent by the server through the communication unit; and for judging whether the terminal meets the flashing condition based on the authorization information; and for using the The communication unit sends a flashing package to the terminal device.
  • an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured by the above Executed by a processor, and the foregoing program includes instructions for executing the steps in the first aspect and the second aspect of the embodiments of the present application.
  • an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute Some or all of the steps described in one aspect and the second aspect.
  • an embodiment of the present application provides a computer program product, wherein the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute as implemented in this application. Examples include part or all of the steps described in the first aspect and the second aspect.
  • the computer program product may be a software installation package.
  • the terminal device first receives the first form that is digitally signed from the electronic device.
  • the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; If the digital signature information of the form is verified, the version information of the flashing package is determined according to the first form; secondly, it is determined whether the flashing package is the firmware package of the preset version according to the version information; if so, the data verification operation is performed to fully verify the flashing machine Package; upgrade the firmware of the mobile terminal according to the verified flashing package.
  • the terminal device first verifies the digital signature of the form, which improves the security when flashing the phone; if the digital signature is verified, the terminal device further determines the version information of the flashing package, and when the version information is adapted, it is completely The flashing package avoids the situation that the firmware package gets wrong and the flashing version is wrong.
  • FIG. 1 is a schematic diagram of the system structure of a brushing method provided by an embodiment of the present application
  • FIG. 2A is a schematic flowchart of a method for flashing a device provided by an embodiment of the present application
  • 2B is a schematic diagram of a message summary table provided by an embodiment of the present application.
  • FIG. 3 is a schematic flow chart of another method for flashing a device provided by an embodiment of the present application.
  • FIG. 4 is a schematic flow chart of another method for flashing a device provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • Fig. 6 is a block diagram of the functional unit composition of a brushing device provided by an embodiment of the present application.
  • FIG. 1 is a schematic diagram of the system structure of a flashing method provided by an embodiment of the present application, in which the mobile terminal 101 is in communication connection with the electronic device 102, and the electronic device 102 is in communication connection with the server 103.
  • the mobile terminal 101 When the mobile terminal 101 detects a flashing instruction, the mobile terminal 101 first sends the flashing request information to the electronic device 102; after the electronic device 102 receives the flashing request information, it sends a response message to the mobile terminal 101, where the response information includes acquiring the mobile terminal 101’s device information request; after the mobile terminal 101 receives the response information, it sends the first device information of the mobile terminal 101 to the electronic device 102; after the electronic device 102 receives the first device information sent by the mobile terminal 101, it extracts the first device information of the local terminal. Second device information, and send both the first device information and the second device information to the server 103.
  • the server 103 determines whether the mobile terminal 101 and the electronic device 102 have the authority to flash the device according to the first device information and the second device information. In the case of having permission, the authorization information is sent to the electronic device 102, and the electronic device 102 sends a flashing package to the mobile terminal 101 in the case that the electronic device 102 determines that the mobile terminal has the flashing permission according to the authorization information.
  • the terminal devices, electronic devices, and servers involved in the embodiments of this application may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to wireless modems, as well as various forms User equipment (UE), mobile station (mobile station, MS), terminal device (terminal device) and so on.
  • UE User equipment
  • MS mobile station
  • terminal device terminal device
  • FIG. 2A is a schematic flowchart of a flashing method provided by an embodiment of the present application.
  • the flashing method described in this embodiment is applied to a terminal device.
  • the method may include the following steps:
  • Step 201 The terminal device receives the digitally signed first form sent by the electronic device.
  • the first table includes at least one message summary; it should be noted that the first table only includes the message summary corresponding to some or all of the flashing commands in the flashing package.
  • the message digest is generated by calculating the hash value according to the flashing command in the flashing package. .
  • Step 202 The terminal device verifies the digital signature information of the first form.
  • the terminal device has a built-in flash verification tool built-in at the factory.
  • the built-in flash verification tool is signed by the manufacturer and cannot be changed; the digital signature information in the first form is also signed by the manufacturer; the first form is verified by the built-in flash verification tool.
  • the digital signature information of one form can determine whether the flashing package corresponding to the first form is a genuine flashing package.
  • Step 203 If the digital signature information of the first form passes the verification, the terminal device determines the version information of the flashing package according to the first form.
  • Step 204 The terminal device judges whether the flashing package is the firmware of the preset version according to the version information.
  • Step 205 If yes, the terminal device performs a data verification operation to completely verify the flashing package.
  • Step 206 The terminal device upgrades the firmware of the mobile terminal according to the verified flashing package
  • the terminal device first receives the first form that is digitally signed from the electronic device.
  • the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; If the digital signature information of the form is verified, the version information of the flashing package is determined according to the first form; secondly, it is determined whether the flashing package is the firmware package of the preset version according to the version information; if so, the data verification operation is performed to fully verify the flashing machine Package; upgrade the firmware of the mobile terminal according to the verified flashing package.
  • the terminal device first verifies the digital signature of the form, which improves the security when flashing the phone; if the digital signature is verified, the terminal device further determines the version information of the flashing package, and when the version information is adapted, it is completely The flashing package avoids the situation that the firmware package gets wrong and the flashing version is wrong.
  • the data verification operation includes the following steps: detecting whether the currently processed form is an unprocessed form; if so, determining the firmware data corresponding to the first type of message digest in the currently processed form; Verify the firmware data corresponding to the message digest of the first type; under the condition that the verification is passed, detect whether the currently processed form includes a message digest of the second type, and the message digest of the second type includes the information of the second form. Preset hash value.
  • the first type of message digest is generated according to the flashing command; the specific method of verifying the firmware data corresponding to the first type of message digest includes: determining the actual hash value of the firmware data corresponding to the first type of message digest, and obtaining the current
  • the preset hash value in the processed table is judged whether the preset hash value is the same as the actual hash value. If they are the same, the firmware data is determined to pass the verification, otherwise the firmware data does not pass the verification.
  • the currently processed table includes N message digests of the first type, and N is a positive integer; each message digest of the first type stores the hash value of a corresponding flashing command, which is called a preset hash value ; N message digests of the first type correspond to N flashing commands, the mobile terminal determines the above N flashing commands in the flashing package, and calculates the actual hash value of each flashing command in the N flashing commands according to the preset calculation rules, and obtains N actual hash values, when the N actual hash values are the same as the N preset hash values, it is determined that the firmware data corresponding to the message digest of the first type in the first table has passed the verification.
  • the preset calculation rule may be the SHA256 algorithm.
  • the message digest of the second type is the preset hash value corresponding to the next table.
  • the terminal device can verify the firmware data in the current table, ensuring the integrity of the firmware data corresponding to the message summary in the current table.
  • the method further includes: if not, determining that the flashing package is verified.
  • the method further includes: if so, obtaining a second table, and calculating the actual hash value of the second table. Hope value; determine whether the actual hash value matches the preset hash value; if so, update the currently processed table to the second table.
  • the method further includes: updating the status of the currently processed table to the processed state .
  • FIG. 2B is a schematic diagram of a message summary table provided by an embodiment of the present application. As shown in the figure, all the message summaries corresponding to the flashing package constitute three tables. Among them, in Table 1, message digest 0 to message digest 52 are the message digests corresponding to the firmware data in the flashing package; message digest 53 is the message digest obtained by calculating the hash value of message digest 54-message digest 181 in Table 2 (message digest The digest 54 to the message digest 181 are regarded as a message, and the hash value of the message is calculated to obtain the message digest 53).
  • Table 1 message digest 0 to message digest 52 are the message digests corresponding to the firmware data in the flashing package
  • message digest 53 is the message digest obtained by calculating the hash value of message digest 54-message digest 181 in Table 2 (message digest The digest 54 to the message digest 181 are regarded as a message, and the hash value of the message is calculated to obtain the message digest 53).
  • message digest 54 to message digest 180 are the message digests corresponding to the firmware data in the flashing package; message digest 181 is the message digest obtained by calculating the hash value of message digest 182 to message digest 262 in Table 3 (message digest 182 can be The message digest 262 is regarded as a message, and the hash value of the message is calculated to obtain the message digest 181).
  • form 1 is digitally signed, and message digest 0 to message digest 53 are digitally signed.
  • form 1 passes the digital signature verification, it means that form 1 is safe, and message digest 53 in form 1 is form 2.
  • the terminal device stores the preset hash value corresponding to the next table (except the last table) in the last message digest in each table.
  • the first table is digitally signed
  • the security transmission is realized, and each form does not need to be digitally signed, which reduces the data processing volume of the terminal device and improves the data processing efficiency of the terminal device.
  • the method further includes : Send an ACK associated with the second table to the electronic device.
  • ACK refers to the Acknowledge character.
  • the terminal device sends an ACK to the electronic device to indicate that the terminal device has confirmed that the current form is correct and is ready to receive the next form.
  • the terminal device can return an ACK to notify the electronic device to send the data of the next form, so as to achieve continuous data acquisition, ensure continuous verification of data, and improve the data processing efficiency of the terminal device.
  • the method further includes: if not, terminating the data verification operation.
  • the determining the version information of the flashing package according to the first table includes: obtaining first firmware data corresponding to the first type of message digest in the first table; extracting the first firmware data Version information in.
  • the first table refers to Table 1.
  • the version information is compiled into the firmware data corresponding to Table 1 in the flashing package, so that the terminal device is processed at the beginning You can get version information. And continue to perform the flashing operation when the version information is adapted; and terminate the flashing operation if the version information is not adapted.
  • the terminal device can first obtain the version information, so that the terminal device can perform subsequent operations according to the version information, which improves the intelligence of the terminal device.
  • the method before the receiving the digitally signed first form sent by the electronic device, the method further includes: sending a flashing request information to the electronic device; receiving response information from the electronic device, the The response information includes a request to obtain device information; and the device information of the terminal device is sent to the electronic device.
  • the terminal device sends a flashing request and device information to the electronic device, so that the electronic device can recognize the identity of the terminal device, and then execute an adapted flashing strategy.
  • the method for flashing the device and the terminal device described in this embodiment may include the following steps:
  • Step 301 The terminal device sends a flashing request information to the electronic device.
  • Step 302 The terminal device receives response information from the electronic device, where the response information includes a request to obtain device information.
  • Step 303 The terminal device sends the device information of the terminal device to the electronic device.
  • Step 304 The terminal device receives the digitally signed first form sent by the electronic device.
  • Step 305 The terminal device verifies the digital signature information of the first form.
  • Step 306 If the digital signature information of the first form passes the verification, the terminal device determines the version information of the flashing package according to the first form.
  • Step 307 The terminal device determines whether the flashing package is a firmware package of a preset version according to the version information.
  • Step 308 If the flashing package is a firmware package of the preset version, the terminal device detects whether the currently processed form is an unprocessed form.
  • Step 309 If the currently processed form is an unprocessed form, the terminal device determines the firmware data corresponding to the first type of message digest in the currently processed form.
  • Step 310 The terminal device verifies the firmware data corresponding to the message digest of the first type.
  • Step 311 Under the condition that the verification is passed, the terminal device detects whether the currently processed table includes a message digest of the second type, and the message digest of the second type includes a preset hash value of the second table.
  • Step 312 If the currently processed form does not include the message digest of the second type, the terminal device generates a flashing package according to the firmware data in all the received forms; if the currently processed form includes the message digest of the second type, then receive In the second table, calculate the actual hash value of the second table; determine whether the actual hash value matches the preset hash value; if so, update the currently processed table to be the second table.
  • the terminal device first receives the first form that is digitally signed from the electronic device.
  • the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; If the digital signature information of the form is verified, the version information of the flashing package is determined according to the first form; secondly, it is determined whether the flashing package is the firmware package of the preset version according to the version information; if so, the data verification operation is performed to fully verify the flashing machine Package; upgrade the firmware of the mobile terminal according to the verified flashing package.
  • the terminal device first verifies the digital signature of the form, which improves the security when flashing the phone; if the digital signature is verified, the terminal device further determines the version information of the flashing package, and when the version information is adapted, it is completely The flashing package avoids the situation that the firmware package gets wrong and the flashing version is wrong.
  • FIG. 4 is a schematic diagram of an embodiment flow of another flashing method provided by an embodiment of the application, which is applied to an electronic device.
  • the method may include the following steps:
  • Step 401 The electronic device receives the flashing request information sent by the terminal device.
  • Step 402 The electronic device sends response information to the terminal device, where the response information includes a request to obtain device information of the terminal device.
  • Step 403 The electronic device receives the first device information sent by the terminal device.
  • Step 404 The electronic device sends the first device information and the second device information to the server, where the second device refers to the device information of the electronic device.
  • Step 405 The electronic device receives the authorization information sent by the server.
  • Step 406 The electronic device judges whether the terminal device meets the flashing condition according to the authorization information.
  • Step 407 If yes, the electronic device sends a flashing package to the terminal device.
  • the electronic device receives the flashing request information sent by the terminal device; sends response information to the terminal device, and the response information includes a request to obtain the device information of the terminal device; and receives the terminal device.
  • the first device information sent by the device; the first device information and the second device information are sent to the server, where the second device refers to the device information of the electronic device; the authorization information sent by the server is received; according to the The authorization information determines whether the terminal device meets the flashing condition; if so, sending a flashing package to the terminal device.
  • the electronic device interacts with the terminal device to obtain the device information of the terminal device; the electronic device interacts with the server to obtain the interactive information of the server for the electronic device and the terminal device, thereby realizing the verification of the terminal device and the electronic device by the server, which improves The security of the flashing machine.
  • FIG. 5 is a schematic structural diagram of a terminal device 500 provided by an embodiment of the present application.
  • the terminal device 500 includes an application processor 510, a memory 520, a communication interface 530, and one or more programs 521, where the one or more programs 521 are stored in the aforementioned memory 520 and are configured to be executed by the aforementioned application processor 510,
  • the one or more programs 521 include instructions for performing the following steps:
  • the terminal device first receives the first form that is digitally signed from the electronic device.
  • the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; If the digital signature information of the form is verified, the version information of the flashing package is determined according to the first form; secondly, it is determined whether the flashing package is the firmware package of the preset version according to the version information; if so, the data verification operation is performed to fully verify the flashing machine Package; upgrade the firmware of the mobile terminal according to the verified flashing package.
  • the terminal device first verifies the digital signature of the form, which improves the security when flashing the phone; if the digital signature is verified, the terminal device further determines the version information of the flashing package, and when the version information is adapted, it is completely The flashing package avoids the situation that the firmware package gets wrong and the flashing version is wrong.
  • the instructions in the program are specifically used to perform the following operations: detecting whether the currently processed form is an unprocessed form; if so, determining the currently processed form The firmware data corresponding to the message digest of the first type in the table; verify the firmware data corresponding to the message digest of the first type; under the condition of passing the verification, detect whether the currently processed table includes the message digest of the second type, The message digest of the second type includes the preset hash value of the second table.
  • the instructions in the program are specifically used to perform the following operations: if not, determine the flashing Package verification passed.
  • the instructions in the program are specifically used to perform the following operations: if so, obtain the second table, Calculate the actual hash value of the second table; determine whether the actual hash value matches the preset hash value; if so, update the currently processed table to the second table.
  • the program in are specifically used to perform the following operations: send an ACK associated with the second table to the electronic device.
  • the instructions in the program are specifically used to perform the following operations: if not, terminate the Data verification operation.
  • the instructions in the program are specifically used to perform the following operations: obtaining the corresponding summary of the first type of message in the first table The first firmware data; extract the version information in the first firmware data.
  • the instructions in the program are specifically used to perform the following operations: sending the flashing request information to the electronic device;
  • an electronic device includes hardware structures and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
  • the embodiment of the present application may divide the electronic device into functional units according to the foregoing method examples.
  • each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 6 is a block diagram of the functional unit composition of a flashing device 600 involved in an embodiment of the present application.
  • the terminal device of the flashing device 600 includes a processing unit 601 and a communication unit 602, in which,
  • the processing unit is configured to receive a digitally signed first form through the communication unit, the first form including at least one message digest; and digital signature information for verifying the first form; and If the digital signature information of the first form is verified, the version information of the flashing package is determined according to the first form; and it is used to determine whether the flashing package is a firmware package of a preset version according to the version information; And if it is, perform a data verification operation through the communication unit to update the flashing package; and for upgrading the firmware of the mobile terminal according to the verified flashing package.
  • the multi-brushing device may further include a storage unit 603 for storing program codes and data of the electronic device.
  • the processing unit 601 may be an application processor
  • the communication unit 602 may be a global communication bus, a transceiver, etc.
  • the storage unit 603 may be a memory.
  • the terminal device first receives the first form that is digitally signed from the electronic device.
  • the first form includes at least one message digest; secondly, the digital signature information of the first form is verified; If the digital signature information of the form is verified, the version information of the flashing package is determined according to the first form; secondly, it is determined whether the flashing package is the firmware package of the preset version according to the version information; if so, the data verification operation is performed to fully verify the flashing machine Package; upgrade the firmware of the mobile terminal according to the verified flashing package.
  • the terminal device first verifies the digital signature of the form, which improves the security when flashing the phone; if the digital signature is verified, the terminal device further determines the version information of the flashing package, and when the version information is adapted, it is completely The flashing package avoids the situation that the firmware package gets wrong and the flashing version is wrong.
  • the processing unit 601 is specifically configured to: detect whether the currently processed form is an unprocessed form; if so, determine that the currently processed form is the first one in the currently processed form.
  • the type of message digest includes the preset hash value of the second table.
  • the processing unit 601 is specifically configured to: if not, determine that the flashing package is verified.
  • the processing unit 601 is specifically configured to: if so, receive the second message digest through the communication unit 602 Table, calculating the actual hash value of the second table; judging whether the actual hash value matches the preset hash value; if so, updating the currently processed table to the second table.
  • the processing The unit 601 is specifically configured to send an ACK associated with the second table to the electronic device through the communication unit 602.
  • the processing unit 601 is specifically configured to: if not, terminate the data verification operation.
  • the processing unit 601 is specifically configured to: obtain the first firmware corresponding to the first type of message digest in the first table Data; extract the version information in the first firmware data.
  • the processing unit 601 before the receiving the digitally signed first form sent by the electronic device, is specifically configured to: send the flashing request information to the electronic device through the communication unit 602;
  • the response information of the electronic device is received through the communication unit 602, the response information includes a request for acquiring device information; the device information of the terminal device is sent to the electronic device.
  • the embodiment of the present application also provides a flashing device, which is characterized in that it is applied to electronic equipment.
  • the flashing device includes a processing unit and a communication unit, wherein:
  • the processing unit is configured to receive the flashing request information sent by the terminal device through the communication unit; and is configured to send response information to the terminal device through the communication unit, and the response information includes the device that obtains the terminal device.
  • Information request ; and for receiving the first device information sent by the terminal device through the communication unit; and for sending the first device information and the second device information to the server, and the second device refers to all The device information of the electronic device; and for receiving the authorization information sent by the server through the communication unit; and for judging whether the terminal device satisfies the flashing condition according to the authorization information;
  • the communication unit sends a flashing package to the terminal device.
  • An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program causes the computer to execute any part or part of the flashing method described in the above method embodiment. All steps.
  • the embodiments of the present application also provide a computer program product.
  • the computer program product includes a non-transitory computer-readable storage medium storing a computer program.
  • the computer program is operable to cause a computer to execute the method described in the foregoing method embodiment. Part or all of the steps of any flashing method.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be realized in the form of hardware or software program module.
  • the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer readable memory.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory.
  • a number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned memory includes: U disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), mobile hard disk, magnetic disk, or optical disk and other media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: a flash disk , ROM, RAM, magnetic disk or CD, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Telephone Function (AREA)

Abstract

一种刷机方法及相关装置,该方法包括:接收电子设备发送的被数字签名的第一表格(201),第一表格包括至少一条消息摘要;验证第一表格的数字签名信息(202);若第一表格的数字签名信息通过验证,则根据第一表格确定刷机包的版本信息(203);根据版本信息判断刷机包是否为预设版本的固件包(204);若是,则执行数据验证操作以更新刷机包;根据刷机包升级移动终端的固件(205)。可见,所述方法有利于提升终端设备刷机的安全性和适配性。

Description

刷机方法及相关装置 技术领域
本申请涉及计算机技术领域,具体涉及一种刷机方法及相关装置。
背景技术
随着电子技术的进步,与终端设备适配的固件越来越多。由于现阶段移动终端良好的兼容性以及适配性,用户可以自主灵活的进行刷机,但也使得某些不法分子有了可乘之机,假冒系统的刷机固件,降低了移动终端的安全性和稳定性信息。
发明内容
本申请实施例提供了一种刷机方法及相关装置,有利于提升终端设备刷机的安全性和适配性。
第一方面,本申请实施例提供一种刷机方法,应用于终端设备,所述方法包括:
接收电子设备发送的被数字签名的第一表格,所述第一表格包括至少一条消息摘要;
验证所述第一表格的数字签名信息;
若所述第一表格的所述数字签名信息通过验证,则根据所述第一表格确定刷机包的版本信息;
根据所述版本信息判断所述刷机包是否为预设版本的固件包;
若是,则执行数据验证操作以完全验证所述刷机包;
根据通过验证的所述刷机包升级所述移动终端的固件。
第二方面,本申请实施例提供一种刷机方法,应用于电子设备,所述方法包括:
接收终端设备发送的刷机请求信息;
向所述终端设备发送响应信息,所述响应信息包括获取所述终端设备的设备信息的请求;
接收所述终端设备发送的第一设备信息;
向服务器发送所述第一设备信息和第二设备信息,所述第二设备是指所述电子设备的设备信息;
接收所述服务器发送的授权信息;
根据所述授权信息判断所述终端是否满足刷机条件;
若是,则向所述终端是设备发送刷机包。
第三方面,本申请实施例提供了一种刷机装置,应用于终端设备,所述刷机装置包括 处理单元和通信单元,其中,
所述处理单元,用于通过所述通信单元接收电子设备发送的被数字签名的第一表格,所述第一表格包括至少一条消息摘要;以及用于验证所述第一表格的数字签名信息;以及用于若所述第一表格的所述数字签名信息通过验证,则根据所述第一表格确定刷机包的版本信息;以及用于根据所述版本信息判断所述刷机包是否为预设版本的固件包;以及用于若是,则执行数据验证操作以完全验证所述刷机包;以及用于根据通过验证的所述刷机包升级所述移动终端的固件。
第四方面,本申请实施例提供了一种刷机装置,应用于电子设备,所述刷机装置包括处理单元和通信单元,其中,
所述处理单元,用于通过所述通信单元接收终端设备发送的刷机请求信息;以及用于通过所述通信单元向所述终端设备发送响应信息,所述响应信息包括获取所述终端设备的设备信息的请求;以及用于通过所述通信单元接收所述终端设备发送的第一设备信息;以及用于向服务器发送所述第一设备信息和第二设备信息,所述第二设备是指所述电子设备的设备信息;以及用于通过所述通信单元接收所述服务器发送的授权信息;以及用于根据所述授权信息判断所述终端是否满足刷机条件;以及用于若是,则通过所述通信单元向所述终端设备发送刷机包。
第五方面,本申请实施例提供一种电子设备,包括处理器、存储器、通信接口,以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行本申请实施例第一方面和第二方面中的步骤的指令。
第六方面,本申请实施例提供了一种计算机可读存储介质,其中,上述计算机可读存储介质存储用于电子数据交换的计算机程序,其中,上述计算机程序使得计算机执行如本申请实施例第一方面和第二方面中所描述的部分或全部步骤。
第七方面,本申请实施例提供了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面和第二方面中所描述的部分或全部步骤。该计算机程序产品可以为一个软件安装包。
可以看出,本申请实施例中,终端设备接首先接收电子设备发送的被数字签名的第一表格,第一表格包括至少一条消息摘要;其次,验证第一表格的数字签名信息;若第一表格的数字签名信息通过验证,则根据第一表格确定刷机包的版本信息;其次,根据版本信息判断刷机包是否为预设版本的固件包;若是,则执行数据验证操作以完全验证所述刷机包;根据通过验证的刷机包升级移动终端的固件。可见,终端设备首先验证表格的数字签名,提升了刷机时的安全性;在数字签名通过验证的情况下,终端设备进一步确定刷机包的版本信息,在版本信息适配的情况下,再完全的刷机包,避免了固件包获取错误以及刷机版本错误的情况。
附图说明
下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的一种刷机方法的系统结构示意图;
图2A是本申请实施例提供的一种刷机方法的流程示意图;
图2B是本申请实施例提供的一种消息摘要表格的示意图;
图3是本申请实施例提供的另一种刷机方法的流程示意图;
图4是本申请实施例提供的另一种刷机方法的流程示意图;
图5是本申请实施例提供的一种终端设备的结构示意图;
图6是本申请实施例提供的一种刷机装置的功能单元组成框图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
下面对本申请实施例进行详细介绍。
请参阅图1,图1是本申请实施例提供的一种刷机方法的系统结构示意图,其中移动终端101与电子设备102通信连接,电子设备102与服务器103通信连接。当移动终端101检测到刷机的指令时,移动终端101首先向电子设备102发送刷机请求信息;电子设备102接收到刷机请求信息之后,向移动终端101发送响应信息,其中响应信息中包含获取移动 终端101的设备信息的请求;移动终端101接收到响应信息后,向电子设备102发送移动终端101的第一设备信息;电子设备102接收到移动终端101发送的第一设备信息后,提取本端的第二设备信息,并将第一设备信息和第二设备信息均发送至服务器103,服务器103根据第一设备信息和第二设备信息判断移动终端101和电子设备102是否具有刷机的权限,在判断出具有权限的情况下,向电子设备102发送授权信息,电子设备102在根据授权信息判断出移动终端具有刷机权限的情况下向移动终端101发送刷机包。
本申请实施例所涉及到的终端设备、电子设备和服务器可以包括各种具有无线通信功能的手持设备、车载设备、可穿戴设备、计算设备或连接到无线调制解调器的其他处理设备,以及各种形式的用户设备(user equipment,UE),移动台(mobile station,MS),终端设备(terminal device)等等。为方便描述,上面提到的设备统称为电子设备。
请参阅图2A,图2A是本申请实施例提供的一种刷机方法的流程示意图,本实施例中所描述的刷机方法,应用于终端设备,本方法可包括以下步骤:
步骤201、终端设备接收电子设备发送的被数字签名的第一表格。
其中,第一表格包括至少一条消息摘要;需要说明的是,第一表格仅包含刷机包中的部分或全部刷机命令对应的消息摘要。
其中,消息摘要是根据刷机包中的刷机命令计算哈希值生成的。。
步骤202、终端设备验证第一表格的数字签名信息。
具体的,终端设备内置有厂商出厂时内置的刷机验证工具,内置的刷机验证工具经过厂商签名的,不可被更改;第一表格的数字签名信息也是厂商签名的;通过内置的刷机验证工具验证第一表格的数字签名信息即可判断第一表格对应的刷机包是否正版的刷机包。
步骤203、终端设备若第一表格的数字签名信息通过验证,则根据第一表格确定刷机包的版本信息。
步骤204、终端设备根据版本信息判断刷机包是否为预设版本的固件。
步骤205、若是,则终端设备执行数据验证操作以完全验证刷机包。
步骤206、终端设备根据通过验证的刷机包升级移动终端的固件
可以看出,本申请实施例中,终端设备接首先接收电子设备发送的被数字签名的第一表格,第一表格包括至少一条消息摘要;其次,验证第一表格的数字签名信息;若第一表格的数字签名信息通过验证,则根据第一表格确定刷机包的版本信息;其次,根据版本信息判断刷机包是否为预设版本的固件包;若是,则执行数据验证操作以完全验证所述刷机包;根据通过验证的刷机包升级移动终端的固件。可见,终端设备首先验证表格的数字签名,提升了刷机时的安全性;在数字签名通过验证的情况下,终端设备进一步确定刷机包的版本信息,在版本信息适配的情况下,再完全的刷机包,避免了固件包获取错误以及刷机版本错误的情况。
在一个可能的示例中,所述数据验证操作包括以下步骤:检测当前处理的表格是否为未处理的表格;若是,则确定所述当前处理的表格中第一类型的消息摘要对应的固件数据;验证所述第一类型的消息摘要对应的固件数据;在验证通过的条件下,检测所述当前处理的表格中是否包括第二类型消息摘要,所述第二类型的消息摘要包括第二表格的预设哈希值。
其中,第一类型的消息摘要是根据刷机命令生成的;验证第一类型的消息摘要对应的固件数据的具体方法包括:确定第一类型的消息摘要对应的固件数据的实际哈希值,获取当前处理的表格中的预设哈希值,判断预设哈希值是否与实际哈希值是否相同,若相同,则确定固件数据通过验证,反之固件数据没有通过验证。
举例来说,当前处理的表格中包括N条第一类型的消息摘要,N为正整数;每一条第一类型的消息摘要存储对应的一条刷机命令的哈希值,称为预设哈希值;N条第一类型的消息摘要对应N条刷机命令,移动终端确定刷机包中上述N条刷机命令,根据预设的计算规则计算N条刷机命令中每条刷机命令的实际哈希值,得到N条实际哈希值,当N条实际哈希值与N条预设哈希值均相同的情况下,确定第一表格中第一类型的消息摘要对应的固件数据通过验证。具体的,预设的计算规则可以是SHA256算法。
其中,第二类型的消息摘要是下一个表格对应的预设哈希值。
可见,本示例中,终端设备可验证当前表格中的固件数据,保证了当前表格中消息摘要对应的固件数据完整性。
在一个可能的示例中,所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后,所述方法还包括:若否,则确定所述刷机包验证通过。
在一个可能的示例中,所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后,所述方法还包括:若是,则获取第二表格,计算所述第二表格的实际哈希值;判断所述实际哈希值是否与所述预设哈希值匹配;若是,则更新所述当前处理的表格为所述第二表格。
其中,判断所述实际哈希值是否与所述预设哈希值匹配之后,更新所述当前处理的表格为所述第二表格之前,还包括:更新当前处理的表格的状态为已处理状态。
其中,判断所述实际哈希值是否与所述预设哈希值匹配之后,还包括:若否,则终止数据验证操作;确定刷机包未验证通过。
举例来说,请参阅图2B,图2B是本申请实施例提供的一种消息摘要表格的示意图。如图所示,刷机包对应的全部消息摘要构成了三个表格。其中,表格1中,消息摘要0至消息摘要52为刷机包中固件数据对应的消息摘要;消息摘要53为表格2中消息摘要54-消息摘要181计算哈希值得到的消息摘要(可将消息摘要54至消息摘要181看做一条消息,计算该条消息的哈希值得到消息摘要53)。表格2中,消息摘要54至消息摘要180为刷机包中固件数据对应的消息摘要;消息摘要181为表格3中消息摘要182至消息摘要262计 算哈希值得到的消息摘要(可将消息摘要182至消息摘要262看做一条消息,计算该条消息的哈希值得到消息摘要181)。其中,表格1是经过数字签名的,及消息摘要0至消息摘要53是经过数字签名的,当表格1通过数字签名验证时,表示表格1是安全的,表格1中的消息摘要53是表格2对应的预设哈希值,由于表格1是安全的,若计算得到表格2对应的实际哈希值与预设哈希值相等,则可证明表格2的信息是安全完整的;实现了安全性的传递,而无需将表格2和表格3都进行数字签名,使得数据冗杂庞大。表格3中由于没有下一个表格对应的消息摘要,因此,表格3的消息摘要全部是刷机包中的刷机命令对应的消息摘要;终端设备在根据表格3的消息摘要验证完刷机数据后,确认整个刷机包验证完毕。
可见,本示例中就,终端设备在每个表格中的最后一个消息摘要中存储下一表格对应的预设哈希值(除最后一个表格),在第一表格是经过数字签名的情况下,实现了安全性的传递,进而无需将每个表格进行数字签名,减小了终端设备的数据处理量,提升了终端设备的数据处理效率。
在一个可能的示例中,所述判断所述实际哈希值是否与所述预设哈希值匹配之后,所述更新所述当前处理的表格为所述第二表格之前,所述方法还包括:向所述电子设备发送关联所述第二表格的ACK。
其中,ACK指的是确认字符(Acknowledge character)。终端设备向电子设备发送ACK以表示终端设备已经确认当前的表格无误,并准备接收下一表格。
可见,本示例中,终端设备可返回ACK,以通知电子设备发送下一表格的数据,实现数据的持续获取,保证了数据的连续验证,提升了终端设备的数据处理效率。
在一个可能的示例中,所述判断所述实际哈希值是否与所述预设哈希值匹配之后,所述方法还包括:若否,则终止所述数据验证操作。
在一个可能的示例中,所述根据所述第一表格确定刷机包的版本信息,包括:获取所述第一表格中第一类型消息摘要对应的第一固件数据;提取所述第一固件数据中的版本信息。
具体的,请参阅图2B,第一表格指的是表格1,其中,在生成刷机包时,将版本信息编译至刷机包中表格1对应的固件数据中,使得终端设备在最开始处理时即可获知版本信息。并在版本信息适配的情况下继续执行刷机操作;在版本信息不适配的情况下终止刷机操作。
可见,本示例中,终端设备可首先获取版本信息,便于终端设备根据版本信息执行后续的操作,提升了终端设备的智能性。
在一个可能的示例中,所述接收电子设备发送的被数字签名的第一表格之前,所述方法还包括:向所述电子设备发送刷机请求信息;接收所述电子设备的响应信息,所述响应信息包括获取设备信息的请求;向所述电子设备发送所述终端设备的设备信息。
可见,本示例中,终端设备向电子设备发送刷机请求以及设备信息,以便于电子设备识别终端设备的身份,进而执行适配的刷机策略。
与上述图2A一致地,请参阅图3,本实施例中所描述的刷机方法,终端设备,本方法可包括以下步骤:
步骤301、终端设备向电子设备发送刷机请求信息。
步骤302、终端设备接收电子设备的响应信息,响应信息包括获取设备信息的请求。
步骤303、终端设备向电子设备发送终端设备的设备信息。
步骤304、终端设备接收电子设备发送的被数字签名的第一表格。
步骤305、终端设备验证第一表格的数字签名信息。
步骤306、若第一表格的数字签名信息通过验证,则终端设备根据第一表格确定刷机包的版本信息。
步骤307、终端设备根据版本信息判断刷机包是否为预设版本的固件包。
步骤308、若刷机包是预设版本的固件包,则终端设备检测当前处理的表格是否为未处理的表格。
步骤309、若当前处理的表格是未处理的表格,则终端设备确定当前处理的表格中第一类型的消息摘要对应的固件数据。
步骤310、终端设备验证第一类型的消息摘要对应的固件数据。
步骤311、在验证通过的条件下,终端设备检测当前处理的表格中是否包括第二类型消息摘要,第二类型的消息摘要包括第二表格的预设哈希值。
步骤312、若当前处理的表格中不包括第二类型消息摘要,则终端设备根据接收到的全部的表格中的固件数据生成刷机包;若当前处理的表格中包括第二类型消息摘要,则接收第二表格,计算第二表格的实际哈希值;判断实际哈希值是否与预设哈希值匹配;若是,则更新当前处理的表格为第二表格。
可以看出,本申请实施例中,终端设备接首先接收电子设备发送的被数字签名的第一表格,第一表格包括至少一条消息摘要;其次,验证第一表格的数字签名信息;若第一表格的数字签名信息通过验证,则根据第一表格确定刷机包的版本信息;其次,根据版本信息判断刷机包是否为预设版本的固件包;若是,则执行数据验证操作以完全验证所述刷机包;根据通过验证的刷机包升级移动终端的固件。可见,终端设备首先验证表格的数字签名,提升了刷机时的安全性;在数字签名通过验证的情况下,终端设备进一步确定刷机包的版本信息,在版本信息适配的情况下,再完全的刷机包,避免了固件包获取错误以及刷机版本错误的情况。
与上述图2A一致地,请参阅图4,为本申请实施例提供的另一种刷机方法的实施例流程示意图,应用于电子设备,本方法可包括以下步骤:
步骤401、电子设备接收终端设备发送的刷机请求信息。
步骤402、电子设备向终端设备发送响应信息,响应信息包括获取终端设备的设备信息的请求;
步骤403、电子设备接收终端设备发送的第一设备信息。
步骤404、电子设备向服务器发送第一设备信息和第二设备信息,第二设备是指电子设备的设备信息。
步骤405、电子设备接收服务器发送的授权信息。
步骤406:电子设备根据授权信息判断终端设备是否满足刷机条件。
步骤407;若是,则电子设备向终端设备发送刷机包。
可以看出,本申请实施例中,电子设备接收终端设备发送的刷机请求信息;向所述终端设备发送响应信息,所述响应信息包括获取所述终端设备的设备信息的请求;接收所述终端设备发送的第一设备信息;向服务器发送所述第一设备信息和第二设备信息,所述第二设备是指所述电子设备的设备信息;接收所述服务器发送的授权信息;根据所述授权信息判断所述终端设备是否满足刷机条件;若是,则向所述终端设备发送刷机包。可见,本示例中,电子设备与终端设备交互得到终端设备的设备信息;电子设备与服务器交互得到服务器对于电子设备和终端设备的交互信息,进而实现服务器对于终端设备和电子设备的验证,提升了刷机的安全性。
与上述图2A、图3、图4所示的实施例一致的,请参阅图5,图5是本申请实施例提供的一种终端设备500的结构示意图,如图所示,所述终端设备500包括应用处理器510、存储器520、通信接口530以及一个或多个程序521,其中,所述一个或多个程序521被存储在上述存储器520中,并且被配置由上述应用处理器510执行,所述一个或多个程序521包括用于执行以下步骤的指令:
接收电子设备发送的被数字签名的第一表格,所述第一表格包括至少一条消息摘要;
验证所述第一表格的数字签名信息;
若所述第一表格的所述数字签名信息通过验证,则根据所述第一表格确定刷机包的版本信息;
根据所述版本信息判断所述刷机包是否为预设版本的固件包;
若是,则执行数据验证操作以完全验证所述刷机包;
根据通过验证的所述刷机包升级所述移动终端的固件。
可以看出,本申请实施例中,终端设备接首先接收电子设备发送的被数字签名的第一表格,第一表格包括至少一条消息摘要;其次,验证第一表格的数字签名信息;若第一表格的数字签名信息通过验证,则根据第一表格确定刷机包的版本信息;其次,根据版本信息判断刷机包是否为预设版本的固件包;若是,则执行数据验证操作以完全验证所述刷机包;根据通过验证的刷机包升级移动终端的固件。可见,终端设备首先验证表格的数字签 名,提升了刷机时的安全性;在数字签名通过验证的情况下,终端设备进一步确定刷机包的版本信息,在版本信息适配的情况下,再完全的刷机包,避免了固件包获取错误以及刷机版本错误的情况。
在一个可能的示例中,在执行所述数据验证操作方面,所述程序中的指令具体用于执行以下操作:检测当前处理的表格是否为未处理的表格;若是,则确定所述当前处理的表格中第一类型的消息摘要对应的固件数据;验证所述第一类型的消息摘要对应的固件数据;在验证通过的条件下,检测所述当前处理的表格中是否包括第二类型消息摘要,所述第二类型的消息摘要包括第二表格的预设哈希值。
在一个可能的示例中,在所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后方面,所述程序中的指令具体用于执行以下操作:若否,则确定所述刷机包验证通过。
在一个可能的示例中,在所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后方面,所述程序中的指令具体用于执行以下操作:若是,则获取第二表格,计算所述第二表格的实际哈希值;判断所述实际哈希值是否与所述预设哈希值匹配;若是,则更新所述当前处理的表格为所述第二表格。
在一个可能的示例中,在所述判断所述实际哈希值是否与所述预设哈希值匹配之后,所述更新所述当前处理的表格为所述第二表格之前方面,所述程序中的指令具体用于执行以下操作:向所述电子设备发送关联所述第二表格的ACK。
在一个可能的示例中,在所述判断所述实际哈希值是否与所述预设哈希值匹配之后方面,所述程序中的指令具体用于执行以下操作:若否,则终止所述数据验证操作。
在一个可能的示例中,在所述根据所述第一表格确定刷机包的版本信息方面,所述程序中的指令具体用于执行以下操作:获取所述第一表格中第一类型消息摘要对应的第一固件数据;提取所述第一固件数据中的版本信息。
在一个可能的示例中,在所述接收电子设备发送的被数字签名的第一表格之前方面,所述程序中的指令具体用于执行以下操作:向所述电子设备发送刷机请求信息;接收所述电子设备的响应信息,所述响应信息包括获取设备信息的请求;向所述电子设备发送所述终端设备的设备信息。
上述主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所提供的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对电子设备进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
图6是本申请实施例中所涉及的一种刷机装置600的功能单元组成框图。该刷机装置600终端设备,包括处理单元601和通信单元602,其中,
所述处理单元,用于通过所述通信单元接收被数字签名的第一表格,所述第一表格包括至少一条消息摘要;以及用于验证所述第一表格的数字签名信息;以及用于若所述第一表格的所述数字签名信息通过验证,则根据所述第一表格确定刷机包的版本信息;以及用于根据所述版本信息判断所述刷机包是否为预设版本的固件包;以及用于若是,则通过所述通信单元执行数据验证操作以更新所述刷机包;以及用于根据通过验证的所述刷机包升级所述移动终端的固件。
其中,所述多刷机装置还可以包括存储单元603,用于存储电子设备的程序代码和数据。所述处理单元601可以是应用处理器,所述通信单元602可以是全局通信总线、收发器等,存储单元603可以是存储器。
可以看出,本申请实施例中,终端设备接首先接收电子设备发送的被数字签名的第一表格,第一表格包括至少一条消息摘要;其次,验证第一表格的数字签名信息;若第一表格的数字签名信息通过验证,则根据第一表格确定刷机包的版本信息;其次,根据版本信息判断刷机包是否为预设版本的固件包;若是,则执行数据验证操作以完全验证所述刷机包;根据通过验证的刷机包升级移动终端的固件。可见,终端设备首先验证表格的数字签名,提升了刷机时的安全性;在数字签名通过验证的情况下,终端设备进一步确定刷机包的版本信息,在版本信息适配的情况下,再完全的刷机包,避免了固件包获取错误以及刷机版本错误的情况。
在一个可能的示例中,在执行所述数据验证操作方面,所述处理单元601具体用于:检测当前处理的表格是否为未处理的表格;若是,则确定所述当前处理的表格中第一类型的消息摘要对应的固件数据;验证所述第一类型的消息摘要对应的固件数据;在验证通过的条件下,检测所述当前处理的表格中是否包括第二类型消息摘要,所述第二类型的消息摘要包括第二表格的预设哈希值。
在一个可能的示例中,在所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后方面,所述处理单元601具体用于:若否,则确定所述刷机包验证通过。
在一个可能的示例中,在所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后方面,所述处理单元601具体用于:若是,则通过所述通信单元602接收第二表格, 计算所述第二表格的实际哈希值;判断所述实际哈希值是否与所述预设哈希值匹配;若是,则更新所述当前处理的表格为所述第二表格。
在一个可能的示例中,在所述判断所述实际哈希值是否与所述预设哈希值匹配之后,所述更新所述当前处理的表格为所述第二表格之前方面,所述处理单元601具体用于:通过所述通信单元602向所述电子设备发送关联所述第二表格的ACK。
在一个可能的示例中,在所述判断所述实际哈希值是否与所述预设哈希值匹配之后方面,所述处理单元601具体用于:若否,则终止所述数据验证操作。
在一个可能的示例中,在所述根据所述第一表格确定刷机包的版本信息方面,所述处理单元601具体用于:获取所述第一表格中第一类型消息摘要对应的第一固件数据;提取所述第一固件数据中的版本信息。
在一个可能的示例中,在所述接收电子设备发送的被数字签名的第一表格之前方面,所述处理单元601具体用于:通过所述通信单元602向所述电子设备发送刷机请求信息;通过所述通信单元602接收所述电子设备的响应信息,所述响应信息包括获取设备信息的请求;向所述电子设备发送所述终端设备的设备信息。
本申请实施例还提供一种刷机装置,其特征在于,应用于电子设备,所述刷机装置包括处理单元和通信单元,其中,
所述处理单元,用于通过所述通信单元接收终端设备发送的刷机请求信息;以及用于通过所述通信单元向所述终端设备发送响应信息,所述响应信息包括获取所述终端设备的设备信息的请求;以及用于通过所述通信单元接收所述终端设备发送的第一设备信息;以及用于向服务器发送所述第一设备信息和第二设备信息,所述第二设备是指所述电子设备的设备信息;以及用于通过所述通信单元接收所述服务器发送的授权信息;以及用于根据所述授权信息判断所述终端设备是否满足刷机条件;以及用于若是,则通过所述通信单元向所述终端设备发送刷机包。
可以理解的是,本实施例的刷机装置的各程序模块的功能可根据上述方法实施例中的方法具体实现,其具体实现过程可以参照上述方法实施例的相关描述,此处不再赘述。
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于电子数据交换的计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任何一种刷机方法的部分或全部步骤。
本申请实施例还提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如上述方法实施例中记载的任何一种刷机方法的部分或全部步骤。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知 悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件程序模块的形式实现。
所述集成的单元如果以软件程序模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、ROM、RAM、磁盘或光盘等。
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (20)

  1. 一种刷机方法,其特征在于,应用于终端设备,所述方法包括:
    接收电子设备发送的被数字签名的第一表格,所述第一表格包括至少一条消息摘要;
    验证所述第一表格的数字签名信息;
    若所述第一表格的所述数字签名信息通过验证,则根据所述第一表格确定刷机包的版本信息;
    根据所述版本信息判断所述刷机包是否为预设版本的固件包;
    若是,则执行数据验证操作以完全验证所述刷机包;
    根据通过验证的所述刷机包升级所述移动终端的固件。
  2. 根据权利要求1所述的方法,其特征在于,所述数据验证操作包括以下步骤:
    检测当前处理的表格是否为未处理的表格;
    若是,则确定所述当前处理的表格中第一类型的消息摘要对应的固件数据;
    验证所述第一类型的消息摘要对应的固件数据;
    在验证通过的条件下,检测所述当前处理的表格中是否包括第二类型的消息摘要,所述第二类型的消息摘要包括第二表格的预设哈希值。
  3. 根据权利要求2所述的方法,其特征在于,所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后,所述方法还包括:
    若否,则确定所述刷机包验证通过。
  4. 根据权利要求2所述的方法,其特征在于,所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后,所述方法还包括:
    若是,则获取第二表格,计算所述第二表格的实际哈希值;
    判断所述实际哈希值是否与所述预设哈希值匹配;
    若是,则更新所述当前处理的表格为所述第二表格。
  5. 根据权利要求4所述的方法,其特征在于,所述判断所述实际哈希值是否与所述预设哈希值匹配之后,所述更新所述当前处理的表格为所述第二表格之前,所述方法还包括:
    向所述电子设备发送关联所述第二表格的ACK。
  6. 根据权利要求4所述的方法,其特征在于,所述判断所述实际哈希值是否与所述预设哈希值匹配之后,所述方法还包括:
    若否,则终止所述数据验证操作。
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述根据所述第一表格确定刷机包的版本信息,包括:
    获取所述第一表格中第一类型消息摘要对应的第一固件数据;
    提取所述第一固件数据中的版本信息。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述接收电子设备发送的被数 字签名的第一表格之前,所述方法还包括:
    向所述电子设备发送刷机请求信息;
    接收所述电子设备的响应信息,所述响应信息包括获取设备信息的请求;
    向所述电子设备发送所述终端设备的设备信息。
  9. 一种刷机方法,其特征在于,应用于电子设备,所述方法包括;
    接收终端设备发送的刷机请求信息;
    向所述终端设备发送响应信息,所述响应信息包括获取所述终端设备的设备信息的请求;
    接收所述终端设备发送的第一设备信息;
    向服务器发送所述第一设备信息和第二设备信息,所述第二设备是指所述电子设备的设备信息;
    接收所述服务器发送的授权信息;
    根据所述授权信息判断所述终端设备是否满足刷机条件;
    若是,则向所述终端设备发送刷机包。
  10. 一种刷机装置,其特征在于,终端设备,所述刷机装置包括处理单元和通信单元,其中,
    所述处理单元,用于通过所述通信单元接收电子设备发送的被数字签名的第一表格,所述第一表格包括至少一条消息摘要;以及用于验证所述第一表格的数字签名信息;以及用于若所述第一表格的所述数字签名信息通过验证,则根据所述第一表格确定刷机包的版本信息;以及用于根据所述版本信息判断所述刷机包是否为预设版本的固件包;以及用于若是,则执行数据验证操作以完全验证所述刷机包;以及用于根据通过验证的所述刷机包升级所述移动终端的固件。
  11. 根据权利要求10所述的装置,其特征在于,在所述执行数据验证操作方面,所述处理单元具体用于:
    检测当前处理的表格是否为未处理的表格;以及用于若是,则确定所述当前处理的表格中第一类型的消息摘要对应的固件数据;以及用于验证所述第一类型的消息摘要对应的固件数据;以及用于在验证通过的条件下,检测所述当前处理的表格中是否包括第二类型消息摘要,所述第二类型的消息摘要包括第二表格的预设哈希值。
  12. 根据权利要求11所述的装置,其特征在于,在所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后方面,所述处理单元具体用于:
    若否,则确定所述刷机包验证通过。
  13. 根据权利要求11所述的方法,其特征在于,在所述检测所述当前处理的表格中是否包括第二类型的消息摘要之后方面,所述处理单元具体用于:
    若是,则通过所述通信单元接收第二表格,计算所述第二表格的实际哈希值;以及用 于判断所述实际哈希值是否与所述预设哈希值匹配;以及用于若是,则更新所述当前处理的表格为所述第二表格。
  14. 根据权利要求13所述的方法,其特征在于,在所述判断所述实际哈希值是否与所述预设哈希值匹配之后,所述更新所述当前处理的表格为所述第二表格之前方面,所述处理单元具体用于:
    通过所述通信单元向所述电子设备发送关联所述第二表格的ACK。
  15. 根据权利要求13所述的方法,其特征在于,在所述判断所述实际哈希值是否与所述预设哈希值匹配之后方面,所述处理单元具体用于:
    若否,则终止所述数据验证操作。
  16. 根据权利要求10-15任一项所述的方法,其特征在于,在所述根据所述第一表格确定刷机包的版本信息方面,所述处理单元具体用于:
    获取所述第一表格中第一类型消息摘要对应的第一固件数据;以及用于提取所述第一固件数据中的版本信息。
  17. 根据权利要求10-16任一项所述的方法,其特征在于,在所述接收电子设备发送的被数字签名的第一表格之前方面,所述处理单元具体用于:
    通过所述通信单元向所述电子设备发送刷机请求信息;以及用于通过所述通信单元接收所述电子设备的响应信息,所述响应信息包括获取设备信息的请求;通过所述通信单元向所述电子设备发送所述终端设备的设备信息。
  18. 一种刷机装置,其特征在于,应用于电子设备,所述刷机装置包括处理单元和通信单元,其中,
    所述处理单元,用于通过所述通信单元接收终端设备发送的刷机请求信息;以及用于通过所述通信单元向所述终端设备发送响应信息,所述响应信息包括获取所述终端设备的设备信息的请求;以及用于通过所述通信单元接收所述终端设备发送的第一设备信息;以及用于向服务器发送所述第一设备信息和第二设备信息,所述第二设备是指所述电子设备的设备信息;以及用于通过所述通信单元接收所述服务器发送的授权信息;以及用于根据所述授权信息判断所述终端是否满足刷机条件;以及用于若是,则通过所述通信单元向所述终端设备发送刷机包。
  19. 一种电子设备,其特征在于,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1-9任一项所述的方法中的步骤的指令。
  20. 一种计算机可读存储介质,其特征在于,存储用于电子数据交换的计算机程序,其中,所述计算机程序使得计算机执行如权利要求1-9任一项所述的方法。
PCT/CN2019/119184 2019-11-18 2019-11-18 刷机方法及相关装置 WO2021097611A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980100613.3A CN114424163A (zh) 2019-11-18 2019-11-18 刷机方法及相关装置
PCT/CN2019/119184 WO2021097611A1 (zh) 2019-11-18 2019-11-18 刷机方法及相关装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/119184 WO2021097611A1 (zh) 2019-11-18 2019-11-18 刷机方法及相关装置

Publications (1)

Publication Number Publication Date
WO2021097611A1 true WO2021097611A1 (zh) 2021-05-27

Family

ID=75981079

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/119184 WO2021097611A1 (zh) 2019-11-18 2019-11-18 刷机方法及相关装置

Country Status (2)

Country Link
CN (1) CN114424163A (zh)
WO (1) WO2021097611A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100251231A1 (en) * 2009-03-25 2010-09-30 Microsoft Corporation Device dependent on-demand compiling and deployment of mobile applications
CN105183499A (zh) * 2015-08-04 2015-12-23 上海青橙实业有限公司 刷机方法、移动终端及终端系统
CN106709284A (zh) * 2016-11-23 2017-05-24 北京小米移动软件有限公司 刷机包验证方法及装置
CN107194242A (zh) * 2017-03-30 2017-09-22 百富计算机技术(深圳)有限公司 固件升级方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100251231A1 (en) * 2009-03-25 2010-09-30 Microsoft Corporation Device dependent on-demand compiling and deployment of mobile applications
CN105183499A (zh) * 2015-08-04 2015-12-23 上海青橙实业有限公司 刷机方法、移动终端及终端系统
CN106709284A (zh) * 2016-11-23 2017-05-24 北京小米移动软件有限公司 刷机包验证方法及装置
CN107194242A (zh) * 2017-03-30 2017-09-22 百富计算机技术(深圳)有限公司 固件升级方法和装置

Also Published As

Publication number Publication date
CN114424163A (zh) 2022-04-29

Similar Documents

Publication Publication Date Title
US10387856B2 (en) Online payment method, system, and apparatus
US10097530B2 (en) Security authentication method and bidirectional forwarding detection BFD device
EP3490304B1 (en) Method for identifying access point and hotspot, and related products
CN106484453B (zh) 一种实现系统升级的方法及装置
CN109213781B (zh) 风控数据查询方法及装置
US9081969B2 (en) Apparatus and method for remotely deleting critical information
CN103327119B (zh) 远程控制方法、装置及系统
CN107248995B (zh) 账号验证方法及装置
CN111176794A (zh) 一种容器管理方法、装置及可读存储介质
WO2023035901A1 (zh) 系统软件升级方法、装置、设备和计算机存储介质
CN111625263A (zh) 一种服务器部件固件更新方法
CN114339755A (zh) 注册验证方法及装置、电子设备和计算机可读存储介质
CN114666097B (zh) 一种物联网设备的通信方法及系统
CN105516054A (zh) 一种用户身份验证的方法及装置
CN105549995B (zh) 一种音频设备升级方法及装置
CN107277163B (zh) 一种设备远程映射方法及装置
CN108574658B (zh) 一种应用登录方法及其设备
CN111600703B (zh) 基于sm2的签名方法、系统、电子设备及存储介质
CN111698097B (zh) 一种证书认证方法及装置
CN104079527A (zh) 一种信息处理方法及电子设备
WO2021097611A1 (zh) 刷机方法及相关装置
JP2018129791A5 (zh)
CN109699015A (zh) 机卡绑定关系认证方法、装置以及通信系统
CN109446052B (zh) 一种应用程序的校验方法及设备
CN109699030A (zh) 无人机认证方法、装置、设备和计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19953142

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19953142

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 281022)

122 Ep: pct application non-entry in european phase

Ref document number: 19953142

Country of ref document: EP

Kind code of ref document: A1