Kernel mirror image verification method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202411533444.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-10-30
AI Technical Summary
The secure startup mechanism of existing embedded devices relies on local mirrored signature verification, resulting in heavy calculation load, extended startup time and degraded device performance.
By setting up a central server, the kernel image sampling data and signature node information sent by the embedded device are received, and the kernel image file is verified using the pre-stored public signature verification key to share the signature verification task of the embedded device.
It significantly improves the efficiency of embedded devices during secure startup, reduces startup time, improves device performance, and ensures the security of communication through a symmetric encryption bidirectional authentication mechanism.
Smart Images

Figure CN119646813A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded operating systems, and in particular to a kernel image verification method, device, electronic equipment and storage medium. Background Art
[0002] Secure boot refers to the process and mechanism of ensuring the integrity of programs running on a platform. The secure boot process establishes a trust relationship between the firmware and the application. After the secure boot function is enabled, unverified kernel image files cannot be loaded on the device, thereby protecting the subsequent operating system generated based on the kernel image file from malicious attacks.
[0003] The existing secure boot mechanism of embedded devices relies on local image signature verification, which usually involves complex asymmetric encryption algorithms. These operations have a heavy computational load on resource-constrained embedded devices, resulting in longer boot time and reduced device performance. Summary of the invention
[0004] The present invention provides a kernel image verification method, device, electronic device and storage medium, which are used to improve the efficiency of embedded devices in a safe startup process, reduce startup time and improve device performance.
[0005] The present invention provides a kernel image verification method, which is applied to a central server and includes the following steps: Receive kernel image sampling data and kernel image signature node information sent by an embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure startup of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device; Based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, the verification process of the kernel image file is executed, and the obtained verification result is sent to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0006] According to a kernel image verification method provided by the present invention, based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, the kernel image file verification process is executed, including: Based on the signature verification public key, the signature of the kernel image signature node information is verified to obtain the sampled hash data; Performing hash calculation on the kernel image sampling data to obtain a target hash value; The target hash value is compared with the sampled hash data, and based on the comparison result, a verification result of the kernel image file is determined.
[0007] According to a kernel image verification method provided by the present invention, before receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, the method further includes: Receiving a first authentication request message, and decrypting the received first authentication request message based on a symmetric key shared with the embedded device, wherein the first authentication request message is generated by encrypting a device identifier of the embedded device and a first random number randomly generated by the embedded device; Authenticate the identity of the embedded device based on the decrypted information, and after the identity authentication is passed, encrypt the first random number and the randomly generated second random number based on the symmetric key, generate a return message, and send the return message to the embedded device, so that after the embedded device receives the return message, it decrypts the return message based on the symmetric key and verifies the first random number obtained after decryption. If the verification is passed, encrypt the second random number obtained after decryption based on the symmetric key, generate a second authentication request message, and send the generated second authentication request message to the central server; The second authentication request message is received, and the second authentication request message is decrypted based on the symmetric key, and the second random number obtained after the decryption is verified to authenticate the identity of the central server.
[0008] The present invention also provides a kernel image verification method, which is applied to an embedded device and comprises the following steps: Sending kernel image sampling data and kernel image signature node information to a central server, so that the central server performs a verification process of the kernel image file based on the received kernel image sampling data and the kernel image signature node information, and a signature verification public key pre-stored in a storage space of the central server, and sends the obtained verification result to the embedded device, wherein the kernel image sampling data is obtained by sampling data of the kernel image file loaded during the secure startup process of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, the secure kernel image file is a kernel image file obtained during the production process of the embedded device, and the signature verification public key corresponds to the signature private key; Receive the verification result sent by the central server.
[0009] According to a kernel image verification method provided by the present invention, the process of determining the kernel image sampling data includes: Determine a plurality of nodes in a tree data structure of the kernel image file, each node corresponding to a type of data in the kernel image file; Based on a preset sampling ratio, data corresponding to each node is sampled to obtain multiple sampling code sequences; Each sampling code sequence is combined to obtain the kernel image sampling data.
[0010] According to a kernel image verification method provided by the present invention, before data sampling is performed on the kernel image file loaded during the secure booting process of the embedded device, the method further includes: Based on the symmetric key shared with the central server, mutual identity authentication is performed with the central server, and it is determined that the identity authentication is successful.
[0011] The present invention also provides a kernel image verification device, which is applied to a central server and includes the following modules: A receiving module, used to receive kernel image sampling data and kernel image signature node information sent by an embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure startup of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device; A verification module is used to perform a verification process of the kernel image file based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, and send the obtained verification result to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0012] The present invention also provides a kernel image verification device, which is applied to an embedded device and includes the following modules: A sending module, used for sending kernel image sampling data and kernel image signature node information to a central server, so that the central server performs a verification process of the kernel image file based on the received kernel image sampling data and the kernel image signature node information, and a signature verification public key pre-stored in a storage space of the central server, and sends the obtained verification result to the embedded device, wherein the kernel image sampling data is obtained by sampling data of the kernel image file loaded during the secure startup process of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, the secure kernel image file is a kernel image file obtained during the production process of the embedded device, and the signature verification public key corresponds to the signature private key; The receiving module is used to receive the verification result sent by the central server.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a kernel image verification method as described above is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the kernel image verification method described in any one of the above is implemented.
[0015] The kernel image verification method, device, electronic device and storage medium provided by the present invention, by setting up a central server, based on receiving kernel image sampling data and kernel image signature node information sent by an embedded device, and the signature verification public key in the storage space of the central server, realizes the verification of the kernel image file loaded by the embedded device, so as to share the signature verification task of the kernel image file of the embedded device during the secure boot process, thereby significantly improving the efficiency of the embedded device during the secure boot process, reducing the boot time, and improving the performance of the device. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure the communication security and reliability of identity authentication between the embedded device and the central server. At the same time, the sampled data extracted from the image is used for image verification, rather than transmitting the complete image or large blocks of data, thereby optimizing the use of network bandwidth. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a conceptual flowchart of the secure boot process provided by the relevant method.
[0018] Figure 2 It is a schematic diagram of the secure boot process of an embedded device provided by a related method.
[0019] Figure 3 It is a schematic diagram of the secure boot RoT process provided by the relevant method.
[0020] Figure 4 It is a schematic diagram of the CoT stage flow chart provided by the relevant method.
[0021] Figure 5 It is a schematic diagram of the generation process of the FIT format Kernel image provided by the relevant method.
[0022] Figure 6 This is one of the flow charts of the kernel image verification method provided by the present invention.
[0023] Figure 7 It is a schematic diagram of the kernel image file signature verification process provided by the present invention.
[0024] Figure 8 This is a schematic diagram of mutual authentication provided by the present invention.
[0025] Fig. 9This is the second flow chart of the kernel image verification method provided by the present invention.
[0026] Fig.10 It is a schematic diagram of the authentication public key embedding and registration process provided by the present invention.
[0027] Fig.11 It is a schematic diagram of the mirror signature node generation process provided by the present invention.
[0028] Fig.12 It is a sampling schematic diagram provided by the present invention.
[0029] Fig.13 This is one of the structural schematic diagrams of the kernel image verification device provided by the present invention.
[0030] Fig.14 This is the second structural schematic diagram of the kernel image verification device provided by the present invention.
[0031] Fig.15 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] Secure Boot refers to the process and mechanism of ensuring the integrity of programs running on a platform. Secure Boot establishes a trust relationship between firmware and applications. After enabling the Secure Boot function, unsigned firmware or programs will not be able to run on the device. In this way, the operating system running on it can be protected from malicious attacks, that is, the operating system is trustworthy and has not been maliciously tampered with. Secure Boot generally uses an asymmetric encryption system to verify whether the signatures of firmware and applications are legitimate. The basic concept can be described as follows Figure 1 The conceptual flow diagram of secure boot provided by the related method is shown as follows. In Secure Boot, the hardware is first verified and loaded, and then the operating system kernel and application are verified and loaded based on the system software Bootloader.
[0034] Specifically for embedded devices, the startup process is as follows Figure 2As shown in the schematic diagram of the secure boot process of embedded devices provided by the relevant method, the boot process generally starts from bootrom, and loads spl, uboot, linux, and applications step by step. In this boot process, when each level of boot program loads the next level of boot image, the image signature verification function is realized, which can be said to be a secure boot.
[0035] In the related methods, the secure boot of embedded devices is divided into two stages (Root of Trust, RoT) and (software chain of trust, CoT). During the secure boot process, the system starts to boot through a pre-trusted root RoT. RoT is usually embedded in hardware and only trusts authenticated boot loaders. As the boot process proceeds, the signature of the code to be loaded is verified at each step. Only when the digital signature of the code matches the public key stored in the device, the system will continue to load the next step of the code. The next CoT is: (Secondary ProgramLoader, spl) verifies the signature of the U-BOOT image and U-BOOT verifies the signature of the Kernel image.
[0036] Among them, the secure boot RoT process of embedded devices is as follows Figure 3 As shown in the secure boot RoT process diagram provided by the relevant method, the signed spl image is stored in the spl or eMMc memory, and the public key used for signature verification is stored in the One-Time Programmable (OTP) memory. After the device is powered on, the firmware on the device uses this signature verification public key to verify the loaded spl image. If the verification passes, the spl is started. This is the general process of RoT.
[0037] According to the device startup process, CoT is divided into two stages: the stage where spl starts U-Boot and the stage where u-boot starts Kernel.
[0038] CoT features such as Figure 4 The CoT stage process diagram provided by the relevant method is shown.
[0039] u-boot has developed the FIT (Flattened Image Tree) image format. Nodes under this image format can add signature attributes and other information, providing conditions for signature verification of the image.
[0040] For the u-boot signature verification kernel image part, the kernel image must be in FIT format and signed by a private key, and the corresponding signature verification public key is stored in the u-boot device tree file.
[0041] For the SPL signature verification u-boot image part, the u-boot image must be in FIT format and signed by a private key, and the corresponding signature verification public key is stored in the SPL device tree file.
[0042] The CoT stage involves three boot entities (spl, u-boot, and Kernel). The images to be securely booted are u-boot and Kernel images. In the context of secure boot CoT, building these two images means adding signature information to them. The generation process of the FIT format Kernel image is as follows: Figure 5 The generation process of the FIT format Kernel image provided by the relevant method is shown in the schematic diagram.
[0043] After the kernel is compiled from the source code, it will output the kernel binary file, device tree file, and rootfs root file system. In order to generate a kernel image in FIT format, you need to write an its file to describe the contents of the FIT image. When the relevant its files and various compiled files of the kernel are ready, use the mkimage tool that comes with the u-boot project, take the above files as input, and output the kernel FIT image. Depending on the set mkimage options, the image may not be signed at this time. When you want to use the mkimage tool to sign the FIT image, prepare the key pair for signature verification in advance, take this key pair and the FIT image as input, set the appropriate mkimage options, and you can output the FIT image with the signature node added and add the public key for signature verification to the specified u-boot device tree file.
[0044] The shortcomings of the related methods are: High computational load: The secure boot mechanism relies on local image signature verification on the embedded device, which usually involves complex asymmetric encryption algorithms. These operations are computationally heavy for resource-constrained embedded devices (such as industrial controllers), resulting in longer boot times and reduced device performance; Poor deployment flexibility: In the secure boot process, embedded devices usually have fixed boot images and corresponding verification data at the production stage. This means that if the image needs to be updated or replaced, the device must be reconfigured or redeployed. This approach lacks flexibility, especially in environments that require frequent updates or maintenance, which makes operations cumbersome and error-prone.
[0045] In view of the defects of the related methods, the present invention proposes a kernel image verification method. Figure 6 One of the flow charts of the kernel image verification method provided by the present invention is shown in FIG. Figure 6The kernel image verification method provided by the present invention is applied to a central server, and the method comprises the following steps: Step 610, receiving kernel image sampling data and kernel image signature node information sent by the embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device, and the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key of the embedded device, and the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is the kernel image file obtained during the production process of the embedded device; Step 620: Based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, execute the verification process of the kernel image file, and send the obtained verification result to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0046] The central server in the present invention is pre-set and is located in the same local area network as the embedded device, and is used to process the signature verification task of the kernel image.
[0047] The following takes the central server executing the kernel image verification method provided by the present invention as an example to describe the technical solution of the present invention in detail.
[0048] In step 610, kernel image sampling data and kernel image signature node information sent by the embedded device are received; wherein, the kernel image sampling data is obtained by sampling data of the kernel image file loaded during the secure startup process of the embedded device, and the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key of the embedded device, and the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device.
[0049] In the secure boot process performed by the boot loader of an embedded device, the kernel image file refers to the file containing the executable code of the operating system kernel.
[0050] The kernel image file may be a kernel image in FIT format. FIT format is a structured tree data structure that contains multiple nodes, each of which usually stores a specific type of data. Common nodes include: / images node: contains specific image data, such as kernel, RAMdisk, fdt, etc.
[0051] / configurations node: contains startup configuration, pointing to specific image data.
[0052] / signatures node: contains signature information, which is used to verify the integrity of the image.
[0053] After obtaining the kernel image file, the boot loader of the embedded device samples the kernel image file. The purpose of data sampling is to extract a representative bit string from the kernel image file, which can effectively reflect the entire kernel image file.
[0054] It should be noted that the signature private key and the verification public key are a pair of keys in encryption technology, which play a vital role in the secure boot and software verification process. Use the signature private key to digitally sign the software image (such as the kernel image in FIT format). The verification public key is the public key corresponding to the signature private key, which is pre-stored in the central server and used by the central server to verify the digital signature of the software image. The use of this pair of keys ensures that the kernel image file has not been tampered with during the distribution process and confirms that the software image is signed by a trusted entity holding the private key. Since the holder of the signature private key is unique, the signature can be used as proof of the source of the software, and the holder cannot deny his signing behavior.
[0055] After the kernel image sampling data is determined, the kernel image sampling data and the kernel image signature node information obtained from the storage space of the embedded device are sent to the central server.
[0056] The kernel image signature node information is determined in advance during the production process of the embedded device, and after being determined, it is stored in the storage space of the embedded device.
[0057] The specific process of determining the kernel image signature node information can be: During the production process of embedded devices, a secure kernel image file will be generated. Among them, the secure kernel image file is a kernel image file that has passed security certification and can be used in the subsequent secure boot process.
[0058] After obtaining the secure kernel image file, data sampling is performed on the secure kernel image file to obtain kernel image sampling data of the secure kernel image file, and hash calculation is performed on the kernel image sampling data of the secure kernel image file to obtain sampling hash data.
[0059] After obtaining the sampled hash data, the sampled hash data is signed based on the signature private key to obtain the kernel image signature node information.
[0060] It is understandable that due to the high load and resource consumption of the asymmetric encryption and verification process, a central server can be set up in the local area network of the embedded device in advance to handle the signature verification task of the kernel image file. Through this distributed verification mechanism, the computing load of the embedded device can be significantly reduced. Among them, the signature verification public key is pre-stored in the storage space of the central server.
[0061] After obtaining the kernel image signature node information and the kernel image sampling data, the boot loader of the embedded device sends the kernel image signature node information and the kernel image sampling data to the central server.
[0062] The central server receives the kernel image signature node information and kernel image sampling data sent by the embedded device.
[0063] In step 620, based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, the verification process of the kernel image file is executed, and the obtained verification result is sent to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0064] The central server receives the kernel image signature node information and kernel image sampling data, and implements the kernel image file verification process based on the kernel image sampling data, the kernel image signature node information and the pre-stored signature verification public key.
[0065] Optionally, the specific verification process may include: Based on the signature verification public key, the kernel image signature node information is verified to obtain the sampled hash data; the kernel image sampled data is hashed to obtain the target hash value; the target hash value is compared with the sampled hash data, and based on the comparison result, the verification result of the kernel image file is determined.
[0066] After determining the verification result, the central service sends the obtained verification result to the embedded device, so that the boot loader of the embedded device executes the subsequent secure startup process based on the verification result.
[0067] The kernel image verification method provided by the present invention realizes verification of the kernel image file loaded by the embedded device by setting up a central server, based on receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, and the signature verification public key in the storage space of the central server, so as to share the signature verification task of the kernel image file of the embedded device in the safe boot process, thereby significantly improving the efficiency of the embedded device in the safe boot process, reducing the boot time, and improving the device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure the communication security and reliability of identity authentication between the embedded device and the central server. At the same time, the sampled data extracted from the image is used for image verification, rather than transmitting the complete image or large blocks of data, thereby optimizing the use of network bandwidth.
[0068] In one embodiment, based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, a verification process of the kernel image file is executed, including: based on the signature verification public key, verifying the kernel image signature node information to obtain the sampled hash data; performing hash calculation on the kernel image sampling data to obtain a target hash value; comparing the target hash value with the sampling hash data, and determining the verification result of the kernel image file based on the comparison result.
[0069] Optionally, the specific verification process can be as follows Figure 7 The kernel image file signature verification process provided by the present invention is shown in the schematic diagram, and the specific process is as follows: Generation of kernel image sampling data: The boot loader of the embedded device loads the kernel image file and extracts kernel image sampling data from the image according to predefined rules: ; in, Sampling data for the kernel image, It is the kernel image file.
[0070] In this step, the kernel image sampling data bits are a bit sequence extracted from the image according to a specific algorithm or a predetermined position for use in the subsequent verification process.
[0071] The boot loader of the embedded device determines the kernel image signature node information signature_node from the kernel image file, and the kernel image signature node information also includes the signature data and the metadata related to the signature algorithm.
[0072] The embedded device's bootloader packages the following data and transmits it to the central server over an encrypted channel: ; in, For the encrypted packaged data, It is a symmetric key shared by the embedded device and the central server, which is used to encrypt the transmitted data to ensure that the data will not be tampered with or stolen during the transmission process.
[0073] The verification process of the central server is: Extract the signature verification public key: The central server extracts the signature verification public key public_key_certificate associated with the kernel image file from the local database or secure storage.
[0074] Verify the signature: The central server uses public_key_certificate to verify the signature of the kernel image signature node information signature_node. The signature verification process will obtain the sampled hash data : ; The Verify function is the core of the signature verification operation, which is used to decrypt the signature data and calculate the hash value of the signature data.
[0075] Calculate the target hash value of the kernel image sampling data: The central server samples the kernel image data received from the embedded device Calculate its target hash value : ; Compare hash values: The central server will and If the two are the same, it means that the kernel image file and the signature node data are complete and have not been tampered with: ; If the comparison results match, the verification is successful, and the central server can return a message indicating successful verification: ; If the comparison fails, a verification failure message is returned: ; In one embodiment, before receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, it also includes: receiving a first authentication request message, and decrypting the received first authentication request message based on the symmetric key shared with the embedded device, the first authentication request message is generated by encrypting the device identifier of the embedded device and the first random number randomly generated by the embedded device; authenticating the identity of the embedded device based on the decrypted information, and after the identity authentication is passed, encrypting the first random number and the randomly generated second random number based on the symmetric key to generate a return message, and sending the return message to the embedded device, so that after the embedded device receives the return message, it decrypts the return message based on the symmetric key and verifies the first random number obtained after decryption. If the verification is passed, encrypting the second random number obtained after decryption based on the symmetric key to generate a second authentication request message, and sending the generated second authentication request message to the central server; receiving the second authentication request message, and decrypting the second authentication request message based on the symmetric key, and verifying the second random number obtained after decryption, so as to authenticate the identity of the central server.
[0076] Specifically, the mutual verification process can be as follows Figure 8 As shown in the mutual authentication schematic diagram provided by the present invention, the specific process is as follows: Key sharing: The embedded device and the central server pre-share a symmetric key , for mutual authentication and secure communications.
[0077] u-boot sends an authentication request message to the central server, including the device identifier and a first random number and use encryption: ; After receiving the message, the central server decrypts it And generate a new second random number R2, which is the same as the first random number After encryption, they are returned to the embedded device: ; Bootloader decryption for embedded devices , verifying that R1 is consistent and confirming the server's identity. The embedded device's bootloader then encrypts using R2 and sends it back to the central server to confirm its own identity: ; Central server decryption , verify whether R2 is consistent and complete mutual authentication.
[0078] Fig. 9 The second flowchart of the kernel image verification method provided by the present invention is shown in FIG. Fig. 9 The kernel image verification method provided by the present invention is applied to a central server, and the method comprises the following steps: Step 910, sending the kernel image sampling data and the kernel image signature node information to the central server, so that the central server performs the verification process of the kernel image file based on the received kernel image sampling data and the kernel image signature node information, and the signature verification public key pre-stored in the storage space of the central server, and sends the obtained verification result to the embedded device, the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure startup process of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, the secure kernel image file is the kernel image file obtained during the production process of the embedded device, and the signature verification public key corresponds to the signature private key; Step 920, receiving the verification result sent by the central server.
[0079] The present invention can implement the kernel image verification process based on the boot loader that performs secure boot on the embedded device. Among them, the boot loader that performs secure boot is also called U-boot (Universal Boot Loader). U-boot is an open source boot loader, mainly used for embedded devices, which supports a variety of different computer architectures and boot protocols. During the secure boot process, U-boot can verify the digital signature of the firmware (such as operating system image, device tree, kernel, etc.) stored on the device. This ensures that the firmware has not been tampered with before startup. The present invention mainly focuses on the U-Boot verification kernel image file stage in secure boot.
[0080] The central server is pre-set and is located in the same local area network as the embedded device to handle the signature verification task of the kernel image.
[0081] The following takes the verification method of the kernel image provided by the present invention executed by the boot loader of an embedded device executing secure startup as an example to describe the technical solution of the present invention in detail.
[0082] Optionally, the system architecture of the embedded device may include: Root of Trust (RoT): The root of the trust chain used for initial secure boot; SPL and boot loader: responsible for loading the boot loader and verifying the signature of the kernel image file in the boot loader; Symmetric key for authentication: The bootloader holds a symmetric key for mutual authentication and encrypted communication with the central server. The bootloader holds the public key for the asymmetric key system used to verify the signature of the kernel image.
[0083] The architecture of the central server includes: Image verification module: It can perform hash calculations on sampled data and also complete signature verification.
[0084] Identity authentication module: Use a symmetric encryption system to encrypt and decrypt communication information to ensure the security of communication with the device and to ensure that both parties in the communication are authenticated.
[0085] Symmetric key set: The set of symmetric keys used for authentication held by all embedded devices connected to this central server, which are generally added to the central server when the embedded devices leave the factory.
[0086] Public key certificate set for signature verification: a set of public keys used to verify the signature of kernel image files, which are usually added to the central server during the "registration" phase with the central server.
[0087] The mapping table of symmetric keys and signature verification public keys is used to select the signature verification public key to be used during the image verification phase. This table is usually updated during the "registration" phase with the central server.
[0088] Embedded device factory delivery and deployment specifically include: The secure boot process from the early RoT stage and the spl to the boot loader stage is consistent with the relevant methods to ensure that the initial trust chain of the system is not affected. This means that in the factory stage of embedded devices, there is not much difference from the original implementation. In the manufacturing stage, confidential information must be placed as the trusted root of RoT to verify the boot boot loader spl. The public key certificate is also embedded in the spl to verify the boot boot loader.
[0089] However, the bootloader embeds a symmetric key that can be used to determine the uniqueness of the device. This key must be securely transmitted to the central server during the device deployment phase, which means that the device is "registered" in the central server. The general process is as follows Fig.10 The authentication public key embedding and registration process provided by the present invention is shown in the schematic diagram.
[0090] In the secure boot process of the related method, in the kernel image file generation stage, after using the mkimage tool to generate a kernel image file in FIT format, this tool and the specified signature private key should be used again to sign the hash value of the newly generated kernel image file, generate a signature node and put it into the kernel image file, and finally embed the corresponding public key certificate of the signature private key into the device tree file of the boot loader.
[0091] Improvements of the present invention include Fig.11 As shown in the schematic diagram of the image signature node generation process provided by the present invention, the improvement is that before using the private key to sign the hash value of the kernel image file, the data of the kernel image file is sampled once, and the sampled data is hashed. The size of the input data used to calculate the hash value is reduced, and the purpose is to reduce the size of the image data transmitted to the central server during the signature verification phase, save bandwidth, and reduce processing time.
[0092] The verification public key is not embedded in the boot loader image, but sent to the central server. The message format sent can be (device identification identifier, verification public key), and the public key in this message is encrypted with the authentication key of this device. After receiving the message, the central server selects the corresponding authentication symmetric key according to the device identifier in the message to decrypt and obtain the verification public key.
[0093] Because the signature verification public key is no longer embedded in the boot loader image, the kernel image file in FIT format can be burned into the device at the factory stage or embedded during the deployment stage.
[0094] Specifically, in step 910, the kernel image sampling data and the kernel image signature node information are sent to the central server, so that the central server performs the verification process of the kernel image file based on the received kernel image sampling data and the kernel image signature node information, and the verification public key pre-stored in the storage space of the central server, and sends the obtained verification result to the embedded device, the kernel image sampling data is obtained by sampling data of the kernel image file loaded during the secure startup process of the embedded device, the kernel image signature node information is pre-stored in the storage space of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampling hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, the secure kernel image file is the kernel image file obtained during the production process of the embedded device, and the verification public key corresponds to the signature private key.
[0095] In the process of secure booting of embedded devices, the kernel image file refers to the file containing the executable code of the operating system kernel.
[0096] The kernel image file may be a kernel image in FIT format. FIT format is a structured tree data structure that contains multiple nodes, each of which usually stores a specific type of data. Common nodes include: / images node: contains specific image data, such as kernel, RAMdisk, fdt, etc.
[0097] / configurations node: contains startup configuration, pointing to specific image data.
[0098] / signatures node: contains signature information, which is used to verify the integrity of the image.
[0099] After obtaining the kernel image file, data sampling is performed on the kernel image file. Data sampling is to extract representative bit strings from the kernel image file, which can effectively reflect the entire kernel image file.
[0100] It should be noted that the signature private key and the verification public key are a pair of keys in encryption technology, which play a vital role in the secure boot and software verification process. Use the signature private key to digitally sign the software image (such as the kernel image in FIT format). The verification public key is the public key corresponding to the signature private key, which is pre-stored in the central server and used by the central server to verify the digital signature of the software image. The use of this pair of keys ensures that the kernel image file has not been tampered with during the distribution process and confirms that the software image is signed by a trusted entity holding the private key. Since the holder of the signature private key is unique, the signature can be used as proof of the source of the software, and the holder cannot deny his signing behavior.
[0101] The kernel image file loaded during the secure boot process of the embedded device is sampled to obtain kernel image sampling data. After the kernel image sampling data is determined, the kernel image sampling data and the kernel image signature node information obtained from the storage space of the embedded device are sent to the central server.
[0102] The kernel image signature node information is determined in advance during the production process of the embedded device, and after being determined, it is stored in the storage space of the embedded device.
[0103] The specific process of determining the kernel image signature node information can be: During the production process of embedded devices, a secure kernel image file will be generated. Among them, the secure kernel image file is a kernel image file that has passed security certification and can be used in the subsequent secure boot process.
[0104] After obtaining the secure kernel image file, data sampling is performed on the secure kernel image file to obtain sampled data of the secure kernel image file, and hash calculation is performed on the sampled data of the secure kernel image file to obtain sampled hash data.
[0105] After obtaining the sampled hash data, the sampled hash data is signed based on the signature private key to obtain the kernel image signature node information.
[0106] It is understandable that due to the high load and resource consumption of the asymmetric encryption and verification process, a central server can be set up in the local area network of the embedded device in advance to handle the signature verification task of the kernel image file. Through this distributed verification mechanism, the computing load of the embedded device can be significantly reduced. Among them, the signature verification public key is pre-stored in the storage space of the central server.
[0107] After the central server receives the kernel image sampling data and kernel image signature node information sent by the embedded device, it implements the verification process of the kernel image file based on the kernel image sampling data, kernel image signature node information and the pre-stored signature verification public key.
[0108] Optionally, the specific verification process may include: Based on the signature verification public key, the kernel image signature node information is verified to obtain the sampled hash data; the kernel image sampled data is hashed to obtain the target hash value; the target hash value is compared with the sampled hash data, and based on the comparison result, the verification result of the kernel image file is determined.
[0109] In step 920, the boot loader of the embedded device executing secure boot receives the verification result sent by the central server, and executes the subsequent secure boot process based on the verification result.
[0110] The kernel image verification method provided by the present invention realizes verification of the kernel image file loaded by the embedded device by setting up a central server, based on receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, and the signature verification public key in the storage space of the central server, so as to share the signature verification task of the kernel image file of the embedded device in the safe boot process, thereby significantly improving the efficiency of the embedded device in the safe boot process, reducing the boot time, and improving the device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure the communication security and reliability of identity authentication between the embedded device and the central server. At the same time, the sampled data extracted from the image is used for image verification, rather than transmitting the complete image or large blocks of data, thereby optimizing the use of network bandwidth.
[0111] In one embodiment, the process of determining kernel image sampling data includes: determining multiple nodes in a tree data structure of the kernel image file, each node corresponding to a type of data in the kernel image file; based on a preset sampling ratio, sampling the data corresponding to each node to obtain multiple sampling code sequences; merging the sampling code sequences to obtain the kernel image sampling data.
[0112] The kernel image file can be a kernel image in FIT (Flattened Image Tree) format. FIT format is a structured tree data structure that contains multiple nodes, each of which corresponds to a type of data in the kernel image file. Common nodes include: / images node: contains specific image data, such as kernel, RAMdisk, fdt, etc.
[0113] / configurations node: contains startup configuration, pointing to specific image data.
[0114] / signatures node: contains signature information, which is used to verify the integrity of the image.
[0115] After the nodes are determined, the preset sampling ratio is used to sample the data corresponding to each node.
[0116] Optionally, the specific sampling process can be as follows Fig.12 As shown in the sampling schematic diagram provided by the present invention, the specific sampling process is as follows: The sampling rule design principles are: Covering key nodes: The sampling rules should ensure that the coding sequence is extracted from key nodes (such as / images, / configurations) to ensure that the obtained coding sequence can represent the integrity of the entire image. Even distribution: The sampling points should be evenly distributed within each node to avoid local sampling bias. Dynamic adjustment: The sampling rules should be able to adapt to different FIT image sizes and structures and have a certain degree of flexibility.
[0117] The specific node selection is based on the principle of priority of key nodes, and the two key nodes / images and / configurations are selected for sampling. Among them, there may be multiple image files (such as kernel, fdt, RAMdisk, etc.) under the / images node, and sampling should be performed from each child node.
[0118] The sampling ratio setting process is: For each key node, a preset sampling ratio is set, for example, 0.1% of the data length of each node is extracted as the basis for the sampling coding sequence. This ratio can be adjusted according to specific needs to balance the sampling accuracy and computing load.
[0119] The specific sampling process is as follows: For each sub-image under the / images node (such as kernel, fdt, RAMdisk), several encoding sequences are selected from each image data block for sampling.
[0120] For example, assuming that a kernel image file is N bytes in size, select several data blocks from it, and select a coding sequence for each block for sampling: ; in, For all sampled encoding sequences sampled from the / images node, Encodes a sequence of individual samples in the / images node.
[0121] The selection strategy can be a fixed interval (such as sampling one bit every m bytes) or a random selection.
[0122] For / configurations node sampling, information related to the startup configuration is sampled, especially references to image data and configuration instructions. A fixed-interval sampling strategy can be used.
[0123] After sampling is completed, merge the sampled encoding sequences. Merge the bit strings extracted from the / images and / configurations nodes to generate the final sampled data: ; Among them, bits is the final sampled data. It is the sequence of all sampled codes sampled from the / images node, and bits_configurations is the sequence of all sampled codes sampled from the / configurations node.
[0124] The merged sampling data should cover multiple key parts of the image and represent the integrity of the entire kernel image file.
[0125] After sampling is completed, the generated sample data is hashed to obtain a hash value H(bits): H(bits)=SHA-256(bits). This hash value will be used in the subsequent image verification process.
[0126] Optional, node weight adjustment: The sampling ratio of each node can be dynamically adjusted according to the needs of different application scenarios. For example, if the content of the / images node is critical to the system, its sampling ratio can be increased. For kernel image files of different sizes and complexities, the sampling strategy can be flexibly adjusted to ensure that representative sampling code sequences can be effectively generated in different situations.
[0127] In one embodiment, before data sampling is performed on the kernel image file loaded during the secure boot process of the embedded device, the method further includes: performing mutual identity authentication with the central server based on the symmetric key shared with the central server, and determining that the identity authentication is passed.
[0128] The process of performing mutual identity authentication based on the symmetric key shared by the embedded device and the central server is a mechanism to ensure the reliability of the identities of both communicating parties in a distributed system.
[0129] Symmetric key cryptography is a method of encrypted communication in which the same key is used for encryption and decryption. This key must be kept secret and can only be shared by the two communicating parties.
[0130] By using a shared symmetric key for mutual authentication, the embedded device and the central server can establish a secure communication environment. This approach simplifies key management because only one key needs to be maintained. The successful execution of the authentication process ensures the confidentiality and integrity of the kernel image file verification.
[0131] Optionally, in the process of sharing symmetric keys between the embedded device and the central server, a secure channel (such as TLS / SSL) can be used for key exchange to ensure confidentiality and integrity during key transmission.
[0132] During the key exchange process, the embedded device and the central server can use the key exchange protocol to negotiate the key. Each party selects a private value, calculates a public value, and then exchanges the public value. The same shared key is calculated based on the received public value and its own private value.
[0133] Before sharing symmetric keys, the identities of embedded devices and central servers are verified through secure authentication mechanisms (such as digital certificates or pre-shared keys) to ensure that only legitimate devices can participate in key exchange.
[0134] Fig.13 This is a schematic diagram of the structure of the kernel image verification device provided by the present invention. Fig.13 , the kernel image verification device provided by the present invention includes: The receiving module 1310 is used to receive kernel image sampling data and kernel image signature node information sent by the embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure startup of the embedded device, and the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key of the embedded device, and the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is the kernel image file obtained during the production process of the embedded device; The verification module 1320 is used to perform the verification process of the kernel image file based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, and send the obtained verification result to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0135] The kernel image verification device provided by the present invention realizes verification of the kernel image file loaded by the embedded device by setting up a central server, based on receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, and the signature verification public key in the storage space of the central server, so as to share the signature verification task of the kernel image file of the embedded device during the secure boot process, thereby significantly improving the efficiency of the embedded device during the secure boot process, reducing the boot time, and improving the device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure the communication security and reliability of identity authentication between the embedded device and the central server. At the same time, the sampled data extracted from the image is used for image verification, rather than transmitting the complete image or large blocks of data, thereby optimizing the use of network bandwidth.
[0136] In one embodiment, the verification module 1320 is specifically used to: Based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, a verification process of the kernel image file is performed, including: Based on the signature verification public key, the signature of the kernel image signature node information is verified to obtain the sampled hash data; Performing hash calculation on the kernel image sampling data to obtain a target hash value; The target hash value is compared with the sampled hash data, and based on the comparison result, a verification result of the kernel image file is determined.
[0137] In one embodiment, the receiving module 1310 is specifically configured to: Before receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, it also includes: Receiving a first authentication request message, and decrypting the received first authentication request message based on a symmetric key shared with the embedded device, wherein the first authentication request message is generated by encrypting a device identifier of the embedded device and a first random number randomly generated by the embedded device; Authenticate the identity of the embedded device based on the decrypted information, and after the identity authentication is passed, encrypt the first random number and the randomly generated second random number based on the symmetric key, generate a return message, and send the return message to the embedded device, so that after the embedded device receives the return message, it decrypts the return message based on the symmetric key and verifies the first random number obtained after decryption. If the verification is passed, encrypt the second random number obtained after decryption based on the symmetric key, generate a second authentication request message, and send the generated second authentication request message to the central server; The second authentication request message is received, and the second authentication request message is decrypted based on the symmetric key, and the second random number obtained after the decryption is verified to authenticate the identity of the central server.
[0138] Fig.14 The second structural diagram of the kernel image verification device provided by the present invention. Fig.14 , the kernel image verification device provided by the present invention includes: The sending module 1410 is used to send the kernel image sampling data and the kernel image signature node information to the central server, so that the central server performs the verification process of the kernel image file based on the received kernel image sampling data and the kernel image signature node information, and the signature verification public key pre-stored in the storage space of the central server, and sends the obtained verification result to the embedded device, the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure startup process of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, the secure kernel image file is the kernel image file obtained during the production process of the embedded device, and the signature verification public key corresponds to the signature private key; The receiving module 1420 is used to receive the verification result sent by the central server.
[0139] The kernel image verification device provided by the present invention realizes verification of the kernel image file loaded by the embedded device by setting up a central server, based on receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, and the signature verification public key in the storage space of the central server, so as to share the signature verification task of the kernel image file of the embedded device during the secure boot process, thereby significantly improving the efficiency of the embedded device during the secure boot process, reducing the boot time, and improving the device performance. A two-way authentication mechanism based on symmetric encryption is introduced between the embedded device and the central server to ensure the communication security and reliability of identity authentication between the embedded device and the central server. At the same time, the sampled data extracted from the image is used for image verification, rather than transmitting the complete image or large blocks of data, thereby optimizing the use of network bandwidth.
[0140] In one embodiment, the sending module 1410 is specifically used for: The process of determining kernel image sampling data includes: Determine a plurality of nodes in a tree data structure of the kernel image file, each node corresponding to a type of data in the kernel image file; Based on a preset sampling ratio, data corresponding to each node is sampled to obtain multiple sampling code sequences; Each sampling code sequence is combined to obtain the kernel image sampling data.
[0141] In one embodiment, the sending module 1410 is further specifically configured to: Before sampling data of the kernel image file loaded during the secure boot process of the embedded device, the method further includes: Based on the symmetric key shared with the central server, mutual identity authentication is performed with the central server, and it is determined that the identity authentication is successful.
[0142] Fig.15 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.15 As shown, the electronic device may include: a processor 1510, a communication interface 1520, a memory 1530 and a communication bus 1540, wherein the processor 1510, the communication interface 1520 and the memory 1530 communicate with each other through the communication bus 1540. The processor 1510 may call the logic instructions in the memory 1530 to execute the kernel image verification method, the method comprising: receiving kernel image sampling data and kernel image signature node information sent by the embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device, the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is the kernel image file obtained during the production process of the embedded device; Based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, the verification process of the kernel image file is executed, and the obtained verification result is sent to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0143] In addition, the logic instructions in the above-mentioned memory 1530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0144] On the other hand, the present invention also provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the kernel image verification method provided by the above methods, the method includes: receiving kernel image sampling data and kernel image signature node information sent by an embedded device; wherein, the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure startup process of the embedded device, the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device; Based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, the verification process of the kernel image file is executed, and the obtained verification result is sent to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0145] On the other hand, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for verifying the kernel image provided by the above methods is implemented, the method comprising: receiving kernel image sampling data and kernel image signature node information sent by an embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure boot process of the embedded device, the kernel image signature node information is obtained by the embedded device signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by hashing the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device; Based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, the verification process of the kernel image file is executed, and the obtained verification result is sent to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
[0146] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0147] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0148] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A kernel image verification method, characterized in that: Applied to a central server, the method comprises: Receive kernel image sampling data and kernel image signature node information sent by an embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure startup of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device; Based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, the verification process of the kernel image file is executed, and the obtained verification result is sent to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
2. The kernel image verification method according to claim 1, characterized in that: The process of executing the verification of the kernel image file based on the kernel image sampling data, the kernel image signature node information and the signature verification public key includes: Based on the signature verification public key, the signature of the kernel image signature node information is verified to obtain the sampled hash data; Performing hash calculation on the kernel image sampling data to obtain a target hash value; The target hash value is compared with the sampled hash data, and based on the comparison result, a verification result of the kernel image file is determined.
3. The kernel image verification method according to claim 1, characterized in that: Before receiving the kernel image sampling data and kernel image signature node information sent by the embedded device, the method further includes: Receiving a first authentication request message, and decrypting the received first authentication request message based on a symmetric key shared with the embedded device, wherein the first authentication request message is generated by encrypting a device identifier of the embedded device and a first random number randomly generated by the embedded device; Authenticate the identity of the embedded device based on the decrypted information, and after the identity authentication is passed, encrypt the first random number and the randomly generated second random number based on the symmetric key, generate a return message, and send the return message to the embedded device, so that after the embedded device receives the return message, it decrypts the return message based on the symmetric key and verifies the first random number obtained after decryption. If the verification is passed, encrypt the second random number obtained after decryption based on the symmetric key, generate a second authentication request message, and send the generated second authentication request message to the central server; The second authentication request message is received, and the second authentication request message is decrypted based on the symmetric key, and the second random number obtained after the decryption is verified to authenticate the identity of the central server.
4. A kernel image verification method, characterized in that: Applied to an embedded device, the method comprises: Sending kernel image sampling data and kernel image signature node information to a central server, so that the central server performs a verification process of the kernel image file based on the received kernel image sampling data and the kernel image signature node information, and a signature verification public key pre-stored in a storage space of the central server, and sends the obtained verification result to the embedded device, wherein the kernel image sampling data is obtained by sampling data of the kernel image file loaded during the secure startup process of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, the secure kernel image file is a kernel image file obtained during the production process of the embedded device, and the signature verification public key corresponds to the signature private key; Receive the verification result sent by the central server.
5. The kernel image verification method according to claim 4, characterized in that: The process of determining the kernel image sampling data includes: Determine a plurality of nodes in a tree data structure of the kernel image file, each node corresponding to a type of data in the kernel image file; Based on a preset sampling ratio, data corresponding to each node is sampled to obtain multiple sampling code sequences; Each sampling code sequence is combined to obtain the kernel image sampling data.
6. The kernel image verification method according to claim 4, characterized in that: Before sampling data of the kernel image file loaded during the secure booting of the embedded device, the method further includes: Based on the symmetric key shared with the central server, mutual identity authentication is performed with the central server, and it is determined that the identity authentication is successful.
7. A kernel image verification device, characterized in that: Applied to a central server, the device comprises: A receiving module, used to receive kernel image sampling data and kernel image signature node information sent by an embedded device; wherein the kernel image sampling data is obtained by sampling the kernel image file loaded during the secure startup of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, and the secure kernel image file is a kernel image file obtained during the production process of the embedded device; A verification module is used to perform a verification process of the kernel image file based on the kernel image sampling data, the kernel image signature node information and the signature verification public key, and send the obtained verification result to the embedded device; wherein the signature verification public key is pre-stored in the storage space of the central server, and the signature verification public key corresponds to the signature private key.
8. A kernel image verification device, characterized in that: Applied to embedded devices, the device comprises: A sending module, used for sending kernel image sampling data and kernel image signature node information to a central server, so that the central server performs a verification process of the kernel image file based on the received kernel image sampling data and the kernel image signature node information, and a signature verification public key pre-stored in a storage space of the central server, and sends the obtained verification result to the embedded device, wherein the kernel image sampling data is obtained by sampling data of the kernel image file loaded during the secure startup process of the embedded device, the kernel image signature node information is obtained by signing the sampled hash data of the embedded device based on the signature private key, the sampled hash data is obtained by performing hash calculation on the sampled data of the secure kernel image file of the embedded device, the secure kernel image file is a kernel image file obtained during the production process of the embedded device, and the signature verification public key corresponds to the signature private key; The receiving module is used to receive the verification result sent by the central server.
9. An electronic 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, the processor implements the kernel image verification method as described in any one of claims 1 to 3, or implements the kernel image verification method as described in any one of claims 4 to 6.
10. A non-transitory 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 kernel image verification method as described in any one of claims 1 to 3, or implements the kernel image verification method as described in any one of claims 4 to 6.
Citation Information
Patent Citations
Embedded system secure start method
CN104156659A
System starting method and device, electronic equipment and storage medium
CN109766134A
TEE-based Internet of Things secure startup implementation method
CN111967019A
SoC chip security design method and hardware platform
CN112784280A
Novel cloud host mirror image file integrity verification method
CN117828676A
Cited By
Server starting control method and electronic equipment
CN120874061A