Electronic file processing method and device, storage medium and processor
By comparing the signature certificate and file content of electronic files in the Windows kernel driver, the problem of low efficiency of code signature verification in the user mode in the existing technology is solved, and the integrity and security of software are effectively protected on the Windows platform. method.
Patent Information
- Application Number
- CN202110390034.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-12
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-04-12
AI Technical Summary
In the existing technology, the code signature verification process on the Windows platform is implemented in user-mode programs, which cannot protect the integrity and security of the software without affecting efficiency.
Through the design based on Windows kernel driver, obtain the signature certificate and file content in the target electronic file, determine the key and hash value of the signature certificate, and compare it with the preset key and hash value. If they are consistent, it is normal. Run, otherwise stop running to achieve security verification of digital certificate signatures.
Without affecting efficiency, the security verification of digital certificate signatures of electronic files is implemented through the Windows kernel driver, improving the integrity and security protection of the software.
Smart Images

Figure CN113094708B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of file processing, and in particular to an electronic file processing method and device, a storage medium and a processor. Background Art
[0002] At present, as the 64-bit Windows operating system is widely used in people's daily office and entertainment environments, application software has also been adapted accordingly with the upgrade of the operating system, and the development of genuine application software has become more and more formalized. In order to ensure the integrity, security and compatibility of the software itself, software developers generally purchase digital signature certificates through formal channels to sign and release software. On the one hand, it can ensure the integrity and security of the software itself, and on the other hand, it can also better be compatible with the scanning mechanism of antivirus software, thereby providing users with a guarantee of safe and stable operation.
[0003] The code signing mechanism is widely used, especially by security vendors. Due to the Windows security mechanism, the kernel driver must meet the digital signature in order to run normally in the underlying environment of the operating system, otherwise the system will not be able to start and run normally. Therefore, digital signatures have become an indispensable technology in the development process of the Windows kernel. Code signature verification checks and verifies the digital signature of the PE file, and finds illegal files without digital signatures or verification failures, which can identify malicious code and illegal programs. Therefore, code signature verification has become a technology that can effectively prevent viruses and other malicious codes from invading the system. However, there are still certain technical barriers to implementing code signature verification in the system kernel, which makes it impossible to protect the integrity and security of the software without affecting efficiency in the existing technology.
[0004] like Figure 1 As shown, in the prior art, the code signature verification process on the Windows platform is basically performed by the Windows system itself, or by the auxiliary signature verification tool provided by Microsoft. Software developers generally use API interfaces such as OpenSSL to complete the message signing and verification process. At present, the signature verification process is basically implemented in user-mode programs, which may be attacked by malicious software.
[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0006] The embodiments of the present invention provide an electronic file processing method and device, a storage medium and a processor, so as to at least solve the technical problem that the code signature verification process on the Windows platform in the prior art is implemented in the user mode program, and it is impossible to protect the integrity and security of the software without affecting the efficiency.
[0007] According to one aspect of an embodiment of the present invention, there is provided an electronic file processing method, comprising: obtaining a signature certificate and file content in a target electronic file; determining a first key of the signature certificate, and a first hash value corresponding to the first key; obtaining a second key and data to be verified preset at a target node position of the target electronic file, and a second hash value corresponding to the second key; respectively comparing whether the first key and the second key are consistent with the data to be verified, and whether the first hash value and the second hash value are consistent, to obtain a comparison result; if the comparison result is consistent, running the target electronic file normally, otherwise stopping the running of the target electronic file.
[0008] Optionally, obtaining the signature certificate and file content in the target electronic file includes: using an image loading callback processing function and a process creation notification callback function to obtain the loading process of the above-mentioned target electronic file and obtain the memory image data of the above-mentioned target electronic file; calling the kernel driver module in the operating system to separate the signature certificate of the above-mentioned target electronic file from the file content and obtain the signature certificate and file content.
[0009] Optionally, before obtaining the signature certificate and file content in the target electronic file, the method further includes: generating an initial electronic file, wherein the initial electronic file includes: a portable and executable program file; and packaging the initial electronic file using a file packaging tool to obtain a processed electronic file.
[0010] Optionally, after using a file packaging tool to package the above-mentioned initial electronic file to obtain the above-mentioned processed electronic file, the above-mentioned method also includes: performing code signature verification on the above-mentioned processed electronic file to obtain a verification result; if the verification is successful, packaging and releasing the above-mentioned processed electronic file to obtain a software release package; installing the above-mentioned software release package on the target operating system, and running the above-mentioned software release package on the above-mentioned target operating system; using the above-mentioned target operating system to execute kernel call and kernel driver call processing on the running software release package to obtain the above-mentioned target electronic file.
[0011] Optionally, generating the initial electronic file includes: obtaining a target code; completing a compilation and merging process of the target code through a compilation script to generate the initial electronic file corresponding to the target code.
[0012] Optionally, the initial electronic file is packaged using a file packaging tool to obtain a processed electronic file, including: modifying the file structure of the initial electronic file using the file packaging tool to determine the target node position of the initial electronic file; writing the second key and the data to be verified from the target node position into the initial electronic file; and performing a code signing operation on the initial electronic file using a code signing tool and the first key to obtain the processed electronic file.
[0013] According to another aspect of an embodiment of the present invention, an electronic file processing device is also provided, including: a first acquisition module, used to obtain a signature certificate and file content in a target electronic file; a determination module, used to determine a first key of the signature certificate, and a first hash value corresponding to the first key; a second acquisition module, used to obtain a second key and data to be verified preset at a target node position of the target electronic file, and a second hash value corresponding to the second key; a comparison module, used to compare whether the first key and the second key are consistent with the data to be verified, and whether the first hash value and the second hash value are consistent, to obtain a comparison result; and a processing module, used to run the target electronic file normally if the comparison result is consistent, otherwise stop running the target electronic file.
[0014] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is further provided, wherein the non-volatile storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing any one of the above-mentioned electronic file processing methods.
[0015] According to another aspect of an embodiment of the present invention, a processor is further provided, and the processor is used to run a program, wherein the program is configured to execute any one of the electronic file processing methods when running.
[0016] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any one of the electronic file processing methods described above.
[0017] In an embodiment of the present invention, based on the design mode of Windows kernel driver, by obtaining the signature certificate and file content in the target electronic file; determining the first key of the signature certificate and the first hash value corresponding to the first key; obtaining the second key and the data to be verified preset at the target node position of the target electronic file, and the second hash value corresponding to the second key; respectively comparing whether the first key and the second key are consistent with the data to be verified, and whether the first hash value and the second hash value are consistent, to obtain a comparison result; if the comparison result is consistent, the target electronic file is run normally, otherwise the target electronic file is stopped, thereby achieving the purpose of implementing the security verification of the digital certificate signature of the electronic file based on the Windows kernel driver, thereby realizing the technical effect of protecting the integrity and security of the software without affecting the efficiency, and further solving the technical problem that the code signature verification process on the Windows platform in the prior art is implemented in the user mode program, and the integrity and security of the software cannot be protected without affecting the efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0019] Figure 1 It is a schematic diagram of a software signature verification function on a Windows platform according to the prior art;
[0020] Figure 2 is a flow chart of an electronic file processing method according to an embodiment of the present invention;
[0021] Figure 3 is a schematic diagram of a system architecture of an optional electronic file processing method according to an embodiment of the present invention;
[0022] Figure 4 is a flow chart of an optional electronic file processing method according to an embodiment of the present invention;
[0023] Figure 5 is a flow chart of an optional electronic file processing method according to an embodiment of the present invention;
[0024] Figure 6 It is a schematic diagram of the structure of an electronic document processing device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] First, to facilitate understanding of the embodiments of the present invention, some terms or nouns involved in the present invention are explained below:
[0028] Digital certificate: refers to a digital certificate that marks the identity information of the communicating parties in Internet communication. People can use it to identify each other's identity on the Internet. Therefore, digital certificates are also called digital identification. Digital certificates ensure the integrity and security of information and data of network users in computer network communication in the form of encryption or decryption.
[0029] Digital signature: also known as public key digital signature, is a digital string that can only be generated by the sender of the information and cannot be forged by others. This digital string is also an effective proof of the authenticity of the information sent by the sender. It is a method for identifying digital information, similar to an ordinary physical signature written on paper, but it is implemented using technology in the field of public key encryption. A set of digital signatures usually defines two complementary operations, one for signing and the other for verification. Digital signature is the application of asymmetric key encryption technology and digital summary technology.
[0030] Public and private keys: The basic architecture of digital certificates is public key PKI, which uses a pair of keys to implement encryption and decryption. The keys include private keys and public keys. The private key is mainly used for signing and decryption, which is defined by the user and only known by the user; the public key is used for signature verification and encryption and can be shared by multiple users.
[0031] PE file: The full name of PE file is Portable Executable, which means portable executable file. Common EXE, DLL, OCX, SYS, and COM are all PE files. PE files are program files on Microsoft Windows operating system (may be executed indirectly, such as DLL).
[0032] Example 1
[0033] According to an embodiment of the present invention, an embodiment of an electronic document processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0034] Figure 2 is a flow chart of an electronic file processing method according to an embodiment of the present invention. Figure 2 As shown, the method comprises the following steps:
[0035] Step S202, obtaining the signature certificate and file content in the target electronic file;
[0036] Step S204, determining the first key of the signing certificate and the first hash value corresponding to the first key;
[0037] Step S206, obtaining a second key and the data to be verified preset at the target node position of the target electronic file, and a second hash value corresponding to the second key;
[0038] Step S208, respectively comparing the first key and the second key to see whether they are consistent with the data to be verified, and the first hash value and the second hash value to see whether they are consistent, to obtain a comparison result;
[0039] Step S210: if the comparison result is consistent, the target electronic file is run normally, otherwise the target electronic file is stopped.
[0040] In an embodiment of the present invention, based on the design mode of Windows kernel driver, by obtaining the signature certificate and file content in the target electronic file; determining the first key of the signature certificate and the first hash value corresponding to the first key; obtaining the second key and the data to be verified preset at the target node position of the target electronic file, and the second hash value corresponding to the second key; respectively comparing whether the first key and the second key are consistent with the data to be verified, and whether the first hash value and the second hash value are consistent, to obtain a comparison result; if the comparison result is consistent, the target electronic file is run normally, otherwise the target electronic file is stopped, thereby achieving the purpose of implementing the security verification of the digital certificate signature of the electronic file based on the Windows kernel driver, thereby realizing the technical effect of protecting the integrity and security of the software without affecting the efficiency, and further solving the technical problem that the code signature verification process on the Windows platform in the prior art is implemented in the user mode program, and the integrity and security of the software cannot be protected without affecting the efficiency.
[0041] The embodiments of the present application start from the perspective of actual needs and applications, and based on the design of Windows kernel driver, provide a kernel driver verification method and system based on Windows operating system, and use the system underlying driver module technology to implement the security verification process of digital certificate signature, thereby improving the security of the software itself and the protection of intellectual property rights, and protecting the integrity and security of the software without affecting efficiency.
[0042] Optionally, in the embodiment of the present application, the target electronic file is a PE file. As an optional embodiment, Figure 3 As shown, it is possible but not limited to installing a Windows image loading callback processing function and a process creation notification callback function in the Windows operating system to intercept the loading process of the target electronic file (i.e., the PE file), and based on the obtained memory image data, call the certificate and algorithm processing module of the kernel driver module to separate the signature certificate of the above-mentioned target electronic file from the file content to obtain the signature certificate and the file content.
[0043] Optionally, an embodiment of the present application obtains a first key (i.e., public key data) corresponding to the signature certificate and a first hash value corresponding to the above-mentioned first key, and at the same time extracts a second key (i.e., certificate public key) preset before packaging and data to be verified (i.e., fingerprint data) at a specific node position of the target electronic file, and calculates a second hash value corresponding to the above-mentioned second key.
[0044] As an optional embodiment, a driver layer verification module can be used in the present application to decrypt the first hash value (SHA1 / MD5) corresponding to the first key, and calculate the second hash value corresponding to the second key, and compare the two hash values with the preset fingerprint data in the package, and compare the extracted certificate public key with the preset public key data in the package. If both comparison operations indicate that the comparison results are the same, the verification passes, the program runs normally, and proceeds to the next step. Otherwise, the program will be terminated and an error warning message will be output, and it will end after completion.
[0045] In an optional embodiment, obtaining the signature certificate and the file content in the target electronic file includes:
[0046] Step S2020, using the image loading callback processing function and the process creation notification callback function to obtain the loading process of the target electronic file and obtain the memory image data of the target electronic file;
[0047] Step S2022, calling the kernel driver module in the operating system to separate the signature certificate of the target electronic file from the file content, and obtaining the signature certificate and the file content.
[0048] In the above optional embodiments, it is possible but not limited to installing a Windows image loading callback processing function and a process creation notification callback function in the Windows operating system to intercept the loading process of the target electronic file (i.e., the PE file), and based on the obtained memory image data, call the certificate and algorithm processing module of the kernel driver module to separate the signature certificate of the above target electronic file from the file content to obtain the signature certificate and the file content.
[0049] In an optional embodiment, before obtaining the signature certificate and the file content in the target electronic file, the method further includes:
[0050] Step S302, generating an initial electronic file;
[0051] Step S304: Use a file packaging tool to package the initial electronic file to obtain a processed electronic file.
[0052] Optionally, the above-mentioned initial electronic file includes: a portable and executable program file, that is, a PE file, and the PE file can be a binary file.
[0053] In the embodiment of the present application, after the Windows operating system is started, the compilation and merging process of the target code is completed through the compilation script to generate the corresponding initial electronic PE file.
[0054] In an optional embodiment, after the initial electronic file is packaged using a file packaging tool to obtain the processed electronic file, the method further includes:
[0055] Step S402, performing code signature verification on the processed electronic file to obtain a verification result;
[0056] Step S404: if the verification is successful, the processed electronic file is packaged and released to obtain a software release package;
[0057] Step S406, installing the software release package into the target operating system, and running the software release package on the target operating system;
[0058] Step S408: using the target operating system to execute kernel call and kernel driver call processing on the software distribution package after running, to obtain the target electronic file.
[0059] In the embodiments of the present application, Figure 4 As shown, the Microsoft code signing tool and the valid signature certificate private key obtained through formal channels can be used to perform code signing operations on the above-mentioned packaged electronic files, and the Microsoft code signing tool can be used to verify the above-mentioned signed PE files. If the file signature after code verification is successful, the above-mentioned normally signed PE files are packaged and released to obtain a software release package; the above-mentioned software release package is installed on the target operating system, and the above-mentioned software release package is run on the above-mentioned target operating system; after the software is run, the operating system win32 is called and the above-mentioned Windows operating system is used to perform kernel call and kernel driver call processing on the software release package after running to obtain the above-mentioned target electronic file.
[0060] In an optional embodiment, generating an initial electronic file includes:
[0061] Step S502, obtaining target code;
[0062] Step S504, completing the compilation and merging process of the target code by compiling the script, and generating the initial electronic file corresponding to the target code.
[0063] Still Figure 4 As shown, after the Windows operating system is started, the compilation and merging process of the target code is completed through the compilation script to generate the corresponding initial electronic PE file.
[0064] In an optional embodiment, the initial electronic file is packaged using a file packaging tool, and the processed electronic file includes:
[0065] Step S602, using the file packaging tool to modify the file structure of the initial electronic file, and determining the target node position of the initial electronic file;
[0066] Step S604, writing the second key and the data to be verified from the target node location into the initial electronic file;
[0067] Step S606: Use a code signing tool and the first key to perform a code signing operation on the initial electronic file to obtain the processed electronic file.
[0068] Optionally, in the above embodiment, after the initial electronic file is generated, a file packaging tool can be used to modify the PE structure of the initial PE file, find the location of the special section of the initial PE file, write the verification feature data (for example, the public key of the code signing certificate, fingerprint data, etc.), and obtain the processed electronic file.
[0069] Through the above-mentioned embodiments of the present application, it is possible to improve the Windows operating system's analysis of abnormal user behavior and protection against APT attacks, achieving advanced architecture, stable technology, high security, convenient and flexible deployment, easy use, no change in user operating habits, and low training costs.
[0070] In recent years, with the sudden occurrence of various leaks, information security and long-term development have been greatly threatened. Therefore, higher security protection requirements have been put forward for the financial industry, which is related to the national economy and people's livelihood, to avoid leaks. Recently, with the intensification of the trade war, various industries have accelerated the detection of internal attack and defense drills and APT attacks. EDR clients based on the Windows platform have emerged, and their abnormal user behavior and endpoint detection functions have been well received in some evaluation projects.
[0071] The following is an example of an optional embodiment to illustrate the electronic file processing method provided in the embodiment of the present application. Figure 5 As shown, for example, an optional electronic document processing method includes:
[0072] Step S1, after entering the Windows desktop operating system, log in to the V3 account system, and execute step S2 after verification;
[0073] Step S2, synchronously receive the user behavior analysis strategy issued by the service, and execute step S3 after completion;
[0074] Step S3, starting the program to be analyzed;
[0075] Step S4, after the Windows system completes the application layer call, it directly enters the system kernel injection analysis module, and after completion, executes step S5;
[0076] Step S5, the injection analysis module needs to obtain the running program path, obtain the content of the PE file according to the path, and determine whether the program is a program hit by the strategy. If yes, go to step S6, otherwise, go to the above step S3;
[0077] Step S6, the injection driver dynamically searches for the security analysis DLL module to be implanted according to the software installation path, and after completion, proceeds to step S7;
[0078] Step S7, the kernel driver verification module performs code signing and security verification on the searched security analysis module. If the verification passes, the process proceeds to step S8, otherwise, the process proceeds to step S10.
[0079] Step S8, write ShellCode code into the current process space by injecting the driver, so that the process can dynamically load the security analysis DLL module, and then go to step S9.
[0080] Step S9, the program runs normally, and the security analysis DLL module processes the API functions that may produce abnormal behaviors through the inline Hook technology, and saves the logs recorded in the processing in the local hard disk or memory. After completion, go to step S10.
[0081] Step S10, program operation is completed, execute safe exit, and after completion, go to step S11.
[0082] Step S11, sending the abnormal log to the server.
[0083] Step S12, check whether to exit the system, if yes, end, otherwise go to step S3.
[0084] Example 2
[0085] According to an embodiment of the present invention, there is also provided an apparatus embodiment for implementing the above-mentioned electronic file processing method. Figure 6 is a schematic diagram of the structure of an electronic document processing device according to an embodiment of the present invention. Figure 6 As shown, the electronic document processing device includes: a first acquisition module 60, a determination module 62, a second acquisition module 64, a comparison module 66 and a processing module 68, wherein:
[0086] The first acquisition module 60 is used to obtain the signature certificate and file content in the target electronic file; the determination module 62 is used to determine the first key of the above-mentioned signature certificate, and the first hash value corresponding to the above-mentioned first key; the second acquisition module 64 is used to obtain the second key and the data to be verified preset at the target node position of the above-mentioned target electronic file, and the second hash value corresponding to the above-mentioned second key; the comparison module 66 is used to compare the above-mentioned first key, the above-mentioned second key and the above-mentioned data to be verified, and whether the above-mentioned first hash value and the above-mentioned second hash value are consistent, to obtain the comparison result; the processing module 68 is used to normally run the above-mentioned target electronic file if the comparison result is consistent, otherwise stop running the above-mentioned target electronic file.
[0087] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0088] It should be noted that the first acquisition module 60, the determination module 62, the second acquisition module 64, the comparison module 66 and the processing module 68 correspond to steps S202 to S210 in Example 1, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above Example 1. It should be noted that the above modules as part of the device can be run in a computer terminal.
[0089] It should be noted that the optional or preferred implementation of this embodiment can refer to the relevant description in Example 1, which will not be repeated here.
[0090] The above-mentioned electronic document processing device may also include a processor and a memory. The above-mentioned first acquisition module 60, determination module 62, second acquisition module 64, comparison module 66 and processing module 68 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0091] The processor includes a kernel, which retrieves the corresponding program unit from the memory. The kernel may be one or more. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory includes at least one memory chip.
[0092] According to an embodiment of the present application, an embodiment of a non-volatile storage medium is also provided. Optionally, in this embodiment, the non-volatile storage medium includes a stored program, wherein when the program is executed, the device where the non-volatile storage medium is located is controlled to execute any of the above electronic file processing methods.
[0093] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group, and the non-volatile storage medium includes a stored program.
[0094] Optionally, when the program is running, the device where the non-volatile storage medium is located is controlled to perform the following functions: obtain the signature certificate and file content in the target electronic file; determine the first key of the above-mentioned signature certificate, and the first hash value corresponding to the above-mentioned first key; obtain the second key and the data to be verified preset at the target node position of the above-mentioned target electronic file, and the second hash value corresponding to the above-mentioned second key; compare the above-mentioned first key, the above-mentioned second key to see whether they are consistent with the above-mentioned data to be verified, and whether the above-mentioned first hash value and the above-mentioned second hash value are consistent, to obtain a comparison result; if the comparison result is consistent, the above-mentioned target electronic file is run normally, otherwise the operation of the above-mentioned target electronic file is stopped.
[0095] Optionally, obtaining the signature certificate and file content in the target electronic file includes: using an image loading callback processing function and a process creation notification callback function to obtain the loading process of the above-mentioned target electronic file and obtain the memory image data of the above-mentioned target electronic file; calling the kernel driver module in the operating system to separate the signature certificate of the above-mentioned target electronic file from the file content and obtain the signature certificate and file content.
[0096] Optionally, before obtaining the signature certificate and file content in the target electronic file, the method further includes: generating an initial electronic file, wherein the initial electronic file includes: a portable and executable program file; and packaging the initial electronic file using a file packaging tool to obtain a processed electronic file.
[0097] Optionally, after the initial electronic file is packaged using a file packaging tool to obtain the processed electronic file, the method further includes:
[0098] Perform code signature verification on the processed electronic file to obtain a verification result; if the verification is successful, package and distribute the processed electronic file to obtain a software distribution package; install the software distribution package on the target operating system, and run the software distribution package on the target operating system; use the target operating system to execute kernel call and kernel driver call processing on the running software distribution package to obtain the target electronic file.
[0099] Optionally, generating the initial electronic file includes: obtaining a target code; completing a compilation and merging process of the target code through a compilation script to generate the initial electronic file corresponding to the target code.
[0100] Optionally, the initial electronic file is packaged using a file packaging tool to obtain a processed electronic file, including: modifying the file structure of the initial electronic file using the file packaging tool to determine the target node position of the initial electronic file; writing the second key and the data to be verified from the target node position into the initial electronic file; and performing a code signing operation on the initial electronic file using a code signing tool and the first key to obtain the processed electronic file.
[0101] According to an embodiment of the present application, an embodiment of a processor is also provided. Optionally, in this embodiment, the processor is used to run a program, wherein the program executes any one of the electronic file processing methods when it is run.
[0102] According to an embodiment of the present application, an embodiment of an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any one of the electronic file processing methods described above.
[0103] According to an embodiment of the present application, an embodiment of a computer program product is also provided. When executed on a data processing device, it is suitable for executing a program that initializes any one of the steps of the above-mentioned electronic file processing method.
[0104] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0105] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0106] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above-mentioned units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0107] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0108] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0109] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a non-volatile storage medium, including a number of instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present invention. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0110] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An electronic file processing method, characterized in that: include: Obtain the signature certificate and file content in the target electronic file; Determine a first key of the signing certificate and a first hash value corresponding to the first key; Acquire a second key and data to be verified preset at a target node position of the target electronic file, and a second hash value corresponding to the second key; Compare the first key and the second key to see whether they are consistent with the data to be verified, and the first Hash value and the second Hash value to see whether they are consistent, to obtain a comparison result; If the comparison result is consistent, the target electronic file is run normally, otherwise the target electronic file is stopped; The step of obtaining the signature certificate and the file content in the target electronic file includes: using an image loading callback processing function and a process creation notification callback function to obtain the loading process of the target electronic file and obtain the memory image data of the target electronic file; calling a kernel driver module in the operating system to separate the signature certificate of the target electronic file from the file content and obtain the signature certificate and the file content; Before obtaining the signature certificate and the file content in the target electronic file, the method further includes: generating an initial electronic file, wherein the initial electronic file includes: a portable and executable program file; using a file packaging tool to package the initial electronic file to obtain a processed electronic file; After the initial electronic file is packaged using a file packaging tool to obtain the processed electronic file, the method further includes: performing code signature verification on the processed electronic file to obtain a verification result; if the verification is successful, packaging and issuing the processed electronic file to obtain a software release package; installing the software release package on a target operating system and running the software release package on the target operating system; using the target operating system to perform kernel call and kernel driver call processing on the running software release package to obtain the target electronic file; The method also includes: using the file packaging tool to modify the file structure of the initial electronic file and determine the target node position of the initial electronic file; and writing the second key and the data to be verified into the initial electronic file from the target node position.
2. The method according to claim 1, characterized in that Generating initial electronic files includes: Get the object code; The compilation and merging process of the target code is completed by compiling the script to generate the initial electronic file corresponding to the target code.
3. The method according to claim 1, characterized in that The initial electronic files are packaged using a file packaging tool, and the processed electronic files include: A code signing tool and the first key are used to perform a code signing operation on the initial electronic file to obtain the processed electronic file.
4. An electronic document processing device, characterized in that: include: A first acquisition module is used to acquire the signature certificate and file content in the target electronic file; A determination module, configured to determine a first key of the signing certificate and a first hash value corresponding to the first key; A second acquisition module, used to acquire a second key and data to be verified preset at a target node position of the target electronic file, and a second hash value corresponding to the second key; a comparison module, used to compare whether the first key and the second key are consistent with the data to be verified, and whether the first Hash value and the second Hash value are consistent, to obtain a comparison result; A processing module, configured to run the target electronic file normally if the comparison result is consistent, or stop running the target electronic file otherwise; The first acquisition module is further used to: use the image loading callback processing function and the process creation notification callback function to acquire the loading process of the target electronic file and obtain the memory image data of the target electronic file; call the kernel driver module in the operating system to separate the signature certificate of the target electronic file from the file content and obtain the signature certificate and the file content; The device is further used to: generate an initial electronic file, wherein the initial electronic file includes: a portable and executable program file; use a file packaging tool to package the initial electronic file to obtain a processed electronic file; The device is also used to: perform code signature verification on the processed electronic file to obtain a verification result; if the verification is successful, perform packaging and distribution processing on the processed electronic file to obtain a software distribution package; install the software distribution package on a target operating system, and run the software distribution package on the target operating system; use the target operating system to perform kernel call and kernel driver call processing on the running software distribution package to obtain the target electronic file; The device is also used for: using the file packaging tool to modify the file structure of the initial electronic file, determining the target node position of the initial electronic file; and writing the second key and the data to be verified into the initial electronic file from the target node position.
5. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the electronic file processing method described in any one of claims 1 to 3.
6. A processor, characterized in that: The processor is used to run a program, wherein the program is configured to execute the electronic document processing method according to any one of claims 1 to 3 when running.
7. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to run the computer program to execute the electronic file processing method according to any one of claims 1 to 3.
