Encryption method, system, device and storage medium for firmware upgrade

By establishing an encrypted channel and generating random numbers and hashes during the firmware upgrade process, the problem of insufficient security in existing firmware upgrade encryption methods is solved, thereby improving the security and reliability of firmware upgrades.

CN115632847BActive Publication Date: 2025-11-28SHENZHEN XINFENG WEIYE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211251120.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-13
Publication Date
2025-11-28
Estimated Expiration
2042-10-13

AI Technical Summary

Technical Problem

Existing firmware upgrade encryption methods have low security and are easily compromised by unauthorized access to the Download port for firmware upgrades.

Method used

The first and second encryption channels are established by the agent, the authorization, and the flashing end, respectively. Random numbers and hash numbers are generated and verified. The encryption channels and the randomly generated random numbers are used to encrypt the firmware upgrade.

Benefits of technology

It improves the security and reliability of firmware upgrades, ensuring the uniqueness and randomness of the firmware upgrade process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115632847B_ABST
    Figure CN115632847B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of firmware upgrading, in particular to an encryption method, system and device for firmware upgrading and a storage medium, wherein the method comprises the following steps: establishing a first encryption channel and a second encryption channel with an authorized end and a flashing end respectively; sending an information generation request to the flashing end through the second encryption channel; receiving a first random number and a first serial number returned by the flashing end and sending the first random number and the first serial number to the authorized end; receiving a second random number and a first hash number returned by the authorized end through the first encryption channel, and sending a data sending request including the second random number and the first hash number to the flashing end, so that the flashing end realizes firmware upgrading based on the data sending request. The application uses the encryption channel and the randomly generated random number, so that the encryption mode of the firmware upgrading has uniqueness and randomness, and the security and reliability of the firmware upgrading are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of firmware upgrading, in particular to an encryption method, system and device for firmware upgrading and a storage medium. BACKGROUND

[0002] System firmware refers to a driver stored in a device, which is widely applied in electronic products.

[0003] The current encryption method for firmware upgrading uses the network of a wireless communication device, sends an http message to the wireless communication device in a browser to open a development mode, wherein the message contains an instruction for opening the development mode, a password and the like, and then uses an AT command to open a Download port in the development mode for encryption for firmware upgrading. However, in this way, as long as the AT command for opening the Download port is known, the Download port can be opened for encryption for firmware upgrading, and the security is low.

[0004] Therefore, based on the above problems, the current authentication method needs to be improved. SUMMARY

[0005] An object of the application is to provide an encryption method for firmware upgrading, which aims to solve the problem that as long as the AT command for opening the Download port is known, the Download port can be opened for encryption for firmware upgrading, and the security is low.

[0006] The above object of the application is achieved by the following technical scheme:

[0007] An encryption method for firmware upgrading, comprising the following steps performed by a proxy end:

[0008] establishing a first encryption channel and a second encryption channel with an authorized end and a flashing end respectively;

[0009] sending an information generation request to the flashing end through the second encryption channel, so that the flashing end generates a first random number and a first serial number;

[0010] receiving the first random number and the first serial number returned by the flashing end, and sending the first random number and the first serial number to the authorized end, so that the authorized end generates a second random number and a first hash number based on the first random number and the first serial number and returns them;

[0011] receiving the second random number and the first hash number returned by the authorized end through the first encryption channel, and sending a data sending request including the second random number and the first hash number to the flashing end, so that the flashing end implements firmware upgrading based on the data sending request.

[0012] The application can be further configured in a preferred example to include the following after establishing the first and second encrypted channels with the authorized and flashing ends respectively:

[0013] Identifying a plurality of network cards to select different network card access points.

[0014] An encryption method for firmware upgrade, including the following steps performed by the flashing end:

[0015] Receiving an information generation request sent by the agent end, generating a first random number and a first serial number based on the information generation request;

[0016] Based on the first random number and the first serial number, return the first random number and the first serial number to the agent end, so that the agent end returns a second random number and a first hash number based on the first random number and the first serial number;

[0017] Receiving the second random number and the first hash number sent by the agent end;

[0018] Based on the flashing end key, the first random number and the second random number, a second hash number is calculated;

[0019] Compare the first hash number and the second hash number, if the first hash number and the second hash number are the same, then the authentication is passed.

[0020] The application can be further configured in a preferred example to generate a first random number, including:

[0021] Generate the first random number using the function in the C language standard library.

[0022] The application can be further configured in a preferred example to calculate a second hash number based on the flashing end key, the first random number and the second random number, including:

[0023] Arrange the first random number, the second random number and the flashing end key in the same order as the authorized end;

[0024] Based on the order, a second hash number is calculated using a hash algorithm.

[0025] An encryption method for firmware upgrade, including the following steps performed by the authorized end:

[0026] Receiving a first random number and a first serial number sent by the agent end, generating a second random number;

[0027] Based on the first serial number and the serial number database, find the authorized end key corresponding to the first serial number;

[0028] Based on the first random number, the second random number and the authorized end key, a first hash number is calculated;

[0029] sending the second random number and the first hash number to the agent end to make the agent end send the second random number and the first hash number to the flashing end.

[0030] The application can be further configured in a preferred example to include, after sending the second random number and the first hash number to the agent end to make the agent end send the second random number and the first hash number to the flashing end:

[0031] the first serial number of the authentication and authorization end corresponds to the authorization end key and the flashing end key;

[0032] acquiring the authentication times;

[0033] if the authentication times are greater than the authentication times threshold, the authorization end is invalid.

[0034] An encryption system for firmware upgrade includes an agent end, a flashing end and an authorization end, the agent end includes:

[0035] an encryption channel establishment module for establishing a first encryption channel and a second encryption channel with the authorization end and the flashing end respectively;

[0036] a request module for sending an information generation request to the flashing end through the second encryption channel to make the flashing end generate a first random number and a first serial number;

[0037] a first random number and a first serial number receiving and sending module for receiving the first random number and the first serial number returned by the flashing end, sending the first random number and the first serial number to the authorization end to make the authorization end generate a second random number and a first hash number based on the first random number and the first serial number and return;

[0038] a second random number and a first hash number sending module for receiving the second random number and the first hash number returned by the authorization end through the first encryption channel, and sending a data sending request including the second random number and the first hash number to the flashing end to make the flashing end implement firmware upgrade based on the data sending request;

[0039] The flashing end includes:

[0040] a first random number and a first serial number generating module for receiving the information generation request sent by the agent end, generating the first random number and the first serial number based on the information generation request;

[0041] a first random number and a first serial number returning module for returning the first random number and the first serial number to the agent end based on the first random number and the first serial number to make the agent end return the second random number and the first hash number based on the first random number and the first serial number;

[0042] a second random number and a first hash number receiving module for receiving the second random number and the first hash number sent by the agent end;

[0043] The second hash number calculation module is configured to calculate a second hash number based on the flashing-end key, the first random number and the second random number.

[0044] The authentication module is configured to compare the first hash number and the second hash number, and if the first hash number and the second hash number are the same, the authentication is passed.

[0045] The authorization end comprises:

[0046] The second random number generation module is configured to receive the first random number and the first serial number sent by the agent end, and generate a second random number.

[0047] The authorization-end key searching module is configured to search for the authorization-end key corresponding to the first serial number based on the first serial number and a serial number database.

[0048] The first hash number calculation module is configured to calculate a first hash number based on the first random number, the second random number and the authorization-end key.

[0049] The authentication module is configured to send the second random number and the first hash number to the agent end, so that the agent end sends the second random number and the first hash number to the flashing end.

[0050] A computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the above-mentioned encryption method for firmware upgrade when executing the computer program.

[0051] A computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the above-mentioned encryption method for firmware upgrade.

[0052] In summary, the present application has the following beneficial technical effects:

[0053] The above-mentioned encryption method, system, device and storage medium for firmware upgrade establish a first encryption channel and a second encryption channel between the agent end and the authorization end and the flashing end respectively, the agent end requests and receives the first random number and the first serial number from the flashing end through the second encryption channel, the agent end sends the first random number and the first serial number to the authorization end through the first encryption channel, and sends the received second random number and the first hash number to the flashing end, so that the encryption method for firmware upgrade has uniqueness and randomness by using the encryption channel and the randomly generated random number, and the security and reliability of the firmware upgrade are improved. BRIEF DESCRIPTION OF DRAWINGS

[0054] Figure 1 An application environment schematic diagram of the encryption method for firmware upgrade in an embodiment of the present application is shown;

[0055] Figure 2 Fig. 1 shows a flow chart of an encryption method for firmware upgrade in an embodiment of the present application;

[0056] Figure 3 Fig. 2 shows a second flow chart of an encryption method for firmware upgrade in an embodiment of the present application;

[0057] Figure 4 Fig. 3 shows a schematic diagram of an encryption system for firmware upgrade in an embodiment of the present application;

[0058] Figure 5 Fig. 4 shows a schematic diagram of a computer device in an embodiment of the present application. DETAILED DESCRIPTION

[0059] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of the present application.

[0060] The encryption method for firmware upgrade provided by the embodiments of the present application can be applied in an application environment such as Figure 1 The encryption method for firmware upgrade is applied in an encryption system for firmware upgrade, which includes an agent end, a flashing end and an authorization end. The agent end establishes an encryption channel with the flashing end and the authorization end respectively to realize the interaction of information between the flashing end and the authorization end. The flashing end is used to generate a first random number and a first serial number. The authorization end is used to generate a second random number and find a corresponding authorization end key, so as to compare the first hash number and the second hash number. The agent end can be run on various computer devices such as personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, but is not limited thereto.

[0061] The encryption method for firmware upgrade includes the following steps performed by the agent end:

[0062] The first encryption channel and the second encryption channel are established with the authorization end and the flashing end respectively.

[0063] The information generation request is sent to the flashing end through the second encryption channel to make the flashing end generate the first random number and the first serial number.

[0064] The first random number and the first serial number returned by the flashing end are received, and the first random number and the first serial number are sent to the authorization end to make the authorization end generate the second random number and the first hash number based on the first random number and the first serial number and return them.

[0065] The receiving authorization end returns the second random number and the first hash number through the first encrypted channel, and sends a data sending request including the second random number and the first hash number to the flashing end, so that the flashing end implements firmware upgrade based on the data sending request.

[0066] The encryption method for firmware upgrade further includes the following steps performed by the flashing end:

[0067] The receiving agent end sends an information generation request, and generates a first random number and a first serial number based on the information generation request.

[0068] Based on the first random number and the first serial number, the first random number and the first serial number are returned to the agent end, so that the agent end returns the second random number and the first hash number based on the first random number and the first serial number.

[0069] The second random number and the first hash number sent by the agent end are received.

[0070] Based on the flashing end key, the first random number and the second random number, a second hash number is calculated.

[0071] The first hash number and the second hash number are compared, and if the first hash number and the second hash number are the same, the authentication is passed.

[0072] The encryption method for firmware upgrade further includes the following steps performed by the authorization end:

[0073] The first random number and the first serial number sent by the agent end are received, and a second random number is generated.

[0074] Based on the first serial number and the serial number database, the authorization end key corresponding to the first serial number is found.

[0075] Based on the first random number, the second random number and the authorization end key, a first hash number is calculated.

[0076] The second random number and the first hash number are sent to the agent end, so that the agent end sends the second random number and the first hash number to the flashing end.

[0077] In an embodiment, as shown in Figure 2 An encryption method for firmware upgrade is provided, which is applied to the agent end, the flashing end and the authorization end, and includes the following steps:

[0078] S11, the agent end, the authorization end and the flashing end establish a first encrypted channel and a second encrypted channel respectively.

[0079] Among them, the first encrypted channel and the second encrypted channel are realized by random number encryption method in this embodiment, which is used to realize the interaction of data information between the flashing end and the authorization end.

[0080] Specifically, the authorized device and the device to be flashed are inserted into an authorized PC (computer), and an authorized agent software is automatically installed, which is referred to as an agent end. The agent end establishes a first encrypted channel and a second encrypted channel with an authorized end running on the authorized device and a flashing end running on the device to be flashed, respectively.

[0081] The step S11 is to establish different encrypted channels respectively, so as to realize the communication between the authorized end and the flashing end in two different network segments.

[0082] S12, the agent end sends an information generation request to the flashing end through the second encrypted channel, so that the flashing end generates a first random number and a first serial number.

[0083] Specifically, the agent end requests the first random number and the first serial number from the flashing end, so that the flashing end generates the first random number and the first serial number according to the information generation request.

[0084] S21, the flashing end receives the information generation request sent by the agent end, and generates the first random number and the first serial number based on the information generation request.

[0085] Specifically, the authorized agent software requests the first random number RandomA and the first serial number imei number from the flashing end. After receiving the request, the flashing end generates the first random number RandomA by using a function in C language.

[0086] The step S21 is to generate the first random number each time, so as to improve the security of the firmware upgrade encryption.

[0087] S22, based on the first random number and the first serial number, the flashing end returns the first random number and the first serial number to the agent end, so that the agent end returns a second random number and a first hash number based on the first random number and the first serial number.

[0088] The first hash number is used to compare and authenticate the second hash number calculated by the authorized end, so as to realize the decryption process.

[0089] Specifically, the flashing end returns the first random number RandomA and the first serial number to the agent end in the form of ciphertext by using the encrypted channel. The agent end then sends the first random number RandomA and the first serial number to the authorized end.

[0090] S13, the agent end receives the first random number and the first serial number returned by the flashing end, and sends the first random number and the first serial number to the authorized end, so that the authorized end generates a second random number and a first hash number based on the first random number and the first serial number and returns them.

[0091] S31, the authorized end receives the first random number and the first serial number sent by the agent end, and generates a second random number.

[0092] The step S31 is to generate the second random number by the authorization end according to the first random number and the first serial number, and improve the correspondence of the second random number.

[0093] S32, based on the first serial number and the serial number database, the authorization end finds the authorization end key corresponding to the first serial number.

[0094] The serial number database is the imei number database, which includes id, imei and authorization end key KEY. The id is the database serial number. The imei is the preset unlockable imei number. The authorization end key KEY is the unlock private key corresponding to the imei number.

[0095] S33, based on the first random number, the second random number and the authorization end key, the authorization end calculates the first hash number.

[0096] Specifically, the authorization end arranges the first random number, the second random number and the authorization end key in a certain order, and then calculates the first hash number by using the hash algorithm.

[0097] Among them, the first random number, the second random number and the authorization end key are arranged and spliced to get tmp, and then the SM3 algorithm is used to calculate the first hash number.

[0098] S34, the authorization end sends the second random number and the first hash number to the proxy end, so that the proxy end sends the second random number and the first hash number to the flashing end.

[0099] The step S34 is to realize the interaction of data information between the authorization end and the flashing end through different network segments.

[0100] S14, the proxy end receives the second random number and the first hash number returned by the authorization end through the first encryption channel, and the proxy end sends the data sending request including the second random number and the first hash number to the flashing end, so that the flashing end realizes the firmware upgrade based on the data sending request.

[0101] S23, the flashing end receives the second random number and the first hash number sent by the proxy end.

[0102] S24, based on the flashing end key, the first random number and the second random number, the flashing end calculates the second hash number.

[0103] Specifically, the flashing end arranges the first random number, the second random number and the flashing end key in a certain order, and the order is consistent with that of the authorization end. Then the hash algorithm is used to calculate the second hash number.

[0104] S25, the flashing end compares the first hash number and the second hash number, if the first hash number and the second hash number are the same, the authentication is passed.

[0105] Specifically, the first hash number EncodedTextA and the second hash number EncodedTextB are compared, if the first hash number and the second hash number are the same, the authentication is passed, and the Download port is opened. If the first hash number and the second hash number are different, the authentication fails, and the Download port is not allowed to be opened.

[0106] The step S25 is used for comparing the first hash number with the second hash number, and improves the reliability and security of the method for firmware upgrade.

[0107] In an embodiment, after the step S11, i.e. after the first encrypted channel and the second encrypted channel are respectively established with the authorized end and the flashing end, the method further comprises the following steps:

[0108] S111, the agent end identifies a plurality of network cards to select different network card access ports.

[0109] Specifically, the authorized device running the authorized end and the device to be flashed running the flashing end respectively enumerate the network cards of the network segments on the authorized PC running the agent end, and the agent end identifies the enumerated network cards.

[0110] The step S111 is used for enabling the user to select different network card access ports for firmware upgrade, and improves the security and reliability of the firmware upgrade.

[0111] In an embodiment, the step S21, i.e. generating the first random number, comprises the following steps:

[0112] S211, the flashing end generates the first random number by using a function in the C language standard library.

[0113] Specifically, the flashing end generates a 256-bit random number by using the rand() function in the C language standard library.

[0114] In an embodiment, as shown in FIG. 4, the step S24, i.e. calculating the second hash number based on the flashing end key, the first random number and the second random number, comprises the following steps: Figure 3

[0115] S241, the flashing end arranges the first random number, the second random number and the flashing end key in the same order as the authorized end.

[0116] S242, based on the order, the flashing end calculates the second hash number by using a hash algorithm.

[0117] ​Wherein, the first random number, the second random number and the flashing end key are arranged and spliced to obtain tmp, and then the SM3 algorithm is used to calculate the second hash number.

[0118] Wherein, the encryption step of SM3 is as follows:

[0119] 1. Define SM3 structure: lk_sm3_context_t context.

[0120] 2. Initialize the structure: LK_INIT_VALUE (& context).

[0121] 3. Group iteration compression calculation on data: lk_sm3_update (lk_sm3_context_t *context, UCHAR *data, UINT len).

[0122] 4. Perform the last group padding and iteration compression calculation: lk_sm3_final (lk_sm3_context *context).

[0123] In this embodiment, the SM3 encryption is realized by C language, but it is not limited to C language. All other embodiments using SM3 encryption belong to the protection scope of the present application.

[0124] In a specific embodiment, with reference to Figure 2 After step S34, that is, after the authorized end sends the second random number and the first hash number to the agent end, the agent end sends the second random number and the first hash number to the flashing end, the method further comprises the following steps:

[0125] S341, the authorized end authenticates the first serial number of the authorized end key corresponding to the flashing end key.

[0126] S342, the authorized end obtains the authentication times.

[0127] S343, if the authentication times are greater than the authentication times threshold, the authorized end is invalid.

[0128] Specifically, the flashing end of the to-be-flashed device is provided with an authorized end key when it is manufactured, that is, the flashing end key. The flashing end key is authenticated with the authorized end key in the serial number database of the authorized end, the authorized end obtains the authentication times, and when the authentication times are greater than the authentication times threshold, the authorized end is invalid. Wherein, when the flashing end key matches the corresponding authorized end key in the serial number database, it is considered that the authentication is passed.

[0129] The embodiment provides a kind of encryption method for firmware upgrade, first encryption channel and second encryption channel are established with authorized end and flashing end by proxy end, proxy end requests and receives first random number and first serial number to flashing end by second encryption channel, proxy end sends first random number and first serial number to authorized end by first encryption channel, and sends received second random number and first hash number to flashing end, using encryption channel and random generated random number, so that the encryption mode of firmware upgrade has uniqueness and randomness, improve the security and reliability of firmware upgrade.

[0130] In an embodiment, an encryption system for firmware upgrade is provided, which corresponds to the encryption method for firmware upgrade in the above embodiments. As shown in the figure, the encryption system for firmware upgrade includes a proxy end 10. Wherein, the functions of each module of the proxy end are described as follows: Figure 4

[0131] The encryption channel establishing module 11 is used for establishing first encryption channel and second encryption channel with authorized end and flashing end respectively.

[0132] The request module 12 is used for sending information generation request to flashing end through second encryption channel, so that flashing end generates first random number and first serial number.

[0133] The first random number and first serial number receiving and sending module 13 is used for receiving first random number and first serial number returned by flashing end, and sending first random number and first serial number to authorized end, so that authorized end generates second random number and first hash number based on first random number and first serial number and returns.

[0134] The second random number and first hash number sending module 14 is used for receiving second random number and first hash number returned by authorized end through first encryption channel, and sending data sending request including second random number and first hash number to flashing end, so that flashing end realizes firmware upgrade based on data sending request.

[0135] In an embodiment, an encryption system for firmware upgrade is provided, which corresponds to the encryption method for firmware upgrade in the above embodiments. As shown in the figure, the encryption system for firmware upgrade includes a proxy end 10. Wherein, the functions of each module of the proxy end are described as follows: Figure 4

[0136] The first random number and first serial number generating module 21 is used for receiving information generation request sent by proxy end, and generating first random number and first serial number based on information generation request.

[0137] ​​The module 22, which returns the first random number and the first serial number, is used to return the first random number and the first serial number to the agent, so that the agent can return the second random number and the first hash number based on the first random number and the first serial number.

[0138] The module 23 for receiving the second random number and the first hash number is used to receive the second random number and the first hash number sent by the agent.

[0139] The second hash number calculation module 24 is used to calculate the second hash number based on the flashing terminal key, the first random number, and the second random number.

[0140] The comparison and authentication module 25 is used to compare the first hash number and the second hash number. If the first hash number and the second hash number are the same, the authentication is successful.

[0141] In one embodiment, an encryption system for firmware upgrades is provided, which corresponds one-to-one with the encryption methods for firmware upgrades described in the above embodiments. For example... Figure 4 As shown, the encryption system used for firmware upgrades includes an authorization terminal 30. The functional modules of the authorization terminal are described in detail below:

[0142] The second random number generation module 31 is used to receive the first random number and the first sequence number sent by the agent and generate the second random number.

[0143] The authorization key lookup module 32 is used to look up the authorization key corresponding to the first serial number based on the first serial number and the serial number database.

[0144] The first hash number calculation module 33 is used to calculate the first hash number based on the first random number, the second random number, and the authorized end key.

[0145] The authentication module 34 is used to send a second random number and a first hash number to the agent, so that the agent sends the second random number and the first hash number to the flashing terminal.

[0146] The encryption system for firmware upgrades provided in this embodiment can achieve the steps of the aforementioned embodiments due to the functions of each module and the logical connections between them. Therefore, it can achieve the same technical effect as the aforementioned embodiments. For the principle analysis, please refer to the relevant description of the encryption method steps for firmware upgrades mentioned above, which will not be repeated here.

[0147] The specific definition of the encryption system for firmware upgrade can refer to the definition of the encryption method for firmware upgrade above, which will not be repeated here. Each module in the encryption system for firmware upgrade above can be implemented by software, hardware, and a combination thereof, in whole or in part. Each module above can be embedded in or independent of a processor in the computer device in hardware form, or stored in a memory in the computer device in software form, so as to be called and executed by the processor to perform the operation corresponding to each module above.

[0148] In an embodiment, a computer device is provided, and an internal structure diagram of the computer device can be as shown in Figure 5 The computer device includes a processor, a memory, a network interface, and a serial number database connected by a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile medium and an internal memory. The non-volatile medium stores an operating system, a computer program, and a serial number database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile medium. The serial number database of the computer device is configured to store data required to be saved in the encryption method for firmware upgrade. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement an encryption method for firmware upgrade.

[0149] In an embodiment, a computer device is provided, and includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor implements the encryption method for firmware upgrade in the above embodiments when executing the computer program, such as steps S11 to S34 shown in Figure 2 Alternatively, the processor implements the functions of each module / unit of the encryption system for firmware upgrade in the above embodiments when executing the computer program, such as the functions of modules 11 to 34 shown in Figure 4 To avoid repetition, details will not be repeated here.

[0150] In an embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by the processor to implement the encryption method for firmware upgrade in the above embodiments, or the computer program is executed by the processor to implement the functions of each module / unit of the encryption system for firmware upgrade in the above system embodiments. To avoid repetition, details will not be repeated here.

[0151] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing relevant hardware, and the computer program can be stored in a non-volatile computer readable medium. When the computer program is executed, the processes of the above-mentioned embodiments of each method can be included. Any reference to memory, storage, sequence number database or other medium used in each embodiment provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0152] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the system is divided into different functional units or modules to complete all or part of the functions described above.

[0153] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. An encryption method for firmware upgrades, applied to a proxy terminal, characterized in that, include: Establish a first encrypted channel and a second encrypted channel with the authorization end and the flashing end, respectively; Send an information generation request to the flashing terminal through the second encrypted channel so that the flashing terminal generates a first random number and a first serial number; The system receives the first random number and the first serial number returned by the flashing terminal, and sends the first random number and the first serial number to the authorization terminal, so that the authorization terminal generates a second random number and a first hash number based on the first random number and the first serial number and returns them. The system receives the second random number and the first hash number returned by the authorized end through the first encryption channel, and sends a data sending request including the second random number and the first hash number to the flashing end, so that the flashing end can perform firmware upgrade based on the data sending request; The authorizing end receives a first random number and a first serial number sent by the agent end. The authorizing end generates a second random number. Based on the first serial number and the serial number database, the authorizing end looks up the authorizing end key corresponding to the first serial number. Based on the first random number, the second random number, and the authorizing end key, the authorizing end calculates a first hash number. The authorizing end sends the second random number and the first hash number to the agent end, so that the agent end sends the second random number and the first hash number to the flashing end. The flashing end receives the second random number and the first hash number sent by the agent end. Based on the flashing end key, the first random number, and the second random number, the flashing end calculates a second hash number. The flashing end compares the first hash number and the second hash number. If the first hash number and the second hash number are the same, the authentication is successful.

2. The encryption method for firmware upgrade according to claim 1, characterized in that, After establishing the first encryption channel and the second encryption channel with the authorization end and the flashing end respectively, the process includes: Identify several network interface cards (NICs) to select different NIC access points.

3. An encryption method for firmware upgrades, applied to the flashing terminal, characterized in that, include: Receive an information generation request sent by the agent, and generate a first random number and a first sequence number based on the information generation request; Based on the first random number and the first sequence number, the first random number and the first sequence number are returned to the agent, so that the agent returns a second random number and a first hash number based on the first random number and the first sequence number. Receive the second random number and the first hash number sent by the agent; The authorizing end receives a first random number and a first serial number sent by the agent end. The authorizing end generates a second random number. Based on the first serial number and the serial number database, the authorizing end looks up the authorizing end key corresponding to the first serial number. Based on the first random number, the second random number, and the authorizing end key, the authorizing end calculates a first hash number. The authorizing end sends the second random number and the first hash number to the agent end, so that the agent end sends the second random number and the first hash number to the flashing end. The flashing end receives the second random number and the first hash number sent by the agent end. Based on the flashing end key, the first random number, and the second random number, the flashing end calculates a second hash number. The flashing end compares the first hash number and the second hash number. If the first hash number and the second hash number are the same, the authentication is successful. The second hash number is calculated based on the flashing key, the first random number, and the second random number; The first hash number and the second hash number are compared. If the first hash number and the second hash number are the same, the authentication is successful.

4. The encryption method for firmware upgrade according to claim 3, characterized in that, The generation of the first random number includes: The first random number is generated using functions from the C language standard library.

5. The encryption method for firmware upgrade according to claim 3, characterized in that, The calculation of the second hash number based on the flashing terminal key, the first random number, and the second random number includes: Arrange the first random number, the second random number, and the flashing key in the same order as the authorization key; Based on the aforementioned order, the second hash number is calculated using a hash algorithm.

6. An encryption method for firmware upgrades, applied to an authorized end, characterized in that, include: Receive the first random number and the first sequence number sent by the agent, and generate the second random number; Based on the first serial number and the serial number database, find the authorization key corresponding to the first serial number; The first hash number is calculated based on the first random number, the second random number, and the authorized terminal key; Send the second random number and the first hash number to the agent terminal, so that the agent terminal sends the second random number and the first hash number to the flashing terminal; The authorizing end receives a first random number and a first serial number sent by the agent end. The authorizing end generates a second random number. Based on the first serial number and the serial number database, the authorizing end looks up the authorizing end key corresponding to the first serial number. Based on the first random number, the second random number, and the authorizing end key, the authorizing end calculates a first hash number. The authorizing end sends the second random number and the first hash number to the agent end, so that the agent end sends the second random number and the first hash number to the flashing end. The flashing end receives the second random number and the first hash number sent by the agent end. Based on the flashing end key, the first random number, and the second random number, the flashing end calculates a second hash number. The flashing end compares the first hash number and the second hash number. If the first hash number and the second hash number are the same, the authentication is successful.

7. The encryption method for firmware upgrade according to claim 6, characterized in that, After sending the second random number and the first hash to the agent, so that the agent sends the second random number and the first hash to the flashing terminal, the process includes: The authorization key corresponding to the first serial number of the authentication and authorization terminal and the flashing terminal key; Number of authentication attempts; If the number of authentication attempts exceeds the authentication attempt threshold, the authorization terminal becomes invalid.

8. An encryption system for firmware upgrades, characterized in that, It includes a proxy terminal, a flashing terminal, and an authorization terminal. The proxy terminal includes: An encrypted channel module is established to create a first encrypted channel and a second encrypted channel with the authorization end and the flashing end, respectively. The request module is used to send an information generation request to the flashing terminal through the second encrypted channel, so that the flashing terminal generates a first random number and a first serial number; A module for receiving and sending a first random number and a first serial number is used to receive the first random number and the first serial number returned by the flashing terminal, and send the first random number and the first serial number to the authorization terminal, so that the authorization terminal generates a second random number and a first hash number based on the first random number and the first serial number and returns them. The module for sending a second random number and a first hash number is used to receive the second random number and the first hash number returned by the authorized end through the first encryption channel, and send a data sending request including the second random number and the first hash number to the flashing end, so that the flashing end can perform firmware upgrade based on the data sending request; The flashing terminal includes: A module for generating a first random number and a first serial number is used to receive an information generation request sent by the agent and generate a first random number and a first serial number based on the information generation request. The module that returns a first random number and a first serial number is used to return the first random number and the first serial number to the agent, so that the agent returns a second random number and a first hash number based on the first random number and the first serial number. A module for receiving a second random number and a first hash number is used to receive the second random number and the first hash number sent by the agent. The second hash calculation module is used to calculate the second hash number based on the flashing terminal key, the first random number, and the second random number; The comparison and authentication module is used to compare the first hash number and the second hash number. If the first hash number and the second hash number are the same, the authentication is successful. The authorization terminal includes: The module for generating a second random number is used to receive a first random number and a first sequence number sent by the agent and generate a second random number. The authorization key lookup module is used to look up the authorization key corresponding to the first serial number based on the first serial number and the serial number database. The module for calculating the first hash number is used to calculate the first hash number based on the first random number, the second random number, and the authorized end key; The authentication module is used to send the second random number and the first hash number to the agent terminal, so that the agent terminal sends the second random number and the first hash number to the flashing terminal; The authorizing end receives a first random number and a first serial number sent by the agent end. The authorizing end generates a second random number. Based on the first serial number and the serial number database, the authorizing end looks up the authorizing end key corresponding to the first serial number. Based on the first random number, the second random number, and the authorizing end key, the authorizing end calculates a first hash number. The authorizing end sends the second random number and the first hash number to the agent end, so that the agent end sends the second random number and the first hash number to the flashing end. The flashing end receives the second random number and the first hash number sent by the agent end. Based on the flashing end key, the first random number, and the second random number, the flashing end calculates a second hash number. The flashing end compares the first hash number and the second hash number. If the first hash number and the second hash number are the same, the authentication is successful.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the encryption method for firmware upgrade as described in any one of claims 1 to 2; when the processor executes the computer program, it implements the encryption method for firmware upgrade as described in any one of claims 3 to 5; or, when the processor executes the computer program, it implements the encryption method for firmware upgrade as described in any one of claims 6 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the encryption method for firmware upgrade as described in any one of claims 1 to 2; when the computer program is executed by the processor, it implements the encryption method for firmware upgrade as described in any one of claims 3 to 5; or, when the computer program is executed by the processor, it implements the encryption method for firmware upgrade as described in any one of claims 6 to 7.

Citation Information

Patent Citations

  • Load balancing method and system for safety communication

    CN102624749A

  • Method and device for realizing safe interaction and pairing authentication between Bluetooth devices

    CN105450269A