Key management method and device based on communication chip and storage medium
By mapping and dynamically managing key files within the contiguous memory space of the communication chip using swap-in/swap-out rules, the problems of discontinuous key storage and low access efficiency in embedded communication chips are solved, improving encryption and decryption performance and resource utilization, and ensuring security and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-13
- Publication Date
- 2026-04-10
AI Technical Summary
Existing key management methods in embedded communication chips suffer from problems such as limited storage resources, discontinuous key layout, low access efficiency, and difficulty in balancing key utilization and consistency, leading to inefficient encryption and decryption processes and increased security risks.
The key file is mapped to the contiguous memory space of the communication chip, and the mapping and dynamic swapping rules are adopted in DMA mode to ensure the continuous storage and orderly use of the key file. The key file is used in sequence and swapped in and out with the currently used key file as the center and an interval of one key file.
It achieves centralized and orderly storage of key data, simplifies storage management logic, reduces addressing and access complexity, improves the overall efficiency of encryption and decryption processes, and ensures that key management and business operations are decoupled and run independently, avoiding key waste and synchronization problems.
Smart Images

Figure CN121841848A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of key management technology, and specifically to a key management method, device and storage medium based on a communication chip. Background Technology
[0002] With the rapid development of communication security technologies, key management is a core element in ensuring the security and efficiency of encryption and decryption operations. Traditional key management schemes typically rely on external high-capacity storage media (such as hard drives or solid-state drives) to store massive amounts of key files. However, embedded communication chips are limited by their environment, and their internal storage resources are extremely limited, making it impossible to accommodate the large-scale key storage requirements of traditional solutions. Therefore, how to achieve efficient and secure key management within the limited chip storage memory space has become a key technical challenge in chip design.
[0003] Existing technologies typically employ the method of splitting the original large key file, for example, dividing an original 128MB key file into multiple smaller segments, such as 32KB, 64KB, 128KB, or 256KB. While this segmentation method alleviates storage pressure to some extent, even a 32KB segment still occupies a considerable amount of storage memory within the chip. Further reducing the segment size may increase management complexity, and the benefits are limited, therefore it is not a fundamental solution.
[0004] In current common key management models, segmented key files are dynamically mapped into chip memory at different points in time. Due to the dynamic nature of memory allocation, these key files are randomly mapped to different memory addresses, resulting in their scattered storage in physical memory space and a lack of continuity. This non-contiguous storage layout leads to a series of operational complexities and performance degradation issues during key usage, specifically as follows:
[0005] First, the non-contiguous storage of key files in memory leads to significant post-encryption and decryption management overhead. When business logic requires data operations across multiple key files, the system must frequently perform context switching, memory address jumps, and even key file remapping. These operations not only increase processing latency but also reduce the overall execution efficiency of the encryption and decryption process, with such efficiency losses being particularly pronounced in chip applications with high real-time requirements.
[0006] Secondly, in encryption and decryption processing, the non-contiguous storage of keys presents a dilemma between key utilization and access consistency. On the one hand, if only the currently mapped key fragment is used, the remaining key at the end of the fragment may be discarded by the system because it is insufficient for a complete processing frame, resulting in key waste. In chip environments where key files are already small, this waste is more likely, and long-term accumulation can lead to severe depletion of effective key resources. On the other hand, if cross-key file indexing access is allowed, key synchronization problems may occur due to the processing time difference between the sender and receiver. For example, the receiver may have switched to the next key file, but the received data frame still needs to reference the key in the previous key file. This cross-fragment backtracking access increases indexing complexity and may lead to security risks of inconsistent encryption and decryption results.
[0007] In summary, existing key management methods face numerous storage challenges in chip environments. There is an urgent need for a new key management scheme that can adapt to the characteristics of chip internal resources, achieve continuous key storage and efficient access, so as to improve encryption and decryption performance and ensure optimal resource utilization. Summary of the Invention
[0008] Purpose of the Invention: The purpose of this invention is to provide a key management method, device, and storage medium based on a communication chip, which solves the problems faced by existing key management methods in a chip environment, such as limited storage resources, discontinuous key layout, low access efficiency, and difficulty in balancing key utilization and consistency. This invention maps the key file to a contiguous memory space, ensuring continuous read and write access to memory addresses. This eliminates the need for frequent key file switching, effectively reduces context switching, and prevents key waste.
[0009] Technical solution: This invention provides a key management method based on a communication chip, the method comprising the following steps:
[0010] The initial mapping key files are mapped into a contiguous memory space of the communication chip, wherein the number of initial mapping key files is at least three.
[0011] During the use of key files, the currently used key file is swapped in and out with an interval of one key file, with the swapped-in key file as the center.
[0012] Furthermore, the use of the key file refers to the sequential and cyclical use of key files within a contiguous memory space.
[0013] Furthermore, the contiguous memory space is divided into multiple equal sub-memory spaces, the number of which is the same as the number of key files initially mapped.
[0014] Furthermore, the key file mapping uses DMA to map the initially mapped key file into a contiguous memory space of the communication chip.
[0015] Furthermore, the swap-in / swap-out refers to swapping the used key file out of the sub-memory space and swapping the supplementary key file into the sub-memory space.
[0016] The present invention also includes a computer device comprising at least a processor and a memory, wherein the processor is configured to implement the key management method based on a communication chip as described in any of the preceding 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 that, when executed by a processor, implements the key management method based on a communication chip as described in any of the preceding claims.
[0018] The beneficial effects of this invention are as follows: By mapping multiple initial key files to a contiguous physical storage memory space of the communication chip, this invention achieves centralized and orderly storage of key data. This contiguous storage layout avoids storage fragmentation, simplifies the management logic of the storage memory space, and reduces the complexity of addressing and access, thereby improving the overall efficiency of key retrieval. Moreover, it decouples key management from business operations for each device, meaning that key management and business encryption / decryption operate independently without interference. In addition, this invention adopts a unique swap-in / swap-out rule centered on the currently used key file with an interval of one key file. This "skip-one-swap" strategy ensures dynamic switching of keys during use. Attached Figure Description
[0019] Figure 1 A schematic diagram of common existing key management models;
[0020] Figure 2 A diagram illustrating the mapping of three key files into a single contiguous memory space;
[0021] Figure 3 This is a diagram illustrating the mapping of four key files;
[0022] Figure 4 This diagram illustrates the swapping of four key files. Detailed Implementation
[0023] The present invention will be further described below with reference to the accompanying drawings and embodiments:
[0024] As described in the background section, in existing key management models, the segmented key files are dynamically mapped into the chip memory at different points in time, such as... Figure 1As shown, this results in keys being stored haphazardly in physical memory, failing to maintain continuity and causing a series of operational complexity and performance degradation issues. For example, when business logic requires data operations across multiple key files, the system must frequently perform context switching, memory address jumps, and even key file remapping. These operations not only increase processing latency but also reduce the overall execution efficiency of the encryption and decryption process. Secondly, in encryption and decryption processing, if only the currently mapped key fragment is used, the remaining key at the end of the fragment may be discarded by the system because it is insufficient for a complete processing frame, resulting in key waste. If cross-key file indexing access is allowed, key synchronization problems may occur due to the processing time difference between the sender and receiver. In summary, there is an urgent need for a new key management scheme that can adapt to the characteristics of chip internal resources and achieve continuous key storage and efficient access, in order to improve encryption and decryption performance and ensure optimal resource utilization.
[0025] In view of this, the present invention proposes a key management method based on a communication chip, the method comprising the following steps:
[0026] The initial mapping key files are mapped to a contiguous memory space of the communication chip, wherein the number of initial mapping key files is at least three. Since there is no mmap interface inside the communication chip, the key file mapping in this embodiment adopts the DMA method to map the initial mapping key files to a contiguous memory space of the communication chip. The DMA method is to realize high-speed data transmission through the DMA controller, and map the disk files scattered in various nodes of the hard disk to a contiguous memory space.
[0027] like Figure 2 As shown, the key files file1, file2, and file3 are mapped to contiguous memory addresses. This ensures that when cross-file access is needed, the memory addresses are read and written consecutively, eliminating the need for frequent file switching, effectively reducing system context switching, and preventing key waste. The contiguous memory space is divided into multiple equal sub-memory spaces, the number of which is the same as the number of initially mapped key files, with at least three key files initially mapped.
[0028] During the use of key files, that is, during the sequential and cyclical use of key files within a contiguous memory space, used key files are swapped in and out with an interval of one key file centered on the currently used key file. In other words, a dynamic swapping-in / swap-out method is adopted. Figure 3 As shown, the initial mapping uses 4 key files (5 would be better if chip resources are plentiful). When keys begin to be consumed, assuming... Figure 3 and Figure 4As shown, when the current offset points to the third key file, the probability of indexing the first key file is extremely small. The key file file1 should be swapped out and the key file file5 should be swapped in instead, and so on. That is, swapping in and out is performed every other key file, swapping out the used key file from the sub-memory space and swapping in the supplementary key file.
[0029] Based on the mapping relationship above, it can be seen that when using key offsets, a key file location must be redundant both forward and backward to ensure dynamic key switching during use. That is, when decryption requires forward key indexing, since there is an extra redundant key file forward, it can be directly indexed without remapping the file to memory; when encryption requires backward key indexing, since there is also an extra redundant file backward, it can also be used directly. In short, the general principle is to have an extra redundant key file both forward and backward, meaning that key file swapping occurs every other key file. Figure 4 As shown, when indexing the key file backward, only one additional key file is needed. However, when indexing the key forward, frame data may be still on the network and has not yet arrived at the local machine, but the local data has already started encrypting and using the key, resulting in excessive key offset. Therefore, forward redundancy only requires one additional key file.
[0030] In summary, this involves dynamic key swapping in and out. Unlike previous dynamic key swapping methods, where the key memory space was discontinuous after swapping in and out, resulting in inconsistent and continuous key memory and preventing the formation of a loop, key offsets always occurred across different memory segments. Therefore, the key management method based on the communication chip in this embodiment solves the above problems.
[0031] This invention achieves centralized and orderly storage of key data by mapping multiple initial key files to a contiguous physical storage memory space of the communication chip. This contiguous storage layout avoids storage fragmentation, simplifies the management logic of the storage memory space, and reduces the complexity of addressing and access, thereby improving the overall efficiency of key retrieval. Moreover, it decouples key management from business operations for each device, meaning that key management and business encryption / decryption operate independently without interference. In addition, this invention adopts a unique swap-in / swap-out rule centered on the currently used key file with an interval of one key file. This "skip-one-swap" strategy ensures dynamic switching of keys during use.
[0032] This invention also provides a computer device, which includes at least a processor and a memory. The memory stores a computer program, and the processor executes the computer program stored in the memory to implement the steps in the key management method based on a communication chip according to this invention.
[0033] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the key management method based on a communication chip according to this invention.
Claims
1. A key management method based on a communication chip, characterized in that, The method includes the following steps: The initial mapping key files are mapped into a contiguous memory space of the communication chip, wherein the number of initial mapping key files is at least three. During the use of key files, the currently used key file is swapped in and out with an interval of one key file, with the swapped-in key file as the center.
2. The key management method based on a communication chip according to claim 1, characterized in that: The use of the key file refers to the sequential and cyclical use of the key file within a contiguous memory space.
3. The key management method based on a communication chip according to claim 1, characterized in that: The contiguous memory space is divided into multiple equal sub-memory spaces, the number of which is the same as the number of key files in the initial mapping.
4. The key management method based on a communication chip according to claim 1, characterized in that: The key file mapping uses DMA to map the initially mapped key file into a contiguous memory space of the communication chip.
5. The key management method based on a communication chip according to claim 3, characterized in that: The term "swap in" refers to swapping out the used key file from the sub-memory space and swapping in the supplementary key file.
6. A computer device, characterized in that: The computer device includes at least a processor and a memory, wherein the processor is used to implement the key management method based on a communication chip as described in any one of claims 1-5 when executing a computer program stored in the memory.
7. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the key management method based on a communication chip as described in any one of claims 1-5.