Disk encryption and decryption method, device, terminal equipment and storage medium

By generating and compiling the key file into the kernel, and utilizing the special agreement between the encryption and decryption program and the key file to realize automatic mounting, the problem of insufficient security and convenience of the existing disk encryption scheme is solved, and the security of disk encryption is improved. sex and convenience.

CN117332429BActive Publication Date: 2024-10-01SHENZHEN WANWU SECURITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311103442.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-29
Publication Date
2024-10-01
Estimated Expiration
2043-08-29

AI Technical Summary

Technical Problem

Existing disk encryption solutions have problems of low security and convenience. In particular, the password form requires interaction and is easy to forget. The storage of secret key files has the risk of high cost and easy loss, and non-encrypted partition storage is vulnerable to attackers. Get.

Method used

By generating a secret key file and compiling it into the kernel, the kernel writes a preset file at startup, uses a special agreement between the encryption and decryption program and the secret key file to realize automatic mounting, and hides the storage path of the secret key file to prevent interception by hackers.

Benefits of technology

It improves the security and convenience of disk encryption and decryption, avoids the problems of forgotten passwords and loss of secret key files, and improves the security and convenience of disk encryption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117332429B_ABST
    Figure CN117332429B_ABST
Patent Text Reader

Abstract

The present application discloses a disk encryption and decryption method, device, terminal device and storage medium, wherein the disk encryption and decryption method comprises: generating a key file through key content; encrypting the disk according to the key file to obtain an encrypted disk; writing the key file into a preset agreed file through the kernel according to the key file; decrypting and mounting the encrypted disk by reading the key file provided by the kernel through a preset encryption and decryption program, wherein the agreed file and the encryption and decryption program are pre-agreed. The present application solves the problem that disk encryption is easy to be discovered and decrypted files are difficult to store, and improves the security and convenience of disk decryption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security encryption, and in particular to a disk encryption and decryption method, device, terminal equipment and storage medium. Background Art

[0002] The existing disk encryption solution under the Linux system is to use the cryptsetup program to encrypt the disk under the system, which can use two methods: password or key file.

[0003] Password-based disk encryption requires entering a password when the system starts or mounts the disk;

[0004] Disk encryption in the form of secret keys requires the key file to be stored in a specific device, such as a TPM chip or an unencrypted disk partition or using an external USB flash drive or a mount point on the disk.

[0005] For disk encryption using passwords, since interaction is required, the disk cannot be automatically mounted, and there is also the problem of forgetting the password;

[0006] For disk encryption in the form of secret keys, due to the special nature of the storage of secret key files, there are the following problems: (1) If stored on an additional hardware chip, it will increase the cost and is not universal. (2) If stored on an external storage device (such as a USB flash drive), then additional hardware may be required, and there is a possibility that the secret key file will be lost or leaked. (3) If the secret key file is stored in a non-encrypted partition, a malicious attacker can use another system to mount the disk to obtain the secret key file, thereby achieving disk decryption.

[0007] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0008] The main purpose of the present invention is to provide a disk encryption and decryption method, device, terminal equipment and storage medium, aiming to solve the technical problem that disk encryption is not safe and convenient enough.

[0009] To achieve the above object, the present invention provides a disk encryption and decryption method, the disk encryption and decryption method comprising:

[0010] Generate a key file based on the key content;

[0011] Encrypt the disk according to the secret key file to obtain an encrypted disk;

[0012] According to the secret key file, the secret key file is written into a preset agreement file through the kernel;

[0013] The encrypted disk is decrypted and mounted by reading the secret key file provided by the kernel through a preset encryption and decryption program, and the agreed file and the encryption and decryption program are agreed upon in advance.

[0014] Optionally, the step of writing the key file into a preset agreed file through the kernel according to the key file includes:

[0015] Compile the key file into the kernel of the binary executable file;

[0016] During the kernel startup process, the key file is written into a preset agreement file through the kernel.

[0017] Optionally, the step of writing the key file into a preset file system through the kernel includes:

[0018] Selecting a storage file of a key file through the kernel;

[0019] Writing the secret key file in the kernel into the selected storage disk file;

[0020] Encrypting the path of the storage disk file;

[0021] Write the encrypted storage disk file path into the preset agreement file.

[0022] Optionally, the step of reading the key file provided by the kernel through a preset encryption and decryption program to decrypt and mount the encrypted disk includes:

[0023] Read the key content of the key file provided by the kernel through the preset encryption and decryption program;

[0024] According to the secret key content, the encrypted disk is decrypted and mounted through the encryption and decryption program.

[0025] Optionally, the step of reading the key content of the key file provided by the kernel through a preset encryption and decryption program includes:

[0026] Read the encrypted storage file path in the agreed file through the encryption and decryption program agreed with the agreed file to obtain the storage file;

[0027] According to the storage file, the key file in the storage file is read through the encryption and decryption program to obtain the key content.

[0028] Optionally, the steps after decrypting and mounting the encrypted disk by a preset encryption and decryption program include:

[0029] Hiding the encryption and decryption program's operation of decrypting and mounting the disk;

[0030] The encryption and decryption program deletes the key file stored in the disk file and the path of the disk file stored in the agreed file.

[0031] Optionally, the step of hiding the operation of the encryption and decryption program on decrypting and mounting the disk includes:

[0032] Generate a fake key file based on the preset disk mounting rules;

[0033] Obtaining a storage address of an encryption / decryption program configuration file according to the encryption / decryption program;

[0034] Move the fake key file to the storage address of the encryption and decryption program configuration file.

[0035] The embodiment of the present invention further provides a disk encryption and decryption device, the disk encryption and decryption device comprising:

[0036] A generation module, used to generate a key file through the key content;

[0037] An encryption module, used to encrypt the disk according to the secret key file to obtain an encrypted disk;

[0038] The write module is used to write the key file into the preset agreed file through the kernel;

[0039] The decryption and mounting module is used to read the key file provided by the kernel through a preset encryption and decryption program to decrypt and mount the encrypted disk, and the agreed file and the encryption and decryption program are agreed in advance.

[0040] An embodiment of the present invention also proposes a terminal device, which includes a memory, a processor, and a disk encryption and decryption program stored in the memory and executable on the processor. When the disk encryption and decryption program is executed by the processor, the steps of the disk encryption and decryption method described above are implemented.

[0041] The embodiment of the present invention further proposes a computer-readable storage medium, on which a disk encryption and decryption program is stored. When the disk encryption and decryption program is executed by a processor, the steps of the disk encryption and decryption method described above are implemented.

[0042] The embodiment of the present invention proposes a disk encryption and decryption method, device, terminal device and storage medium, which generates a key file through key content; encrypts the disk according to the key file to obtain an encrypted disk; writes the key file into a preset agreement file through the kernel according to the key file; decrypts and mounts the encrypted disk through a preset encryption and decryption program, and the agreement file and the encryption and decryption program are pre-agreed. Therefore, the encryption and decryption program reads the key file through the special agreement between the key file and the encryption and decryption program, decrypts and mounts the disk according to the read key file, realizes automatic decryption and mounting of the disk, and ensures the security of disk encryption and decryption. The technical problems of disk encryption and decryption being easy to be discovered and decrypted files being difficult to store in the prior art are solved. Among them, the key file is compiled into the kernel of the binary executable file, and the key file does not exist in the form of an independent file, but is written into the memory (RAM) during the kernel startup process. Therefore, there is no risk that hackers can start and mount the disk through a third-party system and intercept the disk encryption key file from it. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 This is a functional module diagram of the terminal device to which the disk encryption and decryption device of this application belongs;

[0044] Figure 2 This is a flowchart of an exemplary embodiment of the disk encryption and decryption method of the present application;

[0045] Figure 3 A schematic diagram of the process of encrypting a disk in the disk encryption and decryption method of the present application;

[0046] Figure 4 This is a flowchart of another exemplary embodiment of the disk encryption and decryption method of the present application;

[0047] Figure 5 This is a flow chart of writing a key file into a file system in the disk encryption and decryption method of this application;

[0048] Figure 6 This is a flowchart of another exemplary embodiment of the disk encryption and decryption method of the present application;

[0049] Figure 7 This is a flow chart of obtaining the secret key content through the encryption and decryption program in the disk encryption and decryption method of this application;

[0050] Figure 8 This is a flowchart of another exemplary embodiment of the disk encryption and decryption method of the present application;

[0051] Fig. 9 This is a flowchart of the operation of decrypting and mounting a disk by hiding an encryption program in an embodiment of the disk encryption and decryption method of the present application;

[0052] Fig.10 This is a schematic diagram of the process of decrypting a disk in the disk encryption and decryption method of this application.

[0053] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0054] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0055] The main solution of the embodiment of the present application is: compile the key file into the kernel of the binary executable file; during the kernel startup process, write the key file into the preset agreement file through the kernel. Select the storage file of the key file through the kernel; write the key file in the kernel into the selected storage file; encrypt the path of the storage file; write the encrypted path of the storage file into the preset agreement file. The agreement file and the encryption and decryption program are pre-agreed, and the key content is obtained through the preset encryption and decryption program; according to the key content, the encrypted disk is decrypted and mounted through the encryption and decryption program. The encrypted storage file path in the agreement file is read through the preset encryption and decryption program to obtain the storage file; according to the storage file, the key file in the storage file is read through the encryption and decryption program to obtain the key content. Hide the operation of the encryption and decryption program on disk decryption and mounting; delete the key file in the storage file and the path of the storage file in the agreement file through the encryption and decryption program. Generate a fake key file according to the preset disk mounting rules; obtain the storage address of the encryption and decryption program configuration file according to the encryption and decryption program; move the fake key file to the storage address of the encryption and decryption program configuration file. The problem that disk encryption is easy to be discovered and decrypted files are difficult to store is solved. Based on the present application scheme, a disk encryption and decryption method is designed based on the problem that traditional disk encryption technology in the real world is not very secure and not convenient enough. The effectiveness of the disk encryption and decryption method in the present application is verified in actual disk encryption. Finally, the security and convenience of disk encryption by the present application method are significantly improved.

[0056] Technical terms involved in the embodiments of this application:

[0057] Linux: Full name GNU / Linux, is a free to use and freely disseminated UNIX-like operating system, whose kernel was first released by Linus Benedict Torvalds on October 5, 1991. It is mainly inspired by the UNIX-like computer operating system (Minix) based on the microkernel architecture and the Unix concept. It is a multi-user, multi-tasking, multi-threaded and multi-CPU operating system based on the Portable Operating System Interface (POSIX). It supports 32-bit and 64-bit hardware and can run major Unix tool software, applications and network protocols.

[0058] Partition encryption tool (cryptsetup): It can generate an encrypted virtual disk, called a volume, in which data is stored. Reading and writing operations can only be performed after the correct password or key is entered, which can ensure the confidentiality of sensitive data.

[0059] Trusted Platform Module (TPM): A chip installed inside a computer that provides a trusted root for the computer. The chip's specifications are set by the Trusted Computing Group. TPM can effectively protect computers from unauthorized access.

[0060] Mount: Connect the top-level directory in the device file to a directory under the Linux root directory. Accessing this directory is equivalent to accessing the device file.

[0061] Kernel: A core component of the operating system. It is the lowest level of the system, directly controls hardware resources, and provides execution environment and service support.

[0062] The embodiments of the present application take into account that the method of using passwords and keys to encrypt disks still has the technical problem of being sufficiently secure and convenient.

[0063] Therefore, the implementation scheme of the present application, starting from the problems of low security and inconvenience in traditional disk encryption technology, designs a disk encryption and decryption method, and verifies the effectiveness of the disk encryption and decryption method in the present application in actual disk encryption. Finally, the security and convenience of disk encryption performed by the method of the present application are significantly improved.

[0064] Specifically, refer to Figure 1 , Figure 1This is a functional module diagram of the terminal device to which the disk encryption and decryption device of this application belongs. The disk encryption and decryption device can be a device that is independent of the terminal device and can perform disk encryption and decryption, and can be carried on the terminal device in the form of hardware or software. The terminal device can be a smart mobile device with data processing functions such as a mobile phone or a tablet computer, or a fixed terminal device or server with data processing functions.

[0065] In this embodiment, the terminal to which the disk encryption and decryption device belongs at least includes an output module 110 , a processor 120 , a memory 130 and a communication module 140 .

[0066] The memory 130 stores an operating system and a disk encryption and decryption program. The disk encryption and decryption program can generate a key file through the key content; encrypt the disk according to the key file to obtain an encrypted disk; write the key file into a preset agreement file through the kernel according to the key file; decrypt and mount the encrypted disk through the preset encryption and decryption program. Encryption and decryption are performed by the disk encryption and decryption device, and the disk encryption and decryption results and other information are stored in the memory 130; the output module 110 can be a display screen, etc. The communication module 140 can include a WIFI module, a mobile communication module, a Bluetooth module, etc., and communicates with an external device or server through the communication module 140.

[0067] The disk encryption and decryption program in the memory 130 is executed by the processor to implement the following steps:

[0068] Generate a key file based on the key content;

[0069] Encrypt the disk according to the secret key file to obtain an encrypted disk;

[0070] According to the secret key file, the secret key file is written into a preset agreement file through the kernel;

[0071] The encrypted disk is decrypted and mounted by reading the secret key file provided by the kernel through a preset encryption and decryption program, and the agreed file and the encryption and decryption program are agreed upon in advance.

[0072] Furthermore, when the disk encryption and decryption program in the memory 130 is executed by the processor, the following steps are also implemented:

[0073] Compile the key file into the kernel of the binary executable file;

[0074] During the kernel startup process, the key file is written into a preset agreement file through the kernel.

[0075] Furthermore, when the disk encryption and decryption program in the memory 130 is executed by the processor, the following steps are also implemented:

[0076] Selecting a storage file of a key file through the kernel;

[0077] Writing the secret key file in the kernel into the selected storage file;

[0078] Encrypting the path of the storage file;

[0079] Write the encrypted storage file path into the preset agreement file.

[0080] Furthermore, when the disk encryption and decryption program in the memory 130 is executed by the processor, the following steps are also implemented:

[0081] Read the key content of the key file provided by the kernel through the preset encryption and decryption program;

[0082] According to the secret key content, the encrypted disk is decrypted and mounted through the encryption and decryption program.

[0083] Furthermore, when the disk encryption and decryption program in the memory 130 is executed by the processor, the following steps are also implemented:

[0084] Read the encrypted storage file path in the agreed file through the encryption and decryption program agreed with the agreed file to obtain the storage file;

[0085] According to the storage file, the key file in the storage file is read through the encryption and decryption program to obtain the key content.

[0086] Furthermore, when the disk encryption and decryption program in the memory 130 is executed by the processor, the following steps are also implemented:

[0087] Hiding the encryption and decryption program's operation of decrypting and mounting the disk;

[0088] The encryption and decryption program deletes the key file stored in the disk file and the path of the disk file stored in the agreed file.

[0089] Furthermore, when the disk encryption and decryption program in the memory 130 is executed by the processor, the following steps are also implemented:

[0090] Generate a fake key file based on the preset disk mounting rules;

[0091] Obtaining a storage address of an encryption / decryption program configuration file according to the encryption / decryption program;

[0092] Move the fake key file to the storage address of the encryption and decryption program configuration file.

[0093] This embodiment uses the above scheme, specifically, to generate a key file through the key content; encrypt the disk according to the key file to obtain an encrypted disk; write the key file into a preset agreement file through the kernel according to the key file; and decrypt and mount the encrypted disk through a preset encryption and decryption program. Based on the special agreement of the encryption and decryption program and the key file to store in a designated location to interact, the problem of insufficient security and convenience of disk encryption and decryption can be solved, and the security and convenience of disk encryption and decryption can be improved. Based on the scheme of this application, starting from the problem that the traditional disk encryption and decryption technology in the real world is not safe and convenient, a disk encryption and decryption method is designed, and the effectiveness of the disk encryption and decryption method in this application is verified in the actual disk encryption and decryption. Finally, the security and convenience of disk encryption and decryption by the method of this application are significantly improved. Among them, the key file is compiled into the kernel of the binary executable file, and the key file does not exist as an independent file, but is written into the memory (RAM) during the kernel startup process. Therefore, there is no risk that hackers can start and mount the disk through a third-party system and intercept the disk encryption key file from it.

[0094] Based on the above terminal device architecture but not limited to the above architecture, an embodiment of the method of the present application is proposed.

[0095] Reference Figure 2 , Figure 2 This is an exemplary flowchart of a disk encryption method of the present application. The disk encryption and decryption method includes:

[0096] Step S01, generating a key file through the key content;

[0097] The execution subject of the method of this embodiment can be a disk encryption and decryption device, or a disk encryption and decryption terminal device or server. This embodiment takes a disk encryption and decryption device as an example, and the disk encryption and decryption device can be integrated in a terminal device with data processing function.

[0098] To encrypt the disk, take the following steps:

[0099] First, generate the key content through the key generation tool. The key content is used to unlock the disk and access the disk content.

[0100] Then, a key file is generated through the key content. The key file allows the key content to be stored, making it easier for the key content to be stored in the area specified by the kernel, and also to reach a special agreement with the encryption and decryption program to store it in a designated location.

[0101] Step S02, encrypting the disk according to the secret key file to obtain an encrypted disk;

[0102] After completing the generation of the key file, obtain the encrypted disk through the following steps:

[0103] First, use the partition encryption tool to generate an encrypted virtual disk.

[0104] Then, use the key file as the key to unlock the virtual disk.

[0105] Finally, only after this key file is entered, this virtual disk can be read and written, and this virtual disk is an encrypted disk.

[0106] The encrypted disk may refer to disks of different systems, including but not limited to Linux, Windows, Unix, etc. In this embodiment, the Linux operating system is used.

[0107] Step S03, according to the secret key file, the kernel writes the secret key file into a preset agreement file;

[0108] In order to write the key file into the preset agreed file, the embodiment of the present application adopts the method of writing through the kernel, and the following steps can be taken:

[0109] First, compile the key file into the kernel of the binary executable.

[0110] Then, the kernel randomly selects a storage file. The random selection is to prevent the file system from seeing how many files there are from the outside, and because it is a random file, it is not easy to guess the file location of the secret key.

[0111] Then, the key file in the kernel is attached to the tail of the selected storage file. In this embodiment, the key file is attached to the tail of the storage file so as not to affect the availability of the file and to facilitate the management of the key file. In other embodiments, the key file may also be attached to other locations of the storage file, such as the file header, the middle, and other set areas.

[0112] Then, according to the selected storage file, the path of the current storage file is obtained;

[0113] Finally, the path of the storage file is written into the agreement file in an encrypted manner. The purpose of writing the agreement file is to reach a special agreement between the encryption and decryption program and the key file, so that the encryption and decryption program can decrypt and mount the encrypted disk.

[0114] The process of encrypting the disk is as follows: Figure 3 As shown, a key file is first generated through the key content, and then the disk is encrypted through the key file. Finally, the key file is written to a specific area in the kernel to complete the special agreement with the encryption and decryption program.

[0115] Step S04, decrypting and mounting the encrypted disk using a preset encryption and decryption program.

[0116] When the key file is written to the preset file system according to the special agreement with the encryption and decryption program, in order to find the key file and read the key content through the encryption and decryption program to achieve the effect of unlocking the encrypted disk, the following steps are taken:

[0117] First, start the encryption and decryption program to read the storage file attached to the key file in the agreed file system.

[0118] Then, the encryption and decryption program reads the secret key file attached to the storage file and obtains the secret key content.

[0119] Finally, the encryption and decryption program unlocks and mounts the encrypted hard disk by obtaining the secret key content.

[0120] This embodiment uses the above scheme to generate a key file specifically through the key content; encrypt the disk according to the key file to obtain an encrypted disk; write the key file into a preset agreement file through the kernel according to the key file; decrypt and mount the encrypted disk through a preset encryption and decryption program, and the agreement file and the encryption and decryption program are pre-agreed. Based on the special agreement between the key file and the encryption and decryption program, the encryption and decryption operations of the disk and the storage of the key file are realized. The problem that the disk encryption in the prior art is easy to be discovered and the decrypted file is not easy to store is solved, and the security and convenience of disk encryption are improved. Among them, the key file is compiled into the kernel of the binary executable file, and the key file does not exist as an independent file, but is written into the memory (RAM) during the kernel startup process. Therefore, there is no risk that hackers can start and mount the disk through a third-party system and intercept the disk encryption key file from it.

[0121] Reference Figure 4 , Figure 4 This is a flowchart of another exemplary embodiment of the disk encryption and decryption method of the present application.

[0122] Based on the above Figure 2 In the embodiment shown, the step S03, according to the key file, the step of writing the key file into a preset predetermined file through the kernel includes:

[0123] Step S031, write the key file into the kernel:

[0124] Step S032, writing the key file into a preset agreed file through the kernel.

[0125] Specifically, in order to write the secret key file into the preset agreement file, the following steps are performed:

[0126] First, after encrypting the disk with the secret key file, the secret key file is written into the kernel. Here, the secret key file is written into the kernel, which means that the original secret key file is still saved in the current system.

[0127] Then, after receiving the key file, the kernel first randomly selects a file in the system to store the key file, wherein the selected file is the storage file.

[0128] Then, the key file in the kernel is written into the selected storage file, wherein writing into the selected storage file, in this embodiment, means storing the key file at the end of the storage file, wherein the storage location here includes but is not limited to the end of the storage file, and in other embodiments, it can also be stored in other locations of the storage file, such as the head, the middle, etc.

[0129] Then, the selected storage file path is encrypted.

[0130] Finally, the encrypted storage file path is written into the agreed file, where the agreed file refers to the one selected by the encryption and decryption program and the key file, including but not limited to the file name, memory, etc.

[0131] This embodiment uses the above solution, specifically by writing the key file into the kernel; and writing the key file into a preset agreement file through the kernel. Based on the kernel's writing operation on the key file, the key file is stored in the agreement file, following the special agreement between the key file and the encryption and decryption program. This improves the security of disk encryption and decryption and the convenience of disk decryption file storage.

[0132] Reference Figure 5 , Figure 5 This is a flow chart of writing a key file into an agreed file in the disk encryption and decryption method of this application.

[0133] Based on the above Figure 4 In the embodiment shown, the step S032, the step of writing the key file into a preset file system through the kernel, includes:

[0134] Step S0321, selecting a storage file of a key file through the kernel;

[0135] Step S0322, writing the key file in the kernel into the selected storage file;

[0136] Step S0323, encrypting the path of the storage file;

[0137] Step S0324, writing the encrypted storage disk file path into a preset agreed file.

[0138] Specifically, in order to write the secret key file into the agreed file and facilitate the encryption and decryption program to find it, the following solution is adopted:

[0139] First, the current key file already exists in the kernel, and the kernel randomly selects a storage file where the key file is to be stored. The selected files include but are not limited to those selected from disk files and memory files, and all files are located in the memory.

[0140] Then, the secret key file in the kernel is written to the end of the storage file selected by the kernel for storage; then, the path of the current storage file is encrypted;

[0141] Finally, the path of the encrypted storage disk file is written into the agreed file.

[0142] The operation of writing the path of the storage disk file into the agreed file is to hide the current storage file so that the storage file is not easily discovered.

[0143] This embodiment adopts the above scheme, specifically selects the storage file of the key file through the kernel; writes the key file in the kernel into the selected storage file; encrypts the path of the storage file; writes the encrypted path of the storage file into a preset agreement file. Based on the special agreement between the key file and the encryption and decryption program, the deep hiding of the key file and the storage of the key file in accordance with the agreement are realized, so that the encrypted disk is not easy to be cracked, and the encryption and decryption program finds the key file to decrypt and mount the disk, thereby improving the security of disk encryption and decryption.

[0144] Reference Figure 6 , Figure 6 This is a flowchart of another exemplary embodiment of the disk encryption and decryption method of the present application.

[0145] Based on the above Figure 2 In the embodiment shown, the step S04, the step of decrypting and mounting the encrypted disk by a preset encryption and decryption program, includes:

[0146] Step S041, obtaining the key content through a preset encryption and decryption program;

[0147] Step S042, decrypting and mounting the encrypted disk through an encryption and decryption program according to the secret key content.

[0148] Specifically, after the secret key file is written into the agreed file, the operation of starting the encryption and decryption program to decrypt and mount the encrypted disk is as follows:

[0149] First, the current file system is searched through the encryption and decryption program that has been set in advance, and the key content in the key file is obtained according to the special agreement between the key file and the encryption and decryption program;

[0150] Finally, the encryption and decryption program decrypts the currently encrypted disk according to the obtained secret key content, mounts the decrypted disk, and accesses the contents of the disk.

[0151] Among them, in the Linux system, after the disk is decrypted, the current disk content cannot be accessed directly, but the current disk needs to be mounted to access it. After the encryption and decryption program decrypts the current disk, similar to the operation of dividing the disk into symbols in the Windows system, the decrypted disk is divided into symbols to complete the access to the disk content.

[0152] This embodiment uses the above solution to obtain the key content through a preset encryption and decryption program; according to the key content, the encryption and decryption program decrypts and mounts the encrypted disk. The encryption and decryption program decrypts and mounts the encrypted disk, solves the problem of the insecure storage location of the key file, and improves the security and convenience of disk encryption and decryption.

[0153] Reference Figure 7 , Figure 7 This is a flow chart of the disk encryption and decryption method of this application involving the encryption and decryption program obtaining the secret key content.

[0154] Based on the above Figure 6 In the embodiment shown, the step S041, the step of obtaining the key content through the preset encryption and decryption program, includes:

[0155] Step S0411, reading the encrypted storage file path in the agreed file through a preset encryption and decryption program to obtain the storage file;

[0156] Step S0412, according to the storage file, read the key file in the storage file through the encryption and decryption program to obtain the key content.

[0157] Specifically, in order to decrypt and mount the encrypted disk, the scheme for obtaining the secret key content through the encryption and decryption program is as follows:

[0158] First, the encryption and decryption program reads the memory file system and obtains the path of the storage file according to the agreement file agreed upon between the encryption and decryption program and the key file based on the current key file stored in the agreement file;

[0159] Then, according to the read storage file path, read the key file in the storage file at the end of the storage file;

[0160] Finally, the key file is read through the encryption and decryption program to obtain the key content in the key file.

[0161] Among them, the way the encryption and decryption program reads the key content is based on the previous agreement with the key file. Because the storage file path of the key file is encrypted and written into the agreed file, after finding the agreed file, the path of the storage file is obtained, and then the storage file is read to obtain the key file. Finally, the encrypted disk can be decrypted and mounted according to the key file.

[0162] This embodiment uses the above solution to obtain the storage file by reading the encrypted storage file path in the agreed file through a preset encryption and decryption program; and according to the storage file, the encryption and decryption program reads the key file in the storage file to obtain the key content. The encryption and decryption program follows the agreement with the key file and finds the key file previously agreed with it accordingly, thereby obtaining the key file and achieving the effect that the key file is not easy to find, thereby improving the security of disk encryption.

[0163] Reference Figure 8 , Figure 8 This is a flowchart of another exemplary embodiment of the disk encryption and decryption method of the present application.

[0164] Based on the above Figure 2 In the embodiment shown, in this embodiment, after the step S04 of decrypting and mounting the encrypted disk by a preset encryption and decryption program, the disk encryption and decryption method further includes:

[0165] Step S05, hiding the encryption program's operation of decrypting and mounting the disk;

[0166] Step S06, deleting the key file in the storage file and the path of the storage file in the agreed file through the encryption and decryption program.

[0167] Specifically, after the encryption and decryption program obtains the secret key file, in order to further improve the security of disk encryption, the following steps are taken:

[0168] First, the encryption program's operation of decrypting and mounting the disk is hidden by generating a fake key file and placing the fake key file in the encryption and decryption program's configuration file;

[0169] The purpose of generating a fake key file is to confuse malicious attackers and make them think that the current key file is the file for decrypting the disk.

[0170] Finally, use the encryption and decryption program to delete the key file attached to the end of the storage file and the storage file path in the current storage agreement file.

[0171] Among them, since the current encryption and decryption program has obtained the key content in the key file, the encryption and decryption program is used to delete the key file attached to the end of the storage file, and the storage file path in the current storage agreement file is also deleted accordingly.

[0172] This embodiment uses the above solution to hide the encryption program's operation of decrypting and mounting the disk; and deletes the key file in the storage file and the path of the storage file in the agreed file through the encryption and decryption program. The disk encryption security is further improved by confusing malicious attackers with fake key files and deleting the key file storage path.

[0173] Reference Fig. 9 , Fig. 9 The present application's disk encryption and decryption method embodiment relates to a flowchart of operations of a hidden encryption program to decrypt and mount a disk.

[0174] Based on the above Figure 8 In the embodiment shown, the step S06, the step of deleting the key file stored in the disk file and the path of the disk file stored in the file system by the encryption and decryption program, includes:

[0175] Step S061, generating a fake key file according to a preset disk mounting rule;

[0176] Step S062, obtaining the storage address of the encryption and decryption program configuration file according to the encryption and decryption program;

[0177] Step S063, moving the fake key file to the storage address of the encryption and decryption program configuration file.

[0178] Specifically, in order to confuse malicious attackers, the following steps are performed:

[0179] First, according to the disk mounting rules, a fake key file is generated, such as / etc / crypttab in the encrypted Linux system, which is displayed as: luks-979409e5-05f4-401c-aa56-8dffc11c479e / dev / sda3 / etc / wwappluks or luks-7cc23517-0c3f-4038-bc6c-d721194710f1 / dev / sda4 / etc / wwdata luks, which will make malicious attackers think that the disk decryption files are / etc / wwapp and / etc / wwdata.

[0180] Then, the storage address of the encryption and decryption program configuration file is obtained according to the encryption and decryption program;

[0181] Finally, the generated fake key file is moved to the storage address of the encryption and decryption program configuration file to confuse malicious attackers.

[0182] Among them, the disk mounting rule means that when the disk is in an encrypted state, in order to access its contents, the disk must first be decrypted, and then the decrypted disk must be mounted before access can be achieved.

[0183] This embodiment uses the above solution to generate a fake key file according to the preset disk mounting rules; obtain the storage address of the encryption and decryption program configuration file according to the encryption and decryption program; and move the fake key file to the storage address of the encryption and decryption program configuration file. By generating the fake key file and storing it in the corresponding position, it can protect against malicious attackers who understand disk decryption, thereby improving the security of disk encryption.

[0184] The disk encryption and decryption method of the present application involves the process of disk decryption as follows Fig.10 As shown:

[0185] First, after the disk is encrypted, the key file is stored in the kernel. The kernel randomly selects a file in the system as the storage file, and attaches the key file in the kernel to the end of the selected storage file.

[0186] Then, the storage file path of the storage key file is written into the agreed file in an encrypted manner, wherein the agreed file is a file agreed upon by the encryption and decryption program and the key file, including but not limited to the agreement on the file name.

[0187] Then, the system starts the encryption and decryption program to read the file name attached to the key file in the file system.

[0188] Then, the encryption and decryption program reads the storage file attached with the secret key file to obtain the secret key content, wherein the encryption and decryption program finds the location of the secret key file according to the special agreement with the secret key file, and then reads it to obtain the secret key content.

[0189] Then, the encryption and decryption program decrypts the encrypted disk according to the content of the moral key, and then mounts the disk, thus realizing the decryption and mounting of the disk.

[0190] Finally, after decrypting and mounting the disk, the encryption and decryption program deletes the secret key attached to the storage file and the confidential file saved in the agreed file path. The purpose of deletion is to hide the secret key content. It is known that the secret key content is stored in the system, and the special agreement between the encryption and decryption program and the secret key file has been completed. Deleting the secret key file in the disk file can protect the current secret key file from being easily discovered, thereby improving the security of disk encryption.

[0191] In addition, the embodiment of the present application also provides a disk encryption and decryption device, the disk encryption and decryption device comprising:

[0192] Generate module, used to generate key files;

[0193] An encryption module is used to encrypt the disk to obtain an encrypted disk;

[0194] The writing module is used to write the secret key file into the preset file system;

[0195] Decryption and mounting module, used to decrypt and mount encrypted disks.

[0196] For the principle and implementation process of text classification in this embodiment, please refer to the above embodiments and will not be repeated here.

[0197] In addition, an embodiment of the present application also proposes a terminal device, which includes a memory, a processor, and a disk encryption and decryption program stored in the memory and executable on the processor, and the disk encryption and decryption program, when executed by the processor, implements the steps of the disk encryption and decryption method described above.

[0198] Since the disk encryption and decryption program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.

[0199] In addition, an embodiment of the present application further proposes a computer-readable storage medium, on which a disk encryption and decryption program is stored. When the disk encryption and decryption program is executed by a processor, the steps of the disk encryption and decryption method described above are implemented.

[0200] Since the disk encryption and decryption program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.

[0201] Compared with the prior art, the disk encryption and decryption method, device, terminal device and storage medium proposed in the embodiment of the present application generate a key file through the key content; encrypt the disk according to the key file to obtain an encrypted disk; write the key file into a preset file system through the kernel according to the key file; decrypt and mount the encrypted disk through a preset encryption and decryption program. Thus, the technical problems that disk encryption is easy to be discovered and decrypted files are not easy to store are solved. Based on the scheme of the present application, starting from the problems that traditional disk encryption technology in the real world is not safe and convenient enough, a disk encryption and decryption method is designed, and the effectiveness of the disk encryption and decryption method in the present application is verified in the actual disk encryption. Finally, the security and convenience of disk encryption by the method of the present application are significantly improved. Among them, the key file is compiled into the kernel of the binary executable file, and the key file does not exist as an independent file, but is written into the memory (RAM) during the kernel startup process. Therefore, there is no risk that hackers can start and mount the disk through a third-party system and intercept the disk encryption key file from it.

[0202] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0203] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0204] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to execute the method of each embodiment of the present application.

[0205] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A disk encryption and decryption method, characterized in that: The disk encryption and decryption method comprises the following steps: Generate a key file based on the key content; Encrypting the disk according to the secret key file to obtain an encrypted disk; According to the secret key file, the kernel writes the secret key file into a preset agreement file; The step of writing the key file into a preset agreement file through the kernel according to the key file includes: Compile the key file into the kernel of the binary executable file; During kernel startup, the kernel randomly selects a storage file for the key file; Writing the secret key file in the kernel to the tail of the selected storage file; Encrypting the path of the storage file; Write the encrypted storage file path into the preset agreement file; The encrypted disk is decrypted and mounted by reading the secret key file provided by the kernel through a preset encryption and decryption program, and the agreement file and the encryption and decryption program are agreed upon in advance.

2. The disk encryption and decryption method according to claim 1, characterized in that: The step of decrypting and mounting the encrypted disk by reading the key file provided by the kernel through the preset encryption and decryption program includes: Read the key content of the key file provided by the kernel through the preset encryption and decryption program; According to the secret key content, the encrypted disk is decrypted and mounted through the encryption and decryption program.

3. The disk encryption and decryption method according to claim 1, characterized in that: The step of reading the key content of the key file provided by the kernel through the preset encryption and decryption program includes: Read the encrypted storage file path in the agreed file through the encryption and decryption program agreed in the agreed file to obtain the storage file; According to the storage file, the key file in the storage file is read through the encryption and decryption program to obtain the key content.

4. The disk encryption and decryption method according to claim 1, characterized in that: The steps after decrypting and mounting the encrypted disk using the preset encryption and decryption program include: Hiding the encryption and decryption program's operation of decrypting and mounting the disk; The encryption and decryption program deletes the key file in the storage file and the path of the storage file in the agreed file.

5. The disk encryption and decryption method according to claim 4, characterized in that: The step of hiding the operation of the encryption and decryption program on decrypting and mounting the disk includes: Generate a fake key file based on the preset disk mounting rules; Obtaining a storage address of an encryption / decryption program configuration file according to the encryption / decryption program; Move the fake key file to the storage address of the encryption and decryption program configuration file.

6. A disk encryption and decryption device, characterized in that: The disk encryption and decryption device comprises: A generation module is used to generate a key file based on the key content; An encryption module, used to encrypt the disk according to the secret key file to obtain an encrypted disk; A writing module, configured to write the key file into a preset agreement file through the kernel according to the key file; The writing module is further configured to compile the key file into the kernel of a binary executable file; during kernel startup, randomly select a storage file for the key file through the kernel; write the key file in the kernel to the tail of the selected storage file; encrypt the path of the storage file; and write the encrypted path of the storage file into a preset agreement file; The decryption and mounting module is used to read the key file provided by the kernel through a preset encryption and decryption program to decrypt and mount the encrypted disk. The agreed file and the encryption and decryption program are agreed in advance.

7. A disk encryption device, characterized in that: The disk encryption device includes a memory, a processor, and a disk encryption and decryption program stored in the memory and executable on the processor. When the disk encryption and decryption program is executed by the processor, the steps of the disk encryption and decryption method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a disk encryption and decryption program, which, when executed by a processor, implements the steps of the disk encryption and decryption method according to any one of claims 1 to 5.