File encryption and decryption method, system, device and storage medium

By generating and using a key dictionary in mobile storage hardware for file encryption and decryption, the problem of requiring additional hardware in existing encryption lock modes is solved, enabling convenient encryption and decryption processing.

CN116502245BActive Publication Date: 2026-11-24SHENJIANG UNIVERSAL DATA INFORMATION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310293017.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-23
Publication Date
2026-11-24
Estimated Expiration
2043-03-23

AI Technical Summary

Technical Problem

Existing dongle modes require additional dongle hardware and storage devices, leading to inconvenience and resource waste.

Method used

Using mobile storage hardware as the encryption key hardware tool for encryption software authorization, the encryption and decryption of files are achieved by obtaining pre-stored decryption keys and generating a key dictionary.

Benefits of technology

It implements the encryption lock function without affecting the original storage function of the mobile storage hardware, and provides a convenient encryption and decryption solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116502245B_ABST
    Figure CN116502245B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a file encryption and decryption method, device, equipment and storage medium, the method comprising: in response to operation of a mobile storage hardware, obtaining a decryption key pre-stored in the mobile storage hardware; processing the decryption key to obtain a key dictionary; obtaining original file information; and using the key dictionary to perform encryption and decryption processing on the original file information. In the present disclosure, the mobile storage hardware is used as a hardware tool for encryption key authorization of encryption software, which can fully play the encryption lock function while not destroying its original storage function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer processing technology, and in particular to a file encryption / decryption method, system, device, and storage medium. Background Technology

[0002] Currently, with the development of communication technology, data encryption and decryption technology is being used more and more widely.

[0003] Currently, the most common hardware storage method for encryption keys is the dongle mode, also known as the security key mode. A dongle is an intelligent tool provided to software developers for software protection. It consists of hardware installed on a computer's parallel port or USB port, and a set of interface software and tools compatible with various languages. Dongles provide hardware-based protection, aiming to prevent the unauthorized use of intellectual property by protecting software and data.

[0004] The dongle mode requires additional dongle hardware and can only be used as a key. It also requires an additional external hard drive to store the data. Summary of the Invention

[0005] To address the aforementioned technical problems, embodiments of this disclosure provide a file encryption / decryption method, system, device, and storage medium. By using mobile storage hardware as a hardware tool for encryption keys authorized by encryption software, the encryption key function can be fully utilized without compromising its original storage function.

[0006] In a first aspect, embodiments of this disclosure provide a file encryption / decryption method, including:

[0007] In response to an operation on the mobile storage hardware, a decryption key pre-stored in the mobile storage hardware is obtained;

[0008] The decryption key is processed to obtain a key dictionary;

[0009] Obtain the original file information;

[0010] The original file information is encrypted and decrypted using the key dictionary.

[0011] Secondly, embodiments of this disclosure provide a file encryption / decryption apparatus, including:

[0012] The decryption key acquisition module is used to acquire the decryption key pre-stored in the mobile storage hardware in response to an operation on the mobile storage hardware.

[0013] A key dictionary determination module is used to process the decryption key to obtain a key dictionary;

[0014] The original file information acquisition module is used to acquire original file information;

[0015] The encryption / decryption processing module is used to encrypt and decrypt the original file information using the key dictionary.

[0016] Thirdly, embodiments of this disclosure provide an electronic device, the electronic device comprising:

[0017] One or more processors;

[0018] Storage device for storing one or more programs;

[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the file encryption / decryption method as described in any of the first aspects above.

[0020] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the file encryption / decryption method as described in any one of the first aspects above.

[0021] This disclosure relates to a file encryption / decryption method, apparatus, device, and storage medium. The method includes: in response to an operation on mobile storage hardware, obtaining a pre-stored decryption key in the mobile storage hardware; processing the decryption key to obtain a key dictionary; obtaining original file information; and using the key dictionary to encrypt / decrypt the original file information. In this disclosure, mobile storage hardware is used as an encryption key hardware tool for encryption software authorization, which can fully utilize the encryption key function without compromising its original storage function. Attached Figure Description

[0022] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0023] Figure 1 This is a flowchart illustrating a file encryption / decryption method according to an embodiment of the present invention;

[0024] Figure 2 This is a flowchart illustrating a file encryption method according to an embodiment of the present invention;

[0025] Figure 3 This is a flowchart illustrating a file decryption method according to an embodiment of the present invention;

[0026] Figure 4 This is a schematic diagram of the structure of a file encryption / decryption device according to an embodiment of this disclosure;

[0027] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. Detailed Implementation

[0028] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0029] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0030] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0031] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0032] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0033] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0034] Figure 1 This is a flowchart illustrating a file encryption / decryption method according to an embodiment of the present disclosure. This embodiment is applicable to data encryption and decryption. The method can be executed by a file encryption / decryption device, which can be implemented in software and / or hardware. The file encryption / decryption device is configured in an electronic device or server.

[0035] It is understood that the electronic device may include, but is not limited to: mobile phone, site, unit, device, multimedia computer, multimedia tablet, Internet node, communicator, desktop computer, laptop computer, notebook computer, netbook computer, tablet computer, personal communication system (PCS) device, personal navigation device, personal digital assistant (PDA), audio / video player, digital camera / camcorder, positioning device, television receiver, radio broadcast receiver, e-book device, gaming device, or any combination thereof, including accessories and peripherals of these devices, or any combination thereof.

[0036] It is understood that the server can be a single server, a server cluster, or a cloud server, with servers within a server cluster connected via wired or wireless networks. A server cluster can be centralized, such as in a data center, or it can be distributed. Servers can be local or remote. Servers can communicate with electronic devices via wired or wireless networks. The embodiments of this disclosure do not limit the hardware or software systems of the server.

[0037] like Figure 1 As shown, the file encryption and decryption method provided in this embodiment mainly includes steps S101-S104.

[0038] S101. In response to an operation on the mobile storage hardware, obtain the decryption key pre-stored in the mobile storage hardware.

[0039] In one embodiment of this disclosure, the portable storage hardware may be referred to as a portable hard drive or mobile hard drive, meaning a small and portable hard drive storage device that can be plugged in or unplugged at any time. The portable storage hardware can connect to the aforementioned electronic device via a USB, IEEE 1394 interface, or cSATA portable hard drive interface. The electronic device can operate on the files or data stored in the portable storage hardware, including conventional operations such as creating new files, editing file content, and deleting files.

[0040] In one embodiment of this disclosure, operating the mobile storage hardware can be understood as selecting the mobile storage hardware. Further, the operation on the mobile storage hardware may include selecting an identifier for the mobile storage hardware included in the display interface of the electronic device. The identifier for the mobile storage hardware may be the name of the mobile storage hardware, or a mobile storage hard drive identifier, etc. The selection operation can be any of the following: a click operation, a double-click operation, a right-click followed by displaying a secondary list, a click operation on the selection controls displayed in the secondary list, or an operation using a preset shortcut key.

[0041] The decryption key refers to a private key that is pre-stored in the mobile storage hardware and can be obtained by operating the mobile storage hardware.

[0042] In one embodiment of this disclosure, the decryption key is a decryption key obtained by encrypting the serial number of the mobile storage hardware using a public key.

[0043] In one embodiment of this disclosure, the method for generating the decryption key includes: obtaining a first serial number of the mobile storage hardware; obtaining a preset number of random numbers as encryption / decryption keys; receiving a first password input by a user; using the first serial number, the encryption / decryption keys, and the first password as a key dictionary; encrypting the key dictionary to obtain a decryption key; and storing the decryption key in the mobile storage hardware.

[0044] The serial number, also known as the "machine code," is generally a globally unique identifier for electronic products. The first serial number refers to the serial number of the mobile storage hardware obtained during the generation of the decryption key. The preset number can be set according to actual needs; optionally, the preset number is 16. The user-input password refers to the custom password entered by the user during the generation of the decryption key; any characters entered by the user can be used as the first password.

[0045] In one embodiment of this disclosure, encrypting the key dictionary to obtain a decryption key includes: encrypting the key dictionary using the public key in a first encryption / decryption algorithm to obtain a decryption key.

[0046] The first encryption / decryption algorithm can be the SM2 national standard asymmetric encryption algorithm.

[0047] In this embodiment, in response to a user selecting a corresponding mobile storage hardware, a unique serial number, denoted as SN, is obtained through an authorization program. A 16-bit random number (combining numbers and letters) is obtained using a random algorithm and used as the encryption / decryption key for SM4 national standard symmetric encryption, denoted as SM4PWD. A user-inputted custom password, denoted as PWD, is obtained. SN, SM4PWD, and PWD are used as a key dictionary, and the key dictionary is encrypted using the public key of the SM2 national standard asymmetric encryption algorithm to obtain the decryption key. The decryption key is obtained as follows: KEY = SM2([SN, SM4RND, PWD]). The generated decryption key is then written into the mobile storage hardware.

[0048] S102. Process the decryption key to obtain a key dictionary.

[0049] In one embodiment of this disclosure, processing the decryption key to obtain a key dictionary includes: decrypting the decryption key using the private key in a first encryption / decryption algorithm to obtain the key dictionary.

[0050] In this embodiment of the disclosure, the private key in the first encryption and decryption algorithm is used to decrypt KEY = SM2([SN,SM4RND,PWD]) to obtain a key dictionary.

[0051] S103. Obtain the original file information.

[0052] In this embodiment of the disclosure, the original file information is a file or data that needs to be encrypted or decrypted and stored in the mobile storage hardware.

[0053] The process of obtaining original file information includes: in response to a user's selection of an original file, obtaining the original file information corresponding to the selection operation.

[0054] S104. Use the key dictionary to encrypt and decrypt the original file information.

[0055] In one embodiment of this disclosure, if the original file information needs to be encrypted, a key dictionary is used to encrypt the original file information. If the original file information needs to be decrypted, a key dictionary is used to decrypt the original file information.

[0056] This disclosure relates to a file encryption / decryption method, which includes: obtaining a first serial number of a mobile storage hardware; obtaining a preset number of random numbers as an encryption / decryption key; receiving a first password input by a user; using the first serial number, the encryption / decryption key, and the first password as a key dictionary; encrypting the key dictionary to obtain a decryption key; and storing the decryption key in the mobile storage hardware. In response to an operation on the mobile storage hardware, the method obtains a pre-stored decryption key in the mobile storage hardware; processes the decryption key to obtain a key dictionary; obtains original file information; and uses the key dictionary to encrypt / decrypt the original file information. In this embodiment, based on the obtained serial number, random numbers, and custom password of the mobile storage hardware, a decryption key is obtained after encryption. The decryption key is stored in the mobile storage hardware. When a user needs to perform encryption / decryption, they only need to operate the mobile storage hardware to obtain the key dictionary corresponding to the decryption key, and then use the key dictionary to encrypt / decrypt the original file information stored in the mobile storage hardware. This embodiment uses mobile storage hardware as an encryption key hardware tool authorized by encryption software, which can fully utilize the encryption key function without damaging its original storage function.

[0057] In one embodiment of this disclosure, a file encryption method is provided. For example... Figure 2 As shown, the file encryption method provided in this disclosure mainly includes:

[0058] S201. Verify the original file information using the key dictionary.

[0059] In this embodiment of the disclosure, verifying the original file information is to ensure data security. Verifying the original file information includes: verifying whether the serial number included in the key dictionary matches the serial number of the mobile storage hardware corresponding to the current operation, and whether the password entered by the current user matches the user-defined password stored in the key dictionary.

[0060] In one embodiment of this disclosure, verifying the original file information using the key dictionary includes: obtaining a second serial number of the mobile storage hardware; comparing the second serial number of the mobile storage hardware with a first serial number included in the key dictionary; if the second serial number and the first serial number match, receiving a second password input by the user; comparing the second password with a first password included in the key dictionary; if the second password and the first password match, the verification is successful.

[0061] The second serial number refers to the serial number of the mobile storage hardware corresponding to the operation in step S101. The second serial number of the mobile storage hardware is compared with the first serial number included in the key dictionary. If the second serial number matches the first serial number, the second password input by the user is received. The second password currently input by the user is compared with the first password included in the key dictionary. If the second password matches the first password, the verification is successful.

[0062] If the second serial number does not match the first serial number, or the second password does not match the first password, the verification fails. If the verification fails, the process stops, the original file is not processed, and the user is shown a message indicating that the verification failed.

[0063] In this embodiment of the disclosure, step one, "comparing the second serial number with the first serial number", and step two, "comparing the second password with the first password", are not sequential. Step one can be executed first, followed by step two; or step two can be executed first, followed by step one; or both steps can be executed simultaneously. This embodiment of the disclosure does not limit the order of the two steps.

[0064] S202. If the verification is successful, obtain the original file metadata through the original file path.

[0065] In one embodiment of this disclosure, when the original file is a file to be encrypted, the original file information includes: the original file path, the original file name, and the original file information digest. After successful verification, the original file metadata is obtained by acquiring the original file path.

[0066] The original file path can be entered by the user.

[0067] S203. Add the original file name and the original file information summary to the original file metadata to obtain the original file data.

[0068] In the embodiments of this disclosure, the file name and file MD5 are appended to the file metadata to obtain the original file data.

[0069] 204. Use the encryption and decryption keys in the key dictionary to encrypt the original file data to obtain an encrypted file.

[0070] In this embodiment of the disclosure, a method for encrypting original file information using a key dictionary is provided. After the original file information is verified by the key dictionary, it is encrypted, thereby realizing the encryption of the original file and improving the security of the file.

[0071] In one embodiment of this disclosure, a file encryption method is provided. For example... Figure 3 As shown, the file decryption method provided in this disclosure mainly includes:

[0072] S301. Verify the original file information using the key dictionary.

[0073] The execution flow of step S301 in this embodiment is the same as that of step S201 in the above embodiment. For details, please refer to the description in the above embodiment. It will not be repeated in this embodiment.

[0074] S302. If the verification is successful, the original file is decrypted using the encryption and decryption keys in the key dictionary to obtain the original file data.

[0075] In this embodiment of the disclosure, after successful verification, the original file is decrypted using the encryption / decryption keys in the key dictionary to obtain the original file metadata.

[0076] S303. Obtain the original file name from the original file metadata.

[0077] S304. Restore the file to be decrypted using the original file name to obtain the decrypted file.

[0078] In this embodiment of the disclosure, if the verification passes, the file to be decrypted is restored using the original file name to obtain the decrypted file.

[0079] In one embodiment of this disclosure, before restoring the file to be decrypted using the original file name to obtain the decrypted file, the method further includes: obtaining an original file information digest through the original file data; verifying that the file to be decrypted has been tampered with using the original file information digest; and if the file to be decrypted has not been tampered with, then performing the step of restoring the file to be decrypted using the original file name to obtain the decrypted file.

[0080] In this embodiment, the MD5 hash of the original file is obtained through the file metadata. The MD5 hash is then used to verify whether the file to be decrypted has been tampered with. If the verification passes, the file to be decrypted is restored using the original filename, resulting in the decrypted file.

[0081] In this embodiment of the disclosure, a method for decrypting original file information using a key dictionary is provided. After the original file information is verified by the key dictionary, decryption is performed, thereby realizing the decryption of the original file and improving the security of the file.

[0082] Figure 4 This is a schematic diagram of a file encryption / decryption device according to an embodiment of the present disclosure. This embodiment is applicable to the case of encrypting and decrypting data. The file encryption / decryption device can be implemented in software and / or hardware.

[0083] like Figure 4 As shown, the file encryption / decryption device 40 provided in this embodiment includes: a decryption key acquisition module 41, a key dictionary determination module 42, an original file information acquisition module 43, and an encryption / decryption processing module 44.

[0084] The decryption key acquisition module 41 is used to acquire a pre-stored decryption key in the mobile storage hardware in response to an operation on the mobile storage hardware; the key dictionary determination module 42 is used to process the decryption key to obtain a key dictionary; the original file information acquisition module 43 is used to acquire the original file information; and the encryption / decryption processing module 44 is used to encrypt and decrypt the original file information using the key dictionary.

[0085] In one embodiment of this disclosure, the device further includes: a first serial number acquisition module, configured to acquire a first serial number of the mobile storage hardware; an encryption / decryption key determination module, configured to acquire a preset number of random numbers as encryption / decryption keys; a first password receiving module, configured to receive a first password input by a user; a key dictionary acquisition module, configured to use the first serial number, the encryption / decryption keys, and the first password as a key dictionary; a decryption key determination module, configured to encrypt the key dictionary to obtain a decryption key; and a decryption key storage module, configured to store the decryption key in the mobile storage hardware.

[0086] In one embodiment of this disclosure, the decryption key determination module is specifically used to encrypt the key dictionary using the public key in the first encryption / decryption algorithm to obtain the decryption key; the key dictionary determination module 42 is specifically used to decrypt the decryption key using the private key in the first encryption / decryption algorithm to obtain the key dictionary.

[0087] In one embodiment of this disclosure, when the original file is a file to be encrypted, the original file information includes: original file path, original file name, and original file information digest; the encryption / decryption processing module 44 includes: a key dictionary verification unit, used to verify the original file information using the key dictionary; a metadata acquisition unit, used to acquire the original file metadata through the original file path if the verification is successful; a file data determination unit, used to add the original file name and the original file information digest to the original file metadata to obtain the original file data; and an encryption unit, used to encrypt the original file data using the encryption / decryption keys in the key dictionary to obtain an encrypted file.

[0088] In one embodiment of this disclosure, when the original file is a file to be decrypted, the encryption / decryption processing module 44 includes: a key dictionary verification unit, used to verify the original file information using the key dictionary; a file data determination unit, used to decrypt the original file using the encryption / decryption key in the key dictionary if the verification is successful, to obtain the original file data; a file name determination unit, used to obtain the file name from the original file data; and a decryption / restore unit, used to restore the file to be decrypted using the original file name, to obtain the decrypted file.

[0089] In one embodiment of this disclosure, the encryption / decryption processing module 44 further includes: a message digest acquisition module, used to acquire an original file message digest from the original file data before restoring the file to be decrypted using the original file name to obtain the decrypted file; a tampering verification unit, used to verify that the file to be decrypted has been tampered with using the original file message digest; and a decryption restoration unit, specifically used to perform the step of restoring the file to be decrypted using the original file name to obtain the decrypted file if the file to be decrypted has not been tampered with.

[0090] In one embodiment of this disclosure, the key dictionary verification unit includes: a first serial number acquisition subunit, configured to acquire a second serial number of the mobile storage hardware; a serial number comparison subunit, configured to compare the second serial number of the mobile storage hardware with a first serial number included in the key dictionary; a second password receiving subunit, configured to receive a second password input by a user if the second serial number and the first serial number are consistent; a password comparison subunit, configured to compare the second password with a first password included in the key dictionary; and a verification pass subunit, configured to verify if the second password is consistent with the first password.

[0091] The file encryption / decryption apparatus provided in this disclosure embodiment can execute the steps performed in the file encryption / decryption method provided in this disclosure method embodiment, and has the execution steps and beneficial effects, which will not be repeated here.

[0092] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. See below for details. Figure 5 The diagram illustrates a structural schematic suitable for implementing the electronic device 500 in the embodiments of this disclosure. The electronic device 500 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), wearable terminal devices, etc., as well as fixed terminals such as digital TVs, desktop computers, smart home devices, etc. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0093] like Figure 5As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503 to implement the file encryption and decryption methods as described in the embodiments of this disclosure. The RAM 503 also stores various programs and data required for the operation of the electronic device 500. The processing device 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0094] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0095] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts, thereby implementing the file encryption / decryption methods as described above. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0096] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0097] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0098] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0099] The aforementioned computer-readable medium carries one or more programs, which, when executed by the terminal device, cause the terminal device to: in response to an operation on the mobile storage hardware, obtain a pre-stored decryption key in the mobile storage hardware; process the decryption key to obtain a key dictionary; obtain original file information; and use the key dictionary to encrypt and decrypt the original file information.

[0100] Optionally, when one or more of the above-mentioned programs are executed by the terminal device, the terminal device may also execute other steps described in the above embodiments.

[0101] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0102] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0103] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0104] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0105] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0106] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0107] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0108] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A file encryption / decryption method, characterized in that, include: In response to an operation on the mobile storage hardware, a decryption key pre-stored in the mobile storage hardware is obtained; The decryption key is processed to obtain a key dictionary; Obtain the original file information; The original file information is encrypted and decrypted using the key dictionary. When the original file is a file to be encrypted, the original file information includes: the original file path, the original file name, and the original file information digest; Encrypting the original file information using the key dictionary includes: The original file information is verified using the key dictionary. If the verification passes, obtain the original file metadata using the original file path; The original file name and the original file information digest are added to the original file metadata to obtain the original file data; The original file data is encrypted using the encryption and decryption keys in the key dictionary to obtain an encrypted file; The method for generating the decryption key includes: Obtain the first serial number of the mobile storage hardware; Obtain a preset number of random numbers as the encryption / decryption key; Receive the user's initial password; Use the first serial number, the encryption / decryption key, and the first password as a key dictionary; The key dictionary is encrypted to obtain the decryption key; The decryption key is stored in the mobile storage hardware.

2. The method according to claim 1, characterized in that, The key dictionary is encrypted to obtain the decryption key, including: The key dictionary is encrypted using the public key in the first encryption / decryption algorithm to obtain the decryption key; The decryption key is processed to obtain a key dictionary, including: The decryption key is decrypted using the private key in the first encryption / decryption algorithm to obtain the key dictionary.

3. The method according to claim 1, characterized in that, When the original file is a file to be decrypted Decrypting the original file information using the key dictionary includes: The original file information is verified using the key dictionary. If the verification is successful, the original file information is decrypted using the encryption and decryption keys in the key dictionary to obtain the original file data; Obtain the original file name from the original file data; The file to be decrypted is restored using the original file name to obtain the decrypted file.

4. The method according to claim 3, characterized in that, Before reconstructing the file to be decrypted using the original file name to obtain the decrypted file, the method further includes: Obtain a summary of the original file information from the original file data; The original file information digest is used to verify whether the file to be decrypted has been tampered with. If the file to be decrypted has not been tampered with, then the step of restoring the file to be decrypted using the original file name is performed to obtain the decrypted file.

5. The method according to claim 1 or 3, characterized in that, Verifying the original file information using the key dictionary includes: Obtain the second serial number of the mobile storage hardware; Compare the second serial number of the mobile storage hardware with the first serial number included in the key dictionary; If the second serial number matches the first serial number, then the second password entered by the user is received; Compare the second password with the first password included in the key dictionary; If the second password matches the first password, the verification is successful.

6. A file encryption / decryption device, characterized in that, include: The decryption key acquisition module is used to acquire the decryption key pre-stored in the mobile storage hardware in response to an operation on the mobile storage hardware. A key dictionary determination module is used to process the decryption key to obtain a key dictionary; The original file information acquisition module is used to acquire original file information; An encryption / decryption processing module is used to encrypt and decrypt the original file information using the key dictionary; When the original file is a file to be encrypted, the original file information includes: the original file path, the original file name, and the original file information digest; Encrypting the original file information using the key dictionary includes: The original file information is verified using the key dictionary. If the verification passes, obtain the original file metadata using the original file path; The original file name and the original file information digest are added to the original file metadata to obtain the original file data; The original file data is encrypted using the encryption and decryption keys in the key dictionary to obtain an encrypted file; The device further includes: The first serial number acquisition module is used to acquire the first serial number of the mobile storage hardware. The encryption / decryption key determination module is used to obtain a preset number of random numbers as the encryption / decryption key; The first password receiving module is used to receive the first password entered by the user. The key dictionary acquisition module is used to obtain the first serial number, the encryption / decryption key, and the first password as a key dictionary; The decryption key determination module is used to encrypt the key dictionary to obtain the decryption key; A decryption key storage module is used to store the decryption key in the mobile storage hardware.

7. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs; The one or more programs are executed by the one or more processors, such that the one or more processors implement the method as described in any one of claims 1-5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Method for ciphering file using movable storage apparatus

    CN101281495A

  • Storage medium security authentication method and device, computer equipment and storage medium

    CN110659522A