CN112395258A - Block chain file processing method, device, equipment and medium - Google Patents

Block chain file processing method, device, equipment and medium Download PDF

Info

Publication number
CN112395258A
CN112395258A CN202011325607.9A CN202011325607A CN112395258A CN 112395258 A CN112395258 A CN 112395258A CN 202011325607 A CN202011325607 A CN 202011325607A CN 112395258 A CN112395258 A CN 112395258A
Authority
CN
China
Prior art keywords
terminal
signature
file
terminals
public key
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011325607.9A
Other languages
Chinese (zh)
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Yuanqi Software Co ltd
Original Assignee
Suzhou Yuanqi Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Yuanqi Software Co ltd filed Critical Suzhou Yuanqi Software Co ltd
Publication of CN112395258A publication Critical patent/CN112395258A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Human Computer Interaction (AREA)
  • Storage Device Security (AREA)

Abstract

The specification discloses a method, a device and a system for processing files of a block chain, wherein the method comprises the following steps: the first terminal receives a second public key sent by the second terminal and stores the second public key in a first storage area of the first terminal, wherein a second signature can be obtained by encrypting a second file by using a second private key corresponding to the second public key, and the second terminal also sends the second public key to other terminals which form nodes of a block chain with the first terminal and the second terminal; the first terminal receives a second file, a second signature and a request for signing the second file, which are sent by the second terminal; the first terminal sends a first verification request comprising a second signature to other terminals, and determines whether to sign the second document according to the verification result of the legitimacy of the second signature by other terminals, so that the technical problem of poor signature safety of the electronic document in the prior art is solved.

Description

Block chain file processing method, device, equipment and medium
Technical Field
The present disclosure relates to the field of file processing technologies, and in particular, to a method, an apparatus, a device, and a medium for processing a block chain file.
Background
With the development of the internet technology, the electronic document is transmitted through the terminal of the internet to obtain the signature of the electronic document, so that workers can be liberated from paper document printing, sending and other complicated document processing activities, the office ecology is more friendly, and the working efficiency is improved. During the process of transmitting and acquiring and signing the electronic document, the signing party of the electronic document needs to verify the source of the electronic document to ensure that the electronic document is sent by the authorized subject.
To achieve the purpose, the requesting party encrypts the electronic document by using a private key to generate a digital signature, and sends the electronic document and the digital signature to the signing party together, wherein the private key is not disclosed, and a public key corresponding to the private key is disclosed. The signing party decrypts the digital signature by using the public key of the requesting party, if the decryption is successful, the electronic document is confirmed to be sent by the requesting party, otherwise, the electronic document is confirmed not to be sent by the requesting party. In the above process, there may be a case where a malicious party impersonates as a requesting party and sends the malicious party's own public key to a signing party. The signing party decrypts the digital signature sent by the malicious party through the public key of the malicious party, and can naturally and successfully decrypt the digital signature, so that the signing party mistakenly thinks that the electronic document is sent by the requesting party and is cheated to obtain the signature of the electronic document.
It is apparent that the security of the signature method of the electronic document in the prior art cannot be guaranteed, and therefore, there is a need to improve the signature method of the electronic document in the prior art to overcome the above technical problems.
Disclosure of Invention
An object of the present specification is to provide a method, an apparatus, a device, and a medium for processing a block chain file, so as to solve the technical problem in the prior art that the security of signature of an electronic file is poor.
The above purpose is realized by adopting the following technical scheme:
one or more embodiments of the present specification provide a method for processing a file of a blockchain, the method including:
the first terminal receives a second public key sent by the second terminal and stores the second public key in a first storage area of the first terminal, wherein a second file can be encrypted by using a second private key corresponding to the second public key to obtain a second signature,
the second terminal also sends the second public key to other terminals, and the other terminals, the first terminal and the second terminal form nodes of a block chain;
the first terminal receives the second file, the second signature and a request for signing the second file sent by the second terminal;
and the first terminal sends a first verification request comprising the second signature to each other terminal, and determines whether to sign the second document according to the verification result of the second signature validity by each other terminal.
Optionally, the number of the other terminals is two or more.
Optionally, the sending, by the first terminal, a first verification request including the second signature to each of the other terminals, and determining whether to sign the second document according to a verification result of validity of the second signature by each of the other terminals, includes:
the first terminal verifies whether the second signature is legal or not by using the second public key stored in the first storage area;
if the first terminal verifies that the second signature is legal, the first terminal sends the first verification request to other terminals;
the first terminal receives the result that each of the other terminals verifies whether the second signature is legal or not by using the stored second public key;
the first terminal finally determines whether the second signature is legal or not according to the result that the other terminals verify whether the second signature is legal or not;
and if the second signature is finally determined to be legal, the first terminal signs the second document and sends the signed second document to the second terminal.
Optionally, the second signature is obtained by encrypting a file identifier of the second file by using the second private key, wherein the file identifier is obtained by calculating the second file by using a first algorithm,
the first terminal verifies whether the second signature is legal by using the second public key stored in the first storage area, and the verification method comprises the following steps:
the first terminal acquires the second public key from the first storage area;
the first terminal decrypts the second signature by using the second public key, and if the decryption is unsuccessful, the second signature is judged to be illegal;
if the decryption is successful, the first algorithm is used for calculating the second file, the file identification obtained by calculation is compared with the file identification obtained by decrypting the second signature, whether the file identification is consistent or not is judged, if so, the second signature is judged to be legal, and if not, the second signature is judged to be illegal.
Optionally, the determining, by the first terminal, whether the second signature is legal according to a result of verifying whether the second signature is legal by each of the other terminals, includes:
the first terminal receives the results of whether the second signature verification is legal or not from the other terminals;
the first terminal counts the received result of verifying the second signature as a legal number;
the first terminal obtains the number of terminals for verifying the second signature to be legal according to the number of terminals for verifying the second signature to be legal;
the first terminal judges whether the number of terminals for verifying that the second signature is legal exceeds a first threshold value, wherein the first threshold value is determined according to the number of nodes in the block chain;
and finally determining that the second signature is legal if the number of the terminals verifying that the second signature is legal exceeds a first threshold, or else, finally determining that the second signature is illegal.
Optionally, the first threshold is greater than half of the number of all nodes in the block chain.
The present specification also provides a file processing method of a block chain, including:
the first terminal receives a second public key sent by the second terminal and stores the second public key in a first storage area of the first terminal, wherein a second file can be encrypted by using a second private key corresponding to the second public key to obtain a second signature,
the second terminal also sends the second public key to other terminals, and the other terminals, the first terminal and the second terminal form nodes of a block chain;
the first terminal receives the second file, the second signature and a request for signing the second file sent by the second terminal;
the first terminal sends a first verification request comprising the second signature to each other terminal, and determines whether to sign the second file according to the verification result of the validity of the second signature by each other terminal;
the first terminal encrypts a first file by using a first private key to obtain a first signature, and sends a first public key corresponding to the first private key to the second terminal and other terminals;
the first terminal sends a first file, a first signature and a request for signing the first file to the second terminal;
the first terminal receives the signed first document from the second terminal.
The present specification also provides a block chain file processing apparatus, including:
the storage module is used for receiving a second public key sent by a second terminal by a first terminal and storing the second public key in a first storage area of the first terminal, wherein a second file can be encrypted by using a second private key corresponding to the second public key to obtain a second signature, the second terminal also sends the second public key to other terminals, and the other terminals, the first terminal and the second terminal form nodes of a block chain;
a receiving module, configured to receive, by the first terminal, the second file, the second signature, and a request for signing the second file, where the second file and the second signature are sent by the second terminal;
and the signature module is used for sending a first verification request comprising the second signature to each other terminal by the first terminal and determining whether to sign the second document according to the verification result of the legality of the second signature by each other terminal.
The present specification also provides an electronic device comprising a processor and a memory, said memory being configured to store executable instructions of said processor, said processor being configured to perform the steps of the above-mentioned file processing method of a blockchain via execution of said executable instructions.
The present specification also provides a computer-readable storage medium having stored thereon a computer program which, when executed, implements the steps of the above-described block chain file processing method.
The present specification also provides a computer program product containing instructions which, when run on a computer, cause the computer to implement the above-described method of file processing for a blockchain.
In this embodiment, the second terminal sends the second public key to each of the other nodes of the block chain including the first terminal and the second terminal, and when the first terminal receives a request sent by the first terminal to sign a second document, the first terminal requests the other nodes of the block chain to verify the validity of the second signature, so as to determine whether to sign the second document. In addition, since the node of the block chain itself can be composed of the first terminal, the first terminal and other terminals having business relations, no dependence on a third party is generated, and the method has the advantage of low implementation cost.
Drawings
The present description will be further explained with reference to the drawings and examples.
Fig. 1 is a flowchart illustrating a method for processing files of a blockchain according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating another method for processing files in a blockchain according to an embodiment of the present disclosure;
fig. 3 is a flowchart illustrating another method for processing files in a blockchain according to an embodiment of the present disclosure;
fig. 4 is a flowchart illustrating another method for processing files in a blockchain provided in an embodiment of the present disclosure;
fig. 5 is a flowchart illustrating a file processing method for a blockchain provided in an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a block chain file processing apparatus provided in an embodiment of the present specification;
FIG. 7 is a block chain file processing apparatus according to another embodiment of the present disclosure;
FIG. 8 is a block chain file processing apparatus according to another embodiment of the present disclosure;
FIG. 9 is a block chain file processing apparatus according to another embodiment of the present disclosure;
FIG. 10 is a block chain file processing apparatus according to another embodiment of the present disclosure;
FIG. 11 is a schematic block diagram of a document processing system provided in an embodiment of the present description;
fig. 12 is a block diagram of an electronic device provided in an embodiment of the present specification.
Fig. 13 is a schematic structural diagram of a program product for implementing a file processing method of a blockchain provided in an embodiment of the present specification.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the present description. It will be apparent, however, to one skilled in the art that the present description may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present specification with unnecessary detail.
In order to explain the technical means described in the present specification, the following description will be given by way of specific examples.
The request party sends a request for signing the electronic document to the signing party, and the signing party can encrypt the electronic document by using a private key of the request party to generate a digital signature and sends the electronic document and the digital signature to the signing party together, wherein the private key is not public and a public key corresponding to the private key is public.
The signing party receives the electronic document and the digital signature, decrypts the digital signature by using the public key disclosed by the requesting party, if the decryption is successful, the electronic document is confirmed to be sent by the signing party, otherwise, the electronic document is confirmed not to be sent by the signing party.
In the above process, there may be an ill-intentioned third party that spoofs as a signing party and sends its own public key to the signing party. The signing party can also successfully decrypt the digital signature sent by the third party through the public key of the third party, and the electronic document is mistakenly considered to be sent by the signing party, so that the signature of the electronic document is fraudulently obtained, and unexpected loss is caused.
By authenticating the public key issuing authority, the situation that a malicious party pretends to be the public key can be avoided. Illustratively, the authority may be a CA center, also commonly referred to as a CA (certificate authority) certificate authority.
However, public key authentication to the CA center usually requires payment of a service fee with a high price, which increases the cost of signing electronic documents. Moreover, the signing activity of the electronic document is easy to generate dependency on the CA center, and once the CA center fails or is maliciously attacked by a third party, the signing activity of the electronic document cannot be normally carried out.
To this end, in one embodiment of the present specification, a method for processing a block chain file is provided. Referring to fig. 1, the method may include the steps of:
and step S1, the first terminal receives the second public key sent by the second terminal and stores the second public key in the first storage area of the first terminal.
And encrypting a second file by using a second private key corresponding to the second public key to obtain a second signature, wherein the second signature can be obtained by encrypting a file identifier of the second file by using the second private key, and the file identifier is obtained by calculating the second file by using a first algorithm.
The first algorithm may be a hash algorithm, and may be implemented by hash software, that is, the file identifier is obtained by calculating the second file by using the hash software. And the file identifier obtained by hash calculation is a hash value, namely the file identifier is the message digest of the second file.
In addition, the second terminal also sends the second public key to other terminals, and the other terminals, the first terminal and the second terminal form nodes of a block chain. And after receiving the second public key sent by the terminal, each other terminal respectively stores the second public key in a respective storage area.
Wherein, the number of the other terminals is two or more. For example, the number of the other terminals is two, three, four, and so on. In this way, the possibility that other respective terminals are caused to return the second signature as legitimate by improper means is further reduced, so that the reliability of the verification result on the legitimacy of the second signature returned to the first terminal is further ensured.
And step S2, the first terminal receives the second document, the second signature and the request for signing the second document sent by the second terminal.
Step S3, the first terminal sends a first verification request including the second signature to each of the other terminals, and determines whether to sign the second document according to a verification result of the validity of the second signature by each of the other terminals.
In the method for processing a document in a block chain provided in this embodiment, the second terminal sends the second public key to each of other nodes in the block chain including the first terminal and the second terminal, and when the first terminal receives a request for signing a second document sent by the first terminal, the first terminal requests the other nodes in the block chain to verify the validity of the second signature, so as to determine whether to sign the second document. In addition, since the node of the block chain itself can be composed of the first terminal, the first terminal and other terminals having business relations, no dependence on a third party is generated, and the method has the advantage of low implementation cost.
As shown in fig. 2, the step S3, that is, the first terminal sends the first verification request including the second signature to each of the other terminals, and determines whether to sign the second document according to the verification result of the validity of the second signature by each of the other terminals, may include the following steps:
step S31, the first terminal verifies whether the second signature is legal by using the second public key stored in the first storage area.
Step S32, if the first terminal verifies that the second signature is legal, sending the first verification request to each of the other terminals.
Step S33, the first terminal receives a result that each of the other terminals verifies whether the second signature is valid by using the stored second public key.
Step S34, the first terminal finally determines whether the second signature is legal according to the result of verifying whether the second signature is legal by each of the other terminals.
Step S35, if it is finally determined that the second signature is legal, the first terminal signs the second document and sends the signed second document to the second terminal.
In steps S31 to S35, the first terminal verifies the validity of the second signature by using the second public key in the first storage area of the first terminal, if the second signature is determined to be invalid, the first terminal sends the first verification request to other terminals, and if the second signature is valid, the multi-stage verification of the second signature is achieved, so that the verification efficiency is considered, and the reliability of the verification result is ensured.
Further, as shown in fig. 3, in the step S3, wherein the step S31 is that the first terminal verifies whether the second signature is legal by using the second public key stored in the first storage area, the method may include the following steps:
step S311, the first terminal acquires the second public key from the first storage area.
Step S312, the first terminal decrypts the second signature by using the second public key, and if the decryption is unsuccessful, it determines that the second signature is illegal.
Step S313, if the decryption is successful, the first algorithm is used for calculating the second file, the calculated file identification is compared with the file identification obtained by decrypting the second signature, whether the file identification is consistent or not is judged, if so, the second signature is judged to be legal, and if not, the second signature is judged to be illegal.
In the steps S311 to S313, the second public key is used to decrypt the second signature, wherein if the decryption is unsuccessful, the second signature is directly determined to be illegal, and if the decryption is successful, the file identifier calculated by the first algorithm on the second file is compared with the file identifier decrypted by the second signature, and finally whether the second signature is legal is determined, so that the validity of the second signature can be verified doubly by the second public key and the first algorithm, and the reliability of the verification result is enhanced.
As shown in fig. 4, in the step S3, where the step S34 is that the first terminal finally determines whether the second signature is legal according to the result of the other terminals verifying whether the second signature is legal, the method may include the following steps:
step S341, the first terminal receives, from each of the other terminals, a result of whether the second signature verification is valid. Specifically, each of the other terminals acquires a second public key from its storage area and decrypts the second signature using the second public key, and if decryption is successful, it is determined that the second signature is legal, otherwise, it is determined that the second signature is illegal. And after verifying whether the second signature is legal or not, the other terminals respectively send verification results to the first terminal.
Step S342, the first terminal counts the number of the received results of verifying the second signature as legal.
Step S343, the first terminal obtains the number of terminals that verify that the second signature is valid according to the number that is valid as a result of verifying the second signature. Specifically, the number statistical result that the first terminal verifies the second signature received by the first terminal is legal is K, and then the number of terminals with legal second signatures is K.
Step S344, the first terminal determines whether the number of terminals verifying that the second signature is valid exceeds a first threshold. Wherein the first threshold is determined according to the number of nodes in the block chain.
Step S345, if the number of terminals verifying that the second signature is legal exceeds a first threshold, it is finally determined that the second signature is legal, otherwise, it is finally determined that the second signature is illegal. Wherein the first threshold is greater than or equal to half of the number of all nodes in the blockchain. In particular, the first threshold may be any value between 50% and 100% of the number of all nodes in the blockchain. For example only, if the number of all nodes in the block chain is 50, the first threshold may be any one of 25, 26, and 27 … … 50; if the number of all nodes in the blockchain is 51, the first threshold may be any one of the values of 26 and 27 … … 51. Thus, the principle of democratic decision is met, and the credibility of the verification result is more easily accepted.
In the steps S341 to S343, the validity of the second signature is finally determined by comparing the number of terminals that verify that the second signature is valid with the first threshold, so that the greater the first threshold, the greater the reliability of the corresponding verification result is naturally, but the time for each terminal to feed back the verification result to the first terminal is different, and the size of the first threshold is set according to the actual need and the acceptance degree of the reliability, so that the validity of the second signature can be finally determined by setting the threshold requirement that the number of terminals that verify that the second signature is valid is not high, and the timeliness is improved.
In another embodiment, the first terminal finally determines whether the second signature is legal according to the result of verifying whether the second signature is legal by each of the other terminals, and the method may include the following steps:
the first terminal obtains the number of terminals which verify that the second signature is legal and the number of terminals which verify that the second signature is illegal;
the first terminal judges whether the ratio of the number of terminals which verify that the second signature is legal to the number of terminals which verify that the second signature is illegal is larger than 1;
and finally determining that the second signature is legal if the ratio of the number of the terminals for verifying the second signature to be illegal is greater than 1, otherwise, finally determining that the second signature is illegal. Specifically, assuming that the number of terminals verifying that the second signature is legal is K1 and the number of terminals verifying that the second signature is legal is K2, it may be finally determined whether the second signature is legal by determining whether K1/K2 is greater than 1.
The second signature is finally determined to be legal by verifying whether the ratio of the number of terminals with legal second signature to the number of terminals with illegal second signature is larger than 1, so that the second signature can be finally determined to be legal only by determining whether the number of terminals with legal second signature is more than half simple, and the method has strong operability and can ensure reliability.
As shown in fig. 5, according to a block chain file processing method provided in an embodiment of the present specification, the method may further include the following steps:
step S4, the first terminal encrypts the first file by using the first private key to obtain a first signature, and sends the first public key corresponding to the first private key to the second terminal and each of the other terminals.
Step S5, the first terminal sends a first document, a first signature, and a request to sign the first document to the second terminal.
And step S6, the first terminal receives the signed first file from the second terminal.
Therefore, the first terminal can be used as a receiver of the signature request and also can be used as an initiator of the signature request, wherein after each node of the block chain receives the signature request, other nodes can be used for verifying the validity of the signature, the endorsement by a certification authority of a third party is not needed, and the public key is not needed to be linked up by the block chain of the third party, so that the safety performance is guaranteed, and the realization cost is lower.
In another embodiment, a method for processing a file of a block chain is further provided, which is different from the method for processing a file of a block chain in the above embodiment in that:
and the second terminal sends the second file, the second signature and a request for signing the second file to the first terminal, and simultaneously sends the second signature to other terminals to request the other terminals to verify the validity of the first signature, and requires the other terminals to send verification results to the first terminal.
The first terminal does not need to send first verification requests including the second signature to other terminals, but directly receives verification results of the second signature validity sent by other terminals, and determines whether to sign the second document according to the verification results of the second signature validity sent by other terminals.
It should be understood that, the sequence numbers of the steps in the above embodiments do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic thereof, and should not constitute any limitation to the implementation process of the present application.
In another embodiment of the present specification, a block chain file processing apparatus is provided. As shown in fig. 6, the file processing apparatus of the block chain may include the following modules:
the storage module M1, the first terminal receives the second public key sent by the second terminal and stores it in the first storage area of the first terminal.
And encrypting a second file by using a second private key corresponding to the second public key to obtain a second signature, wherein the second signature can be obtained by encrypting a file identifier of the second file by using the second private key, and the file identifier is obtained by calculating the second file by using a first algorithm.
The first algorithm may be a hash algorithm, and may be implemented by hash software, that is, the file identifier is obtained by calculating the second file by using the hash software. And the file identifier obtained by hash calculation is a hash value, namely the file identifier is the message digest of the second file.
In addition, the second terminal also sends the second public key to other terminals, and the other terminals, the first terminal and the second terminal form nodes of a block chain.
Wherein, the number of the other terminals is two or more. In this way, the possibility that other respective terminals are caused to return the second signature as legitimate by improper means is further reduced, so that the reliability of the verification result on the legitimacy of the second signature returned to the first terminal is further ensured.
The receiving module M2, the first terminal, receives the second document, the second signature and the request for signing the second document sent by the second terminal;
the signing module M3, the first terminal, sends a first verification request including the second signature to each of the other terminals, and determines whether to sign the second document according to a verification result of the validity of the second signature by each of the other terminals.
In the block chain file processing apparatus provided in this embodiment, the second terminal sends the second public key to each of the other nodes of the block chain including the first terminal and the second terminal, and when the first terminal receives the request for signing the second file sent by the first terminal, the first terminal requests the other nodes of the block chain to verify the validity of the second signature, so as to determine whether to sign the second file. In addition, since the node of the block chain itself can be composed of the first terminal, the first terminal and other terminals having business relations, no dependence on a third party is generated, and the method has the advantage of low implementation cost.
As shown in fig. 7, the module M3 may include:
and the verification submodule M31 verifies whether the second signature is legal or not by using the second public key stored in the first storage area by the first terminal.
And the request submodule M32 sends the first verification request to each of the other terminals if the first terminal verifies that the second signature is legal.
And the receiving submodule M33 receives, by the first terminal, a result that each of the other terminals verifies whether the second signature is valid by using the stored second public key.
And the determining submodule M34 determines, by the first terminal, whether the second signature is legal or not, according to the result of verifying whether the second signature is legal or not by each of the other terminals.
And the signature submodule M35 is used for signing the second document by the first terminal and sending the signed second document to the second terminal if the second signature is finally determined to be legal.
In the sub-module, the first terminal firstly verifies the legality of the second signature through the second public key of the first storage area of the first terminal, if the second signature is illegal, the first terminal directly determines that the second signature is illegal, and if the second signature is legal, the first verification request is sent to other terminals, so that the multistage verification of the second signature is realized, the verification efficiency is considered, and meanwhile, the reliability of a verification result is ensured.
Further, as shown in fig. 8, the verification sub-module M31 may include:
the obtaining unit M311 obtains the second public key from the first storage area by the first terminal.
The first determining unit M312, where the first terminal decrypts the second signature by using the second public key, and if the decryption is unsuccessful, determines that the second signature is illegal.
And if the decryption is successful, the second judging unit M313 calculates the second file by using the first algorithm, compares the calculated file identifier with the file identifier obtained by decrypting the second signature, judges whether the file identifiers are consistent, judges that the second signature is legal if the file identifiers are consistent, and judges that the second signature is illegal if the file identifiers are not consistent.
In the unit, the second public key is used for decrypting the second signature, wherein if the decryption is unsuccessful, the second signature is directly judged to be illegal, if the decryption is successful, the file identification obtained by calculating the second file by using the first algorithm is compared with the file identification obtained by decrypting the second signature, and finally whether the second signature is legal is judged, so that the second public key and the first algorithm can be used for realizing double verification of the legality of the second signature, and the credibility of the verification result is enhanced.
As shown in fig. 9, the determining submodule M34 may include:
the number receiving unit M341, the first terminal, receives the result of whether the second signature verification is valid from each of the other terminals.
The number counting unit M342 counts the number of the received results of verifying the second signature as legal.
The number obtaining unit M343, the first terminal obtains the number of terminals that verify that the second signature is legal according to the number that is a result of verifying the second signature.
The third determining unit M344 determines, by the first terminal, whether the number of terminals that verify that the second signature is valid exceeds a first threshold, where the first threshold is determined according to the number of nodes in the block chain.
The fourth determining unit M345, if the number of terminals verifying that the second signature is legal exceeds the first threshold, finally determines that the second signature is legal, otherwise, finally determines that the second signature is illegal. Wherein the first threshold is greater than or equal to half of the number of all nodes in the blockchain. In particular, the first threshold may be any value between 50% and 100% of the number of all nodes in the blockchain. For example only, if the number of all nodes in the block chain is 50, the first threshold may be any one of 25, 26, and 27 … … 50; if the number of all nodes in the blockchain is 51, the first threshold may be any one of the values of 26 and 27 … … 51. Thus, the principle of democratic decision is met, and the credibility of the verification result is more easily accepted.
The legality of the second signature is finally determined by comparing the number of the terminals for verifying the legality of the second signature with the first threshold, so that the greater the first threshold is, the more naturally the credibility of the corresponding verification result can be guaranteed, but the time for each terminal to feed back the verification result to the first terminal is different, the size of the first threshold is set according to actual needs and the acceptance degree of the credibility, and therefore the legality of the second signature can be finally determined by setting and judging that the number of the terminals for verifying the legality of the second signature meets the low threshold requirement, and the timeliness is improved.
As shown in fig. 10, the block chain file processing apparatus provided in the embodiment of the present specification may further include the following modules:
the encryption sending module M4, where the first terminal encrypts the first file by using a first private key to obtain a first signature, and sends a first public key corresponding to the first private key to the second terminal and each of the other terminals.
The signature request module M5, the first terminal sending a first document, a first signature, and a request to sign the first document to the second terminal.
And the receiving signature module M6 receives the signed first document from the second terminal by the first terminal.
It should be noted that the function implementation of each module in the file processing apparatus of the block chain corresponds to each step in the file processing method embodiment of the block chain, and the function and implementation process thereof are not described in detail here.
Fig. 11 illustrates a file processing system provided in an embodiment of the present specification, which is one of applications of the file processing method of the blockchain provided in the above embodiment. The file processing system includes a first terminal 100, a second terminal 200, a third terminal 300, a fourth terminal 400, and a fifth terminal 500, where the third terminal 300 and the fourth terminal 400 are the other terminals mentioned in the file processing method of the blockchain provided in the above embodiment. In other embodiments, the file processing system may further include a sixth terminal, a seventh terminal, and so on, which may be specifically determined according to all terminals that have service needs to establish a block chain.
In the file processing system, the terminals are in communication connection with each other, and each terminal is provided with a separate storage area. Specifically, the first terminal 100 includes a first storage area 101, the second terminal 200 includes a second storage area 201, the third terminal 300 includes a third storage area 301, the fourth terminal 400 includes a fourth storage area 401, and the fifth terminal 500 includes a fifth storage area 501.
It should be noted that the storage areas of the respective terminals are configured to support operations of writing and reading data thereto, but not operations of modifying and deleting data that has been stored. Specifically, the public key cannot be modified and deleted once stored in the storage area. Even if the sent public key is wrong, the wrong public key cannot be withdrawn, and the wrong public key is always saved in the storage area. Therefore, a traceability mechanism of the public key can be provided, the possibility of malicious tampering of the public key is reduced, and the safety is ensured.
Referring to fig. 12, the present specification provides an electronic device 3, the electronic device 3 comprising at least one memory unit 31, at least one processing unit 32, and a bus 33 connecting different platform systems.
The storage unit 31 may include readable media in the form of volatile storage units, such as a random access memory unit (RAM)311 and/or a cache memory unit 312, and may further include a read only memory unit (ROM) 313.
Wherein, the storage unit 31 further stores a program product 4, and the program product 4 can be executed by the processing unit 32, so that the processing unit 32 executes the steps of the file processing method of the blockchain in the above embodiment. The storage unit 31 may also include a program/utility 314 having a set (at least one) of program modules 315, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Accordingly, the processing unit 32 may execute the program product 4 described above, and may execute the program/utility 314.
Bus 33 may be one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 3 may also communicate with one or more external devices 34, such as a keyboard, pointing device, bluetooth device, etc., and may also communicate with one or more devices capable of interacting with the electronic device 3, and/or with any device (e.g., router, modem, etc.) that enables the electronic device 3 to communicate with one or more other computing devices. Such communication may be through input/output (I/O) interfaces 35. Also, the electronic device 3 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 36. The network adapter 36 may communicate with other modules of the electronic device 3 via the bus 33. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 3, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, to name a few.
The present specification also provides a computer-readable storage medium for storing a computer program which, when executed, implements the steps of the file processing method of the blockchain in the above embodiments.
Fig. 13 shows a program product 4 provided in the present embodiment for implementing the above method, which may employ a portable compact disc read only memory (CD-ROM) and include program codes, and may be run on a terminal device, such as a personal computer. However, the program product 4 of the present specification is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. Program product 4 may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable storage medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing. Program code for carrying out operations for this specification may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The above description and drawings are only preferred embodiments of the present specification and are not intended to limit the present specification, so that all the similar or equivalent structures, devices, features and the like to those of the present specification, i.e., all the equivalent substitutions or modifications made in the scope of the present specification, shall fall within the scope of the present specification.

Claims (10)

1. A method for processing files of a blockchain, the method comprising:
the first terminal receives a second public key sent by the second terminal and stores the second public key in a first storage area of the first terminal, wherein a second file can be encrypted by using a second private key corresponding to the second public key to obtain a second signature,
the second terminal also sends the second public key to other terminals, and the other terminals, the first terminal and the second terminal form nodes of a block chain;
the first terminal receives the second file, the second signature and a request for signing the second file sent by the second terminal;
and the first terminal sends a first verification request comprising the second signature to each other terminal, and determines whether to sign the second document according to the verification result of the second signature validity by each other terminal.
2. The method of claim 1, wherein:
the number of the other terminals is two or more.
3. The method as claimed in claim 2, wherein said first terminal sends a first verification request including said second signature to each of said other terminals, and determines whether to sign said second document according to a result of said verification of the validity of said second signature by each of said other terminals, including:
the first terminal verifies whether the second signature is legal or not by using the second public key stored in the first storage area;
if the first terminal verifies that the second signature is legal, the first terminal sends the first verification request to other terminals;
the first terminal receives the result that each of the other terminals verifies whether the second signature is legal or not by using the stored second public key;
the first terminal finally determines whether the second signature is legal or not according to the result that the other terminals verify whether the second signature is legal or not;
and if the second signature is finally determined to be legal, the first terminal signs the second document and sends the signed second document to the second terminal.
4. A blockchain file processing method according to claim 3, wherein said second signature is obtained by encrypting a file identifier of said second file using said second private key, wherein said file identifier is obtained by calculating said second file using a first algorithm,
the first terminal verifies whether the second signature is legal by using the second public key stored in the first storage area, and the verification method comprises the following steps:
the first terminal acquires the second public key from the first storage area;
the first terminal decrypts the second signature by using the second public key, and if the decryption is unsuccessful, the second signature is judged to be illegal;
if the decryption is successful, the first algorithm is used for calculating the second file, the file identification obtained by calculation is compared with the file identification obtained by decrypting the second signature, whether the file identification is consistent or not is judged, if so, the second signature is judged to be legal, and if not, the second signature is judged to be illegal.
5. The method of claim 4, wherein the determining, by the first terminal, whether the second signature is legal according to the result of the other terminals verifying whether the second signature is legal comprises:
the first terminal receives the results of whether the second signature verification is legal or not from the other terminals;
the first terminal counts the received result of verifying the second signature as a legal number;
the first terminal obtains the number of terminals for verifying the second signature to be legal according to the number of terminals for verifying the second signature to be legal;
the first terminal judges whether the number of terminals for verifying that the second signature is legal exceeds a first threshold value, wherein the first threshold value is determined according to the number of nodes in the block chain;
and finally determining that the second signature is legal if the number of the terminals verifying that the second signature is legal exceeds a first threshold, or else, finally determining that the second signature is illegal.
6. A block chain file processing method according to claim 5, wherein said first threshold is greater than half of the number of all nodes in said block chain.
7. A method for processing files of a blockchain, the method comprising:
the first terminal receives a second public key sent by the second terminal and stores the second public key in a first storage area of the first terminal, wherein a second file can be encrypted by using a second private key corresponding to the second public key to obtain a second signature,
the second terminal also sends the second public key to other terminals, and the other terminals, the first terminal and the second terminal form nodes of a block chain;
the first terminal receives the second file, the second signature and a request for signing the second file sent by the second terminal;
the first terminal sends a first verification request comprising the second signature to each other terminal, and determines whether to sign the second file according to the verification result of the validity of the second signature by each other terminal;
the first terminal encrypts a first file by using a first private key to obtain a first signature, and sends a first public key corresponding to the first private key to the second terminal and other terminals;
the first terminal sends a first file, a first signature and a request for signing the first file to the second terminal;
the first terminal receives the signed first document from the second terminal.
8. A block chain file processing apparatus, comprising:
the storage module is used for receiving a second public key sent by a second terminal by a first terminal and storing the second public key in a first storage area of the first terminal, wherein a second file can be encrypted by using a second private key corresponding to the second public key to obtain a second signature, the second terminal also sends the second public key to other terminals, and the other terminals, the first terminal and the second terminal form nodes of a block chain;
a receiving module, configured to receive, by the first terminal, the second file, the second signature, and a request for signing the second file, where the second file and the second signature are sent by the second terminal;
and the signature module is used for sending a first verification request comprising the second signature to each other terminal by the first terminal and determining whether to sign the second document according to the verification result of the legality of the second signature by each other terminal.
9. An electronic device comprising a processor and a memory, the memory configured to store executable instructions of the processor, wherein the processor is configured to perform the steps in a block chain file processing method of any one of claims 1-7 via execution of the executable instructions.
10. A computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed, implements the steps in a blockchain file processing method according to any one of claims 1 to 7.
CN202011325607.9A 2020-09-01 2020-11-23 Block chain file processing method, device, equipment and medium Pending CN112395258A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2020109067695 2020-09-01
CN202010906769 2020-09-01

Publications (1)

Publication Number Publication Date
CN112395258A true CN112395258A (en) 2021-02-23

Family

ID=74607721

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011325607.9A Pending CN112395258A (en) 2020-09-01 2020-11-23 Block chain file processing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN112395258A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1125196A (en) * 1997-07-08 1999-01-29 Nippon Telegr & Teleph Corp <Ntt> Electronic seal system and approval method utilizing computer card
CN101419686A (en) * 2008-10-28 2009-04-29 吕金洪 A kind of on-line contract signing system based on the internet
CN107067255A (en) * 2017-02-27 2017-08-18 腾讯科技(深圳)有限公司 The treating method and apparatus of account in block chain
CN110222537A (en) * 2019-06-17 2019-09-10 北京艾摩瑞策科技有限公司 Verification method and device applied to block chain link
CN111224788A (en) * 2020-04-21 2020-06-02 国网区块链科技(北京)有限公司 Electronic contract management method, device and system based on block chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1125196A (en) * 1997-07-08 1999-01-29 Nippon Telegr & Teleph Corp <Ntt> Electronic seal system and approval method utilizing computer card
CN101419686A (en) * 2008-10-28 2009-04-29 吕金洪 A kind of on-line contract signing system based on the internet
CN107067255A (en) * 2017-02-27 2017-08-18 腾讯科技(深圳)有限公司 The treating method and apparatus of account in block chain
CN110222537A (en) * 2019-06-17 2019-09-10 北京艾摩瑞策科技有限公司 Verification method and device applied to block chain link
CN111224788A (en) * 2020-04-21 2020-06-02 国网区块链科技(北京)有限公司 Electronic contract management method, device and system based on block chain

Similar Documents

Publication Publication Date Title
WO2021012552A1 (en) Login processing method and related device
CN101395624B (en) Verification of electronic signatures
CN110519309B (en) Data transmission method, device, terminal, server and storage medium
CN100512201C (en) Method for dealing inserted-requested message of business in groups
CN110311787B (en) Authorization management method, system, device and computer readable storage medium
US20110264917A1 (en) Method for two step digital signature
CN102177678B (en) Trusted and confidential remote TPM initialization
KR20060031881A (en) Method for using trusted, hardware-based identity credentials in runtime package signature to secure mobile communications and high-value transaction execution
CN109981287B (en) Code signing method and storage medium thereof
CN110708162B (en) Resource acquisition method and device, computer readable medium and electronic equipment
CN111639325A (en) Merchant authentication method, device, equipment and storage medium based on open platform
CN116633522A (en) Two-party privacy intersection method and system based on blockchain
CN112968779B (en) Security authentication and authorization control method, control system and program storage medium
CN116506134B (en) Digital certificate management method, device, equipment, system and readable storage medium
CN111291398B (en) Block chain-based authentication method and device, computer equipment and storage medium
CN109302442B (en) Data storage proving method and related equipment
CN112311534A (en) Method for generating asymmetric algorithm key pair
CN114297597B (en) Account management method, system, equipment and computer readable storage medium
CN115549984A (en) Cross-chain transaction method, device, equipment and storage medium
CN112395258A (en) Block chain file processing method, device, equipment and medium
CN114584347A (en) Verification short message receiving and sending method, server, terminal and storage medium
CN108985079B (en) Data verification method and verification system
CN109104393B (en) Identity authentication method, device and system
CN113723897A (en) OA approval method, device, equipment and storage medium based on block chain
CN114760111B (en) File confidentiality method and file confidentiality device based on block chain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination