Method for rapidly improving OFD signature, signature and verification

文档序号:1201220 发布日期:2020-09-01 浏览:5次 中文

阅读说明:本技术 一种快速提升ofd签名、签章及验证的方法 (Method for rapidly improving OFD signature, signature and verification ) 是由 王珂 王永起 魏建民 于 2020-05-01 设计创作,主要内容包括:本发明公开了一种快速提升OFD签名、签章及验证的方法,包括如下步骤,计算前,将所有不参与计算的文档路径放入一个文件目录M;读取当前设定并行任务数。解压OFD,读取OFD文档列表,按照任务数获取对应的文件路径。S4、并行启动多个任务数量。比较当前文档路径是否在M中,若在则当前任务结束;若不在则开启HASH计算。每个计算HASH的任务计算完成后,将文件路径和HASH值发送至向XML写入HASH值的任务队列中。待所有OFD文档均参与完成后,即向写入HASH值的任务队列写入完成计算信号。本发明可以边计算、边写入,提升多页文件、多资源文件处理效率。(The invention discloses a method for rapidly improving OFD signature, signature and verification, which comprises the following steps of putting all document paths which do not participate in calculation into a file directory M before calculation; and reading the currently set parallel task number. And decompressing the OFD, reading the OFD document list, and acquiring a corresponding file path according to the number of tasks. And S4, starting a plurality of task numbers in parallel. Comparing whether the current document path is in M or not, and if so, ending the current task; if not, starting HASH calculation. After the task of calculating HASH is calculated, the file path and the HASH value are sent to a task queue for writing the HASH value into XML. And after all OFD documents participate in the completion, writing a completion calculation signal into the task queue written with the HASH value. The invention can simultaneously calculate and write in, and improves the processing efficiency of multi-page files and multi-resource files.)

1. A method for rapidly improving OFD signature, signature and verification is characterized by comprising the following steps,

s1, determining that the file directory M does not participate in calculation, and putting all the file paths not participating in calculation into a file directory M;

s2, reading the number of the currently set parallel tasks;

s3, decompressing the OFD, reading an OFD document list, and acquiring a corresponding file path according to the number of tasks;

s4, starting a plurality of tasks in parallel;

s5, comparing whether the current document path is in M, if yes, ending the current task; if not, starting HASH calculation;

s6, after the task of calculating HASH is completed, the file path and the HASH value are sent to a task queue for writing the HASH value into XML, and the task calculation is completed;

s7, after all the tasks are finished, whether the polling of all the files of the OFD file is finished is determined; if there are remaining files, repeatedly performing S4-S6;

s8, writing a completion calculation signal into the task queue written with the HASH value after all OFD documents participate in the completion; and outputting a final XML document after the task queue takes the signal, and finishing HASH calculation of the whole OFD file.

Technical Field

The invention relates to a method for rapidly improving OFD signature, signature and verification.

Background

According to the technical specification of the OFD, the digital signature, signature and verification process of the OFD all needs HASH calculation on some protected files in the OFD to obtain HASH values, and HASH algorithms, HASH values, corresponding file paths and other information are formed into new XML files which are placed in corresponding directories to serve as calculation original texts of the digital signature, signature or verification. In the existing calculation, the files to be calculated are usually polled one by one to obtain HASH values, and the HASH values are written into XML files. In the existing mode, the problem of slow calculation exists, and especially when the number of pages and resources of a file are more, a large amount of time is occupied by sequential single HASH calculation, so that the performance is low, and the HASH calculation of each page needs to be completed for a long time.

Disclosure of Invention

In order to solve the problems, the method for rapidly improving the OFD signature, signature and verification of the invention improves the existing calculation mode, performs parallel optimization on the original linear processes of polling, HASH calculation, insertion and the like, can perform calculation and write-in simultaneously, can fully exert calculation potential, and improves the processing efficiency of multi-page files and multi-resource files.

The technical scheme of the invention is as follows:

a method for rapidly improving OFD signature, signature and verification is characterized by comprising the following steps,

and S1, definitely not participating in the operation of the file directory M. Before calculation, all document paths not participating in calculation are put into a file directory M

And S2, reading the currently set parallel task number.

S3, decompressing the OFD, reading the OFD document list, and acquiring the corresponding file path according to the number of tasks.

And S4, starting a plurality of task numbers in parallel.

S5, comparing whether the current document path is in M, if yes, ending the current task; if not, starting HASH calculation.

S6, after each HASH calculation task is completed, the file path and the HASH value are sent to a task queue for writing the HASH value into XML, and the task calculation of the current time is completed

S7, after all the tasks are finished, whether the polling of all the files of the OFD file is finished is determined; if there are remaining files, repeatedly performing S4-S6;

s8, after all OFD documents are involved, writing a completion calculation signal to the job queue in which the HASH value is written. And outputting a final XML document after the task queue takes the signal, and finishing HASH calculation of the whole OFD file.

Has the advantages that:

the method can synchronously perform HASH calculation on certain files by drawing up the HASH task pool, and further write the files into a completed task queue, and write the files into the XML file synchronously. The method converts the original single file HASH operation into simultaneous HASH operation of a plurality of files on one hand, and converts the original HASH operation after calculation into simultaneous calculation and writing in of the files on the other hand, thereby greatly accelerating the original calculation speed.

Compared with the existing working mode, the invention has the following remarkable performance advantages while meeting all the functional requirements of the prior technical scheme:

1. efficiency of parallel HASH is improved

In the invention, the parallel HASH calculation of a plurality of files can be rapidly completed by performing the parallel HASH calculation of a plurality of task lists in a mode of fully playing the calculation capability

2. Improving efficiency of final XML generation

In the prior art, multi-task calculation is adopted, one calculation is written in one, the bottleneck that a HASH generation task is executed independently after parallel operation is solved, and the efficiency is higher.

Drawings

FIG. 1 is a flow chart of the present invention;

Detailed Description

The invention will be described in detail below with reference to the accompanying drawing 1:

the invention filters the files to be calculated in the task by setting a mode of not calculating the directory blacklist in advance. Synchronous HASH calculation of a plurality of files of OFD is realized by a plurality of HASH tasks; and uniformly finishing the content generation of the HASH file list in the OFD specification by the HASH in a queue mode. The specific method comprises the following steps:

and S1, definitely not participating in the operation of the file directory M. Before calculation, all document paths which do not participate in calculation are put into a file directory M.

And S2, reading the currently set parallel task number.

S3, decompressing the OFD, reading the OFD document list, and acquiring the corresponding file path according to the number of tasks.

And S4, starting a plurality of task numbers in parallel.

S5, comparing whether the current document path is in M, if yes, ending the current task; if not, starting HASH calculation.

S6, after each HASH calculation task is completed, the file path and the HASH value are sent to a task queue for writing the HASH value into XML, and the task calculation of the current time is completed

S7, after all the tasks are finished, whether the polling of all the files of the OFD file is finished is determined; if there are remaining files, repeatedly performing S4-S6;

s8, after all OFD documents are involved, writing a completion calculation signal to the job queue in which the HASH value is written. And outputting a final XML document after the task queue takes the signal, and finishing HASH calculation of the whole OFD file.

The specific application scenarios are as follows:

1. digital signature and signature of OFD

The file list information in the OFD packet and the in-packet files that do not need protection are collected first to form a protected file list. And if the document is locked after signature, protecting the signature list document.

And then the thread pool is used for carrying out parallel abstract calculation on the file according to the file path recorded in the file protection list. And recording the file name and the abstract result of the protected file in the signature description file. The signature description file simultaneously records information such as a security algorithm provider, a signature algorithm, signature time, positions in a seal file package (required during signature and not required for signature), positions in a signature value file package and the like. The signature describes the structure of the file and the storage path in the packet, and conforms to the relevant GB/T33190 specification.

And calculating the abstract of the signature description file, and organizing the abstract information and the version number of the signature, the electronic seal (required when signing, and not required when signing), the signature certificate, the signature time and other information into a structure to be signed according to GM/T0031, C0120 or GM/T0010 specifications.

And calculating a signature for the structure to be signed according to a signature algorithm specified in the signature description file, and generating a signature value file according to GM/T0031, C0120 or GM/T0010 specifications.

And storing the seal file (required when signing and not required for signing) and the signature value file into an OFD file package according to the specified path in the signature description file.

2. Digital signature and signature verification of OFD

And according to the selected seal, positioning the corresponding signature description file by analyzing the signature list file.

And analyzing the signature description file to obtain a protection file list.

And calculating the abstract of the protected file according to an abstract algorithm recorded in the signature description file, comparing the abstract with the abstract recorded in the signature description file, and indicating that the file is modified if the comparison fails.

After the comparison of the abstracts is completed, the abstracts are calculated for the signature description files and are compared with the abstracts of the signature description files recorded in the signature value structure, and if the comparison fails, the files are modified.

And verifying the signature value file according to the GM/T0031, C0120 or GM/T0010 standard to ensure that the signature value file is not changed, if the signature value file is changed, modifying the instruction file, and if not, modifying the instruction file, and successfully verifying.

6页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:异构数据的处理方法、装置以及计算机设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!