File encryption method and device, electronic equipment and storage medium

By sharding the encrypted files, disrupting the identification sequence and hardware encryption, the problem of file encryption dependence on keys is solved, and file encryption that does not depend on keys is realized, and file security and flexibility of use are improved.

CN119442257AActive Publication Date: 2025-02-14CHINA MOBILE GRP FUJIAN CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202310970500.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-03
Publication Date
2025-02-14
Estimated Expiration
2043-08-03

AI Technical Summary

Technical Problem

In the prior art, file encryption relies on keys, and loss or leakage of keys can lead to huge losses.

Method used

By sharding the encrypted files, generating and disrupting the identification sequence, combining hardware encryption and recombining files, encrypted files are generated to avoid dependence on keys.

Benefits of technology

It implements encryption of files without relying on keys, improving file security and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119442257A_ABST
    Figure CN119442257A_ABST
Patent Text Reader

Abstract

The invention provides a file encryption method and device, electronic equipment and a storage medium, and relates to the technical field of encryption. The method comprises the steps that a to-be-encrypted file is fragmented to obtain a plurality of file fragments, and the file fragments have corresponding identifiers; generating a first identifier sequence according to the position of each file fragment in the to-be-encrypted file and the corresponding identifier; based on the disorganized first identification sequence, recombining the corresponding file fragments to obtain a recombined file; calling hardware corresponding to a preset hardware identifier, and performing hardware encryption on the disorganized first identifier sequence to obtain an encrypted second identifier sequence; and determining an encrypted file corresponding to the to-be-encrypted file according to the encrypted second identifier sequence, the length of the file fragment, the preset hardware identifier and the recombined file. Therefore, the to-be-encrypted file can be encrypted without depending on a key.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of encryption technology, and in particular to a file encryption method, device, electronic device and storage medium. Background Art

[0002] As the application of the Internet and information technology penetrates into all aspects of people's lives, people's requirements for information security are getting higher and higher. How to safely store some confidential files in storage devices and how to effectively encrypt and decrypt files have become an important research direction in the field of information security.

[0003] In the related art, encryption and decryption of files require an encryption algorithm (generally a symmetric encryption algorithm) and an encryption and decryption password (referred to as a key). When encrypting, the key and the selected symmetric encryption algorithm are used to encrypt the file, and when decrypting, the key and the symmetric encryption algorithm used during encryption are used to decrypt. After encrypting a file in the above manner, there will be a strong dependence on the key. Without the key, the encrypted file cannot be decrypted, and the file cannot be used. For the file owner, the loss or leakage of the key will cause huge losses. Summary of the invention

[0004] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.

[0005] The first embodiment of the present disclosure provides a file encryption method, including:

[0006] Slice the file to be encrypted to obtain multiple file segments, wherein the file segments have corresponding identifiers;

[0007] Generate a first identification sequence according to the position of each file segment in the file to be encrypted and the corresponding identification;

[0008] Based on the scrambled first identification sequence, reorganize the corresponding file fragments to obtain a reorganized file;

[0009] Calling hardware corresponding to a preset hardware identifier to perform hardware encryption on the scrambled first identifier sequence to obtain an encrypted second identifier sequence;

[0010] An encrypted file corresponding to the file to be encrypted is determined according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reassembled file.

[0011] The second aspect of the present disclosure provides a file encryption device, including:

[0012] A first acquisition module is used to perform fragmentation processing on the file to be encrypted to obtain multiple file fragments, wherein the file fragments have corresponding identifiers;

[0013] A generating module, used for generating a first identification sequence according to the position of each file segment in the file to be encrypted and the corresponding identification;

[0014] A second acquisition module is used to reorganize the corresponding file fragments based on the scrambled first identification sequence to obtain a reorganized file;

[0015] A third acquisition module is used to call the hardware corresponding to the preset hardware identification, and perform hardware encryption on the scrambled first identification sequence to obtain an encrypted second identification sequence;

[0016] The determination module is used to determine the encrypted file corresponding to the file to be encrypted according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reassembled file.

[0017] The third aspect of the present disclosure proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the file encryption method proposed in the first aspect of the present disclosure is implemented.

[0018] The fourth aspect embodiment of the present disclosure proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the file encryption method proposed in the first aspect embodiment of the present disclosure is implemented.

[0019] The file encryption method, device, electronic device and storage medium provided by the present disclosure have the following beneficial effects:

[0020] In the disclosed embodiment, the file to be encrypted is firstly segmented to obtain a plurality of file fragments, wherein the file fragments have corresponding identifiers, and then a first identifier sequence is generated according to the position of each file fragment in the file to be encrypted and the corresponding identifier, and then the corresponding file fragments are reorganized based on the scrambled first identifier sequence to obtain a reorganized file, and the hardware corresponding to the preset hardware identifier is called to perform hardware encryption on the scrambled first identifier sequence to obtain an encrypted second identifier sequence, and finally, the encrypted file corresponding to the file to be encrypted is determined according to the encrypted second identifier sequence, the length of the file fragment, the preset hardware identifier and the reorganized file. Thus, the scrambled order of the file to be encrypted is reorganized, and an encrypted file is generated by combining the scrambled first identifier sequence after hardware encryption, the length of the file fragment, and the preset hardware identifier, so that the file to be encrypted can be encrypted without relying on a key.

[0021] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0023] Figure 1 A flowchart of a file encryption method provided by an embodiment of the present disclosure;

[0024] Figure 2 A flowchart of a file encryption method provided by another embodiment of the present disclosure;

[0025] Figure 3 A flowchart of a file encryption method provided by another embodiment of the present disclosure;

[0026] Figure 4 A schematic diagram of the structure of a file encryption device provided by another embodiment of the present disclosure;

[0027] Figure 5 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0028] Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0029] The following describes the file encryption method, device, electronic device and storage medium according to the embodiments of the present disclosure with reference to the accompanying drawings.

[0030] Figure 1 A flowchart of a file encryption method provided in an embodiment of the present disclosure.

[0031] The embodiment of the present disclosure takes the file encryption method being configured in a file encryption device as an example. The file encryption device can be applied to any electronic device so that the electronic device can perform a file encryption function.

[0032] Among them, the electronic device can be a personal computer (PC), a cloud device, a mobile device, etc. The mobile device can be, for example, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a car device, etc., which are hardware devices with various operating systems, touch screens and / or display screens.

[0033] like Figure 1 As shown, the file encryption method may include the following steps:

[0034] Step 101: Segment the file to be encrypted to obtain multiple file segments, wherein the file segments have corresponding identifiers.

[0035] Optionally, the file to be encrypted may be fragmented based on a preset number of fragments, for example, the preset number of fragments may be 100, 200, 250, etc. This disclosure does not limit this.

[0036] Optionally, the file to be encrypted may be processed by even slicing or uneven slicing, which is not limited in the present disclosure.

[0037] The identifier corresponding to each file segment may be the position of the file segment in the file to be encrypted. For example, the identifier corresponding to the first file segment of the file to be encrypted may be 1 or 0, and the identifier corresponding to the second file segment may be 2 or 1.

[0038] Optionally, before the file to be encrypted is segmented to obtain multiple file segments, the file to be encrypted may be converted into a bit array form.

[0039] Step 102: Generate a first identification sequence according to the position of each file segment in the file to be encrypted and the corresponding identification.

[0040] For example, the file segment identified as 1 is located at the first file segment in the file to be encrypted, and the file segment identified as 2 is located at the second file segment in the file to be encrypted, and the first identification sequence may be [1, 2, 3, ..., n], where n is the number of file segments.

[0041] Alternatively, the file segment identified as 0 is located at the first file segment in the file to be encrypted, and the file segment identified as 1 is located at the second file segment in the file to be encrypted, and the first identification sequence may also be [0, 1, 2, ..., n-1], where n is the number of file segments.

[0042] Step 103: reorganize the corresponding file segments based on the scrambled first identification sequence to obtain a reorganized file.

[0043] Specifically, the first identification sequence is randomly shuffled first, and then based on the shuffled first identification sequence, the corresponding file segments are reorganized to obtain a reorganized file.

[0044] For example, the first identification sequence is [1, 2, 3, 4, ..., 200], and the shuffled first identification sequence may be [42, 80, 1, 5, 3, ..., 2, 4], or [15, 30, 5, 3, ..., 20, 140], etc. This disclosure does not limit this.

[0045] If the scrambled first identification sequence can be [42, 80, 1, 5, 3, ..., 2, 4], then the first file fragment in the reassembled file is the file fragment identified as 42 in the file to be encrypted, the second file fragment in the reassembled file is the file fragment identified as 80 in the file to be encrypted, and so on.

[0046] In some possible implementations, after obtaining the reorganized file, the reorganized file may be completely inverted, thereby further ensuring the security of the file to be encrypted.

[0047] Step 104 , calling the hardware corresponding to the preset hardware identification, and performing hardware encryption on the scrambled first identification sequence to obtain an encrypted second identification sequence.

[0048] The second identification sequence may be a scrambled first identification sequence.

[0049] The preset hardware identifier may be an identifier of the hardware that is pre-set to perform hardware encryption on the encrypted file. For example, the preset hardware identifier may be a product serial number (Serial Number, SN) of the hardware, etc. This disclosure does not limit this.

[0050] Hardware encryption is generally implemented through dedicated encryption chips or security modules (i.e.). These chips or modules integrate encryption algorithms and key management functions in hardware, and can directly encrypt and decrypt data at the hardware level. Hardware encryption often uses symmetric encryption algorithms (such as the Advanced Encryption Standard) or asymmetric encryption algorithms (such as the RSA encryption algorithm).

[0051] It should be noted that in the embodiment of the present disclosure, there is no specific limitation on the order of implementing step 103 and step 104. Step 103 can be performed first, or step 104 can be performed first, and the present disclosure does not limit this.

[0052] Step 105, determining the encrypted file corresponding to the file to be encrypted according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reorganized file.

[0053] In the disclosed embodiment, after the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reorganized file are determined, the encrypted file corresponding to the file to be encrypted can be determined.

[0054] Specifically, we can first determine the byte lengths occupied by the encrypted second identification sequence, the length of the file fragment, the preset hardware identification and the reassembled file, and their arrangement order in the encrypted file. Then, based on the byte length and arrangement order, we can reassemble the encrypted second identification sequence, the length of the file fragment, the preset hardware identification and the reassembled file to obtain the encrypted file.

[0055] The encrypted second identification sequence, the length of the file segment, and the byte length occupied by the preset hardware identification may be predetermined. The encrypted second identification sequence, the length of the file segment, and the byte length occupied by the preset hardware identification may be the same or different. This disclosure does not limit this.

[0056] The arrangement order may also be predefined, for example, the arrangement order is the encrypted second identification sequence, the preset hardware identification, the length of the file segment, and the reorganized file.

[0057] For example, if the byte length occupied by the preset encrypted second identification sequence is 500 bytes, the byte length occupied by the length of the file fragment is 2 bytes, and the byte length occupied by the preset hardware identification is 4 bytes, and the arrangement order is the encrypted second identification sequence, the preset hardware identification, the length of the file fragment, and the reconstructed file, then bytes 1-500 are the encrypted second identification sequence, bytes 501-504 are the preset hardware identification, bytes 505-506 are the length of the file fragment, and the remaining bytes are the reconstructed file.

[0058] In the disclosed embodiment, the file to be encrypted is firstly segmented to obtain a plurality of file fragments, wherein the file fragments have corresponding identifiers, and then a first identifier sequence is generated according to the position of each file fragment in the file to be encrypted and the corresponding identifier, and then the corresponding file fragments are reorganized based on the scrambled first identifier sequence to obtain a reorganized file, and the hardware corresponding to the preset hardware identifier is called to perform hardware encryption on the scrambled first identifier sequence to obtain an encrypted second identifier sequence, and finally, the encrypted file corresponding to the file to be encrypted is determined according to the encrypted second identifier sequence, the length of the file fragment, the preset hardware identifier and the reorganized file. Thus, the scrambled order of the file to be encrypted is reorganized, and an encrypted file is generated by combining the scrambled first identifier sequence after hardware encryption, the length of the file fragment, and the preset hardware identifier, so that the file to be encrypted can be encrypted without relying on a key.

[0059] Figure 2 A flowchart of a file encryption method provided by an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the file encryption method may include the following steps:

[0060] Step 201 : Segment the file to be encrypted to obtain a plurality of file segments, wherein the file segments have corresponding identifiers.

[0061] Step 202: Generate a first identification sequence according to the position of each file segment in the file to be encrypted and the corresponding identification.

[0062] Step 203: reorganize the corresponding file segments based on the scrambled first identification sequence to obtain a reorganized file.

[0063] Step 204 , calling the hardware corresponding to the preset hardware identification, and performing hardware encryption on the scrambled first identification sequence to obtain an encrypted second identification sequence.

[0064] The specific implementation forms of steps 201 and 204 can refer to the detailed descriptions in other embodiments of the present disclosure and will not be described in detail here.

[0065] Step 205 , converting the encrypted second identification sequence, the length of the file segment, and the preset hardware identification into target formats respectively.

[0066] The target format may be a TLV format or other formats, which is not limited in the present disclosure.

[0067] Among them, TLV (Type-Length-Value) is a common format for data encoding and encapsulation. Its structure consists of three parts:

[0068] (1) Type: Indicates the type or identifier of the data. Usually represented by one byte, it defines the meaning of the subsequent fields.

[0069] (2) Length: Indicates the length of the subsequent value field. The length can be fixed or variable. The size of the length field can use different numbers of bytes depending on the requirements.

[0070] (3) Value: Contains the actual data content. Its length is determined by the length field.

[0071] For example, the target format corresponding to the encrypted second identification sequence may be F1+03E8+encrypted second identification sequence, where F1 is the type, indicating the second identification sequence, and 03E8 is the length, indicating the byte length occupied by the encrypted second identification sequence.

[0072] For example, if the length of the file segment is 254, the target format corresponding to the length of the file segment may be F2+00 01+FE, where F2 is the type, indicating the length of the file segment, 00 01 is the length, indicating that the length of the file segment occupies 1 byte, and FE indicates 254 of the length of the file segment.

[0073] For example, if the preset hardware identifier is 01 02 03 04, the corresponding target format may be F3+04+0102 03 04. Among them, F3 is the type, indicating the preset hardware identifier, 04 is the length, indicating that the byte length occupied by the preset hardware identifier is 4, and 01 02 03 04 indicates the preset hardware identifier.

[0074] Step 206, the encrypted second identification sequence of the target format, the length of the file segment of the target format, the preset hardware identification of the target format, and the reorganized file are reorganized in sequence to obtain an encrypted file.

[0075] Optionally, you can first determine the first byte length occupied by the encrypted second identification sequence of the target format, the second byte length occupied by the length of the file fragment of the target format, and the third byte length occupied by the preset hardware identification of the target format, and then determine the target total byte length corresponding to the encrypted file based on the first byte length, the second byte length, the third byte length and the fourth byte length occupied by the file to be encrypted, and then create a new empty file based on the target total byte length, and finally add the encrypted second identification sequence of the target format, the length of the file fragment of the target format, the preset hardware identification of the target format, and the reorganized file to the empty file in sequence to obtain the encrypted file.

[0076] For example, if the first byte length is 1000, the second byte length is 4, the third byte length is 6, and the fourth byte length is 5000, the target total byte length is 6010. That is, the newly created empty file can store 6010 bytes of content.

[0077] In some embodiments, a file name corresponding to the new file may also be generated based on preset rules.

[0078] In the disclosed embodiment, after obtaining the encrypted second identification sequence, the length of the file fragment, and the preset hardware identification, the encrypted second identification sequence, the length of the file fragment, and the preset hardware identification can be converted into the target format respectively, and finally the encrypted second identification sequence in the target format, the length of the file fragment in the target format, the preset hardware identification in the target format, and the reassembled file are reassembled in sequence to obtain the encrypted file. In this way, the content of each part in the encrypted file can be accurately determined, providing support for decryption.

[0079] Figure 3A flowchart of a file encryption method provided by an embodiment of the present disclosure is shown in FIG. Figure 3 As shown, the file encryption method may include the following steps:

[0080] Step 301, obtaining the performance corresponding to the hardware.

[0081] Step 302: Determine the number of shards based on performance.

[0082] It should be noted that the performance corresponding to the hardware can be the processing power corresponding to the hardware. The processing power corresponding to the hardware is different, and the corresponding number of shards is different. The stronger the processing power of the hardware, the more corresponding shards.

[0083] Step 303: Based on the number of shards, the file to be encrypted is evenly sharded to obtain file segments of the number of shards.

[0084] In the disclosed embodiment, the file to be encrypted can be evenly segmented, so that only the length corresponding to one file segment needs to be stored in the subsequent encrypted file, thereby saving storage space.

[0085] It should be noted that, since the file to be encrypted is evenly fragmented, the length of the corresponding last file fragment may be different from the lengths of other file fragments.

[0086] Step 304: Generate a first identifier sequence according to the position of each file fragment in the file to be encrypted and the corresponding identifier, wherein, when the length of the last file fragment among the multiple file fragments is greater than 0 and is not equal to the lengths of other file fragments, the last file fragment does not have a corresponding identifier.

[0087] In the disclosed embodiment, if the length of the last file segment among the multiple file segments is greater than 0 and is not equal to the lengths of other file segments, the last file segment does not have a corresponding identifier. Therefore, when the file segments are subsequently reassembled, the last file segment can be ignored, and only the file segments with the same length can be reassembled.

[0088] Step 305: reorganize the corresponding file segments based on the scrambled first identification sequence to obtain a reorganized file.

[0089] Step 306: Add the last file segment to the end of the reassembled file.

[0090] In the disclosed embodiment, since the last file fragment does not participate in the reorganization, the reorganized file generated in step 305 does not contain the last file fragment, so the last file fragment needs to be added to the end of the reorganized file to avoid the reorganized file losing the content of the file to be encrypted.

[0091] Step 307 , calling the hardware corresponding to the preset hardware identification, and performing hardware encryption on the scrambled first identification sequence to obtain an encrypted second identification sequence.

[0092] Step 308: Determine the encrypted file corresponding to the file to be encrypted according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reorganized file.

[0093] In the embodiment of the present disclosure, when the length of the last file fragment among multiple file fragments is greater than 0 and is not equal to the lengths of other file fragments, the corresponding identifier may not be configured for the last file fragment, so that when the file fragments are reassembled to obtain the reassembled file, the last file fragment does not need to be considered, and the last file fragment is added to the end of the reassembled file, so that only the length of one file fragment needs to be stored in the encrypted file, thereby improving the speed of file encryption and reducing the storage content of the encrypted file.

[0094] In order to implement the above embodiment, the present disclosure also proposes a file encryption device.

[0095] Figure 4 A schematic diagram of the structure of a file encryption device provided in an embodiment of the present disclosure.

[0096] like Figure 4 As shown, the file encryption device 400 may include:

[0097] A first acquisition module 410 is used to perform fragmentation processing on the file to be encrypted to obtain multiple file fragments, wherein the file fragments have corresponding identifiers;

[0098] A generating module 420, configured to generate a first identification sequence according to the position of each file segment in the file to be encrypted and the corresponding identification;

[0099] A second acquisition module 430 is used to reorganize the corresponding file segments based on the scrambled first identification sequence to obtain a reorganized file;

[0100] The third acquisition module 440 is used to call the hardware corresponding to the preset hardware identification, and perform hardware encryption on the scrambled first identification sequence to obtain an encrypted second identification sequence;

[0101] The determination module 450 is used to determine the encrypted file corresponding to the file to be encrypted according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reorganized file.

[0102] Optionally, the determination module 450 is specifically configured to:

[0103] converting the encrypted second identification sequence, the length of the file segment, and the preset hardware identification into target formats respectively;

[0104] The encrypted second identification sequence of the target format, the length of the file segment of the target format, the preset hardware identification of the target format, and the reorganized file are reorganized in sequence to obtain the encrypted file.

[0105] Optionally, the determination module 450 is specifically configured to:

[0106] Determine a first byte length occupied by the encrypted second identification sequence of the target format, a second byte length occupied by the length of the file segment of the target format, and a third byte length occupied by the preset hardware identification of the target format;

[0107] Determine a target total byte length corresponding to the encrypted file according to the first byte length, the second byte length, the third byte length, and the fourth byte length occupied by the file to be encrypted;

[0108] Create a new empty file based on the target total byte length;

[0109] The encrypted second identification sequence of the target format, the length of the file segment of the target format, the preset hardware identification of the target format, and the reorganized file are sequentially added to the empty file to obtain the encrypted file.

[0110] Optionally, the first acquisition module 410 is specifically configured to:

[0111] Get the performance corresponding to the hardware;

[0112] Determine the number of shards based on performance;

[0113] Based on the number of shards, the file to be encrypted is evenly sharded to obtain file fragments of the number of shards.

[0114] Optionally, when the length of the last file fragment among the number of fragments of file fragments is greater than 0 and is not equal to the lengths of other file fragments, the last file fragment does not have a corresponding identifier.

[0115] Optionally, add-on modules are also included to:

[0116] Add the last file fragment to the end of the reassembled file.

[0117] Optionally, a conversion module is also included, for:

[0118] Convert the file to be encrypted into a bit array.

[0119] Optionally, a negation module is also included, for:

[0120] Negate all of the reorganized files.

[0121] The functions and specific implementation principles of the above modules in the embodiments of the present disclosure can be referred to the above method embodiments, and will not be repeated here.

[0122] The file encryption device of the disclosed embodiment first performs fragmentation processing on the file to be encrypted to obtain multiple file fragments, wherein the file fragments have corresponding identifiers, and then generates a first identifier sequence according to the position of each file fragment in the file to be encrypted and the corresponding identifier, and then reorganizes the corresponding file fragments based on the scrambled first identifier sequence to obtain a reorganized file, calls the hardware corresponding to the preset hardware identifier, performs hardware encryption on the scrambled first identifier sequence to obtain an encrypted second identifier sequence, and finally determines the encrypted file corresponding to the file to be encrypted according to the encrypted second identifier sequence, the length of the file fragment, the preset hardware identifier and the reorganized file. Thus, the scrambled order of the file to be encrypted is reorganized, and the encrypted file is generated by combining the scrambled first identifier sequence after hardware encryption, the length of the file fragment, and the preset hardware identifier, so that the file to be encrypted can be encrypted without relying on a key.

[0123] In order to implement the above embodiments, the present disclosure further proposes an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the file encryption method proposed in the above embodiments of the present disclosure is implemented.

[0124] In order to implement the above embodiments, the present disclosure further proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the file encryption method proposed in the above embodiments of the present disclosure is implemented.

[0125] Figure 5 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. Figure 5 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0126] like Figure 5 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0127] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.

[0128] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0129] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (CD-ROM), a digital versatile disc read only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present disclosure.

[0130] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0131] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0132] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the methods mentioned in the above embodiments.

[0133] The technical solution disclosed in the present invention firstly performs fragmentation processing on the file to be encrypted to obtain multiple file fragments, wherein the file fragments have corresponding identifiers, and then generates a first identifier sequence according to the position of each file fragment in the file to be encrypted and the corresponding identifier, and then reorganizes the corresponding file fragments based on the scrambled first identifier sequence to obtain a reorganized file, calls the hardware corresponding to the preset hardware identifier, performs hardware encryption on the scrambled first identifier sequence to obtain an encrypted second identifier sequence, and finally determines the encrypted file corresponding to the file to be encrypted according to the encrypted second identifier sequence, the length of the file fragment, the preset hardware identifier and the reorganized file. Thus, the scrambled order of the file to be encrypted is reorganized, and an encrypted file is generated by combining the scrambled first identifier sequence after hardware encryption, the length of the file fragment, and the preset hardware identifier, so that the file to be encrypted can be encrypted without relying on a key.

[0134] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0135] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0136] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present disclosure includes additional implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present disclosure belong.

[0137] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0138] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0139] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0140] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0141] The storage medium mentioned above may be a read-only memory, a disk or an optical disk, etc. Although the embodiments of the present disclosure have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations of the present disclosure. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present disclosure.

Claims

1. A file encryption method, characterized in that: include: Slice the file to be encrypted to obtain multiple file segments, wherein the file segments have corresponding identifiers; Generate a first identification sequence according to the position of each file segment in the file to be encrypted and the corresponding identification; Based on the scrambled first identification sequence, reorganize the corresponding file fragments to obtain a reorganized file; Calling hardware corresponding to a preset hardware identifier to perform hardware encryption on the scrambled first identifier sequence to obtain an encrypted second identifier sequence; An encrypted file corresponding to the file to be encrypted is determined according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reassembled file.

2. The method according to claim 1, characterized in that The step of determining the encrypted file corresponding to the file to be encrypted according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reassembled file includes: Converting the encrypted second identification sequence, the length of the file segment, and the preset hardware identification into target formats respectively; The encrypted second identification sequence of the target format, the length of the file segment of the target format, the preset hardware identification of the target format, and the reassembled file are reassembled in sequence to obtain the encrypted file.

3. The method according to claim 2, characterized in that The step of sequentially reassembling the encrypted second identification sequence of the target format, the length of the file segment of the target format, the preset hardware identification of the target format, and the reassembled file to obtain the encrypted file includes: Determine a first byte length occupied by the encrypted second identification sequence in the target format, a second byte length occupied by the length of the file fragment in the target format, and a third byte length occupied by the preset hardware identification in the target format; Determine a target total byte length corresponding to the encrypted file according to the first byte length, the second byte length, the third byte length, and a fourth byte length occupied by the file to be encrypted; Based on the target total byte length, create a new empty file; The encrypted second identification sequence of the target format, the length of the file segment of the target format, the preset hardware identification of the target format, and the reorganized file are sequentially added to the empty file to obtain the encrypted file.

4. The method according to claim 1, characterized in that: The file to be encrypted is segmented to obtain multiple file segments, including: Obtaining performance corresponding to the hardware; Determine the number of shards based on the performance; Based on the number of shards, the to-be-encrypted file is evenly sharded to obtain file segments of the number of shards.

5. The method according to claim 4, characterized in that In the case that the length of the last file fragment among the number of file fragments is greater than 0 and is not equal to the lengths of other file fragments, the last file fragment has no corresponding identifier.

6. The method according to claim 5, characterized in that After reorganizing the corresponding file segments based on the scrambled first identification sequence to obtain the reorganized file, the method further includes: The last file fragment is added to the end of the reassembled file.

7. The method according to any one of claims 1 to 6, characterized in that: Before the file to be encrypted is segmented to obtain multiple file segments, the method further includes: The file to be encrypted is converted into a bit array form.

8. The method according to claim 7, characterized in that Before determining the encrypted file corresponding to the to-be-encrypted file according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reassembled file, the method further includes: The reorganized file is completely negated.

9. A file encryption device, characterized in that: include: A first acquisition module is used to perform fragmentation processing on the file to be encrypted to obtain multiple file fragments, wherein the file fragments have corresponding identifiers; A generating module, used for generating a first identification sequence according to the position of each file segment in the file to be encrypted and the corresponding identification; A second acquisition module is used to reorganize the corresponding file fragments based on the scrambled first identification sequence to obtain a reorganized file; A third acquisition module is used to call the hardware corresponding to the preset hardware identification, and perform hardware encryption on the scrambled first identification sequence to obtain an encrypted second identification sequence; The determination module is used to determine the encrypted file corresponding to the file to be encrypted according to the encrypted second identification sequence, the length of the file segment, the preset hardware identification and the reassembled file.

10. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the file encryption method as claimed in any one of claims 1 to 8 is implemented.

11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the file encryption method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • File encryption method and device, file decryption method and device and storage medium

    CN111814182A

  • File encryption method and device, file decryption method and device, electronic equipment and readable storage medium

    CN111859408A

  • System and method for improving encryption performance of hardware password equipment,

    CN114036544A

  • Editing device and editing method

    CN1268847A

  • System, method and apparatus for network security monitoring, information sharing, and collective intelligence

    US10326803B1