Firmware image signing method and apparatus, computer device, and storage medium
By constructing a key storage database and calculating key trustworthiness, target keys are selected and signed firmware image files are generated, solving the problems of key leakage and cumbersome signing steps, and realizing efficient and secure key management and signature verification services.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2023-05-09
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies pose a high risk of key leakage during firmware image signing, involve cumbersome signing steps that depend on the signing environment, and suffer from low security and efficiency.
By building a key storage database, calculating key trustworthiness and filtering target keys, and using a digital signature mechanism to generate signed firmware image files, we provide one-stop key management and signature verification services.
It reduces the risk of key leakage, decreases the probability of errors, and improves work efficiency and security.
Smart Images

Figure CN116633554B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network security technology, and in particular to a firmware image signing method, apparatus, computer device, and storage medium. Background Technology
[0002] When using the BMC (Baseboard Management Controller) to upgrade firmware, the image used for the upgrade needs to be verified. The upgrade operation can only be performed after the verification is passed to prevent illegal images from threatening system security.
[0003] The specific steps for completing the image verification operation are as follows: Sign the image by using the BMC's trusted key and converting the unsigned image into a signed image that meets the requirements according to a certain format; then upload the signed image to the designated location and complete the image verification operation from the BMC; after verification, extract the upgrade package and then upgrade the firmware.
[0004] Existing technical solutions typically involve manually signing images using command lines. This approach has several drawbacks, including: offline key transmission, which poses a significant risk of key leakage if many people use the same key for image signing, compromising the security of signed images; cumbersome signing procedures, requiring signers to be familiar with the process; and reliance on a specific signing environment.
[0005] Therefore, there is an urgent need to propose a firmware image signing method, device, computer equipment, and storage medium that can reduce the risk of key leakage and error rate. Summary of the Invention
[0006] Therefore, it is necessary to provide a firmware image signing method, apparatus, computer device, and storage medium to address the aforementioned technical problems.
[0007] On the one hand, a firmware image signing method is provided, applied to a baseboard management controller, the method comprising:
[0008] In response to detecting a firmware image signing request, the key information corresponding to the firmware image signing request and the image type are obtained;
[0009] Calculate the key credibility based on the key information;
[0010] Target keys are selected based on the key's credibility.
[0011] Based on the image type and target key, the firmware image file to be signed is signed to generate a signed firmware image file for users to download and use.
[0012] In one embodiment, the method further includes: before obtaining the key information corresponding to the firmware image signing request and the image type in response to detecting a firmware image signing request, the method further includes:
[0013] Construct a key storage database, which includes a first storage module and a second storage module;
[0014] The key to be imported into the key storage database is marked with a function type, and it is detected whether the key contains both a public key and a private key.
[0015] In response to the detection that the key contains both a public key and a private key, the key is encrypted using a security algorithm, the encrypted key and the security algorithm used are associated and saved in the first storage module, and the encrypted public key and the security algorithm used are associated and saved in the second storage module.
[0016] In response to the detection that the key contains only a public key, the public key is encrypted using a security algorithm, the encrypted public key and the security algorithm used are associated, and the encrypted public key is saved to the second storage module.
[0017] In one embodiment, the method further includes: the key information includes security algorithm strength, key usage count, and key function type; the step of calculating key trustworthiness based on the key information includes:
[0018] Extract the key information corresponding to the firmware image signing request in the first storage module;
[0019] Based on the key information and the credibility calculation formula, the credibility of the key is calculated. The credibility calculation formula includes:
[0020]
[0021] Where K represents the credibility value, δ1, δ2, and δ3 represent the security algorithm strength correction coefficient, key function type correction coefficient, and fusion coefficient, respectively, A1 represents the security algorithm strength assignment, A2 represents the key function type assignment, and A3 represents the number of times the key is used.
[0022] In one embodiment, the method further includes: determining the key's credibility based on the calculated credibility value, including:
[0023] When the confidence value is detected to be greater than a first preset value, the key confidence level is determined to be high.
[0024] In response to detecting that the confidence value is less than or equal to a first preset value and greater than a second preset value, the key confidence level is determined to be medium confidence.
[0025] In response to detecting that the confidence value is less than or equal to a second preset value, the key confidence is determined to be low.
[0026] In one embodiment, the step of filtering out the target key based on the key trustworthiness includes:
[0027] In response to detecting that the key's confidence level is medium, and When the value is greater than the third preset value, the key corresponding to the key credibility is determined to be the target key;
[0028] In response to detecting that the key has a high level of confidence, and When the value is greater than the fourth preset value, the key corresponding to the key credibility is determined to be the target key;
[0029] The third preset value is greater than the fourth preset value.
[0030] In one embodiment, the method further includes: signing the firmware image file to be signed using a digital signature mechanism based on the image type and the target key, thereby generating a signed firmware image file.
[0031] In one embodiment, the method further includes: after signing the firmware image file to be signed according to the image type and the target key to generate a signed firmware image file, the method further includes:
[0032] In response to detecting a firmware image signature verification request, the public key information corresponding to the firmware image signature verification request is obtained from the second storage module and selected.
[0033] In response to the detection that a signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the information of the signature verification public key. If the comparison is successful, the signature firmware image file is verified.
[0034] In response to the detection that no signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the public key information in the second storage module. If the comparison is successful, the signature firmware image file is verified.
[0035] The system returns the verification result and the corresponding signature public key information for the user to view.
[0036] On the other hand, a firmware image signing device is provided, the device comprising:
[0037] The data acquisition module is used to acquire the key information corresponding to the detected firmware image signing request, as well as the image type;
[0038] The calculation module is used to calculate the key trustworthiness based on the key information;
[0039] The filtering module is used to filter out target keys based on the key's credibility.
[0040] The signing module is used to sign the firmware image file to be signed according to the image type and the target key, and generate a signed firmware image file for users to download and use.
[0041] In another aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0042] In response to detecting a firmware image signing request, the key information corresponding to the firmware image signing request and the image type are obtained;
[0043] Calculate the key credibility based on the key information;
[0044] Target keys are selected based on the key's credibility.
[0045] Based on the image type and target key, the firmware image file to be signed is signed to generate a signed firmware image file for users to download and use.
[0046] In another aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0047] In response to detecting a firmware image signing request, the key information corresponding to the firmware image signing request and the image type are obtained;
[0048] Calculate the key credibility based on the key information;
[0049] Target keys are selected based on the key's credibility.
[0050] Based on the image type and target key, the firmware image file to be signed is signed to generate a signed firmware image file for users to download and use.
[0051] The aforementioned firmware image signing method, apparatus, computer device, and storage medium, the method comprising: in response to detecting a firmware image signing request, obtaining key information corresponding to the firmware image signing request and an image type; calculating key credibility based on the key information; filtering out target keys based on the key credibility; and signing the firmware image file to be signed according to the image type and the target key to generate a signed firmware image file for users to download and use. This application can realize a one-stop service for key management and signature verification, reduce the risk of key leakage, reduce the probability of errors, and improve work efficiency. Attached Figure Description
[0052] Figure 1 This is a diagram illustrating the application environment of the firmware image signing method in one embodiment;
[0053] Figure 2 This is a flowchart illustrating a firmware image signing method in one embodiment;
[0054] Figure 3 This is a schematic diagram of the signature process of a firmware image signing method in one embodiment;
[0055] Figure 4 This is a schematic diagram of the signature verification process of a firmware image signing method in one embodiment;
[0056] Figure 5 This is a structural block diagram of a firmware image signing device in one embodiment;
[0057] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0059] It should be understood that, in the description of this application, unless the context explicitly requires it, words such as "including" or "comprising" throughout the specification should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".
[0060] It should also be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0061] It should be noted that the terms "S1," "S2," etc., are used only for descriptive purposes and do not specifically refer to the order or sequence, nor are they intended to limit this application. They are merely for the convenience of describing the method of this application and should not be construed as indicating the sequential order of the steps. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.
[0062] The firmware image signing method provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with a data processing platform set on server 104 via a network. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Server 104 can be implemented as a standalone server or a server cluster consisting of multiple servers.
[0063] Example 1: In one example, as Figures 2-4 As shown, a firmware image signing method is provided, which can be applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps:
[0064] S1: In response to detecting a firmware image signing request, obtain the key information corresponding to the firmware image signing request and the image type.
[0065] It should be noted that, before obtaining the key information corresponding to the firmware image signing request and the image type in response to the detection of a firmware image signing request, the method further includes:
[0066] Construct a key storage database (DB, DoggaByte, data storage unit), the key storage database including a first storage module and a second storage module;
[0067] The key to be imported into the key storage database is marked with a function type, and it is detected whether the key contains both a public key and a private key.
[0068] In response to the detection that the key contains both a public key and a private key, the key is encrypted using a security algorithm, the encrypted key and the security algorithm used are associated and saved in the first storage module, and the encrypted public key and the security algorithm used are associated and saved in the second storage module.
[0069] In response to the detection that the key contains only a public key, the public key is encrypted using a security algorithm, the encrypted public key and the security algorithm used are associated, and the encrypted public key is saved to the second storage module.
[0070] Specifically, this application provides key management functionality through Java-web (using Java technology to solve the relevant web and internet technology stack). The key administrator responsible for key management can create keys from the platform and import externally provided key information into the platform's database. If only the public key is imported, the key can be used for subsequent signature verification. When generating or importing a key, the key administrator needs to fill in information such as the key usage category (i.e., function type). After generation or import, a security algorithm is used for encryption. The encrypted key is stored in the database for subsequent signature verification. When storing the key, the algorithm used by the key is also stored in the key-related information. The security algorithm may include signature encryption algorithms, RSA algorithms, and other encryption algorithms.
[0071] Furthermore, the user responsible for signing opens the signing page of the signing website through a browser, i.e., sends a firmware image signing request. After receiving the request, the backend server of the signing platform automatically queries the relevant information of the available keys, i.e., the security algorithm used by the key, and calculates the trustworthiness of the key based on the number of times the key has been used and the key type, and displays it on the signing page for the user to choose from. If the key only has a public key, it will not be displayed and will only be used for subsequent signature verification operations. The signing tool is built based on a BS architecture (browser and server architecture). The signing tool is installed on the server, and the user can manage the key and sign the file by accessing the browser page.
[0072] Furthermore, the aforementioned firmware can be BMC (Baseboard Management Controller) firmware. The image type can be determined based on the firmware's attributes. For example, if it's Baseboard Management Controller firmware, then it corresponds to a Baseboard Management Controller firmware image file. When sending a firmware image signing request, the image file to be signed is uploaded simultaneously. Specifically, according to the BMC's key requirements, key generation, import, export, and management functions are provided via Java. According to the BMC's requirements for the signing object, the necessary information is filled into the image via Java code to form a trusted signed image file. At the same time, a signature verification function for the signed image is provided, which can verify the signature of external images.
[0073] S2: Calculate the key credibility based on the key information.
[0074] It should be noted that the key information includes the security algorithm strength, the number of times the key is used, and the key function type. Expert rules are used to assign values to the security algorithm strength and key function type. For example, when the security algorithm strength used by the key is high, a value of 3 is assigned; when it is medium strength, a value of 2 is assigned, and so on. The calculation of key trustworthiness based on the key information includes:
[0075] Extract the key information corresponding to the firmware image signing request in the first storage module;
[0076] Based on the key information and the credibility calculation formula, the credibility of the key is calculated. The credibility calculation formula includes:
[0077]
[0078] Where K represents the credibility value, δ1, δ2, and δ3 represent the security algorithm strength correction coefficient, key function type correction coefficient, and fusion coefficient, respectively, A1 represents the security algorithm strength assignment, A2 represents the key function type assignment, and A3 represents the number of times the key is used.
[0079] Furthermore, the key's trustworthiness is categorized into three levels: high, medium, and low. Determining the key's trustworthiness based on the calculated trustworthiness value includes:
[0080] When the confidence value is detected to be greater than a first preset value, the key confidence level is determined to be high.
[0081] In response to detecting that the confidence value is less than or equal to a first preset value and greater than a second preset value, the key confidence level is determined to be medium confidence.
[0082] In response to detecting that the confidence value is less than or equal to a second preset value, the key confidence is determined to be low.
[0083] S3: Select the target key based on the key's credibility.
[0084] It should be noted that this step is as follows:
[0085] In response to detecting that the key's confidence level is medium, and When the value is greater than the third preset value, the key corresponding to the key credibility is determined to be the target key;
[0086] In response to detecting that the key has a high level of confidence, and When the value is greater than the fourth preset value, the key corresponding to the key credibility is determined to be the target key;
[0087] When the key is detected to have low credibility, its corresponding key is filtered out without further processing and is only used for subsequent signature verification operations. In addition, the third preset value is greater than the fourth preset value. The first, second, third and fourth preset values can be set according to actual needs.
[0088] S4: Based on the image type and target key, sign the firmware image file to be signed to generate a signed firmware image file for users to download and use.
[0089] It should be noted that this application uses Java (digital signature mechanism) to sign the firmware image file to be signed, generates a signed firmware image file that meets the requirements, records the signature record, updates the key usage information, and provides it to the user for download after the generation is completed.
[0090] Furthermore, after signing the firmware image file to be signed according to the image type and target key to generate a signed firmware image file, the method further includes:
[0091] In response to the detection of a firmware image signature verification request, i.e., when the user opens the verification page of the signing website in the browser, the public key information corresponding to the firmware image signature verification request is obtained from the second storage module and displayed on the signing page for the user to select. The user can choose a verification key or not to select a verification key here.
[0092] In response to the detection that a signature verification public key has been selected, the relevant information of the signed firmware image file is extracted and compared with the information of the signature verification public key. If the comparison is successful, the signature firmware image file is verified. The relevant information may include signature value, signature key, signature type and other information.
[0093] In response to the detection that no signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the public key information in the second storage module. If the comparison is successful, the signature firmware image file is verified.
[0094] If the verification passes, the system returns the verification result and the corresponding signature public key information for the user to view. After verification, the upgrade package is extracted and the firmware is upgraded. If the verification fails, the system prompts the user that the verification failed.
[0095] The aforementioned firmware image signing method includes: in response to detecting a firmware image signing request, obtaining key information corresponding to the firmware image signing request and the image type; calculating key credibility based on the key information; filtering out target keys based on the key credibility; and signing the firmware image file to be signed according to the image type and the target key to generate a signed firmware image file for users to download and use. This application can realize a one-stop service for key management and signature verification, reduce the risk of key leakage, reduce the probability of errors, and improve work efficiency.
[0096] It should be understood that, although Figure 2-4 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2-4 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0097] Example 2: In one example, as Figure 5 As shown, a firmware image signing device is provided, including: a data acquisition module, a calculation module, a filtering module, and a signing module, wherein:
[0098] The data acquisition module is used to acquire the key information corresponding to the detected firmware image signing request, as well as the image type;
[0099] The calculation module is used to calculate the key trustworthiness based on the key information;
[0100] The filtering module is used to filter out target keys based on the key's credibility.
[0101] The signing module is used to sign the firmware image file to be signed according to the image type and the target key, and generate a signed firmware image file for users to download and use.
[0102] In a preferred embodiment of the present invention, the device further includes a database generation module, which is specifically used for:
[0103] Construct a key storage database, which includes a first storage module and a second storage module;
[0104] The key to be imported into the key storage database is marked with a function type, and it is detected whether the key contains both a public key and a private key.
[0105] In response to the detection that the key contains both a public key and a private key, the key is encrypted using a security algorithm, the encrypted key and the security algorithm used are associated and saved in the first storage module, and the encrypted public key and the security algorithm used are associated and saved in the second storage module.
[0106] In response to the detection that the key contains only a public key, the public key is encrypted using a security algorithm, the encrypted public key and the security algorithm used are associated, and the encrypted public key is saved to the second storage module.
[0107] In a preferred embodiment of the present invention, the calculation module is specifically used for:
[0108] Extract the key information corresponding to the firmware image signing request in the first storage module;
[0109] Based on the key information and the credibility calculation formula, the credibility of the key is calculated. The credibility calculation formula includes:
[0110]
[0111] Where K represents the credibility value, δ1, δ2, and δ3 represent the security algorithm strength correction coefficient, key function type correction coefficient, and fusion coefficient, respectively, A1 represents the security algorithm strength assignment, A2 represents the key function type assignment, and A3 represents the number of times the key is used.
[0112] In a preferred embodiment of the present invention, the calculation module is further configured to:
[0113] When the confidence value is detected to be greater than a first preset value, the key confidence level is determined to be high.
[0114] In response to detecting that the confidence value is less than or equal to a first preset value and greater than a second preset value, the key confidence level is determined to be medium confidence.
[0115] In response to detecting that the confidence value is less than or equal to a second preset value, the key confidence is determined to be low.
[0116] In a preferred embodiment of the present invention, the screening module is specifically used for:
[0117] In response to detecting that the key's confidence level is medium, and When the value is greater than the third preset value, the key corresponding to the key credibility is determined to be the target key;
[0118] In response to detecting that the key has a high level of confidence, and When the value is greater than the fourth preset value, the key corresponding to the key credibility is determined to be the target key;
[0119] The third preset value is greater than the fourth preset value.
[0120] In a preferred embodiment of the present invention, the signature module is specifically used for:
[0121] Based on the image type and target key, the firmware image file to be signed is signed using a digital signature mechanism to generate a signed firmware image file.
[0122] In a preferred embodiment of the present invention, the device further includes a signature verification module, which is specifically used for:
[0123] In response to detecting a firmware image signature verification request, the public key information corresponding to the firmware image signature verification request is obtained from the second storage module and selected.
[0124] In response to the detection that a signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the information of the signature verification public key. If the comparison is successful, the signature firmware image file is verified.
[0125] In response to the detection that no signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the public key information in the second storage module. If the comparison is successful, the signature firmware image file is verified.
[0126] The system returns the verification result and the corresponding signature public key information for the user to view.
[0127] For specific limitations regarding the firmware image signing device, please refer to the limitations on the firmware image signing method above, which will not be repeated here. Each module in the aforementioned firmware image signing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0128] Example 3: In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows. Figure 6 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a firmware image signing method. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0129] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0130] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0131] S1: In response to detecting a firmware image signing request, obtain the key information corresponding to the firmware image signing request and the image type;
[0132] S2: Calculate the key credibility based on the key information;
[0133] S3: Select target keys based on the key credibility;
[0134] S4: Based on the image type and target key, sign the firmware image file to be signed to generate a signed firmware image file for users to download and use.
[0135] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0136] Construct a key storage database, which includes a first storage module and a second storage module;
[0137] The key to be imported into the key storage database is marked with a function type, and it is detected whether the key contains both a public key and a private key.
[0138] In response to the detection that the key contains both a public key and a private key, the key is encrypted using a security algorithm, the encrypted key and the security algorithm used are associated and saved in the first storage module, and the encrypted public key and the security algorithm used are associated and saved in the second storage module.
[0139] In response to the detection that the key contains only a public key, the public key is encrypted using a security algorithm, the encrypted public key and the security algorithm used are associated, and the encrypted public key is saved to the second storage module.
[0140] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0141] Extract the key information corresponding to the firmware image signing request in the first storage module;
[0142] Based on the key information and the credibility calculation formula, the credibility of the key is calculated. The credibility calculation formula includes:
[0143]
[0144] Where K represents the credibility value, δ1, δ2, and δ3 represent the security algorithm strength correction coefficient, key function type correction coefficient, and fusion coefficient, respectively, A1 represents the security algorithm strength assignment, A2 represents the key function type assignment, and A3 represents the number of times the key is used.
[0145] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0146] When the confidence value is detected to be greater than a first preset value, the key confidence level is determined to be high.
[0147] In response to detecting that the confidence value is less than or equal to a first preset value and greater than a second preset value, the key confidence level is determined to be medium confidence.
[0148] In response to detecting that the confidence value is less than or equal to a second preset value, the key confidence is determined to be low.
[0149] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0150] In response to detecting that the key's confidence level is medium, and When the value is greater than the third preset value, the key corresponding to the key credibility is determined to be the target key;
[0151] In response to detecting that the key has a high level of confidence, and When the value is greater than the fourth preset value, the key corresponding to the key credibility is determined to be the target key;
[0152] The third preset value is greater than the fourth preset value.
[0153] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0154] Based on the image type and target key, the firmware image file to be signed is signed using a digital signature mechanism to generate a signed firmware image file.
[0155] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0156] In response to detecting a firmware image signature verification request, the public key information corresponding to the firmware image signature verification request is obtained from the second storage module and selected.
[0157] In response to the detection that a signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the information of the signature verification public key. If the comparison is successful, the signature firmware image file is verified.
[0158] In response to the detection that no signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the public key information in the second storage module. If the comparison is successful, the signature firmware image file is verified.
[0159] The system returns the verification result and the corresponding signature public key information for the user to view.
[0160] Example 4: In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, performs the following steps:
[0161] S1: In response to detecting a firmware image signing request, obtain the key information corresponding to the firmware image signing request and the image type;
[0162] S2: Calculate the key credibility based on the key information;
[0163] S3: Select target keys based on the key credibility;
[0164] S4: Based on the image type and target key, sign the firmware image file to be signed to generate a signed firmware image file for users to download and use.
[0165] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0166] Construct a key storage database, which includes a first storage module and a second storage module;
[0167] The key to be imported into the key storage database is marked with a function type, and it is detected whether the key contains both a public key and a private key.
[0168] In response to the detection that the key contains both a public key and a private key, the key is encrypted using a security algorithm, the encrypted key and the security algorithm used are associated and saved in the first storage module, and the encrypted public key and the security algorithm used are associated and saved in the second storage module.
[0169] In response to the detection that the key contains only a public key, the public key is encrypted using a security algorithm, the encrypted public key and the security algorithm used are associated, and the encrypted public key is saved to the second storage module.
[0170] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0171] Extract the key information corresponding to the firmware image signing request in the first storage module;
[0172] Based on the key information and the credibility calculation formula, the credibility of the key is calculated. The credibility calculation formula includes:
[0173]
[0174] Where K represents the credibility value, δ1, δ2, and δ3 represent the security algorithm strength correction coefficient, key function type correction coefficient, and fusion coefficient, respectively, A1 represents the security algorithm strength assignment, A2 represents the key function type assignment, and A3 represents the number of times the key is used.
[0175] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0176] When the confidence value is detected to be greater than a first preset value, the key confidence level is determined to be high.
[0177] In response to detecting that the confidence value is less than or equal to a first preset value and greater than a second preset value, the key confidence level is determined to be medium confidence.
[0178] In response to detecting that the confidence value is less than or equal to a second preset value, the key confidence is determined to be low.
[0179] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0180] In response to detecting that the key's confidence level is medium, and When the value is greater than the third preset value, the key corresponding to the key credibility is determined to be the target key;
[0181] In response to detecting that the key has a high level of confidence, and When the value is greater than the fourth preset value, the key corresponding to the key credibility is determined to be the target key;
[0182] The third preset value is greater than the fourth preset value.
[0183] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0184] Based on the image type and target key, the firmware image file to be signed is signed using a digital signature mechanism to generate a signed firmware image file.
[0185] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0186] In response to detecting a firmware image signature verification request, the public key information corresponding to the firmware image signature verification request is obtained from the second storage module and selected.
[0187] In response to the detection that a signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the information of the signature verification public key. If the comparison is successful, the signature firmware image file is verified.
[0188] In response to the detection that no signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the public key information in the second storage module. If the comparison is successful, the signature firmware image file is verified.
[0189] The system returns the verification result and the corresponding signature public key information for the user to view.
[0190] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this 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. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0191] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0192] The embodiments described above are merely examples of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application.
Claims
1. A firmware image signing method, characterized in that, Applied to a baseboard management controller, the method includes: In response to detecting a firmware image signing request, the system obtains the key information corresponding to the firmware image signing request and the image type. The key information includes the security algorithm strength, the number of times the key is used, and the key function type. The image type is determined based on the attributes of the firmware. Calculate the key credibility based on the key information; Target keys are selected based on the key's credibility. Based on the image type and target key, the firmware image file to be signed is signed to generate a signed firmware image file for users to download and use; Before obtaining the key information corresponding to the firmware image signing request and the image type in response to the detection of a firmware image signing request, the method further includes: Construct a key storage database, which includes a first storage module and a second storage module; The key to be imported into the key storage database is marked with a function type, and it is detected whether the key contains both a public key and a private key. In response to the detection that the key contains both a public key and a private key, the key is encrypted using a security algorithm, the encrypted key and the security algorithm used are associated and saved in the first storage module, and the encrypted public key and the security algorithm used are associated and saved in the second storage module. In response to the detection that the key contains only a public key, the public key is encrypted using a security algorithm, the encrypted public key and the security algorithm used are associated, and the encrypted public key is saved to the second storage module; The step of calculating the key credibility based on the key information includes: Extract the key information corresponding to the firmware image signing request in the first storage module; Based on the key information and the credibility calculation formula, the credibility of the key is calculated. The credibility calculation formula includes: ; in, Indicates the confidence level value. , , These represent the security algorithm strength correction factor, key function type correction factor, and fusion factor, respectively. This indicates the assignment of security algorithm strength. This indicates the key function type assignment. Indicates the number of times the key has been used; Determining the key's credibility based on the calculated credibility value includes: When the confidence value is detected to be greater than a first preset value, the key confidence level is determined to be high. In response to detecting that the confidence value is less than or equal to a first preset value and greater than a second preset value, the key confidence level is determined to be medium confidence. In response to detecting that the confidence value is less than or equal to a second preset value, the key confidence is determined to be low. The process of filtering out target keys based on the key credibility includes: In response to detecting that the key's confidence level is medium, and When the value is greater than the third preset value, the key corresponding to the key credibility is determined to be the target key; In response to detecting that the key has a high level of confidence, and When the value is greater than the fourth preset value, the key corresponding to the key credibility is determined to be the target key; When the key is detected to have low confidence, the key corresponding to that confidence level is filtered out. in, This indicates the assignment of security algorithm strength. The third preset value is greater than the fourth preset value, indicating the number of times the key has been used. After signing the firmware image file to be signed according to the image type and target key to generate a signed firmware image file, the method further includes: In response to the detection of a firmware image signature verification request, the public key information corresponding to the firmware image signature verification request is obtained from the second storage module and selected. In response to the detection that a signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the information of the signature verification public key. If the comparison is successful, the signature firmware image file is verified. In response to the detection that no signature verification public key has been selected, the relevant information of the signature firmware image file is extracted and compared with the public key information in the second storage module. If the comparison is successful, the signature firmware image file is verified. The system returns the verification result and the corresponding signature public key information for the user to view. After verification, the upgrade package is extracted and the firmware is upgraded. If the verification fails, the system prompts the user that the verification failed.
2. The firmware image signing method according to claim 1, characterized in that, Based on the image type and target key, the firmware image file to be signed is signed using a digital signature mechanism to generate a signed firmware image file.
3. 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 steps of the method described in claim 1 or 2.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method described in claim 1 or 2.
Citation Information
Patent Citations
Chip safety starting method and device, storage medium and terminal
CN110990084A