A method for preventing recovery of a memory key

By employing a multi-layered memory overlay mechanism and a dynamic migration strategy, the problem of residual charge patterns in key data in memory being recoverable by cold-start attacks is solved, achieving effective protection of key data and reducing the success rate of attacks.

CN121682860BActive Publication Date: 2026-05-19WEIMEI TIANCHENG TECH BEIJING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEIMEI TIANCHENG TECH BEIJING CO LTD
Filing Date
2025-11-28
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In existing technologies, residual charge patterns of key data after its use in memory can be recovered by cold start attacks, lacking an effective physical layer protection mechanism.

Method used

A multi-level memory overlay mechanism is adopted, including generating a cold start overlay vector before the key is used to perform multiple random data overlays, dynamically migrating the control vector through cyclic shifting during use, and performing fragmented overlay and deep erasure verification based on the GMRES algorithm after use to ensure that the similarity of residual data is reduced to below 5%.

Benefits of technology

By working together in multiple dimensions, the identifiability of residual charge is destroyed, the attack window is dispersed, the success rate of cold start attacks is significantly reduced, and key data is ensured to be unrecoverable in memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121682860B_ABST
    Figure CN121682860B_ABST
Patent Text Reader

Abstract

The application provides a memory key recovery prevention method, and belongs to the field of encryption security technology. The application eliminates historical charges through 5-12 cold start coverings before the key is used. A 30-180 second cycle shift is established to realize dynamic migration. After the key is used, hot area address segments with an access frequency exceeding 50 times per unit time are extracted, fragmented and segmented according to 8B-64B granularity, and a residual minimization mechanism based on the GMRES algorithm is used to calculate the covering sequence. Deep erasing verification is performed to ensure that the similarity of residual data is lower than 5%. An integrity verification report is constructed by changing the tracking sequence, and the technical problem that the residual charge mode of the key data in the memory after use can be recovered by a cold start attack is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of encryption security technology, and specifically relates to a method for preventing the recovery of memory keys. Background Technology

[0002] In cryptographic applications, key data needs to be loaded into memory for encryption and decryption operations. Traditional techniques use simple memory zeroing or single-overwrite methods to handle used key areas. However, due to the physical characteristics of DRAM storage cells, even after a zeroing operation, residual charge in the storage cells can remain identifiable for seconds to minutes after power failure. Attackers can extend this residual time by using liquid nitrogen cooling or other methods, and then transfer the memory module to analysis equipment for data reconstruction, successfully recovering the original key content. In existing technologies, due to the lack of deep protection mechanisms against the physical characteristics of memory, a single overwrite cannot completely eliminate residual charge patterns, and the fixed location of statically stored keys makes them vulnerable to targeted attacks. In other words, existing technologies suffer from the technical problem that residual charge patterns after key data is used in memory can be recovered by cold-start attacks. Summary of the Invention

[0003] In view of this, the present invention provides a method for preventing the recovery of memory keys, which can solve the technical problem in the prior art where residual charge patterns of key data after use in memory can be recovered by cold start attacks.

[0004] This invention is implemented as follows: A method for preventing the recovery of a memory key includes the following steps: Before key use, a cold start overlay vector is generated and multiple random data overlays are performed on the key storage area; after the key is loaded into memory, a hot zone access matrix is ​​recorded and a mapping relationship between the hot zone access matrix and the physical memory address is established; during key use, a cyclic shift control vector is established, and the next storage location is calculated based on the cyclic shift control vector, and data migration is completed; after detecting a key access end signal, memory address segments whose access frequency exceeds a preset threshold in the hot zone access matrix are extracted; the memory address segments are fragmented and a fragmentation overlay matrix is ​​generated, with the overlay order calculated using a residual minimization mechanism based on the GMRES algorithm, and an approximate solution that minimizes the L2 norm of the fragment address jump residual is found in the Krylov subspace; after performing the fragmentation overlay operation, a fragmentation erase vector is established and deep erase verification is performed; after the fragmentation erase verification of all memory fragments is completed, a change tracking sequence is generated and an anti-recovery operation integrity verification report is constructed.

[0005] The cold start overlay vector is a one-dimensional vector with a length equal to the number of bytes in the key storage area. Each element of the cold start overlay vector is generated by a cryptographically secure pseudo-random number generator.

[0006] The encrypted secure pseudo-random number generator uses an algorithm based on a high-entropy seed. The high-entropy seed is derived from a combination of system clock, processor temperature sensor, and memory noise, and covers a closed interval of 5 to 12 times.

[0007] The number of coverages is determined by the key security level, which is divided into standard, enhanced and highest levels. The standard level corresponds to a closed interval of 5 to 7 coverages, the enhanced level corresponds to a closed interval of 8 to 10 coverages, and the highest level corresponds to a closed interval of 11 to 12 coverages.

[0008] The hot zone access matrix is ​​a two-dimensional matrix. The number of rows in the hot zone access matrix represents the number of memory address segments, and the number of columns in the hot zone access matrix represents the attribute dimension of the record, with the number of columns being equal to 5.

[0009] The attribute dimensions include physical address, logical address, access timestamp, access type, and access frequency. The hot zone access matrix is ​​updated in real time through a memory access hook function, and the access frequency column is implemented through an accumulator counter.

[0010] The cyclic shift control vector is a one-dimensional vector. The length of the cyclic shift control vector is equal to the number of migration steps within the key data migration cycle. Each element of the cyclic shift control vector represents the target address offset for the corresponding migration.

[0011] The target address offset is calculated by applying a pseudo-random offset value to the current address. The pseudo-random offset value ranges from 10% to 90% of the current memory page size, and the migration period is within a closed interval of 30s to 180s.

[0012] The fragmentation coverage matrix is ​​a two-dimensional matrix. The number of rows in the fragmentation coverage matrix represents the total number of memory fragments, and the number of columns in the fragmentation coverage matrix represents the attribute dimension of the coverage operation, with the number of columns equal to 5.

[0013] The attribute dimensions include fragment start address, fragment length, coverage sequence number, coverage data mode type and coverage completion flag. The fragment granularity is within a closed range of 8B to 64B, and the coverage data mode type includes all-zero mode, all-one mode, alternating mode and pseudo-random mode.

[0014] The residual minimization mechanism employs the GMRES algorithm iteratively solved in the Krylov subspace, where the GMRES algorithm constructs a coefficient matrix from the fragment address sequence. The desired uniformly distributed target is constructed as the right-hand vector. .

[0015] Among them, by solving the linear system To obtain the covering order vector x, the GMRES algorithm minimizes the residual vector r= - of Norm in Krylov subspace To find an approximate solution, the dimension of the Krylov subspace is in the closed interval between 5 and 20.

[0016] The fragmented erase vector is a one-dimensional vector with a length equal to the total number of memory fragments. Each element of the fragmented erase vector represents the erase verification status of the corresponding memory fragment.

[0017] The erasure verification is achieved through a deep read operation, which performs multiple consecutive reads of memory fragments and calculates the Hamming distance between the read data and the original key data. The Hamming distance is then normalized and used as the similarity of the residual data.

[0018] Specifically, when the similarity of the residual data is less than 5%, the corresponding element is marked as verified, and the memory fragments that fail verification are added back to the fragmentation coverage matrix for re-coverage.

[0019] The change tracking sequence is a one-dimensional vector. The length of the change tracking sequence is equal to the total number of operations that occur during the recovery process. Each element of the change tracking sequence records the detailed information of the corresponding operation, including the operation type identifier, operation timestamp, operation target address, and operation result status.

[0020] This invention solves the technical problem of recoverable residual charge in keys by establishing a multi-layered memory overlay mechanism and dynamic migration strategy, implementing targeted protection at each stage of the key lifecycle. Before key use, this invention employs 5 to 12 rounds of random data overlay to eliminate historical charge patterns. During use, it breaks static storage characteristics through cyclic shifts with periods of 30 to 180 seconds. After use, it performs fragmented overlay based on the GMRES algorithm to optimize high-frequency access areas, dividing memory into 8B to 64B granularities and performing deep erasure in the order of minimizing residuals, ensuring that the similarity of residual data is reduced to below 5%. Through multi-dimensional synergy, this invention physically destroys the identifiability of residual charge, disperses the attack window in the temporal dimension, and disrupts the data distribution pattern in the spatial dimension, thus depriving cold-start attacks of the basis for exploitable residual patterns. In summary, this invention solves the technical problem mentioned in the background art where residual charge patterns after key data is used in memory can be recovered by cold-start attacks. Attached Figure Description

[0021] Figure 1 This is a flowchart of the method of the present invention.

[0022] Figure 2 This is a dynamic migration trajectory diagram of the key data address in the embodiment.

[0023] Figure 3 This is a distribution diagram of fragmented overlay address jump distances in the embodiment. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.

[0025] like Figure 1 The diagram shown is a flowchart of a memory key anti-recovery method provided by the present invention. This method includes the following steps:

[0026] S01. Before using the key, a cold start overlay vector is generated. The cold start overlay vector is used to initialize and fill the memory area and to overlay the key storage area with multiple random data overlays. The number of overlays is within a closed range of 5 to 12 times.

[0027] S02. After the key is loaded into memory, a hot zone access matrix is ​​recorded. The hot zone access matrix is ​​used to mark the actual location and access frequency of the key data in memory, and to establish a mapping relationship between the hot zone access matrix and the physical address of memory.

[0028] S03. During the key usage process, a cyclic shift control vector is established. The cyclic shift control vector is used to control the dynamic migration of key data in memory. The next storage location is calculated according to the cyclic shift control vector and the data migration is completed. The migration period is within a closed interval of 30s to 180s.

[0029] S04. After detecting the key access end signal, extract the memory address segments in the hot zone access matrix whose access frequency exceeds a preset threshold, and compare the access frequency value with the preset threshold. The preset threshold is 50 accesses per unit time. When the access frequency exceeds the preset threshold, start the fragmentation overwrite process; otherwise, proceed to step S05.

[0030] S05. The memory address segment is fragmented and a fragmentation coverage matrix is ​​generated. The fragmentation coverage matrix is ​​used to record the coverage order and coverage data pattern of each memory fragment. The memory address segment is divided into a closed interval of 8B to 64B according to the fragment granularity. Coverage operation is performed on each memory fragment in sequence. The coverage order is calculated by the residual minimization mechanism based on the GMRES algorithm. An approximate solution that minimizes the L2 norm of the fragment address jump residual is found in the Krylov subspace.

[0031] S06. After performing the fragmentation overwrite operation, a fragmentation erase vector is established. The fragmentation erase vector is used to perform deep erase verification on the covered memory fragments. By reading the memory fragment data and comparing it with the change tracking sequence, the similarity of the residual data is calculated. When the similarity of the residual data is less than 5%, the erasure is completed. Otherwise, the overwrite operation is repeated on the memory fragment.

[0032] S07. After the fragmentation and erasure verification of all memory fragments is completed, a change tracking sequence is generated. The change tracking sequence is used to record the operation timestamps and operation types throughout the entire anti-recovery process. The change tracking sequence is correlated with the cold start overlay vector to construct an anti-recovery operation integrity verification report.

[0033] The cold start coverage vector is a vector of length [missing information]. A one-dimensional vector, the length of which The number of bytes in the key storage area is equal to the number of elements in the cold-start overlay vector. Each element of the cold-start overlay vector is generated by a cryptographically secure pseudo-random number generator. This generator employs an algorithm based on a high-entropy seed, derived from a combination of system clock, processor temperature sensor, and memory noise. The cold-start overlay vector performs multiple rounds of overlay writing to the target memory area before key loading, with each round using a different pseudo-random number sequence. The purpose of these multiple overlays is to eliminate residual charge patterns in the memory cells. The number of overlays... The value is determined by the key security level, which is divided into standard, enhanced, and highest levels. The standard level corresponds to the number of coverage attempts. ∈[5, 7], the enhancement level corresponds to the number of coverage times ∈[8, 10], the highest level corresponds to the number of coverages. ∈[11, 12].

[0034] The hot zone access matrix is ​​a dimensionless matrix. OK A two-dimensional matrix of columns, the number of rows The number of columns indicates the number of memory address segments. Indicates the attribute dimensions of the record and =5, the attribute dimensions include physical address, logical address, access timestamp, access type, and access frequency, and the hotspot access matrix is... Line 1 Column elements Record number The first memory address segment The hotspot access matrix is ​​updated in real time via a memory access hook function, which intercepts all read and write operations on the key data. The access frequency column is implemented using an accumulator counter, which increments by 1 each time an access occurs. The number of memory address segments... The physical address is obtained from the memory management unit, the logical address is obtained from the operating system virtual memory mapping table, the access timestamp is obtained from the system clock, the access type is obtained by the memory access hook function parsing the instruction type, the access frequency is output by the accumulator counter, and the hot zone access matrix is ​​used for memory address segment extraction in step S04.

[0035] The cyclic shift control vector is a vector of length [missing information]. A one-dimensional vector, the length of which The number of migration steps within the key data migration cycle, and each element of the cyclic shift control vector. Indicates the first The target address offset for each migration is calculated by applying a pseudo-random offset value to the current address. This pseudo-random offset value ranges from 10% to 90% of the current memory page size. The circular shift control vector employs a circular queue structure. When the number of migrations exceeds this length... The migration cycle restarts from the first element of the vector. This cyclic shift mechanism causes the key data's position in memory to change unpredictably and dynamically. This dynamic change reduces the success rate of recovering the key through a cold start attack. Specifyed by the system security policy configuration file and ∈[30s, 180s], the number of migration steps The migration cycle The current address is obtained by dividing by the time taken for a single migration operation. It is extracted from the physical address column of the hot zone access matrix. The target address offset is used to calculate the next storage location in step S03.

[0036] The fragmentation coverage matrix is ​​a matrix with dimension 1. OK A two-dimensional matrix of columns, the number of rows The column number represents the total number of memory fragments. Indicates the attribute dimension of the overwrite operation and =5, the attribute dimensions include fragment start address, fragment length, coverage order number, coverage data mode type, and coverage completion flag. The coverage data mode type includes all-zero mode, all-one mode, alternating mode, and pseudo-random mode. Each row of the fragmentation coverage matrix corresponds to a complete coverage description of a memory fragment. The fragment start address is extracted from the physical address column of the hot zone access matrix. The fragment length is determined based on memory alignment requirements and the fragment granularity. Determined and ∈[8B, 64B], the covering order number is calculated through the residual minimization mechanism, which transforms the fragment covering problem into a linear system problem. The optimal covering order is obtained by minimizing the address jump residuals between fragments. This optimal covering order reduces the cache miss rate of the covering operation. The total number of memory fragments... Divide the total length of the memory address segment by the fragmentation granularity. The calculation shows that the initial value of the overwrite completion flag is 0 to indicate that it has not been overwritten, and it is updated to 1 after the overwrite operation is performed to indicate that it has been overwritten. The overwrite sequence number is used to determine the overwrite execution order of memory fragments in step S05.

[0037] The fragmentation erasure vector is a vector of length [length missing]. A one-dimensional vector, the length of which Equal to the total number of memory fragments Each element of the fragmented erase vector Indicates the first The erase verification status of each memory fragment includes three values: unverified, verified successfully, and verified failed. The erase verification is implemented through a deep read operation, which performs multiple consecutive reads of the memory fragment and calculates the Hamming distance between the read data and the original key data. The normalized Hamming distance is used as the similarity of the residual data. When the similarity of the residual data is less than 5%, the corresponding element is... If the verification is marked as successful, the memory fragments that failed the verification are added back to the fragmentation overlay matrix for overlay again. The read data is obtained directly from the memory fragment address. The original key data is extracted from the key backup buffer. The Hamming distance is calculated by bitwise XOR operation. The erase verification status is used in step S06 to determine whether the overlay operation needs to be repeated.

[0038] The change tracking sequence is a sequence of length [length missing]. A one-dimensional vector, the length of which Equal to the total number of operations that occur during the recovery process, each element of the change tracking sequence Record number Detailed information for each operation, including operation type identifier, operation timestamp, operation target address, and operation result status. The operation type identifier is represented by an enumeration value, which includes cold start overwrite, hot zone recording, circular shift, fragment overwrite, and fragment erase. The change tracking sequence is used to construct a timeline view of the recovery-proof operation. The timeline view is generated by sorting the elements of the change tracking sequence according to the operation timestamp. The recovery-proof operation integrity verification report is generated by analyzing the continuity and integrity of the change tracking sequence. The total number of operations... The number of times the cold start coverage vector is covered. The number of times the hot zone access matrix is ​​updated, and the number of migration steps of the cyclic shift control vector. The fragmentation overlay matrix is ​​obtained by summing the number of overlay operations and the number of verifications of the fragmentation erase vector. The operation timestamp is obtained from the system clock. The operation target address is extracted from the address parameters of the corresponding operation. The operation result status is determined by the execution result of the corresponding operation. The change tracking sequence is used to compare with the read data in step S06.

[0039] The residual minimization mechanism employs the GMRES algorithm to iteratively solve the problem in the Krylov subspace. The GMRES algorithm constructs a coefficient matrix from the fragment address sequence. The desired uniformly distributed target is constructed as the right-hand vector. By solving linear systems Obtain the covering order vector The covering order vector Each component corresponds to a memory fragment coverage priority weight, and the index of the coverage priority weights arranged in descending order is the coverage order number. The GMRES algorithm minimizes the residual vector. of Norm in Krylov subspace To find an approximate solution, the dimension of the Krylov subspace is... ∈[5, 20] is determined by the iterative convergence, and the coefficient matrix is... The elements are constructed by normalizing the address distances between fragments, and the right-hand vector is... The elements are set to uniform values ​​to achieve uniform coverage of the address space. The fragmented address jump residual is defined as the address difference between adjacent overlay operations. Norm minimization ensures the smoothness of the coverage path.

[0040] The preset threshold in step S04 is calculated by a set of access frequency equations, which includes a baseline frequency equation and a dynamic adjustment equation.

[0041] The baseline frequency equation is used to calculate the expected access frequency of key data under normal usage scenarios, and the input includes the key data length. Time consumption of a single cryptographic operation and system concurrency The output is the baseline access frequency threshold. The key data length The time consumed by the single cryptographic operation is obtained from the key management module. The system concurrency level is obtained from the performance monitoring module. Obtained from the operating system scheduler.

[0042] The dynamic adjustment equation is used to adjust the baseline access frequency threshold according to the actual operating environment. The input includes the baseline access frequency threshold. Memory bus bandwidth utilization and processor load rate The output is a dynamically adjusted preset threshold. The memory bus bandwidth utilization The processor load rate is obtained from the memory controller performance counters. The preset threshold is obtained from the operating system performance monitoring interface. Used for comparison with the access frequency value in step S04.

[0043] The residual data similarity in step S06 is calculated by a set of similarity equations, which includes the Hamming distance normalization equation and the weighted similarity equation.

[0044] The Hamming distance normalization equation is used to convert the original Hamming distance into a dimensionless similarity value. The input includes the Hamming distance between the read data and the original key data. Total number of data bits The output is the normalized Hamming similarity score. The Hamming distance The total number of bits of data is calculated from the XOR operation result of the depth read operation. Multiply the length of the fragment by 8.

[0045] The weighted similarity equation is used to calculate the final similarity by combining the results of multiple reads. The input includes the normalized Hamming similarity. Number of reads and the confidence weights of each read The output is the similarity of the residual data. The number of reads ∈[3, 10] is specified by the verification strategy configuration, the confidence weight The residual data similarity is calculated based on the success rate of the read operation. Used for comparison with the 5% threshold in step S06.

[0046] As one embodiment of the present invention, the present invention also provides a method for forming a memory key anti-recovery system by means of a computer, wherein the computer is provided with a readable storage medium, the readable storage medium stores program instructions, and the program instructions execute the above-mentioned memory key anti-recovery method when the computer is run.

[0047] The specific implementation methods of the above steps are described in detail below.

[0048] The specific implementation of step S01 involves first acquiring high-entropy seed source data from the system clock module, processor temperature sensor module, and memory noise acquisition module. This high-entropy seed source data possesses high randomness and unpredictability, ensuring that the subsequently generated pseudo-random number sequence has cryptographic security strength. The acquired multi-source high-entropy data is mixed and processed, and an initial seed is generated through XOR operations and bit rearrangement operations. This initial seed serves as the input parameter for the cryptographically secure pseudo-random number generator. Based on the initial seed, the pseudo-random number generator is started. This generator employs a cryptographically strong random number generation algorithm, capable of outputting a pseudo-random number stream with good statistical properties and whose seed cannot be deduced from the output sequence. The length of the cold-start overlay vector is determined based on the number of bytes in the key storage area. This length strictly corresponds to the size of the memory region to be protected, ensuring complete and comprehensive coverage. The generated length is... The cold start overlay vector consists of elements generated sequentially by a pseudo-random number generator, each element corresponding to a one-byte overlay data location in memory. The number of overlays is determined based on the key's security level configuration parameters. The standard-level key is covered 5 to 7 times, the enhanced-level key is covered 8 to 10 times, and the highest-level key is covered 11 to 12 times. Increasing the number of coverages allows for a more thorough elimination of residual charge patterns in memory cells. Multiple rounds of overwrite operations are performed on the target memory region. Each round uses a newly generated sequence of pseudo-random numbers. The cold-start overwrite vector data is written byte-by-byte to the target memory address using memory write instructions, and this process is repeated. Round-over operation. The purpose of this step is to completely destroy the original data charge distribution pattern that may remain in the memory cell through multiple random data overwrites, preventing attackers from recovering key data from the memory chip after the system is powered off using cold start attack techniques. The multi-round overwrite mechanism is based on the principle that the charge residue in the physical characteristics of the memory cell decays exponentially with the number of overwrites, ensuring that even with advanced physical analysis methods, the data content before it was overwritten cannot be recovered.

[0049] The specific implementation of step S02 is to initialize the hot zone access matrix data structure immediately after the key data is loaded into memory. This matrix is ​​a two-dimensional matrix structure with a number of rows. The number of columns is determined by the actual number of address segments occupied by the key data in memory. The number of access parameters is fixed at 5, corresponding to five attribute dimensions: physical address, logical address, access timestamp, access type, and access frequency. A memory access hook function is registered at the operating system kernel level. This hook function intercepts read and write requests from the memory management unit to achieve real-time monitoring of key data access behavior, capturing all access operations to the key storage area without affecting normal business processes. When an access operation to key data is detected, the hook function immediately extracts detailed information about the access, reads the physical address information from the memory management unit register, queries the corresponding logical address information from the operating system's virtual memory mapping table, obtains the current high-precision timestamp from the system clock, and determines whether the access is a read or write operation by parsing the instruction type executed by the processor. The extracted access information is then filled into the corresponding position in the hot zone access matrix. If the memory address segment is being accessed for the first time, a new record is added to the matrix and the access frequency is initialized to 1. If a record already exists for the address segment, the corresponding row is located and the accumulator counter of the access frequency column is incremented by 1. A bidirectional mapping table is established between the hotspot access matrix and physical memory addresses. This table uses the physical address as the index key and the matrix row number as the index value, supporting fast lookup of the record position of any physical address in the matrix, and also supporting reverse lookup of the corresponding physical address range from the matrix row number. The purpose of this step is to accurately grasp the actual distribution location and usage frequency characteristics of the keys in memory by monitoring and recording the access behavior of key data in real time. This information provides precise target address location for subsequent fragmentation overwrite operations. Access frequency statistics are used to identify high-risk hotspot memory regions. The hook function mechanism can transparently collect access data without modifying the application code, ensuring the universality and compatibility of the key anti-recovery mechanism.

[0050] The specific implementation of step S03 is to read the key migration cycle parameter according to the system security policy configuration file. This migration period parameter ranges from 30s to 180s. Shorter migration periods offer higher security but increase system overhead, while longer migration periods strike a balance between performance and security. Performance tests are used to obtain the average time for a single key data migration operation, and the migration period is then used as the basis for this calculation. The number of migration steps is calculated by dividing by the time of a single migration. This step count represents the number of migration operations required to complete a full migration cycle. The initial length is [value missing]. The circular shift control vector, each element in the vector This represents the target address offset to which the key data should be moved during the k-th migration. A pseudo-random number generator is started to generate an offset value for each vector element. The value of each offset is set between 10% and 90% of the current memory page size. This range ensures sufficient address jump distance to break address continuity while avoiding page table switching overhead caused by crossing too many memory pages. The circular shift control vector is organized into a circular queue data structure. When the number of migrations exceeds the vector length... The system automatically restarts the cycle from the first element of the vector, ensuring the continued effectiveness of migration operations in long-running scenarios. During key usage, the migration occurs according to a pre-defined cycle. Trigger the data migration operation, extract the memory address where the current key data is located from the physical address column of the hot zone access matrix, and retrieve the offset corresponding to the current migration step from the cyclic shift control vector. The current address is added to the offset to calculate the target address of the next storage location. A memory data migration operation is then performed. First, the memory region at the target address is pre-cleaned. Then, the key data is copied from the current location to the target location. After copying, random data is overwritten in the original location. Finally, the physical address record in the hotspot access matrix is ​​updated. The purpose of this step is to make the position of the key data in memory exhibit an unpredictable change pattern through periodic dynamic migration. Even if an attacker obtains the memory address information of the key at a certain moment, this information will become invalid within a short period. The cyclic shift mechanism, based on the random walk principle, makes the temporal evolution trajectory of the key position unpredictable through historical data, significantly reducing the success probability of targeted memory scanning attacks. The use of pseudo-random offsets breaks the regular distribution of the address space, further enhancing the protection effect.

[0051] The specific implementation of step S04 involves detecting the key access end signal through the status interface of the key management module. This signal is either actively sent by the application after completing the cryptographic operation or automatically triggered by the timeout mechanism. Upon receiving the key access end signal, the hotspot access matrix is ​​immediately scanned and analyzed, and the access frequency statistics for each memory address segment are extracted from the access frequency column of the matrix. The key data length is then obtained from the key management module. The parameters are obtained from the performance monitoring module, showing the time taken for a single cryptographic operation. Parameters, obtained from the operating system scheduler, show the system concurrency level. These three parameters collectively reflect the expected access strength of the key under normal usage scenarios. The baseline access frequency threshold is calculated by taking the key data length, single operation time, and system concurrency as input parameters, based on the baseline frequency calculation equation. This benchmark value represents the upper limit of the reasonable access frequency of the key under ideal load conditions. Memory bus bandwidth utilization is read from the memory controller's performance counters. Obtain processor load rate from the operating system performance monitoring interface These two operating environment parameters reflect the actual working state of the system. Based on the dynamic adjustment equation, the baseline access frequency threshold, memory bus bandwidth utilization, and processor load rate are used as input parameters to calculate the dynamically adjusted preset threshold. This threshold can adapt to different system load conditions. Under high load, the threshold is appropriately increased to reduce false positives, while under low load, the threshold is decreased to improve detection sensitivity. The default reference value is set to 50 accesses per unit time. The system iterates through each row of the hotspot access matrix, comparing the access frequency value with the preset threshold. Numerical comparisons are performed. When the access frequency of a memory address segment exceeds a preset threshold, the start and end addresses of that segment are extracted and added to the high-frequency access address segment list. Address segments that do not exceed the threshold are skipped without processing. The high-frequency access address segment list is checked for emptiness. If an address segment exists in the list, the fragmentation overwrite process is immediately initiated, proceeding to step S05. If the list is empty, it indicates that the access frequency of all memory regions is within the normal range, and fragmentation overwrite is unnecessary. The purpose of this step is to identify frequently accessed hotspot memory regions in the key data through access frequency analysis. These high-frequency access regions experience decreased charge state stability due to repeated reads and writes, making them more prone to data retention after power failure. The threshold judgment mechanism based on access frequency can accurately locate memory address segments requiring key protection. The dynamic threshold adjustment algorithm considers the impact of the actual system operating environment, avoiding the adaptability issues of fixed thresholds under different load scenarios. This mechanism embodies a risk-driven differentiated protection strategy, concentrating limited security resources to protect the most vulnerable memory regions.

[0052] The specific implementation of step S05 involves extracting memory address segment information one by one from the high-frequency access address segment list output in step S04, obtaining the start address and length parameters of each address segment. This is done based on memory alignment requirements and fragmentation granularity parameters. The memory address segment is divided into segments with a fragmentation granularity parameter ranging from 8B to 64B. Smaller fragmentation granularity provides finer coverage control but increases the number of fragments and management overhead, while larger fragmentation granularity simplifies the processing but reduces coverage flexibility. Each memory address segment is then divided according to its fragmentation granularity. Perform equal-length partitioning, ensuring that the starting address of each fragment satisfies memory alignment constraints during partitioning, and calculate the total number of fragments. Equals the total length of the memory address segment divided by the fragmentation granularity Initialize the dimension as follows: A 5-row fragmentation coverage matrix is ​​used. Each row corresponds to a complete description of a memory fragment, and the five columns store the fragment's starting address, fragment length, coverage sequence number, coverage data mode type, and coverage completion flag, respectively. To populate the fragmentation coverage matrix, the starting address of each fragment is entered into the first column, and the fragment length is standardized. Fill in the second column, initializing the coverage completion flag to 0 to indicate an uncovered state. Construct the coefficient matrix for calculation using the generalized minimum residual method. The elements of this matrix are obtained by normalizing the address distances between fragments. The element in the i-th row and j-th column reflects the relative distance between the i-th fragment and the j-th fragment in the address space. Construct the desired uniformly distributed target vector. Each element in the target vector is set to the same uniform value, representing the ideal uniform distribution expectation of fragment overlay operations in the address space. A generalized minimum residual method is used to iteratively solve the linear system in a Krylov subspace. This algorithm constructs a Krylov subspace and searches for an approximate solution that minimizes the L2 norm of the residual vector. The dimension of the subspace is adaptively determined between 5 and 20 based on the iteration convergence. During iteration, the residual vector is continuously updated. The residual vector equals the target vector minus the product of the coefficient matrix and the current solution vector. The L2 norm of the residual vector is calculated as a convergence criterion. Iteration terminates when the L2 norm of the residual falls below a preset convergence threshold or the maximum number of iterations is reached, and an overlay order vector is output. Each component of this vector corresponds to the overlay priority weight of a memory fragment. The overlay priority weights are sorted in descending order, and the sorted index positions are the overlay order numbers of each fragment. These overlay order numbers are then filled into the third column of the fragmentation overlay matrix. Based on the address characteristics and data pattern diversity requirements of the fragments, a coverage data pattern type is assigned to each fragment. Optional patterns include all-zero, all-one, alternating, and pseudo-random patterns. Different coverage patterns can destroy different types of residual data characteristics. The assigned pattern type is filled into the fourth column of the matrix. Coverage operations are performed on the memory fragments sequentially according to their coverage order number. For each fragment, corresponding coverage data is generated based on its coverage data pattern type. The coverage data is written to the memory address corresponding to the fragment using memory write instructions. After the coverage is complete, the coverage completion flag of the fragment is updated to 1. The purpose of this step is to perform fine-grained fragmentation of frequently accessed memory address segments and execute overwrite operations in an optimized order. Fragmentation can break the continuous structure of memory data, and even if some fragments fail to be overwritten, the entire key data will not be completely recovered. The generalized minimum residual method, based on the iterative solution principle of Krylov subspaces, can quickly find the optimal solution in high-dimensional linear systems. By minimizing the fragment address jump residual, the overwrite path is optimized. This optimized path makes the address jump distance between adjacent overwrite operations tend to be evenly distributed, significantly reducing the processor cache miss rate and improving the execution efficiency of overwrite operations. At the same time, the optimized overwrite order breaks the continuity of the address space, increasing the difficulty for attackers to predict the overwrite pattern.

[0053] The specific implementation of step S06 is to initialize the length to be The fragmented erase vector, whose length is equal to the total number of memory fragments, and each element in the vector... Used to record the erase verification status of the m-th memory fragment. Extract fragment information with a completion flag of 1 from the fragmentation coverage matrix, and perform a deep erase verification operation sequentially on each covered fragment. Read the original key data from the key backup buffer as a comparison benchmark; this backup data is created and stored in a protected, independent memory region when the key is first loaded into memory. Perform multiple consecutive deep read operations on the target memory fragment, the number of reads being... The number of reads is determined based on the verification strategy configuration, ranging from 3 to 10. Multiple reads can eliminate interference from accidental read errors and memory noise. Each read's data is XORed bit-by-bit with the original key data. A bit in the XOR result that is 1 indicates that the two data are different at that bit. The Hamming distance is obtained by counting the number of bits with 1 in the XOR result. Calculate the total number of bits in the data. This is equal to the fragment length multiplied by 8; the total number of bits represents the total number of binary bits contained in a memory fragment. The Hamming distance is then normalized according to the Hamming distance normalization equation. Divide by the total number of bits in the data Obtain the normalized Hamming similarity This normalization process converts the dimensional Hamming distance into a dimensionless similarity value between 0 and 1. A weight is assigned to each read operation. The confidence weights are calculated based on the success rate of the read operations; operations with high success rates are assigned larger weights, while operations that fail or encounter anomalies are assigned smaller weights. The normalized Hamming similarity obtained from multiple reads is then calculated using a weighted similarity equation. With the corresponding confidence weights Perform a weighted average calculation and output the final residual data similarity. This weighted average can integrate the results of multiple reads and reduce the impact of single read errors. It also incorporates residual data similarity. Compared to a 5% threshold, when the similarity is below 5%, it indicates that the difference between the read data and the original key data exceeds 95%, and the memory fragment erasure verification is deemed successful. The corresponding fragmented erasure vector element is then processed. Marked as verified. When the similarity is 5% or higher, it indicates that there is still identifiable key data residue in the memory fragment, and the erase verification of that memory fragment fails. The corresponding fragmented erase vector element is then removed. Marked as a verification failure state. For memory fragments that fail verification, they are added back to the fragmentation overlay matrix, the overlay order number is updated, and the overlay data mode type is reassigned. The overlay operation is performed again, and the erasure verification is repeated. This iterative process continues until all fragments pass the erasure verification. The purpose of this step is to verify the overlay effect of memory fragments through deep reading and similarity calculation, ensuring that the key data has been completely erased rather than just superficially covered. Hamming distance, as a standard metric for measuring the difference of binary data, can accurately quantify the degree of data residue. Normalization processing eliminates the influence of different fragment lengths on similarity calculation. Multiple readings and weighted averaging mechanisms improve the reliability of verification results. The 5% similarity threshold is set based on cryptographic security requirements to ensure that the information entropy of the residual data is insufficient to support effective key recovery attacks. The repeated overlay mechanism after verification failure forms a closed-loop feedback control, ensuring the final effectiveness of the anti-recovery operation.

[0054] The specific implementation of step S07 is to create a change tracking sequence data structure, with a sequence length of... The total number of operations occurring throughout the entire recovery process is determined by the sum of cold start coverage counts, hot zone access matrix update counts, cyclic shift migration steps, fragmentation coverage operations, and fragmentation erase verification counts. Tracking code is inserted at each critical operation node in the recovery process. When a cold start coverage, hot zone recording, cyclic shift, fragmentation coverage, or fragmentation erase operation occurs, a tracking record is automatically generated and added to the change tracking sequence. Each tracking record contains four fields: operation type identifier, operation timestamp, operation target address, and operation result status. The operation type identifier uses predefined enumeration values ​​to represent different types of operations. The operation timestamp is obtained from the system clock and records the precise moment the operation occurred. The operation target address is extracted from the memory address parameters involved in the current operation. The operation result status is determined based on whether the operation was successful or failed. All records in the change tracking sequence are sorted according to the timestamp order to generate a timeline view of the recovery operations. This timeline view displays the complete evolution of the entire recovery process along a time axis. A continuity check is performed on the timeline view to verify whether the time interval between adjacent operations meets expectations and to detect any abnormal time jumps or missing operations. The execution count for each operation type is counted, and the results are compared with the expected number of operations to verify the completeness of the recovery prevention process. The correlation information between the change tracking sequence and the cold start coverage vector is extracted to analyze whether the cold start coverage operation follows the predetermined coverage count. The entire process is executed, verifying whether different random number sequences were used in each round of coverage. Based on the results of continuity checks, integrity statistics, and correlation analysis, an integrity verification report for the recovery prevention operation is generated. This report includes a summary of the operation execution, a list of abnormal operations, key indicator statistics, and an overall assessment conclusion. The generated integrity verification report is persistently stored in the security log system for subsequent security audits and compliance checks. The purpose of this step is to establish a full-process traceability mechanism for recovery prevention operations. By recording the execution details of each operation in detail, the recovery prevention process can be monitored and audited. The timeline view provides an intuitive display of the operation sequence, facilitating the identification of abnormal behavior or attack signs in the process. Continuity and integrity verification ensure that the recovery prevention operation is executed completely according to the established plan, preventing security vulnerabilities caused by operation omissions or interruptions. Correlation analysis with the cold start coverage vector verifies the effectiveness of the operation in the initialization phase. The integrity verification report provides an objective basis for the system's security assessment. This mechanism embodies the security design philosophy of defense in depth, establishing a supervision and verification system for the operation itself while executing recovery prevention operations.

[0055] Specifically, the principle of this invention is as follows: The fundamental reason why the anti-recovery scheme of this invention can solve the problem of recoverable residual charge in the key lies in establishing a physical mechanism that covers the residual charge pattern and a logical mechanism that disrupts the spatiotemporal conditions of the attack. From a physical perspective, DRAM memory cells represent data states through capacitor charging and discharging. The charge distribution after a single write exhibits a characteristic pattern related to the original data. Attackers exploit this correlation to reconstruct the data. This invention, by repeatedly covering the same cell with different pseudo-random sequences, causes the capacitor to undergo multiple charging and discharging cycles. The superposition effect causes the final charge state to lose statistical correlation with any historical data. At the same time, fragmentation processing breaks the continuous key into discrete fragments, so even if some fragments are recovered, the complete key structure cannot be reconstructed. From a logical perspective, the cyclic shift mechanism causes the key to exhibit a time-varying distribution in memory. Even if an attacker obtains a memory snapshot at a certain moment, they can only capture the instantaneous state and cannot trace the complete key. However, the overlay order optimization based on the GMRES algorithm minimizes the address jump residual, enabling the overlay operation to be executed efficiently at the cache level, shortening the key exposure window. The hot zone access matrix and change tracking sequence of this invention constitute a closed-loop verification system, ensuring that each protection link is auditable and traceable. The multi-mechanism collaboration forms a defense-in-depth system, requiring attackers to simultaneously break through the physical overlay layer, dynamic migration layer, and fragmentation scattering layer to recover the key. The combined complexity of the three-layer protection far exceeds that of a single protection method. Therefore, this invention theoretically conforms to the defense-in-depth principle of cryptographic security and meets the key protection requirements of high-security systems in engineering.

[0056] The following provides a specific embodiment 1 of the present invention, and the specific implementation of each step in this embodiment 1 is described in detail below.

[0057] The specific implementation of step S01 is as follows: First, high-entropy seed source data is obtained from the system clock module, processor temperature sensor module, and memory noise acquisition module. The obtained multi-source high-entropy data is mixed and processed, and an initial seed is generated through XOR operation and bit reorganization operation. The formula for calculating the initial seed is as follows:

[0058] ;

[0059] In the formula, The initial seed is dimensionless; It is the system clock entropy source, dimensionless, and obtained from the system clock module; The entropy source for the processor temperature sensor is dimensionless and is obtained from the processor temperature sensor module. The entropy source for memory noise is dimensionless and is obtained from the memory noise acquisition module. This is the bitwise XOR operator.

[0060] The initial seed serves as the input parameter for a cryptographically secure pseudorandom number generator. Based on this initial seed, the pseudorandom number generator is launched. This generator employs a cryptographically strong random number generation algorithm, capable of outputting a stream of pseudorandom numbers with good statistical properties and whose seed cannot be deduced from the output sequence. The length of the cold-start overlay vector is determined based on the number of bytes in the key storage area. This length strictly corresponds to the size of the memory region to be protected, ensuring complete and comprehensive coverage. The generated length is... Cold start coverage vector The vector representation is:

[0061] ;

[0062] In the formula, This is the cold start coverage vector; For the first The data covered by each byte position is dimensionless and ranges from 0 to 255. The number of bytes in the key storage area, in units of Obtain from the key management module; This is a byte position index, dimensionless, with a value range of 1 to 1. .

[0063] The number of coverage times is determined based on the key's security level configuration parameters. The formula for calculating the number of coverages is as follows:

[0064] ;

[0065] In the formula, The number of times the coverage is given, and is dimensionless. The number of basic coverages is dimensionless and has a value of 5. This represents the key security level, a dimensionless value, with 1 for standard level, 2 for enhanced level, and 3 for the highest level. This is the highest security level value, dimensionless, and takes the value of 3. The maximum number of coverages is dimensionless and has a value of 12.

[0066] Multiple rounds of overwrite operations are performed on the target memory region. Each round of overwrite uses a newly generated different pseudo-random number sequence. The data of the cold start overwrite vector is written byte by byte to the target memory address through memory write instructions. This process is repeated. Round-over operation. The purpose of this step is to completely destroy any remaining original data charge distribution patterns in the memory cells through multiple random data overwrites, preventing attackers from recovering key data from the memory chip after a power outage using cold start attack techniques.

[0067] The specific implementation of step S02 is to initialize the hot zone access matrix data structure immediately after the key data is loaded into memory. This matrix is ​​a two-dimensional matrix structure. The matrix representation is as follows:

[0068] ;

[0069] In the formula, This is a hotspot access matrix; For the first The first memory address segment Each attribute value; The number of memory address segments, dimensionless, is determined by the number of address segments actually occupied by the key data in memory; This is a row index, dimensionless, with values ​​ranging from 1 to... ; This is a column index, dimensionless, with values ​​ranging from 1 to 5; the first column is the physical address, in units of... The address is obtained from the memory management unit; the second column is the logical address, in units of... The data is obtained from the operating system's virtual memory mapping table; the third column is the access timestamp, in units of... The first column is obtained from the system clock; the second column is the access type, which is dimensionless, with a value of 0 indicating a read operation and a value of 1 indicating a write operation; the third column is the access frequency, which is dimensionless and implemented through an accumulator counter.

[0070] A memory access hook function is registered at the operating system kernel level. This hook function intercepts read and write requests from the memory management unit to achieve real-time monitoring of key data access behavior. When an access operation for key data is detected, the hook function immediately extracts the detailed information of the access and fills the extracted access information into the corresponding position in the hot zone access matrix. If the memory address segment is accessed for the first time, a new record is added to the matrix and the access frequency is initialized to 1. If a record already exists for the address segment, the corresponding row is located and the accumulator counter of the access frequency column is incremented by 1. A bidirectional mapping table between the hot zone access matrix and the physical memory address is established, with the physical address as the index key and the matrix row number as the index value. The purpose of this step is to accurately grasp the actual distribution location and usage frequency characteristics of the key in memory by monitoring and recording the key data access behavior in real time.

[0071] The specific implementation of step S03 is to read the key migration cycle parameter according to the system security policy configuration file. The period parameter takes values ​​between 30 and 180, with units of [missing value]. The average time taken for a single key data migration operation was obtained through performance testing. The unit is The migration cycle The number of migration steps is calculated by dividing by the time of a single migration. The calculation formula is expressed as follows:

[0072] ;

[0073] In the formula, The number of migration steps is dimensionless. The migration period is expressed in units of 1. Read from the system security policy configuration file; The time taken for a single migration operation, in units of The value is obtained through performance testing, with an empirical value of 0.5 to 2.

[0074] Initial length is Circular shift control vector The vector representation is:

[0075] ;

[0076] In the formula, This is the cyclic shift control vector; For the first The target address offset for this migration, in units of The value ranges from 10% to 90% of the current memory page size; This is a migration step index, dimensionless, with values ​​ranging from 1 to... .

[0077] During key usage, a migration cycle is set. Trigger a data migration operation to extract the memory address where the current key data is located from the physical address column of the hotspot access matrix. The unit is Extract the offset corresponding to the current migration step from the cyclic shift control vector. Calculate the target address of the next storage location. The calculation formula is expressed as follows:

[0078] ;

[0079] In the formula, The target address for the next storage location, in units of ; This is the memory address where the current key data is located, in units of... ; For the first The target address offset for this migration, in units of ; This refers to the memory page size, in units of... It is obtained from the operating system's memory management module, and its value is usually 4096.

[0080] A memory data migration operation is performed, copying the key data from its current location to the target location. After copying, random data is overwritten at the original location, updating the physical address record in the hotspot access matrix. The purpose of this step is to make the location of the key data in memory exhibit an unpredictable change pattern through periodic dynamic migration. Even if an attacker obtains the memory address information of the key at a certain moment, this information will become invalid within a short period of time.

[0081] The specific implementation of step S04 involves detecting the key access end signal by monitoring the status interface of the key management module. Upon receiving the key access end signal, the hot zone access matrix is ​​immediately scanned and analyzed, and the access frequency statistics for each memory address segment are extracted from the access frequency column of the matrix. , dimensionless, of which This is a memory address segment index, dimensionless, with a value range of 1 to... Obtain the key data length from the key management module. The unit is Obtain the time consumed by a single cryptographic operation from the performance monitoring module. The unit is Obtain system concurrency from the operating system scheduler Dimensionless. The baseline access frequency threshold is calculated based on the baseline frequency calculation equation. The reference frequency equation is expressed as follows:

[0082] ;

[0083] In the formula, This is the baseline access frequency threshold, measured in times per second. ; The key data length, in units of ; Standard key length, in units of The value is 256; Standard operating time, in units of The value is 0.01; The time taken for a single cryptographic operation, in units of ; The system concurrency is dimensionless. For reference concurrency, it is dimensionless and takes a value of 4; For reference frequency, the unit is times per second, i.e. The value is 100.

[0084] Read memory bus bandwidth utilization from the memory controller's performance counters. Dimensionless, with a value range of 0 to 1, processor load rate is obtained from the operating system performance monitoring interface. Dimensionless, with values ​​ranging from 0 to 1. The preset threshold after dynamic adjustment is calculated based on the dynamic adjustment equation. The dynamic adjustment equation is expressed as follows:

[0085] ;

[0086] In the formula, This is the dynamically adjusted preset threshold, measured in times per second. ; This is the baseline access frequency threshold, measured in times per second. ; Memory bus bandwidth utilization, dimensionless; The processor load rate is dimensionless. This is a bandwidth utilization adjustment factor, dimensionless, with an empirical value of 0.3; This is a processor load rate adjustment factor, dimensionless, with an empirical value of 0.2.

[0087] Iterate through each row of the hotspot access matrix and record the access frequency value. With preset threshold Numerical comparisons are performed. When the access frequency of a memory address segment exceeds a preset threshold, the start and end addresses of that segment are extracted and added to a high-frequency access address segment list. It is then determined whether the high-frequency access address segment list is empty. If an address segment exists in the list, the fragmentation overwrite process is immediately initiated, proceeding to step S05. The purpose of this step is to identify frequently accessed hotspot memory regions in the key data through access frequency analysis.

[0088] The specific implementation of step S05 involves extracting memory address segment information one by one from the high-frequency access address segment list output in step S04, obtaining the start address and length parameters of each address segment. This is done based on memory alignment requirements and fragmentation granularity parameters. The memory address segment is divided, with the fragmentation granularity parameter ranging from 8 to 64, in units of... Each memory address segment is divided according to fragmentation granularity. Perform equal-length segmentation and calculate the total number of fragments. The calculation formula is expressed as follows:

[0089] ;

[0090] In the formula, The total number of fragments is dimensionless. The number of high-frequency access address segments is dimensionless and is obtained from the list of high-frequency access address segments in step S04. This is an address range index, dimensionless, with values ​​ranging from 1 to... ; For the first The length of an address segment, in units of ; Fragment size, unit: .

[0091] Initialize the dimension as Fragmented Covering Matrix with 5 rows and 5 columns The matrix representation is as follows:

[0092] ;

[0093] In the formula, For fragmented coverage matrix; For the first The first fragment One attribute; This is a row index, dimensionless, with values ​​ranging from 1 to... ; This is a column index, dimensionless, with values ​​ranging from 1 to 5; the first column is the fragment starting address, in units of... The second column shows the fragment length, in units of... The third column is the coverage sequence number, which is dimensionless; the fourth column is the coverage data pattern type, which is dimensionless, with a value of 0 indicating all-zero mode, 1 indicating all-one mode, 2 indicating alternating mode, and 3 indicating pseudo-random mode; the fifth column is the coverage completion flag, which is dimensionless, with a value of 0 indicating no coverage and 1 indicating coverage.

[0094] Construct the coefficient matrix for calculation using the generalized minimum residual method. The elements of this matrix are obtained by normalizing the address distances between fragments, and the coefficient matrix elements are... The calculation formula is expressed as follows:

[0095] ;

[0096] In the formula, For the coefficient matrix, the first Line 1 The elements of the column are dimensionless; This is a row index, dimensionless, with values ​​ranging from 1 to... ; This is a column index, dimensionless, with values ​​ranging from 1 to... ; For the first The fragment and the first The address distance of each fragment, in units of It is calculated as the absolute value of the difference between the starting addresses of the two fragments; The maximum address distance between all fragment pairs, in units of .

[0097] Construct the desired uniformly distributed target vector The vector representation is:

[0098] ;

[0099] In the formula, The target vector; For the first There are n elements, dimensionless, with values ​​of 1. ; This is an element index, dimensionless, with values ​​ranging from 1 to... .

[0100] The generalized minimum residual method is used to iteratively solve the linear system in the Krylov subspace. The algorithm constructs a Krylov subspace and searches within the subspace for residual vectors. The approximate solution with the smallest L2 norm is defined by the residual vector as follows:

[0101] ;

[0102] In the formula, The residual vector; The target vector; It is a coefficient matrix; This is a covering order vector.

[0103] L2 norm of residuals The calculation formula is expressed as follows:

[0104] ;

[0105] In the formula, Let L be the L2 norm of the residual, which is dimensionless; The residual vector is the first One component, dimensionless; This is a component index, dimensionless, with values ​​ranging from 1 to... ; The total number of fragments is dimensionless.

[0106] The iteration terminates when the L2 norm of the residual falls below the preset convergence threshold or the maximum number of iterations is reached, and the covering order vector is output. Each component of the vector Corresponding to the The coverage priority weight of each memory fragment, dimensionless, where This is a fragment index, dimensionless, with values ​​ranging from 1 to... The coverage priority weights are sorted in descending order, and the sorted index positions are the coverage order numbers of each fragment. Coverage operations are then performed on the memory fragments sequentially according to their coverage order numbers. The purpose of this step is to perform refined fragmentation of frequently accessed memory address segments and execute coverage operations in an optimized order. The generalized minimum residual method, based on the iterative solution principle of Krylov subspaces, can quickly find the optimal solution in high-dimensional linear systems.

[0107] The specific implementation of step S06 is to initialize the length to be Fragmented erase vector The vector representation is:

[0108] ;

[0109] In the formula, For fragmented erasure vectors; For the first The erase verification status of a memory fragment is dimensionless, with a value of 0 indicating unverified, 1 indicating successful verification, and 2 indicating failed verification. This is a fragment index, dimensionless, with values ​​ranging from 1 to... ; The total number of fragments is dimensionless.

[0110] Extract fragment information with a coverage completion flag of 1 from the fragmented coverage matrix, and perform a deep erase verification operation on each completed fragment in sequence. Read the original key data from the key backup buffer. As a benchmark, multiple consecutive deep read operations were performed on the target memory fragment, and the number of reads was... The number of reads, determined by the verification strategy configuration, is between 3 and 10, and is dimensionless. The data obtained from each read... Perform a bitwise XOR operation with the original key data, where This is an index for the number of reads, dimensionless, with values ​​ranging from 1 to... Calculate Hamming distance The calculation formula is expressed as follows:

[0111] ;

[0112] In the formula, For the first The Hamming distance for each read is dimensionless. The first of the original key data Each binary bit is dimensionless and takes the value 0 or 1. For the first The first time data was read Each binary bit is dimensionless and takes the value 0 or 1. It is a binary bit index, dimensionless, with a value range of 1 to 1. ; The total number of data bits is dimensionless and is calculated as fragment length multiplied by 8. This is the bitwise XOR operator.

[0113] Calculate the total number of bits in the data Equals the fragment length multiplied by 8. The normalized Hamming similarity is calculated using the Hamming distance normalization equation. The Hamming distance normalization equation is expressed as follows:

[0114] ;

[0115] In the formula, For the first Normalized Hamming similarity for each read, dimensionless; For the first The Hamming distance for each read is dimensionless. The total number of bits in the data is dimensionless.

[0116] Configure a weight for each read operation. The confidence weight calculation formula is expressed as follows:

[0117] ;

[0118] In the formula, For the first The confidence weight for each read is dimensionless and ranges from 0 to 1. For the first The number of bytes successfully read in this read operation, in units of The result is obtained from the memory read result verification module; For the first Total number of bytes in each read operation, in units of , which is equal to the length of the fragment.

[0119] The final residual data similarity is calculated based on the weighted similarity equation. The weighted similarity equation is expressed as follows:

[0120] ;

[0121] In the formula, The similarity is for residual data and is dimensionless. For the first The confidence weight for each read is dimensionless and ranges from 0 to 1. For the first Normalized Hamming similarity for each read, dimensionless; The number of reads is dimensionless. For summation index, dimensionless, values ​​range from 1 to... .

[0122] Residual data similarity When compared with a 5% threshold, if the similarity is below 5%, the memory fragment is deemed to have passed the erasure verification, and the corresponding fragmented erasure vector element is... Marked as 1. When the similarity is higher than or equal to 5%, the erase verification of the memory fragment is deemed to have failed, and the corresponding fragmented erase vector element is removed. Marked as 2. For memory fragments that fail verification, they are added back to the fragmentation overlay matrix, and the overlay operation is performed again. The erasure verification is repeated, and this iterative process continues until all fragments pass the erasure verification. The purpose of this step is to verify the overlay effect of memory fragments through deep reading and similarity calculation, ensuring that the key data has been completely erased and not just superficially covered.

[0123] The specific implementation of step S07 is to create a change tracking sequence data structure, with a sequence length of... The change tracking sequence length is determined by the total number of operations that occur during the entire recovery process. The formula for calculating the change tracking sequence length is as follows:

[0124] ;

[0125] In the formula, To change the length of the tracking sequence, dimensionless; The number of cold start coverage times is dimensionless. The number of times the hot zone access matrix is ​​updated is dimensionless and equal to the total number of key access operations, obtained from the hot zone access matrix record. The number of cyclic shift steps is dimensionless. The number of fragmentation overwrite operations is dimensionless and at least equal to the total number of fragments. If duplicate coverage exists, the count is incremented. The number of fragmentation erasure verifications is dimensionless and at least equal to the total number of fragments. If duplicate verifications are found, the count is incremented.

[0126] Tracking code is inserted at each critical operation node in the anti-recovery process. When a cold start overwrite, hot zone recording, circular shift, fragment overwrite, or fragment erase operation occurs, a tracking record is automatically generated and added to the change tracking sequence. Each tracking record contains four fields: operation type identifier, operation timestamp, operation target address, and operation result status. The operation type identifier uses predefined enumerated values ​​to represent different types of operations. The operation timestamp is obtained from the system clock and records the precise time when the operation occurred, in units of 120 ... The target address of the operation is extracted from the memory address parameters involved in the current operation, in units of... The operation result status is determined by the success or failure of the operation execution, and is dimensionless, with a value of 0 indicating failure and 1 indicating success. All records in the change tracking sequence are sorted according to their timestamps to generate a timeline view of the recovery prevention operation. This timeline view displays the complete evolution of the recovery prevention process along a time axis. A continuity check is performed on the timeline view to verify whether the time interval between adjacent operations meets expectations and to detect any abnormal time jumps or missing operations. The execution count for each operation type is counted, and the results are compared with the expected number of operations to verify the completeness of the recovery prevention process. The correlation information between the change tracking sequence and the cold start coverage vector is extracted to analyze whether the cold start coverage operation follows the predetermined coverage count. The entire process is executed, verifying that different random number sequences were used in each round of coverage. Based on the results of continuity checks, integrity statistics, and correlation analysis, an integrity verification report for the recovery prevention operation is generated. The report includes a summary of the operation execution, a list of abnormal operations, key indicator statistics, and an overall assessment conclusion. The generated integrity verification report is persistently stored in the security log system for subsequent security audits and compliance checks. The purpose of this step is to establish a full traceability mechanism for the recovery prevention operation. By recording the execution details of each operation in detail, the recovery prevention process can be monitored and audited. The timeline view provides an intuitive display of the operation sequence, making it easy to identify abnormal behavior or attack signs in the process. Continuity and integrity verification ensures that the recovery prevention operation is executed completely according to the established plan, preventing security vulnerabilities caused by operation omissions or interruptions.

[0127] The formula's principle and effect are explained below: Initial Seed Generation Formula By employing a multi-source entropy data XOR mixing mechanism, and performing bit-by-bit XOR operations on three independent entropy sources—system clock, processor temperature sensor, and memory noise—a thorough mixing of entropy sources is achieved. The XOR operation ensures that the randomness of any entropy source is propagated to the final initial seed. The operation maps the mixed results to a 64-bit integer space, providing a high-quality seed for subsequent pseudo-random number generation. This mechanism effectively prevents the decrease in randomness caused by the failure of a single entropy source.

[0128] The cold start coverage vector achieves complete elimination of residual charge in memory through multiple rounds of coverage using a pseudo-random number sequence. The formula for calculating the number of coverages is as follows: The coverage intensity is dynamically adjusted according to the security level, in the formula. The project implements linear interpolation from the basic coverage count to the maximum coverage count, ensuring protection effectiveness under different security requirements.

[0129] The hotspot access matrix achieves comprehensive monitoring of key access behavior through multi-dimensional attribute records. The five columns of the matrix record the physical address, logical address, access timestamp, access type, and access frequency, respectively, providing accurate target positioning basis for subsequent fragmented coverage.

[0130] Formula for calculating the target address of the cyclic shift control vector Modular operations are used to ensure that the address is within the valid range. The modular operations in the formula ensure that the calculation result does not exceed the memory page boundary. Periodic pseudo-random offsets make the key position exhibit unpredictable dynamic changes, which significantly improves the ability to prevent cold start attacks.

[0131] Reference frequency equation and dynamic adjustment equation By comprehensively considering key length, operation time, system concurrency, and operating environment parameters, intelligent dynamic adjustment of the access frequency threshold is achieved. The three normalization factors in the baseline frequency equation standardize key length, operation time, and system concurrency, respectively. The dynamic adjustment equation adjusts the baseline threshold in real time based on memory bus bandwidth utilization and processor load rate. Two adjustment coefficients... and It controls the impact of system load on the threshold, accurately identifies high-risk hot memory regions, and avoids the adaptability problem of fixed thresholds under different load scenarios.

[0132] The fragmentation covering matrix is ​​constructed by combining the coefficient matrix and the target vector of the generalized minimum residual method. The fragmentation covering order is optimized by minimizing the residual L2 norm. The formula for the coefficient matrix elements is... Spatial relationships between fragments were constructed using normalized address distances, and the target vector was used. The uniform distribution characteristic guides the optimization algorithm to generate a uniform coverage path, and the residual vector L2 norm The deviation between the current overlay order and the ideal uniform distribution is quantified. This optimized order makes the address jump distance of adjacent overlay operations tend to be evenly distributed, reduces the processor cache miss rate, improves the execution efficiency of overlay operations, and at the same time breaks the continuity of the address space, enhancing the anti-recovery effect.

[0133] Hamming distance formula The Hamming distance normalization equation is derived by counting the number of distinct bits in two data sequences using bitwise XOR operations. Converting dimensional positional differences into dimensionless similarity values ​​eliminates the influence of different fragment lengths on similarity calculations. The confidence weight formula... The reliability of each read result is quantified based on the success rate of the read operation, using a weighted similarity equation. The reliability of verification is improved by weighted averaging of multiple reading results. The weights in the numerator and denominator ensure that the reading results with higher credibility contribute more to the final similarity. The 5% similarity threshold is set based on cryptographic security requirements to ensure that the information entropy of the residual data is insufficient to support effective key recovery attacks. The repeated overwriting mechanism after verification failure forms a closed-loop feedback control, ensuring the final effectiveness of the anti-recovery operation.

[0134] Formula for changing the tracking sequence length By accumulating the number of operations at each stage, a precise count of the total number of operations in the entire anti-recovery process is achieved. This statistical result provides a quantitative basis for integrity verification, ensuring that no operations are missed or skipped. The entire method achieves comprehensive anti-recovery protection for memory keys through multi-level mathematical models and algorithm optimization.

[0135] To better understand and implement this invention, a specific application scenario is provided below as Example 2: A technical team developing an encrypted communication system needs to ensure that the session keys stored in memory cannot be recovered through cold start attacks or memory forensics techniques after use. The system processes 256-byte session keys using the AES-256 encryption algorithm, requiring approximately 200 key operations per second under high concurrency. To prevent key leakage, the technical team decided to implement the memory key anti-recovery method described in this invention.

[0136] Before the key is initially loaded into memory, the system initiates a cold start overwrite process. Based on the key's security level requirements, this session key is defined as enhanced level, therefore the number of cold start overwrites is [number missing]. Set to 9 times. System-generated length. A cold-start overwrite vector of 256 bytes is generated, with each element produced by a cryptographically secure pseudo-random number generator. The high-entropy seed sources include a nanosecond-level timestamp from the system clock, a CPU temperature sensor reading of 142°C, and memory noise samples. Nine rounds of overwrite are performed over the 256-byte target memory region, each round using a different pseudo-random sequence to eliminate any residual charge patterns that may exist in the DRAM cells. After the cold-start overwrite is complete, key data is loaded into a contiguous memory region starting at physical address 0x7F8A2000.

[0137] After the key is loaded, the system establishes a hotspot access matrix for real-time monitoring. This matrix has the following dimensions: × =15×5, recording access information for 15 memory address segments. Table 1 shows the access statistics for some memory address segments. Through memory access hook functions, the system intercepts all read and write operations targeting the key region, and the access frequency counter for the corresponding address segment increments by 1 each time an access occurs. The physical addresses in Table 1 are obtained directly from the memory management unit, the logical addresses are extracted from the virtual memory mapping table, the access timestamps are accurate to the microsecond level, and the access types are distinguished as read and write operations.

[0138] Table 1. Partial Data Records of Hotspot Access Matrix

[0139]

[0140] To further reduce the risk of key tampering, the system initiates a cyclic shift mechanism during key usage. According to the system security policy, the migration cycle... With a time limit of 90 seconds, the average time for a single migration operation is 18 ms, therefore the number of migration steps... =5000. The system generates a cyclic shift control vector of length 5000, with each element... This represents the target address offset for a single migration. The current memory page size is 4096 bytes, and the pseudo-random offset value ranges from 410 bytes to 3686 bytes. For example... Figure 2 As shown, the address change trajectory of the key data is displayed during 12 consecutive migrations. It can be seen that the key position exhibits irregular jump characteristics, which effectively blocks attack attempts based on address prediction.

[0141] After 4800 seconds of continuous operation, the system detected a key access termination signal. At this point, access frequency data was extracted from the hotspot access matrix for analysis. The system then calculated a preset threshold using a set of access frequency equations. First, based on the key data length of 256 bytes, the time taken for a single cryptographic operation of 12 ms, and the system concurrency of 16, the baseline access frequency threshold is calculated. The result was 48 times. Then, based on the memory bus bandwidth utilization of 76% and the processor load rate of 68%, dynamic adjustments were made to finally obtain... =50 times. Comparing the access frequency of each address segment in Table 1 with this threshold, it was found that the access frequencies of address segments 1 and 3 were 68 times and 73 times respectively, both exceeding the threshold. The system immediately started the fragmentation overlay process.

[0142] The system fragments memory address segments whose access frequency exceeds a threshold. The fragmentation granularity is determined based on memory alignment requirements. The size is set to 16 bytes. The total length of address segment 1 and address segment 3 is 128 bytes, divided into 8 memory fragments. The system is built with the following dimensions: × An 8×5 fragmentation coverage matrix is ​​used to record the coverage parameters of each fragment. The coverage order is calculated in the Krylov subspace using the GMRES algorithm. The algorithm converges after 14 iterations, yielding the residual that allows for address jumps between fragments. The cover sequence numbering with the smallest norm is [3, 7, 1, 5, 8, 2, 6, 4]. For example... Figure 3 As shown, the address jump distance distribution when eight memory fragments are covered in the optimal order is illustrated. Compared to random order, the optimized coverage path significantly reduces the cache miss rate. The system performs the coverage operation on each fragment sequentially, using a pseudo-random mode, an all-zero mode, an all-one mode, and an alternating mode in a cyclical manner for the coverage data.

[0143] After fragmentation is completed, the system establishes a length. Deep verification is performed using a fragmented erase vector of 8. Five consecutive read operations are performed on each memory fragment, and the Hamming distance between the read data and the original key data is calculated. Taking the first fragment as an example, the Hamming distances for the five reads are 121, 118, 123, 119, and 122, respectively, with a total data bit length of [missing information]. =128. The normalized Hamming similarity for each iteration was calculated using the Hamming distance normalization equation. The values ​​are 0.9453, 0.9219, 0.9609, 0.9297, and 0.9531, respectively. Then, confidence weights are assigned based on the success rate of each read; the confidence weights for the five reads are... The values ​​were 0.22, 0.19, 0.21, 0.18, and 0.20, respectively. The final residual data similarity was calculated using a weighted similarity equation. The similarity was 0.9418, or 94.18%, far exceeding the 5% threshold, indicating significant key remnants in the fragment. The system marked this fragment as a verification failure and re-executed the overwrite operation. After two overwrites and verifications, the residual data similarity decreased to 3.2%, and the verification passed. The residual data similarities for the remaining 7 fragments in the first verification were 4.1%, 2.8%, 3.9%, 2.3%, 4.7%, 3.5%, and 2.6%, respectively, all below the 5% threshold, and all passed verification.

[0144] After all fragments have been verified, the system generates a change tracking sequence to record the entire recovery process. The sequence length is... =5127, including 9 cold start overwrite operations, 832 hot zone access matrix updates, 5000 cyclic shift operations, 278 fragment overwrite operations, and 8 fragment erase verifications. Each operation record includes detailed operation type identifier, operation timestamp, operation target address, and operation result status. By sorting the change tracking sequence by timestamp, the system constructs a complete timeline view and performs correlation analysis with the cold start overwrite vector to generate an anti-recovery operation integrity verification report, confirming that all anti-recovery steps have been correctly executed without omission. The above description is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the protection scope of the present invention.

Claims

1. A method for preventing the recovery of a memory key, characterized in that, Includes the following steps: Before the key is used, a cold start overlay vector is generated and the key storage area is overwritten with multiple random data overlays; after the key is loaded into memory, the hot zone access matrix is ​​recorded and a mapping relationship between the hot zone access matrix and the physical memory address is established. During key usage, a cyclic shift control vector is established, and the next storage location is calculated based on the cyclic shift control vector to complete data migration. After detecting the key access end signal, memory address segments with access frequency exceeding a preset threshold in the hot zone access matrix are extracted. The memory address segments are fragmented and a fragmentation overlay matrix is ​​generated. The overlay order is calculated using a residual minimization mechanism based on the GMRES algorithm. An approximate solution that minimizes the L2 norm of the fragment address jump residual is found in the Krylov subspace. After performing the fragmentation overlay operation, a fragmentation erase vector is established and deep erase verification is performed. After all memory fragments have been fragmented and erased, a change tracking sequence is generated and a recovery-proof operation integrity verification report is constructed.

2. The method according to claim 1, characterized in that, The cold start overlay vector is a one-dimensional vector, and its length is equal to the number of bytes in the key storage area. Each element value of the cold start overlay vector is generated by a cryptographically secure pseudo-random number generator.

3. The method according to claim 2, characterized in that, The encrypted secure pseudo-random number generator uses an algorithm based on a high-entropy seed. The high-entropy seed is derived from a combination of system clock, processor temperature sensor, and memory noise, and covers a closed interval of 5 to 12 times.

4. The method according to claim 3, characterized in that, The number of coverages is determined by the key security level, which is divided into standard, enhanced and highest levels. The standard level corresponds to a closed interval of 5 to 7 coverages, the enhanced level corresponds to a closed interval of 8 to 10 coverages, and the highest level corresponds to a closed interval of 11 to 12 coverages.

5. The method according to claim 4, characterized in that, The hot zone access matrix is ​​a two-dimensional matrix. The number of rows in the hot zone access matrix represents the number of memory address segments, and the number of columns in the hot zone access matrix represents the attribute dimension of the record, with the number of columns equal to 5.

6. The method according to claim 5, characterized in that, The attribute dimensions include physical address, logical address, access timestamp, access type, and access frequency. The hot zone access matrix is ​​updated in real time through a memory access hook function, and the access frequency column is implemented through an accumulator counter.

7. The method according to claim 6, characterized in that, The cyclic shift control vector is a one-dimensional vector. The length of the cyclic shift control vector is equal to the number of migration steps within the key data migration cycle. Each element of the cyclic shift control vector represents the target address offset for the corresponding migration.

8. The method according to claim 7, characterized in that, The target address offset is calculated by applying a pseudo-random offset value to the current address. The pseudo-random offset value ranges from 10% to 90% of the current memory page size, and the migration period is within a closed interval of 30s to 180s.

9. The method according to claim 8, characterized in that, The fragmentation overlay matrix is ​​a two-dimensional matrix. The number of rows in the fragmentation overlay matrix represents the total number of memory fragments, and the number of columns in the fragmentation overlay matrix represents the attribute dimension of the overlay operation, with the number of columns equal to 5.

10. The method according to claim 9, characterized in that, The attribute dimensions include fragment start address, fragment length, coverage sequence number, coverage data mode type and coverage completion flag. The fragment granularity is within a closed range of 8B to 64B. The coverage data mode types include all-zero mode, all-one mode, alternating mode and pseudo-random mode.