Fast key file supplementing method

Through the terminal and the offline key distributor, the problem of inapplicable key supplementation in offline scenarios such as drones is solved, the interaction process is simplified, resource efficiency and business processing capabilities are improved, and the Communication load.

CN119210709APending Publication Date: 2024-12-27MATRICTIME DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411288419.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing key supplement method is not suitable for offline scenarios such as drones, and the communication path is overloaded during communication with limited bandwidth.

Method used

The terminal and offline key distributor agree on the key data structure format. The offline key distributor supplements and drops the disk based on the key data structure. The terminal reads the file to memory, generates the target data structure for key file consumption, and simplifies interaction process to reduce resource usage.

Benefits of technology

It achieves rapid key supplementation and improved resource efficiency, reduces communication path load, and improves business processing capabilities and resource scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119210709A_ABST
    Figure CN119210709A_ABST
Patent Text Reader

Abstract

The invention discloses a key file rapid supplement method. The method comprises the following steps: firstly, a terminal and an offline key distributor appoint a key data structure format; the offline key distributor supplements the key data structure based on the key data structure, and then places the supplemented key data structure to a physical disk in a file writing mode; the terminal obtains a supplemented key data structure in a mode of reading a file to a memory from a fixed directory; and finally, the terminal generates a target data structure based on the supplemented key data structure, and the terminal consumes the key file through the target data structure. According to the method, the interaction process of key supplement is simplified, more work is not carried out in an actual service communication channel, so that the capability of processing other data can be reserved for service and hardware resources, and the service processing capability and resource scheduling are improved in a disguised manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of key, and in particular to a method for quickly supplementing a key file. Background Art

[0002] The existing key supplement method involves participants including terminals (such as quantum privacy computers), servers, and key centers. It requires four requests and four response messages to confirm the availability of a key file and its orderliness when in use. It is applicable to two scenarios: 1. Real-time key supplementation, that is, to support online key supplementation, all quantum privacy computer terminals need to establish a connection with the key center; 2. The availability of key use needs to be jointly determined by the quantum privacy computer terminal and the server, and the server has a dominant position, that is, to confirm the orderliness and availability of the key file.

[0003] However, it is not applicable to the current key replenishment process in typical scenarios such as drone scenarios. The key replenishment in such scenarios is offline key replenishment, that is, the terminal does not need to establish contact with the key center; secondly, taking drones as an example, there is no server in the communication system. For airborne and ground, it is actually equivalent to two terminals communicating. During the communication process, the bandwidth and communication lines are limited. If the original key replenishment method is used, the key replenishment process will occupy part of the bandwidth of the communication path, which will cause a great burden on the load of the communication path. Summary of the invention

[0004] Purpose of the invention: The purpose of the present invention is to provide a method for quickly supplementing key files, which solves the problem that the existing key supplement method is not suitable for the current offline key supplement situation with drone scenarios as typical scenarios; it also solves the problem that the original key supplement method will cause a great burden on the load of the communication path due to limited bandwidth and communication lines during the communication process.

[0005] Technical solution: The present invention provides a method for quickly supplementing a key file, comprising the following steps:

[0006] (1) The terminal and the offline key distributor agree on the key data structure format;

[0007] (2) The offline key distributor supplements the key data structure based on the key data structure, and then writes the supplemented key data structure to the physical disk by writing a file; the terminal then obtains the supplemented key data structure by reading the file from the fixed directory to the memory;

[0008] (3) The terminal generates a target data structure based on the supplemented key data structure, and the terminal consumes the key file through the target data structure.

[0009] Furthermore, the key data structure includes a supplementary key capacity, a current key file usage serial number, a valid expiration key file serial number and a key file linked list; the supplementary key capacity refers to the total value of the current supplementary key, the current key file usage serial number refers to the slot serial number corresponding to the key file used by the current program, and the valid expiration key file serial number refers to the last slot serial number of the key file added to the key file linked list;

[0010] The key file linked list is a circular linked list, which includes N slots numbered 0 to N-1, and each slot includes a group of key files.

[0011] Furthermore, each slot also includes slot information, which includes the key file size, key file hash value and key file status corresponding to the slot, and the key file status refers to the key file corresponding to the slot being in one of the four states of uninitialized, initialized, in use and used.

[0012] Furthermore, the offline key distributor supplements based on the key data structure, which means that: according to the needs of the terminal, the supplemented key file is supplemented to the slots of the key file linked list in sequence starting from the slot corresponding to the current key file usage serial number, and the slot information corresponding to the slot is updated at the same time; then, the total amount of keys of the supplemented key file is filled in the supplementary key capacity, and the last slot serial number of the key file linked list supplemented with the supplemented key file is filled in the valid end key file serial number.

[0013] Furthermore, the key file hash value refers to a unique value that identifies the key file, which is a file checksum calculated using a hash function.

[0014] Furthermore, the target data structure includes the same supplementary key capacity, current key file usage serial number, valid expiration key file serial number and key file linked list as the key data structure; the target data structure also includes the key usage amount, which refers to the accumulated value of continuous use of the key starting from the first use.

[0015] Furthermore, the slot information of each slot in the key file linked list of the target data structure includes the key file size and key file status corresponding to the same slot in the key data structure, and also includes the current file offset and the key usage difference. The current file offset refers to the usage address of the key file in the current slot, and the key usage difference refers to periodically performing persistence operations on the target data structure according to the value in the key usage difference.

[0016] Beneficial effects of the present invention: The present invention firstly agrees on the key data structure format through the terminal and the offline key distributor; then the offline key distributor supplements based on the key data structure and writes the supplemented key data structure to the physical disk; the terminal then reads the file into the memory to obtain the supplemented key data structure, and finally generates the target data structure based on the supplemented key data structure, and consumes the key file through the target data structure. The present invention simplifies the interactive process of key supplementation, so that more work is not performed in the actual business communication channel, so that the business and hardware resources can be left with the ability to process other data, which in disguise improves the processing capacity and resource scheduling of the business; and the data structured key file consumes the lowest resources, and then the target data structure is regularly persisted according to the value in the key usage difference, which greatly reduces the resource occupation. The target data structure in the terminal has the same structure as the supplemented key data structure, so that the supplemented key data structure can be directly placed in the target data structure without the need for a cumbersome data structure conversion process, thereby improving the rate of supplementing the key. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 is a schematic diagram of the structure of the key data structure;

[0018] Figure 2 is a schematic diagram of the structure of the target data structure;

[0019] Figure 3 This is a schematic diagram of the structure of the key file linked list. DETAILED DESCRIPTION

[0020] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:

[0021] The existing key supplement method requires four requests and four response messages to confirm the availability of a key file and the orderliness of its use. However, it is not suitable for some current scenarios represented by drones. In addition, the bandwidth and communication lines are limited during the communication process. If the original key supplement method is used, it will cause a great burden on the communication channel.

[0022] In view of this, the present application proposes a method for quickly supplementing a key file.

[0023] like Figure 1 As shown, the participants of the present invention include a terminal and an offline key distributor. The key library generated by the offline key distributor ensures the authenticity and orderliness of the key. The terminal obtains the key of the generated key library, and no longer uses the four-request and four-response mode. The two transmit data structured information to each other to achieve the supplement of the key file. The terminal here can be a type of terminal represented by a drone that performs offline key supplementation.

[0024] Specifically, the present invention proposes a method for quickly supplementing a key file, comprising the following steps:

[0025] (1) The terminal and the offline key distributor agree on the key data structure format, such as Figure 1 As shown, the key data structure is a format agreed upon by the terminal and the offline key distributor; the key data structure includes the supplementary key capacity, the current key file usage serial number, the effective expiration key file serial number and the key file linked list; the supplementary key capacity refers to the total value of the current supplementary key, the current key file usage serial number refers to the slot serial number corresponding to the key file used by the current program, and the effective expiration key file serial number refers to the last slot serial number of the key file supplemented to the key file linked list, that is, the slot serial number to which the key file is supplemented is the effective expiration key file serial number;

[0026] The key file linked list is a circular linked list, which includes N slots with serial numbers from 0 to N-1, and each slot includes a set of key files; for example, N is 256, then the key file linked list includes slots with serial numbers from 0 to 255, and the slots are effectively incremented when used. When slot number 255 is used, it will be flipped to slot number 0 and used again. Therefore, the key file linked list supports a total of 256 key files, and the size value of each file is given by the offline key distributor, that is, the supplementary key capacity, which can be 256*X, where X is adjusted by the offline key distributor and controls the total number of keys.

[0027] In the key file linked list, there are 256 slots with serial numbers from 0 to 255. Each slot includes slot information, which includes the size of the key file corresponding to the slot, the key file hash value and the key file status. The key file hash value refers to a unique value that identifies the key file, which is a file checksum calculated using a hash function; the key file status refers to the current status of the key file corresponding to the slot, which is one of the four states: uninitialized, initialized, in use and used.

[0028] Why is there slot information? Because after the key file is used, it can be deleted and then a new one can be suspended. For example, when the key files with slot numbers 0 to 200 are replenished, after they are used up, the offline key distributor replenishes 200 more slots, from 201 to 255, and from 0 to 144; then the previous file information of 0 to 144 will be cleared, and the new key file information will be filled in when replenishing.

[0029] (2) The offline key distributor supplements the key data structure based on the key data structure, and then writes the supplemented key data structure to the physical disk by writing a file; the offline key distributor supplements the key data structure based on the key data structure, which means: according to the needs of the terminal, the supplemented key file is supplemented to the slots of the key file list in sequence starting from the slot corresponding to the current key file usage serial number, and the slot information corresponding to the slot is updated at the same time; then, the total amount of keys of the supplemented key file is filled in the supplementary key capacity, and the last slot serial number of the key file list supplemented by the supplemented key file is filled in the valid end key file serial number.

[0030] When the terminal program is started, the supplemented key data structure is directly obtained by reading files from a fixed directory to the memory; for example, when the offline key distributor supplements the key files with slot numbers 0 to 200, the effective end key file number is 200. If each key file is 128M, the supplemented key capacity is 200*128M. The current key file uses the serial number starting from 0. As the terminal program is processed, the current key file uses the serial number from 0 to 200 in order.

[0031] (3) The terminal generates a target data structure based on the supplemented key data structure, and the terminal consumes the key file through the target data structure.

[0032] like Figure 2 As shown, the target data structure includes the same supplementary key capacity, current key file usage sequence number, effective end key file sequence number and key file linked list as the key data structure. Since the target data structure and the key data structure have the same parts as above, in the process of generating the target data structure, the key file with the key data structure can be directly placed in the target data structure without the cumbersome data structure conversion process, so as to realize the rapid supplement of the key file.

[0033] The target data structure also includes the key usage, which refers to the cumulative value of the continuous use of the key from the first use, that is, it records the cumulative value of the key usage of the program during the entire life cycle.

[0034] like Figure 3 As shown in the figure, the current key file usage sequence number and the effective expiration key file sequence number can be regarded as two cursors, and the key file linked list can be regarded as a ruler. Once the current key file usage sequence number coincides with the effective expiration key file sequence number, the key file is used up, and the key file with the coincident sequence number value will be reused, which is the key backing file.

[0035] The slot information of each slot in the key file linked list of the target data structure includes the key file size and key file status corresponding to the same slot in the key data structure, and also includes the current file offset and the key usage difference. The current file offset refers to the usage address of the key file in the current slot. The usage address means that if the size of a key file is 128MB, which is converted into 128*1024*1024 bytes, then it is considered that this key file has 128*1024*1024 scales. For every byte of key consumed, the scale in the key file moves forward by one, and a certain scale value in the key file is used, which is the so-called usage address of the current key file.

[0036] The key usage difference is a frequency control value. It is used to effectively save the data of each file used by the current program without frequently using the disk files, which would occupy IO resources. It refers to the periodic persistence operation of the target data structure according to the value in the key usage difference. During the communication process, the size of a frame varies, so the length of the consumed key is random. Considering power outages or program restarts, a persistent record is required to determine which key file is consumed and where the key file is consumed. The above key usage difference is used to record the consumption of the key file in each slot.

[0037] However, there may be hundreds or thousands of frames of data in one second. If each frame of data is processed and recorded and persisted to a file on disk, the file will be frequently called for reading and writing, temporarily using IO resources. Therefore, it is necessary to control the frequency, that is, to set the key usage difference. For example, the default key usage difference in the program is 4MB, which means that when the key file scales, the program will perform a data structure persistence operation every time 4MB (4*1024*1024B) is used, which greatly reduces the resource usage. When the power is off or the program is restarted, as long as the program reads the locally controlled data structure file, it can know the key usage of the previous program and can use the key file continuously. In general, although the key usage difference will reduce the frequency of persistence and some keys will be reused when restarted, this parameter is adjustable and can be reduced to an acceptable range.

[0038] The present invention firstly agrees on the key data structure format through the terminal and the offline key distributor; then the offline key distributor supplements based on the key data structure and writes the supplemented key data structure to the physical disk; the terminal then reads the file into the memory to obtain the supplemented key data structure, and finally generates a target data structure based on the supplemented key data structure, and consumes the key file through the target data structure. The whole process simplifies the interactive process of key supplementation, so that more work is not performed in the actual business communication channel, so that the business and hardware resources can be left with the ability to process other data, which in disguise improves the business processing capacity and resource scheduling; and the data structured key file consumes the lowest resources, and then the target data structure is regularly persisted according to the value in the key usage difference, which greatly reduces the resource occupation.

Claims

1. A method for quickly supplementing a key file, characterized in that: The following steps are involved: (1) The terminal and the offline key distributor agree on the key data structure format; (2) The offline key distributor supplements the key data structure based on the key data structure, and then writes the supplemented key data structure to the physical disk by writing a file; the terminal then obtains the supplemented key data structure by reading the file from the fixed directory to the memory; (3) The terminal generates a target data structure based on the supplemented key data structure, and the terminal consumes the key file through the target data structure.

2. A method for quickly supplementing a key file according to claim 1, characterized in that: The key data structure includes a supplementary key capacity, a current key file usage serial number, a valid expiration key file serial number and a key file linked list; the supplementary key capacity refers to the total value of the current supplementary key, the current key file usage serial number refers to the slot serial number corresponding to the key file used by the current program, and the valid expiration key file serial number refers to the last slot serial number of the key file added to the key file linked list; The key file linked list is a circular linked list, which includes N slots numbered 0 to N-1, and each slot includes a group of key files.

3. A method for quickly supplementing a key file according to claim 2, characterized in that: Each slot also includes slot information, which includes the size of the key file corresponding to the slot, the hash value of the key file and the key file status. The key file status refers to whether the key file corresponding to the slot is in one of the four states: uninitialized, initialized, in use and used.

4. A method for quickly supplementing a key file according to claim 3, characterized in that: The offline key distributor supplements based on the key data structure by: supplementing the supplemented key file to the slots of the key file linked list in sequence starting from the slot corresponding to the current key file usage serial number according to the needs of the terminal, and updating the slot information corresponding to the slot; then, filling the total amount of keys of the supplemented key file into the supplementary key capacity, and filling the last slot serial number of the key file linked list with the supplemented key file into the valid end key file serial number.

5. A method for quickly supplementing a key file according to claim 3, characterized in that: The key file hash value refers to a unique value that identifies the key file, which is a file checksum calculated using a hash function.

6. A method for quickly supplementing a key file according to claim 3, characterized in that: The target data structure includes the same supplementary key capacity, current key file usage serial number, valid expiration key file serial number and key file linked list as the key data structure; the target data structure also includes the key usage amount, which refers to the accumulated value of continuous use of the key starting from the first use.

7. A method for quickly supplementing a key file according to claim 6, characterized in that: The slot information of each slot in the key file linked list of the target data structure includes the key file size and key file status corresponding to the same slot in the key data structure, and also includes the current file offset and the key usage difference. The current file offset refers to the usage address of the key file in the current slot, and the key usage difference refers to the periodic persistence operation of the target data structure according to the value in the key usage difference.