CN113032806A - File processing method and device, storage medium and electronic device - Google Patents

File processing method and device, storage medium and electronic device Download PDF

Info

Publication number
CN113032806A
CN113032806A CN202110310849.9A CN202110310849A CN113032806A CN 113032806 A CN113032806 A CN 113032806A CN 202110310849 A CN202110310849 A CN 202110310849A CN 113032806 A CN113032806 A CN 113032806A
Authority
CN
China
Prior art keywords
information
target
file
encryption
initial
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
CN202110310849.9A
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.)
Postal Savings Bank of China Ltd
Original Assignee
Postal Savings Bank of China 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 Postal Savings Bank of China Ltd filed Critical Postal Savings Bank of China Ltd
Priority to CN202110310849.9A priority Critical patent/CN113032806A/en
Publication of CN113032806A publication Critical patent/CN113032806A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • 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
    • G06F16/162Delete operations
    • 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/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6209Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Abstract

The embodiment of the invention provides a file processing method, a file processing device, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring initial file information of an initial file, wherein the initial file information comprises a plurality of lines of information; executing target processing on the initial file information line by line; deleting the initial file and taking the first file as a target file under the condition that the target processing is executed on each line of information contained in the initial file information; by the method and the device, the problem of low file information security in the related technology is solved, and the effect of improving the file information security is achieved.

Description

File processing method and device, storage medium and electronic device
Technical Field
The embodiment of the invention relates to the field of communication, in particular to a file processing method, a file processing device, a storage medium and an electronic device.
Background
The current application programs usually configure some technical parameters or service parameters into configuration files, and when the programs are started, configuration values in the configuration files are read to initialize the application programs.
To protect some security sensitive information (such as a database user password) in the application configuration file, the security sensitive information needs to be encrypted, so that the value configured in the configuration file is a ciphertext, and meanwhile, to correctly decrypt the ciphertext information when the application is initialized, key information needs to be configured in the configuration file.
In the configuration process, in order to enable the application program to decrypt the ciphertext to obtain the plaintext information when the application program is started, the plaintext of the key information needs to be configured in the configuration file, so that the key information is easy to obtain, and the information safety hazard is caused.
Disclosure of Invention
The embodiment of the invention provides a file processing method, a file processing device, a storage medium and an electronic device, and aims to at least solve the problem of low information security in the related technology.
According to an embodiment of the present invention, there is provided a file processing method including:
acquiring initial file information of an initial file, wherein the initial file information comprises a plurality of lines of information;
executing target processing on the initial file information line by line, wherein the target processing comprises: performing a first detection on initial file information in a current line; when the first detection result is that the initial file information in the current line contains target information, performing encryption processing on the target information to obtain target encryption information; replacing the target information with the target encryption information to obtain target file information; writing the target file information into a position corresponding to the current line in a first file;
and deleting the initial file and taking the first file as a target file when the target processing is executed on each line of information contained in the initial file information.
In one exemplary embodiment, the target process further comprises:
and writing the initial file information in the current line into a position corresponding to the current line in the first file when the first detection result indicates that the initial file information in the current line does not contain the target information.
In an exemplary embodiment, before performing the target processing on the initial file information line by line, the method further includes:
and generating the first file in a target path, wherein the target path is the path of the initial file.
In one exemplary embodiment, performing encryption processing on the target information to obtain target encryption information includes:
acquiring configuration information of target equipment, wherein the target equipment is used for operating the target file;
and carrying out encryption calculation on the target information according to the configuration information to obtain the target encryption information.
In an exemplary embodiment, the performing the encryption calculation on the target information according to the configuration information includes:
performing superposition calculation on the configuration information to obtain an encrypted abstract;
generating an encryption key from the encrypted digest, wherein the encryption key comprises the encrypted digest;
and carrying out encryption calculation on the target information according to the encryption key so as to obtain the target encryption information.
In an exemplary embodiment, before performing the target processing on the initial file information line by line, the method further includes: performing first identification processing on information to be encrypted in the initial file information to obtain target information containing a first target identification;
performing encryption processing on the target information to obtain target encryption information comprises: performing the encryption processing on the information, except the first target identifier, included in the target information to obtain the target encryption information;
writing the target file information into a position in a first file corresponding to the current line comprises: replacing the first target identifier included in the target file information with a second target identifier to obtain updated target file information; and writing the updated target file information as the target file information into a position corresponding to the current line in the first file.
According to another embodiment of the present invention, there is provided a document processing apparatus including:
the system comprises an initial information acquisition module, a file processing module and a file processing module, wherein the initial information acquisition module is used for acquiring initial file information of an initial file, and the initial file information comprises a plurality of lines of information;
an object processing module, configured to perform object processing on the initial file information line by line, where the object processing includes: performing a first detection on initial file information in a current line; when the first detection result is that the initial file information in the current line contains target information, performing encryption processing on the target information to obtain target encryption information; replacing the target information with the target encryption information to obtain target file information; writing the target file information into a position corresponding to the current line in a first file;
and the file replacement module is used for deleting the initial file and taking the first file as a target file under the condition that the target processing is executed on each line of information contained in the initial file information.
In one exemplary embodiment, the target process further comprises:
and writing the initial file information in the current line into a position corresponding to the current line in the first file when the first detection result indicates that the initial file information in the current line does not contain the target information.
According to a further embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the invention, under the condition of detecting the target information, the target information in the initial file is encrypted, and the initial file is directly replaced by the replaced first file, so that a key plaintext and the like are not required to be written into the initial file, the problem of low information security in the related technology can be solved, and the effect of improving the information security is achieved.
Drawings
Fig. 1 is a block diagram of a hardware configuration of a mobile terminal of a file processing method according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a method of file processing according to an embodiment of the invention;
fig. 3 is a block diagram of a file processing apparatus according to an embodiment of the present invention.
Detailed Description
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking an example of the present invention running on a mobile terminal, fig. 1 is a block diagram of a hardware structure of the mobile terminal of a file processing method according to an embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 104 for storing data, wherein the mobile terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a file processing method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In the present embodiment, a file processing method is provided, and fig. 1 is a flowchart of a file processing method according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, acquiring initial file information of an initial file, wherein the initial file information comprises a plurality of lines of information;
in this embodiment, the initial file generally refers to (but is not limited to) a configuration file that is stored in a specific way and needs to be called for starting the relevant application program, and accordingly, the initial file information may be (but is not limited to) information included in the configuration file that needs to be called for starting the relevant application program, such as a file location, a code instruction, an object program code, and the like; the method for obtaining the initial file may (but is not limited to) obtain the initial file by scanning all files in a specific path, may also be directly called from a specified path according to path information received in advance, may also be obtained by manual calling or input, and may also be obtained by other methods; the transmission of the configuration file may be performed through an internal line, or may be performed through a wireless network such as bluetooth, 3G/4G/5G/quantum communication network, and the like.
It should be noted that, because different applications execute different functions, configuration files required by different applications are different, that is, a configuration file to be called by one application may be single or multiple, and the content included in each configuration file may be multi-line information or single-line information; identifying a configuration file under a particular path may be, but is not limited to being, automatically identified when an application is launched.
Step S204, executing target processing on the initial file information line by line, wherein the target processing comprises the following steps: performing a first detection on initial file information in a current line; under the condition that the first detection result is that the initial file information in the current line contains target information, performing encryption processing on the target information to obtain target encryption information; replacing the target information with target encryption information to obtain target file information; writing the target file information into a position corresponding to the current line in the first file;
in the embodiment, as the target processing is performed on the initial file information line by line, omission caused by scanning errors can be avoided, so that the integrity of the processed initial file information is ensured; and the target encryption information obtained by encryption is written into the first file and directly replaces the target information with the target encryption information, so that a plaintext corresponding to the target encryption information does not need to be written into the first file, the encryption information leakage caused by reading the plaintext in the program starting process is avoided, and the safety of the file information is improved.
The line-by-line execution mode may be that the number of lines where the corresponding initial file information is located is judged by identifying the identification information included in the initial file information of each line, the number of lines where the corresponding initial file information is located is determined by counting the number of lines, or the number of lines where the initial file information is located is determined by other modes; the first detection may be to scan initial file information, and determine whether target information is included according to a scanning result, where the target information may be initial file information with a specific identifier, for example, in the initial file information including "WENC (1233)", "WENC (1233)" is the target information, "1233" is the initial file information to be encrypted, "WENC ()" is the identifier information for performing the identifier, and "ENC (1233)" is the target encryption information after performing the encryption processing; the encryption process may be to encrypt the aforementioned target information by a specific encryption algorithm, for example, but not limited to, it may be implemented by the cryptographic asymmetric encryption/decryption algorithm SM2, or may be implemented by other encryption/decryption algorithms; after the target encryption information is obtained, the initial file information can be written into a first file, and the target encryption information is used for replacing the target information to obtain a first file which does not contain the initial file information; wherein the first file may be a folder or a file template under a specific path.
In step S206, when the target process is executed for each line of information included in the initial file information, the initial file is deleted, and the first file is set as the target file.
In this embodiment, in the case that target processing is performed on each line of information, deleting the initial file is to avoid erroneous execution caused by scanning and reading of the initial file when the application program is started, and to avoid leakage of the initial file information due to existence of the initial file.
The deletion of the initial file may be implemented on a computer executing an application program, and the deletion of the initial file may be performed by a module or a device having a Logic calculation function, such as a Central Processing Unit (CPU), an MCU (micro control Unit), an FPGA (Field Programmable Gate Array), a Programmable Logic Controller (PLC), or the like, configured on the computer itself, or may be a computing device or a module externally connected to the computer, such as a cloud computer; the execution of deleting the initial file may be triggered and executed after the computer receives a trigger instruction sent when the last line of information also executes the target process, may be triggered and executed when the computer receives a result that the last line of information also executes the target process, or may be triggered and executed in other manners.
Through the steps, the target encryption information obtained by encryption is written into the first file and directly replaces the target information with the target encryption information, so that a plaintext corresponding to the target encryption information does not need to be written into the first file, the encryption information leakage caused by reading the plaintext in the program starting process is avoided, the safety of file information is improved, the problem of low information processing safety is solved, and the information safety is improved.
The main body of the above steps may be a base station, a terminal, etc., but is not limited thereto.
In an optional embodiment, the target processing further comprises:
step S2042, if the first detection result is that the target information is not included in the initial file information in the current line, writing the initial file information in the current line into a corresponding position of the first file with respect to the current line.
In this embodiment, the reason that the initial file information that does not include the target information is also written into the first file is to ensure the integrity of the initial file information and avoid information omission.
In an optional embodiment, before performing the target processing on the initial file information line by line, the method further comprises:
step S20402, a first file is generated in a target path, where the target path is a path where the initial file is located.
In this embodiment, generating the first file in the path where the initial file is located in advance can facilitate writing the replaced file information into the first file, and reduce time consumed by generating the first file in the replacement process.
The execution of generating the first file may be (but is not limited to) implemented by a module or device with a logic computing function, such as a CPU, an MCU, an FPGA, and a PLC, configured by the computer itself, or implemented by a computing device or module externally connected to the computer, such as a cloud computer.
In an optional embodiment, performing encryption processing on the target information to obtain target encryption information includes:
step S2044, obtaining configuration information of target equipment, wherein the target equipment is equipment for operating a target file;
step S2046, according to the configuration information, performing encryption calculation on the target information to obtain target encryption information.
In this embodiment, since the hardware configurations of the target devices executing the application programs are not completely the same, the encryption information calculated according to the configurations of the target devices is also not completely the same, so that the independence of the encryption information is ensured, and the leakage of the information is avoided.
The target device may be a server where the application program is located, a hardware device such as a CPU, and correspondingly, the configuration information may be (but is not limited to) information such as a network card MAC address, a CPU model, a CPU core number, and a pre-built 256-bit character string of the server where the application program is located; the encryption calculation mode can be realized by adopting a cryptographic asymmetric encryption and decryption algorithm SM 2.
In an optional embodiment, performing the encryption calculation on the target information according to the configuration information includes:
step S20462, performing superposition calculation on the configuration information to obtain an encrypted abstract;
step S20464, generating an encryption key according to the encrypted digest, wherein the encryption key comprises the encrypted digest;
step S20466, performing encryption calculation on the target information according to the encryption key to obtain target encryption information.
In this embodiment, the cryptographic digest may be (but is not limited to) calculated by superimposing the network card MAC address, the CPU model, the CPU core number, and the like of the target device on a built-in 256-bit character string, or may be calculated by other methods.
In an alternative embodiment of the method according to the invention,
before performing object processing on the initial file information line by line, the method further includes:
step S20404, performing first identification processing on information to be encrypted in the initial file information to obtain target information containing a first target identification;
in this embodiment, the identification of the information to be encrypted is to enable quick identification in the scanning process; wherein the first target identification may be (but is not limited to) the aforementioned "WENC ()"; the execution of the first identification processing may be (but is not limited to) implemented by a module or device with a logic computing function, such as a CPU, an MCU, an FPGA, and a PLC, configured by the computer itself, or implemented by a computing device or module external to the computer, such as a cloud computer.
Performing encryption processing on the target information to obtain target encryption information includes:
step S20468, performing encryption processing on information other than the first target identifier included in the target information to obtain target encrypted information;
in the present embodiment, the information other than the first target identification may be (but is not limited to) the aforementioned "1233".
Writing the target file information into the position corresponding to the current line in the first file comprises:
step S2062, replacing the first target identification included in the target file information with a second target identification to obtain updated target file information;
step S2064, writing the updated target file information as target file information into the position corresponding to the current line in the first file.
In the present embodiment, replacing the first target identification with the second target identification may be replacing the aforementioned "WENC ()" with "ENC ()".
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a configuration file encryption apparatus is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, and the description already made is omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 3 is a block diagram of a file processing apparatus according to an embodiment of the present invention, as shown in fig. 3, the apparatus including:
the initial information acquisition module 32 is configured to acquire initial file information of an initial file, where the initial file information includes multiple lines of information;
an object processing module 34, configured to perform object processing on the initial file information line by line, where the object processing includes: performing a first detection on initial file information in a current line; under the condition that the first detection result is that the initial file information in the current line contains target information, performing encryption processing on the target information to obtain target encryption information; replacing the target information with target encryption information to obtain target file information; writing the target file information into a position corresponding to the current line in the first file;
and a file replacing module 36 configured to delete the initial file and take the first file as a target file if target processing is performed on each line of information included in the initial file information.
In an optional embodiment, the target processing further comprises:
and writing the initial file information in the current line into a position corresponding to the current line in the first file when the first detection result indicates that the initial file information in the current line does not contain the target information.
In an optional embodiment, the apparatus further comprises:
the first file generating module 340 is configured to generate a first file in a target path before performing target processing on the initial file information line by line, where the target path is a path where the initial file is located.
In an alternative embodiment, the target processing module 34 performs the encryption processing on the target information to obtain the target encrypted information by:
acquiring configuration information of target equipment, wherein the target equipment is equipment for operating a target file;
and carrying out encryption calculation on the target information according to the configuration information to obtain target encryption information.
In an alternative embodiment, the target processing module 34 performs the encryption calculation on the target information according to the configuration information to obtain the target encryption information by:
performing superposition calculation on the configuration information to obtain an encrypted abstract;
generating an encryption key based on the encrypted digest, wherein the encryption key comprises the encrypted digest;
and carrying out encryption calculation on the target information according to the encryption key to obtain target encryption information.
In an alternative embodiment of the method according to the invention,
the target processing module 34 includes:
the first identifying unit 342 is configured to perform, before performing target processing on the initial file information line by line, first identifying processing on information to be encrypted in the initial file information to obtain target information including a first target identifier;
the target processing module 34 is further configured to perform encryption processing on the target information to obtain target encrypted information by:
performing encryption processing on information, except for the first target identifier, included in the target information to obtain target encryption information;
the target processing module 34 is further configured to write the target file information into the first file in a location corresponding to the current line by:
replacing a first target identifier included in the target file information with a second target identifier to obtain updated target file information; and writing the updated target file information as target file information into a position corresponding to the current line in the first file.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
The present invention will be described with reference to specific examples.
When the application is started, the target device automatically identifies all the configuration file paths (corresponding to the step S202); then, scanning all the configuration files under the paths line by line (corresponding to the aforementioned step S204); if the security-sensitive information to be encrypted is found, a key pair is generated using a built-in key generation algorithm, and the original value is encrypted using the key and written back to the configuration file to overwrite the original value (corresponding to the target process in step S204 described above).
When the application is initialized, the ciphertext is decrypted by using the same key to obtain a plaintext value, and the initialization is only executed in the process of starting the application for the first time.
The generation of the key pair can be realized by adopting a state-secret asymmetric encryption and decryption algorithm SM2, the key pair adopted in the encryption and decryption process of the algorithm is generated by calculation based on a specific seed, and the seed generation adopts some hardware information of a server where an application program is located, such as a network card MAC address, a CPU model, a CPU core number and the like, and a pre-built character string with the length of 256 bits; in the calculation process, after the opinion information and the character string are overlapped, calculating an abstract, and determining a seed according to the abstract; because hardware information of different servers is different, key pairs of different servers are different, and ciphertexts of different servers after encrypting the same configuration value are also different.
In order to make ciphertext write-back more reliable and avoid the problems of incomplete write-back and data loss of an original configuration file caused by abnormality in the write-back process, the following strategies are adopted in the write-back process of the invention:
firstly, generating a temporary file under the same directory of an original file, wherein the name of the temporary file is 'original file name. tmp';
then scanning the original file line by line;
if the line has no content to be encrypted, the encrypted ciphertext is written into the temporary file in the original mode, otherwise, the encrypted ciphertext replaces the plaintext and is written back into the temporary file;
after the original file is scanned and the temporary file is completely written successfully, the original file is deleted, the temporary file is renamed to the original file name, and finally the replacement of the configuration file is completed.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A file processing method, comprising:
acquiring initial file information of an initial file, wherein the initial file information comprises a plurality of lines of information;
executing target processing on the initial file information line by line, wherein the target processing comprises: performing a first detection on initial file information in a current line; when the first detection result is that the initial file information in the current line contains target information, performing encryption processing on the target information to obtain target encryption information; replacing the target information with the target encryption information to obtain target file information; writing the target file information into a position corresponding to the current line in a first file;
and deleting the initial file and taking the first file as a target file when the target processing is executed on each line of information contained in the initial file information.
2. The method of claim 1, wherein the target process further comprises:
and writing the initial file information in the current line into a position corresponding to the current line in the first file when the first detection result indicates that the initial file information in the current line does not contain the target information.
3. The method of claim 1, wherein prior to performing object processing on the initial file information line-by-line, the method further comprises:
and generating the first file in a target path, wherein the target path is the path of the initial file.
4. The method of claim 1, wherein performing encryption processing on the target information to obtain target encryption information comprises:
acquiring configuration information of target equipment, wherein the target equipment is used for operating the target file;
and carrying out encryption calculation on the target information according to the configuration information to obtain the target encryption information.
5. The method of claim 4, wherein the performing encryption calculation on the target information according to the configuration information to obtain the target encryption information comprises:
performing superposition calculation on the configuration information to obtain an encrypted abstract;
generating an encryption key from the encrypted digest, wherein the encryption key comprises the encrypted digest;
and carrying out encryption calculation on the target information according to the encryption key so as to obtain the target encryption information.
6. The method of claim 1,
before performing the target processing on the initial file information line by line, the method further includes: performing first identification processing on information to be encrypted in the initial file information to obtain target information containing a first target identification;
performing encryption processing on the target information to obtain target encryption information comprises: performing the encryption processing on the information, except the first target identifier, included in the target information to obtain the target encryption information;
writing the target file information into a position in a first file corresponding to the current line comprises: replacing the first target identifier included in the target file information with a second target identifier to obtain updated target file information; and writing the updated target file information as the target file information into a position corresponding to the current line in the first file.
7. A document processing apparatus, characterized by comprising:
the system comprises an initial information acquisition module, a file processing module and a file processing module, wherein the initial information acquisition module is used for acquiring initial file information of an initial file, and the initial file information comprises a plurality of lines of information;
an object processing module, configured to perform object processing on the initial file information line by line, where the object processing includes: performing a first detection on initial file information in a current line; when the first detection result is that the initial file information in the current line contains target information, performing encryption processing on the target information to obtain target encryption information; replacing the target information with the target encryption information to obtain target file information; writing the target file information into a position corresponding to the current line in a first file;
and the file replacement module is used for deleting the initial file and taking the first file as a target file under the condition that the target processing is executed on each line of information contained in the initial file information.
8. The apparatus of claim 7, wherein the target process further comprises:
and writing the initial file information in the current line into a position corresponding to the current line in the first file when the first detection result indicates that the initial file information in the current line does not contain the target information.
9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 6 when executed.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 6.
CN202110310849.9A 2021-03-23 2021-03-23 File processing method and device, storage medium and electronic device Pending CN113032806A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110310849.9A CN113032806A (en) 2021-03-23 2021-03-23 File processing method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110310849.9A CN113032806A (en) 2021-03-23 2021-03-23 File processing method and device, storage medium and electronic device

Publications (1)

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

Family

ID=76473178

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110310849.9A Pending CN113032806A (en) 2021-03-23 2021-03-23 File processing method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN113032806A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722671A (en) * 2012-06-01 2012-10-10 北京理工大学 Data defense system in windows operation system
CN104657670A (en) * 2013-11-19 2015-05-27 北京天地超云科技有限公司 Data encryption based safety use method of configuration file
CN105184181A (en) * 2015-06-15 2015-12-23 北京天诚同创电气有限公司 File encryption method, file decryption method and file encryption device
CN109271800A (en) * 2018-09-19 2019-01-25 中国银联股份有限公司 A kind of document handling method and device
CN112329033A (en) * 2020-10-30 2021-02-05 上海钐昆网络科技有限公司 Data encryption method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722671A (en) * 2012-06-01 2012-10-10 北京理工大学 Data defense system in windows operation system
CN104657670A (en) * 2013-11-19 2015-05-27 北京天地超云科技有限公司 Data encryption based safety use method of configuration file
CN105184181A (en) * 2015-06-15 2015-12-23 北京天诚同创电气有限公司 File encryption method, file decryption method and file encryption device
CN109271800A (en) * 2018-09-19 2019-01-25 中国银联股份有限公司 A kind of document handling method and device
CN112329033A (en) * 2020-10-30 2021-02-05 上海钐昆网络科技有限公司 Data encryption method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110099064B (en) File processing method, device, equipment and storage medium based on Internet of things
CN106529308B (en) data encryption method and device and mobile terminal
CN110430446B (en) Video processing method, device, equipment and computer readable storage medium
CN108197485B (en) Terminal data encryption method and system and terminal data decryption method and system
CN111193817B (en) Method and device for automatically registering equipment serial number, computer equipment and storage medium
CN109271798A (en) Sensitive data processing method and system
CN104751105A (en) Fingerprint data verification method, fingerprint data verification device, related equipment and system
CN112883388A (en) File encryption method and device, storage medium and electronic device
WO2021164462A1 (en) Data encryption method, data decryption method, computer device, and medium
US9137219B1 (en) Methods and systems for securely managing multimedia data captured by mobile computing devices
CN115442032A (en) Data processing method, system on chip and readable storage medium
CN111737718A (en) Encryption and decryption method and device for jar packet, terminal equipment and storage medium
CN109120641B (en) Report automatic uploading method and device, computer equipment and storage medium
CN111866864B (en) Method, device and storage medium for realizing encrypted storage and safe use management of cloud platform certificate based on wireless AP
CN116545776B (en) Data transmission method, device, computer equipment and storage medium
CN111181905B (en) File encryption method and device
CN117201120A (en) Information encryption method, device, computer equipment and storage medium
CN109977692B (en) Data processing method and device, storage medium and electronic equipment
CN110880965A (en) Outgoing electronic document encryption method, system, terminal and storage medium
WO2022100675A1 (en) Data encryption and data decryption methods, apparatus, storage medium, and electronic apparatus
CN111400771A (en) Target partition checking method and device, storage medium and computer equipment
CN113032806A (en) File processing method and device, storage medium and electronic device
CN106453335B (en) Data transmission method and device
CN105939192A (en) Data encryption method and device
CN114915503A (en) Data stream splitting processing encryption method based on security chip and security chip device

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