Key encryption method and device, computer equipment, storage medium and program product
By fragmenting and scrambling the key storage, the problems of intellectual property disputes and operational complexity in key encryption methods are solved, achieving efficient key protection without encryption algorithms and improving product security.
Patent Information
- Application Number
- CN202511973811.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-24
- Publication Date
- 2026-03-20
AI Technical Summary
Existing key encryption methods are prone to intellectual property disputes and increase the difficulty of decryption for both legitimate users and unauthorized access users, leading to increased operational complexity for legitimate users.
The key is fragmented and scrambled for storage. This is achieved by assigning the content of each byte of the key to multiple different sub-files and randomly allocating memory addresses when the programming file forms a Bin file.
It prevents unauthorized access to obtain the complete key without the need for encryption algorithms, thus improving product security and simplifying the operation process for legitimate users.
Smart Images

Figure CN121711099A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information security technology, and in particular to a key encryption method and apparatus. Background Technology
[0002] Encrypting data with keys is a common method to enhance security in software. Ensuring the integrity, confidentiality, and availability of data has become an important research direction in the field of information security.
[0003] For example, Figure 1 This is a schematic diagram of how keys are stored in existing technologies. For example... Figure 1 As shown, the first part of a piece of data in the storage area, indicated by the dashed box T1, is a key (6 digits). Only after storing the 6-digit key is the code of the data stored. In this case, if an unauthorized accessor illegally obtains the contents of the storage area, they can easily determine that the key for that data is the content corresponding to the dashed box T1, i.e., the key "132654". After entering this key, the unauthorized accessor can then illegally obtain the contents of that data.
[0004] In response to the above situation, the key needs to be encrypted to prevent it from being easily obtained. Figure 2 This is another schematic diagram of key storage methods in existing technologies. Existing technologies often encrypt keys by complexly encoding them using encryption algorithms, such as... Figure 2 As shown in the dashed box T2 of the storage area, the key is stored in the dashed box T2. Even if an unauthorized accessor obtains the contents of the storage area, they cannot easily obtain the key directly from the contents of the dashed box T2. Alternatively, they may need to use professional software to decrypt the key "132654" corresponding to the dashed box T2.
[0005] It should be noted that the above description of the background technology is only for the purpose of providing a clear and complete explanation of the technical solutions of this application and facilitating understanding by those skilled in the art. It should not be assumed that these technical solutions are known to those skilled in the art simply because they have been described in the background technology section of this application. Summary of the Invention
[0006] The inventors discovered that in existing key encryption technologies, intellectual property disputes may easily arise when the encryption algorithm involves a third party; and while existing key encryption increases the difficulty for unauthorized access to crack the key, it also increases the complexity of the decryption algorithm for legitimate users.
[0007] To address one of the aforementioned problems or other similar issues, embodiments of this application provide a key encryption method and apparatus that prevent unauthorized access from obtaining the complete key, thereby protecting the key.
[0008] According to a first aspect of the embodiments of this application, a key encryption method is provided, wherein the key encryption method includes: fragmenting a key to obtain key fragments; and scrambling and storing the key fragments.
[0009] In some embodiments, the content of each byte of the key is assigned to multiple different sub-files in the programming file, resulting in multiple sub-files that each contain different key fragments.
[0010] In some embodiments, assigning the content of each byte of the key to multiple different subfiles in a programming file includes: sequentially assigning the content of each byte of the key to different subfiles; or randomly assigning the content of each byte of the key to different subfiles.
[0011] In some embodiments, each subfile includes at least one byte of the key.
[0012] In some embodiments, scrambling the key fragments for storage includes: during the process of forming a Bin file from the programming file, randomly assigning memory addresses to the key fragments to obtain scrambled and stored keys.
[0013] In some embodiments, the executable code in the Bin file has the same value range as the key.
[0014] According to a second aspect of the embodiments of this application, a key encryption device is provided, wherein the key encryption device includes: a fragmentation unit for fragmenting a key to obtain key fragments; and a scrambling storage unit for scrambling and storing the key fragments.
[0015] This application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the aforementioned key encryption method.
[0016] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned key encryption method.
[0017] This application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the aforementioned key encryption method.
[0018] One of the beneficial effects of this application embodiment is that, according to this application embodiment, the fragmented key (key fragments) is scrambled and stored, so there is no need to use an encryption algorithm. This simple method can prevent unauthorized access to obtain the complete key, thereby achieving key protection and improving product security.
[0019] Specific embodiments of this application are disclosed in detail with reference to the following description and accompanying drawings, indicating how the principles of this application can be adopted. It should be understood that the embodiments of this application are not limited in scope. Within the spirit and scope of the appended claims, embodiments of this application include many changes, modifications, and equivalents. Attached Figure Description
[0020] The accompanying drawings, which form part of the specification, are used to provide a further understanding of the embodiments of this application and illustrate the implementation methods of this application, together with the textual description, to explain the principles of this application. Obviously, the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without creative effort. In the drawings:
[0021] Figure 1 This is a schematic diagram of the key storage method in existing technology;
[0022] Figure 2 This is another schematic diagram of key storage methods in existing technologies;
[0023] Figure 3 This is a schematic diagram of a key encryption method according to an embodiment of the first aspect of this application;
[0024] Figure 4 This is a schematic diagram of the C file of an embodiment of the first aspect of this application;
[0025] Figure 5 This is a schematic diagram of a Bin file representing an embodiment of the first aspect of this application;
[0026] Figure 6 This is a schematic diagram of a key encryption device according to an embodiment of the second aspect of this application. Detailed Implementation
[0027] Referring to the accompanying drawings, the foregoing and other features of this application will become apparent from the following description. Specific embodiments of this application are specifically disclosed in the description and drawings, illustrating partial implementations in which the principles of this application may be employed. It should be understood that this application is not limited to the described embodiments; rather, it includes all modifications, variations, and equivalents falling within the scope of the appended claims.
[0028] In the embodiments of this application, the terms "first," "second," etc., are used to distinguish different elements by name, but do not indicate the spatial arrangement or chronological order of these elements, and these elements should not be limited by these terms. The term "and / or" includes any one or more of the terms listed in association and all combinations thereof. The terms "comprising," "including," "having," etc., refer to the presence of the stated features, elements, components, or assemblies, but do not exclude the presence or addition of one or more other features, elements, components, or assemblies.
[0029] In the embodiments of this application, the singular forms "a," "the," etc., including the plural forms, should be broadly understood as "a kind" or "a class" rather than limited to the meaning of "an." Furthermore, the term "the" should be understood to include both the singular and plural forms, unless the context explicitly indicates otherwise. Additionally, the term "according to" should be understood as "at least partially based on…," and the term "based on" should be understood as "at least partially based on…," unless the context explicitly indicates otherwise.
[0030] The embodiments of this application will now be described with reference to the accompanying drawings. These embodiments are merely exemplary and are not intended to limit the scope of this application.
[0031] First aspect of the embodiments
[0032] An embodiment of the first aspect of this application provides a key encryption method.
[0033] Figure 3 This is a schematic diagram of a key encryption method according to an embodiment of the first aspect of this application.
[0034] like Figure 3 As shown, key encryption methods may include:
[0035] 301, fragment the key to obtain key fragments;
[0036] 302, shuffle and store the fragmented key (key fragments).
[0037] Therefore, according to the above embodiments, the fragmented key (key fragments) are shuffled and stored. This eliminates the need for encryption algorithms and prevents unauthorized access to the complete key in a simple way, thereby protecting the key and improving product security.
[0038] In this embodiment of the application, in step 301, the key can be fragmented in any way. For example, fragmenting the key can include assigning the content of each byte of the key to multiple different sub-files in the programming file, thereby obtaining multiple sub-files each containing different key fragments.
[0039] Specifically, for example, in a C language programming file, the key K consists of constants of length N bytes: password_01, password_02, password_03, password_04, ..., password_N, i.e. (0x00, 0x02, 0x03, 0x01, ..., 0xFE). In multiple different sub-files of the C file, keys of any length can be assigned in units of bytes. That is to say, each sub-file can include at least one byte of the key K.
[0040] Figure 4 This is a schematic diagram of a C file representing an embodiment of the first aspect of this application.
[0041] like Figure 4 As shown, C file 400 includes multiple different subfiles 401 (FileA.c 401-1, FileB.c 401-2, FileC.c 401-3, ..., FileX.c 401-X). In each subfile 401, a key of any length can be assigned in bytes. For example, in subfile 401-1, password_02=0x02 is assigned a one-byte value; in subfile 401-2, password_04=0x01 is assigned a one-byte value; in subfile 401-3, password_03=0x03 and password_01=0x00 are assigned two-byte values; and in subfile 401-X, password_N=0xFE is assigned a one-byte value. In this way, each subfile 401 includes different key fragments, thereby fragmenting the key K and obtaining multiple key fragments in different subfiles 401.
[0042] In this embodiment of the application, assigning the content of each byte of the key to multiple different subfiles in the programming file (C file) may include: randomly assigning the content of each byte of the key to different subfiles, for example, in Figure 4 In the process, password_02=0x02 is randomly assigned to subfile 401-1, password_04=0x01 is assigned to subfile 401-2, password_03=0x03 and password_01=0x00 are assigned to subfile 401-3, and password_N=0xFE is assigned to subfile 401-X.
[0043] However, this application is not limited to this. Assigning the content of each byte of the key to multiple different subfiles in the programming file (C file) can also include: assigning the content of each byte of the key to different subfiles sequentially. Compared to assigning the content of each byte of the key to different subfiles sequentially, randomly assigning the content of each byte of the key to different subfiles can make the key encryption more secure and more difficult to crack.
[0044] In this embodiment of the application, in step 302, scrambling and storing the fragmented key (key fragments) may specifically include: during the process of forming a Bin file from a programming file, randomly assigning memory addresses to the key fragments to obtain the scrambled and stored key.
[0045] For example, a compiler can be used to convert a C file into a binary file (an executable file) stored in memory. In other words, during the process of compiling the C file into a Bin file, memory addresses are randomly assigned to the fragmented key (key fragments), thus achieving the scrambled storage of the fragmented key (key fragments).
[0046] Figure 5 This is a schematic diagram of a Bin file representing an embodiment of the first aspect of this application.
[0047] like Figure 5 As shown, Bin file 500 includes multiple sub-Bin files 501 (FileA.obj 501-1, FileB.obj 501-2, FileC.obj 501-3, ..., FileX.obj 501-X). Figure 4 During the compilation of subfile 401-1 into a Bin file, the content 0x02 of the second byte (password_02) of key K is randomly assigned to the memory address where the dashed box T3 of subfile 501-1 is located; the content 0x01 of the fourth byte (password_04) of key K is randomly assigned to the memory address where the dashed box T4 of subfile 501-2 is located; the content 0x03 of the third byte (password_03) of key K is randomly assigned to the memory address where the dashed box T5 of subfile 501-3 is located; the content 0x00 of the first byte (password_01) of key K is randomly assigned to the memory address where the dashed box T6 of subfile 501-3 is located; and the content 0xFE of the Nth byte (password_N) of key K is randomly assigned to the memory address where the dashed box T7 of subfile 501-X is located.
[0048] Therefore, when generating the Bin file, the compiler automatically arranges these key fragments into different memory addresses, thus scrambling the key fragments for storage. Storing these key fragments in a non-contiguous address space within memory prevents unauthorized access to them from being easily obtained from contiguous address spaces.
[0049] In this embodiment, the executable code in the Bin file has the same value range as the key. For example, the storage space corresponding to any address in the memory has a value range of 0x00-0xFF (256 values), which is consistent with the value range of the key. Specifically, as shown... Figure 5 As shown, the value range of the key K is 0x00-0xFF, and the value range of the executable code in the storage space corresponding to the dashed box T3 in the Bin subfile 501-1 is also 0x00-0xFF.
[0050] By mixing the executable code and key fragments together, and since their values are all in the range of 0x00-0xFF, the repetition rate of their values is very high. This makes it impossible for unauthorized access users to distinguish between the key and the executable code even if they obtain the relevant information in the memory, thus preventing decryption. This further helps to better prevent the leakage of file data.
[0051] According to the above embodiments, the fragmented key (key fragments) are shuffled and stored. This eliminates the need for encryption algorithms and prevents unauthorized access to the complete key in a simple way, thereby protecting the key and improving product security.
[0052] Second aspect of the embodiments
[0053] The second aspect of this application provides a key encryption device. Since the principle by which the key encryption device solves the problem is similar to that of the key encryption method, the implementation of the key encryption device can refer to the implementation of the key encryption method, and repeated details will not be described again.
[0054] Figure 6 This is a schematic diagram of a key encryption device according to an embodiment of the second aspect of this application.
[0055] like Figure 6 As shown, the key encryption device 600 may include a fragmentation unit 601 and a scrambling storage unit 602, wherein the fragmentation unit 601 is used to fragment the key to obtain key fragments; and the scrambling storage unit 602 is used to scramble and store the key fragments.
[0056] According to the above embodiments, the fragmented key (key fragments) are shuffled and stored. This eliminates the need for encryption algorithms and prevents unauthorized access to the complete key in a simple way, thereby protecting the key and improving product security.
[0057] In this embodiment of the application, the aforementioned units of the key encryption device 600 can be integrated into a microprocessor.
[0058] This application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described key encryption method.
[0059] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described key encryption method.
[0060] This application also provides a computer program product, which includes a computer program that implements a key encryption method when executed by a processor.
[0061] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0062] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0063] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0064] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0065] The present application has been described above with reference to specific embodiments. However, those skilled in the art should understand that these descriptions are exemplary and not intended to limit the scope of protection of the present application. Those skilled in the art can make various modifications and variations to the present application based on its spirit and principles, and these modifications and variations are also within the scope of the present application.
[0066] Preferred embodiments of this application have been described above with reference to the accompanying drawings. Many features and advantages of these embodiments are apparent from this detailed description, and therefore the appended claims are intended to cover all such features and advantages of these embodiments that fall within their true spirit and scope. Furthermore, since many modifications and alterations will readily occur to those skilled in the art, the embodiments of this application are not intended to be limited to the precise structures and operations illustrated and described, but rather to encompass all suitable modifications and equivalents falling within their scope.
Claims
1. A key encryption method, characterized in that, The key encryption method includes: Fragment the key to obtain key fragments; The key fragments are shuffled and stored.
2. The key encryption method according to claim 1, wherein, The key fragmentation includes: The content of each byte of the key is assigned to multiple different sub-files in the programming file, resulting in multiple sub-files that each contain different key fragments.
3. The key encryption method according to claim 2, wherein, Assigning the content of each byte of the key to multiple different subfiles in the programming file includes: Assign the content of each byte of the key to different sub-files sequentially, byte by byte; or The content of each byte of the key is randomly assigned to different sub-files.
4. The key encryption method according to claim 2 or 3, wherein, Each subfile includes at least one byte of the key.
5. The key encryption method according to claim 2, wherein, The step of scrambling and storing the key fragments includes: During the process of forming the programming file into a binary file, memory addresses are randomly assigned to the key fragments to obtain scrambled stored keys.
6. The key encryption method according to claim 5, wherein, The executable code in the binary file has the same value range as the key.
7. A key encryption device, characterized in that, The key encryption device includes: A fragmentation unit, which is used to fragment the key to obtain key fragments; A scrambling storage unit is used to scramble and store the key fragments.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 6.