Hierarchical file storage method, system and device based on trusted key management and medium
By using dynamic key sharding and hierarchical encryption technology in a trusted execution environment, combined with the key management and revocation mechanism of the blockchain network, the data security, flexibility and real-time problems of traditional file storage systems in the face of complex security threats are solved, and efficient and secure storage and transmission of data are achieved.
Patent Information
- Application Number
- CN202510377330.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-06-20
AI Technical Summary
When facing complex security threats, traditional file storage systems have limitations that are difficult to meet in data security, flexibility and real-time, including the risks of centralized key storage, insufficient permission control, insecurity in key generation and distribution processes, and the inability to respond to key leakage events in a timely manner.
The hierarchical file storage method based on trusted key management is adopted. The master key is managed in a trusted execution environment through a trusted key management server, and the session key is generated and encrypted. The encryption algorithm is selected according to the file encryption level to realize the hierarchical encryption of the file, and key revocation and re-encryption operations are performed through the blockchain network.
Effectively prevent single point leakage of the master key, enhance data security, realize the integrity and security of data during storage and transmission, ensure the security of data throughout the life cycle, and prevent data leakage and illegal access.
Smart Images

Figure CN120180477A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of data security storage, and specifically relates to a hierarchical file storage method, system, device, and medium based on trusted key management. Background Art
[0002] With the development of digitalization, data security storage is crucial for all fields. Traditional file storage systems have many limitations when facing complex security threats and are difficult to meet users' requirements for data security, flexibility, and real-time performance.
[0003] Firstly, traditional key management usually adopts a mode of centralized key storage and management. Once the key is stolen, the data in the entire storage system will be completely exposed, facing huge risks of being tampered with and leaked. Moreover, traditional key management lacks an effective dynamic update mechanism and cannot respond to security events of key leakage in a timely manner, nor can it adjust the key immediately, further exacerbating the security risks of data. Secondly, insufficient permission control is also very prominent. The permission granularity of traditional key management is coarse, and the encryption method is fixed and single, resulting in some data with high sensitivity may not be fully protected due to insufficient encryption intensity, while data with low sensitivity is affected by excessive encryption and the use efficiency is reduced, making it difficult to achieve a balance between data usage security and efficiency. Thirdly, the process of key generation and distribution may be exposed to an insecure environment, increasing the risk of the key being intercepted or tampered with. Finally, when the file access permission changes, the traditional key management system cannot know in a timely manner, so that illegal users still have the opportunity to access data using the old key, posing a serious threat to data security. Summary of the Invention
[0004] In a first aspect, an embodiment of this application provides a hierarchical file storage method based on trusted key management, including the following steps: S1. Respond to a file upload request, parse the uploaded file, determine the file classification level, and send a session key request to the trusted key management server; S2. The trusted key management server responds to the session key request, generates a session key, encrypts the session key using the master key, stores the ciphertext of the session key and generates a key ID, and then returns the session key and the key ID; S3. Select an encryption algorithm according to the classification level of the uploaded file, encrypt the uploaded file using the session key, save the encryption algorithm, the encrypted file, and the key ID to the file storage node, and generate file metadata; S4. Respond to a file download request, obtain the file metadata, determine the encrypted file, the key ID, and the encryption algorithm to be searched, and request the session key from the trusted key management server according to the key ID; The trusted key management server responds to the session key request, looks up the ciphertext of the session key according to the key ID, decrypts it using the master key, obtains the original session key and returns it; According to the session key returned by the trusted key management server, and using the found encryption algorithm to decrypt the encrypted file, obtain the original file and return it to the user. Manage the master key through the dynamic key sharding method, which can prevent single-point leakage and enhance the security of the master key. Select the encryption algorithm according to the file classification level, which can take into account the performance requirements while ensuring data security; Encrypt the file using the session key, which can reduce the risk of master key leakage and improve security. When downloading a file, obtain the session key through the key ID to decrypt the encrypted file to ensure the security of the data during transmission and use.
[0005] Furthermore, it also includes the following: S5. The trusted key management server regularly checks the validity period of the session key. If the session key expires, regenerate the session key, encrypt the new session key using the master key, store the ciphertext of the new session key, generate a new key ID, and then send the new session key and the new key ID to the file storage node; The file storage node performs a re-encryption operation on the encrypted file associated with the key ID in the expired state; During the session key update process, queue control is performed on the download requests associated with the expired session key until the new session key finishes encrypting the file. By regularly checking the validity period of the session key, regenerating and updating it after expiration, the risk of key leakage can be effectively resisted and data security can be guaranteed; Queue control of download requests during key update can avoid data inconsistency or acquisition failure and ensure the stability of the system.
[0006] Furthermore, the specific steps for performing the re-encryption operation are as follows: The file storage node obtains the encrypted file, decrypts it according to the encryption algorithm using the original session key, and then encrypts it using the new session key to obtain a new encrypted file. At the same time, delete the old encrypted file, and save the encryption algorithm, the new encrypted file, and the new key ID to the file storage node, and update the file metadata.
[0007] Furthermore, it also includes the following steps: S6. Receive the permission revocation instruction, parse the key ID associated with the target user, and send a key invalidation request to the trusted key management server; The trusted key management server marks the key ID associated with the target user as the invalid state, and broadcasts the key revocation event to all file storage nodes through the blockchain network; Each file storage node responds to the broadcast key revocation event and performs re-encryption operations on the encrypted files associated with the invalid key IDs; During the re-encryption operation, queue control is performed on the download requests associated with the invalid session keys until the new session key finishes encrypting the file. When the permission is revoked, the relevant keys can be invalidated in a timely manner, and the associated files are re-encrypted to prevent illegal access and ensure data security; by broadcasting the key revocation event through the blockchain network, the key states of all nodes are ensured to be consistent, improving the reliability of the system.
[0008] Furthermore, the specific steps for performing the re-encryption operation are as follows: After the file storage node decrypts the file using the original session key, it requests the trusted key management server to generate a new session key and encrypts it to obtain a new key ID, deletes the original session key, and updates the key ID in the metadata.
[0009] Furthermore, the following steps are also included: S7. The file storage node counts the access frequencies of the encrypted files, takes the encrypted files with access frequencies higher than the frequency threshold as hot data, and takes the encrypted files with access frequencies lower than the frequency threshold as cold data; The file storage node stores the hot data locally and uploads the cold data to cloud storage. Storing the hot data locally can improve the data access speed; storing the cold data in the cloud can reduce the storage cost and achieve a balance between data storage performance and cost; dynamically adjusting the storage location according to the file access frequency can improve the utilization rate of storage resources.
[0010] Furthermore, the master key is managed by the trusted key management server in the trusted execution environment using the dynamic key sharding method.
[0011] Furthermore, the specific steps for master key management are as follows: SS1. The trusted key management server generates a high-entropy master key based on the hardware true random number generator in the trusted execution environment; SS2. The trusted key management server shards the generated high-entropy master key in the trusted execution environment to obtain N master key shards, and sends them to N blockchain nodes respectively. At the same time, the aggregation threshold value k is set; where k ≤ N; SS3. The trusted key management server responds to the master key request, obtains k master key shards from k blockchain nodes, verifies the validity of each master key shard using the threshold signature algorithm, and then aggregates the k verified master key shards in the trusted execution environment to obtain the high-entropy master key; The SS4. Trusted Key Management Server responds to the re-sharding request, obtains the high-entropy master key in the manner of step S13, then adjusts the number of master key shards and the aggregation threshold according to security requirements, blockchain node status, or business changes, re-shards, and updates the master key shards of each blockchain node. Generating a high-entropy master key based on a hardware true random number generator can enhance the security of the master key; sharding and storing the master key and setting an aggregation threshold can prevent single-point leakage and enable the secure recovery of the master key when needed; re-sharding according to security requirements, node status, or business changes realizes the dynamic adjustment of the master key shards.
[0012] Further, in step S1, the file secrecy level includes the public level, internal level, confidential level, and top-secret level; For the public level, the corresponding encryption algorithm uses the AES-128 encryption algorithm, the internal level uses the SM4 encryption algorithm, the confidential level adopts the AES-256 + SM4 encryption algorithm, and the top-secret level uses the quantum-resistant encryption algorithm. Using different encryption algorithms for files with different sensitivities can meet the performance requirements of different scenarios while ensuring data security; using the low-latency AES-128 algorithm at the public level and the quantum-resistant encryption algorithm at the top-secret level achieves a balance between security and performance.
[0013] In a second aspect, an embodiment of the present application further provides a hierarchical file storage system based on trusted key management, including: A trusted key management server, configured with a trusted execution environment, manages the master key using a dynamic key sharding method within the trusted execution environment, and responds to a session key request, generates and stores a session key using the master key; An access controller, which responds to file upload requests, file download requests, and permission revocation instructions, and authenticates the access users; A hierarchical encryption module, for a file upload request responded by the access controller, encrypts the file using the corresponding encryption algorithm and session key and stores it in the file storage node, and for a file download request responded by the access controller, after obtaining the file from the file storage node, decrypts it using the corresponding encryption algorithm and session key; A file storage node, which stores the encrypted file, session key ID, and encryption algorithm.
[0014] In a third aspect, an embodiment of the present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the steps of the hierarchical file storage method based on trusted key management as described in the first aspect.
[0015] Fourthly, an embodiment of the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the hierarchical file storage method based on trusted key management as described in the first aspect are implemented.
[0016] As can be seen from the above technical solutions, the present application has the following advantages: In the hierarchical file storage method, system, device and medium based on trusted key management provided by the present application, through the trusted key management mechanism and the hierarchical encryption policy, data with different sensitivity levels is classified and stored and encrypted, and the dynamic session key update and real-time permission revocation functions ensure the security of data throughout its life cycle, preventing data leakage and illegal access. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the present application, the drawings required for description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0018] Figure 1 It is a flowchart of the hierarchical file storage method based on trusted key management of the present invention.
[0019] Figure 2 It is a flowchart of the hierarchical file storage system based on trusted key management of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] In the following, the specific steps of the hierarchical file storage method based on trusted key management will be described in detail, and various embodiments of the present disclosure will be described more comprehensively. The present disclosure can have various embodiments, and adjustments and changes can be made therein. However, it should be understood that there is no intention to limit the various embodiments of the present disclosure to the specific embodiments disclosed herein, but the present disclosure should be understood to cover all adjustments, equivalents and / or alternative solutions falling within the spirit and scope of the various embodiments of the present disclosure.
[0021] TKMS is Trust Key Management Service, which is a trusted key management server.
[0022] Exemplarily, with the acceleration of the digitalization process, ensuring the secure storage of data has become a core concern in all walks of life. However, traditional file storage systems are unable to cope with increasingly complex security challenges and are difficult to meet the high standards of users for data security, flexibility and immediacy.
[0023] First, traditional key management adopts a centralized storage and management method. In this mode, once the key is stolen, the data security of the entire storage system will be affected, facing the huge risks of being arbitrarily tampered with and leaked. At the same time, the lack of an effective dynamic update mechanism makes traditional key management unable to respond quickly when a key leakage event occurs and unable to replace the key in a timely manner, thus exacerbating the data security risks. Second, traditional key management has obvious deficiencies in permission control. Its permission division is too rough, and the encryption method is single and fixed, resulting in high-sensitive data may not be fully protected due to insufficient encryption strength, while low-sensitive data may be affected in terms of usage efficiency due to excessive encryption, making it difficult to find a balance between data security and usage efficiency. Moreover, the key generation and distribution processes in traditional systems are often exposed to an insecure environment, increasing the risk of the key being intercepted or tampered with. Finally, when the file access permission changes, the traditional key management system cannot obtain this information in real time, resulting in the possibility that illegal users may still access the data using the old key, posing a serious hidden danger to data security.
[0024] To address the above problems, this embodiment provides a hierarchical storage method based on trusted key management, which ensures the data integrity and security of file data during storage and transmission by combining a trusted execution environment, dynamic key sharding, hierarchical encryption, and distributed storage.
[0025] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0026] Please refer to Figure 1 The following figure shows a flowchart of a hierarchical file storage method based on trusted key management in a specific embodiment. The method includes the following steps: S1. Respond to the file upload request, parse the uploaded file, determine the file classification level, and send a session key request to the trusted key management server; It should be noted that the file classification level can be input by the user when uploading the file, or the access controller can determine the file classification level by keyword scanning; Determining the file classification level can provide a basis for selecting an appropriate encryption algorithm in the follow-up to achieve hierarchical encrypted storage; and by applying for a session key, the usage frequency of the master key can be reduced, and the risk of master key leakage can be reduced; S2. The trusted key management server responds to the session key request, generates a session key, encrypts the session key using the master key, stores the ciphertext of the session key and generates a key ID, and then returns the session key and the key ID; It should be noted that the key ID is the unique key index of the session key; Generating the session key and encrypting it with the master key can ensure the security of the session key during transmission and storage; generating the key ID facilitates the management and search of the session key, improving the efficiency of the system; S3. Select an encryption algorithm according to the classification level of the uploaded file, encrypt the uploaded file with the session key, save the encryption algorithm, the encrypted file, and the key ID to the file storage node, and generate file metadata; It should be noted that selecting the encryption algorithm according to the file classification level can balance performance requirements while ensuring data security; saving the encrypted file, the encryption algorithm, and the key ID to the file storage node and generating file metadata facilitates the management and retrieval of the file; S4. In response to the file download request, obtain the file metadata, determine the encrypted file, the key ID, and the encryption algorithm to be searched for, and request the session key from the trusted key management server according to the key ID; The trusted key management server responds to the session key request, searches for the ciphertext of the session key according to the key ID, decrypts it with the master key, obtains the original session key and returns it; Decrypt the encrypted file with the session key returned by the trusted key management server using the found encryption algorithm to obtain the original file and return it to the user; It should be noted that when downloading a file, the session key is obtained through the key ID to decrypt the encrypted file, ensuring the security of the data during transmission and use.
[0027] In this embodiment, the master key is managed by the dynamic key sharding method, which can prevent single-point leakage and enhance the security of the master key. Selecting the encryption algorithm according to the file classification level can balance performance requirements while ensuring data security; encrypting the file with the session key can reduce the risk of master key leakage and improve security.
[0028] Furthermore, as a refinement and extension of the specific implementation manner of the above embodiment, in order to fully illustrate the specific implementation process in this embodiment, another hierarchical file storage method based on trusted key management is provided. This method includes the following steps: S1. In response to the file upload request, parse the uploaded file, determine the file classification level, and send a session key request to the trusted key management server; S2. The trusted key management server responds to the session key request, generates the session key, encrypts the session key with the master key, stores the ciphertext of the session key and generates the key ID, and then returns the session key and the key ID; S3. Select an encryption algorithm according to the classification level of the uploaded file, encrypt the uploaded file using the session key, save the encryption algorithm, the encrypted file, and the key ID to the file storage node, and generate file metadata; S4. In response to a file download request, obtain the file metadata, determine the encrypted file, key ID, and encryption algorithm to be searched for, and request the session key from the trusted key management server according to the key ID; The trusted key management server responds to the session key request, searches for the ciphertext of the session key according to the key ID, and decrypts it using the master key to obtain the original session key and returns it; According to the session key returned by the trusted key management server, decrypt the encrypted file using the found encryption algorithm to obtain the original file and return it to the user; It should be noted that when downloading a file, the session key is obtained through the key ID to decrypt the encrypted file to ensure the security of data during transmission and use; S5. The trusted key management server regularly checks the validity period of the session key. If the session key expires, a new session key is regenerated, and the new session key is encrypted using the master key. The ciphertext of the new session key is stored and a new key ID is generated. Then, the new session key and the new key ID are sent to the file storage node; The file storage node performs a re-encryption operation on the encrypted file associated with the key ID in the expired state; Specifically, the specific steps for performing the reconstruction operation are as follows: The file storage node obtains the encrypted file, decrypts it according to the encryption algorithm using the original session key, and then encrypts it using the new session key to obtain a new encrypted file. At the same time, the old encrypted file is deleted, and the encryption algorithm, the new encrypted file, and the new key ID are saved to the file storage node, and the file metadata is updated; During the session key update process, queue control is performed on the download requests associated with the expired session key until the new session key finishes encrypting the file; It should be noted that by regularly checking the validity period of the session key, regenerating and updating it after expiration, the risk of key leakage can be effectively resisted to ensure data security; queue control of download requests during key update can avoid data inconsistency or acquisition failure and ensure the stability of the system; S6. Receive a permission revocation instruction, parse the key ID associated with the target user, and send a key invalidation request to the trusted key management server; The trusted key management server marks the key ID associated with the target user as the invalid state and broadcasts the key revocation event to all file storage nodes through the blockchain network; Each file storage node responds to the broadcast key revocation event and performs re-encryption operations on the encrypted files associated with the invalidated key IDs; Specifically, the steps for performing the re-encryption operation are as follows: After the file storage node decrypts the file using the original session key, it requests the trusted key management server to generate a new session key and encrypts it to obtain a new key ID, deletes the original session key, and updates the key ID in the metadata; During the re-encryption operation, queue control is performed on the download requests associated with the invalidated session keys until the new session key finishes encrypting the file; It should be noted that when the permission is revoked, the relevant keys can be invalidated in a timely manner, and the associated files can be re-encrypted to prevent illegal access and ensure data security; by broadcasting the key revocation event through the blockchain network, the key states of all nodes are ensured to be consistent, improving the reliability of the system; S7. The file storage node counts the access frequencies of each encrypted file, takes the encrypted files with access frequencies higher than the frequency threshold as hot data, and takes the encrypted files with access frequencies lower than the frequency threshold as cold data; The file storage node stores the hot data locally and uploads the cold data to cloud storage; It should be noted that storing the hot data locally can improve the data access speed; storing the cold data in the cloud can reduce the storage cost and achieve a balance between data storage performance and cost; dynamically adjusting the storage location according to the file access frequency can improve the utilization rate of storage resources.
[0029] In an embodiment of the present invention, a possible embodiment will be given below to non-restrictively elaborate on its specific implementation scheme.
[0030] The master key is managed by the trusted key management server in the trusted execution environment using the dynamic key sharding method; It should be noted that managing the master key in the trusted execution environment can resist operating system-level malicious attacks; the dynamic key sharding method can prevent single-point leakage of the master key and enhance the security of the key; performing operations such as generation, distribution, update, and revocation on the master key realizes the full life cycle management of the key; The specific steps for master key management are as follows: SS1. The trusted key management server generates a high-entropy master key in the trusted execution environment based on a hardware true random number generator; Exemplarily, the trusted execution environment can select Intel SGX or ARM TrustZone; SS2. The trusted key management server shards the generated high-entropy master key in the trusted execution environment to obtain N master key shards, and sends them to N blockchain nodes respectively. At the same time, an aggregation threshold value k is set; where k ≤ N; Exemplarily, the high-entropy master key shards can choose the Shamir SSS algorithm or the CRT algorithm; SS3. The trusted key management server responds to the master key request, obtains k master key shards from k blockchain nodes, verifies the validity of each master key shard using the threshold signature algorithm, and then aggregates the k verified master key shards in the trusted execution environment to obtain the high-entropy master key; SS4. The trusted key management server responds to the re-sharding request, obtains the high-entropy master key in the manner of step S13, then adjusts the number of master key shards and the aggregation threshold value according to security requirements, blockchain node status or business changes, re-shards, and updates the master key shards of each blockchain node; Exemplarily, in a system using Intel SGX as the trusted execution environment, a true random number generator generates a 256-bit binary random number, which is used as the master key M; Using the method of splitting the master key M into multiple shards by the Shamir SSS algorithm, the original secret can be recovered only when a sufficient number of shards are collected. The specific steps are as follows: Select a prime number p greater than the master key value; Construct a th-degree polynomial , where a0 represents the master key M, are coefficients randomly selected within the range of ; Calculate N different points (x i , y i ), where y i = f(x i ) mod p, x i are different non-zero integers, ; these N (x i , y i ) are the master key shards; When at least t shards are collected, the master key is recovered using the following Lagrange interpolation formula:
[0031] It should be noted that generating a high-entropy master key based on a hardware true random number generator can enhance the security of the master key; fragmenting and storing the master key and setting an aggregation threshold can prevent single-point leakage and safely recover the master key when needed; dynamically adjusting the fragmentation of the master key can be achieved by re-fragmenting according to security requirements, node status, or business changes.
[0032] In an embodiment of the present invention, based on step S1, the following will give a possible embodiment to non-restrictively elaborate on its specific implementation.
[0033] In step S1, the file secrecy levels include public level, internal level, confidential level, and top-secret level; The public level corresponds to using the AES-128 encryption algorithm for the encryption algorithm, the internal level uses the SM4 encryption algorithm, the confidential level adopts the AES-256 + SM4 encryption algorithm, and the top-secret level uses the quantum-resistant encryption algorithm; It should be noted that using different encryption algorithms for files with different sensitivities can, while ensuring data security, meet the performance requirements of different scenarios; using the low-latency AES-128 algorithm at the public level and the quantum-resistant encryption algorithm at the top-secret level achieves a balance between security and performance.
[0034] This application mentions a hierarchical file storage method based on trusted key management. The trusted key management server manages the master key in a trusted execution environment using a dynamic key sharding method. Even if some key shards are leaked, it is difficult to recover the complete master key, effectively preventing the risk of the master key being stolen and ensuring the key security foundation of the entire file storage system. The master key shards are stored dispersedly by blockchain nodes, and the number of master key shards and the aggregation threshold value can be adjusted according to security requirements, blockchain node status, or business changes for re-sharding, which not only enhances the reliability of key storage but also improves the flexibility and adaptability of the system, enabling it to cope with different security threats and business requirement changes. Different encryption algorithms are selected according to the file classification level, and AES-128, SM4, AES-256 + SM4, and quantum-resistant encryption algorithms are successively used from the public level to the top-secret level, realizing hierarchical encryption protection for files with different sensitivity levels, ensuring that high-classified files receive a higher level of encryption guarantee, and effectively preventing files from being accessed and leaked without authorization. Through regular update of the session key, re-encryption operations are performed on relevant files during the update process, and queue control is carried out on download requests, avoiding file security vulnerabilities caused by the expiration or invalidation of the session key, and further enhancing the security of file storage. When a user's permission is revoked, by marking the key ID as invalid and broadcasting the key revocation event, it triggers the file storage node to re-encrypt the relevant files, timely cutting off the access path of the user whose permission has been revoked to the files, preventing information leakage, and ensuring strict control of file access permissions. By classifying files into hot data and cold data according to the access frequency at the file storage node, hot data is stored locally to quickly respond to high-frequency access requirements, and cold data is uploaded to cloud storage to save local storage resources, realizing the optimal configuration of storage resources, improving both the file access efficiency and reducing the storage cost. In addition, through the distributed storage of the master key shards by the blockchain, the storage reliability of the key shards is ensured, and at the same time, the validity of the master key shards is verified through the threshold signature algorithm, further enhancing the reliability of the system. Even if some blockchain nodes fail or are attacked, the secure recovery and normal use of the master key can be guaranteed.
[0035] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0036] As Figure 2 shown, the following are embodiments of a hierarchical storage system based on trusted key management provided by the embodiments of the present disclosure. This system and the hierarchical storage method based on trusted key management in the above embodiments belong to the same inventive concept. For the details not described in detail in the embodiments of the hierarchical storage system based on trusted key management, reference can be made to the embodiments of the hierarchical storage method based on trusted key management above.
[0037] The system includes: A trusted key management server, configured with a trusted execution environment, manages the master key in the trusted execution environment using a dynamic key sharding method, and responds to a session key request, generates a session key using the master key and stores it; An access controller, which responds to file upload requests, file download requests, and permission revocation instructions, and authenticates the permissions of accessing users; A hierarchical encryption module, encrypts the file using the corresponding encryption algorithm and session key for the file upload request responded by the access controller and stores it in the file storage node, and for the file download request responded by the access controller, decrypts the file using the corresponding encryption algorithm and session key after obtaining the file from the file storage node; A file storage node, which stores the encrypted file, the session key ID, and the encryption algorithm.
[0038] In this embodiment, through the collaborative work of the trusted key management server, the access controller, the hierarchical encryption module, and the distributed storage node, the secure upload, download, storage, and permission control of files are realized, ensuring the security and reliability of file storage.
[0039] The hierarchical storage method based on trusted key management provided by the embodiments of the present application can be applied to electronic devices. Those skilled in the art can understand that the structure of the electronic device involved in the embodiments of the present invention does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. In the embodiments of the present invention, the electronic device includes, but is not limited to, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described herein and / or claimed.
[0040] The electronic device may include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charging management module, a power management module, a battery, a wireless communication module, an audio module, a speaker, a microphone, a sensor module, a key, a camera, a display screen, and a SIM card interface, etc.
[0041] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figures, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0042] The processor may include one or more processing units. For example, the processor may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0043] Among them, the processor may be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
[0044] A memory may also be provided in the processor for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. This memory can store the instructions or data that the processor has just used or recycled. If the processor needs to use the instruction or data again, it can be directly called from this memory. This avoids repeated accesses, reduces the waiting time of the processor, and thus improves the system efficiency.
[0045] The above electronic device implements the trusted key management server of the hierarchical file storage method based on trusted key management in the hierarchical storage method based on trusted key management of the present application to manage the master key in the trusted execution environment using the dynamic key sharding method; the access controller responds to the file upload request, parses the uploaded file, determines the file classification level, and sends a session key request to the trusted key management server; the trusted key management server responds to the session key request, generates a session key, encrypts the session key using the master key, stores the ciphertext of the session key and generates a key ID, and then returns the session key and the key ID; the access controller selects an encryption algorithm according to the classification level of the uploaded file, encrypts the uploaded file using the session key, saves the encryption algorithm, the encrypted file, and the key ID to the file storage node, and generates file metadata. The technical solution achieves the beneficial effect of ensuring data integrity and security during the storage and transmission of file data by combining the trusted execution environment, dynamic key sharding, hierarchical encryption, and distributed storage.
[0046] In the storage medium provided by the present application, there is stored a program product capable of implementing the hierarchical storage method based on trusted key management.
[0047] The hierarchical storage method based on trusted key management includes: the trusted key management server manages the master key in the trusted execution environment using the dynamic key sharding method; the access controller responds to the file upload request, parses the uploaded file, determines the file classification level, and sends a session key request to the trusted key management server; the trusted key management server responds to the session key request, generates a session key, encrypts the session key using the master key, stores the ciphertext of the session key and generates a key ID, and then returns the session key and the key ID; the access controller selects an encryption algorithm according to the classification level of the uploaded file, encrypts the uploaded file using the session key, saves the encryption algorithm, the encrypted file, and the key ID to the file storage node, and generates file metadata.
[0048] In some possible implementation manners, the hierarchical file storage method based on trusted key management of the present disclosure may be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments described in the "Exemplary Method" section of this specification above.
[0049] The storage medium of the present disclosure may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0050] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A hierarchical file storage method based on trusted key management, characterized in that: The steps include: S1. Respond to the file upload request, parse the uploaded file, determine the file classification, and send a session key request to the trusted key management server; S2. The trusted key management server responds to the session key request, generates a session key, encrypts the session key using the master key, stores the ciphertext of the session key and generates a key ID, and then returns the session key and key ID; S3. Select an encryption algorithm according to the confidentiality level of the uploaded file, encrypt the uploaded file using the session key, save the encryption algorithm, encrypted file, and key ID to the file storage node, and generate file metadata; S4. Respond to the file download request, obtain the file metadata, determine the encrypted file, key ID and encryption algorithm to be found, and request a session key from the trusted key management server based on the key ID; The trusted key management server responds to the session key request, searches for the ciphertext of the session key according to the key ID, decrypts it using the master key, obtains the original session key and returns it; According to the session key returned by the key management server, the encrypted file is decrypted using the found encryption algorithm to obtain the original file and return it to the user.
2. The hierarchical file storage method based on trusted key management according to claim 1, characterized in that: Also includes the following: S5. The trusted key management server periodically checks the validity period of the session key. If the session key expires, it regenerates the session key and encrypts the new session key using the master key. It stores the ciphertext of the new session key and generates a new key ID. It then sends the new session key and the new key ID to the file storage node. The file storage node performs a re-encryption operation on the encrypted file associated with the expired key ID; During the session key update process, queue management is performed on download requests associated with expired session keys until the new session key completes file encryption.
3. The hierarchical file storage method based on trusted key management according to claim 1, characterized in that: The following steps are also included: S6. Receive the permission revocation instruction, parse the key ID associated with the target user, and send a key expiration request to the trusted key management server; The trusted key management server marks the key ID associated with the target user as invalid and broadcasts the key revocation event to all file storage nodes through the blockchain network; Each file storage node responds to the broadcast key revocation event and performs a re-encryption operation on the encrypted file associated with the expired key ID; During the re-encryption operation, the download requests associated with the expired session key are queued and managed until the new session key encrypts the file.
4. The hierarchical file storage method based on trusted key management according to claim 1, characterized in that: The following steps are also included: S7. The file storage node counts the access frequency of each encrypted file, and regards the encrypted files with access frequency higher than the frequency threshold as hot data, and regards the encrypted files with access frequency lower than the frequency threshold as cold data; The file storage node stores hot data locally and uploads cold data to cloud storage.
5. The hierarchical file storage method based on trusted key management according to claim 1, characterized in that: The master key is managed by a trusted key management server in a trusted execution environment using a dynamic key sharding method.
6. The hierarchical file storage method based on trusted key management according to claim 5, characterized in that: The specific steps of master key management are as follows: SS1. The trusted key management server generates a high entropy master key based on a hardware true random number generator in a trusted execution environment; SS2. The trusted key management server shards the generated high entropy master key in the trusted execution environment to obtain N master key shards, and sends them to N blockchain nodes respectively. At the same time, the aggregation threshold value k is set; where k≤N; SS3. The trusted key management server responds to the master key request, obtains k master key shards from k blockchain nodes, verifies the validity of each master key shard using the threshold signature algorithm, and then aggregates the verified k master key shards in the trusted execution environment to obtain a high entropy master key; SS4. The trusted key management server responds to the re-sharding request and obtains the high-entropy master key according to step SS3. It then adjusts the number of master key shards and the aggregation threshold value according to security requirements, blockchain node status, or business changes, re-shards, and updates the master key shards of each blockchain node.
7. The hierarchical file storage method based on trusted key management according to claim 1, characterized in that: In step S1, the file classification level includes public level, internal level, confidential level and top secret level; The public level uses the AES-128 encryption algorithm, the internal level uses the SM4 encryption algorithm, the confidential level uses the AES-256+SM4 encryption algorithm, and the top secret level uses the quantum-resistant encryption algorithm.
8. A hierarchical file storage system based on trusted key management, characterized in that: include: A trusted key management server is configured with a trusted execution environment, manages a master key using a dynamic key sharding method in the trusted execution environment, responds to session key requests, generates and stores session keys using the master key; Access controller, responds to file upload requests, file download requests and permission revocation instructions, and authenticates access users; A hierarchical encryption module, which uses a corresponding encryption algorithm and a session key to perform file encryption for a file upload request responded by the access controller and then stores the file in a file storage node, and which uses a corresponding encryption algorithm and a session key to perform decryption after obtaining the file from the file storage node for a file download request responded by the access controller; The file storage node stores the encrypted file, session key ID, and encryption algorithm.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the hierarchical file storage method based on trusted key management as described in any one of claims 1 to 7 when executing the program.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the hierarchical file storage method based on trusted key management as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Chip file dual encryption method, system and device, storage medium and product
CN122457390A