A terminal upgrade method and terminal
Patent Information
- Application Number
- CN202611093509.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]目前的终端设备普遍采用的在线升级方式缺乏文件验证,虽然现有的HTTPS协议通过传输层加密,但是缺少独立于传输通道的文件验证手段,可能下载到被篡改的升级包;另外终端与服务器之间缺少密钥协商机制,密钥一旦泄露将影响所有终端设备的安全
[0022]与现有技术相比,本发明的优点在于:终端在每次升级会话中动态生成非对称密钥对,升级服务器基于本次公钥加密返回会话密钥片段,无需在终端预置长期共享密钥,即使单次会话信息被分析,也不影响其他终端及其他次升级会话的安全,因此通过会话级密钥协商,降低长期密钥泄露风险;将版本查询阶段与文件下载阶段独立认证,降低升级链路被跨阶段攻击的风险,通过检验后才允许执行终端设备升级,增强升级链路安全性;另外通过终端对本地升级文件进行校验,只有本地升级文件的校验信息与解密校验码一致才能启动升级,确保下载文件安全性。
Smart Images

Figure CN122987013A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of terminal upgrade technology, and in particular to a terminal upgrade method and a terminal. Background Technology
[0002] During use, terminals usually require continuous upgrades to add new features or fix existing problems.
[0003] Current online upgrade methods commonly used by terminal devices lack file verification. Although existing HTTPS protocols use transport layer encryption, they lack file verification mechanisms independent of the transmission channel, potentially leading to the download of tampered upgrade packages. Furthermore, the lack of a key negotiation mechanism between the terminal and the server means that a leaked key will compromise the security of all terminal devices. Therefore, further improvements to existing technologies are necessary. Summary of the Invention
[0004] The first technical problem to be solved by the present invention is to provide a terminal upgrade method that can perform file verification and enhance upgrade security, in contrast to the above-mentioned prior art.
[0005] The second technical problem to be solved by the present invention is to provide a terminal that applies the above-mentioned upgrade method.
[0006] The technical solution adopted by the present invention to solve the first technical problem mentioned above is: a terminal upgrade method, characterized by comprising the following steps:
[0007] Step 1: Dynamically generate an asymmetric key pair locally on the terminal to construct the first authentication information. The terminal sends a version query request to the upgrade server. The request header of the version query request must contain at least the first authentication information.
[0008] Step 2: After receiving the version query request from the terminal, the upgrade server first verifies whether the first authentication information is valid. If the first authentication information is valid, the server returns the fragmented session key and encryption verification code to the terminal.
[0009] Step 3: After receiving the fragmented session key and encryption verification code returned by the upgrade server, the terminal processes the fragmented session key to obtain the symmetric key for this upgrade session, and then uses the symmetric key for this upgrade session to symmetrically decrypt the encryption verification code to obtain the decryption verification code.
[0010] Step 4: Construct the second authentication information on the terminal. The terminal sends a file download request to the upgrade server. The request header of the file download request must contain at least the second authentication information.
[0011] Step 5: After receiving the file download request from the terminal, the upgrade server first verifies whether the second authentication information is valid. If the second authentication information is valid, the upgrade server will download the upgrade file to the specified path on the terminal.
[0012] Step 6: The terminal verifies the local upgrade file and determines whether the verification information of the local upgrade file matches the decryption verification code. If they match, the upgrade is initiated; otherwise, the upgrade is rejected.
[0013] Preferably, in step 1, the asymmetric key pair includes a public key and a private key. The private key is stored locally on the terminal and can only be used once. The modulus and exponent of the public key are extracted on the terminal.
[0014] To reduce the risk of information exposure, the first authentication information is constructed as follows: a first authentication string is constructed according to the rule of "first agreed preset value + first random number + first timestamp + first request parameter", and the first authentication string is hashed to obtain the first authentication information; the first request parameter includes at least the modulus of the public key, the exponent of the public key, the terminal identification code, the terminal serial number and the current version number of the terminal.
[0015] To reduce the risk of forged version query requests, the request header of the version query request also carries a first random number and a first timestamp.
[0016] To enhance the protection of verification information, the fragmented session key in step 2 includes a first key fragment and a second key fragment. The first key fragment is returned after being encrypted with a public key, and the second key fragment is returned in plaintext.
[0017] Preferably, the specific method for obtaining the symmetric key for this upgrade session in step 3 is as follows: the terminal uses its local private key to decrypt the first key fragment, and then concatenates the decrypted first key fragment with the second key fragment to obtain the symmetric key for this upgrade session.
[0018] Preferably, the encryption verification code in step 2 is the result of encrypting the upgrade file digest using the symmetric key in the upgrade server.
[0019] To further reduce the risk of information exposure, the second authentication information in step 4 is constructed as follows: the second authentication string is constructed according to the rule of "second agreed preset value + second random number + second timestamp + second request parameter", and the second authentication string is hashed to obtain the second authentication information; the second request parameter includes at least the upgrade file name.
[0020] To reduce the risk of forged file download requests, the request header of the file download request also carries a second random number and a second timestamp.
[0021] The technical solution adopted by the present invention to solve the second technical problem mentioned above is: a terminal, characterized in that: it is upgraded by applying the terminal upgrade method described above.
[0022] Compared with existing technologies, the advantages of this invention are as follows: The terminal dynamically generates an asymmetric key pair in each upgrade session. The upgrade server encrypts and returns a session key fragment based on the public key used in this session. This eliminates the need to pre-configure a long-term shared key on the terminal. Even if information from a single session is analyzed, it does not affect the security of other terminals or subsequent upgrade sessions. Therefore, session-level key negotiation reduces the risk of long-term key leakage. Independent authentication of the version query stage and the file download stage reduces the risk of cross-stage attacks on the upgrade chain. Only after verification is the terminal device upgrade allowed, enhancing the security of the upgrade chain. Furthermore, the terminal verifies the local upgrade file; the upgrade can only be initiated if the verification information of the local upgrade file matches the decrypted verification code, ensuring the security of the downloaded file. Attached Figure Description
[0023] Figure 1 This is a flowchart of the terminal upgrade method in an embodiment of the present invention. Detailed Implementation
[0024] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0025] The terminal application in this embodiment has the following terminal upgrade method. The terminal is usually a PC device, but it can also be a printer device.
[0026] like Figure 1 As shown, the terminal upgrade method in this embodiment includes the following steps:
[0027] Step 1: Dynamically generate an asymmetric key pair locally on the terminal to construct the first authentication information. The terminal sends a version query request to the upgrade server. The request header of the version query request must contain at least the first authentication information.
[0028] Step 2: After receiving the version query request from the terminal, the upgrade server first verifies whether the first authentication information is valid. If the first authentication information is valid, the server returns the fragmented session key and encryption verification code to the terminal.
[0029] In this embodiment, the encryption verification code is the result of encrypting the upgrade file digest using the symmetric key in the upgrade server;
[0030] Step 3: After receiving the fragmented session key and encryption verification code returned by the upgrade server, the terminal processes the fragmented session key to obtain the symmetric key for this upgrade session, and then uses the symmetric key for this upgrade session to symmetrically decrypt the encryption verification code to obtain the decryption verification code.
[0031] Step 4: Construct the second authentication information on the terminal. The terminal sends a file download request to the upgrade server. The request header of the file download request must contain at least the second authentication information.
[0032] Step 5: After receiving the file download request from the terminal, the upgrade server first verifies whether the second authentication information is valid. If the second authentication information is valid, the upgrade server will download the upgrade file to the specified path on the terminal.
[0033] Step 6: The terminal verifies the local upgrade file and determines whether the verification information of the local upgrade file matches the decryption verification code. If they match, the upgrade is initiated; otherwise, the upgrade is rejected. In this embodiment, the verification information of the local upgrade file is generated by the terminal based on the local upgrade file. The method of generating this verification information is a well-known prior art and will not be elaborated further here.
[0034] In this embodiment, the asymmetric key pair includes a public key and a private key. The private key is stored locally on the terminal and can only be used once. The modulus and exponent of the public key are extracted on the terminal.
[0035] In this embodiment, the first authentication information in step 1 is constructed as follows: the first authentication string is constructed according to the rule of "first agreed preset value + first random number + first timestamp + first request parameter", and the first authentication string is hashed to obtain the first authentication information; the first request parameter includes at least the modulus of the public key, the exponent of the public key, the terminal identification code, the terminal serial number and the current version number of the terminal; in this embodiment, the request header of the version query request also carries the first random number and the first timestamp.
[0036] In this embodiment, the second authentication information in step 4 is constructed as follows: a second authentication string is constructed according to the rule of "second agreed preset value + second random number + second timestamp + second request parameter," and a hash operation is performed on the second authentication string to obtain the second authentication information; the second request parameter includes at least the upgrade file name. The request header of the file download request also carries a second random number and a second timestamp.
[0037] By constructing authentication information using different request parameters for the version query phase and the file download phase, and by employing independent random numbers and timestamps for each phase, the risk of cross-phase forged requests is reduced. Furthermore, this two-stage independent authentication enhances the security of the upgrade process.
[0038] In this embodiment, the fragmented session key in step 2 includes a first key fragment and a second key fragment. The first key fragment is encrypted using a public key and returned, while the second key fragment is returned in plaintext. By splitting the session key into a public key encrypted fragment and a plaintext fragment, only the terminal holding the corresponding private key can completely restore the session key. This makes it difficult for attackers to recover the complete key by intercepting only part of the response data, thereby enhancing the protection strength of the verification information and improving the key protection capability.
[0039] In step 3, the symmetric key for this upgrade session is obtained as follows: the terminal uses its local private key to decrypt the first key fragment, and then concatenates the decrypted first key fragment with the second key fragment to obtain the symmetric key for this upgrade session.
[0040] The first key fragment is returned as a numerical array, where each element corresponds to a byte in the session key after asymmetric encryption. The terminal decrypts the first key fragment block by block using its local private key.
[0041] The terminal dynamically generates an asymmetric key pair during each upgrade session. The upgrade server encrypts and returns a session key fragment based on this public key, eliminating the need for a pre-configured long-term shared key on the terminal. Even if information from a single session is analyzed, it does not affect the security of other terminals or subsequent upgrade sessions. Therefore, session-level key negotiation reduces the risk of long-term key leakage.
[0042] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A terminal upgrade method, characterized in that... Includes the following steps: Step 1: Dynamically generate an asymmetric key pair locally on the terminal to construct the first authentication information. The terminal sends a version query request to the upgrade server. The request header of the version query request must contain at least the first authentication information. Step 2: After receiving the version query request from the terminal, the upgrade server first verifies whether the first authentication information is valid. If the first authentication information is valid, the server returns the fragmented session key and encryption verification code to the terminal. Step 3: After receiving the fragmented session key and encryption verification code returned by the upgrade server, the terminal processes the fragmented session key to obtain the symmetric key for this upgrade session, and then uses the symmetric key for this upgrade session to symmetrically decrypt the encryption verification code to obtain the decryption verification code. Step 4: Construct the second authentication information on the terminal. The terminal sends a file download request to the upgrade server. The request header of the file download request must contain at least the second authentication information. Step 5: After receiving the file download request from the terminal, the upgrade server first verifies whether the second authentication information is valid. If the second authentication information is valid, the upgrade server will download the upgrade file to the specified path on the terminal. Step 6: The terminal verifies the local upgrade file and determines whether the verification information of the local upgrade file matches the decryption verification code. If they match, the upgrade is initiated; otherwise, the upgrade is rejected.
2. The terminal upgrade method according to claim 1, characterized in that: In step 1, the asymmetric key pair includes a public key and a private key. The private key is stored locally on the terminal and can only be used once. The modulus and exponent of the public key are extracted on the terminal.
3. The terminal upgrade method according to claim 2, characterized in that: The first authentication information is constructed as follows: a first authentication string is constructed according to the rule of "first agreed preset value + first random number + first timestamp + first request parameter", and a hash operation is performed on the first authentication string to obtain the first authentication information; The first request parameters should include at least the modulus of the public key, the exponent of the public key, the terminal identification code, the terminal serial number, and the current version number of the terminal.
4. The terminal upgrade method according to claim 3, characterized in that: The request header of the version query request also carries a first random number and a first timestamp.
5. The terminal upgrade method according to any one of claims 2 to 4, characterized in that: In step 2, the fragmented session key includes a first key fragment and a second key fragment. The first key fragment is returned after being encrypted with a public key, and the second key fragment is returned in plaintext.
6. The terminal upgrade method according to claim 5, characterized in that: The specific method for obtaining the symmetric key for this upgrade session in step 3 is as follows: the terminal uses its local private key to decrypt the first key fragment, and then concatenates the decrypted first key fragment with the second key fragment to obtain the symmetric key for this upgrade session.
7. The terminal upgrade method according to claim 1, characterized in that: In step 2, the encryption verification code is the result of encrypting the upgrade file digest using the symmetric key within the upgrade server.
8. The terminal upgrade method according to claim 1, characterized in that: The second authentication information in step 4 is constructed as follows: the second authentication string is constructed according to the rule of "second agreed preset value + second random number + second timestamp + second request parameter", and the second authentication string is hashed to obtain the second authentication information; The second request parameter must include at least the name of the upgrade file.
9. The terminal upgrade method according to claim 8, characterized in that: The file download request header also carries a second random number and a second timestamp.
10. A terminal, characterized in that: The terminal upgrade method described in any one of claims 1 to 9 is applied for the upgrade.