A method and system for processing structured data of a contract with a double-layer signature

By performing dual-layer signing on the structured data and PDF files of electronic contracts, the problems of high coupling between data and format, low verification efficiency, and poor cross-system compatibility are solved, thereby improving data security and flexibility and supporting rapid cross-system verification and management.

CN122133198APending Publication Date: 2026-06-02BEIJING HUIYUEYUN TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING HUIYUEYUN TECHNOLOGY CO LTD
Filing Date
2026-01-22
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing electronic contract processing methods suffer from problems such as high coupling between data and format, low verification efficiency, poor cross-system compatibility, insufficient security and traceability, and limited scalability and reusability.

Method used

A two-layer signature mechanism is adopted, which digitally signs the structured data file and the PDF file respectively, and embeds the signature information into the metadata area to ensure the logical association and independent verification of the data and the file.

Benefits of technology

It achieves dual anti-tampering protection for data, improves cross-system interoperability and verification efficiency, ensures data authenticity and flexibility, and supports contract management in different scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122133198A_ABST
    Figure CN122133198A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of double-layer signature contract structured data processing method, comprising: step 1, extracting key information from contract original file, and key information is encapsulated as structured data file;Step 2, the generated structured data file is digitally signed, and structured data file is generated;Step 3, conversion PDF file, structured data file is embedded into the metadata area of PDF file;Step 4, the entire PDF file is digitally signed.Double signature design can double guarantee the validity of data and prevent tampering, and third party system can compare PDF file and the structured data file in its metadata area, and check whether the key information in PDF file is consistent with the information of structured data file, improve security and credibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of contract encryption technology, and in particular to a method and system for processing structured contract data with two-layer signatures. Background Technology

[0002] With the widespread application of electronic contracts in government affairs, finance, corporate procurement, and other fields, the secure storage, reliable transmission, and efficient verification of contract data have become core requirements. In existing technologies, electronic contracts primarily use PDF files as their carrier, with structured data typically embedded directly into the PDF text or transmitted as an attachment.

[0003] In scenarios where only PDF contract documents are available, existing solutions generally employ Optical Character Recognition (OCR) or PDF content parsing technology to extract structured data from the contract. This involves recognizing, parsing, and semantically analyzing the contract format, then generating structured contract data through rule matching. While these solutions provide some technical support for the digital management of electronic contracts, they still have significant technical limitations.

[0004] In existing electronic contract processing methods, the following methods are typically used to obtain the structured data within the contract document: like Figure 3 As shown, when only a PDF document is available, OCR (Optical Character Recognition) or PDF parsing technology is often used to identify and extract the contract content. Then, semantic analysis and a rule engine are used to convert the identified key information (such as contract number, signatories, amount, performance period, etc.) into structured data for subsequent system use. This approach has the following drawbacks: ① The data and layout are highly coupled. Contract data is tightly coupled with the PDF file structure. The structured data generated by OCR recognition is only a secondary extraction of the document content, lacking the guarantee of the original data. It is difficult to flexibly adjust or optimize the contract layout while maintaining the authenticity of the data.

[0005] ② The verification and processing efficiency is low. Both OCR and parsing methods require processing the complete file content. The recognition and verification process is computationally intensive and time-consuming, making it difficult to meet the performance requirements of batch contract or high-concurrency verification scenarios.

[0006] ③ Poor cross-system compatibility: Existing methods rely on complex file parsing or specific format interfaces, making it difficult to port between different business systems. They also have strong interface dependencies and poor cross-platform interoperability.

[0007] ④ Data portability and verifiability: OCR extraction results depend on algorithm accuracy, are subject to recognition errors, and it is difficult to reliably verify the source and integrity of the data. The generated structured data is difficult to directly verify its authenticity and consistency in other systems.

[0008] ⑤ Insufficient security and traceability: Existing solutions lack a mechanism for binding and verifying structured data with the original contract text, making it impossible to guarantee that data has not been tampered with during file transmission or sharing, and making it difficult to achieve reliable flow and traceability of contract data.

[0009] ⑥ Limited scalability and reusability: Because the generation method of structured data depends on business logic and parsing rules, repeated development is required in different systems or scenarios, making it impossible to form a unified standard and limiting the reuse and sharing of structured contract data. Summary of the Invention

[0010] The purpose of this invention is to provide a method and system for processing structured contract data with two-layer signatures, which can solve the problems of high coupling, low verification efficiency and poor cross-platform interoperability in existing electronic contract data storage and verification methods.

[0011] This invention is achieved through the following technical solution: A method for processing structured contract data with a two-layer signature, comprising: Step 1: Extract key information from the original contract documents, organize it according to a predefined data structure, and encapsulate the key information from the original contract documents into a structured data file; Step 2: Use a signature algorithm to digitally sign the generated structured data file, generate the first digital signature information, and associate and store the first digital signature information with the structured data file; Step 3: Convert the original contract file into a PDF file, and embed the signed structured data file into the metadata area of ​​the PDF file. The complete structured data file and corresponding signature information are saved in the metadata area to ensure logical consistency. Step 4: After embedding the structured data file, use a signature algorithm to digitally sign the PDF file, generate a second digital signature, and store the second digital signature associating it with the PDF file.

[0012] An electronic contract processing system, comprising: The data generation module is used to generate structured data files based on the original contract documents; The signature module is used to digitally sign structured data files and PDF files; The embedding module is used to embed signed structured data files into the metadata area of ​​a PDF file.

[0013] Compared with previous technologies, the beneficial effects of the present invention are as follows: 1. The dual signature design of this invention can provide dual protection for the validity of data and prevent tampering. Third-party systems can compare the PDF file with the structured data file in its metadata area and check whether the key information in the PDF file is consistent with the information in the structured data file, thereby improving security and credibility.

[0014] 2. This invention allows third-party systems to use contracts without relying on the client's interface, quickly parse and verify structured contract data, and significantly improve cross-system interoperability and verification efficiency without depending on external methods such as OCR and API.

[0015] 3. Digital signatures for structured data files ensure data integrity, while digital signatures for PDF files ensure overall file security, achieving dual anti-tampering protection for both files and data.

[0016] 4. Under the premise of ensuring data authenticity, this invention can independently optimize, adjust or adapt the contract format to different scenarios without re-signing core data, which greatly improves the flexibility and applicability of electronic contract management. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating an embodiment of a contract structured data processing method with dual-layer signatures according to the present invention. Figure 2 This is a block diagram of an embodiment of an electronic contract processing system according to the present invention; Figure 3 A flowchart of existing technology; Figure 4 A flowchart for digital signatures. Detailed Implementation

[0018] The present invention will now be described in detail with reference to the accompanying drawings, but the scope of protection of the present invention is not limited to the following description: Example 1: like Figure 1 As shown, a method for processing structured contract data with a two-layer signature includes: Step 1: Extract key information from the original contract document, organize it according to a predefined data structure, and encapsulate the key information in the original contract document into a structured data file; the original contract document is in Word text format or rich text format. The key information includes contract number, signatory information, contract amount, performance period, signing time, contract type, and attachment information, etc. Step 2: Use a signature algorithm to digitally sign the generated structured data file, generate first digital signature information, and store the first digital signature information in association with the structured data file; the first digital signature information includes a first digital signature value, a signature algorithm identifier, and a first digital certificate for verification; Step 3: Convert the original contract file into a PDF file, and embed the signed structured data file into the metadata area of ​​the PDF file. The complete structured data file and corresponding signature information are saved in the metadata area to ensure logical consistency. Step 4: After embedding the structured data file, use a signature algorithm to digitally sign the PDF file, generate a second digital signature, and store the second digital signature as associated with the PDF file; the second digital signature includes a second digital signature value, a signature algorithm identifier, and a second digital certificate for verification.

[0019] This invention achieves standardized and structured storage of contract data, avoiding coupling between data and format, making subsequent data retrieval and parsing more efficient. The dual-signature design ensures the authenticity and integrity of the structured data. Even if the contract PDF file is copied or non-critical content is modified, digital signature verification can detect whether the data has been tampered with, improving security and credibility.

[0020] Furthermore, the structured data file is an XML format data file, implemented using UTF-8 encoding. XML format is a commonly used structured data file, and UTF-8 encoding is a standard encoding format, which can ensure consistency in reading, parsing, and verification across systems.

[0021] Furthermore, the signature algorithm is the SM2 digital signature algorithm; the signature algorithm identifier is the SM2 algorithm identifier.

[0022] Step 2 includes the following steps: Step 21: Calculate the first digest value based on the content of the structured data file; Step 22: Read the first digital certificate and the corresponding first SM2 private key, and use the first SM2 private key to perform SM2 signature operation on the first digest value to generate the first digital signature value; Step 23: Encapsulate the first digital signature value, the SM2 algorithm identifier, and the first digital certificate to form the first digital signature information, and store it in association with the structured data file; Similarly, step 4 includes the following steps: Step 41: Determine the byte range to be signed in the PDF file, extract the corresponding document data based on the byte range, and calculate the second digest value; Step 42: Read the second digital certificate and the corresponding second SM2 private key, and use the second SM2 private key to perform SM2 signature operation on the second digest value to obtain the second digital signature value; Step 43: Encapsulate the second digital signature value, SM2 algorithm identifier, and second digital certificate to form second digital signature information, and embed the second digital signature information into the signature field of the PDF file for associated storage, thereby achieving PDF file integrity and identity authentication protection; The "SM2 digital signature algorithm" refers to a signature method that conforms to the standard "SM2 Elliptic Curve Public Key Cryptography Algorithm Part 2: Digital Signature Algorithm" issued by the State Cryptography Administration. In practical applications, the SM2 digital signature algorithm typically calls the SM3 digest algorithm to calculate the digest value (i.e., the first digest value and the second digest value mentioned in this invention), or it can use other secure digest algorithms such as SHA-256. This is a conventional technical solution well-known to those skilled in the art, and therefore will not be elaborated upon further.

[0023] like Figure 4 As shown, the "r and s components" output in the flowchart are the two core parameters constituting the SM2 digital signature value. This is a technology well-known to those skilled in the art, so it will not be elaborated upon further. The first digital certificate contains information about the first SM2 public key, and the second digital certificate contains information about the second SM2 public key. The first SM2 public key corresponds to the first SM2 private key, and the second SM2 public key corresponds to the second SM2 private key. Steps 2 and 4 work together to form a "dual-layer signature mechanism": the signature of the structured data file ensures the integrity of the data content, and the signature of the PDF file ensures the overall security of the file; achieving dual anti-tampering protection for both the file and the data. Moreover, after the structured data file is written to the PDF file, the data logic of the two is separated, which does not affect the display effect of the contract; at the same time, it ensures that the structured data is bound to the file, laying the foundation for independent verification by third-party systems after the file is sent.

[0024] To avoid security risks when third-party systems read tampered PDF content, this invention recommends prioritizing full verification of the PDF file in the business process; only after confirming the trustworthiness of the PDF file should independent verification be performed on the embedded XML structured data.

[0025] However, from an implementation perspective, PDF files and XML data files each have independent digital signature systems. Therefore, the system technically supports independent verification of PDF file signatures and XML data signatures. This invention does not restrict the order in which the signature verification operations are called.

[0026] This is illustrated using structured data files as XML data files: When using contracts processed by this invention in third-party systems or external business modules, to avoid security risks when the third-party system reads tampered PDF content, this invention recommends prioritizing full verification of the PDF file in the business process; after confirming the trustworthiness of the PDF file, independent verification should then be performed on the embedded XML structured data, specifically as follows: First, the second digital signature information of the PDF file is verified. After the second digital signature information is verified, the XML data file and its associated first digital signature information are extracted from the metadata area of ​​the PDF file. Finally, the first digital signature information is verified to confirm the authenticity of the contract data. If the second digital signature verification of the PDF file shows "untrusted file," regardless of whether the first digital signature verification of the XML data file shows "untrusted file," it indicates that the content of both the PDF file and the XML data file has been tampered with and does not match the original contract document. If the second digital signature verification of the PDF file shows "trusted file," and the first digital signature verification of the XML data file shows "trusted file," it indicates that the content of the PDF file has not been modified and is completely consistent with the original contract document. However, from an implementation perspective, in existing PDF standards and common implementations, PDF digital signatures do not necessarily cover all metadata areas. Especially in scenarios supporting "incremental updates," the PDF file itself can maintain a valid signature, while the metadata content may be modified by subsequent operations. Therefore, the system technically supports independent verification of PDF file signatures and XML data signatures, and this invention does not restrict the order in which signature verification operations are called.

[0027] In summary, this invention enables third-party systems or external business modules to quickly parse and verify structured contract data without relying on external methods such as OCR and APIs, significantly improving cross-system interoperability and verification efficiency.

[0028] Example 2: like Figure 2 As shown, an electronic contract processing system is characterized by comprising: The data generation module is used to generate structured data files based on the original contract documents; The signature module is used to digitally sign structured data files and PDF files; The embedding module is used to embed signed structured data files into the metadata area of ​​a PDF file.

[0029] The aforementioned data generation module, signature module, and embedding module work together to enable the present invention to independently optimize, adjust, or adapt the contract format to different scenarios while ensuring data authenticity, without having to re-sign core data, thus greatly improving the flexibility and applicability of electronic contract management.

[0030] Although the present invention has been illustrated and described through specific embodiments and alternative methods, it should be understood that various changes and modifications may be made without departing from the spirit and scope of the invention. Therefore, it should be understood that the present invention is not limited in any sense except by the appended claims and their equivalents.

Claims

1. A method for processing structured contract data with a two-layer signature, characterized in that, include: Step 1: Extract key information from the original contract documents, organize it according to a predefined data structure, and encapsulate the key information from the original contract documents into a structured data file; Step 2: Use a signature algorithm to digitally sign the generated structured data file, generate the first digital signature information, and associate and store the first digital signature information with the structured data file; Step 3: Convert the original contract file into a PDF file, and embed the signed structured data file into the metadata area of ​​the PDF file. The complete structured data file and corresponding signature information are saved in the metadata area to ensure logical consistency. Step 4: After embedding the structured data file, use a signature algorithm to digitally sign the PDF file, generate a second digital signature, and store the second digital signature associating it with the PDF file.

2. The contract structured data processing method with dual signatures according to claim 1, characterized in that: The original contract document is in Word text format or rich text format; The key information includes contract number, signatory information, contract amount, performance period, signing time, contract type, and attachment information.

3. The contract structured data processing method with dual signatures according to claim 1, characterized in that: The structured data file is an XML format data file.

4. The contract structured data processing method with dual signatures according to claim 1, characterized in that: The first digital signature information includes a first digital signature value, a signature algorithm identifier, and a first digital certificate used for verification; The second digital signature information includes a second digital signature value, a signature algorithm identifier, and a second digital certificate used for verification.

5. The contract structured data processing method with dual signatures according to claim 4, characterized in that: The signature algorithm is the SM2 digital signature algorithm; the signature algorithm identifier is the SM2 algorithm identifier.

6. The contract structured data processing method with dual signatures according to claim 5, characterized in that, Step 2 includes the following steps: Step 21: Calculate the first digest value based on the content of the structured data file; Step 22: Read the first digital certificate and the corresponding first SM2 private key, and use the first SM2 private key to perform SM2 signature operation on the first digest value to generate the first digital signature value; Step 23: Encapsulate the first digital signature value, the SM2 algorithm identifier, and the first digital certificate to form the first digital signature information, and store it in association with the structured data file.

7. The contract structured data processing method with dual signatures according to claim 5, characterized in that, Step 4 includes the following steps: Step 41: Determine the byte range to be signed in the PDF file, extract the corresponding document data based on the byte range, and calculate the second digest value; Step 42: Read the second digital certificate and the corresponding second SM2 private key, and use the second SM2 private key to perform SM2 signature operation on the second digest value to obtain the second digital signature value; Step 43: Encapsulate the second digital signature value, the SM2 algorithm identifier, and the second digital certificate to form second digital signature information, and embed the second digital signature information into the signature field of the PDF file for associated storage, thereby achieving PDF file integrity and identity authentication protection.

8. An electronic contract processing system for executing the contract structured data processing method with double signature as described in any one of claims 1-7, characterized in that, include: The data generation module is used to generate structured data files based on the original contract documents; The signature module is used to digitally sign structured data files and PDF files; The embedding module is used to embed signed structured data files into the metadata area of ​​a PDF file.