Signature method, signature verification method and signature verification system for custom mirror image file

By obtaining the random key and platform key, the custom image file is encrypted and signed to ensure its integration with the security verification chain of the Linux system, which solves the problem of user-defined image verification failure and realizes the secure signature of the image file. and signature verification, improving system security.

CN118797745APending Publication Date: 2024-10-18FIBOCOM AUTO INC
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410986873.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

In Linux systems, the independent security verification scheme of user-defined images cannot be integrated with the security verification chain of the entire platform, causing the custom image verification to fail and causing inconvenience to users when using custom image files.

Method used

By obtaining the random key and platform key, use the random key to encrypt and sign the custom image file, and use the platform private key to build the platform signature information to ensure that the signature process of the custom image can be verified with the native verification chain of the platform Fusion to achieve level-by-level verification of image files.

Benefits of technology

It implements the security signature and verification of custom image files, ensuring the integration of the custom image and the system security verification chain, avoiding the problem of verification failure, and improving the convenience of users using custom images and system security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118797745A_ABST
    Figure CN118797745A_ABST
Patent Text Reader

Abstract

The invention provides a signature method for a custom mirror image file. The signature method comprises the following steps: acquiring a random key and a platform key of a verification platform; storing a public key of the random key to a verification public key storage area of a user-defined mirror image file; inputting a private key of the random key into an abstract area to construct signature information; and inputting a private key in the platform key into the abstract area to construct platform signature information, and writing a public key in the platform key into the custom mirror image file to obtain a signature-containing custom mirror image file. According to the method and the device, the signature process of the custom mirror image can be ensured to be fused with the original check chain of the check platform, so that step-by-step check of the mirror image file is realized. The invention further provides a signature verification method, a signature system and a signature verification system of the self-defined mirror image file, a computer readable storage medium and electronic equipment, which have the above beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a signature method, a signature verification method and a system for a custom image file. Background Art

[0002] In the process of developing Linux system communication products, it is necessary to ensure that user applications can be established in a trusted platform environment, and to perform security checks on images at different stages of the system during the startup process. Only authorized images can be loaded and executed by the system. The security verification chain adds encryption checks at each stage of the overall system startup, and in this process, it intelligently determines the authenticity of each program image executed by the current system. The function of this verification chain can prevent any unauthorized or maliciously modified software from running in the system.

[0003] Currently, for scenarios where users customize images and image signature verification is performed independently for different customers, the independent security verification solution for the customer's newly added customized image cannot be integrated with the security verification chain of the entire platform, which can easily cause customized image verification failures and cause inconvenience to users in using customized image files. Summary of the invention

[0004] The purpose of this application is to provide a signature method, a signature verification method, a signature system, a signature verification system, a computer-readable storage medium and an electronic device for a custom image file, which can realize the signature and signature verification of a user-defined image.

[0005] In order to solve the above technical problems, this application provides a signature method for a custom image file, and the specific technical solution is as follows:

[0006] Get the random key and the platform key of the verification platform;

[0007] Storing the public key of the random key in the verification public key storage area of ​​the custom image file;

[0008] Input the private key of the random key into the summary area to construct signature information;

[0009] The private key in the platform key is input into the summary area to construct the platform signature information, and the public key in the platform key is written into the custom image file to obtain the custom image file with signature.

[0010] Optionally, before obtaining the random key and verifying the platform key of the platform, the following steps are also included:

[0011] The random key using a set encryption algorithm is generated using a software library package.

[0012] Optionally, inputting the private key of the random key into the summary area to construct signature information includes:

[0013] Entering the private key of the random key into the summary area;

[0014] Extracting information from the custom image file using a hash tree in the summary area to obtain summary information;

[0015] The summary information is encrypted using the private key to obtain signature information.

[0016] The present application also provides a method for verifying a signature of a custom image file, the method comprising:

[0017] Get the public key from the platform key contained in the signed custom image file;

[0018] Calculate the hash value of the public key, and determine whether the hash value is consistent with the hash value of the platform public key burned by the electronic fuse in the verification platform;

[0019] If they are consistent, the signature information of the custom image file is decrypted using the public key in the platform key to obtain the signature information;

[0020] Extracting the integrity metadata signature from the custom image file containing the signature, and verifying the consistency between the signature information and the integrity metadata signature;

[0021] If they are consistent, it is confirmed that the custom image file containing the signature is credible.

[0022] Optionally, extracting the integrity metadata signature from the custom image file containing the signature includes:

[0023] The device mapping program is called to extract the integrity metadata signature in the signature-containing custom image file.

[0024] Optionally, after confirming that the custom image file is credible, the process further includes:

[0025] Mount the signature-containing custom image file to the image file directory.

[0026] This application also provides a signature system for a custom image file, including:

[0027] A key acquisition module, used to obtain a random key and a platform key of a verification platform;

[0028] A public key storage module, used to store the public key of the random key in the verification public key storage area of ​​the custom image file;

[0029] A first signature generation module, used for inputting the private key of the random key into the summary area to construct signature information;

[0030] The second signature generation module is used to input the private key in the platform key into the summary area to construct the platform signature information, and write the public key in the platform key into the custom image file to obtain the signature-containing custom image file.

[0031] This application also provides a custom image file signature verification system, including:

[0032] The public key extraction module is used to obtain the public key in the platform key contained in the custom image file with signature;

[0033] A public key verification module, used to calculate the hash value of the public key and determine whether the hash value is consistent with the platform public key hash value burned by the electronic fuse in the verification platform;

[0034] A signature extraction module, used for decrypting the signature information of the custom image file using the public key in the platform key to obtain the signature information when the public key verification module confirms that the hash value is consistent with the platform public key hash value;

[0035] The signature verification module is used to extract the integrity metadata signature in the custom image file containing the signature, verify the consistency between the signature information and the integrity metadata signature; when the signature information is consistent with the integrity metadata signature, confirm that the custom image file containing the signature is credible.

[0036] The present application also provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the steps of the above-mentioned method when executed by a processor.

[0037] The present application also provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned method when calling the computer program in the memory.

[0038] The present application provides a signing method for a custom image file, comprising: obtaining a random key and a platform key of a verification platform; storing the public key of the random key in a verification public key storage area of ​​the custom image file; inputting the private key of the random key into a summary area to construct signature information; inputting the private key in the platform key into the summary area to construct platform signature information, and writing the public key in the platform key into the custom image file to obtain a custom image file with a signature.

[0039] When this application signs a custom image file, it first uses a random key to encrypt and sign the file content, and then uses the platform private key to construct the platform signature information to ensure that the signature process of the custom image can be integrated with the native verification chain of the verification platform to achieve step-by-step verification of the image file.

[0040] The present application also provides a signature verification method, a signature system, a signature verification system, a computer-readable storage medium and an electronic device for a custom image file, which have the above-mentioned beneficial effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0042] Figure 1 A flowchart of a method for signing a custom image file provided in an embodiment of the present application;

[0043] Figure 2 A flowchart of a method for verifying a signature of a custom image file provided in an embodiment of the present application;

[0044] Figure 3 A schematic diagram of the signature system structure of a custom image file provided in an embodiment of the present application;

[0045] Figure 4 A schematic diagram of the structure of a signature verification system for a custom image file provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0047] Please refer to Figure 1 , Figure 1 A flowchart of a method for signing a custom image file provided in an embodiment of the present application, the method comprising:

[0048] S101: Obtain a random key and a platform key of a verification platform;

[0049] S102: storing the public key of the random key in the verification public key storage area of ​​the custom image file;

[0050] S103: Inputting the private key of the random key into the summary area to construct signature information;

[0051] S104: Input the private key in the platform key into the summary area to construct platform signature information, and write the public key in the platform key into the custom image file to obtain a custom image file with a signature.

[0052] This application can be developed based on a third-party Linux platform. All functions are written in C, C++, and shell scripts, and only standard function libraries and adaptation layer functions are called. All system-related functions need to be encapsulated in specified files to facilitate future porting and modification. The custom image file can be in the OEM app image format. OEM app provides a one-stop customization service, allowing developers to customize the latest version of the public version of the APP, including customization of the user interface (UI) and function extension configuration. This service model does not require the developer to design an application from scratch, and can quickly build a smart hardware APP that meets its own brand style through a SaaS template.

[0053] First, obtain the random key and the platform key of the verification platform. In this embodiment, the random key is used to verify the custom image file, and the platform key is used to ensure that the verification of the custom image file is integrated with the existing verification chain. Usually, the security verification chain software of the verification platform can simultaneously support 4 different formats of images for signing. At different stages of system startup, the way to verify partition data will be different depending on the size of the partition. For small partitions, the partition data is directly read into the memory and then the hash value of the partition is calculated for verification. For large partitions, if the same verification method is used, loading and calculation will be very time-consuming. Because DM-verity works between the file system and the block device, it only verifies the data blocks read by the file system, rather than verifying all the data blocks in the entire partition at once.

[0054] This embodiment does not limit how to obtain the random key, and the software library package can be used to generate a random key using a set encryption algorithm. The set encryption algorithm used is not limited here, and symmetric encryption or asymmetric encryption can be used. At the same time, the key format of the random key is not limited, and it can be PEM or DER format. The PEM format stores the key in text form, which is more suitable for users to read; while the DER format is stored in binary form. The platform key of the verification platform is provided by the platform.

[0055] Thereafter, the public key of the random key can be stored in the verification public key storage area of ​​the custom image file, and the private key of the random key can be entered into the summary area to construct the signature information.

[0056] There is no limitation on how to construct the signature information. In one feasible implementation, the private key of the random key can be input into the summary area, and the hash tree is used to extract information from the custom image file in the summary area to obtain the summary information, and the private key is used to encrypt the summary information to obtain the signature information.

[0057] Finally, you need to enter the platform key into the summary area to build the platform signature information, and write the public key in the platform key into the custom image file to obtain a custom image file with a signature.

[0058] At this point, the signing process for the custom image file is completed.

[0059] When signing a custom image file, the embodiment of the present application first uses a random key to encrypt and sign the file content, and then uses the platform private key to construct the platform signature information, ensuring that the signature process of the custom image can be integrated with the native verification chain of the verification platform to achieve step-by-step verification of the image file.

[0060] The following is an explanation of the signature verification method for the custom image file provided by the present application. The signature verification method is based on the signature method for the custom image file described in the above embodiment to obtain the signature of the custom image file. Figure 2 , Figure 2 A flowchart of a signature verification method for a custom image file provided in an embodiment of the present application, the signature verification method comprising:

[0061] S201: Obtain the public key in the platform key contained in the custom image file with signature;

[0062] S202: Calculate the hash value of the public key, and determine whether the hash value is consistent with the hash value of the platform public key burned by the electronic fuse in the verification platform; if they are consistent, proceed to S203;

[0063] S203: Decrypt the signature information of the custom image file using the public key in the platform key to obtain the signature information;

[0064] S204: extracting the integrity metadata signature from the signature-containing custom image file, and verifying the consistency between the signature information and the integrity metadata signature; if they are consistent, proceeding to S205;

[0065] S205: Confirm that the signature-containing custom image file is credible.

[0066] Of course, if any consistency verification in steps S202 and S204 fails, it indicates that there is an abnormality in the custom image file containing the signature, and the application cannot be mounted normally at this time.

[0067] When verifying the signature, it is necessary to calculate whether the public key in the platform key contained in the custom image file containing the signature is consistent with the public key in the platform key burned into the electronic fuse in the verification platform. If they are consistent, it means that the platform key in the custom image file containing the signature is credible, that is, the platform signature information is credible. After that, the platform key can be applied to decrypt the signature to verify whether the signature information is valid. Specifically, extract the integrity metadata signature in the custom image file containing the signature, and verify the consistency of the signature information and the integrity metadata signature. If they are consistent, it indicates that the custom image file containing the signature is credible. After that, the custom image file containing the signature can be mounted to the image file directory.

[0068] It can be seen that this embodiment implements a step-by-step verification of a custom image file containing a signature. First, the public key in the platform key is determined. This verification is mainly used to ensure that the verification of the custom image file containing a signature is integrated with the system security chain. After that, the signature information is further verified to ensure that the custom image file containing the signature has not been tampered with and ensures its credibility. It can be seen that after the double verification is passed, the security verification of the custom image file containing the signature can be realized, and the integration with several other signature format verifications can be realized, which can ensure the integrity of the system security chain verification.

[0069] The following is an explanation of the signature method of the custom image file provided by this application using a specific application process of this application:

[0070] The first step is to copy all the image files in the unsigned directory of the non-secure version to the input directory;

[0071] Step 2: Copy the oemapp.ubi file to the input directory;

[0072] The third step is to execute the following script to sign the custom image file.

[0073] Execute: . / sign_tools.sh local.

[0074] After successful execution, a secure version file will be generated under output.

[0075] The unsigned directory contains non-secure versions of custom image files, that is, custom image files that have not been signed. The oemapp.ubi file is a UBIFS-formatted file that contains oemapp data and is often used to store firmware or system images in embedded Linux systems. After that, the script can be executed to sign the custom image file. After the signature is successful, a secure version file is output, that is, a custom image file with a signature.

[0076] After executing the script, obtain the random key pre-generated by openssl and the platform key sbc of the verification platform.

[0077] Then store the public key of the random secret key in the verification public key storage area of ​​the custom image file, for example, it can be stored in the dm-verity pk area;

[0078] Enter the private key of the random key into the summary area to build a hash tree structure and signature information; the summary area can be fibosign tool. Fibo sign tool is a tool for signing and verifying firmware image files, mainly used to ensure the integrity and reliability of firmware during the upgrade process of embedded system firmware.

[0079] After that, input the private key of the platform key sbc into the fibo sign tool to build the platform signature information, and write the public key of the platform key sbc into the custom image file to obtain the custom image file with signature.

[0080] Custom images use random keys to ensure the independence of signature verification for different customers, and use the platform key sbc to build platform signature information to ensure that the verification of customer customized images can be integrated into the entire security verification chain of the platform.

[0081] After that, for the custom image file with signature, it contains four parts of data, namely, the custom image file oemapp data, the public key of the random key, the signature information obtained after encryption by the private key in the random key, and the public key in the platform key sbc.

[0082] When verifying the signature, you can calculate the sbc public key hash value in the custom image file OEMApp containing the signature, and determine whether the hash value is equal to the sbc public key hash value burned in the electronic fuse eFuse. If they are consistent, the public key of the platform key sbc is credible. This step is to verify the credibility of the platform key.

[0083] If the public key of the platform key sbc is credible, use the sbc public key to decrypt the signature information and verify whether the public key of the random key is valid. This step is to verify the credibility of the random key.

[0084] After the platform key and random key are confirmed to be credible, the content of the custom image file can be verified and extracted. Specifically, the dm_init program can be used to verify the integrity metadata signature vbmeta (Verified Boot meta) carried in oemapp through dm-verity pk. Specifically, the hashtree of oemapp can be calculated and compared with the hashtree in vbmeta. If they are consistent, it means that the oemapp image data is credible. Then mount the oemapp partition data to the oemapp directory.

[0085] The process of using the dm_init program to verify the integrity metadata signature vbmeta (Verified Boot meta) carried in the oemapp through dm-verity pk is as follows:

[0086] When the system starts, the dm_init function initializes the root node of the device model and scans and binds available devices. dm-verity pk is a tool used to verify the vbmeta signature stored on the device, using the public key to verify the authenticity of the signature. During the system startup process, the dm_init function reads the vbmeta signature in the oemapp and passes it to dm-verity pk for verification. dm-verity pk uses the public key to decrypt the vbmeta signature and compares it with the integrity metadata on the device to confirm whether the custom image file with the signature has been tampered with. If the vbmeta signature verification is successful, it means that the custom image file with the signature has not been tampered with; otherwise, an error message may be displayed.

[0087] Through the above steps, the dm_init program can verify the vbmeta signature carried in the oemapp through dm-verity pk to ensure that the firmware or operating system image running on the device during the startup process has not been tampered with, thereby improving the security of the system.

[0088] The following is an introduction to a signature system for a custom image file provided in an embodiment of the present application. The signature system described below and the signature method for the custom image file described above can refer to each other.

[0089] join Figure 3 , Figure 3 This is a schematic diagram of the structure of a signature system for a custom image file provided in an embodiment of the present application. The present application also provides a signature system for a custom image file, including:

[0090] A key acquisition module, used to obtain a random key and a platform key of a verification platform;

[0091] A public key storage module, used to store the public key of the random key in the verification public key storage area of ​​the custom image file;

[0092] A first signature generation module, used for inputting the private key of the random key into the summary area to construct signature information;

[0093] The second signature generation module is used to input the private key in the platform key into the summary area to construct the platform signature information, and write the public key in the platform key into the custom image file to obtain the signature-containing custom image file.

[0094] A signature verification system for a custom image file provided in an embodiment of the present application is introduced below. The signature verification system described below and the signature verification method for a custom image file described above can refer to each other.

[0095] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a signature verification system for a custom image file provided in an embodiment of the present application. The present application also provides a signature verification system for a custom image file, including:

[0096] The public key extraction module is used to obtain the public key in the platform key contained in the custom image file with signature;

[0097] A public key verification module, used to calculate the hash value of the public key and determine whether the hash value is consistent with the platform public key hash value burned by the electronic fuse in the verification platform;

[0098] A signature extraction module, used for decrypting the signature information of the custom image file using the public key in the platform key to obtain the signature information when the public key verification module confirms that the hash value is consistent with the platform public key hash value;

[0099] The signature verification module is used to extract the integrity metadata signature in the custom image file containing the signature, verify the consistency between the signature information and the integrity metadata signature; when the signature information is consistent with the integrity metadata signature, confirm that the custom image file containing the signature is credible.

[0100] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0101] The present application also provides an electronic device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the electronic device may also include various network interfaces, power supplies and other components.

[0102] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the system provided in the embodiment, since it corresponds to the method provided in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0103] Specific examples are used herein to illustrate the principles and implementation methods of the present application, and the description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

[0104] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A signature method for a custom image file. It is characterized in that include: Get the random key and the platform key of the verification platform; Storing the public key of the random key in the verification public key storage area of ​​the custom image file; Input the private key of the random key into the summary area to construct signature information; The private key in the platform key is input into the summary area to construct the platform signature information, and the public key in the platform key is written into the custom image file to obtain the custom image file with signature.

2. The verification method according to claim 1, It is characterized in that Before obtaining the random key and verifying the platform key of the platform, it also includes: The random key using a set encryption algorithm is generated using a software library package.

3. The verification method according to claim 1, It is characterized in that The step of inputting the private key of the random key into the summary area to construct the signature information comprises: Entering the private key of the random key into the summary area; Extracting information from the custom image file using a hash tree in the summary area to obtain summary information; The summary information is encrypted using the private key to obtain signature information.

4. A signature verification method for a custom image file. It is characterized in that The signature verification method for the custom image file obtained based on the signature method of the custom image file according to any one of claims 1 to 3 includes: Get the public key from the platform key contained in the signed custom image file; Calculate the hash value of the public key, and determine whether the hash value is consistent with the hash value of the platform public key burned by the electronic fuse in the verification platform; If they are consistent, the signature information of the custom image file is decrypted using the public key in the platform key to obtain the signature information; Extracting the integrity metadata signature from the custom image file containing the signature, and verifying the consistency between the signature information and the integrity metadata signature; If they are consistent, it is confirmed that the custom image file containing the signature is credible.

5. The signature verification method of the custom image file according to claim 4, It is characterized in that The step of extracting the integrity metadata signature from the signature-containing custom image file comprises: The device mapping program is called to extract the integrity metadata signature in the signature-containing custom image file.

6. The signature verification method of a custom image file according to claim 4, It is characterized in that After confirming that the custom image file is credible, the following steps are also included: Mount the signature-containing custom image file to the image file directory.

7. A signature system for custom image files, It is characterized in that include: A key acquisition module, used to obtain a random key and a platform key of a verification platform; A public key storage module, used to store the public key of the random key in the verification public key storage area of ​​the custom image file; A first signature generation module, used for inputting the private key of the random key into the summary area to construct signature information; The second signature generation module is used to input the private key in the platform key into the summary area to construct the platform signature information, and write the public key in the platform key into the custom image file to obtain the signature-containing custom image file.

8. A signature verification system for custom image files. It is characterized in that include: The public key extraction module is used to obtain the public key in the platform key contained in the custom image file with signature; A public key verification module, used to calculate the hash value of the public key and determine whether the hash value is consistent with the platform public key hash value burned by the electronic fuse in the verification platform; A signature extraction module, used for decrypting the signature information of the custom image file using the public key in the platform key to obtain the signature information when the public key verification module confirms that the hash value is consistent with the platform public key hash value; A signature verification module, used to extract the integrity metadata signature in the signature-containing custom image file, and verify the consistency between the signature information and the integrity metadata signature; When the signature information is consistent with the integrity metadata signature, it is confirmed that the custom image file containing the signature is credible.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 or 4 to 5 are implemented.

10. An electronic device, It is characterized in that The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps of the method according to any one of claims 1 to 3 or 4 to 5 are implemented.

Citation Information

Cited By

  • Mirror image verification method and device based on double-trust-chain mechanism, equipment and medium

    CN119602968A

  • An image verification method and device based on a double trust chain mechanism, equipment and medium

    CN119602968B

  • Encapsulation method and de-capsulation method of mirror image file, encryption equipment and communication terminal

    CN119892519A