Verification method and related apparatus
By encrypting and decrypting the Excel template, and combining server signature and verification rules for dual verification, the problems of low template verification efficiency and poor portability in existing technologies are solved, achieving efficient and secure template verification.
Patent Information
- Application Number
- CN202010189776.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-18
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2040-03-18
AI Technical Summary
The existing Excel template validation technology stack requires customized development and configuration for each template, resulting in low validation efficiency and poor portability, especially since reconfiguration is required when the template is modified.
By encrypting and decrypting file templates, different keys are selected for encryption based on the template type, and dual verification is performed using server signatures and file template verification rules, thereby improving verification efficiency and portability.
It achieves efficient verification of file templates, ensuring that the templates have not been tampered with, improving template security and verification efficiency, while reducing the need for repetitive configuration.
Smart Images

Figure CN111476014B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of information security, in particular to a verification method and related device. BACKGROUND
[0002] In the current era of network data, the demand for data import using file templates is increasing. Moreover, the requirement for data quality accuracy is also increasing, so in many cases, the file template needs to be verified before data import to ensure that the file template has not been tampered with, and thus to determine the accuracy and security of the data generated according to the file template.
[0003] Taking an excel table file as an example, after generating an excel template, the excel template includes data format, drop-down selection, linkage, and other template rules. The user fills in the data according to the template rules, and the obtained data is standard data that meets the template rules. However, if the user modifies the template rules, the accuracy of the standard data cannot be guaranteed. Therefore, the excel template needs to be verified in the backend. Most of the existing excel template verification technology stacks are based on bean, xml, and configuration for customized development. However, this process requires development and configuration for each excel template, and if the template is modified, the configuration needs to be modified, which will greatly limit the efficiency and portability of excel template verification. SUMMARY
[0004] The present application provides a verification method and related device to encrypt the file template and decrypt the edited file to complete the verification of the file template, thereby improving the verification efficiency and portability of the file template.
[0005] In a first aspect, the present application provides a verification method, which includes:
[0006] receiving a file template or an edited file sent by a user terminal;
[0007] if the file template is received, determining the template type of the file template, the template type including a first type of template and a second type of template;
[0008] if the file template is the first type of template, obtaining an existing key from a locally stored key library to encrypt the file template;
[0009] if the file template is the second type of template, generating a new key to encrypt the file template;
[0010] sending the encrypted file template to the user terminal for file editing to generate an edited file;
[0011] If the edited file is received, the edited file is subjected to a first check, the first check being used to decrypt a file template corresponding to the edited file;
[0012] The edited file that passes the first check is determined as a qualified file.
[0013] In an optional example, after the file template is received, the method further comprises:
[0014] Obtaining a check rule in the file template;
[0015] Obtaining a unique identifier of the file template;
[0016] The check rule and the unique identifier are stored correspondingly to generate a check rule table.
[0017] In an optional example, the first check on the edited file further comprises:
[0018] Obtaining an encryption time of the file template corresponding to the edited file;
[0019] The encryption time is checked to determine whether the encryption time meets a preset time range.
[0020] In an optional example, after the server performs the first check on the edited file, the method further comprises:
[0021] Obtaining a unique identifier corresponding to the edited file;
[0022] Traversing the check rule table to determine whether the unique identifier exists in the check rule table;
[0023] If the unique identifier exists in the check rule table, a second check is performed on the edited file, the second check being: obtaining a first check rule corresponding to the edited file, and matching the first check rule with a check rule corresponding to the unique identifier; if the matching is successful, it is determined that the edited file passes the second check.
[0024] In an optional example, if the edited file passes the first check, after the second check is performed on the edited file, the method further comprises:
[0025] The edited file that passes the first check and the second check is determined as a qualified file.
[0026] In an optional example, if the edited file does not pass the first check, after the second check is performed on the edited file, the method further comprises:
[0027] Obtain the number of times the file template corresponding to the edited file that passed the second verification is marked as qualified;
[0028] If the number of times the mark is qualified is less than the preset number, then the edited file is determined to be a qualified file;
[0029] Increment the number of times the document template is marked as qualified.
[0030] In an optional example, if the edited file fails the first verification, the method further includes performing a second verification on the edited file:
[0031] Obtain the unique identifier and verification rules corresponding to the edited file that passed the second verification;
[0032] Generate a file template corresponding to the edited file based on the unique identifier and the verification rules;
[0033] Send a request for the number of file template copies to the user and receive the number of template copies input by the user;
[0034] The number of file templates corresponding to the specified number of template copies is encrypted, and the encrypted file templates are sent to the user terminal.
[0035] Receive the edited file sent by the user terminal, and perform a first verification on the edited file;
[0036] The edited file that passes the first verification is determined to be a qualified file.
[0037] Secondly, this application provides a verification device, the device comprising:
[0038] The receiving unit is used to receive file templates or edited files sent by the user terminal;
[0039] An encryption unit is used to encrypt a file template if it receives a file template, and send the encrypted file template to the user terminal for file editing to generate an edited file;
[0040] The verification unit is used to perform a first verification on the edited file if an edited file is received, wherein the first verification is used to verify the encryption of the file template corresponding to the edited file;
[0041] The determining unit is used to determine that the edited file that has passed the first verification is a qualified file.
[0042] In an optional example, the encryption unit is further used for:
[0043] Obtain the verification rules from the file template;
[0044] obtain a unique identifier of the file template;
[0045] store the check rule and the unique identifier correspondingly to generate a check rule table.
[0046] In an optional example, the check unit is further configured to:
[0047] obtain an encryption time of the file template corresponding to the edited file;
[0048] check the encryption time to determine whether the encryption time meets a preset time range.
[0049] In an optional example, the check unit is further configured to:
[0050] obtain a unique identifier of the file template corresponding to the edited file;
[0051] traverse the check rule table to determine whether the unique identifier exists in the check rule table;
[0052] if the unique identifier exists in the check rule table, perform a second check on the edited file, the second check comprising: obtaining a first check rule corresponding to the edited file, and matching the first check rule with a check rule corresponding to the unique identifier; if the matching is successful, it is determined that the edited file passes the second check.
[0053] In an optional example, the determination unit is configured to:
[0054] determine that the edited file passing the first check and the second check is a qualified file.
[0055] In an optional example, if the edited file does not pass the first check, the check unit is further configured to:
[0056] obtain a qualified times of the file template corresponding to the edited file passing the second check;
[0057] if the qualified times is less than a preset number, determine that the edited file is a qualified file;
[0058] increment the qualified times of the file template by one.
[0059] In an optional example, if the edited file does not pass the first check, the check unit is further configured to:
[0060] obtain a unique identifier and a check rule corresponding to the edited file passing the second check;
[0061] generating a file template corresponding to the edited file according to the unique identifier and the check rule;
[0062] outputting a file template share request to the user terminal and receiving a template share input by the user;
[0063] encrypting a number of file templates corresponding to the template share and sending the encrypted file templates to the user terminal;
[0064] receiving the edited file sent by the user terminal and performing a first check on the edited file;
[0065] determining that the edited file passing the first check is a qualified file.
[0066] In a third aspect, an electronic device is provided, including a processor, a memory, a communication interface, and one or more programs stored in the memory and configured to be executed by the processor, the program including instructions for performing the steps in any method of the first aspect.
[0067] In a fourth aspect, a computer readable storage medium storing a computer program for electronic data exchange is provided, where the computer program causes a computer to execute instructions for performing the steps in any method of the first aspect.
[0068] As can be seen, the check method and device in the embodiments of the present application receive a file template or an edited file sent by a user terminal; if a file template is received, the template type of the file template is determined, the template type including a first type of template and a second type of template; if the file template is a first type of template, an existing key is obtained from a locally stored key library to encrypt the file template; if the file template is a second type of template, a new key is generated to encrypt the file template; the encrypted file template is sent to the user terminal for file editing to generate an edited file; if an edited file is received, a first check is performed on the edited file, the first check being used to decrypt a file template corresponding to the edited file; and the edited file passing the first check is determined to be a qualified file. In this process, the file template is encrypted with different keys according to different template types, which improves the encryption efficiency of the first type of file template and the encryption security of the second type of file template; and the check on the file template is completed through the encryption and decryption processes, without the need to separately configure a check rule in a specific file template, which improves the check efficiency and portability of the file template. BRIEF DESCRIPTION OF DRAWINGS
[0069] The drawings involved in the embodiments of the present application will be briefly introduced below.
[0070] Figure 1A verification method flowchart provided by an embodiment of the present application;
[0071] Figure 2A A file template diagram provided by an embodiment of the present application;
[0072] Figure 2B An edited file diagram provided by an embodiment of the present application;
[0073] Figure 3 A diagram of a client selecting an upload file type provided by an embodiment of the present application;
[0074] Figure 4 A diagram of traversing a verification rule table provided by an embodiment of the present application;
[0075] Figure 5 A verification method flowchart provided by an embodiment of the present application;
[0076] Figure 6 Another verification method flowchart provided by an embodiment of the present application;
[0077] Figure 7 A structural diagram of an electronic device provided by an embodiment of the present application;
[0078] Figure 8 A functional unit composition block diagram of a verification device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0079] In order to make the personnel in the technical field better understand the present application scheme, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor are within the scope of protection of the present application.
[0080] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, not to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or device.
[0081] Reference to an "embodiment" herein means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. As will be apparent to those of ordinary skill in the art, embodiments described herein can be combinable with other embodiments.
[0082] The embodiments of the application are described in detail below.
[0083] Please refer to Figure 1 , Figure 1 is a flowchart of a verification method provided by an embodiment of the application, as shown in Figure 1 , the method comprises the following steps:
[0084] Step 101, the server receives a file template or an edited file sent by the user end.
[0085] The server receives the content sent by the user end, which can be a file template or an edited file. Taking an excel file as an example, the file template refers to a file that has set verification rules for regulating file content, but has not been edited specifically. Please refer to Figure 2A , Figure 2A is a file template provided by an embodiment of the application, as shown in Figure 2A , the file template includes the title of each column and the verification rule corresponding to the file to be edited under each title. For the "gender" column, the content can only be selected from the "male" and "female" tabs, and for the "age" column, only numerical data can be filled in. Figure 2A The verification rule is a schematic display mode, which can be displayed explicitly or hidden and not directly displayed on the file template page.
[0086] The edited file refers to a file that has been edited after the file template is generated. Please refer to Figure 2B , Figure 2B is a schematic diagram of an edited file provided by an embodiment of the application, as shown in Figure 2B , the edited file has been edited in the file template, as shown in Figure 2AThe document template shown has already been edited with details such as name, gender, age, and job title, resulting in an edited document. The identification process between the edited document and the document template can be based on file identifiers. For example, both document templates and edited documents have their own file identifiers, with a specific identifier bit used to distinguish between them. The identifier for document templates is "0," and for edited documents, it's "1." Alternatively, it can detect whether a specific area contains text content. Editing of an edited document always occurs within a specific area, for example, for... Figure 2A To generate an editable file from a file template, text editing is only allowed in the blank areas. Therefore, by detecting whether the editing area contains text data, it can be determined whether the file sent by the client is a template file or an editable file. Alternatively, it is not necessary to identify or detect the file type on the server side; the file type option when uploading the file can be used to determine whether the uploaded file is a template file or an editable file.
[0087] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating a client selecting the file type for uploading, as provided in an embodiment of this application. Figure 3 As shown, the client connects to the server and displays a file type options page provided by the server. The user selects a file type option, such as "template file". The server then receives the file sent by the client and the user's file type option, and determines the received file type as the file type provided by the user.
[0088] Step 102: If a file template is received, determine the template type of the file template. The template type includes a first type of template and a second type of template.
[0089] 103. If the file template is a first type of template, then obtain an existing key from the locally stored key store to encrypt the file template;
[0090] 104. If the file template is a second type of template, then generate a new key to encrypt the file template;
[0091] 105. The server sends the encrypted file template to the user terminal for file editing to generate an edited file.
[0092] The server receives the file template sent by the user end, and needs to encrypt the template so that the file template cannot be changed, because once the template is changed, the subsequent decryption process of the server on the file template cannot be completed. The encryption of the file template by the server can be symmetric encryption, that is, the server configures a key for the file template, and stores the key itself, when the server receives the edited file corresponding to the file template, the key stored by the server is matched with the key of the file template. Or the encryption of the file template by the server can be asymmetric encryption, that is, the server encrypts the file template by using a private key, and stores the public key corresponding to the private key, when the server receives the edited file corresponding to the file template, the public key is used to decrypt the edited file.
[0093] There can be different template types for the file template. The template type is used to distinguish the different security requirements of the template. For the first type of template, the required security level is ordinary, and a special key does not need to be generated, the server only needs to select one from the existing stored keys to encrypt it. For the user's batch upload, even the same key can be used for encryption, which can greatly improve the encryption efficiency of the file template. For the second type of template, the required security level is high, and the server needs to generate a special key for this type of template, which can be generated according to the parameters and characteristics of the template, or according to the template upload time, template business number and other information. The first type of template can be generated by a normally authorized client, and the second type of template can be generated by a high-level authorized client. Or the server interface can provide options, and the template type can be determined according to the received client options.
[0094] Optionally, the server can also obtain the unique identifier of the file template, and then store the unique identifier corresponding to the encryption key and the decryption key of the file template, so that when the edited file generated by the file template is decrypted, the decryption can be matched according to the unique identifier. The keys stored in the server can also be cleared regularly to reduce the storage pressure of the server memory.
[0095] The server sends the encrypted file template to the user end for editing, and the user cannot change the encrypted content in the file template, but can only edit other content. This can effectively prevent the target from being tampered.
[0096] 106、If the edited file is received, the server performs a first check on the edited file, and the first check is used to decrypt the file template corresponding to the edited file.
[0097] The server receives the edited file, and needs to check the file template corresponding to the edited file, to verify whether the file template is a file template encrypted by the server, so as to determine that the file template has not been tampered with in the process of being sent to the client for content editing. The file template is verified whether it is a file template encrypted by the server, that is, the file template is decrypted by using the key stored in the server, and if the decryption is successful, it is indicated that the file template is a file template encrypted by the server, otherwise it is an unencrypted file template.
[0098] Optionally, the first check on the edited file comprises: obtaining an encryption time of the file template corresponding to the edited file; and checking the encryption time to determine whether the encryption time meets a preset time range.
[0099] In some cases, the encryption of the file template is time-limited, for example, the processor only processes the edited file of the file template which is encrypted in batches during this task. Therefore, in the first check on the edited file, in addition to checking the key of the file template corresponding to the edited file, the encryption time of the file template is also checked to determine whether the encryption time meets a preset time range. The encryption time can be added in the form of a time stamp in the template file or the identifier corresponding to the template file, or can be directly added in the form of a date in the target file.
[0100] Step 107, the server determines that the edited file passing the first check is a qualified file.
[0101] The edited file passing the first check indicates that the file template corresponding to the edited file includes key information that can be decrypted by the server, and the file template has not been tampered with, so the security of the file template can be ensured, and therefore the edited file can be determined to be a qualified file.
[0102] In some possible cases, if the encryption information of the server is leaked, there may also be a case of forging the encryption information of the file template. Alternatively, in the case that the template file does not pass the first check of the server, the qualification of the edited file can also be determined by other check methods. Therefore, the second check can also be used to supplement the check method in the embodiment of the application.
[0103] Optionally, after receiving the file template, the method further comprises: obtaining a check rule in the file template; obtaining a unique identifier of the file template; and storing the check rule and the unique identifier correspondingly to generate a check rule table.
[0104] A file template's unique identifier can be used to uniquely identify the file template. Therefore, storing the file template's verification rules and the unique identifier in a corresponding table allows the server to accurately retrieve the verification rules corresponding to the file template using its unique identifier. The unique identifier can be generated based on the user's physical parameters, network parameters, or task parameters, or it can be generated based on the server's task parameters. The generation location can be either the client or the server.
[0105] Optionally, after the server performs the first verification on the edited file, it further includes: obtaining the unique identifier corresponding to the edited file; traversing the verification rule table to determine whether a unique identifier exists in the verification rule table; if a unique identifier exists in the verification rule table, then performing a second verification on the edited file, the second verification being: obtaining the first verification rule corresponding to the edited file and matching the first verification rule with the verification rule corresponding to the unique identifier; if the match is successful, then determining that the edited file has passed the second verification.
[0106] Optionally, if the edited file passes the first verification, after performing the second verification on the edited file, the method further includes: determining that the edited file that passes the first and second verifications is a qualified file.
[0107] Please see Figure 4 , Figure 4 This is a schematic diagram of a traversal verification rule table provided in an embodiment of this application, as shown below. Figure 4 As shown, the identifier 1 of the edited file is obtained, and then the verification rule table is traversed to determine whether identifier 1 is stored in the verification rule table. If it is, the edited file is subjected to a second verification. The specific process is as follows: retrieve rule 1 corresponding to identifier 1 from the verification rule table, and then match rule 1 with the verification rule corresponding to the edited file. During the matching, if the order, constraints, or tabs of the verification rules are exactly the same, the match is successful and the edited file passes the second verification; otherwise, the match fails and the edited file fails the second verification.
[0108] Meanwhile, edited files that pass both the first and second verifications are identified as qualified files. This further ensures the security of edited files. Even if the server's encryption key is leaked, it can be guaranteed that the file template corresponding to the edited file has not been tampered with, thus improving the effectiveness of file verification.
[0109] Optionally, if the edited file fails the first verification, the second verification of the edited file further includes: obtaining the number of times the edited file passes the second verification; if the number of times the edited file passes the second verification is less than the preset number, the edited file is determined to be a qualified file; and the number of times the edited file passes the second verification is incremented by one.
[0110] After the first check on the edited file, if the edited file fails to pass the first check, it means that the file template of the edited file has not been encrypted by the server in advance. In some cases, the file template of the edited file can be generated by copying the file template of another server-encrypted file, and the file template itself is not tampered with, but the encryption process is omitted. Such edited files can also be confirmed by the server as qualified files, and the step of re-uploading the file template of the edited file by the user terminal for encryption is omitted to improve the efficiency of the check. However, if all edited files that pass the second check but fail the first check are considered as qualified files, the first check process loses its meaning, and a large number of edited files with file templates not encrypted by the server uploaded to the server can also cause unauthorized user terminals to upload some unnecessary edited files, increasing the data processing capacity of the server.
[0111] Therefore, the server can only confirm a limited number of edited files corresponding to the same file template as the signed file template as qualified files. The specific process is as follows: store all server-encrypted file templates in the server and set a qualified number of times for each file template, and the initial value of the qualified number of times is 0. Each time the server receives an edited file with an unencrypted file template, but the edited file passes the second check, the qualified number of times of the file template corresponding to the edited file stored in the server is increased by 1. When the qualified number of times of the file template stored in the server is not less than a preset number of times, if the server receives an edited file corresponding to the file template again, as long as it fails to pass the first check, the edited file is determined to be an unqualified file.
[0112] In some cases, the edited file fails to pass the first check, indicating that the file template of the edited file has not been encrypted by the server in advance. The second check is continued on the edited file, and the edited file passes the second check, indicating that the file template of the edited file has been stored in the server. At this time, it can be because the number of server-signed file templates is not enough, causing the user terminal to generate an unencrypted file template by copying an encrypted file template, and then generate an edited file by editing the file in the unencrypted file template. Because the server's encryption information cannot be copied when copying the file template, the edited file cannot pass the first check, but the edited file is undoubtedly a qualified file. In this case, the edited file can be provided with the opportunity to provide a supplementary signature, and the specific process is as follows:
[0113] The server obtains the unique identifier and the check rule corresponding to the edited file that passes the second check;
[0114] The server generates a file template corresponding to the edited file according to the unique identifier and the verification rule; or, the server can also obtain the verification rule corresponding to the unique identifier stored in the verification rule table of the server according to the unique identifier, and then generate the file template;
[0115] The server outputs a file template share request to the user end, and receives the template share input by the user;
[0116] The server encrypts the file template corresponding to the template share, and sends the encrypted file template to the user end;
[0117] The user end edits the file template, generates an edited file, and sends the edited file to the server;
[0118] The server performs a first verification on the edited file, and determines that the edited file passing the first verification is a qualified file.
[0119] This process can avoid the limitation caused by the verification order of the first verification and the second verification, effectively combine the first verification and the second verification, and improve the verification accuracy.
[0120] It can be seen that in the embodiments of the present application, the server receives the file template or the edited file sent by the user end; if the file template is received, the server encrypts the file template, and sends the encrypted file template to the user end for file editing to generate an edited file; if the edited file is received, the server performs a first verification on the edited file, and the first verification is used to decrypt the file template corresponding to the edited file; the server determines that the edited file passing the first verification is a qualified file. In this process, the file template is encrypted, so that when the edited file is received, the file template is decrypted to complete the verification of the file template, which improves the security of the file template and improves the verification efficiency of the file template.
[0121] Please refer to Figure 5 , Figure 5 is a verification method flowchart provided by the embodiments of the present application, as shown in Figure 5 , the method comprises the following steps:
[0122] Step 501, the server receives the file template or the edited file sent by the user end;
[0123] Step 502, if the file template is received, the server obtains the verification rule in the file template, and obtains the unique identifier of the file template;
[0124] Step 503, the server stores the verification rule and the unique identifier correspondingly, and generates a verification rule table;
[0125] Step 504, the server encrypts the file template and sends the encrypted file template to the user terminal for file editing to generate an edited file;
[0126] Step 505, the server performs a first check on the edited file, and the first check is used to decrypt the file template corresponding to the edited file;
[0127] Step 506, the server obtains the unique identifier corresponding to the edited file, traverses the check rule table, and determines whether the unique identifier exists in the check rule table;
[0128] Step 507, if the unique identifier exists in the check rule table, the server performs a second check on the edited file, and the second check is: obtaining the first check rule corresponding to the edited file, and matching the first check rule with the check rule corresponding to the unique identifier; if the matching is successful, it is determined that the edited file passes the second check;
[0129] Step 508, the server determines that the edited file passing the first check and the second check is a qualified file.
[0130] The above steps 501-508 are that the server simultaneously performs a first check and a second check on the received edited file, and determines that the edited file is a qualified file in the case that the edited file passes the first check and the second check. For specific description, refer to the corresponding description of the check method described in steps 101-107, which will not be repeated here.
[0131] It can be seen that in the embodiments of the present application, whether the edited file is a qualified file is determined through the first check based on the server signature and the second check based on the file template check rule, which improves the accuracy and reliability of the check.
[0132] Please refer to Figure 6 , Figure 6 is another check method flowchart provided by the embodiments of the present application, as shown in Figure 6 , the method comprises the following steps:
[0133] Step 601, the server receives the file template or the edited file sent by the user terminal;
[0134] Step 602, if the file template is received, the server obtains the check rule in the file template, and simultaneously obtains the unique identifier of the file template;
[0135] Step 603, the server stores the check rule and the unique identifier correspondingly to generate a check rule table;
[0136] Step 604, the server encrypts the file template, and sends the encrypted file template to the user terminal for file editing to generate an edited file;
[0137] Step 605, the server performs a first check on the edited file, and the first check is used to decrypt the file template corresponding to the edited file;
[0138] Step 606, a unique identifier corresponding to the edited file is obtained, and the check rule table is traversed to determine whether the unique identifier exists in the check rule table;
[0139] Step 607, if the unique identifier exists in the check rule table, a second check is performed on the edited file, and the second check is that a first check rule corresponding to the edited file is obtained, and the first check rule is matched with a check rule corresponding to the unique identifier; if the matching is successful, it is determined that the edited file passes the second check;
[0140] Step 608, if the edited file does not pass the first check, the server obtains a file template mark qualified number corresponding to the edited file that passes the second check;
[0141] Step 609, if the mark qualified number is less than a preset number, the server determines that the edited file is a qualified file, and increases the file template mark qualified number by one.
[0142] The above steps 601-609 are that the server simultaneously performs the first check and the second check on the received edited file, and in the case that the edited file does not pass the first check but passes the second check, allows to determine the edited file as a qualified file for a limited number of times. For specific description, reference can be made to the corresponding description of the check method described in steps 101-107, which will not be described here.
[0143] In the embodiments of the present application, in the case that the edited file does not pass the first check based on the server signature but passes the second check based on the file template check rule, the edited file is determined as a qualified file within a preset number of times, which improves the flexibility and comprehensiveness of the check.
[0144] As described above, please refer to Figure 7 , Figure 7 is a structural schematic diagram of an electronic device provided by the embodiments of the present application, as shown in Figure 7 the electronic device includes a processor, a memory, a communication interface, and one or more programs, wherein the above one or more programs are stored in the above memory and are configured to be executed by the above processor, and the program includes instructions for performing the following steps:
[0145] The server receives a file template or an edited file sent by the user terminal;
[0146] If the file template is received, the template type of the file template is determined, and the template type includes a first type of template and a second type of template;
[0147] If the file template is the first type of template, an existing key is obtained from a locally stored key store to encrypt the file template;
[0148] If the file template is the second type of template, a new key is generated to encrypt the file template;
[0149] The encrypted file template is sent to the user terminal for file editing to generate an edited file;
[0150] If the edited file is received, the server performs a first check on the edited file, and the first check is used to decrypt a file template corresponding to the edited file;
[0151] The server determines that the edited file that passes the first check is a qualified file.
[0152] As can be seen, in the embodiments of the present application, the server receives a file template or an edited file sent by the user terminal; if the file template is received, the server encrypts the file template and sends the encrypted file template to the user terminal for file editing to generate an edited file; if the edited file is received, the server performs a first check on the edited file, and the first check is used to decrypt a file template corresponding to the edited file; the server determines that the edited file that passes the first check is a qualified file. In this process, the file template is encrypted, so that when the edited file is received, the file template is decrypted to complete the check on the file template, which improves the security of the file template and improves the check efficiency of the file template.
[0153] In one possible example, after the file template is received, the method further includes:
[0154] Obtaining a check rule in the file template;
[0155] Obtaining a unique identifier of the file template;
[0156] Storing the check rule and the unique identifier correspondingly to generate a check rule table.
[0157] In one possible example, the first check on the edited file further includes:
[0158] Obtaining an encryption time of a file template corresponding to the edited file;
[0159] checking the encrypted time to determine whether the encrypted time meets a preset time range.
[0160] In one possible example, after the server performs the first check on the edited file, the method further includes:
[0161] obtaining a unique identifier corresponding to the edited file;
[0162] traversing the check rule table to determine whether the unique identifier exists in the check rule table;
[0163] If the unique identifier exists in the check rule table, performing a second check on the edited file, the second check being: obtaining a first check rule corresponding to the edited file, and matching the first check rule with a check rule corresponding to the unique identifier; if the matching is successful, determining that the edited file passes the second check.
[0164] In one possible example, if the edited file passes the first check, after performing the second check on the edited file, the method further includes:
[0165] determining that the edited file that passes the first check and the second check is a qualified file.
[0166] In one possible example, if the edited file does not pass the first check, after performing the second check on the edited file, the method further includes:
[0167] obtaining a qualified number of times of a file template corresponding to the edited file that passes the second check;
[0168] If the qualified number of times is less than a preset number of times, determining that the edited file is a qualified file;
[0169] incrementing the qualified number of times of the file template by one.
[0170] In one possible example, if the edited file does not pass the first check, after performing the second check on the edited file, the method further includes:
[0171] obtaining a unique identifier and a check rule corresponding to the edited file that passes the second check;
[0172] generating a file template corresponding to the edited file according to the unique identifier and the check rule;
[0173] outputting a file template number request to a user end, and receiving a template number input by the user;
[0174] encrypt the file templates corresponding to the template shares in quantity, and send the encrypted file templates to the user terminal;
[0175] receive the edited file sent by the user terminal, and perform first checking on the edited file;
[0176] determine that the edited file passing the first checking is a qualified file.
[0177] Figure 8 is a functional unit composition block diagram of the checking device 800 involved in the embodiments of the present application. The checking device 800 is applied to an electronic device, and the checking device 800 comprises:
[0178] a receiving unit 801, configured to receive a file template or an edited file sent by a user terminal;
[0179] a determining unit 802, configured to, if the file template is received, determine a template type of the file template, wherein the template type comprises a first type of template and a second type of template;
[0180] a first encryption unit 803, configured to, if the file template is the first type of template, acquire an existing key from a locally stored key library to encrypt the file template;
[0181] a second encryption unit 804, configured to, if the file template is the second type of template, generate a new key to encrypt the file template;
[0182] a generating unit 805, configured to send the encrypted file template to the user terminal for file editing to generate an edited file;
[0183] a checking unit 806, configured to, if the edited file is received, perform first checking on the edited file, wherein the first checking is used to check encryption of a file template corresponding to the edited file;
[0184] a determining unit 807, configured to determine that the edited file passing the first checking is a qualified file.
[0185] It can be seen that the verification device provided by the embodiment of the application receives a file template or an edited file sent by a user terminal; if the file template is received, the file template is encrypted, and the encrypted file template is sent to the user terminal for file editing to generate an edited file; if the edited file is received, the edited file is subjected to first verification, and the first verification is used to decrypt the file template corresponding to the edited file; and the edited file that passes the first verification is determined as a qualified file. In this process, the file template is encrypted, so that when the edited file is received, the file template is decrypted to complete the verification of the file template, thereby improving the security of the file template and the verification efficiency of the file template.
[0186] In an optional example, the determination unit 802 is further configured to:
[0187] obtain a verification rule in the file template;
[0188] obtain a unique identifier of the file template;
[0189] store the verification rule and the unique identifier correspondingly, and generate a verification rule table.
[0190] In an optional example, the verification unit 806 is further configured to:
[0191] obtain an encryption time of the file template corresponding to the edited file;
[0192] verify the encryption time, and determine that the encryption time meets a preset time range.
[0193] In an optional example, the verification unit 806 is further configured to:
[0194] obtain a unique identifier corresponding to the edited file;
[0195] traverse the verification rule table to determine whether the unique identifier exists in the verification rule table;
[0196] if the unique identifier exists in the verification rule table, the edited file is subjected to second verification, and the second verification is: obtaining a first verification rule corresponding to the edited file, and matching the first verification rule with a verification rule corresponding to the unique identifier; if the matching is successful, it is determined that the edited file passes the second verification.
[0197] In an optional example, the determination unit 807 is configured to:
[0198] determine that the edited file that passes the first verification and the second verification is a qualified file.
[0199] In an optional example, if the edited file fails the first check, the checking unit 806 is further configured to:
[0200] obtain a qualified number of file templates corresponding to the edited file passing the second check;
[0201] if the qualified number is less than a preset number, determine that the edited file is a qualified file;
[0202] increment the qualified number of file templates by one.
[0203] In an optional example, if the edited file fails the first check, the checking unit 806 is further configured to:
[0204] obtain a unique identifier and a checking rule corresponding to the edited file passing the second check;
[0205] generate a file template corresponding to the edited file according to the unique identifier and the checking rule;
[0206] output a file template number request to the user terminal, and receive a template number input by the user;
[0207] encrypt a number of file templates corresponding to the template number, and send the encrypted file templates to the user terminal;
[0208] receive the edited file sent by the user terminal, and perform a first check on the edited file;
[0209] determine that the edited file passing the first check is a qualified file.
[0210] Embodiments of the present application further provide a computer readable storage medium, wherein the computer readable storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to perform some or all of the steps of any of the methods described in the above method embodiments, and the computer includes a mobile terminal.
[0211] Embodiments of the present application further provide a computer program product, which includes a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform some or all of the steps of any of the methods described in the above method embodiments. The computer program product can be a software installation package, and the computer includes a mobile terminal.
[0212] It should be noted that, for the foregoing method embodiments, the sequences of the described actions can be changed, and the actions can be performed in other sequences or concurrently. Additionally, it should be understood that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0213] In the above embodiments, the description of each embodiment is focused on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0214] In the several embodiments provided by the present application, it should be understood that the disclosed apparatus can be implemented in other manners. For example, the apparatus embodiments described above are merely schematic; for example, the division of the units is only a logical function division; there can be another division manner for the actual implementation; for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different parts can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrically, mechanically or in other forms.
[0215] The units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place or distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments.
[0216] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware or software functional units.
[0217] If the above integrated units are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable memory. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a memory and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the above-mentioned methods of various embodiments of the present application. The aforementioned memory includes: a U disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0218] A person of ordinary skill in the art can understand that all or part of the steps of the various methods of the above embodiments can be completed by a program instructing relevant hardware, and the program can be stored in a computer readable memory, which can include a flash disk, a ROM, a RAM, a magnetic disk or an optical disk, etc.
[0219] The embodiments of the present application are described in detail above, and the principles and implementation manners of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range will be changed, and the above description of the embodiments is not used to limit the present application.
Claims
1. A method of checking, characterized by, The method comprises: receiving a file template or an edited file sent by a user terminal; if the file template is received, determining a template type of the file template, the template type comprising a first type of template and a second type of template; if the file template is the first type of template, obtaining an existing key from a locally stored key library to encrypt the file template; if the file template is the second type of template, generating a new key to encrypt the file template; sending the encrypted file template to the user terminal for file editing to generate an edited file; if the edited file is received, performing a first check on the edited file to verify whether the edited file is tampered with, the first check being used to decrypt a file template corresponding to the edited file; determining that the edited file passing the first check is a qualified file; The method further comprises: obtaining a unique identifier corresponding to the edited file, wherein the unique identifier is generated according to physical parameters, network parameters or task parameters of the user terminal; traversing a check rule table to determine whether the unique identifier exists in the check rule table; if the unique identifier exists in the check rule table, performing a second check on the edited file, the second check being: obtaining a first check rule corresponding to the edited file, and matching the first check rule with a check rule corresponding to the unique identifier; if the matching is successful, it is determined that the edited file passes the second check; if the edited file does not pass the first check, the method further comprises, after the second check on the edited file: obtaining a qualified number of times of a file template corresponding to the edited file passing the second check; if the qualified number of times is less than a preset number of times, determining that the edited file is a qualified file; incrementing the qualified number of times of the file template by one.
2. The method of claim 1, wherein, After receiving the file template, the method further comprises: obtaining a check rule in the file template; obtaining a unique identifier of the file template; storing the check rule and the unique identifier correspondingly to generate a check rule table.
3. The method of claim 1, wherein, The first check on the edited file further comprises: obtaining an encryption time of a file template corresponding to the edited file; checking the encryption time to determine whether the encryption time satisfies a preset time range.
4. The method of claim 1, wherein, if the edited file passes the first check, the method further comprises, after the second check on the edited file: determining that the edited file passing the first check and the second check is a qualified file.
5. The method of claim 1, wherein, if the edited file does not pass the first check, the method further comprises, after the second check on the edited file: obtaining a unique identifier and a check rule corresponding to the edited file passing the second check; generating a file template corresponding to the edited file according to the unique identifier and the check rule; outputting a file template number request to the user terminal, and receiving a template number input by the user; encrypting a number of file templates corresponding to the template number, and sending the encrypted file templates to the user terminal; receive the edited file sent by the user terminal, and perform a first check on the edited file; determine that the edited file passing the first check is a qualified file.
6. A checking device, characterized in that The apparatus is configured to perform the method of any one of claims 1-5, and the apparatus comprises: a receiving unit configured to receive a file template or an edited file sent by a user terminal; an encryption unit configured to, if a file template is received, encrypt the file template, and send the encrypted file template to the user terminal for file editing to generate an edited file; a checking unit configured to, if an edited file is received, perform a first check on the edited file to verify whether the edited file is tampered, the first check being configured to check encryption of a file template corresponding to the edited file; a determining unit configured to determine that the edited file passing the first check is a qualified file.
7. An electronic device, comprising: A computer program product comprising a processor, a memory, a communication interface, and one or more programs stored in the memory and configured to be executed by the processor, the programs comprising instructions for performing the steps of the method of any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, A computer program for electronic data exchange, wherein the computer program causes a computer to perform the method of any one of claims 1-5.
Citation Information
Patent Citations
Method for verifying whether paper certificate is tampered or not
CN107194266A
Data processing method and device, computer equipment and storage medium
CN110765741A