Automatic encryption multi-level key management method and system based on TPM (Trusted Platform Module)

By adopting an automated encryption multi-level key management method based on TPM, the problems of easy key loss, leakage and high cost are solved, and high security and low cost key management are achieved. It is applicable to a variety of business systems and avoids key leakage and loss.

CN122027147APending Publication Date: 2026-05-12KYLIN CORP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
KYLIN CORP
Filing Date
2026-03-30
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing multi-level key management schemes are prone to key loss and leakage, and are costly, making them unsuitable for network isolation environments. In TPM, KEK key storage lacks protective measures and is easily leaked during decryption.

Method used

It adopts an automated encryption multi-level key management method based on TPM, which generates a multi-level key system through TPM, combines multi-factor authentication and automated secure and trusted storage, and utilizes the hardware security mechanism of TPM to realize automated management and persistent storage of keys, avoiding the storage of keys in the file system. It uses asymmetric key encryption and is suitable for a variety of business systems.

Benefits of technology

It achieves highly secure and low-cost key management, reduces the risk of data corruption and leakage, automates key management, eliminates the need for local storage, is suitable for various business systems, and avoids key leakage and loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122027147A_ABST
    Figure CN122027147A_ABST
Patent Text Reader

Abstract

The invention provides an automatic encryption multi-level key management method and system based on a TPM, and the method comprises the steps: generating a multi-level key system based on the TPM, which comprises the steps: generating a first-level master key, deriving a second-level encryption key KEK for key encryption based on the first-level master key, and deriving a third-level encryption key DEK for data encryption; performing multi-factor authentication on the multi-level key system; a non-volatile region NV key and a storage index address of a trusted platform module TPM are automatically derived based on user and hardware information, and multi-level keys are persistently stored. According to the method, a safe and reliable multi-level key management system is constructed, NV key and index management of the user can be automatically completed, the safety and integrity of the key are effectively guaranteed, and meanwhile flexible and efficient key management is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of information security technology, specifically relating to an automated encryption multi-level key management method and system based on TPM. Background Technology

[0002] In today's digital age, data security and privacy are paramount. With the rapid development of information technology, the amount of data processed and stored by various information systems is constantly increasing, and the security threats facing data are becoming increasingly diverse, such as data leakage, tampering, and unauthorized access. To protect data security, encryption technology has become an important means. The core of encryption technology lies in key management, including key generation, storage, encryption, distribution, and use. A secure and efficient key management system plays a crucial role in ensuring the security of the entire information system.

[0003] In system application scenarios, it is often necessary to manage a large number of keys, which may have different levels and purposes. For example, user data may need to be encrypted using multiple levels of keys to ensure the security of the data during transmission and storage. How to effectively store, encrypt, and manage multi-level keys is a pressing problem in the field of information security.

[0004] Existing technologies propose using a multi-level key system consisting of a set of asymmetric encryption keys (KEK) and a set of symmetric encryption keys (DEK) to achieve data encryption and key protection. This scheme uses the symmetric encryption key DEK to encrypt the data, then uses the private key of the asymmetric key KEK to encrypt the symmetric key DEK, and stores the encrypted symmetric key ciphertext locally. The encrypted data and the public key of the asymmetric key KEK are stored on a cloud server. However, in this scheme, both the private key of KEK and the ciphertext data of DEK require personal management by the user or system and are stored in the file system, posing a risk of loss and leakage, resulting in low security. Once the file system is attacked, the keys can be easily stolen. For example, malware can infect the computer system, obtain the file storing the keys, and then obtain the keys to perform illegal operations on the data. Furthermore, since the KEK public key and ciphertext data are stored on the cloud server, if the cloud server data is leaked and the user obtains the local DEK ciphertext data, the data can be decrypted and leaked, posing a significant data breach risk. Additionally, this scheme uses cloud servers for data storage, which is costly and unsuitable for network-isolated environments.

[0005] Existing technologies have proposed a method for data encryption and key protection using a multi-level key system consisting of a set of symmetric encryption keys KEK and a set of symmetric encryption keys DEK. This method uses DEK to encrypt data and stores it locally, and uses KEK to encrypt DEK and store it locally, storing KEK in a TPM chip. When a data encryption / decryption request is received, the DEK ciphertext data is retrieved locally, the KEK key is retrieved from the TPM, the DEK ciphertext is decrypted using the KEK key to obtain the DEK, and then the DEK is used for further encryption / decryption. However, this scheme uses local storage of DEK ciphertext data, which is prone to loss and leakage. Furthermore, since KEK uses symmetric encryption keys, the key must be securely shared before encryption and decryption; if the key is leaked, all data is exposed, limiting the application scenarios of KEK. Additionally, there are no protective measures for storing the KEK key in the TPM; the key needs to be retrieved from the TPM for decryption, making KEK easily leaked and causing data breaches. Moreover, the key stored in the NV section of the TPM is not encrypted, making it easy to read and crack. Summary of the Invention

[0006] The purpose of this invention is to provide an automated encryption multi-level key management method and system based on TPM. Through the Trusted Platform Module (TPM), it realizes automated multi-level key storage, encryption and management, and builds a secure and reliable multi-level key management system. It can automatically complete the management of user NV keys (non-volatile zone keys) and indexes, effectively ensuring the security and integrity of keys, while achieving flexible and efficient key management.

[0007] To achieve the above objectives, the technical solution of the present invention is as follows: An automated, multi-level encrypted key management method based on TPM, comprising: S1. Generate a multi-level key system based on the Trusted Platform Module (TPM), including generating a primary master key, deriving a secondary encryption key (KEK) for key encryption based on the primary master key, and a tertiary encryption key (DEK) for data encryption. S2. Multi-factor authentication is adopted for the multi-level key system. The first-level master key is bound to the platform configuration register (PCR) of the Trusted Platform Module (TPM) for authentication. The second-level encryption key (KEK) is encrypted and decrypted using the incoming password. The third-level encryption key (DEK) is encrypted and decrypted using the second-level encryption key (KEK). S3. Based on user and hardware information, automatically derive the non-volatile zone (NV) key and storage index address of the Trusted Platform Module (TPM) and persistently store multi-level keys.

[0008] Furthermore, the primary master key mentioned in step S1 is generated by calling the TPM2CreatePrimary key generation function of TPM.

[0009] Furthermore, the secondary encryption key KEK mentioned in step S1 is an asymmetric encryption key generated by calling the Create function of TPM with the primary master key as the parent key.

[0010] Furthermore, the third-level encryption key DEK mentioned in step S1 is a symmetric encryption key generated by calling the Create function of TPM with the first-level master key as the parent key.

[0011] Furthermore, in step S2, the authentication of the primary master key includes: reading one or more platform configuration registers (PCRs), creating a PCR policy, and binding the primary master key to the PCR policy after its generation to protect the security of the multi-level key system.

[0012] Furthermore, in step S2, the third-level encryption key DEK is encrypted using the public key of the second-level encryption key KEK, and decrypted using the private key of the second-level encryption key KEK.

[0013] Furthermore, step S3 includes: S301, NV Key Automated Generation: Obtain user information and hardware information as key seeds to generate NV space encryption keys; S302, NV Index Automated Generation: Based on user information and hardware information, the initial index address is calculated using a hybrid hash algorithm; the NV space is then probed for status based on the initial index address and the NV space encryption key. If the space probe meets expectations, it is a valid NV key and storage index address.

[0014] Furthermore, step S301 includes: The first element of the mixed hash is obtained by calculating the username; the second element of the mixed hash is obtained by calculating the UID; and the third element of the mixed hash is obtained by calculating the MAC address. Finally, a combined hash operation is performed on the first, second, and third elements of the mixed hash to obtain the initial index address.

[0015] Furthermore, step S302 also includes: if the space detection does not meet expectations, a quadratic probing method is used as the index conflict resolution algorithm, the probing step size increases non-linearly with the number of attempts, a prime number larger than the index space is used for modulo, and the state detection of the NV space is continued.

[0016] In another aspect, this invention also proposes an automated multi-level encrypted key management system based on TPM, which, when applied to the aforementioned automated multi-level encrypted key management method based on TPM, includes: System application module: Provides an interface to the application, enabling the application to request the required key through the interface and use the key under the authorization of TPM; Key Management Module: Responsible for the automatic management of NV keys and indexes based on user and hardware information, and interacting with the TPM module to realize the generation, encryption, storage, distribution and management of multi-level keys; TPM Adaptation Module: Adapts to the TPM software stack interface, enabling trusted storage and algorithm function calls within the TPM without leaving the TPM; the TPM software stack interface adaptation means being able to correctly interact with the TPM and its software stack, ensuring that the security functions provided by the TPM can be utilized.

[0017] During management system initialization, a primary master key is generated and PCR-bound via the TPM adapter module, and persistently stored in the TPM chip. When the application / system requires encryption / decryption, the key management module calls the TPM adapter module to derive a secondary encryption key KEK based on the primary master key, and randomly generates a tertiary encryption key DEK. The secondary encryption key KEK is encrypted with a password to obtain the KEK ciphertext, and the tertiary encryption key DEK is encrypted with the secondary encryption key KEK to obtain the DEK ciphertext. The KEK ciphertext and DEK ciphertext are persistently stored in the TPM chip.

[0018] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention has a high degree of automated management capability. All data and keys are automatically generated and managed without the need for local storage management, thus reducing the risk of data corruption and leakage.

[0019] 2. This invention has high security. It utilizes the hardware security mechanism of TPM to ensure the security of key storage, encryption and management processes, and prevent keys from being stolen or tampered with.

[0020] 3. This invention is highly user-friendly. Users and applications do not need to consider the storage scheme of key files and configuration data. The storage of key data is completely transparent to the user, making it simple and easy to use. The KEK key uses asymmetric keys, making it suitable for various business systems, and decoupling encryption and decryption business systems.

[0021] 4. This invention is low-cost. Compared to traditional hardware security modules (HSM), this invention is based on TPM, requiring no additional hardware equipment and reducing costs. It adopts a localized solution, requiring no investment in other business systems and can be used on a single machine. Attached Figure Description

[0022] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the multi-level key system of Embodiment 2 of the present invention; Figure 3 This is the implementation process of the multi-level key system in Embodiment 2 of this aspect; Figure 4This is a schematic diagram of the key management system architecture of Embodiment 4 of the present invention; Figure 5 This is a flowchart of the encryption and decryption process of the key management system in Embodiment 4 of the present invention. Detailed Implementation

[0023] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.

[0024] First, the technical terms and abbreviations used in the implementation of this invention will be explained.

[0025] NV: Non-volatile region; PBKDF2: A cryptographic key derivation algorithm; KEK: Key Encrypt Key; DEK: Data Encrypt Key; TPM: Trusted Platform Module, is a hardware module designed to improve the security of a computer platform; PCR: Platform Configuration Register, TPM's platform configuration register.

[0026] The core design concept of this invention is to utilize the tamper-proof and secure storage characteristics of TPM, and to solve the problems of data storage key management and NV index persistence recording by adopting transparent key generation and NV index automatic detection technology. This will build a secure and reliable multi-level key management system that can automatically complete the management of user NV keys and indexes, effectively ensure the security and integrity of keys, and achieve flexible and efficient key management.

[0027] The present invention will now be described in detail with reference to specific embodiments and accompanying drawings.

[0028] Example 1: The TPM-based automated encryption multi-level key management method proposed in this embodiment adopts an architecture that combines a multi-level key system with multi-factor authentication and automated secure and trusted storage, such as... Figure 1 As shown, it includes: I. Multi-level key system: Primary Key: A unique master key for the entire system, persistently stored at a specified address on the Trusted Platform Module (TPM) chip, serving as the system's root key of trust.

[0029] Secondary key encryption key (KEK): The TPM chip derives the secondary encryption key KEK based on the primary master key. The secondary encryption key KEK is an asymmetric encryption key, which is encrypted with the public key and decrypted with the private key. It has a wide range of applications and is used in this embodiment to encrypt other keys (tertiary keys).

[0030] The Level 3 Data Encryption Key (DEK): The TPM chip derives the Level 3 encryption key DEK from the Level 1 master key. The Level 3 encryption key DEK is a symmetric encryption key. DEK is encrypted using the Level 2 encryption key KEK public key and stored within the TPM chip. It can only be decrypted using the Level 2 encryption key KEK private key, ensuring security and reliability.

[0031] II. Multi-factor authentication: Multi-factor authentication is used for multi-level key systems.

[0032] PCR Authentication: The primary master key is bound to the TPM's platform configuration register (PCR). The primary master key can only be unlocked and used when the system infrastructure verification is successful (i.e., the system's PCR value matches the bound value).

[0033] Password authentication: The private key of the secondary encryption key KEK is encrypted using the input password. Successful password authentication is required for loading. The input password is the authorization password entered by the user through the application / system.

[0034] Key authentication: The third-level encryption key DEK is encrypted using the public key of the second-level encryption key KEK, and can only be loaded and used after being decrypted using the private key of the second-level encryption key KEK.

[0035] III. Automated, secure, and reliable storage: This step automatically derives the NV key and storage index address based on user and hardware information, solving the problem of hard-coding or local storage of the NV key and storage index address. It uses TPM persistent storage technology and non-volatile zone storage technology to reliably store the key context handle and key configuration data.

[0036] This embodiment proposes an automated multi-level encrypted key management method based on TPM. It uses a TPM chip to store all key-related data and configurations, achieving reliable key storage. Key storage no longer relies on a file system, solving the problems of accidental key deletion and loss. Furthermore, all data encryption and decryption operations are performed within the TPM chip; the keys never leave the TPM chip, fundamentally preventing key leakage. Simultaneously, this embodiment automatically derives NV space encryption keys and index addresses based on user and hardware information, automating conflict prevention and resolving the problems of NV space conflicts, easy cracking, and difficult key management.

[0037] Example 2: This embodiment describes the technical implementation process of generating a multi-level key system in the method described in Embodiment 1.

[0038] The structure of a multi-level key system is as follows: Figure 2 As shown, it includes a primary master key, a secondary encryption key KEK (key encryption key), and a tertiary encryption key DEK (data encryption key). Its technical implementation process is as follows: Figure 3 As shown, it includes: 1. Generation of the primary master key.

[0039] When the system is started for the first time, the Trusted Platform Module (TPM) is initialized to ensure that it is in normal working order.

[0040] Load the primary master key from the non-volatile region (NV), and determine if the primary master key exists. If it exists, proceed directly to the generation process of the secondary encryption key (KEK); otherwise, proceed to the following primary master key generation process: The Platform Configuration Register (PCR) is a register in the TPM used to store platform status information. Its value reflects the host system's startup status and configuration information. In this embodiment, one or more PCRs are read and a PCR policy is created.

[0041] The TPM2CreatePrimary command is invoked to generate a primary key, PrimaryKey, using its key generation function. This primary key is then bound to the PCR policy. Once bound, the root key can only be used when the host system's PCR value matches the bound value. The primary key is used to protect the security of the entire key system.

[0042] For example, the values ​​of PCR0 (typically used to store BIOS boot state), PCR4 (MBR), and PCR7 (platform manufacturer-specific metric) can be bound to PrimaryKey to ensure that the primary key can only be accessed if the system boots normally and has not been tampered with.

[0043] The generated PrimaryKey is persistently stored in the NV storage area of ​​TPM using an automatically generated NV key and index address, ensuring that it is immutable and cannot be directly accessed from the outside.

[0044] 2. Generation of the secondary encryption key KEK.

[0045] After PCR verification is successful, the primary master key, PrimaryKey, is loaded from the non-volatile region (NV) of the TPM chip. The TPM's Create function method is called, using PrimaryKey as the parent key, to generate an asymmetric key, which serves as the secondary encryption key, KEK. The KEK private key is encrypted using the input password and stored encrypted within the TPM.

[0046] When generating the secondary encryption key KEK, a public part KEK.pub and a private part KEK.priv are generated. KEK.pub and KEK.priv are then stored in the TPM chip NV using the automatically generated NV key and the NV storage index address to ensure the security of the secondary encryption key KEK.

[0047] 3. Data encryption key (DEK) generation.

[0048] After PCR verification is successful, the primary key (PrimaryKey) is loaded from the TPM chip NV. The TPM's Create function is called, using PrimaryKey as the parent key, to generate a symmetric key, which serves as the third-level encryption key (DEK).

[0049] When generating DEK, a public part DEK.pub and a private part DEK.priv are generated. The public part KEK.pub of the secondary encryption key KEK is loaded from the TPM chip NV and loaded into the TPM chip to obtain the secondary encryption key KEK public key. Then, the secondary encryption key KEK public key is used to encrypt the symmetric key DEK.pub and DEK.priv. The automatically generated NV key and index are stored in the TPM chip NV to ensure the security of the data encryption key DEK.

[0050] After the multi-level key system is stored in NV, the PrimaryKey, secondary encryption key KEK, and tertiary encryption key DEK outside the NV storage area in TPM are destroyed.

[0051] In this embodiment, the primary master key is bound to the PCR as the trusted root of the key chain, ensuring the reliability of the key chain at the system level. The secondary encryption key KEK uses an asymmetric key, encrypting with the public key and decrypting with the private key, to encrypt the data key DEK, adapting to various business types. The tertiary encryption key DEK uses a symmetric key, balancing data encryption performance and usage security. Each key protects the next, forming a complete trust chain with extremely high security. Furthermore, both encryption and decryption algorithms use hardware-level algorithms provided by TPM, ensuring the keys remain within the trusted execution environment and eliminating the risk of key leakage. In addition, all key configuration information is securely stored using the TPM chip NV, solving the problems of difficult management and loss associated with traditional key file systems.

[0052] Example 3: This embodiment focuses on the implementation of the technology for automatically generating NV keys and storage index addresses in the method described in Embodiment 1.

[0053] Specifically, it includes: 1. Automated NV Key Generation: Obtain user information and hardware information. For example, the user information includes at least a username and UID, and the hardware information includes at least a MAC address. Combine the user information and hardware information as a key seed. Use the PBKDF2 cryptographic key derivation algorithm with the key seed and sm3 as the hash algorithm to generate the NV space encryption key.

[0054] 2. Automated generation of NV indexes: a. Calculate the initial index address using a hybrid hash algorithm: Perform SM3 calculation on the username in the user information, and then take the first 4 bytes as the first element of the hybrid hash; The user information UID is transformed, including operations such as UID reshaping, truncation, bit expansion, and decorrelation, to make the UID suitable for hash operation; then, a multiplicative hash operation is performed using the golden ratio prime number (0x9e3779b9), and the result is used as the second element of the hybrid hash, which can avoid linear correlation. DJB2 variant hashing is used to perform mixed calculations on the MAC address in the hardware information to enhance the overall participation of the input data, and the calculation result is used as the third element of the mixed hash. Finally, XOR and golden ratio multiplication are used to perform a combined hash operation on the three hash elements (first, second, and third elements) to obtain the initial index address.

[0055] b. Probe index address: The TPM's NV space is probed based on the initial index address and NV encryption key. If the space detection meets the expectations, it is a valid NV key and index address.

[0056] If the expected result is not achieved, a quadratic probing method can be used as an index conflict resolution algorithm to avoid clustering. At the same time, the probing step size increases non-linearly with the number of attempts, improving search efficiency. Finally, a prime number larger than the index space (200003 in this example) is used for modulo operation to ensure a uniform distribution of hash values ​​and improve the rationality of index address probing. Then, the index address and the NV key are used cyclically to probe the state of the NV space of the TPM until the legitimate address index is successfully probed, and the index address can be obtained.

[0057] Tests show that the TPM index range is 0x01000000-0x01FFFFFF, with 16,777,216 available index values. After optimizing the distribution using the 200003 prime number modulo operation, under the assumption of an ideal hash function, for n index requests, the collision probability is approximately 1 - e^(-n). 2 / (2×N)), where N is the number of available indexes (approximately 1.67×10).7 For example, generating 1,000 indexes results in a conflict probability of approximately 0.03%, which meets business requirements.

[0058] Example 4: This embodiment proposes a key management system that applies the TPM-based automated encryption multi-level key management method described in this invention, such as... Figure 4 As shown, the key management system is divided into three main modules: system application module, key management module, and TPM adaptation module.

[0059] The functions of each module are as follows: System Application Module: Provides interfaces for connecting to external applications and systems within the key management system, providing them with keys for data encryption and decryption. Applications and systems request the necessary keys through the interfaces provided by the System Application Module and use these keys for corresponding operations under the authorization of the TPM module.

[0060] The key management module is responsible for the automatic management of NV keys and indices based on user and hardware information, and interacts with the TPM module to generate, encrypt, store, distribute, and manage multi-level keys. The key management system constructs a flexible key hierarchy structure according to application scenarios and user needs, and ensures key security throughout its lifecycle through collaboration with the TPM. During NV key storage, it automatically calculates the NV storage address index and NV key based on user and hardware information, enabling encrypted storage of multi-level keys in the NV space.

[0061] TPM Adaptation Module: Since the Trusted Platform Module (TPM) is the core security component of the entire system, it is responsible for generating, storing, and protecting the primary master key. The primary master key, as the root key, is the foundation of the entire key hierarchy; all other levels of keys are derived from the root key. The TPM has a secure internal storage area to prevent unauthorized reading and tampering of keys. The TPM adaptation module is responsible for adapting to the TPM software stack interface, enabling trusted storage and algorithm function calls within the TPM without the keys leaving the TPM, thus maximizing data security.

[0062] During the initialization of the key management system, the TPM adapter module generates a primary master key and performs PCR binding, which is then persistently stored in the TPM chip. When an application or system component has encryption or decryption requirements, the key management module calls the TPM adapter module to derive a secondary encryption key KEK and a tertiary encryption key DEK based on the primary master key. The secondary encryption key KEK is encrypted using the input password to obtain the KEK ciphertext, and the DEK is encrypted using the public key of the secondary encryption key KEK to obtain the DEK ciphertext. The KEK ciphertext and DEK ciphertext are persistently stored in the TPM chip.

[0063] The usage flow of each module of the key management system is as follows: Figure 5 As shown, it includes: 1. The system application module sends a key request to the key management module, requesting to obtain a specific data encryption key.

[0064] The request should include the following information: Key identifier: A unique identifier used to identify the encryption key for the required data; User or application identity information: used to verify the identity of the requester; Key encryption password information: Used to decrypt the private key loaded with the secondary encryption key KEK, proving that the requester has the right to use the private key.

[0065] 2. When the key management module receives the key request sent by the system application module, it first verifies the identity of the requester. After successful verification, it performs PCR verification. After successful verification, it loads the primary key (PrimaryKey) from the NV specified address of the TPM chip using the automatically generated NV key and index address through the TPM adapter module.

[0066] 3. After the primary master key is loaded, the key management module obtains the storage addresses of KEK.pub and KEK.priv corresponding to the secondary encryption key KEK in the TPM chip NV according to the key identifier and reads the data.

[0067] 4. The key management module passes the key encryption password information, KEK.pub, and KEK.priv from the key request to the TPM adapter module for KEK private key loading. If the three match, the KEK private key loading is completed in the TPM chip.

[0068] 5. The key management module reads data from the storage addresses of DEK.pub and DEK.priv corresponding to the three-level encryption key DEK in the TPM chip NV using the automatically generated NV key and index address based on the key identifier. It then decrypts DEK.pub and DEK.priv using the KEK private key from step 4 and loads the decrypted DEK.pub and DEK.priv into the TPM chip to complete the loading of the three-level encryption key DEK.

[0069] 6. After the third-level encryption key DEK is successfully loaded, the key management module destroys the second-level encryption key KEK and the first-level master key in the TPM chip, and returns the DEK handle to the system application module.

[0070] 7. The system application module calls the TPM adapter module to use the three-level encryption key DEK to encrypt and decrypt application or system data.

[0071] 8. After the system application module completes data encryption and decryption, it notifies the key management module to destroy the three-level encryption key DEK in the TPM chip.

[0072] The TPM-based automated encryption multi-level key management system proposed in this embodiment can implement and apply the TPM-based automated encryption multi-level key management method described in any one of Embodiments 1-3, and has the same technical effect.

[0073] The above-described embodiments are merely preferred embodiments of the present invention and are only used to help understand the method and core ideas of this application. The scope of protection of the present invention is not limited to the above embodiments, and all technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.

Claims

1. An automated encrypted multi-level key management method based on TPM, characterized in that, include: S1. Generate a multi-level key system based on the Trusted Platform Module (TPM), including generating a primary master key, deriving a secondary encryption key (KEK) for key encryption based on the primary master key, and a tertiary encryption key (DEK) for data encryption. S2. Multi-factor authentication is adopted for the multi-level key system. The first-level master key is bound to the platform configuration register (PCR) of the Trusted Platform Module (TPM) for authentication. The second-level encryption key (KEK) is encrypted and decrypted using the incoming password. The third-level encryption key (DEK) is encrypted and decrypted using the second-level encryption key (KEK). S3. Based on user and hardware information, automatically derive the non-volatile zone (NV) key and storage index address of the Trusted Platform Module (TPM) and persistently store multi-level keys.

2. The automated encryption multi-level key management method based on TPM according to claim 1, characterized in that, The primary master key mentioned in step S1 is generated by calling the TPM2CreatePrimary key generation function of TPM.

3. The automated encryption multi-level key management method based on TPM according to claim 1, characterized in that, The secondary encryption key KEK mentioned in step S1 is an asymmetric encryption key generated by calling the Create function of TPM with the primary master key as the parent key.

4. The automated encryption multi-level key management method based on TPM according to claim 1, characterized in that, The third-level encryption key DEK mentioned in step S1 is a symmetric encryption key generated by calling the Create function of TPM with the first-level master key as the parent key.

5. The automated encryption multi-level key management method based on TPM according to claim 1, characterized in that, In step S2, the authentication of the primary master key includes: reading one or more platform configuration registers (PCRs), creating a PCR policy, and binding the primary master key to the PCR policy after its generation to protect the security of the multi-level key system.

6. The automated encryption multi-level key management method based on TPM according to claim 1, characterized in that, In step S2, the third-level encryption key DEK is encrypted using the public key of the second-level encryption key KEK, and decrypted using the private key of the second-level encryption key KEK.

7. The automated encryption multi-level key management method based on TPM according to claim 1, characterized in that, Step S3 includes: S301, NV Key Automated Generation: Obtain user information and hardware information as key seeds to generate NV space encryption keys; S302, NV Index Automated Generation: Based on user information and hardware information, the initial index address is calculated using a hybrid hash algorithm; the NV space is then probed for status based on the initial index address and the NV space encryption key. If the space probe meets expectations, it is a valid NV key and storage index address.

8. The automated encryption multi-level key management method based on TPM according to claim 7, characterized in that, Step S301 includes: The first element of the mixed hash is obtained by calculating the username; the second element of the mixed hash is obtained by calculating the UID; and the third element of the mixed hash is obtained by calculating the MAC address. Finally, a combined hash operation is performed on the first, second, and third elements of the mixed hash to obtain the initial index address.

9. The automated encryption multi-level key management method based on TPM according to claim 7, characterized in that, Step S302 also includes: if the space detection does not meet expectations, a quadratic probing method is used as the index conflict resolution algorithm, the probing step size increases non-linearly with the number of attempts, a prime number larger than the index space is used for modulo, and the state detection of the NV space is continued.

10. An automated encrypted multi-level key management system based on TPM, employing the automated encrypted multi-level key management method based on TPM as described in any one of claims 1-9, characterized in that, include: System application module: Provides an interface to the application, enabling the application to request the required key through the interface and use the key under the authorization of TPM; Key Management Module: Responsible for the automatic management of NV keys and indexes based on user and hardware information, and interacting with the TPM module to realize the generation, encryption, storage, distribution and management of multi-level keys; TPM Adaptation Module: Adapts to the TPM software stack interface, enabling trusted storage and algorithm function calls of TPM without leaving the TPM; During system initialization, the TPM adapter module generates a primary master key and binds it with PCR, which is then persistently stored in the TPM chip. When the application / system has encryption / decryption requirements, the key management module calls the TPM adapter module to derive a secondary encryption key KEK based on the primary master key and randomly generates a tertiary encryption key DEK. The secondary encryption key KEK is encrypted using a password to obtain the KEK ciphertext. The tertiary encryption key DEK is then encrypted using the secondary encryption key KEK to obtain the DEK ciphertext. The KEK ciphertext and DEK ciphertext are persistently stored in the TPM chip.