CN113032345A - File processing method, device, terminal and non-transitory storage medium - Google Patents

File processing method, device, terminal and non-transitory storage medium Download PDF

Info

Publication number
CN113032345A
CN113032345A CN202110324791.3A CN202110324791A CN113032345A CN 113032345 A CN113032345 A CN 113032345A CN 202110324791 A CN202110324791 A CN 202110324791A CN 113032345 A CN113032345 A CN 113032345A
Authority
CN
China
Prior art keywords
file
data
encrypted
acquiring
encryption range
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110324791.3A
Other languages
Chinese (zh)
Inventor
莫铭锟
黎旋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202110324791.3A priority Critical patent/CN113032345A/en
Publication of CN113032345A publication Critical patent/CN113032345A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Abstract

The disclosure provides a method, an apparatus, a terminal and a non-transitory storage medium for file processing. The method comprises the following steps: acquiring the file type of a file to be encrypted; acquiring an encryption range of data to be encrypted in the file to be encrypted based on the file type; and encrypting the data to be encrypted in the encryption range to obtain an encrypted file. The file processing method provided by the disclosure can select the encryption range according to the type of the file, so that respective encryption rules are obtained for different files.

Description

File processing method, device, terminal and non-transitory storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a terminal, and a non-transitory storage medium for processing a file.
Background
The encryption is that the original information data is changed, so that even if an unauthorized user obtains the encrypted information, the content of the information cannot be known because the unauthorized user does not know the decryption method. If the whole file is encrypted, the defect of low speed is brought; if the file is encrypted by some deterministic rule, there is a security risk.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In order to solve the above problems, the present disclosure provides a method, an apparatus, a terminal, and a non-transitory storage medium for file processing.
According to an embodiment of the present disclosure, there is provided a file processing method including:
acquiring the file type of a file to be encrypted;
acquiring an encryption range of data to be encrypted in the file to be encrypted based on the file type; and
and encrypting the data to be encrypted in the encryption range to obtain an encrypted file.
According to an embodiment of the present disclosure, there is provided a file processing method including:
acquiring a file;
acquiring index information from a preset position of the file;
analyzing the index information to obtain the encryption range of the file;
acquiring data in the encryption range in the file;
analyzing the data to obtain analyzed data corresponding to the data; and
and replacing the data in the encryption range with the analysis data to obtain a decrypted file.
According to an embodiment of the present disclosure, there is provided an apparatus for file processing, including:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring the file type of a file to be encrypted and acquiring the encryption range of data to be encrypted in the file to be encrypted based on the file type; and
and the encryption module is used for encrypting the data to be encrypted in the encryption range to obtain an encrypted file.
According to an embodiment of the present disclosure, there is provided an apparatus for file processing, including:
the second acquisition module is used for acquiring a file, acquiring index information from a preset position of the file, acquiring an encryption range of the file, acquiring data in the encryption range in the file and acquiring analysis data corresponding to the data;
the analysis module is used for analyzing the index information and the data; and
and the processing module is used for covering the data in the encryption range by using the analysis data to obtain a decryption file.
According to an embodiment of the present disclosure, there is provided a terminal including: at least one memory and at least one processor; wherein the memory is used for storing program codes, and the processor is used for calling the program codes stored in the memory to execute the method.
According to an embodiment of the present disclosure, there is provided a non-transitory storage medium for storing program code for performing the above-described method.
The file processing scheme can select the encryption range according to the type of the file, so that respective encryption rules are obtained for different files.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 shows a flowchart of a file processing method of an embodiment of the present disclosure.
Fig. 2 shows a schematic diagram of a file structure of an embodiment of the present disclosure.
Fig. 3 shows a schematic diagram of a file structure of another embodiment of the present disclosure.
Fig. 4 shows a flow chart of the decryption steps of an embodiment of the present disclosure.
Fig. 5 shows a schematic structural diagram of a document processing apparatus of an embodiment of the present disclosure.
Fig. 6 shows a schematic structural diagram of a first obtaining module of the embodiment of the present disclosure.
Fig. 7 shows a schematic structural diagram of an encryption module according to an embodiment of the present disclosure.
Fig. 8 shows a schematic configuration diagram of a document processing apparatus according to another embodiment of the present disclosure.
FIG. 9 illustrates a schematic structural diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, 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". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The terminal in the present disclosure may include, but is not limited to, mobile terminal devices such as a mobile phone, a smart phone, a notebook computer, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation apparatus, a vehicle-mounted terminal device, a vehicle-mounted display terminal, a vehicle-mounted electronic rearview mirror, and the like, and fixed terminal devices such as a digital TV, a desktop computer, and the like.
As shown in fig. 1, an embodiment of the present disclosure provides a method for file processing, including the following steps.
S100, acquiring the file type of the file to be encrypted.
Specifically, the embodiment of the present disclosure may include extracting header data of the file to be encrypted; acquiring a first data block in the head data; and analyzing the first data block of the head data to obtain the file type of the file to be encrypted. Wherein the first data block may include a data block indicating a file type, and the second data block may include other data blocks of the header data except the first data block.
The files in the embodiments of the present disclosure may include various types, and may be, for example, multimedia files such as MP4 files and picture files such as PNG files, etc. More specifically, embodiments of the present disclosure may determine the file type by reading file header data, such as the contents of the header 16 bytes. Referring to fig. 2 and 3, by looking at the header data shown in the figures, it can be determined that the file type is MP4, for example, from the ftyp data block in fig. 2, and it can be determined that the file type is PNG, for example, from the PNG flag in fig. 3.
S200, acquiring the encryption range of the data to be encrypted in the file to be encrypted based on the file type.
Wherein the encryption range includes the header data. Specifically, the disclosed embodiments may include determining a range of the header data as the encryption range; acquiring the position information of the head data in the file to be encrypted, and determining the position information as the index information of the encryption range; or determining a second data block from the header data according to the first data block, and determining the range of the second data block as the encryption range; and acquiring the position information of the second data block in the file to be encrypted, and determining the position information as the index information of the encryption range.
Since the file type is an important condition for parsing and the header data is necessary data for reading or playing the file, such as the header file is damaged or missing, the file cannot be read or played correctly. The embodiment of the disclosure encrypts the header data, can destroy the analysis rule, and achieves the technical effect that the file is difficult to read and restore. The encryption range in the embodiment of the present disclosure may include the specified information, such as the entire header data, or only a part of the header data. Still taking fig. 2 and fig. 3 as an example, for example, a file of the MP4 type shown in fig. 2 may specify all header data therein, i.e., a file type part (ftyp data block) and a storage media information part (moov data block), as an encryption range, or may specify only storage media information data in the multimedia file as an encryption range. The Moov data block contains playing information such as video duration, frame rate and the like, and playing software needs to read the playing information from the data block and then can accurately play the video. If this information is lost or cannot be read, the software has no way of knowing the video frame rate and where to start decoding, i.e., the video cannot be played. Also, for example, all header data of the file in fig. 3 may be designated as an encryption range, or only a file header data block (IHDR) and a palette data block (PLTE) may be designated therein as an encryption range. The embodiment of the disclosure can also randomly select a plurality of ranges of contents in the file to form a plurality of data segments, that is, the encryption range can be random, and also can include a plurality of discontinuous segments of data. In view of the above, the embodiment of the present disclosure may further obtain index information of the encryption range, so as to identify the encryption range. The embodiment of the disclosure can place the index information at the end of the file, and the index information can be composed of two bytes and corresponds to the encryption range in the file. Taking the example of a file comprising 40 bytes from 1 to 40, the index information may comprise 4 bytes from 1, 10, 30, and 40. If the encryption range is the first 10 bytes, index information 1 and 10 can be set at the tail of the encrypted file, which indicates that the 1-10 byte part in the original text is the encrypted part. The file type of the embodiment of the present disclosure may not be limited to those described in fig. 2 and 3, and other types of files may also designate a corresponding portion such as header information or the like as an encryption range. Still taking fig. 2 as an example, the header data of the MP4 type file includes ftyp data blocks and moov data blocks; wherein, the file type can be identified by ftyp. The encryption range of the embodiment of the present disclosure may include all the ftyp data blocks and moov data blocks of the header data, or may include only the moov data blocks.
S300, encrypting the data to be encrypted in the encryption range to obtain an encrypted file.
Specifically, the embodiment of the present disclosure may include encrypting data to be encrypted within the encryption range to obtain ciphertext data; replacing the data to be encrypted in the encryption range with the ciphertext data; and adding the index information to a preset position of the file to be encrypted.
The embodiment of the disclosure can extract binary data in an encryption range, and obtain ciphertext data after encryption; then, the ciphertext is written back to the original file, namely, the data in the original file, such as the content of a specific data block, is covered or replaced; and then the index information of the encrypted paragraph is added to a preset position such as the end of the file. More specifically, the encryption process may include storing the encryption key in a container, thereby increasing the difficulty of extracting the key. In addition, the embodiments of the present disclosure may also limit the time and manner of key usage, for example, user authentication is required to use the key, or the key is limited to be used only in some encryption modes. Wherein the encryption algorithm to be used may be determined prior to the creation of the key. Furthermore, it is possible to determine the identification link of the key during the encryption/decryption process, which corresponds to the role of the key in the key value pair in the transfer data.
The above describes an encryption process, and, in contrast, embodiments of the present disclosure may also include a decryption process. Specifically, the embodiment of the present disclosure may further include obtaining the index information at the preset position, and deleting the index information from the preset position; in one embodiment, the decryption end may perform decryption according to a known reverse operation of the encryption algorithm, for example, by identifying a suffix identifier "devider" of the file; the decryption end acquires index information from a preset position such as the tail by identifying the suffix identification, and acquires the encryption range according to the index information; obtaining the ciphertext data within the encryption range of the encrypted file; analyzing the ciphertext data to obtain the analysis data; and replacing the ciphertext data in the encryption range with the analysis data to obtain the decryption file.
The disclosed embodiments may be analyzed and encrypted according to the type characteristics of each file. Each file has a difference in header information/type, resulting in a different range of encrypted data. However, the encrypted data range can cover the header information of the file, so that the analysis rule is not leaked due to less coverage, and the encryption time is not increased due to more coverage. For a large file, only a small part of data in the large file is processed, so that the encryption speed can be increased; and the data in the file header information range is analyzed and encrypted, so that the analysis rule of the file is destroyed, the content of the file cannot be checked, and the encryption safety and the difficulty of decryption are improved.
Referring to fig. 4, fig. 4 shows a flowchart of the decryption step of an embodiment of the present disclosure. In contrast, the embodiment of the present disclosure may further perform a reverse-derivation to obtain a decryption step according to the encryption process: acquiring a file; acquiring index information from a preset position of the file; analyzing the index information to obtain an encryption range in the file; acquiring data in the encryption range in the file; analyzing the data to obtain analyzed data corresponding to the data; and replacing the data with the analyzed data to obtain a decrypted file. The decryption process of the embodiment of the disclosure is also correspondingly cracked according to the obtained different encryption ranges.
As shown in fig. 5, fig. 5 shows a schematic structural diagram of a document processing apparatus according to an embodiment of the present disclosure. The apparatus 10 of the disclosed embodiment includes a first obtaining module 13 and an encrypting module 15. The first obtaining module 13 may be configured to obtain a file type of a file to be encrypted, and obtain an encryption range of data to be encrypted in the file to be encrypted based on the file type; the encryption module 15 may be configured to encrypt the data to be encrypted within the encryption range to obtain an encrypted file. Referring to fig. 6, fig. 6 is a schematic structural diagram of a first obtaining module according to an embodiment of the disclosure. The first obtaining module 13 may include an extracting module 131 and an operating module 133; the extracting module 131 may be configured to extract header data of a file to be encrypted, and the operating module 133 may be configured to obtain a first data block in the header data; analyzing the first data block to obtain the file type of the file to be encrypted; determining a range of the header data as the encryption range; acquiring the position information of the head data in the file to be encrypted, and determining the position information as the index information of the encryption range; or determining a second data block from the header data according to the first data block, and determining the range of the second data block as the encryption range; and acquiring the position information of the second data block in the file to be encrypted, and determining the position information as the index information of the encryption range. Referring to fig. 7, fig. 7 is a schematic structural diagram of an encryption module 15 according to an embodiment of the disclosure. The encryption module 15 may include a replacement module 151 and an addition module 153; the replacing module 151 may be configured to encrypt the data to be encrypted within the encryption range to obtain ciphertext data; the adding module 153 may be configured to add the index information to a preset position of the file to be encrypted, by replacing the data in the encryption range with the ciphertext data.
As shown in fig. 8, fig. 8 is a schematic structural diagram of a document processing apparatus according to another embodiment of the present disclosure. The apparatus 30 of the embodiment of the present disclosure includes a second obtaining module 33, a parsing module 35, and a processing module 37. The second obtaining module 33 may be configured to obtain a file, obtain index information from a preset position of the file, obtain an encryption range in the file, obtain data in the encryption range in the file, and obtain analysis data corresponding to the data; the parsing module 35 may be configured to parse the index information and the data; the processing module 37 may be configured to replace the data with the parsed data to obtain a decrypted file.
For the embodiments of the apparatus, since they correspond substantially to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described apparatus embodiments are merely illustrative, wherein the modules described as separate modules may or may not be separate. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
In addition, the present disclosure also provides a terminal, including: at least one memory and at least one processor; wherein the memory is used for storing program codes, and the processor is used for calling the program codes stored in the memory to execute the method.
Furthermore, the present disclosure also provides a non-transitory storage medium for storing program code for performing the above method.
Referring now to fig. 9, a block diagram of an electronic device 800, such as a terminal, suitable for use in implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 9, the electronic device 800 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM 802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 9 illustrates an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program, when executed by the processing apparatus 801, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: one or more programs are invoked to perform the methods of the embodiments of the present disclosure.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a method of file processing, including:
acquiring the file type of a file to be encrypted;
acquiring an encryption range of data to be encrypted in the file to be encrypted based on the file type; and
and encrypting the data to be encrypted in the encryption range to obtain an encrypted file.
According to one or more embodiments of the present disclosure, the obtaining of the file type of the file to be encrypted includes:
extracting the head data of the file to be encrypted;
acquiring a first data block in the head data;
and analyzing the first data block to obtain the file type of the file to be encrypted.
According to one or more embodiments of the present disclosure, the obtaining an encryption range of data to be encrypted in the file to be encrypted based on the file type includes:
determining a range of the header data as the encryption range; acquiring the position information of the head data in the file to be encrypted, and determining the position information as the index information of the encryption range; or
Determining a second data block from the header data according to the first data block, and determining the range of the second data block as the encryption range; and acquiring the position information of the second data block in the file to be encrypted, and determining the position information as the index information of the encryption range.
According to one or more embodiments of the present disclosure, the encrypting the data to be encrypted within the encryption range to obtain an encrypted file includes:
encrypting the data to be encrypted in the encryption range to obtain ciphertext data;
replacing the data to be encrypted in the encryption range with the ciphertext data; and
and adding the index information to a preset position of the file to be encrypted.
According to one or more embodiments of the present disclosure, the method further comprises:
acquiring the index information at the preset position, and deleting the index information from the preset position;
obtaining the encryption range according to the index information;
obtaining the ciphertext data within the encryption range of the encrypted data;
analyzing the ciphertext data to obtain analysis data; and
and replacing the ciphertext data in the encryption range with the analysis data to obtain a decrypted file.
According to one or more embodiments of the present disclosure, there is provided a method of file processing, including:
acquiring a file;
acquiring index information from a preset position of the file;
analyzing the index information to obtain an encryption range in the file;
acquiring data in the encryption range in the file;
analyzing the data to obtain analyzed data corresponding to the data; and
and replacing the data with the analysis data to obtain a decrypted file.
According to one or more embodiments of the present disclosure, there is provided an apparatus for file processing, including:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring the file type of a file to be encrypted and acquiring the encryption range of data to be encrypted in the file to be encrypted based on the file type; and
and the encryption module is used for encrypting the data to be encrypted in the encryption range to obtain an encrypted file.
According to one or more embodiments of the present disclosure, there is provided an apparatus for file processing, including:
the second acquisition module is used for acquiring a file, acquiring index information from a preset position of the file, acquiring an encryption range in the file, acquiring data in the encryption range in the file and acquiring analysis data corresponding to the data;
the analysis module is used for analyzing the index information and the data; and
and the processing module is used for replacing the data with the analysis data to obtain a decrypted file.
According to one or more embodiments of the present disclosure, there is provided a terminal including: at least one memory and at least one processor; wherein the memory is used for storing program codes, and the processor is used for calling the program codes stored in the memory to execute the method.
According to one or more embodiments of the present disclosure, there is provided a non-transitory storage medium for storing program code for performing the above-described method.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A method of file processing, the method comprising:
acquiring the file type of a file to be encrypted;
acquiring an encryption range of data to be encrypted in the file to be encrypted based on the file type; and
and encrypting the data to be encrypted in the encryption range to obtain an encrypted file.
2. The method according to claim 1, wherein the obtaining the file type of the file to be encrypted comprises:
extracting the head data of the file to be encrypted;
acquiring a first data block in the head data;
and analyzing the first data block to obtain the file type of the file to be encrypted.
3. The method according to claim 2, wherein the obtaining the encryption range of the data to be encrypted in the file to be encrypted based on the file type comprises:
determining a range of the header data as the encryption range; acquiring the position information of the head data in the file to be encrypted, and determining the position information as the index information of the encryption range; or
Determining a second data block from the header data according to the first data block, and determining the range of the second data block as the encryption range; and acquiring the position information of the second data block in the file to be encrypted, and determining the position information as the index information of the encryption range.
4. The method according to claim 3, wherein the encrypting the data to be encrypted in the encryption range to obtain an encrypted file comprises:
encrypting the data to be encrypted in the encryption range to obtain ciphertext data;
replacing the data to be encrypted in the encryption range with the ciphertext data; and
and adding the index information to a preset position of the file to be encrypted.
5. The method of claim 4, further comprising:
acquiring the index information at the preset position, and deleting the index information from the preset position;
obtaining the encryption range according to the index information;
obtaining the ciphertext data within the encryption range of the encrypted file;
analyzing the ciphertext data to obtain analysis data; and
and replacing the ciphertext data in the encryption range with the analysis data to obtain a decrypted file.
6. A method of file processing, comprising:
acquiring a file;
acquiring index information from a preset position of the file;
analyzing the index information to obtain the encryption range of the file;
acquiring data in the encryption range in the file;
analyzing the data to obtain analyzed data corresponding to the data; and
and replacing the data in the encryption range with the analysis data to obtain a decrypted file.
7. An apparatus for file processing, comprising:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring the file type of a file to be encrypted and acquiring the encryption range of data to be encrypted in the file to be encrypted based on the file type; and
and the encryption module is used for encrypting the data to be encrypted in the encryption range to obtain an encrypted file.
8. An apparatus for file processing, comprising:
the second acquisition module is used for acquiring a file, acquiring index information from a preset position of the file, acquiring an encryption range of the file, acquiring data in the encryption range in the file and acquiring analysis data corresponding to the data;
the analysis module is used for analyzing the index information and the data; and
and the processing module is used for replacing the data in the encryption range with the analysis data to obtain a decrypted file.
9. A terminal, comprising:
at least one memory and at least one processor;
wherein the at least one memory is configured to store program code and the at least one processor is configured to invoke the program code stored in the at least one memory to perform the method of any of claims 1 to 6.
10. A non-transitory storage medium for storing program code for performing the method of any one of claims 1 to 6.
CN202110324791.3A 2021-03-26 2021-03-26 File processing method, device, terminal and non-transitory storage medium Pending CN113032345A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110324791.3A CN113032345A (en) 2021-03-26 2021-03-26 File processing method, device, terminal and non-transitory storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110324791.3A CN113032345A (en) 2021-03-26 2021-03-26 File processing method, device, terminal and non-transitory storage medium

Publications (1)

Publication Number Publication Date
CN113032345A true CN113032345A (en) 2021-06-25

Family

ID=76474147

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110324791.3A Pending CN113032345A (en) 2021-03-26 2021-03-26 File processing method, device, terminal and non-transitory storage medium

Country Status (1)

Country Link
CN (1) CN113032345A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114286131A (en) * 2021-12-27 2022-04-05 上海哔哩哔哩科技有限公司 Transmission method and device for anchor image model file in live broadcast wheat

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294961A (en) * 2013-06-07 2013-09-11 北京奇虎科技有限公司 Method and device for file encrypting/decrypting
CN103488915A (en) * 2013-09-24 2014-01-01 无锡德思普科技有限公司 Double-secret-key-encryption resource encryption and decryption method with combination of software and hardware
CN110191360A (en) * 2019-06-04 2019-08-30 人教数字出版有限公司 The device of multi-media processing method, multi-medium play method and corresponding method
CN112149168A (en) * 2020-10-10 2020-12-29 中育数据(广州)科技有限公司 File data encryption method and device and electronic equipment
CN114826696A (en) * 2022-04-08 2022-07-29 中国电子科技集团公司第三十研究所 File content hierarchical sharing method, device, equipment and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294961A (en) * 2013-06-07 2013-09-11 北京奇虎科技有限公司 Method and device for file encrypting/decrypting
CN103488915A (en) * 2013-09-24 2014-01-01 无锡德思普科技有限公司 Double-secret-key-encryption resource encryption and decryption method with combination of software and hardware
CN110191360A (en) * 2019-06-04 2019-08-30 人教数字出版有限公司 The device of multi-media processing method, multi-medium play method and corresponding method
CN112149168A (en) * 2020-10-10 2020-12-29 中育数据(广州)科技有限公司 File data encryption method and device and electronic equipment
CN114826696A (en) * 2022-04-08 2022-07-29 中国电子科技集团公司第三十研究所 File content hierarchical sharing method, device, equipment and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114286131A (en) * 2021-12-27 2022-04-05 上海哔哩哔哩科技有限公司 Transmission method and device for anchor image model file in live broadcast wheat

Similar Documents

Publication Publication Date Title
CN111343146B (en) Data auditing method, system, computer readable medium and electronic equipment
CN110545472B (en) Video data processing method and device, electronic equipment and computer readable medium
CN110727566A (en) Method, device, medium and electronic equipment for acquiring process crash information
CN112149168A (en) File data encryption method and device and electronic equipment
CN111259409A (en) Information encryption method and device, electronic equipment and storage medium
CN110688667A (en) Picture file processing method and device, terminal equipment and medium
CN113032345A (en) File processing method, device, terminal and non-transitory storage medium
CN112329044A (en) Information acquisition method and device, electronic equipment and computer readable medium
CN114499893B (en) Bidding file encryption and evidence storage method and system based on block chain
CN115567937A (en) Short message verification method and device, storage medium and electronic equipment
CN114491421A (en) File encryption method, file processing method, file encryption device, file processing device, readable medium and electronic equipment
CN113987471A (en) Executable file execution method and device, electronic equipment and computer readable medium
CN114780124A (en) Differential upgrading method, device, medium and electronic equipment
CN111130805B (en) Secure transmission method, electronic device, and computer-readable storage medium
CN115348472A (en) Video identification method and device, readable medium and electronic equipment
CN112468470B (en) Data transmission method and device and electronic equipment
CN111708680A (en) Error reporting information analysis method and device, electronic equipment and storage medium
CN113742774B (en) Data processing method and device, readable medium and electronic equipment
CN111314320B (en) Communication method, terminal, server and system based on HTTP
CN116760992B (en) Video encoding, authentication, encryption and transmission methods, devices, equipment and media
CN111404890B (en) Flow data detection method, system, storage medium and electronic device
CN115378743B (en) Information encryption transmission method, device, equipment and medium
CN110909382B (en) Data security control method and device, electronic equipment and computer readable medium
CN110619218B (en) Method and apparatus for generating information
CN115758433A (en) Code encryption method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination