Key file management method and device and storage medium
By confirming the size and separating the storage space in the local storage space of the device, the problem of chaotic key file management is solved, ensuring the orderliness and management efficiency of key files.
Patent Information
- Application Number
- CN202510864558.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-09-16
AI Technical Summary
In the case of both source key files and extended key files, the random storage of key files in the prior art leads to confusion in usage and lacks effective management solutions, especially improper management under different hardware storage spaces.
By confirming the size of the local storage space of the device, selecting appropriate download and expansion operations, and storing key files by location, separating the storage space into key file download and usage space, setting the expansion flag to manage the expanded key file, and ensuring orderliness.
It realizes orderly management of key files, reduces usage confusion, and improves the management efficiency and usage speed of key files.
Smart Images

Figure CN120658385A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of key technology, and in particular to a key file management method, device and storage medium. Background Art
[0002] With the widespread use of the internet, data transmission has become commonplace. To ensure data security, most data is encrypted. Data encryption relies on the use of keys. As encryption algorithms evolve, the corresponding key consumption increases significantly. In addition to downloading keys from a key center, keys can also be expanded. However, the current key download logic impacts both network bandwidth and the speed of key usage. Therefore, key expansion is used more frequently. Key expansion involves locally expanding the key files downloaded during the key download process. This increases the number of keys available locally, reduces download times, and reduces key usage delays.
[0003] Currently, due to the addition of a key expansion algorithm, the local storage space, i.e., the key pool, contains not only the source key file (which serves as the expansion source) but also the expanded key file. If the source and expanded key files are stored arbitrarily, this can lead to confusion in key file usage. For example, the following issues arise: 1. If the expanded key file and the source key file are used in the same storage space and not managed properly, confusion will occur; 2. If the order of the expanded key file is not controlled after it is logically generated, confusion will also occur; 3. The logic for deleting the key after use still requires targeted and effective management. Otherwise, when the network is unstable, out-of-order packets will not be effectively decrypted. Therefore, the key file management issue in the case of both source and expanded key files urgently needs to be addressed, and the key file management solution should be adapted to different hardware storage spaces.
[0004] In summary, when there are both source key files and extended key files, how to solve the problem of random storage of source key files and extended key files, which leads to confusion in the use of key files, is a technical issue that the industry is currently concerned about. Summary of the Invention
[0005] Purpose of the Invention: The present invention provides a key file management method, device, and storage medium that address the issue of arbitrarily storing both source and expanded key files, leading to confusion in key file usage. This method ensures orderly key file usage by first determining the size of the device's local storage space, then selecting different methods for downloading source key files and expanding them, and finally managing their storage and usage.
[0006] Technical solution: The present invention provides a key file management method, which includes:
[0007] Confirm the size of the local storage space of the device. If the size of the local storage space is less than or equal to the predetermined space size, select and execute the corresponding source key file download operation or key expansion operation based on the number of current source key files, and store the downloaded source key file or expanded key file according to the location; if the size of the local storage space is larger than the predetermined space size, divide the key file download space and key file usage space from the local storage space, execute the corresponding source key file download operation and key expansion operation in the key file download space and key file usage space and store them.
[0008] Furthermore, the selecting and executing the corresponding source key file downloading operation or key expansion operation according to the number of current source key files, and storing the downloaded source key file or the expanded key file according to the location means:
[0009] Obtain the current number of source key files and store them in the key download slot of the storage space. If the current number of source key files is greater than the first preset threshold, the key required for the business directly uses the key in the source key file; if the current number of source key files is less than or equal to the first preset threshold, but greater than the second preset threshold, call the key expansion interface to obtain the source key file for expansion to obtain the expanded key file, and store it in the key expansion slot in the storage space. The key required for the business uses the key in the key expansion slot; if the current number of source key files is less than or equal to the second preset threshold, download multiple source key files from the key center, and store the downloaded source key files in the key download slot in the storage space.
[0010] Furthermore, the expanded key file is deleted after being used and the source key file is deleted after being expanded.
[0011] Furthermore, when the operation of downloading multiple source key files from the key center fails and the key usage in the key expansion slot of the storage space is close to the third preset threshold, the key required for the business reuses the key obtained by expanding the source key file that has not been expanded.
[0012] Furthermore, performing corresponding operations of downloading source key files and expanding key files and storing them in the key file download space and the key file usage space refers to:
[0013] Obtain the current number of source key files and store them in the key download slot of the key file download space. When the number of source key files in the key file download space is less than or equal to the fourth preset threshold, multiple source key files are downloaded from the key center, and the downloaded source key files are stored in the key download slot in the key file download space. When the expanded key file in the key file usage space is less than or equal to the fifth preset threshold, call the key expansion interface to obtain the source key file from the key file download space for expansion to obtain the expanded key file, and store it in the key expansion slot in the key file usage space. The key required for the business uses the key in the key expansion slot. At the same time, the expanded source key file is also transferred to the key expansion slot in the key file usage space.
[0014] Furthermore, the expanded key file is provided with an expansion identifier.
[0015] Furthermore, the expanded key file is deleted after being used and the source key file is deleted after being expanded and used.
[0016] The present invention also includes a computer device, which includes at least a processor and a memory, and the processor is used to implement the key file management method as described in any one of the above claims when executing a computer program stored in the memory.
[0017] The present invention also includes a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the key file management method as claimed in any one of the above claims.
[0018] The beneficial effects of the present invention are as follows: the present invention first confirms the size of the local storage space of the device. For devices with a space size less than or equal to a predetermined size, the present invention selects to execute the corresponding source key file download operation or key expansion operation according to the number of current source key files, and stores the downloaded source key file or the expanded key file according to the location; otherwise, the key file download space and the key file usage space are divided from the local storage space, and the corresponding source key file download operation and key expansion operation are executed and stored in the key file download space and the key file usage space; by selecting different methods to download the source key file and expand the key file, and finally performing storage and use management, the orderliness of the key file use is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 Schematic diagram of a key file management method according to embodiment 1 of the present invention;
[0020] Figure 2 Schematic diagram of the key file management method according to embodiment 2 of the present invention. DETAILED DESCRIPTION
[0021] The present invention will be further described below with reference to the accompanying drawings and embodiments:
[0022] Example 1
[0023] As described in the background technology, the consumption of keys used in existing data encryption transmission is very huge. After using up the keys, in addition to downloading the keys from the key center, the keys can also be expanded. However, due to the addition of a key expansion algorithm, in the local storage space, i.e., in the key pool, there is not only the source key file as the expansion source, but also the expanded key file. If the source key file and the expanded key file are stored arbitrarily, the use of the key files will be confused. For example, problems such as confusion and uncontrolled orderliness of the key files will occur. In summary, the key file management problem under the situation of both the source key file and the expanded key file is in urgent need of processing, and the management scheme of the key file should be adapted to different hardware storage spaces. Therefore, how to solve these problems is an important issue currently faced.
[0024] like Figure 1 In view of this, the present invention proposes a key file management method, which includes the following steps:
[0025] Confirm the size of the local storage space on the device. If the local storage space is less than or equal to the predetermined size, which can be 5G or 10G, etc., through custom settings, select the corresponding source key file download operation or key expansion operation based on the number of current source key files, and store the downloaded source key file or the expanded key file according to the location, which specifically refers to:
[0026] Obtain the number of current source key files and store them in the key download slot of the storage space. If the number of current source key files is greater than a first preset threshold (e.g., the first threshold = 30), the key required for the business directly uses the key in the source key file;
[0027] If the number of current source key files is less than or equal to a first preset threshold (for example, the first threshold = 30) but greater than a second preset threshold (for example, the second threshold = 10), the key expansion interface is called to execute the key file expansion algorithm, that is, the source key file is obtained for expansion to obtain the expanded key file, and the expanded key file is stored in the key expansion slot in the storage space. The key required for the business uses the key in the key expansion slot; the device will reserve a storage area equivalent to the size of the expanded key file in the existing storage space according to the expansion multiple. Although the expanded key file and the source key file are both stored in the local storage space, the storage locations are different to ensure key usage management; and the expanded key file is provided with an expansion flag to prevent secondary expansion from diluting the randomness of the key file;
[0028] If the current number of source key files is less than or equal to a second preset threshold (for example, the second threshold = 10), multiple source key files are downloaded from the key center, and the downloaded source key files are stored in the key download slot in the storage space.
[0029] The expanded key file is deleted after it is used and the source key file is deleted after it is expanded.
[0030] When the operation of downloading multiple source key files from the key center fails, and the key usage in the key expansion slot of the storage space is close to the third preset threshold (for example, the third threshold = 100M), the key required by the business is reused by expanding the source key file that has been used but not expanded. This requires that the source key file that has not been expanded can be not deleted after use. If the current unused source key file is less than or equal to the second preset threshold and no new source key file enters the key download slot of the storage space, multiple files are selected from the used source key files to call the key expansion interface for expansion.
[0031] In view of the fact that the local storage space of the device is small, this embodiment manages both the source key file and the expanded key file in one storage space, thereby ensuring the orderly use of the key files.
[0032] An embodiment of the present invention further provides a computer device, which includes at least a processor and a memory, wherein the memory stores a computer program, and the processor is configured to implement the steps of the key file management method of the embodiment of the present invention when executing the computer program stored in the memory.
[0033] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the key file management method of the embodiment of the present invention are implemented.
[0034] Example 2
[0035] Confirm the size of the local storage space on the device. If the local storage space is larger than the predetermined size, which can be 5G or 10G, etc., the local storage space is divided into a key file download space and a key file usage space through custom settings. The corresponding source key file download operation and key expansion operation are performed and stored in the key file download space and the key file usage space. Specifically, it means:
[0036] Obtaining the current number of source key files and storing them in the key download slots of the key file download space; when the number of source key files in the key file download space is less than or equal to a fourth preset threshold (e.g., the fourth threshold = 300M), triggering a download operation, downloading multiple source key files from the key center, and storing the downloaded source key files in the key download slots in the key file download space;
[0037] When the expanded key file in the key file usage space is less than or equal to the fifth preset threshold (for example, the fifth threshold = 500M), the expansion operation is triggered, the key expansion interface is called to perform the key expansion operation, the source key file is obtained from the key file download space for expansion to obtain the expanded key file, the expanded key file is provided with an expansion identifier, the expanded key file is stored in the key expansion slot in the key file usage space, and the key required for the business uses the key in the key expansion slot; at the same time, the expanded source key file is also transferred to the key expansion slot in the key file usage space. The expanded key file is deleted after it is used and the source key file is deleted after it is expanded and used.
[0038] In this embodiment, the source key file download and expansion operations do not affect each other. When a key is used in a business, only the key file usage space is accessed, and a key file is selected from the key file usage space for use. All used key files are deleted. Thus, in this embodiment, the source key file and the expanded key file are stored separately, which simplifies management. The downloaded and expanded key files access two storage areas, ensuring the orderly use of key files.
Claims
1. A key file management method, characterized in that: The method includes: Confirm the size of the local storage space of the device. If the size of the local storage space is less than or equal to the predetermined space size, select and execute the corresponding source key file download operation or key expansion operation based on the number of current source key files, and store the downloaded source key file or expanded key file according to the location; if the size of the local storage space is larger than the predetermined space size, divide the key file download space and key file usage space from the local storage space, execute the corresponding source key file download operation and key expansion operation in the key file download space and key file usage space and store them.
2. A key file management method according to claim 1, characterized in that: The step of selecting and executing a corresponding source key file downloading operation or key expansion operation according to the number of current source key files, and storing the downloaded source key files or expanded key files according to the locations refers to: Obtain the current number of source key files and store them in the key download slot of the storage space. If the current number of source key files is greater than the first preset threshold, the key required for the business directly uses the key in the source key file; if the current number of source key files is less than or equal to the first preset threshold, but greater than the second preset threshold, call the key expansion interface to obtain the source key file for expansion to obtain the expanded key file, and store it in the key expansion slot in the storage space. The key required for the business uses the key in the key expansion slot; if the current number of source key files is less than or equal to the second preset threshold, download multiple source key files from the key center, and store the downloaded source key files in the key download slot in the storage space.
3. A key file management method according to claim 2, characterized in that: The expanded key file is deleted after being used and the source key file is deleted after being expanded.
4. A key file management method according to claim 3, characterized in that: When the operation of downloading multiple source key files from the key center fails and the key usage in the key expansion slot of the storage space is close to the third preset threshold, the key required for the business is reused by expanding the source key file that has not been expanded.
5. A key file management method according to claim 1, characterized in that: The performing of corresponding source key file downloading operations and key expansion operations and storing them in the key file download space and the key file usage space refers to: Obtain the current number of source key files and store them in the key download slot of the key file download space. When the number of source key files in the key file download space is less than or equal to the fourth preset threshold, multiple source key files are downloaded from the key center, and the downloaded source key files are stored in the key download slot in the key file download space. When the expanded key file in the key file usage space is less than or equal to the fifth preset threshold, call the key expansion interface to obtain the source key file from the key file download space for expansion to obtain the expanded key file, and store it in the key expansion slot in the key file usage space. The key required for the business uses the key in the key expansion slot. At the same time, the expanded source key file is also transferred to the key expansion slot in the key file usage space.
6. A key file management method according to claim 2 or 5, characterized in that: The expanded key file is provided with an expansion identifier.
7. A key file management method according to claim 5, characterized in that: The expanded key file is deleted after being used and the source key file is deleted after being expanded and used.
8. A computer device, characterized in that: The computer device includes at least a processor and a memory, and the processor is used to implement the key file management method according to any one of claims 1 to 7 when executing a computer program stored in the memory.
9. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the key file management method according to any one of claims 1 to 7.