Digital signature generation and verification method, device, system, medium and product
By generating digital digests and obtaining timestamp information locally on the user terminal, combining them with file metadata to generate a signature request, and binding multiple timestamps on the server side, the system solves the problems of insufficient efficiency and security of existing electronic signature technologies, and achieves efficient and secure signature generation and verification.
Patent Information
- Application Number
- CN202611103648.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-11-10
AI Technical Summary
Existing electronic signature generation and verification technologies have significant shortcomings in terms of efficiency, security, and reliability, making it difficult to meet the needs of government, finance, healthcare, and judicial sectors for efficient, secure, and trustworthy signature verification.
The user terminal generates a digital digest of the file to be signed locally and obtains the timestamp information. It then generates a signature request by combining the file metadata. The server uses a multi-timestamp and metadata binding mechanism to perform the signature. The terminal stores the complete signature information, and the server centrally manages the key and completes the signature operation.
It improves the efficiency of signature generation, enhances the traceability and security of signature evidence, ensures the inseparable association between signature information and the document entity, the operating user, and the trusted time, and improves the overall reliability of the system.
Smart Images

Figure CN123074723A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology or other related fields, and in particular to a method, apparatus, system, medium and product for generating and verifying digital signatures. Background Technology
[0002] In recent years, electronic document verification technology has become a fundamental security capability in key areas such as government affairs, finance, healthcare, and the judiciary, placing stringent requirements on high-concurrency processing, low response latency, and traceability of evidence.
[0003] However, existing electronic signature generation and verification technologies have significant shortcomings in terms of efficiency, security, and reliability, making it difficult to meet the requirements of efficient, secure, and trustworthy signature verification in the aforementioned scenarios. Summary of the Invention
[0004] This application provides a digital signature generation and verification method, apparatus, system, medium, and product. The user terminal generates a digital digest of the file to be signed locally and obtains at least one timestamp. The digital digest and at least one timestamp are then combined with the file metadata to assemble a signature request and send it to the server. This reduces the computational burden on the server and enhances the traceability of the signature evidence by binding multiple timestamps and metadata. Thus, while ensuring the security of signature generation, this effectively improves the preprocessing efficiency of the signature request and the integrity of the evidence chain in subsequent verification steps.
[0005] In a first aspect, embodiments of this application provide a digital signature generation method, applied to a user terminal, the method comprising:
[0006] Obtain the file to be signed, generate a digital digest of the file to be signed, and obtain at least one timestamp information corresponding to the digital digest;
[0007] Based on the digital digest, the at least one timestamp information, and the metadata of the file to be signed, a signature generation request corresponding to the file to be signed is generated, and the signature generation request is sent to the server connected to the user terminal, so that the server generates digital signature information according to the signature generation request;
[0008] Receive and store the digital signature information sent by the server.
[0009] Secondly, embodiments of this application provide a digital signature generation method, applied to a server, the method comprising:
[0010] Receive a signature generation request sent by a user terminal, and parse the digital digest of the file to be signed and at least one timestamp information corresponding to the digital digest from the signature generation request;
[0011] According to a preset key rotation strategy, a target encrypted private key that is currently in a valid state is determined from multiple candidate encrypted private keys, and the digital digest is signed using the target encrypted private key to generate a digital signature.
[0012] Based on the digital signature, the public key information corresponding to the target encrypted private key, and the version identifier of the target encrypted private key, digital signature information is generated and sent to the user terminal.
[0013] Thirdly, embodiments of this application provide a digital signature verification method applied to a user terminal, the method comprising:
[0014] Obtain the document to be verified and the digital signature information corresponding to the document to be verified; wherein, the digital signature information includes a digital signature, public key information corresponding to the digital signature value, and a key version identifier corresponding to the public key information;
[0015] The document to be verified, the digital signature, the public key information, and the key version identifier are sent to the server connected to the user terminal, so that the server performs a verification operation on the digital signature to verify the integrity of the document to be verified.
[0016] Receive and store the verification result information returned by the verification server, wherein the verification result information includes at least a verification status identifier indicating whether the verification has passed or not.
[0017] Fourthly, embodiments of this application provide a digital signature verification method applied to a server, the method comprising:
[0018] The system receives at least one signature verification request sent by a user terminal. Each signature verification request carries a file digital digest of the file to be verified, a digital signature, public key information corresponding to the digital signature value, a key version identifier corresponding to the public key information, and at least one timestamp information corresponding to the file digital digest.
[0019] For each of the aforementioned signature verification requests, the public key information is extracted from the signature verification request, and the current status information of the digital certificate corresponding to the public key information is determined;
[0020] When the current status information indicates that the digital certificate is in a valid state, a preset hash operation is performed on the file to be verified to generate a digital digest to be compared.
[0021] The digital digest to be compared is first compared with the digital digest of the file to obtain a digest consistency result; and the first timestamp information is second compared with the second timestamp information to obtain a timestamp consistency result.
[0022] Based on the digest consistency result and the timestamp consistency result, the verification result information corresponding to the signature verification request is generated and sent to the user terminal.
[0023] Fifthly, embodiments of this application provide a digital signature generation apparatus, comprising:
[0024] The information acquisition module is used to acquire the file to be signed, generate a digital digest of the file to be signed, and acquire at least one timestamp information corresponding to the digital digest;
[0025] The information sending module is used to generate a signature generation request corresponding to the file to be signed based on the digital digest, the at least one timestamp information and the metadata of the file to be signed, and send the signature generation request to the server connected to the user terminal, so that the server generates digital signature information according to the signature generation request.
[0026] The signature receiving module is used to receive and store the digital signature information sent by the server.
[0027] Sixthly, embodiments of this application provide a digital signature generation apparatus and an application server, the apparatus comprising:
[0028] The information receiving module is used to receive a signature generation request sent by a user terminal, and to parse a digital digest of the file to be signed and at least one timestamp information corresponding to the digital digest from the signature generation request.
[0029] The signature generation module is used to determine the target encrypted private key that is currently in a valid state from multiple candidate encrypted private keys according to a preset key rotation strategy, and to perform a signature operation on the digital digest using the target encrypted private key to generate a digital signature.
[0030] The signature sending module is used to generate digital signature information based on the digital signature, the public key information corresponding to the target encrypted private key, and the version identifier of the target encrypted private key, and send the digital signature information to the user terminal.
[0031] Seventhly, embodiments of this application provide a digital signature verification device, which is used in a user terminal. The device includes:
[0032] The information acquisition module is used to acquire the document to be verified and the digital signature information corresponding to the document to be verified; wherein, the digital signature information includes a digital signature, public key information corresponding to the digital signature value, and a key version identifier corresponding to the public key information;
[0033] The information sending module is used to send the document to be verified, the digital signature, the public key information and the key version identifier to the server connected to the user terminal, so that the server can perform a verification operation on the digital signature to verify the integrity of the document to be verified.
[0034] The result receiving module is used to receive and store the verification result information returned by the verification server. The verification result information includes at least a verification status identifier indicating whether the verification has passed or not.
[0035] Eighthly, embodiments of this application provide a digital signature verification device, which is used in a user terminal. The device includes:
[0036] The information receiving module is used to receive at least one signature verification request sent by a user terminal. Each signature verification request carries a file digital digest of the file to be verified, a digital signature, public key information corresponding to the digital signature value, a key version identifier corresponding to the public key information, and at least one timestamp information corresponding to the file digital digest.
[0037] The status determination module is used to extract the public key information from the signature verification request for each of the aforementioned signature verification requests, and determine the current status information of the digital certificate corresponding to the public key information;
[0038] The digital digest generation module is used to perform a preset hash operation on the signature to be verified file to generate a digital digest to be compared when the current status information indicates that the digital certificate is in a valid state.
[0039] The comparison module is used to perform a first comparison between the digital digest to be compared and the digital digest of the file to obtain a digest consistency result; and to perform a second time consistency comparison between the first timestamp information and the second timestamp information to obtain a timestamp consistency result.
[0040] The result generation module is used to generate verification result information corresponding to the signature verification request based on the digest consistency result and the timestamp consistency result, and send it to the user terminal.
[0041] Ninthly, embodiments of this application provide a digital signature processing system, including: a user terminal and a server;
[0042] The user terminal is used to execute the digital signature generation method as described in the first aspect, and / or the digital signature verification method as described in the third aspect.
[0043] The server is used to execute the digital signature generation method as described in the second aspect, and / or the digital signature verification method as described in the fourth aspect.
[0044] In a tenth aspect, embodiments of this application provide an electronic device, including: a memory and a processor;
[0045] The memory stores computer-executed instructions;
[0046] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0047] Eleventhly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0048] In a twelfth aspect, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0049] The digital signature generation and verification method, apparatus, system, medium, and product provided in this application's embodiments extract the digital digest of the file to be signed and acquire at least one timestamp information locally on the user terminal. The digital digest, timestamp information, and file metadata are then assembled into a signature generation request and sent to the server for collaborative signature computation. On one hand, resource-intensive operations such as hash calculation and timestamp acquisition are pre-executed on the terminal side, effectively distributing server computational pressure and improving signature generation efficiency. On the other hand, by cryptographically binding the file digest with multi-source timestamps and file metadata during the signature request stage, the final generated digital signature information forms an inseparable association with a specific file entity, the operating user, and a trusted time, effectively preventing signature replay or migration to other files and enhancing the security of the signing process. Furthermore, the server centrally manages the key and completes the signature based on the structured request, while the terminal locally stores the complete signature information, further enhancing the overall reliability of the system. Attached Figure Description
[0050] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0051] Figure 1 Flowchart of the digital signature generation method provided in this application Figure 1 ;
[0052] Figure 2 Flowchart of the digital signature generation method provided in this application Figure 2 ;
[0053] Figure 3 Flowchart of the digital signature verification method provided in this application Figure 1 ;
[0054] Figure 4 Flowchart of the digital signature verification method provided in this application Figure 2 ;
[0055] Figure 5 A schematic diagram of the structure of a digital signature processing system provided in this application;
[0056] Figure 6 Schematic diagram of the digital signature generation device provided in this application Figure 1 ;
[0057] Figure 7 Schematic diagram of the digital signature generation device provided in this application Figure 2 ;
[0058] Figure 8 Schematic diagram of the digital signature verification device provided in this application Figure 1 ;
[0059] Figure 9 Schematic diagram of the digital signature verification device provided in this application Figure 2 ;
[0060] Figure 10 A schematic diagram of the structure of the electronic device provided in this application.
[0061] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0062] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0063] The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0064] The user information (including but not limited to user terminal information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. The collection, use and processing of the relevant data shall comply with relevant laws, regulations and standards, and corresponding operation entry points shall be provided for users to choose to authorize or refuse.
[0065] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.
[0066] As described in the background section, electronic document verification technology has become an indispensable core capability in key sectors such as government affairs, finance, healthcare, and the judiciary. Taking government office work as an example, government agencies need to process massive amounts of electronic documents, contracts, and approval documents, requiring verification systems to ensure document integrity while supporting high-concurrency processing capabilities to meet the real-time needs of cross-departmental collaborative work. In the financial sector, banks, securities firms, and other institutions rely on electronic signatures to complete the signing and verification of critical business documents such as transaction contracts and customer agreements, requiring verification to be completed within millisecond response times to avoid economic losses due to transaction delays. The healthcare industry needs electronic verification to ensure the immutability of sensitive data such as patient electronic medical records and diagnostic reports, while also ensuring the legal validity of data sharing between different medical institutions. Furthermore, in scenarios such as judicial evidence preservation and intellectual property protection, electronic document verification needs to be combined with timestamp technology to form a complete chain of evidence to meet the traceability requirements of evidence in legal proceedings. However, existing electronic signature generation and verification technologies have significant shortcomings in terms of efficiency, security, and reliability, making it difficult to meet the efficient, secure, and reliable verification needs of the aforementioned scenarios.
[0067] To address the aforementioned technical problems, this application provides a digital signature generation method. This method is applied to a user terminal, whereby the user terminal locally completes digital digest extraction, multi-source timestamp acquisition, and metadata binding, before sending a structured signature request to the server for collaborative signature computation. This improves efficiency by distributing server-side computational load through terminal-side preprocessing, enhances security by preventing signature replay and tampering through cryptographic binding of file digests, metadata, and multiple timestamps, and improves system reliability by centrally managing keys and anchoring them to multiple timestamps to form a complete chain of evidence through server-side centralized control.
[0068] It should be noted that the digital signature generation and verification methods, devices, systems, media and products provided in this application can be used in the field of fintech or other related fields, or in any field other than the field of fintech or other related fields. The application fields of the digital signature generation and verification methods, devices, systems, media and products in this application are not limited.
[0069] The digital signature generation and verification method provided in this application is applicable to various scenarios that require signature generation and authenticity and integrity verification of electronic documents.
[0070] For example, in financial transactions, banks, securities firms, and financial leasing companies can use this method to electronically sign and verify transaction contracts, credit agreements, and customer documents, meeting millisecond-level response and judicial evidence requirements. In government office settings, government agencies can use this method to sign and verify electronic documents, administrative approval documents, and electronic certificates, ensuring tamper-proof and traceable document flow in cross-departmental collaborative work. In healthcare, hospitals and medical institutions can use this method to sign, preserve, and verify electronic medical records, prescriptions, test reports, and informed consent forms, ensuring the integrity and legal validity of sensitive medical data. In judicial evidence preservation and intellectual property protection scenarios, courts, notary offices, and intellectual property service agencies can use this method to solidify and preserve electronic evidence, design drawings, and software code, forming a complete chain of evidence through timestamps and blockchain technology.
[0071] Furthermore, the above methods can also be applied to numerous digital business scenarios, such as electronic contract signing (e.g., labor contracts, procurement agreements, lease contracts), signing and sealing of bidding documents, electronic invoices and receipts, real estate registration, and housing provident fund business processing. In short, any field that requires the generation and verification of digital signatures for electronic documents falls within the application scenarios of the technical solutions in this application.
[0072] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0073] Figure 1 Flowchart of the digital signature generation method provided in this application Figure 1 This method is applied to user terminals. For example... Figure 1 As shown, the method includes:
[0074] S101. Obtain the file to be signed, generate a digital digest of the file to be signed, and obtain at least one timestamp information corresponding to the digital digest.
[0075] In this embodiment, the user terminal obtains a document to be digitally signed. This document can be any electronic document requiring subsequent digital signing and verification, such as official documents, contracts, electronic medical records, design drawings, or software code. The user terminal can obtain this document through various methods, including local storage retrieval, user upload, or network reception; this embodiment does not impose specific limitations on these methods.
[0076] After obtaining the file to be signed, the user terminal performs a hash operation on the file to generate a corresponding digital digest (also known as a message digest or digital fingerprint). A digital digest is a fixed-length, irreversible digest of raw data of arbitrary length, generated using a one-way hash function. The server then signs the digital digest, indirectly proving the integrity and authenticity of the file's content, thus avoiding the efficiency issues associated with signing the entire large file.
[0077] In practice, any of the cryptographic hash algorithms such as SHA-256, SHA-384, SHA-512, or SM3 can be used. For example, this embodiment can use the SHA-256 algorithm to perform hash operations to generate a 256-bit digital digest.
[0078] In one optional implementation, the process of generating a digital digest of a file to be signed may include: dividing the file to be signed into multiple consecutive data blocks according to a preset data block size; performing hash iteration operations on each data block in sequence, wherein the hash iteration operation of the current data block depends on the intermediate digest state value obtained after the operation of the previous data block; and determining the final intermediate digest state value as the digital digest of the file to be signed when all data blocks have completed the iteration operation.
[0079] In this embodiment, for large files to be signed, after the user terminal obtains the file, it divides it into multiple consecutive data blocks according to a preset data block size. The preset data block size can be flexibly set according to the actual application scenario, for example, it can be set to 1MB (megabytes), 2MB, 4MB, or 8MB, to achieve a good balance between memory usage and processing efficiency. For files to be signed that are smaller than one data block size, they contain only one data block.
[0080] Specifically, the user terminal can use a streaming reading method to sequentially read data of a preset size starting from the file header. Each data block read forms a data segment until the entire file is completely segmented. This streaming segmentation method eliminates the need to load the entire file to be signed into memory at once, thus significantly reducing the memory usage of the terminal device.
[0081] Hash iteration operations are performed on each data block sequentially according to their order of creation. It should be understood that during this hash iteration operation, the hash iteration operation for the current data block depends on the intermediate digest state value obtained after the operation on the previous data block. Based on this, the user terminal first initializes the initial state vector of the hash algorithm (i.e., the initial digest state value), and then performs a hash compression operation on the first data block based on this initial state vector to obtain the first intermediate digest state value. For the second data block, a hash compression operation is performed based on the first intermediate digest state value to obtain the second intermediate digest state value. This process continues, iterating and updating the intermediate digest state value based on the intermediate digest state value obtained in the previous operation for each data block processed. Throughout the entire iteration process, the user terminal needs to cache the intermediate digest state value after each operation as input for the next data block iteration operation.
[0082] In one implementation, the hash iteration operation can be specifically implemented using the SHA-256 algorithm. For example, in the SHA-256 algorithm, the intermediate digest state value is a 256-bit state variable, consisting of eight 32-bit registers. For each data block, the algorithm treats it as 64 message words, and then performs 64 rounds of compression operations based on the current state variable and the message words, updating the state variable and outputting a new intermediate digest state value. In this way, by processing all data blocks sequentially in the original order, the correct digital digest is obtained, preventing any change in the block order or tampering with the block content from altering the final digest result, thus ensuring the tamper-proof characteristics of the digital digest.
[0083] After the user terminal has traversed the last data block and completed the hash compression operation, it is also necessary to fill and encode the final intermediate digest state value (i.e., add the length padding field specified by the SHA-256 algorithm) and output the final 256-bit hash value as the digital digest of the file to be signed.
[0084] Through the above-described streaming block iterative hashing method, user terminals can generate digital digests of files of any size with extremely low memory overhead, avoiding the risk of memory overflow caused by loading the full text of large files into memory, and improving the applicability and stability of the digital signature generation method.
[0085] After generating the digital digest, the user terminal obtains at least one timestamp corresponding to the digital digest. Here, the timestamp information is used to prove that the digital digest existed before a specific point in time, thereby providing a time-dimensional traceability guarantee for subsequent signature evidence.
[0086] In one implementation, at least one timestamp information includes first timestamp information and second timestamp information. Based on this, the process of obtaining at least one timestamp information corresponding to the digital digest may include: sending a first acquisition request carrying the digital digest and the device identifier of the user terminal to a timestamp authority server, and receiving the first timestamp information returned by the timestamp authority server; the first timestamp information includes first timestamp data signed by the timestamp authority server; submitting the digest certificate of the digital digest and the first timestamp information as on-chain evidence storage data to the blockchain network through a blockchain network interface, and receiving the second timestamp information returned by the blockchain network; the second timestamp information includes the second timestamp data generated by the blockchain network and the block height information corresponding to the on-chain evidence storage data.
[0087] Specifically, a user terminal can send a timestamp request to a Time Stamping Authority (TSA) conforming to RFC 3161, based on a preset timestamp service address. This timestamp request carries a digital digest and the user terminal's device identifier, among other information. Upon receiving the request, the TSA binds the current trusted time with the digital digest, digitally signs the bound data using its private key, generates a timestamp response (TimeStampToken), and returns it to the user terminal.
[0088] After receiving the timestamp response, the user terminal extracts the first timestamp information. This first timestamp information contains at least timestamp data signed by a timestamp authority server (i.e., data signed by the TSA that includes a trusted time and a digital digest binding).
[0089] In addition, user terminals can also obtain second timestamp information through the blockchain network interface. Specifically, the user terminal submits the digital digest and the digest certificate of the first timestamp information (i.e., the hash value obtained by hashing the original text of the first timestamp response) as on-chain evidence storage data to the blockchain network (such as a consortium blockchain node). After the blockchain network packages and uploads the submitted data, it returns the second timestamp information to the user terminal. This second timestamp information includes at least the block timestamp generated by the blockchain network and the block height information of the block where the evidence storage transaction is located.
[0090] It should be noted that the aforementioned first timestamp information (from TSA) and second timestamp information (from the blockchain) are specific implementations of "at least one timestamp information" in this step. In actual implementation, user terminals may obtain only TSA timestamp information, only blockchain timestamp information, or both, depending on actual security needs and business scenarios. This embodiment does not limit this. When both timestamp information are obtained simultaneously, the dual timestamps carried in subsequent signature requests can be cross-compared during the verification stage, thereby forming a stronger chain of evidence.
[0091] Through the above implementation method, dual-source cross-examination of centralized authoritative timestamps and decentralized blockchain timestamps is realized. That is, the authority and credibility of the timestamp are guaranteed by TSA, and the immutability and public verifiability of the blockchain are used to solidify and preserve the TSA timestamp a second time. This effectively prevents the risk of a single timestamp source being tampered with or denied, thereby enhancing the judicial probative value of the signature time and the integrity and reliability of the electronic evidence chain.
[0092] In the above scheme, by moving preprocessing operations such as digest calculation and timestamp acquisition to the terminal side, the server can focus on signature calculation, effectively reducing the server's computational load. At the same time, it ensures that all elements of the signature evidence chain are uniformly bound at the request initiation stage, providing a complete and reliable data foundation for the subsequent signature verification process.
[0093] S102. Based on the digital digest, at least one timestamp information, and the metadata of the file to be signed, generate a signature generation request corresponding to the file to be signed, and send the signature generation request to the server connected to the user terminal so that the server generates digital signature information according to the signature generation request.
[0094] In this embodiment, after obtaining the digital digest and at least one timestamp, the user terminal further obtains the metadata of the file to be signed. This metadata includes at least file identification information and user identity information, which is used to bind the digital signature to the specific file entity and the operating user during the signing stage, preventing the signature from being replayed or ported.
[0095] The user terminal assembles a digital digest, at least one timestamp, and metadata into a structured signature generation request according to the message format agreed upon with the server in advance.
[0096] In one implementation, the data can be encapsulated into a request body in JSON format, with auxiliary fields such as terminal device information and request timestamp appended. After assembly, the user terminal sends the signature generation request to the server via a secure communication link, whereby the server performs the signature calculation. For example, the user terminal and the server can establish a communication connection via a wired or wireless network (such as Wi-Fi, mobile communication network, etc.) and use HTTPS, WebSocket, or other secure communication protocols for data transmission to ensure the confidentiality and integrity of the signature generation request during transmission.
[0097] S103. Receive and store the digital signature information sent by the storage client.
[0098] In this embodiment, after receiving the digital signature information returned by the server, the user terminal can associate and store the electronic file to be signed, the digital signature value, the first timestamp information, the second timestamp information, and the public key certificate. Specifically, the user terminal uses the file identification information of the file to be signed (such as file ID, file name, or file hash value) as the association key, and binds and stores the above five data items as a complete signature record in the local secure storage area.
[0099] After completing local storage, the user terminal will also back up the complete signature record of the associated storage to the cloud storage server through an encrypted transmission channel.
[0100] Specifically, the user terminal uses a user-preset encryption key to symmetrically encrypt the digital signature information and associated file data, packages the encrypted ciphertext data and uploads it to the cloud storage server, and only retains the cloud backup index locally.
[0101] Through the aforementioned associated storage, local caching, and cloud backup mechanisms, the complete elements of the signature evidence chain can be securely, efficiently, and with multiple redundancies after the signature generation process is completed on the user terminal, ensuring the reliable availability of signature data on the user side. Simultaneously, cloud backup support allows signature records to be recovered from the cloud even if the user terminal is lost or damaged, further enhancing reliability.
[0102] The data signature generation method provided in this application allows the user terminal to extract the digital digest of the file to be signed and obtain at least one timestamp locally. The digital digest, timestamp, and file metadata are then assembled into a signature generation request and sent to the server for collaborative signature computation. This method, on the one hand, forwards resource-intensive operations such as hash calculation and timestamp acquisition to the terminal, effectively distributing server computational pressure and improving signature generation efficiency. On the other hand, by cryptographically binding the file digest with multi-source timestamps and file metadata during the signature request stage, the final generated digital signature information forms an inseparable association with the specific file entity, the operating user, and the trusted time, effectively preventing signature replay or migration to other files and enhancing the security of the signing process. Furthermore, the server centrally manages the key and completes the signature based on the structured request, while the terminal locally stores the complete signature information, further enhancing the overall reliability of the system.
[0103] Figure 2 Flowchart of the digital signature generation method provided in this application Figure 2 This method is applied on the server side. For example... Figure 2 As shown, in this embodiment... Figure 1 Based on the embodiments, the process of generating digital signatures on the server side is described in detail. The method includes:
[0104] S201. Receive a signature generation request sent by a user terminal, and parse the digital digest of the file to be signed and at least one timestamp information corresponding to the digital digest from the signature generation request.
[0105] In this embodiment, the server receives the signature generation request sent by the user terminal through a preset communication interface. A secure communication link is pre-established between the server and the user terminal, such as a two-way authentication channel based on the HTTPS protocol or the WebSocket security protocol, to ensure the confidentiality and integrity of the request data during transmission.
[0106] After receiving a signature generation request, the server can perform protocol parsing and format verification. If the verification passes, the server parses the core parameters required for the signature operation from the signature generation request according to a data format pre-agreed with the server's local configuration file or the user terminal.
[0107] Specifically, the server extracts a digital digest of the file to be signed and at least one timestamp corresponding to the digital digest from the request body. In one implementation, the at least one timestamp includes at least one of a first timestamp and a second timestamp.
[0108] In addition, to facilitate subsequent tracing and auditing of signature generation requests, after successfully parsing the above information, the server also generates a unique request ID for this signature generation request, and records part of the digital digest (such as the first 8 bytes), the digest value of at least one timestamp, the receiving time, and the device identifier of the user terminal in the server audit log to form a complete request receiving record.
[0109] S202. According to the preset key rotation strategy, determine the target encryption private key that is currently in a valid state from multiple candidate encryption private keys, and use the target encryption private key to perform a signature operation on the digital digest to generate a digital signature.
[0110] In this embodiment, the server maintains a private key management list containing multiple candidate encryption private keys. Each candidate encryption private key is associated with its corresponding metadata information, which includes at least: a private key version number (e.g., V1.0, V2.0, or an incremental integer number), an effective start time, an effective end time, and an active flag (with a value of "enabled" or "disabled"). This private key management list is stored in a secure storage area on the server (such as in a Hardware Security Module (HSM) or a Trusted Execution Environment (TEE)) to ensure the confidentiality and integrity of the candidate encryption private keys.
[0111] When determining the target encrypted private key, the server iterates through the private key management list according to a preset key rotation strategy. Specifically, the server obtains the current system time and compares it with the valid start and end times of each candidate encrypted private key. Simultaneously, it checks whether the enable status flag of each candidate encrypted private key is "enabled". When the current system time of a candidate encrypted private key falls within the valid time interval defined by its valid start and end times, and its enable status flag is "enabled", the server determines that candidate encrypted private key as the currently valid target encrypted private key.
[0112] In another optional implementation, the key rotation strategy also includes a periodic automatic rotation mechanism. Based on a preset rotation cycle (e.g., quarterly or annually), the server automatically generates a new encryption private key pair via a background task before the expiration date of the currently used target encryption private key. The new private key and its metadata are added to the private key management list, and the activation status of the old private key is updated to "deactivated," thus achieving seamless rolling updates of the keys. This mechanism ensures that the server always has a usable and valid private key, avoiding interruptions to the signing service due to private key expiration.
[0113] After determining the target encryption private key, the server uses this target encryption private key to perform a signature operation on the digital digest. Specifically, the server takes the digital digest as the message to be signed as input, the target encryption private key as the signing key, performs a digital signature generation operation according to a preset asymmetric signature algorithm, and outputs a digital signature value.
[0114] In one implementation, before performing a signature operation on the digital digest, the server can further encapsulate the digital digest in a specific format along with the timestamp information in the request, so that the final digital signature is cryptographically bound to the timestamp information, thereby enhancing the non-repudiation of the signature.
[0115] It should be understood that if no candidate encryption private key in a valid state is found in the private key management list (e.g., all private keys have expired or have all been marked as disabled), the server determines that the signing service is currently unavailable, generates a failure response containing an error code and returns it to the user terminal, and triggers an alarm to notify the operation and maintenance personnel to update the key configuration in a timely manner, thereby ensuring the reliability of the signing service.
[0116] Through the aforementioned key rotation and target private key determination, the server can dynamically and orderly switch between multiple encrypted private keys, avoiding the risks of key leakage and expiration caused by the long-term use of a single fixed private key, thus improving the security of signature key management and the continuous availability of the signature service.
[0117] S203. Based on the digital signature, the public key information corresponding to the target encrypted private key, and the version identifier of the target encrypted private key, generate digital signature information and send the digital signature information to the user terminal.
[0118] In this embodiment, after generating the digital signature, the server obtains the public key information and key version identifier corresponding to the target encrypted private key. The digital signature, public key information, and version identifier are then structurally encapsulated according to a pre-agreed response message format to generate digital signature information. The version identifier is used to accurately locate the corresponding public key during subsequent signature verification.
[0119] After encapsulation, the server returns the digital signature information to the user terminal via a secure communication link, and includes the corresponding request sequence number in the response header to facilitate matching between the request and response. After transmission, the server writes the request sequence number, terminal identifier, digital digest, and key version information of this signing operation into the audit log for traceability and auditing purposes.
[0120] The digital signature generation method provided in this embodiment directly obtains the digital digest and corresponding timestamp information of the file to be signed by receiving and parsing the preprocessed signature generation request from the user terminal. This avoids the server repeatedly performing resource-intensive operations such as hash calculation and timestamp acquisition, reducing the server's computational load and improving the processing efficiency of signature requests. Simultaneously, the server dynamically selects a valid target private key from multiple candidate encryption private keys based on a preset key rotation strategy to perform signature operations. It then combines the signature value, corresponding public key information, and version identifier to structurally generate digital signature information and returns it to the user terminal. On the one hand, the rotation management of multiple private keys effectively reduces the risk of leakage caused by the long-term use of a single private key. On the other hand, the version identifier enables the verification end to accurately match the corresponding public key to complete the verification. Thus, while ensuring the efficiency of high-concurrency signature request processing, it also considers the security of the signature key and the continuous reliability of the signature service.
[0121] Based on the above implementation method, the signature generation request received by the server also includes metadata of the file to be signed. Therefore, in the above implementation method, before performing the signature operation on the digital digest using the target encryption private key, the method further includes: verifying whether the user identity information in the metadata has the permission to sign the file corresponding to the file identification information; if the verification passes, then the step of performing the signature operation on the digital digest using the target encryption private key is executed.
[0122] In this embodiment, while parsing the digital digest and corresponding timestamp information of the file to be signed from the signature generation request, the server also extracts the metadata of the file to be signed carried in the signature generation request. The metadata includes at least file identification information and user identity information. The server temporarily stores the parsed metadata in its memory or cache.
[0123] Specifically, after determining the target encryption private key according to the key rotation strategy and before performing a signature operation on the digital digest using the target encryption private key, the server extracts user identity information (such as user ID, user account or digital certificate serial number) and file identification information (such as file ID, file name or file path) from the metadata, and verifies whether the user has the signing permission for the file corresponding to the file identification information based on the user identity information.
[0124] In one implementation, the server pre-stores a permission management list, which contains the association between user identity information and file identification information, as well as the corresponding permission identifiers. Using the user identity information as an index, the server queries the permission management list for the permission record corresponding to that user. If the query finds that the user has signing permission for the file corresponding to the file identification information, the verification is considered successful. If the query finds that the user does not have signing permission, the verification is considered unsuccessful, the server refuses to perform the signature operation, and returns an insufficient permission error response to the user terminal.
[0125] In another implementation, the permission management list can adopt a hierarchical permission model, where different user groups or roles (such as department managers, legal specialists, and ordinary staff) correspond to different signing permissions for file types or file directories. During permission verification, the server determines the user group or role to which the user belongs, and then judges whether to allow signing the current file based on the permission policy corresponding to that user group or role. For example, in a government office scenario, only users with managerial or higher roles have the right to sign official documents for external release, while ordinary staff do not have this permission.
[0126] If the above permission verification passes, the server continues with the step of signing the digital digest using the target's encrypted private key. If the permission verification fails, the server terminates the current signing process, generates a failure response with an error code, and returns it to the user's terminal. Simultaneously, the server records the verification failure in the audit log. This audit log includes at least the user's identity information, file identification information, request time, and reason for failure, for administrators to perform security audits and adjust permission configurations.
[0127] The aforementioned permission verification mechanism, which introduces two-factor access control based on user identity and file identifier at the signature generation stage, ensures that only authorized users can initiate signature operations on specific files. This effectively prevents security risks such as unauthorized signing, exceeding authority, or erroneous signing, thus improving the access control security and compliance of the electronic signature system. Furthermore, by placing permission verification before signature computation, it avoids wasting server-side computing resources on invalid signature operations, further improving the system's resource utilization efficiency.
[0128] Figure 3 Flowchart of the digital signature verification method provided in this application Figure 1 This method is applied to user terminals. For example... Figure 3 As shown, the method includes:
[0129] S301. Obtain the document to be verified and the digital signature information corresponding to the document to be verified; wherein, the digital signature information includes the digital signature, the public key information corresponding to the digital signature value, and the key version identifier corresponding to the public key information.
[0130] In this embodiment, the user terminal obtains the file to be verified and, using the file's identifier information as an index, retrieves and obtains the associated digital signature information from the local secure storage area. Specifically, the user terminal obtains the file to be verified in the following ways: by selecting and importing it locally through an interactive interface, by reading it directly from the local secure storage area, or by receiving it from an external device. The digital signature information includes at least three core data items: the digital signature value, the public key information paired with the signing private key (which can be the original public key or a digital certificate), and the key version identifier.
[0131] After obtaining the digital signature information, if the information was encrypted during storage, the user terminal first decrypts it using the corresponding decryption key, and then parses out the digital signature value, public key information, and key version identifier. The user terminal can also perform integrity verification on the signature information, such as recalculating the hash value of the signature information and comparing it with the stored verification value to confirm that the signature information has not been tampered with during storage. Furthermore, the user terminal supports importing the file to be verified and its corresponding signature information file from external storage media, extracting the above three data items by recognizing the file extension or format, thereby meeting the application requirements for cross-device verification.
[0132] S302. Send the document to be verified, digital signature, public key information, and key version identifier to the server connected to the user terminal, so that the server can perform verification calculation on the digital signature to verify the integrity of the document to be verified.
[0133] Specifically, the user terminal assembles the file to be verified, the digital signature value, the public key information, and the key version identifier into a signature verification request according to the verification request message format pre-agreed with the server. The file to be verified can be carried directly in the request body in its original form, or it can be compressed and encoded to reduce transmission overhead.
[0134] In one alternative implementation, if the file to be verified is large (e.g., more than 10MB), the user terminal can recalculate the hash value of the file locally and include the hash value instead of the full text of the file in the verification request to reduce the amount of data transmitted over the network. After receiving the hash value, the server can directly use it as the digest to be verified for signature comparison.
[0135] Furthermore, the digital signature value is the signature calculation result returned by the server during the aforementioned signature generation stage. The public key information can be the plain text of the public key or a digital certificate containing the public key. The key version identifier is used to instruct the server to verify whether the public key version matches the private key version used during signing before signature verification.
[0136] In one implementation, the user terminal also includes at least one timestamp information associated with the document to be verified in the signature verification request, so that the server can perform timestamp consistency verification.
[0137] After assembling the request, the user terminal sends the signature verification request to the server via a secure communication link (such as HTTPS or an encrypted WebSocket connection). Before sending, the user terminal can also attach a message authentication code or digital signature to the entire request body to ensure the integrity and authenticity of the request during transmission and prevent man-in-the-middle attacks.
[0138] After receiving a signature verification request, the server retrieves the corresponding public key based on the key version identifier and uses the public key information to perform a signature verification operation on the digital signature value to verify the integrity of the file to be verified, i.e., to confirm whether the file has been modified since the signature was generated. After completing the signature verification, the server generates a verification result and returns it to the user terminal, which then knows whether the signature verification has passed.
[0139] S303. Receive and store the verification result information returned by the verification server. The verification result information shall at least include a verification status identifier indicating whether the verification has passed or not.
[0140] The user terminal receives the verification response message returned by the server and parses the verification result information from the response message. The verification result information includes at least a verification status identifier, such as "passed" or "failed".
[0141] In one optional implementation, the verification result information may further include a verification timestamp and error code generated by the server. If the verification status indicates that the signature verification is successful, the user terminal displays a "Signature Verification Successful" message on the interactive interface. If the signature verification fails, "Signature Verification Failed" and the corresponding error reason information are displayed, such as signature value mismatch or certificate expiration.
[0142] After obtaining the verification result information, the user terminal can use the file identification information of the document to be verified as an index to associate and store at least one of the following records in the local secure storage area: verification status identifier, verification timestamp, and error code. Together with the digital signature information stored in the signature generation stage, this forms a complete evidence chain from signature generation to signature verification, for subsequent auditing or judicial evidence.
[0143] The signature verification method provided in this application involves a user terminal acquiring the file to be verified and its corresponding digital signature information, and sending all the data required for verification to the server for verification calculation. This allows the server to independently complete the verification without relying on a local database or external certificate store, effectively reducing external dependencies and improving verification efficiency. Simultaneously, by incorporating public key information and key version identifiers into the verification request, the server can verify the matching of the public key and version before verification, preventing the use of obsolete or mismatched public keys and enhancing the security of the verification process. Furthermore, the user terminal receives and stores verification result information containing a verification status identifier, which is associated with the digital signature information from the signature generation stage, forming a complete closed-loop evidence chain from signature generation to verification result. This provides a reliable data foundation for subsequent auditing and judicial evidence collection, further enhancing the overall reliability of the system.
[0144] Figure 4 Flowchart of the digital signature verification method provided in this application Figure 2 This method is applied on the server side. For example... Figure 4 As shown, the method includes:
[0145] S401. Receive at least one signature verification request sent by the user terminal. Each signature verification request carries a file digital digest of the file to be verified, a digital signature, public key information corresponding to the digital signature value, a key version identifier corresponding to the public key information, and at least one timestamp information corresponding to the file digital digest.
[0146] In this embodiment, the server receives signature verification requests sent by the user terminal through a preset communication interface. These signature verification requests can be single requests, containing only verification data for one file to be verified; or they can be batch requests, containing verification data for multiple files to be verified simultaneously. For batch requests, the server parses the request type identifier in the request header after receiving the request, determines that it is a batch verification request, and then extracts the complete data fields carried by each signature verification request one by one according to a preset batch data format.
[0147] For each received signature verification request, the server can perform protocol parsing and format validation. After successful validation, the server parses all the parameters required for this verification from each signature verification request according to the pre-agreed data format. For batch requests, the server parses each request independently and indexes the parsed data according to file identification information (such as file ID or file sequence number), temporarily storing it in the server's memory or cache for subsequent batch verification processing.
[0148] In addition, after the server successfully parses and verifies the signature verification request, it generates a unique request serial number for each verification operation and records information such as the file digital digest, key version identifier, reception time, and user terminal identifier in the server audit log to form a complete verification request reception record for subsequent security audits and traceability queries.
[0149] S402. For each signature verification request, extract the public key information from the signature verification request and determine the current status information of the digital certificate corresponding to the public key information.
[0150] In this embodiment, after parsing the signature verification request, the server extracts the public key information for each request and determines the current status of the corresponding digital certificate based on this public key information. This allows the server to confirm whether the certificate used for the signature is still valid at the current moment before performing the verification operation, thus preventing signatures issued with revoked, expired, or withdrawn certificates from passing verification.
[0151] After extracting the public key information, the server determines its data type. If the public key information is in digital certificate format, the server directly parses the certificate attribute fields, such as certificate serial number, issuer information (Issuer DN), validity start time, and validity end time, from the digital certificate. If the public key information is only the plain text and does not contain certificate information, the server maintains a mapping table between public keys and certificates. The server uses the plain text of the public key as an index to query the mapping table for the corresponding certificate serial number and certificate issuer information to determine the digital certificate corresponding to the public key.
[0152] After determining the basic attributes of the digital certificate, the server further obtains the current status information of the digital certificate. The current status information is used to indicate whether the digital certificate is valid at the current moment, specifically including but not limited to: whether the certificate is within its validity period (i.e., whether the current system time is between the certificate's valid start time and valid end time), whether the certificate has been revoked by the issuing authority, whether the certificate has been suspended, or whether the certificate status is unknown.
[0153] In one implementation, the process by which the server determines the current status information of the digital certificate corresponding to the public key information may include: determining the corresponding certificate authority identifier based on the public key information; and obtaining the current status information of the digital certificate corresponding to the public key information based on the certificate authority identifier.
[0154] Specifically, the server extracts the public key information from the signature verification request and determines the corresponding Certificate Authority (CA) identifier based on the public key information. The CA identifier is used to uniquely identify the Certificate Authority that issued the digital certificate, and can be the issuer's Distinguished Name (DN), the issuer's Authority Key Identifier, or the CA's digital certificate serial number, etc.
[0155] In one specific implementation, if the public key information is in digital certificate format (such as an X.509 certificate), the server directly parses the issuer information field from the digital certificate and extracts the distinguishable name of the certificate authority or the issuer key identifier from this field as the CA identifier. If the public key information is only the plain text of the public key and does not contain digital certificate information, the server pre-maintains a mapping table between public keys and CA identifiers. The server uses the plain text of the public key as an index to query this mapping table and locate the certificate authority identifier of the digital certificate corresponding to the public key. In another optional implementation, the server can also match the corresponding digital certificate in the local certificate store using the hash fingerprint of the public key, and then parse the CA identifier from it.
[0156] After determining the CA identifier, the server retrieves the current status information of the digital certificate corresponding to the public key information based on the Certificate Authority identifier. Specifically, the server has pre-configured the certificate status query service address (such as the OCSP (Online Certificate Status Protocol) responder URL address) and CRL (Certificate Revocation List) publication point address corresponding to each CA identifier in its local configuration file. The server uses the CA identifier as an index to query the online certificate status query service address corresponding to that CA identifier in its local configuration file.
[0157] In one implementation, the server sends a status query request carrying the certificate serial number to the OCSP service address corresponding to the CA identifier, receives and verifies the signature of the OCSP response, confirms that it was issued by the CA and has not been tampered with, and then extracts the certificate status field from the response as the current status information.
[0158] In another implementation, the server can also obtain the latest version of the CRL file issued by the CA and search for the revocation entry corresponding to the certificate serial number in the CRL. If no matching entry is found and the current system time is within the certificate's validity period, the certificate is determined to be valid; if a matching entry is found, the certificate is determined to have been revoked.
[0159] In this way, the server accurately determines the corresponding CA identifier based on the public key information, and then obtains the current status information of the digital certificate based on the CA identifier, providing a reliable basis for determining the validity of the certificate for subsequent signature verification operations. At the same time, the success rate of certificate status query is ensured in various network environments through both online and offline query methods.
[0160] In the implementation of the above method, one way to obtain the current status information of the digital certificate corresponding to the public key information based on the certificate authority identifier may include: determining the online certificate status query interface corresponding to the certificate authority based on the certificate authority identifier, and sending a status query request carrying the certificate serial number of the digital certificate through the online certificate status query interface; determining whether a valid status response message returned by the online certificate status query interface is received within a preset timeout period; if a valid status response message is received, parsing the first status information of the digital certificate from the valid status response message and using the first status information as the current status information; if no valid status response message is received, obtaining the corresponding certificate revocation list file based on the certificate authority identifier, searching for the certificate serial number in the certificate revocation list file, generating second status information based on the search result, and using the second status information as the current status information.
[0161] Specifically, the server sends a status query request carrying the certificate serial number of the digital certificate to the online certificate status query service address and receives the returned status query response. This status query request preferably conforms to the OCSP request format of RFC 6960, and includes information such as the serial number of the certificate to be queried and the public key hash or issuer key identifier of the certificate issuer.
[0162] After receiving the OCSP response, the server verifies the signature of the OCSP response. After confirming that the response is signed by the certificate authority corresponding to the CA identifier and has not been tampered with, the server extracts the certificate status field from the response. The value of the certificate status field includes "good" (valid), "revoked" (revoked) or "unknown" (unknown). The server uses this field value as the current status information of the digital certificate.
[0163] If the online certificate status query service is unavailable, for example, if no response is received within the preset timeout period, or if the online query result is unreliable, such as if the OCSP response signature verification fails, the server will automatically switch to the offline query method.
[0164] Specifically, the server obtains the latest version of the CRL file issued by the corresponding Certificate Authority based on the CA identifier. The CRL file can be obtained in advance and cached locally on the server through methods such as scheduled synchronization, manual import, or download from the CRL distribution point. The server updates the CRL file regularly to keep it synchronized with the latest status issued by the CA.
[0165] After obtaining the CRL file, the server searches the CRL file for a revocation entry that matches the certificate serial number of the digital certificate. If no matching entry is found and the current system time is within the validity period of the certificate, the digital certificate is determined to be valid. If a matching entry is found, the digital certificate is determined to have been revoked, and "revoked" is set as the current status information.
[0166] The above implementation method, through a dual-mode fault-tolerant mechanism that prioritizes online certificate status query and uses offline certificate revocation list query as a fallback, effectively solves the technical problem of signature verification service interruption caused by unavailability or abnormal response of online query service while ensuring the real-time query requirement for certificate status, thereby improving the reliability of signature verification.
[0167] S403. When the current status information indicates that the digital certificate is in a valid state, perform a preset hash operation on the document to be verified to generate a digital digest to be compared.
[0168] In this embodiment, after confirming that the current status information of the digital certificate indicates that the certificate is in a valid state, that is, the certificate is within the validity period and has not been revoked, the server obtains the signature to be verified file from the signature verification request, and performs a preset hash operation on the signature to be verified file to generate a digital digest to be compared.
[0169] Specifically, in this embodiment, after confirming that the current status information of the digital certificate indicates that the certificate is valid (i.e., the certificate is within its validity period and has not been revoked), the server obtains the file to be verified from the signature verification request and performs a preset hash operation on the file to be verified to generate a digital digest to be compared. The purpose of this step is to determine whether the file to be verified has been modified after the signature was generated by comparing the digital digest to be compared with the file digital digest carried in the request during subsequent verification, thereby verifying the integrity of the file.
[0170] In one implementation, if the signature verification request carries the original data of the file to be verified, the server directly extracts the binary content of the file to be verified from the request body, performs a hash operation on all bytes of the file to be verified according to a preset hash algorithm, and outputs a fixed-length hash value as the digital digest to be compared. The hash algorithm used should be consistent with the hash algorithm used by the user terminal when generating the digital digest of the file during the signature generation stage to ensure the accuracy and consistency of subsequent comparisons.
[0171] In another implementation, if the signature verification request carries a digital digest of the document to be verified, rather than the original document, the server directly extracts the digital digest from the request and uses it as the digital digest to be compared, without needing to re-perform the hash operation. This method is suitable for scenarios where the document to be verified is large and transmitting the original document is inefficient, as integrity verification can be completed by transmitting only the digest value, reducing network transmission overhead.
[0172] In one optional implementation, when the server receives a signature verification request that includes both the original file text and the file digital digest, it first performs a hash operation on the original file text to generate a digital digest to be compared, and then compares and verifies it with the file digital digest carried in the request. This dual verification mechanism can simultaneously detect whether the file content has been tampered with during transmission and whether the digest value has been tampered with.
[0173] In a preferred embodiment, for large file scenarios, the server employs a streaming hashing method. That is, the data of the file to be verified is read into memory in blocks sequentially. The intermediate state of the hash operation is updated after each data block is read, until the entire file is read, and finally, a complete digital digest to be compared is output. This streaming processing method avoids loading large files entirely into memory, reducing server memory usage and improving system stability in high-concurrency signature verification scenarios.
[0174] After generating the digital digest to be compared, the server temporarily stores it in memory or cache for later comparison with the digital digest of the file carried in the request. If an exception occurs during the hash operation (such as corrupted file data, invalid format, or reading error), the server terminates the signature verification process and returns the corresponding error message.
[0175] S404. Perform a first comparison between the digital digest to be compared and the digital digest of the document to obtain a digest consistency result; and perform a second comparison between the first timestamp information and the second timestamp information to obtain a timestamp consistency result.
[0176] In this embodiment, after generating the digital digest to be compared, the server performs verification operations on two dimensions: digest consistency comparison and timestamp consistency comparison, to obtain two independent comparison results, providing a basis for the final verification result.
[0177] Specifically, the server determines whether the digital digest to be compared is completely identical to the file digital digest carried in the signature verification request. If they are completely identical, it means that the file to be verified has not been modified since the signature was generated, the file integrity verification passes, and the server generates a digest consistency result indicating that the digests are identical. If they are inconsistent, it means that the file to be verified has been tampered with or damaged since the signature was generated, and the server generates a digest consistency result indicating that the digests are inconsistent.
[0178] It should be noted that this comparison assumes that the server and the user terminal used the same hash algorithm when generating the digital digest. If the signature verification request also carries a signature algorithm identifier field, the server can automatically adapt the corresponding hash algorithm for comparison based on this identifier, ensuring cross-system and cross-version compatibility.
[0179] At the same time as or after the digest consistency comparison, the server performs a second time consistency comparison between the first timestamp information carried in the signature verification request and the second timestamp information.
[0180] It should be understood that the first timestamp information is a timestamp issued by the Timestamp Authority (TSA) conforming to the RFC 3161 standard, containing a trusted time certified by the TSA, i.e., the time of generation of the first timestamp, T1. The second timestamp information is a timestamp generated by the blockchain network, containing the blockchain block time, i.e., the time of generation of the second timestamp, T2, and the corresponding block height information. Because the blockchain block time is publicly verifiable and tamper-proof, and the TSA timestamp has the characteristic of authoritative time certification, the mutual anchoring of the two can form stronger legal evidentiary value.
[0181] During the second time consistency comparison, the server parses the first timestamp generation time T1 from the first timestamp information and the blockchain block production time T2 from the second timestamp information. After extracting T1 and T2, the server calculates the absolute difference between them. And compare Δt with the preset time tolerance threshold. (e.g., 5 minutes, 10 minutes, or 30 minutes) for comparison. If This indicates that the TSA timestamp and the blockchain timestamp have reasonable consistency in time, and the server generates a timestamp consistency result indicating that the timestamps are consistent; if If the discrepancy is large, it indicates that there may be an anomaly during the evidence storage process, and the server generates a consistency result indicating that the timestamps are inconsistent.
[0182] In another implementation, if the signature verification request carries only one of the first and second timestamp information, the server skips the second time consistency comparison step and marks the timestamp consistency result as unavailable. In another implementation, if the request does not carry any timestamp information, the server generates a verification conclusion based solely on the digest consistency result, and simultaneously marks the verification result information with a message indicating that timestamp verification is not included.
[0183] S405. Based on the digest consistency result and the timestamp consistency result, generate the verification result information corresponding to the signature verification request and send it to the user terminal.
[0184] In this embodiment, after obtaining the digest consistency result and the timestamp consistency result, the server determines whether the signature verification passes based on the two comparison results, generates the corresponding verification result information, and sends the verification result information to the user terminal.
[0185] Specifically, the server performs a logical AND operation on the digest consistency result and the timestamp consistency result. The signature verification is considered successful only if both the digest consistency result and the timestamp consistency result indicate that the timestamps are consistent, and a verification status flag indicating successful verification is generated. If the digest consistency result indicates that the digests are inconsistent, or the timestamp consistency result indicates that the timestamps are inconsistent, or both fail, the signature verification is considered to have failed, and a verification status flag indicating failed verification is generated.
[0186] Based on the generated verification status identifier, the server constructs the verification result information. The verification result information includes at least the verification status identifier.
[0187] In one implementation, the verification result information also includes: a verification timestamp generated by the server, a request serial number, and an error code and error description information carried when verification fails, to assist user terminals or technical personnel in locating the cause of the problem.
[0188] After constructing the verification result information, the server encapsulates it according to the response message format pre-agreed with the user terminal and sends the encapsulated response message to the user terminal through a secure communication link. During transmission, the response message carries the corresponding request sequence number so that the user terminal can associate and match the response with the previously sent signature verification request.
[0189] After the transmission is completed, the server writes a complete record of this verification operation to the audit log. The audit log includes at least the following: request serial number, user terminal identifier, file digital digest (or its hash fingerprint), verification status identifier, verification timestamp, and detailed comparison values of digest consistency results and timestamp consistency results, for subsequent security audits and judicial evidence.
[0190] The signature verification method provided in this embodiment receives a verification request sent by a user terminal, which includes a file digital digest, digital signature, public key information, key version identifier, and multiple timestamps. Before signature verification, it performs certificate status validity verification to block invalid certificate-signed files from passing verification. When the certificate is valid, it ensures file integrity by comparing the regenerated digest to be compared with the file digest carried in the request, and ensures the credibility of the signature time and the traceability of the evidence chain by cross-comparing the dual timestamps. Thus, while achieving comprehensive credibility and judicial probative value of the signature verification results, it supports flexible processing of single and batch verification requests, effectively improving the security of the signature verification system, the reliability of the verification conclusions, and the processing efficiency in high-concurrency scenarios.
[0191] Based on the above implementation method, this implementation method also provides the following solution: obtaining the number of signature verification requests and determining whether the number of requests is greater than a preset concurrency threshold; if the number of requests is greater than the preset concurrency threshold, then: dividing the signature verification request into multiple sub-requests according to a preset classification rule, and assigning an independent processing process to each sub-request; wherein, each processing process uses a multi-threaded parallel approach to execute the hash operation and signature verification operation of each file to be verified in the corresponding sub-request; after completing the corresponding sub-task, each processing process generates a verification result sub-report; according to the file identifier of the file to be verified in each sub-task, sorting and merging all verification result sub-reports to generate the verification result information corresponding to the signature verification request.
[0192] In this embodiment, after receiving a signature verification request from a user terminal, the server obtains the number of signature verification requests, N, which is the total number of documents to be verified. The server then compares this number of requests, N, with a preset concurrency threshold M (e.g., M=100). If the number of requests, N, is less than or equal to the preset concurrency threshold M, the server processes each signature verification request sequentially according to the method described above, generating corresponding verification result information. If the number of requests, N, is greater than the preset concurrency threshold M, the server determines that the current scenario is a high-concurrency batch verification scenario and triggers parallel processing mode.
[0193] In parallel processing mode, the server initiates a task splitting unit to divide the signature verification request into multiple sub-requests according to a preset classification rule. In one embodiment, the preset classification rule is to classify the files to be verified in each signature verification request according to their file types, such as dividing the requests into document sub-requests, image sub-requests, and audio sub-requests. By classifying by file type, hash operations on similar files can be processed centrally in the same process, which is beneficial for utilizing cache locality and avoiding performance loss caused by frequent switching between processes.
[0194] After the task is split, the server assigns an independent processing process to each sub-request. Taking a sub-request split into three sub-requests as an example, the server's process pool allocates process P1 for document sub-requests, process P2 for image sub-requests, and process P3 for audio sub-requests. Each process is isolated from the others and runs in parallel. The abnormal exit of any process does not affect the normal execution of other processes, thus achieving overall reliability of batch verification.
[0195] Within each processing process, a multi-threaded parallel approach is further employed to execute the hash calculations and signature verification operations for each file to be verified in the corresponding sub-request. Specifically, each processing process creates a thread pool within its process space, splits each signature verification request in its sub-request into multiple verification tasks according to the number of files, and assigns them to idle threads in the thread pool for parallel execution. For example, for a document-type sub-request containing 200 PDF files, process P1 creates a thread pool with 20 worker threads, each thread responsible for the hash calculation and signature verification operations for 10 files, thereby achieving a two-tiered parallel acceleration at the process and thread levels.
[0196] After all verification tasks within each processing process have been completed, each processing process generates a corresponding verification result sub-report. The verification result sub-report must at least include the verification status (pass / fail) of each file in its sub-request, the processing time, and the error code for failure.
[0197] After receiving the sub-reports returned by all processing processes, the verification result sub-reports are sorted and merged according to the file identifiers of the files to be verified in each sub-request to generate a summary verification report. In this embodiment, the summary verification report contains the complete verification results of all files to be verified, arranged in order of file identifiers. Files that failed verification are marked as abnormal files and accompanied by corresponding detailed error logs to help users quickly locate and handle anomalies. The server sends this summary verification report as verification result information to the user terminal.
[0198] In one optional implementation, if the number N of signature verification requests is much greater than the preset concurrency threshold M, for example, N > 10 × M, the server also adopts a batch processing strategy. That is, all signature verification requests are divided into multiple batches according to file identifier order, each batch contains no more than the preset threshold number of requests, and the batches are processed serially, while the batches use the parallel processing mode described above, in order to avoid exhausting system resources by starting too many processes at the same time.
[0199] In addition, during the execution of batch parallel processing, the server can monitor the resource usage of each processing process in real time, and when the resource usage of any processing process exceeds the preset limit, it will automatically migrate some of the verification tasks in its sub-requests to other idle processes to achieve dynamic load balancing.
[0200] By using the above batch parallel processing, the processing efficiency and system throughput of the server in large-scale document verification scenarios are improved. At the same time, process-level isolation ensures that single-task exceptions do not affect the reliability of the overall batch verification.
[0201] Based on the above methods, this application also provides a digital signature processing system. This system includes a user terminal and a server. Figure 5 This is a schematic diagram of the structure of a digital signature processing system provided in an embodiment of this application. See also... Figure 5 The digital signature processing system provided in this application includes a client module, a signature service module, a verification service module, a storage and synchronization module, and a parallel processing module. The client module is deployed on a user terminal (such as a personal computer or mobile terminal device), while the signature service module, verification service module, storage and synchronization module, and parallel processing module are deployed on a server. The modules interact with each other via a secure communication link, collaborating to achieve the generation, verification, and batch processing of digital signatures.
[0202] Specifically, the client module is deployed on the user terminal and has interactive functions such as file upload, signature verification request initiation, and verification result display. This module integrates a streaming hash calculation component, supporting real-time calculation of the SHA-256 hash value of the file to be signed in a streaming manner during file upload. That is, the hash calculation status is updated as the file data stream is transmitted, and a complete digital digest is output synchronously when the file transmission is complete, thus avoiding the excessive memory consumption problem caused by downloading the complete file to the local machine before calculation. In addition, the client module also has a built-in trusted execution environment interface for performing local key operations (such as user private key signing, local data encryption and decryption, etc.) in a hardware-level secure isolation environment, ensuring that sensitive key data is not stolen by the operating system or malicious applications.
[0203] The signature service module is deployed on the server side, responsible for responding to signature generation requests initiated by clients and performing digital signature calculations. This module uses the RSA-2048 algorithm as the default asymmetric encryption algorithm for digital signature generation in conventional scenarios; it also integrates the NTRU (N-th degree truncated polynomial ring) quantum-resistant encryption algorithm as a backup signature scheme to address potential security threats to traditional public-key cryptography algorithms in future quantum computing environments. Regarding key management, the signature service module is equipped with a dynamic key rotation engine, configured to automatically trigger a key pair update process every 24 hours. The engine periodically generates new RSA or NTRU key pairs, synchronizes the public key information and corresponding key version identifier of the new key pair to the verification service module via an encrypted communication channel, and securely destroys the old key pair and all copies of it in memory and storage media after confirming synchronization. This achieves periodic rolling updates of keys, effectively reducing the risk of leakage caused by long-term use of a single key.
[0204] The verification service module is divided into an external network backend sub-module and an internal environment sub-module, which are used to support different certificate status query scenarios.
[0205] The external network backend submodule deploys an OCSP (Online Certificate Status Protocol) service integration interface. This submodule has pre-established agreements with several leading Certificate Authorities (CAs) (such as the China Financial Certification Authority and Shanghai CA) and obtained OCSP service access permissions. Through this interface, the submodule initiates real-time certificate status query requests to external OCSP responders, supporting multiple concurrent queries with a single query response time controlled within 500 milliseconds to meet the real-time certificate status requirements in high-concurrency signature verification scenarios.
[0206] The internal environment submodule deploys a CRL (Certificate Revocation List) storage and verification engine. This submodule uses a distributed database to store CRL files issued by various CAs and creates a hash index on the certificate serial number field to accelerate queries, enabling millisecond-level response time when retrieving the revocation status of a specific certificate from the CRL file.
[0207] The storage and synchronization module is responsible for the automated maintenance of CRL files within the industry environment. This module downloads the latest CRL files from the official CRL distribution points of various CA institutions according to a preset synchronization strategy (e.g., executed daily at 3 AM). After downloading, the module verifies the integrity and authenticity of the CRL files through hash verification (e.g., comparing the SHA-256 hash value of the downloaded file with the digest value pre-published by the CA institution). If verification fails, a retry mechanism is triggered, meaning the module automatically re-initiates the download request, retrying a maximum of 3 times, with each retry interval of 10 minutes. If all 3 retries fail, an exception log is recorded and an alarm is triggered, requiring intervention from operations personnel. After synchronization is complete, the module updates the local CRL version number and effective time, and retains the old version CRL files for 7 days before deletion, for traceability and historical auditing purposes.
[0208] The parallel processing module is designed based on a distributed computing architecture, which includes three core sub-units: a task splitter, a node manager, and a result aggregator.
[0209] The task splitter is responsible for evenly dividing the batch signature verification task into multiple subtasks based on the number or size of files. Each subtask contains a preset number of files to be verified. The node manager dynamically allocates subtasks based on the current load of each processing node in the cluster, scheduling them to less loaded processing nodes for execution. After receiving a subtask, each processing node independently performs hash calculations, certificate status queries, and signature verification operations for the corresponding file. After completing the subtask, each node returns the verification results to the result aggregator. The result aggregator collects the verification results from all nodes, sorts and merges all results according to the file identifiers of each file, and generates a summary report containing all verification results. The report also marks the files that failed verification and their corresponding detailed error logs for user review and subsequent processing.
[0210] Through the modular system architecture described above, this application embodiment realizes a signature generation mechanism that combines terminal preprocessing with centralized server processing, as well as a signature verification mechanism that combines real-time and offline certificate status and single-machine and distributed parallel processing, effectively improving the overall processing efficiency, security and scalability of the system.
[0211] Figure 6 Schematic diagram of the digital signature generation device provided in this application Figure 1 This device is used in user terminals. For example... Figure 6 As shown, the digital signature generation device 60 provided in this embodiment includes:
[0212] The information acquisition module 601 is used to acquire the file to be signed, generate a digital digest of the file to be signed, and acquire at least one timestamp information corresponding to the digital digest.
[0213] The information sending module 602 is used to generate a signature generation request corresponding to the file to be signed based on the digital digest, at least one timestamp information and the metadata of the file to be signed, and send the signature generation request to the server connected to the user terminal so that the server generates digital signature information according to the signature generation request.
[0214] The signature receiving module 603 is used to receive and store digital signature information sent by the storage client.
[0215] In one possible implementation, the information acquisition module 601 is specifically used for:
[0216] The file to be signed is divided into multiple consecutive data blocks according to the preset data block size;
[0217] Hash iteration operations are performed sequentially on each data block, where the hash iteration operation of the current data block depends on the intermediate digest state value obtained after the operation of the previous data block;
[0218] Once all data blocks have completed iterative computation, the final intermediate digest state value will be determined as the digital digest of the file to be signed.
[0219] In one possible implementation, at least one timestamp information includes a first timestamp information and a second timestamp information;
[0220] Information acquisition module 601 is specifically used for:
[0221] Send a first acquisition request carrying a digital digest and the device identifier of the user terminal to the timestamp authority server, and receive first timestamp information returned by the timestamp authority server; the first timestamp information contains first timestamp data signed by the timestamp authority server;
[0222] Through the blockchain network interface, the digest certificate of the digital digest and the first timestamp information is submitted to the blockchain network as on-chain evidence storage data, and the second timestamp information returned by the blockchain network is received; the second timestamp information includes the second timestamp data generated by the blockchain network and the block height information corresponding to the on-chain evidence storage data.
[0223] Figure 7 Schematic diagram of the digital signature generation device provided in this application Figure 2 This device is used on the server side. For example... Figure 7 As shown, the digital signature generation device 70 provided in this embodiment includes:
[0224] The information receiving module 701 is used to receive a signature generation request sent by a user terminal, and to parse the digital digest of the file to be signed and at least one timestamp information corresponding to the digital digest from the signature generation request.
[0225] The signature generation module 702 is used to determine the target encrypted private key that is currently in a valid state from multiple candidate encrypted private keys according to a preset key rotation strategy, and to perform a signature operation on the digital digest using the target encrypted private key to generate a digital signature.
[0226] The signature sending module 703 is used to generate digital signature information based on the digital signature, the public key information corresponding to the target encrypted private key, and the version identifier of the target encrypted private key, and send the digital signature information to the user terminal.
[0227] In one alternative implementation, the signature generation request also includes metadata of the file to be signed;
[0228] The device is also used to: verify whether the user identity information in the metadata has the authority to sign the file corresponding to the file identification information before performing a signature operation on the digital digest using the target encryption private key;
[0229] If the verification passes, the step of signing the digital digest using the target encryption private key is executed.
[0230] Figure 8 Schematic diagram of the digital signature verification device provided in this application Figure 1 This device is used in user terminals. For example... Figure 8 As shown, the digital signature verification device 80 provided in this embodiment includes:
[0231] The information acquisition module 801 is used to acquire the document to be verified and the digital signature information corresponding to the document to be verified; wherein, the digital signature information includes a digital signature, public key information corresponding to the digital signature value, and key version identifier corresponding to the public key information;
[0232] The information sending module 802 is used to send the document to be verified, the digital signature, the public key information and the key version identifier to the server connected to the user terminal, so that the server can perform verification calculation on the digital signature to verify the integrity of the document to be verified.
[0233] The result receiving module 803 is used to receive and store the verification result information returned by the verification server. The verification result information includes at least a verification status identifier indicating whether the verification passed or failed.
[0234] Figure 9 Schematic diagram of the digital signature verification device provided in this application Figure 2 This device is used on the server side. For example... Figure 9 As shown, the digital signature verification device 90 provided in this embodiment includes:
[0235] The information receiving module 901 is used to receive at least one signature verification request sent by the user terminal. Each signature verification request carries a file digital digest of the file to be verified, a digital signature, public key information corresponding to the digital signature value, a key version identifier corresponding to the public key information, and at least one timestamp information corresponding to the file digital digest.
[0236] The status determination module 902 is used to extract public key information from each signature verification request and determine the current status information of the digital certificate corresponding to the public key information for each signature verification request.
[0237] The digital digest generation module 903 is used to perform a preset hash operation on the document to be verified and generate a digital digest to be compared when the current status information indicates that the digital certificate is in a valid state.
[0238] The comparison module 904 is used to perform a first comparison between the digital digest to be compared and the digital digest of the document to obtain a digest consistency result; and to perform a second comparison between the first timestamp information and the second timestamp information to obtain a timestamp consistency result.
[0239] The result generation module 905 is used to generate verification result information corresponding to the signature verification request based on the digest consistency result and the timestamp consistency result, and send it to the user terminal.
[0240] In one alternative implementation, the state determination module 902 is specifically used for:
[0241] The corresponding certificate authority identifier is determined based on the public key information;
[0242] Based on the certificate authority identifier, obtain the current status information of the digital certificate corresponding to the public key information.
[0243] In one alternative implementation, the state determination module 902 is specifically used for:
[0244] Based on the certificate authority identifier, determine the online certificate status query interface corresponding to the certificate authority, and send a status query request carrying the certificate serial number of the digital certificate through the online certificate status query interface;
[0245] Determine whether a valid status response message has been received from the online certificate status query interface within the preset timeout period;
[0246] If a valid status response message is received, the first status information of the digital certificate is parsed from the valid status response message and used as the current status information.
[0247] If no valid status response message is received, the corresponding certificate revocation list file is obtained based on the certificate authority identifier. The certificate serial number is searched in the certificate revocation list file, and a second status information is generated based on the search result. The second status information is used as the current status information.
[0248] In one optional embodiment, the device is further configured to: after receiving at least one signature verification request sent by a user terminal, obtain the number of signature verification requests and determine whether the number of requests is greater than a preset concurrency threshold.
[0249] If the number of requests exceeds the preset concurrency threshold, then:
[0250] According to the preset classification rules, the signature verification request is divided into multiple sub-requests, and each sub-request is assigned an independent processing process; within each processing process, the hash calculation and signature verification operation of each file to be verified in the corresponding sub-request are performed in parallel using a multi-threaded approach.
[0251] After completing their respective subtasks, each processing process generates a verification result sub-report.
[0252] Based on the file identifiers of the files to be verified in each subtask, all verification result sub-reports are sorted and merged to generate verification result information corresponding to the signature verification request.
[0253] Each device provided in this embodiment can execute the method provided in the above method embodiment, and their implementation principle and technical effect are similar, so they will not be described in detail here.
[0254] Figure 10 A schematic diagram of the structure of the electronic device provided in this application. The device may include at least one of a user terminal and a server. Figure 10 As shown, the electronic device 100 provided in this embodiment includes at least one processor 1001 and a memory 1002. Optionally, the device 100 further includes a communication component 1003. The processor 1001, memory 1002, and communication component 1003 are connected via a bus 1004.
[0255] In a specific implementation, at least one processor 1001 executes computer execution instructions stored in memory 1002, causing at least one processor 1001 to perform the above-described method.
[0256] The specific implementation process of processor 1001 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0257] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0258] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0259] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0260] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0261] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0262] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0263] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0264] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0265] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0266] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0267] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0268] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0269] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A method for generating a digital signature, characterized in that, Applied to a user terminal, the method includes: Obtain the file to be signed, generate a digital digest of the file to be signed, and obtain at least one timestamp information corresponding to the digital digest; Based on the digital digest, the at least one timestamp information, and the metadata of the file to be signed, a signature generation request corresponding to the file to be signed is generated, and the signature generation request is sent to the server connected to the user terminal, so that the server generates digital signature information according to the signature generation request; Receive and store the digital signature information sent by the server.
2. The method according to claim 1, characterized in that, Generating a digital digest of the file to be signed includes: The file to be signed is divided into multiple consecutive data blocks according to a preset data block size; Hash iteration operations are performed sequentially on each of the data blocks, wherein the hash iteration operation of the current data block depends on the intermediate digest state value obtained after the operation of the previous data block; Once all data blocks have completed iterative computation, the final intermediate digest state value is determined as the digital digest of the file to be signed.
3. The method according to claim 1, characterized in that, At least one timestamp information includes a first timestamp information and a second timestamp information; Obtaining at least one timestamp information corresponding to the digital digest includes: Send a first acquisition request carrying the digital digest and the device identifier of the user terminal to the timestamp authority server, and receive the first timestamp information returned by the timestamp authority server; the first timestamp information contains first timestamp data signed by the timestamp authority server; Through the blockchain network interface, the digest credentials of the digital digest and the first timestamp information are submitted to the blockchain network as on-chain evidence storage data, and the second timestamp information returned by the blockchain network is received; the second timestamp information includes the second timestamp data generated by the blockchain network and the block height information corresponding to the on-chain evidence storage data.
4. A method for generating a digital signature, characterized in that, Applied to the server side, the method includes: Receive a signature generation request sent by a user terminal, and parse the digital digest of the file to be signed and at least one timestamp information corresponding to the digital digest from the signature generation request; According to a preset key rotation strategy, a target encrypted private key that is currently in a valid state is determined from multiple candidate encrypted private keys, and the digital digest is signed using the target encrypted private key to generate a digital signature. Based on the digital signature, the public key information corresponding to the target encrypted private key, and the version identifier of the target encrypted private key, digital signature information is generated and sent to the user terminal.
5. The method according to claim 4, characterized in that, The signature generation request also includes metadata of the file to be signed; Before performing a signature operation on the digital digest using the target encryption private key, the method further includes: Verify whether the user identity information in the metadata has the signing permission for the file to be signed; If the verification passes, the step of signing the digital digest using the target encryption private key is executed.
6. A signature verification method, characterized in that, Applied to a user terminal, the method includes: Obtain the document to be verified and the digital signature information corresponding to the document to be verified; wherein, the digital signature information includes a digital signature, public key information corresponding to the digital signature value, and a key version identifier corresponding to the public key information; The document to be verified, the digital signature, the public key information, and the key version identifier are sent to the server connected to the user terminal, so that the server performs a verification operation on the digital signature to verify the integrity of the document to be verified. Receive and store the verification result information returned by the server, wherein the verification result information includes at least a verification status identifier indicating whether the verification passed or failed.
7. A signature verification method, characterized in that, Applied to the server side, the method includes: The system receives at least one signature verification request sent by a user terminal. Each signature verification request carries a file digital digest of the file to be verified, a digital signature, public key information corresponding to the digital signature value, a key version identifier corresponding to the public key information, and at least one timestamp information corresponding to the file digital digest. For each of the aforementioned signature verification requests, the public key information is extracted from the signature verification request, and the current status information of the digital certificate corresponding to the public key information is determined; When the current status information indicates that the digital certificate is in a valid state, a preset hash operation is performed on the file to be verified to generate a digital digest to be compared. The digital digest to be compared is first compared with the digital digest of the document to obtain a digest consistency result; and the first timestamp information is second compared with the second timestamp information to obtain a timestamp consistency result. Based on the digest consistency result and the timestamp consistency result, the verification result information corresponding to the signature verification request is generated and sent to the user terminal.
8. The method according to claim 7, characterized in that, Determining the current status information of the digital certificate corresponding to the public key information includes: The corresponding certificate authority identifier is determined based on the public key information; Based on the certificate authority identifier, obtain the current status information of the digital certificate corresponding to the public key information.
9. The method according to claim 8, characterized in that, Based on the certificate authority identifier, obtain the current status information of the digital certificate corresponding to the public key information, including: Based on the certificate authority identifier, determine the online certificate status query interface corresponding to the certificate authority, and send a status query request carrying the certificate serial number of the digital certificate through the online certificate status query interface; Determine whether a valid status response message returned by the online certificate status query interface has been received within a preset timeout period; If the valid status response message is received, the first status information of the digital certificate is parsed from the valid status response message, and the first status information is used as the current status information; If the valid status response message is not received, the corresponding certificate revocation list file is obtained according to the certificate authority identifier, the certificate serial number is searched in the certificate revocation list file, and a second status information is generated based on the search result. The second status information is used as the current status information.
10. The method according to claim 7, characterized in that, After receiving at least one signature verification request sent by the user terminal, the method further includes: Obtain the number of signature verification requests and determine whether the number of requests is greater than a preset concurrency threshold; If the number of requests exceeds the preset concurrency threshold, then: The signature verification request is divided into multiple sub-requests according to a preset classification rule, and an independent processing process is assigned to each sub-request; wherein, each processing process uses a multi-threaded parallel approach to execute the hash operation and signature verification operation of each file to be verified in the corresponding sub-request. After completing their respective subtasks, each of the processing processes generates a verification result sub-report. Based on the file identifier of the file to be verified in each subtask, all the verification result sub-reports are sorted and merged to generate the verification result information corresponding to the signature verification request.
11. A digital signature generation device, characterized in that, The device includes an application user terminal: The information acquisition module is used to acquire the file to be signed, generate a digital digest of the file to be signed, and acquire at least one timestamp information corresponding to the digital digest; The information sending module is used to generate a signature generation request corresponding to the file to be signed based on the digital digest, the at least one timestamp information and the metadata of the file to be signed, and send the signature generation request to the server connected to the user terminal, so that the server generates digital signature information according to the signature generation request. The signature receiving module is used to receive and store the digital signature information sent by the server.
12. A digital signature generation device, characterized in that, Application server, the device includes: The information receiving module is used to receive a signature generation request sent by a user terminal, and to parse a digital digest of the file to be signed and at least one timestamp information corresponding to the digital digest from the signature generation request. The signature generation module is used to determine the target encrypted private key that is currently in a valid state from multiple candidate encrypted private keys according to a preset key rotation strategy, and to perform a signature operation on the digital digest using the target encrypted private key to generate a digital signature. The signature sending module is used to generate digital signature information based on the digital signature, the public key information corresponding to the target encrypted private key, and the version identifier of the target encrypted private key, and send the digital signature information to the user terminal.
13. A digital signature verification device, characterized in that, The device includes an application user terminal: The information acquisition module is used to acquire the document to be verified and the digital signature information corresponding to the document to be verified; wherein, the digital signature information includes a digital signature, public key information corresponding to the digital signature value, and a key version identifier corresponding to the public key information; The information sending module is used to send the document to be verified, the digital signature, the public key information and the key version identifier to the server connected to the user terminal, so that the server can perform a verification operation on the digital signature to verify the integrity of the document to be verified. The result receiving module is used to receive and store the verification result information returned by the verification server. The verification result information includes at least a verification status identifier indicating whether the verification has passed or not.
14. A digital signature generation device, characterized in that, The device includes an application user terminal: The information receiving module is used to receive at least one signature verification request sent by a user terminal. Each signature verification request carries a file digital digest of the file to be verified, a digital signature, public key information corresponding to the digital signature value, a key version identifier corresponding to the public key information, and at least one timestamp information corresponding to the file digital digest. The status determination module is used to extract the public key information from the signature verification request for each of the aforementioned signature verification requests, and determine the current status information of the digital certificate corresponding to the public key information; The digital digest generation module is used to perform a preset hash operation on the signature to be verified file and generate a digital digest to be compared when the current status information indicates that the digital certificate is in a valid state. The comparison module is used to perform a first comparison between the digital digest to be compared and the digital digest of the file to obtain a digest consistency result; and to perform a second time consistency comparison between the first timestamp information and the second timestamp information to obtain a timestamp consistency result. The result generation module is used to generate verification result information corresponding to the signature verification request based on the digest consistency result and the timestamp consistency result, and send it to the user terminal.
15. A digital signature processing system, characterized in that, include: User terminal and server; The user terminal is used to execute the digital signature generation method described in any one of claims 1-3, and / or the digital signature verification method described in claim 6; The server is configured to execute the digital signature generation method as described in any one of claims 4-5, and / or the digital signature verification method as described in any one of claims 7-10.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the digital signature generation method as described in any one of claims 1-5, and / or the digital signature verification method as described in any one of claims 6-10.
17. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the digital signature generation method as described in any one of claims 1-5, and / or the digital signature verification method as described in any one of claims 6-10.
