Firmware updating method, terminal equipment and server

The terminal device generates communication seeds and authentication information based on the server public key, and actively obtains firmware update packages from the server for local updates, solving the high cost and long time-consuming problem of hardware security module factory updates, and improving communication security.

CN119806566AInactive Publication Date: 2025-04-11QINGDAO HISENSE MOBILE COMM TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411658883.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-04-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, when a hardware security module encounters program defects during terminal equipment operation, it needs to return to the factory to update the firmware, resulting in high labor costs and long time.

Method used

The terminal device generates a communication seed carrying the device identification based on the server public key, and selects an encryption algorithm from the algorithm table to encrypt the system time, generates authentication information, and sends a firmware update request to the server, thereby actively obtaining the firmware update package for local update.

Benefits of technology

It realizes that the terminal equipment can complete firmware updates without returning to the factory, which reduces update time, reduces labor costs, and improves communication security through index transmission through encryption algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806566A_ABST
    Figure CN119806566A_ABST
Patent Text Reader

Abstract

The invention provides a firmware updating method, terminal equipment and a server, and relates to the technical field of firmware updating, in the method, the terminal equipment generates a communication seed carrying an equipment identifier based on a server public key, selects a first algorithm from a first algorithm table, and encrypts current system time based on the first algorithm to obtain identity verification information. Each encryption algorithm in the first algorithm table is provided with a corresponding index, so that a firmware update request sent to the server can be generated according to the target index, the communication seed and the identity verification information of the first algorithm, and the server issues a firmware update package. In the above process, the terminal device can acquire the firmware update package from the server in an active communication mode to realize local update of the firmware, firmware factory return update does not need to be performed on the device, the cost is saved, and the update time consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of firmware update, and specifically discloses a firmware update method, a terminal device, and a server. Background Art

[0002] A hardware security module (Secure Element, SE) is a hardware module in a terminal device that is responsible for storing and processing high-security information, such as the storage and call of payment information and communication keys, and the processing of identity authentication data. A hardware security module is usually used as a secure trusted root of a terminal device.

[0003] When the hardware security module has program defects such as partial permissions being unable to be enabled or crashing during device operation, since the hardware security module is implanted in the terminal device by the module provider before it leaves the factory, the main solution is to return the terminal device to the factory for the module provider to update the firmware system of the hardware security module. This method of returning the device to the factory for firmware update has the problems of high labor costs and long time consumption. Summary of the invention

[0004] The embodiments of the present application provide a firmware update method, a terminal device, and a server, which are used to enable the terminal device to actively communicate to obtain a firmware update package from the server to complete a local update of the firmware, without returning the device to the factory for processing, thereby reducing the time spent on firmware updates.

[0005] To achieve the above purpose, the technical solution of the embodiment of the present application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides a firmware update method, including:

[0007] In response to the firmware abnormality indication, generating a communication seed carrying the device identification based on the server public key;

[0008] Selecting a first algorithm from a first algorithm table, encrypting the current system time based on the first algorithm to obtain identity authentication information; wherein each encryption algorithm in the first algorithm table is provided with a corresponding index;

[0009] A firmware update request is generated and sent to a server according to a target index, the communication seed and the identity authentication information, so that the server sends a firmware update package; wherein the target index is an index of the first algorithm.

[0010] In an embodiment of the present application, the terminal device can obtain the firmware update package from the server by active communication, and then complete the local update of the firmware, without returning the device to the factory for processing, thereby reducing the time spent on firmware updates. During communication, the system time is encrypted based on the algorithm in the algorithm table shared with the server to generate corresponding identity authentication information. The selected algorithm is only notified to the server in the form of an index during communication. Therefore, even if the communication content is stolen, the attacker cannot intercept the actual algorithm used to complete the identity authentication, thereby improving the security of communications.

[0011] In a second aspect, an embodiment of the present application provides a firmware update method, including:

[0012] Receive a firmware update request from a terminal device; wherein the firmware update request includes a target index, a communication seed, and identity authentication information; the communication seed is generated by the terminal device based on a server public key; the identity authentication information is obtained by the terminal device using a first algorithm selected from a first algorithm table to encrypt the system time; the target index is an index of the first algorithm in the first algorithm table;

[0013] Based on the server private key corresponding to the server public key, obtaining the device identification of the terminal device from the communication seed;

[0014] Selecting a second algorithm from a plurality of pre-stored encryption algorithm tables based on the device identification, and acquiring the system time from the identity verification information according to the second algorithm;

[0015] If the difference between the system time and the reception time of the firmware update request message is less than the time threshold, a firmware update package is sent to the terminal device.

[0016] In the embodiment of the present application, the terminal device encrypts the system time based on the algorithm in the algorithm table shared with the server during the communication to generate the corresponding identity authentication information. The selected algorithm is only notified to the server in the form of an index during the communication. The server can find the encryption algorithm of the terminal device from the encryption algorithm table stored in itself according to the device identification of the terminal device and the target index sent by the terminal device. Then the system time is obtained from the identity authentication information. If the difference between the system time and the reception time of the firmware update request message received by the server is less than the time threshold, it indicates that the terminal device has not been attacked during the communication. At this time, the firmware update package can be sent to the terminal device, thereby improving the communication security.

[0017] In a third aspect, an embodiment of the present application further provides a firmware update device, including:

[0018] The data acquisition unit is configured to: generate a communication seed carrying a device identification based on a server public key in response to a firmware abnormality indication;

[0019] The verification information unit is configured to: select a first algorithm from a first algorithm table, encrypt the current system time based on the first algorithm, and obtain identity verification information; wherein each encryption algorithm in the first algorithm table is provided with a corresponding index;

[0020] The update request unit is configured to: generate a firmware update request to be sent to the server according to the target index, the communication seed and the identity authentication information, so that the server sends a firmware update package; wherein the target index is the index of the first algorithm.

[0021] In a fourth aspect, an embodiment of the present application further provides a firmware update device, including:

[0022] A request receiving unit, configured to: receive a firmware update request from a terminal device; wherein the firmware update request includes a target index, a communication seed, and identity authentication information; the communication seed is generated by the terminal device based on a server public key; the identity authentication information is obtained by encrypting the system time by the terminal device using a first algorithm selected from a first algorithm table; the target index is an index of the first algorithm in the first algorithm table;

[0023] an identification acquisition unit, configured to: acquire a device identification of the terminal device from the communication seed based on a server private key corresponding to the server public key;

[0024] A time acquisition unit is configured to: select a second algorithm from a plurality of pre-stored encryption algorithm tables based on the device identification, and acquire the system time from the identity authentication information according to the second algorithm;

[0025] The identity authentication unit is configured to: if the difference between the system time and the reception time of the firmware update request message is less than a time threshold, send a firmware update package to the terminal device.

[0026] In a fifth aspect, an embodiment of the present application further provides a terminal device, including a first transmission unit and a first processor;

[0027] The first transmission unit is configured to: receive a firmware abnormality indication;

[0028] The first processor is configured to: generate a communication seed carrying a device identification based on a server public key in response to a firmware abnormality indication;

[0029] Selecting a first algorithm from a first algorithm table, encrypting the current system time based on the first algorithm to obtain identity authentication information; wherein each encryption algorithm in the first algorithm table is provided with a corresponding index;

[0030] Generate an update package download request according to the target index, the communication seed and the identity authentication information;

[0031] The first transmission unit is further configured to: send the update package download request to the server, so that the server sends the firmware update package; wherein the target index is the index of the first algorithm.

[0032] In a sixth aspect, an embodiment of the present application further provides a server, including a second transmission unit and a second processor:

[0033] The second transmission unit is configured to: receive a firmware update request from a terminal device; wherein the firmware update request includes a target index, a communication seed, and identity authentication information; the communication seed is generated by the terminal device based on a server public key; the identity authentication information is obtained by encrypting the system time by the terminal device using a first algorithm selected from a first algorithm table; the target index is an index of the first algorithm in the first algorithm table;

[0034] The second processor is configured to: obtain a device identification of the terminal device from the communication seed based on a server private key corresponding to the server public key;

[0035] Based on the device identification, selecting a second algorithm from a plurality of pre-stored encryption algorithm tables;

[0036] Determine the system time based on the second algorithm and the identity authentication information;

[0037] The second transmission unit is further configured to: if the difference between the system time and the reception time of the firmware update request message is less than a time threshold, send a firmware update package to the terminal device.

[0038] In the seventh aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes any one of the methods in the first aspect or the second aspect.

[0039] In an eighth aspect, an embodiment of the present application provides a computer program product, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method described in any one of the first aspect or the second aspect.

[0040] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0042] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0043] Figure 2 The encryption algorithm provided in the embodiment of the present application is intended to represent;

[0044] Figure 3 A schematic diagram of the storage logic of the encryption algorithm table provided in the embodiment of the present application;

[0045] Figure 4 A communication sequence diagram between a terminal device and a server provided in an embodiment of the present application;

[0046] Figure 5 A flowchart of a terminal device sending a firmware update request provided in an embodiment of the present application;

[0047] Figure 6 A schematic diagram of the process of generating a message signature value provided in an embodiment of the present application;

[0048] Figure 7 A schematic diagram of the process of generating identity verification information provided in an embodiment of the present application;

[0049] Figure 8 A schematic diagram of the process of generating identity verification information provided in an embodiment of the present application;

[0050] Fig. 9 A flowchart of a server sending a firmware update package provided in an embodiment of the present application;

[0051] Fig.10 A schematic diagram of the structure of a firmware update device 100 provided in an embodiment of the present application;

[0052] Fig.11 A schematic diagram of the structure of a firmware update device 110 provided in an embodiment of the present application;

[0053] Fig.12A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0054] Fig.13 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0056] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0057] To facilitate understanding of the technical solution provided by this application, the following is a detailed description of the technical background:

[0058] As mentioned earlier, the hardware security module is a hardware module in the terminal device that is responsible for storing and processing high-security information and is usually used as the security root of trust for the terminal device.

[0059] Taking mobile phones as an example, currently most mobile phone manufacturers do not independently develop hardware security modules for mobile phones. Instead, they mostly cooperate with module providers to implant the hardware security modules provided by the module providers into the mobile phones before they leave the factory.

[0060] Since the hardware security module is implanted in the terminal device by the module provider before it leaves the factory, and the hardware security module has extremely high security requirements for the operating environment, when the hardware security module crashes or some permissions cannot be enabled during device operation, customers are often required to mail their phones to the phone manufacturer, who then returns the phone to the hardware provider for firmware updates. This firmware update method is complex, labor-intensive, and time-consuming.

[0061] To solve the above problems, the invention of the embodiment of the present application is as follows: the terminal device generates a communication seed carrying a device identification based on the server public key, and selects a first algorithm from the first algorithm table to encrypt the current system time based on the first algorithm to obtain identity authentication information. Each encryption algorithm in the first algorithm table is provided with a corresponding index, so that a firmware update request sent to the server can be generated according to the target index, communication seed and identity authentication information of the first algorithm, so that the server can send a firmware update package. In the above process, the terminal device can obtain a firmware update package from the server in an active communication manner to achieve a local update of the firmware, without returning the device to the factory for firmware update, saving costs and reducing update time, and during the communication period, the system time is encrypted based on the algorithm in the algorithm table shared with the server to generate corresponding identity authentication information, and the selected algorithm is only notified to the server in the form of an index during the communication period, so even if the communication content is stolen, the attacker cannot intercept the actual algorithm used to complete the identity authentication, thereby improving the communication security.

[0062] Figure 1 A schematic diagram of an application scenario of a firmware update method provided in an embodiment of the present application, such as Figure 1 As shown, the application scenario may include: a terminal device 101, a server 102, and a network 103;

[0063] Among them, the terminal device 101 can be a mobile phone, a laptop computer, a desktop computer, a game console and other devices; the server 102 can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers. The server 102 stores the firmware update package of the hardware security module implanted by the module provider for the terminal device 101.

[0064] The terminal device 101 and the server 102 may be directly or indirectly connected to each other through one or more networks 103. The network 103 may be a wired network or a wireless network, for example, a mobile cellular network or a wireless fidelity (Wireless-Fidelity, WIFI) network, or other possible networks, which are not limited in the present application.

[0065] In some embodiments, a hardware security module is provided in the body of the terminal device 101. When the user enables the hardware security module and there are situations such as some permissions cannot be enabled or the device crashes, a firmware exception indication may be sent to the terminal device 101. In response to the indication, the terminal device 101 actively initiates a firmware update request for the firmware of the hardware security module to the server 102 through the network 103.

[0066] In some embodiments, after receiving the firmware update request from the terminal device 101, the server 102 can authenticate the identity of the terminal device 101, and after the verification is passed, send the firmware update package to the terminal device 101 through the network 103. As a result, the terminal device can obtain the firmware update package from the server by active communication, and then complete the local update of the firmware, without returning the device to the factory for processing, thereby reducing the time spent on firmware updates.

[0067] It should be noted that Figure 1 The above is just an example. In fact, the number of terminal devices and servers is not limited, and is not specifically limited in the embodiments of the present application. In addition, in some scenarios, the terminal device 101 and the server 102 can also be the same device, that is, the functions of the terminal device 101 and the server 102 can be implemented by the same device.

[0068] For ease of understanding, the preprocessing stage between the terminal device and the server of this application is first introduced:

[0069] Trusted Execution Environment TEE of terminal device: A set of firmware update interfaces FirmwareUpdateTEEAPI are set in the trusted execution environment, which are used to call the firmware update program in the Android REE (Rich Execution Environment) environment, and then update the firmware of the hardware security module SE in the TEE environment. The server public key ServerEncKeyPub can be stored in the TEE environment of the terminal device, and the firmware update interface is used to interact with the server through the protocol.

[0070] Key setting on the terminal device side: Each smart terminal device is pre-fabricated with a unique asymmetric key pair when it leaves the factory. The key pair may include the device private key DeviceSignKeyPriv and the device public key DeviceSignKeyPub, which are used to digitally sign and verify the communication between the terminal device and the server. At the same time, the device public key DeviceSignKeyPub is stored in the device password management table of the server in a secure manner.

[0071] Key setting on the server side: The server pre-makes an RSA asymmetric key pair, including the server private key ServerEncKeyPriv and the server public key ServerEncKeyPub, which are used to protect the encrypted communication between the smart terminal device and the server, and can be used for both encryption and signing. The server public key ServerEncKeyPub is pre-made in the trusted execution environment TEE of the terminal device in a secure way.

[0072] The encryption algorithm table set is stored in the server and contains multiple encryption algorithm tables. Each encryption algorithm table can be Figure 2 As shown in the table, there are multiple encryption algorithms, and each encryption algorithm has a corresponding serial number, i.e., index, in the table. Figure 3 As shown, each encryption algorithm table corresponds to a terminal device. The encryption algorithm table and the device identification of the corresponding terminal device can be used as device reference identifications and stored in the server in association with the encryption algorithm table. In this way, the server can compare the device identification of the terminal device with the device reference identification associated with each encryption algorithm table, and then filter out the encryption algorithm table associated with the device reference identification that is the same as the device identification, thereby retrieving the encryption algorithm table corresponding to the terminal device.

[0073] In addition, the encryption algorithm table corresponding to each terminal device can be stored locally in the device, for example, it can be implanted in the terminal device when the terminal device is produced. The serial numbers of the multiple encryption algorithms in the encryption algorithm table corresponding to each terminal device can be randomly assigned, and the types of encryption algorithms contained in each encryption algorithm table can be the same or different, which is not limited in this application.

[0074] The image processing method provided by the exemplary embodiment of the present application is described below in combination with the application scenarios described above and with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation of the present application is not limited in this regard.

[0075] Figure 4 The terminal device 101 and the server 102 respectively execute a timing flow of a firmware update method provided in an embodiment of the present application, as shown in FIG. Figure 4 As shown, the following steps may be included:

[0076] Step 401: the terminal device 101 generates a firmware update request including identity authentication information based on a public key encryption algorithm, a current system time, and a first algorithm table pre-stored locally in response to a firmware abnormality indication;

[0077] Figure 5 The generation process of the firmware update request is shown in FIG. Figure 5 As shown, the following steps may be included:

[0078] Step 501: In response to a firmware abnormality indication, generate a communication seed carrying a device identification based on a server public key;

[0079] The firmware exception indication can be actively triggered by the user of the terminal device. For example, if it is found during the use of the device that some permissions of the hardware security module of the device cannot be enabled or the device crashes, a firmware exception indication can be issued to the terminal device, so that the terminal device sends a firmware update request to the server to request a firmware update package, and then completes the local update of the firmware.

[0080] In some embodiments, the target salt value Salt and the session seed SessionKeySeed may be concatenated to obtain a session message SessionKey; then, the server public key ServerEncKeyPub mentioned above is used to encrypt the session message SessionKey and the device identifier to obtain a communication seed EncSessionKeySeed.

[0081] The device identification is a unique identification of the terminal device, which can be generated by using part or a combination of the device's unique ID information such as the device model, device serial number, IMEI number, etc.

[0082] In some embodiments, the target salt value Salt and the session seed SessionKeySeed may be randomly generated by the terminal device, or may be pre-agreed with the server, which is not limited in this application.

[0083] Step 502: Select a first algorithm from a first algorithm table, encrypt the current system time based on the first algorithm, and obtain identity authentication information; wherein each encryption algorithm in the first algorithm table is provided with a corresponding index;

[0084] The foregoing Figure 2-Figure 3 As mentioned above, the server stores a set of encryption algorithm tables including multiple encryption algorithm tables, each encryption algorithm table corresponds to a terminal device, and the terminal device stores the corresponding encryption algorithm table locally. The first algorithm table of the embodiment of the present application is the encryption algorithm table stored locally on the terminal device, and the encryption algorithm table is synchronously stored in the server.

[0085] When implementing Figure 6 As shown, the current system time T1 is obtained, and the system time T1 and the communication seed EncSessionKeySeed obtained in the above step 501 are spliced ​​into an intermediate message TbsReqMessage. Further, a preset hash algorithm pre-agreed by the terminal device and the server is used to perform a hash operation on the intermediate message TbsReqMessage to obtain a first hash value H1, and the first hash value H1 is signed using the device private key DeviceSignKeyPriv of the terminal device itself to obtain a message signature value MessageSign.

[0086] Next, Figure 7As shown, a first algorithm for this encryption is selected from the first algorithm table. The intermediate message TbsReqMessage and the message signature value MessageSign are encrypted using the first algorithm to obtain the encrypted verification information ReqMessage. Further, the session seed SessionKeySeed is used to encrypt the intermediate message TbsReqMessage and the encrypted verification information ReqMessage to obtain the identity verification information EncReqMessage.

[0087] Step 503: Generate a firmware update request to be sent to a server according to a target index, the communication seed and the identity authentication information, so that the server sends a firmware update package; wherein the target index is an index of the first algorithm.

[0088] The foregoing Figure 2-Figure 3 As mentioned above, the various encryption algorithms in the encryption algorithm table are provided with corresponding indexes, and the target index of the embodiment of the present application is the index of the first algorithm in the first algorithm table.

[0089] In some embodiments, the target index, the communication seed EncSessionKeySeed obtained in the aforementioned step 501, and the identity authentication information EncReqMessage obtained in the aforementioned step 502 may be packaged together to generate a firmware update request FinalReqMessage sent to the server.

[0090] Step 402: The terminal device 101 sends a firmware update request to the server 102;

[0091] Step 403: The server 102 authenticates the firmware upgrade request;

[0092] Step 404: If the verification is successful, the server 102 sends a firmware update package to the terminal device 101;

[0093] Figure 8 The firmware update package distribution process is shown in FIG. Figure 8 As shown, the following steps may be included:

[0094] Step 801: obtaining a device identification of the terminal device from the communication seed based on a server private key corresponding to the server public key;

[0095] As mentioned in the aforementioned step 501, the communication seed EncSessionKeySeed is obtained by the terminal device using the pre-stored server public key ServerEncKeyPub to encrypt the session message SessionKey and the device identification.

[0096] Therefore, when executing step 801, the public key encryption algorithm can be used to decrypt the communication seed EncSessionKeySeed using the server private key corresponding to the server public key (ie, the ServerEncKeyPriv mentioned above) to obtain the device identification of the terminal device and the session message SessionKey.

[0097] Step 802: selecting a second algorithm from a plurality of pre-stored encryption algorithm tables based on the device identification, and obtaining the system time from the identity verification information according to the second algorithm;

[0098] The foregoing Figure 2-Figure 3 As mentioned above, each encryption algorithm table stored in the server corresponds to a terminal device, and the encryption algorithm table is bound to the device identification of the corresponding terminal device, so that the server can directly retrieve the encryption algorithm table corresponding to the terminal device through the device identification.

[0099] Therefore, it can be used Fig. 9 The process shown in the figure selects the second algorithm from the encryption algorithm table set pre-stored in the server. Fig. 9 As shown: N encryption algorithm tables stored in the server are associated with corresponding device reference identifiers S1 to S N The server obtains the device identification S of the terminal device through the aforementioned step 801 N After that, a second algorithm table corresponding to the same device reference identifier as the device identifier can be selected from the N encryption algorithm tables. Fig. 9 Shown with the logo S N The associated encryption algorithm table 3 is used as the second algorithm table.

[0100] The foregoing Figure 2-Figure 3 As mentioned above, each encryption algorithm table stored in the server is provided with a plurality of encryption algorithms, and each encryption algorithm is provided with a corresponding reference index in the encryption algorithm table to which it belongs. Since the first algorithm table of the terminal device coexists with the server, the content of the second algorithm table found in the above process is the same as the content of the first algorithm table stored in the terminal device. In other words, according to the target index sent by the terminal device, the first algorithm used by the terminal device for encryption can be found. During implementation, the algorithm with the same corresponding reference index as the target index in the second algorithm table can be used as the second algorithm, and the second algorithm is the same encryption algorithm as the first algorithm.

[0101] It should be noted that in the above process of determining the second algorithm, if there is no second algorithm table in the server whose corresponding device reference identifier is the same as the device identifier, or there is no algorithm in the second algorithm table whose corresponding reference index is the same as the target index, it indicates that the terminal device identity authentication has failed, and the process can jump to the subsequent step 406.

[0102] Next, the system time is obtained from the identity verification information according to the second algorithm. Figure 6-Figure 7 As mentioned above, when generating identity authentication information, the terminal device needs to concatenate the system time T1 and the communication seed EncSessionKeySeed into an intermediate message TbsReqMessage, and use the first algorithm to encrypt the intermediate message TbsReqMessage and the message signature value MessageSign to obtain the encrypted authentication information ReqMessage. Then, the encrypted authentication information ReqMessage is encrypted using the session seed SessionKeySeed to obtain the identity authentication information EncReqMessage.

[0103] It can be seen that if you want to obtain the system time T1, you need to first use the session seed SessionKeySeed to decrypt the encrypted verification message ReqMessage from the identity verification message EncReqMessage. Then use the second algorithm that is the same as the first algorithm to decrypt the encrypted verification message ReqMessage to obtain the system time T1 from the decrypted intermediate message TbsReqMessage.

[0104] Since the session seed SessionKeySeed is unknown information on the server side, the session seed SessionKeySeed can be obtained from the firmware update request FinalReqMessage in the following way:

[0105] As mentioned in the above step 501, the target salt value Salt and the session seed SessionKeySeed of the embodiment of the present application can be generated by the terminal device itself, or can be pre-agreed between the terminal device and the server. To further improve the communication security, multiple reference salt values ​​can be stored in the server, and each reference salt value has a corresponding salt value reference identifier.

[0106] In some embodiments, each reference salt value may correspond to a unique terminal device, and the salt value reference identifier corresponding to each reference salt value is the device identifier of the terminal device corresponding to the reference salt value.

[0107] During implementation, the server private key ServerEncKeyPriv can be used to decrypt the communication seed EncSessionKeySeed to obtain the device identifier of the terminal device and the session message SessionKey. Then, from the multiple reference salt values ​​pre-stored in the server, select the candidate salt value whose corresponding salt value reference identifier is the same as the device identifier. That is, find the salt value reference identifier that is the same as the device identifier of the terminal device, and the reference salt value corresponding to the salt value reference identifier is the candidate salt value.

[0108] It should be understood that if the salt value reference identifier is the same as the device identifier of the terminal device, then the reference salt value corresponding to this salt value reference identifier is the same salt value as the target salt value Salt used by the terminal device when generating the session message SessionKey. Since the session message SessionKey is obtained by the terminal device concatenating the target salt value Salt and the session seed SessionKeySeed, and the above text has explained that the concatenation rule is known to the server, after the server obtains the candidate salt value through the above process, it can separate the candidate salt value from the session message SessionKey based on the known concatenation rule, and then obtain the session seed SessionKeySeed.

[0109] Next, the session seed SessionKeySeed is used to decrypt the identity verification message EncReqMessage to obtain the encrypted verification message ReqMessage. Then, the second algorithm, which is the same as the first algorithm, is used to obtain the system time T1 from the encrypted verification message ReqMessage.

[0110] In some embodiments, the second algorithm may be used to decrypt the encrypted verification information ReqMessage to obtain the intermediate message TbsReqMessage and the message signature value MessageSign; then the communication seed EncSessionKeySeed is separated from the intermediate message TbsReqMessage to obtain the system time T1.

[0111] Step 803: If the difference between the system time and the reception time of the firmware update request message is less than the time threshold, a firmware update package is sent to the terminal device.

[0112] As mentioned above, system time T1 is the system time read during the terminal device's generation of a firmware update request. If an attack occurs during communication, it will take a certain amount of time for the attacker to decrypt and steal the communication information. Therefore, a reasonable time threshold can be set in advance.

[0113] When the time difference between the system time T1 and the time when the server receives the firmware update request is less than the time threshold, it indicates that the terminal device has not been attacked during the communication period, and the firmware update package can be sent to the terminal device. Otherwise, it is determined that the identity authentication of the terminal device has failed, and there may be an attacker impersonating, and if it is determined that the identity authentication has failed, jump to the subsequent step 406.

[0114] In some embodiments, before sending the firmware update package to the terminal device, the terminal device may be authenticated again based on the message signature value MessageSign.

[0115] The foregoing Figure 6-Figure 7As mentioned above, the terminal device uses its own device private key DeviceSignKeyPriv to sign the first hash value H1 to obtain the message signature value MessageSign. The first hash value H1 is obtained by the terminal device using the hash algorithm pre-agreed with the server to perform a hash operation on the intermediate message TbsReqMessage.

[0116] Since the server knows the device public key of the terminal device, after the server uses the second algorithm to decrypt the encrypted verification information ReqMessage and obtains the intermediate message TbsReqMessage and the message signature value MessageSign, it can use the hash algorithm pre-agreed with the terminal device to perform a hash operation on the intermediate message TbsReqMessage, and the operation result is the first hash value H1.

[0117] Then, the device public key DeviceSignKeyPub is used to verify the message signature value MessageSign to obtain a second hash value H2. If the second hash value H2 is the same as the first hash value H1, it indicates that the terminal device identity authentication is successful, otherwise jump to the subsequent step 406.

[0118] Step 405: The terminal device 101 receives the firmware update package and performs a firmware update on the hardware security module.

[0119] In the TEE environment, the terminal device enables the firmware update permission of the hardware security module and uses the firmware update package to update the SE firmware. After the firmware update is completed, the terminal device restarts and boots normally into the terminal device system. The built-in firmware update program of the terminal device can notify the server that the firmware update is successful.

[0120] Step 406: If the verification fails, determine whether the number of verification failures within a specified period is greater than a number threshold;

[0121] Step 407: If the number is not greater than the threshold, an indication indicating resending the firmware update request is sent to the terminal device 101, so that the terminal device 101 re-executes the aforementioned step 401 and resends the firmware update request to the server 102;

[0122] Step 408: If the number is greater than the threshold, an indication is sent to the terminal device 101 indicating that the verification failed and the device needs to be returned to the factory for firmware update, so as to inform the terminal device 101 to return to the factory for firmware update.

[0123] In steps 406 to 408, the server will record the number of times the terminal device's identity authentication fails within a specified time period (for example, 1 hour), and will send an indication to the terminal device for each authentication failure to resend the firmware update request. The indication requires the terminal device to have the aforementioned firmware update request generation process, regenerate a new firmware update request and send it to the server, so that the server repeats the aforementioned identity authentication process for the resent firmware update request, and sends the firmware update package to the terminal device after successful authentication.

[0124] In some embodiments, if the terminal device fails verification too many times within a specified time period, indicating that the terminal device is at risk of being attacked and the device itself cannot escape the attack, the server will send an indication of verification failure to the terminal device, forcing the terminal device to return to the factory for a firmware update, thereby ensuring the security of the firmware.

[0125] In the above process, the terminal device can use active communication to send a firmware update request to the server to request a firmware update package, and then complete the local update of the firmware. There is no need to return the device to the factory for processing, which reduces the time spent on firmware updates. During communication, the system time is encrypted based on the algorithm in the algorithm table shared with the server to generate corresponding identity authentication information. The selected algorithm is only notified to the server in the form of an index during communication. Therefore, even if the communication content is stolen, the attacker cannot intercept the actual algorithm used to complete the identity authentication, thereby improving communication security.

[0126] Based on the same inventive concept, the present application embodiment also provides a firmware update device 100, specifically, Fig.10 As shown, including:

[0127] The data acquisition unit 101 is configured to: generate a communication seed carrying a device identification based on a server public key in response to a firmware abnormality indication;

[0128] The verification information unit 102 is configured to: select a first algorithm from a first algorithm table, encrypt the current system time based on the first algorithm, and obtain identity authentication information; wherein each encryption algorithm in the first algorithm table is provided with a corresponding index;

[0129] The update request unit 103 is configured to generate a firmware update request to be sent to the server according to the target index, the communication seed and the identity authentication information, so that the server sends a firmware update package; wherein the target index is the index of the first algorithm.

[0130] In some embodiments, to generate the communication seed including the device identification based on the server public key, the data acquisition unit 101 is specifically configured as follows:

[0131] Concatenate the target salt value and session seed agreed with the server to obtain the session message;

[0132] The session message and the device identification are encrypted using the server public key to obtain the communication seed.

[0133] In some embodiments, the encryption of the current system time based on the first algorithm is performed to obtain identity authentication information, and the authentication information unit 102 is specifically configured as follows:

[0134] splicing the system time and the communication seed into an intermediate message, and performing a preset hash operation on the intermediate message to obtain a first hash value;

[0135] Using the device private key of the terminal device to sign the first hash value to obtain a message signature value; and using the first algorithm to encrypt the intermediate message and the message signature value to obtain encrypted verification information;

[0136] The encrypted verification information is encrypted using the session seed to obtain the identity verification information.

[0137] In some embodiments, the update request unit 103 is further configured to:

[0138] receiving the firmware update package;

[0139] In a trusted execution environment, the firmware update permission of the security module SE is enabled, and the firmware update package is used to perform firmware update on the SE.

[0140] Based on the same inventive concept, the present application embodiment also provides a firmware update device 110, specifically as follows: Fig.11 As shown, including:

[0141] The request receiving unit 111 is configured to: receive a firmware update request from a terminal device; wherein the firmware update request includes a target index, a communication seed, and identity authentication information; the communication seed is generated by the terminal device based on a server public key; the identity authentication information is obtained by encrypting the system time by the terminal device using a first algorithm selected from a first algorithm table; the target index is an index of the first algorithm in the first algorithm table;

[0142] The identification acquisition unit 112 is configured to: acquire the device identification of the terminal device from the communication seed based on the server private key corresponding to the server public key;

[0143] The time acquisition unit 113 is configured to: select a second algorithm from a plurality of pre-stored encryption algorithm tables based on the device identification, and acquire the system time from the identity authentication information according to the second algorithm;

[0144] The identity authentication unit 114 is configured to: if the difference between the system time and the reception time of the firmware update request message is less than a time threshold, send a firmware update package to the terminal device.

[0145] In some embodiments, each of the pre-stored encryption algorithm tables is provided with a corresponding device reference identifier; and to perform the selecting of the second algorithm from the pre-stored multiple encryption algorithm tables based on the device identifier, the time acquisition unit 113 is specifically configured as follows:

[0146] From the plurality of encryption algorithm tables, select a second algorithm table whose corresponding device reference identifier is the same as the device identifier; wherein each encryption algorithm in each encryption algorithm table is provided with a corresponding reference index;

[0147] The algorithm in the second algorithm table whose corresponding reference index is the same as the target index is used as the second algorithm.

[0148] In some embodiments, the server stores a plurality of reference salt values, each of which is provided with a corresponding salt value reference identifier; the identification obtaining unit 112 is specifically configured as follows:

[0149] The communication seed is decrypted using the server private key to obtain the device identification and session message; wherein the session message is obtained by concatenating the target salt value agreed upon by the terminal device with the server and the session seed.

[0150] In some embodiments, the time acquisition unit 113 is specifically configured to:

[0151] Selecting a candidate salt value whose corresponding salt value reference identifier is the same as the device identifier from the multiple reference salt values, and separating the candidate salt value from the session message to obtain the session seed;

[0152] Decrypting the identity verification message using the session seed to obtain an encrypted verification message;

[0153] Based on the second algorithm, the system time is obtained from the encrypted verification message.

[0154] In some embodiments, the system time is obtained from the identity authentication information according to the second algorithm, and the time acquisition unit 113 is specifically configured as follows:

[0155] Decrypting the encrypted verification information using the second algorithm to obtain an intermediate message and a message signature value; wherein the intermediate message is obtained by concatenating the system time and the communication seed; the message signature value is obtained by the terminal device signing the first hash value using its own device private key; the first hash value is obtained by performing a preset hash operation on the intermediate message;

[0156] Separating the communication seed from the intermediate message to obtain the system time;

[0157] In some embodiments, the identity verification unit 114 is further configured to:

[0158] Performing a preset hash operation on the intermediate message to obtain the first hash value, and using the device public key corresponding to the device private key to verify the message signature value to obtain a second hash value;

[0159] When the second hash value is the same as the first hash value, a firmware update package is sent to the terminal device; wherein the second hash value is obtained by verifying the message signature value using the device public key corresponding to the device private key.

[0160] Based on the same inventive concept, the present application embodiment also provides a terminal device, specifically as follows Fig.12 As shown, it includes a first transmission unit 121 and a first processor 122;

[0161] The first transmission unit 121 is configured to: receive a firmware abnormality indication;

[0162] The first processor 122 is configured to: generate a communication seed carrying a device identification based on a server public key in response to a firmware abnormality indication;

[0163] Selecting a first algorithm from a first algorithm table, encrypting the current system time based on the first algorithm to obtain identity authentication information; wherein each encryption algorithm in the first algorithm table is provided with a corresponding index;

[0164] Generate an update package download request according to the target index, the communication seed and the identity authentication information;

[0165] The first transmission unit is further configured to: send the update package download request to the server, so that the server sends the firmware update package; wherein the target index is the index of the first algorithm.

[0166] In some embodiments, to perform the generation of the communication seed including the device identification based on the server public key, the first processor 122 is specifically configured to:

[0167] Concatenate the target salt value and session seed agreed with the server to obtain the session message;

[0168] The session message and the device identification are encrypted using the server public key to obtain the communication seed.

[0169] In some embodiments, to perform the encryption of the current system time based on the first algorithm to obtain the identity authentication information, the first processor 122 is specifically configured to:

[0170] splicing the system time and the communication seed into an intermediate message, and performing a preset hash operation on the intermediate message to obtain a first hash value;

[0171] Using the device private key of the terminal device to sign the first hash value to obtain a message signature value; and using the first algorithm to encrypt the intermediate message and the message signature value to obtain encrypted verification information;

[0172] The encrypted verification information is encrypted using the session seed to obtain the identity verification information.

[0173] In some embodiments, the first processor 122 is further configured to:

[0174] receiving the firmware update package;

[0175] In a trusted execution environment, the firmware update permission of the security module SE is enabled, and the firmware update package is used to perform firmware update on the SE.

[0176] Based on the same inventive concept, the embodiment of the present application also provides a server, specifically as follows Fig.13 As shown, it includes a second transmission unit 131 and a second processor 132;

[0177] The second transmission unit 131 is configured to: receive a firmware update request from a terminal device; wherein the firmware update request includes a target index, a communication seed, and identity authentication information; the communication seed is generated by the terminal device based on a server public key; the identity authentication information is obtained by encrypting the system time using a first algorithm selected from a first algorithm table by the terminal device; the target index is an index of the first algorithm in the first algorithm table;

[0178] The second processor 132 is configured to: obtain a device identification of the terminal device from the communication seed based on a server private key corresponding to the server public key;

[0179] Based on the device identification, selecting a second algorithm from a plurality of pre-stored encryption algorithm tables;

[0180] Determine the system time based on the second algorithm and the identity authentication information;

[0181] The second transmission unit is further configured to: if the difference between the system time and the reception time of the firmware update request message is less than a time threshold, send a firmware update package to the terminal device.

[0182] In some embodiments, each of the pre-stored encryption algorithm tables is provided with a corresponding device reference identifier; to perform the selecting of the second algorithm from the pre-stored multiple encryption algorithm tables based on the device identifier, the second processor 132 is specifically configured as follows:

[0183] From the plurality of encryption algorithm tables, select a second algorithm table whose corresponding device reference identifier is the same as the device identifier; wherein each encryption algorithm in each encryption algorithm table is provided with a corresponding reference index;

[0184] The algorithm in the second algorithm table whose corresponding reference index is the same as the target index is used as the second algorithm.

[0185] In some embodiments, the server stores a plurality of reference salt values, each reference salt value is provided with a corresponding salt value reference identifier; and the second processor 132 is specifically configured to:

[0186] The communication seed is decrypted using the server private key to obtain the device identification and session message; wherein the session message is obtained by concatenating the target salt value agreed upon by the terminal device with the server and the session seed.

[0187] In some embodiments, the second processor 132 is specifically configured to:

[0188] Selecting a candidate salt value whose corresponding salt value reference identifier is the same as the device identifier from the multiple reference salt values, and separating the candidate salt value from the session message to obtain the session seed;

[0189] Decrypting the identity verification message using the session seed to obtain an encrypted verification message;

[0190] Based on the second algorithm, the system time is obtained from the encrypted verification message.

[0191] In some embodiments, the obtaining the system time from the identity authentication information according to the second algorithm, the second processor 132 is specifically configured to:

[0192] Decrypting the encrypted verification information using the second algorithm to obtain an intermediate message and a message signature value; wherein the intermediate message is obtained by concatenating the system time and the communication seed; the message signature value is obtained by the terminal device signing the first hash value using its own device private key; the first hash value is obtained by performing a preset hash operation on the intermediate message;

[0193] Separating the communication seed from the intermediate message to obtain the system time;

[0194] In some embodiments, the second processor 132 is further configured to:

[0195] Performing a preset hash operation on the intermediate message to obtain the first hash value, and using the device public key corresponding to the device private key to verify the message signature value to obtain a second hash value;

[0196] When the second hash value is the same as the first hash value, a firmware update package is sent to the terminal device; wherein the second hash value is obtained by verifying the message signature value using the device public key corresponding to the device private key.

[0197] The embodiment of the present application also provides a computer storage medium, in which computer program instructions are stored. When the instructions are executed on a computer, the computer executes any step in any of the above-mentioned firmware updating methods.

[0198] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0199] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0200] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0201] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0202] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A firmware update method, characterized in that: Applied to a terminal device, the method comprises: In response to the firmware abnormality indication, generating a communication seed carrying the device identification based on the server public key; Selecting a first algorithm from a first algorithm table, encrypting the current system time based on the first algorithm to obtain identity authentication information; wherein each encryption algorithm in the first algorithm table is provided with a corresponding index; A firmware update request is generated and sent to a server according to a target index, the communication seed and the identity authentication information, so that the server sends a firmware update package; wherein the target index is an index of the first algorithm.

2. The method according to claim 1, characterized in that The generating of a communication seed including a device identification based on a server public key comprises: Concatenate the target salt value and session seed agreed with the server to obtain the session message; The session message and the device identification are encrypted using the server public key to obtain the communication seed.

3. The method according to claim 2, characterized in that The encrypting the current system time based on the first algorithm to obtain identity authentication information includes: splicing the system time and the communication seed into an intermediate message, and performing a preset hash operation on the intermediate message to obtain a first hash value; Using the device private key of the terminal device to sign the first hash value to obtain a message signature value; and using the first algorithm to encrypt the intermediate message and the message signature value to obtain encrypted verification information; The encrypted verification information is encrypted using the session seed to obtain the identity verification information.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: receiving the firmware update package; In a trusted execution environment, the firmware update permission of the security module SE is enabled, and the firmware update package is used to perform firmware update on the SE.

5. A firmware update method, characterized in that: Applied to a server, the method comprises: Receive a firmware update request from a terminal device; wherein the firmware update request includes a target index, a communication seed, and identity authentication information; the communication seed is generated by the terminal device based on a server public key; the identity authentication information is obtained by the terminal device using a first algorithm selected from a first algorithm table to encrypt the system time; the target index is an index of the first algorithm in the first algorithm table; Based on the server private key corresponding to the server public key, obtaining the device identification of the terminal device from the communication seed; Selecting a second algorithm from a plurality of pre-stored encryption algorithm tables based on the device identification, and acquiring the system time from the identity verification information according to the second algorithm; If the difference between the system time and the reception time of the firmware update request message is less than the time threshold, a firmware update package is sent to the terminal device.

6. The method according to claim 5, characterized in that Each of the pre-stored encryption algorithm tables is provided with a corresponding device reference identifier; The selecting a second algorithm from a plurality of pre-stored encryption algorithm tables based on the device identification includes: From the plurality of encryption algorithm tables, select a second algorithm table whose corresponding device reference identifier is the same as the device identifier; wherein each encryption algorithm in each encryption algorithm table is provided with a corresponding reference index; The algorithm in the second algorithm table whose corresponding reference index is the same as the target index is used as the second algorithm.

7. The method according to claim 5, characterized in that The server stores a plurality of reference salt values, each of which is provided with a corresponding salt value reference identifier; The obtaining the device identification of the terminal device from the communication seed based on the server private key corresponding to the server public key includes: Decrypting the communication seed using the server private key to obtain the device identification and session message; wherein the session message is obtained by concatenating the target salt value agreed upon by the terminal device with the server and the session seed; The acquiring the system time from the identity authentication information based on the second algorithm includes: Selecting a candidate salt value whose corresponding salt value reference identifier is the same as the device identifier from the multiple reference salt values, and separating the candidate salt value from the session message to obtain the session seed; Decrypting the identity verification message using the session seed to obtain an encrypted verification message; Based on the second algorithm, the system time is obtained from the encrypted verification message.

8. The method according to claim 7, characterized in that The obtaining the system time from the identity authentication information according to the second algorithm includes: Decrypting the encrypted verification information using the second algorithm to obtain an intermediate message and a message signature value; wherein the intermediate message is obtained by concatenating the system time and the communication seed; the message signature value is obtained by the terminal device signing the first hash value using its own device private key; the first hash value is obtained by performing a preset hash operation on the intermediate message; Separating the communication seed from the intermediate message to obtain the system time; The method further includes: performing a preset hash operation on the intermediate message to obtain the first hash value, and verifying the message signature value using a device public key corresponding to the device private key to obtain a second hash value; When the second hash value is the same as the first hash value, a firmware update package is sent to the terminal device; wherein the second hash value is obtained by verifying the message signature value using the device public key corresponding to the device private key.

9. A terminal device, characterized in that: comprising a first transmission unit and a first processor; The first transmission unit is configured to: receive a firmware abnormality indication; The first processor is configured to: generate a communication seed carrying a device identification based on a server public key in response to a firmware abnormality indication; Selecting a first algorithm from a first algorithm table, encrypting the current system time based on the first algorithm to obtain identity authentication information; wherein each encryption algorithm in the first algorithm table is provided with a corresponding index; Generate an update package download request according to the target index, the communication seed and the identity authentication information; The first transmission unit is further configured to: send the update package download request to the server, so that the server sends the firmware update package; wherein the target index is the index of the first algorithm.

10. A server, characterized in that: Comprising a second transmission unit and a second processor: The second transmission unit is configured to: receive a firmware update request from a terminal device; wherein the firmware update request includes a target index, a communication seed, and identity authentication information; the communication seed is generated by the terminal device based on a server public key; the identity authentication information is obtained by encrypting the system time by the terminal device using a first algorithm selected from a first algorithm table; the target index is an index of the first algorithm in the first algorithm table; The second processor is configured to: obtain a device identification of the terminal device from the communication seed based on a server private key corresponding to the server public key; Selecting a second algorithm from a plurality of pre-stored encryption algorithm tables based on the device identification, and acquiring the system time from the identity verification information according to the second algorithm; The second transmission unit is further configured to: if the difference between the system time and the reception time of the firmware update request message is less than a time threshold, send a firmware update package to the terminal device.

Citation Information

Cited By

  • Firmware security updating method and device for Internet of Things equipment

    CN120653283A