A project contract management method based on blockchain
Through the project contract management method based on the blockchain, the convenience and security problems of traditional contract management are solved, efficient query of the contract and multiple security measures are realized, ensuring the security and reliability of the contract.
Patent Information
- Application Number
- CN202410881560.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-07-03
AI Technical Summary
Traditional project contract management has problems with convenience and security. Paper contracts are easy to lose. Electronic contract management is inconvenient and there are risks of data loss and contract tampering. It cannot meet the needs of modern project contract management.
Adopting a blockchain-based project contract management method, the security and convenience of the contract are ensured through server preset contract templates, identity authentication, electronic signatures and blockchain storage. Specific steps include server preset contract templates, client identity authentication, electronic signatures and encrypted storage, and the use of blockchain for decentralized storage and backup.
It realizes convenient query and management of project contracts, improves the security of the contract, prevents data leakage and tampering, and ensures the reliability and integrity of the contract.
Smart Images

Figure CN118427864B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of project contract management, and in particular to a project contract management method based on blockchain. Background Art
[0002] A project is an independent one-time or long-term work task that people organize human, material and financial resources through efforts and various methods, according to the relevant planning and arrangement of the business model, in order to achieve the goals defined by quantity and quality indicators. An engineering project is a project with engineering construction as the carrier, which is a one-time engineering construction task as the object of management. It takes buildings or structures as the target output, needs to pay a certain fee, follow a certain procedure, and be completed within a certain time, and should meet quality requirements.
[0003] The process of project advancement involves transactions of related materials and services. In order to ensure the security of the transactions, a project contract needs to be drafted and signed during the transaction process, and the project contract needs to be managed after it is signed.
[0004] Traditionally, two copies of paper contracts are signed and kept by both parties for project contract management. However, this method is easy to lose and difficult to query. With the advancement of technology, it has been gradually replaced by electronic contracts. However, traditional electronic contracts are just scanning paper contracts into electronic files, and then simply storing the electronic contract files in a folder. They can only be viewed locally one by one, which is inconvenient to manage. There are also problems such as contract fraud, contract tampering, and information leakage. Electronic contracts also have the risk of data loss, which can no longer meet the needs of project contract management.
[0005] Therefore, how to provide a blockchain-based project contract management method to improve the convenience and security of project contract management has become a technical problem that needs to be solved urgently. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide a project contract management method based on blockchain to improve the convenience and security of project contract management.
[0007] The present invention is implemented as follows: a project contract management method based on blockchain, comprising the following steps:
[0008] Step S10, the server presets contract templates of several project contracts, creates a private key, a root certificate carrying a root public key, a pair of A1 private key and A1 public key, a pair of B1 private key and B1 public key, signs the A1 public key with the root private key to obtain the A work certificate, and signs the B1 public key with the root private key to obtain the B work certificate;
[0009] Step S20: The server sends the root certificate, A work certificate and A1 private key to the first client, and sends the root certificate, B work certificate and B1 private key to the second client;
[0010] Step S30: After the first client and the second client perform identity authentication through the root certificate, A work certificate, A1 private key, B work certificate and B1 private key, the first client obtains the corresponding contract template from the server and drafts a project contract based on the contract template;
[0011] Step S40: After the first client electronically signs the project contract, the first client sends the project contract to the second client;
[0012] Step S50: After the second client performs a second electronic signature on the project contract, the project contract is fed back to the server;
[0013] Step S60: The server encrypts and stores the project contract and backs it up to the blockchain;
[0014] Step S70: The first client or the second client accesses the server to query and manage the project contract.
[0015] Furthermore, in step S10, the server presets several contract templates of project contracts, specifically:
[0016] The server creates contract templates for several project contracts, sets the template name, template category and template style of each of the contract templates, and displays each of the contract templates in a list form.
[0017] Furthermore, in step S10, the root private key is used to sign the A1 public key and the B1 public key; the root public key is used to verify the signature of the A work certificate and the B work certificate.
[0018] Furthermore, in step S20, the first client is a buyer's client or a seller's client; the second client is a seller's client or a buyer's client.
[0019] Furthermore, the step S30 specifically includes:
[0020] Step S31: The first client generates a first random number, and sends the first random number and A work certificate to the second client;
[0021] Step S32: The second client verifies the legitimacy of the A work certificate and extracts the A1 public key, generates a second random number, a pair of B2 private key and B2 public key, encrypts the first random number and the B2 public key by the A1 public key, generates first ciphertext data, and sends the first ciphertext data, the second random number and the B2 work certificate to the first client;
[0022] Step S33: The first client verifies the legitimacy of the B work certificate and extracts the B1 public key. After decrypting the first ciphertext data with the A1 private key and verifying it, a pair of A2 private key and A2 public key is generated. The first session key is negotiated with the A2 private key and the B2 public key and a first check value is calculated. The second random number, the A2 public key and the first check value are encrypted with the B1 public key to generate second ciphertext data, and the second ciphertext data is sent to the second client.
[0023] Step S34: the second client decrypts the second ciphertext data by using the B1 private key to obtain a second random number, the A2 public key, and the first check value; after verifying the second random number, the second session key is negotiated by using the A2 public key and the B2 private key; a second check value of the second session key is calculated; after verifying the first check value by using the second check value, the second check value is sent to the first client;
[0024] Step S35: After the first client verifies the second verification value by using the first verification value, identity authentication between the first client and the second client is completed;
[0025] Step S36: The first client accesses the server and obtains the corresponding contract template based on the template name, template category or template style;
[0026] Step S37: The first client drafts a project contract with a contract number, a contract name, a contract type and a contract status based on the contract template; the value of the contract status is to be signed or signed.
[0027] Furthermore, the step S32 is specifically as follows:
[0028] The second client extracts the root public key from the root certificate, verifies the signature of A's work certificate by using the root public key, extracts the A1 public key from the A's work certificate, generates a second random number, and generates a pair of B2 private key and B2 public key by using the ElGamal algorithm;
[0029] The second client encrypts the first random number and the B2 public key by using the A1 public key to generate first ciphertext data, and sends the first ciphertext data, the second random number and the B work certificate to the first client.
[0030] Furthermore, the step S33 is specifically as follows:
[0031] The first client extracts the root public key from the root certificate, verifies the signature of B's work certificate with the root public key, extracts the B1 public key from the B's work certificate, decrypts the first ciphertext data with the A1 private key to obtain the first random number and the B2 public key, and determines whether the first random number obtained by decryption is consistent with the local first random number. If not, the process ends; if yes, then:
[0032] A pair of A2 private key and A2 public key are generated through the ElGamal algorithm; a first session key is negotiated through the A2 private key and the B2 public key, a first check value of the first session key is calculated, a second random number, the A2 public key and the first check value are encrypted through the B1 public key to generate second ciphertext data, and the second ciphertext data is sent to a second client.
[0033] Furthermore, the step S40 is specifically as follows:
[0034] The first client obtains the input of the first signer and the first signature coordinates, automatically matches the corresponding first signature information based on the first signer, adds the first signature information to the project contract based on the first signature coordinates to complete the first electronic signature of the project contract, and encrypts the project contract after the first electronic signature using the RSA algorithm and sends it to the second client.
[0035] Furthermore, the step S50 is specifically as follows:
[0036] The second client uses the RSA algorithm to decrypt the received project contract, obtains the input second signer and the second signature coordinates, automatically matches the corresponding second signature information based on the second signer, and adds the second signature information to the project contract based on the second signature coordinates to complete the second electronic signature of the project contract. The project contract after the second electronic signature is encrypted using the 3DES algorithm and then fed back to the server.
[0037] Furthermore, the step S60 is specifically as follows:
[0038] The server uses the 3DES algorithm to decrypt the received project contract, reads the plaintext data of the project contract, performs MAC calculation on the plaintext data to obtain a MAC value, and verifies whether the blockchain stores the MAC value. If so, the process ends; if not, an encryption key is generated based on the ElGamal algorithm, the project contract is encrypted using the encryption key, and stored in the IPFS system. The MAC value and the index address returned by the IPFS system are bound and backed up to the blockchain.
[0039] The advantages of the present invention are:
[0040] 1. Preset several contract templates of project contracts through the server, create a private key, a root certificate with a root public key, a pair of A1 private key and A1 public key, a pair of B1 private key and B1 public key, sign the A1 public key with the root private key to obtain the A work certificate, sign the B1 public key with the root private key to obtain the B work certificate, then send the root certificate, A work certificate and A1 private key to the first client, and send the root certificate, B work certificate and B1 private key to the second client; after the first client and the second client perform identity authentication through the root certificate, A work certificate, A1 private key, B work certificate and B1 private key, the first client obtains the corresponding contract template from the server and drafts the project contract, performs the first electronic signature on the project contract and sends it to the second client, then the second client performs the second electronic signature on the project contract and feeds it back to the server, the server encrypts and stores the project contract and backs it up to Blockchain, the first client or the second client accesses the server to query the project contract; since the project contract is stored in the server, the project contract can be queried online by accessing the server later, and the project contract can be searched and queried based on data such as contract number, contract name, contract type, contract content, etc. The search results are displayed in a list form, and the project contract can be quickly queried and located; and the data exchanged between the first client, the second client, and the server are encrypted by an encryption algorithm to prevent the data from being stolen in plain text, and different encryption algorithms are used for encryption to prevent the leakage of one of the encryption algorithms and the leakage of all data, and only the first client and the second client who have passed the identity authentication can draft the project contract, combined with electronic signatures and decentralized storage backup of blockchain, and multiple security measures are taken before and after, which ultimately greatly improves the convenience and security of project contract management.
[0041] 2. Create a root private key, a root certificate with a root public key, a pair of A1 private key and A1 public key, a pair of B1 private key and B1 public key through the server, sign the A1 public key with the root private key to obtain the A work certificate, sign the B1 public key with the root private key to obtain the B work certificate, send the root certificate, A work certificate, and A1 private key to the first client, and send the root certificate, B work certificate, and B1 private key to the second client; then the first client generates a first random number, sends the first random number and A work certificate to the second client, the second client verifies the legitimacy of the A work certificate and extracts the A1 public key, and generates The first random number, a pair of B2 private key and B2 public key are generated, the first random number and B2 public key are encrypted by the A1 public key to generate the first ciphertext data, the first ciphertext data, the second random number, and the B2 work certificate are sent to the first client, the first client verifies the legitimacy of the B work certificate and extracts the B1 public key, decrypts the first ciphertext data by the A1 private key and verifies it, generates a pair of A2 private key and A2 public key, negotiates the first session key with the A2 private key and the B2 public key and calculates the first check value, encrypts the second random number, the A2 public key and the first check value by the B1 public key to generate the second ciphertext data, and the second random number and the B2 work certificate are sent to the first client. The first client verifies the legitimacy of the B work certificate and extracts the B1 public key, decrypts the first ciphertext data by the A1 private key and verifies it, and generates the first session key by the A2 private key and the B2 public key. The second client decrypts the second ciphertext data through the B1 private key to obtain a second random number, an A2 public key and a first check value. After verifying the second random number, the second session key is negotiated through the A2 public key and the B2 private key and a second check value is calculated. After verifying the first check value through the second check value, the second check value is sent to the first client. After the first client verifies the second check value through the first check value, the identity authentication between the first client and the second client is completed; that is, based on the root certificate, A work certificate, B work certificate, A2 private key, A2 public key, B2 private key, B2 public key, first random number, second random number, perform two-way authentication on the first client and the second client. The authentication process adopts at least 6 security measures (A work certificate signature verification, second ciphertext data signature verification, second check value comparison, B work certificate signature verification, first ciphertext data signature verification, first check value comparison), and the first ciphertext data, second ciphertext data, first check value, and second check value are all generated based on multiple keys, which increases the difficulty of cracking, and ultimately greatly improves the reliability of identity authentication, ensures the reliability of the project contract drafting entity, and thereby improves the security of project contract management.
[0042] 3. The first client generates a first random number and the second client generates a second random number for security authentication, which can effectively prevent replay attacks. Combined with the validity period verification of the timestamp, the reliability of identity authentication is further guaranteed.
[0043] 4. Encrypt the first random number and the B2 public key through the A1 public key to generate the first ciphertext data and send it to the first client; encrypt the second random number, the A2 public key, and the first check value through the B1 public key to generate the second ciphertext data and send it to the second client, so as to prevent the plaintext from being stolen during the relevant data transmission process, greatly improve the security of data transmission, and further ensure the reliability of identity authentication.
[0044] 5. By setting up different encryption schemes for identity authentication between the first client and the second client, issuing contract templates, transmitting project contracts, storing project contracts, and backing up project contracts, the security of project contract management is greatly improved.
[0045] 6. Read the plaintext data of the project contract, perform MAC calculation on the plaintext data to obtain the MAC value, verify whether the blockchain stores the MAC value, generate an encryption key based on the ElGamal algorithm, use the encryption key to encrypt the project contract and store it in the IPFS system, bind the MAC value and the index address returned by the IPFS system and back it up to the blockchain. Since the MAC calculation is a hash function with a secret key, it is more secure than ordinary hash calculations. At least three security measures are taken before and after (MAC calculation, ElGamal algorithm, blockchain), which greatly improves the security of the project contract storage and backup. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.
[0047] Figure 1 It is a flow chart of a project contract management method based on blockchain of the present invention. DETAILED DESCRIPTION
[0048] The technical solution in the embodiment of the present application has the following overall idea: the project contract is stored in the server, and the project contract can be queried and retrieved online by accessing the server later. The data exchanged between the first client, the second client, and the server are encrypted by an encryption algorithm to prevent the data from being stolen in plain text, and different encryption algorithms are used for encryption to prevent the leakage of all data due to the leakage of one of the encryption algorithms. Only the first client and the second client that have passed the identity authentication can draft the project contract. Combined with the electronic signature and the decentralized storage backup of the blockchain, multiple security measures are taken before and after to improve the convenience and security of project contract management.
[0049] Please refer to Figure 1 As shown, a preferred embodiment of a project contract management method based on blockchain of the present invention comprises the following steps:
[0050] Step S10, the server presets contract templates of several project contracts, creates a private key, a root certificate carrying a root public key, a pair of A1 private key and A1 public key, a pair of B1 private key and B1 public key, signs the A1 public key with the root private key to obtain the A work certificate, and signs the B1 public key with the root private key to obtain the B work certificate;
[0051] The root certificate, A's work certificate and B's work certificate use the X.509 format, which defines the public key module field, from which the root public key, A1 public key and B1 public key can be extracted later;
[0052] Step S20: The server sends the root certificate, A work certificate and A1 private key to the first client, and sends the root certificate, B work certificate and B1 private key to the second client;
[0053] Step S30: After the first client and the second client perform identity authentication through the root certificate, A work certificate, A1 private key, B work certificate and B1 private key, the first client obtains the corresponding contract template from the server and drafts a project contract based on the contract template;
[0054] Step S40: After the first client electronically signs the project contract, the first client sends the project contract to the second client;
[0055] Step S50: After the second client performs a second electronic signature on the project contract, the project contract is fed back to the server;
[0056] Step S60: The server encrypts and stores the project contract and backs it up to the blockchain;
[0057] Step S70: The first client or the second client accesses the server to manage the query of the project contract. In specific implementation, the project contract can be searched and queried based on data such as contract number, contract name, contract type, contract content, etc., and the search results are displayed in a list form.
[0058] In specific implementation, relevant data is sent through instructions carrying timestamps. The party receiving the data needs to first perform a time verification through the timestamp to prevent replay attacks, which also increases the difficulty of attacks.
[0059] In step S10, the server presets several contract templates of project contracts, specifically:
[0060] The server creates contract templates for several project contracts, sets the template name, template category and template style of each contract template, and displays each contract template in a list format to facilitate selection of the corresponding contract template as needed.
[0061] In the step S10, the root private key is used to sign the A1 public key and the B1 public key; the root public key is used to verify the signature of the A work certificate and the B work certificate; the root private key and the root public key are a pair of paired keys.
[0062] In the step S20, the first client is a buyer's client or a seller's client; the second client is a seller's client or a buyer's client.
[0063] The step S30 specifically includes:
[0064] Step S31: The first client generates a first random number, and sends the first random number and A work certificate to the second client;
[0065] Step S32: The second client verifies the legitimacy of the A work certificate and extracts the A1 public key, generates a second random number, a pair of B2 private key and B2 public key, encrypts the first random number and the B2 public key by the A1 public key, generates first ciphertext data, and sends the first ciphertext data, the second random number and the B2 work certificate to the first client;
[0066] Step S33: The first client verifies the legitimacy of the B work certificate and extracts the B1 public key. After decrypting the first ciphertext data with the A1 private key and verifying it, a pair of A2 private key and A2 public key is generated. The first session key is negotiated with the A2 private key and the B2 public key and a first check value is calculated. The second random number, the A2 public key and the first check value are encrypted with the B1 public key to generate second ciphertext data, and the second ciphertext data is sent to the second client.
[0067] The first session key is negotiated. In the specific implementation, the A2 private key and the B2 public key are first used to perform ECDH calculation, and then sha256 calculation is performed and the preset length is intercepted to generate the first session key; the negotiation process of the second session key is the same.
[0068] Calculate the first check value of the first session key. In specific implementation, the first session key can be used to encrypt 8 bytes of 0, and the first 3 bytes are taken as the first check value. The calculation process of the second check value is similar.
[0069] Step S34: the second client decrypts the second ciphertext data by using the B1 private key to obtain a second random number, the A2 public key, and the first check value; after verifying the second random number, the second session key is negotiated by using the A2 public key and the B2 private key; a second check value of the second session key is calculated; after verifying the first check value by using the second check value, the second check value is sent to the first client;
[0070] Since the first session key is generated through negotiation between the A2 private key and the B2 public key, and the second session key is generated through negotiation between the A2 public key and the B2 private key, the first session key and the second session key are the same pair of keys, and the first check value calculated based on the first session key should theoretically be equal to the second check value calculated based on the second session key; that is, to check the first check value by the second check value is to compare whether the second check value is equal to the first check value;
[0071] Step S35: After the first client verifies the second verification value by using the first verification value, identity authentication between the first client and the second client is completed;
[0072] Step S36: the first client accesses the server and obtains the corresponding contract template based on the template name, template category or template style; when the server sends the contract template to the first client, it encrypts it using the IDEA algorithm to ensure the security of the transmission of the contract template;
[0073] Step S37: The first client drafts a project contract with a contract number, contract name, contract type and contract status based on the contract template; the contract status is either to be signed or signed. When drafting the project contract, the contract status is to be signed. After both the first client and the second client sign, the contract status is updated to signed.
[0074] The step S32 is specifically as follows:
[0075] The second client extracts the root public key from the root certificate, verifies the signature of A's work certificate by using the root public key, extracts the A1 public key from the A's work certificate, generates a second random number, and generates a pair of B2 private key and B2 public key by using the ElGamal algorithm;
[0076] The second client encrypts the first random number and the B2 public key by using the A1 public key to generate first ciphertext data, and sends the first ciphertext data, the second random number and the B work certificate to the first client.
[0077] The step S33 is specifically as follows:
[0078] The first client extracts the root public key from the root certificate, verifies the signature of B's work certificate with the root public key, extracts the B1 public key from the B's work certificate, decrypts the first ciphertext data with the A1 private key to obtain the first random number and the B2 public key, and determines whether the first random number obtained by decryption is consistent with the local first random number. If not, the process ends; if yes, then:
[0079] A pair of A2 private key and A2 public key are generated through the ElGamal algorithm; a first session key is negotiated through the A2 private key and the B2 public key, a first check value of the first session key is calculated, a second random number, the A2 public key and the first check value are encrypted through the B1 public key to generate second ciphertext data, and the second ciphertext data is sent to a second client.
[0080] The step S35 is specifically as follows:
[0081] The first client determines whether the first verification value is consistent with the second verification value. If not, the process ends; if so, the identity authentication between the first client and the second client is completed.
[0082] The step S40 is specifically as follows:
[0083] The first client obtains the input of the first signer and the first signature coordinates, automatically matches the corresponding first signature information based on the first signer, adds the first signature information to the project contract based on the first signature coordinates to complete the first electronic signature of the project contract, and encrypts the project contract after the first electronic signature using the RSA algorithm and sends it to the second client.
[0084] The step S50 is specifically as follows:
[0085] The second client uses the RSA algorithm to decrypt the received project contract, obtains the input second signer and the second signature coordinates, automatically matches the corresponding second signature information based on the second signer, and adds the second signature information to the project contract based on the second signature coordinates to complete the second electronic signature of the project contract. The project contract after the second electronic signature is encrypted using the 3DES algorithm and then fed back to the server.
[0086] During specific implementation, the first client and the second client can send a real-name authentication request with the signatory (name or company name), mobile phone number, ID number and photo to the authentication server for real-name authentication. Only when the signatory, mobile phone number, ID number and photo are consistent, the real-name authentication is passed, which effectively improves the reliability of the real-name authentication; by performing real-name authentication on the first client and the second client, the reliability of the proposed subject of the project contract is guaranteed.
[0087] The step S60 is specifically as follows:
[0088] The server uses the 3DES algorithm to decrypt the received project contract, reads the plaintext data of the project contract, performs MAC calculation on the plaintext data to obtain a MAC value, and verifies whether the blockchain stores the MAC value. If so, the process ends; if not, an encryption key is generated based on the ElGamal algorithm, the project contract is encrypted using the encryption key, and stored in the IPFS system. The MAC value and the index address returned by the IPFS system are bound and backed up to the blockchain.
[0089] Since MAC calculation is irreversible, the MAC calculation is performed again on the project contract subsequently. By comparing the calculated MAC value with the MAC value stored in the blockchain, it is possible to quickly determine whether the project contract has been tampered with. The MAC value and index address are notarized through the blockchain to prevent tampering with the MAC value and index address, and the project contract is verified through a trusted MAC value to further ensure security.
[0090] In summary, the advantages of the present invention are:
[0091] 1. Preset several contract templates of project contracts through the server, create a private key, a root certificate with a root public key, a pair of A1 private key and A1 public key, a pair of B1 private key and B1 public key, sign the A1 public key with the root private key to obtain the A work certificate, sign the B1 public key with the root private key to obtain the B work certificate, then send the root certificate, A work certificate and A1 private key to the first client, and send the root certificate, B work certificate and B1 private key to the second client; after the first client and the second client perform identity authentication through the root certificate, A work certificate, A1 private key, B work certificate and B1 private key, the first client obtains the corresponding contract template from the server and drafts the project contract, performs the first electronic signature on the project contract and sends it to the second client, then the second client performs the second electronic signature on the project contract and feeds it back to the server, the server encrypts and stores the project contract and backs it up to Blockchain, the first client or the second client accesses the server to query the project contract; since the project contract is stored in the server, the project contract can be queried online by accessing the server later, and the project contract can be searched and queried based on data such as contract number, contract name, contract type, contract content, etc. The search results are displayed in a list form, and the project contract can be quickly queried and located; and the data exchanged between the first client, the second client, and the server are encrypted by an encryption algorithm to prevent the data from being stolen in plain text, and different encryption algorithms are used for encryption to prevent the leakage of one of the encryption algorithms and the leakage of all data, and only the first client and the second client who have passed the identity authentication can draft the project contract, combined with electronic signatures and decentralized storage backup of blockchain, and multiple security measures are taken before and after, which ultimately greatly improves the convenience and security of project contract management.
[0092] 2. Create a root private key, a root certificate with a root public key, a pair of A1 private key and A1 public key, a pair of B1 private key and B1 public key through the server, sign the A1 public key with the root private key to obtain the A work certificate, sign the B1 public key with the root private key to obtain the B work certificate, send the root certificate, A work certificate, and A1 private key to the first client, and send the root certificate, B work certificate, and B1 private key to the second client; then the first client generates a first random number, sends the first random number and A work certificate to the second client, the second client verifies the legitimacy of the A work certificate and extracts the A1 public key, and generates The first random number, a pair of B2 private key and B2 public key are generated, the first random number and B2 public key are encrypted by the A1 public key to generate the first ciphertext data, the first ciphertext data, the second random number, and the B2 work certificate are sent to the first client, the first client verifies the legitimacy of the B work certificate and extracts the B1 public key, decrypts the first ciphertext data by the A1 private key and verifies it, generates a pair of A2 private key and A2 public key, negotiates the first session key with the A2 private key and the B2 public key and calculates the first check value, encrypts the second random number, the A2 public key and the first check value by the B1 public key to generate the second ciphertext data, and the second random number and the B2 work certificate are sent to the first client. The first client verifies the legitimacy of the B work certificate and extracts the B1 public key, decrypts the first ciphertext data by the A1 private key and verifies it, and generates the first session key by the A2 private key and the B2 public key. The second client decrypts the second ciphertext data through the B1 private key to obtain a second random number, an A2 public key and a first check value. After verifying the second random number, the second session key is negotiated through the A2 public key and the B2 private key and a second check value is calculated. After verifying the first check value through the second check value, the second check value is sent to the first client. After the first client verifies the second check value through the first check value, the identity authentication between the first client and the second client is completed; that is, based on the root certificate, A work certificate, B work certificate, A2 private key, A2 public key, B2 private key, B2 public key, first random number, second random number, perform two-way authentication on the first client and the second client. The authentication process adopts at least 6 security measures (A work certificate signature verification, second ciphertext data signature verification, second check value comparison, B work certificate signature verification, first ciphertext data signature verification, first check value comparison), and the first ciphertext data, second ciphertext data, first check value, and second check value are all generated based on multiple keys, which increases the difficulty of cracking, and ultimately greatly improves the reliability of identity authentication, ensures the reliability of the project contract drafting entity, and thereby improves the security of project contract management.
[0093] 3. The first client generates a first random number and the second client generates a second random number for security authentication, which can effectively prevent replay attacks. Combined with the validity period verification of the timestamp, the reliability of identity authentication is further guaranteed.
[0094] 4. Encrypt the first random number and the B2 public key through the A1 public key to generate the first ciphertext data and send it to the first client; encrypt the second random number, the A2 public key, and the first check value through the B1 public key to generate the second ciphertext data and send it to the second client, so as to prevent the plaintext from being stolen during the relevant data transmission process, greatly improve the security of data transmission, and further ensure the reliability of identity authentication.
[0095] 5. By setting up different encryption schemes for identity authentication between the first client and the second client, issuing contract templates, transmitting project contracts, storing project contracts, and backing up project contracts, the security of project contract management is greatly improved.
[0096] 6. Read the plaintext data of the project contract, perform MAC calculation on the plaintext data to obtain the MAC value, verify whether the blockchain stores the MAC value, generate an encryption key based on the ElGamal algorithm, use the encryption key to encrypt the project contract and store it in the IPFS system, bind the MAC value and the index address returned by the IPFS system and back it up to the blockchain. Since the MAC calculation is a hash function with a secret key, it is more secure than ordinary hash calculations. At least three security measures are taken before and after (MAC calculation, ElGamal algorithm, blockchain), which greatly improves the security of the project contract storage and backup.
[0097] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A project contract management method based on blockchain, characterized by: The steps include: Step S10, the server presets contract templates of several project contracts, creates a private key, a root certificate carrying a root public key, a pair of A1 private key and A1 public key, a pair of B1 private key and B1 public key, signs the A1 public key with the root private key to obtain the A work certificate, and signs the B1 public key with the root private key to obtain the B work certificate; Step S20: The server sends the root certificate, A work certificate and A1 private key to the first client, and sends the root certificate, B work certificate and B1 private key to the second client; Step S30: After the first client and the second client perform identity authentication through the root certificate, A work certificate, A1 private key, B work certificate and B1 private key, the first client obtains the corresponding contract template from the server and drafts a project contract based on the contract template; Step S40: After the first client electronically signs the project contract, the first client sends the project contract to the second client; Step S50: After the second client performs a second electronic signature on the project contract, the project contract is fed back to the server; Step S60: The server encrypts and stores the project contract and backs it up to the blockchain; Step S70: the first client or the second client accesses the server to query and manage the project contract; The step S30 specifically includes: Step S31: The first client generates a first random number, and sends the first random number and A work certificate to the second client; Step S32: The second client verifies the legitimacy of the A work certificate and extracts the A1 public key, generates a second random number, a pair of B2 private key and B2 public key, encrypts the first random number and the B2 public key by the A1 public key, generates first ciphertext data, and sends the first ciphertext data, the second random number and the B2 work certificate to the first client; Step S33: The first client verifies the legitimacy of the B work certificate and extracts the B1 public key. After decrypting the first ciphertext data with the A1 private key and verifying it, a pair of A2 private key and A2 public key is generated. The first session key is negotiated with the A2 private key and the B2 public key and a first check value is calculated. The second random number, the A2 public key and the first check value are encrypted with the B1 public key to generate second ciphertext data, and the second ciphertext data is sent to the second client. Step S34: the second client decrypts the second ciphertext data by using the B1 private key to obtain a second random number, the A2 public key, and the first check value; after verifying the second random number, the second session key is negotiated by using the A2 public key and the B2 private key; a second check value of the second session key is calculated; after verifying the first check value by using the second check value, the second check value is sent to the first client; Step S35: After the first client verifies the second verification value by using the first verification value, identity authentication between the first client and the second client is completed; Step S36: The first client accesses the server and obtains the corresponding contract template based on the template name, template category or template style; Step S37: The first client draws up a project contract with a contract number, a contract name, a contract type, and a contract status based on the contract template; the contract status can be a value of to be signed or signed; The step S32 is specifically as follows: The second client extracts the root public key from the root certificate, verifies the signature of A's work certificate by using the root public key, extracts the A1 public key from the A's work certificate, generates a second random number, and generates a pair of B2 private key and B2 public key by using the ElGamal algorithm; The second client encrypts the first random number and the B2 public key by using the A1 public key to generate first ciphertext data, and sends the first ciphertext data, the second random number and the B work certificate to the first client; The step S33 is specifically as follows: The first client extracts the root public key from the root certificate, verifies the signature of B's work certificate with the root public key, extracts the B1 public key from the B's work certificate, decrypts the first ciphertext data with the A1 private key to obtain the first random number and the B2 public key, and determines whether the first random number obtained by decryption is consistent with the local first random number. If not, the process ends; if yes, then: Generate a pair of A2 private key and A2 public key by using the ElGamal algorithm; negotiate a first session key by using the A2 private key and the B2 public key, calculate a first check value of the first session key, encrypt a second random number, the A2 public key and the first check value by using the B1 public key to generate second ciphertext data, and send the second ciphertext data to the second client; The step S40 is specifically as follows: The first client obtains the input first signer and first signature coordinates, automatically matches the corresponding first signature information based on the first signer, adds the first signature information to the project contract based on the first signature coordinates to complete the first electronic signature of the project contract, encrypts the project contract after the first electronic signature using the RSA algorithm, and sends it to the second client; The step S50 is specifically as follows: The second client uses the RSA algorithm to decrypt the received project contract, obtains the input second signer and the second signature coordinates, automatically matches the corresponding second signature information based on the second signer, and adds the second signature information to the project contract based on the second signature coordinates to complete the second electronic signature of the project contract. The project contract after the second electronic signature is encrypted using the 3DES algorithm and then fed back to the server.
2. A blockchain-based project contract management method as claimed in claim 1, characterized in that: In step S10, the server presets several contract templates of project contracts, specifically: The server creates contract templates for several project contracts, sets the template name, template category and template style of each of the contract templates, and displays each of the contract templates in a list form.
3. A blockchain-based project contract management method as claimed in claim 1, characterized in that: In the step S10, the root private key is used to sign the A1 public key and the B1 public key; the root public key is used to verify the signature of the A work certificate and the B work certificate.
4. A project contract management method based on blockchain as claimed in claim 1, characterized in that: In the step S20, the first client and the second client are respectively a buyer's client and a seller's client or the first client and the second client are respectively a seller's client and a buyer's client.
5. A blockchain-based project contract management method as claimed in claim 1, characterized in that: The step S60 is specifically as follows: The server decrypts the received project contract using the 3DES algorithm, reads the plaintext data of the project contract, performs MAC calculation on the plaintext data to obtain a MAC value, and verifies whether the blockchain stores the MAC value. If so, the process ends; If not, an encryption key is generated based on the ElGamal algorithm, the project contract is encrypted using the encryption key, and stored in the IPFS system. The MAC value and the index address returned by the IPFS system are bound and backed up to the blockchain.
