CN115085934A - Contract management method based on block chain and combined key and related equipment - Google Patents
Contract management method based on block chain and combined key and related equipment Download PDFInfo
- Publication number
- CN115085934A CN115085934A CN202210668866.4A CN202210668866A CN115085934A CN 115085934 A CN115085934 A CN 115085934A CN 202210668866 A CN202210668866 A CN 202210668866A CN 115085934 A CN115085934 A CN 115085934A
- Authority
- CN
- China
- Prior art keywords
- contract
- combined
- hash value
- combination
- blockchain
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
- H04L9/3239—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
- H04L63/0442—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply asymmetric encryption, i.e. different keys for encryption and decryption
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本申请实施例属于区块链信息安全领域,涉及一种基于区块链和组合密钥的合同管理方法及相关设备,包括获取区块链上所有参与方,将参与方进行两两组合,得到组合结果,根据组合结果生成各组合对应的公私钥对,其中,公私钥对包括组合公钥和组合私钥,将组合私钥发送至各组合中对应的参与方;获取组合中参与方的标识信息,对标识信息进行哈希计算,得到组合哈希值,将组合哈希值和对应的公私钥对的组合公钥进行映射并存储至区块链;使用组合公钥,将组合中参与方对应的合同中的关键信息进行加密,得到加密合同;对加密合同进行哈希计算,得到合同哈希值,将加密合同及合同哈希值上传至区块链。本申请可以提高数据的安全性,避免暴露商业机密。
The embodiments of the present application belong to the field of blockchain information security, and relate to a contract management method and related equipment based on a blockchain and a combined key, including acquiring all participants on the blockchain, combining the participants in pairs, and obtaining Combining the result, generating a public-private key pair corresponding to each combination according to the combination result, wherein the public-private key pair includes a combined public key and a combined private key, and sending the combined private key to the corresponding participants in each combination; obtaining the identifiers of the participants in the combination information, hash the identification information to obtain a combined hash value, map the combined hash value and the combined public key of the corresponding public-private key pair and store it in the blockchain; The key information in the corresponding contract is encrypted to obtain the encrypted contract; the encrypted contract is hashed to obtain the contract hash value, and the encrypted contract and the contract hash value are uploaded to the blockchain. This application can improve the security of data and avoid exposing commercial secrets.
Description
技术领域technical field
本申请涉及区块链信息安全技术领域,尤其涉及一种基于区块链和组合密钥的合同管理方法及相关设备。The present application relates to the technical field of blockchain information security, and in particular, to a contract management method and related equipment based on a blockchain and a combined key.
背景技术Background technique
近些年,在国家大力发展普惠金融的背景下,伴随着数字技术的发展,数据资产成为评判中小微企业信贷发放的首选因素之一。供应链金融业务作为普惠金融的直接体现,得到了金融机构的重点关注。传统供应链金融受制于信息不对称、信用难以多层穿透、线下操作繁琐、贸易真实性难辨别等问题。利用区块链的去中心、防篡改、可溯源特性,结合物联网、AIoT等技术可提升刚性的信任能力,使得核心企业资信能够可靠、可信地在区块链上同步流转,有效盘活企业的应收账款,实现贸易全流程可信,从而解决中小企业融资难、融资贵的问题。In recent years, under the background of the country's vigorous development of inclusive finance, along with the development of digital technology, data assets have become one of the preferred factors for judging the credit issuance of small, medium and micro enterprises. As a direct embodiment of inclusive finance, supply chain finance business has attracted the attention of financial institutions. Traditional supply chain finance is subject to information asymmetry, difficulty in multi-layer penetration of credit, cumbersome offline operations, and difficulty in identifying trade authenticity. Using the decentralization, anti-tampering, and traceability features of the blockchain, combined with the Internet of Things, AIoT and other technologies can enhance the rigid trust ability, so that the core enterprise credit can be reliably and credibly circulated on the blockchain synchronously, effectively revitalizing the enterprise It can realize the credibility of the whole process of trade, so as to solve the problems of difficult and expensive financing for small and medium-sized enterprises.
然而,当前区块链、物联网、AIoT等技术的应用还不能解决所有的问题。在业务落地中,无论是核心企业还是其上下游的供应商、经销商,将核心商业数据上传区块链,仍然会有数据泄露的可能,造成企业隐私及商业数据泄露。However, the current application of technologies such as blockchain, Internet of Things, and AIoT cannot solve all problems. In the process of business landing, whether it is a core enterprise or its upstream and downstream suppliers and distributors, uploading core business data to the blockchain still has the possibility of data leakage, resulting in corporate privacy and business data leakage.
发明内容SUMMARY OF THE INVENTION
本申请实施例的目的在于提出一种基于区块链和组合密钥的合同管理方法及相关设备,以解决相关技术中将核心商业数据上传区块链,仍然会有数据泄露的可能,造成企业隐私及商业数据泄露的技术问题。The purpose of the embodiments of this application is to propose a contract management method and related equipment based on a blockchain and a combined key, so as to solve the problem of uploading core business data to the blockchain in the related art, there is still the possibility of data leakage, causing enterprise Technical aspects of privacy and commercial data breaches.
为了解决上述技术问题,本申请实施例提供一种基于区块链和组合密钥的合同管理方法,应用于合约端,采用了如下所述的技术方案:In order to solve the above technical problems, the embodiments of the present application provide a contract management method based on a blockchain and a combined key, which is applied to the contract side and adopts the following technical solutions:
获取区块链上所有参与方,将所述参与方进行两两组合,得到组合结果,根据所述组合结果生成各组合对应的公私钥对,其中,所述公私钥对包括组合公钥和组合私钥;Obtain all participants on the blockchain, combine the participants in pairs to obtain a combination result, and generate a public-private key pair corresponding to each combination according to the combination result, wherein the public-private key pair includes a combination public key and a combination private key;
将所述组合私钥发送至各所述组合中对应的参与方;sending the combination private key to the corresponding participants in each combination;
获取所述组合中参与方的标识信息,对所述标识信息进行哈希计算,得到组合哈希值;Obtain the identification information of the participants in the combination, perform hash calculation on the identification information, and obtain a combined hash value;
将所述组合哈希值和对应的所述公私钥对的组合公钥进行映射并存储至所述区块链;mapping the combined hash value and the combined public key of the corresponding public-private key pair to the blockchain;
使用所述组合公钥,将所述组合中参与方对应的合同中的关键信息进行加密,得到加密合同;Using the combination public key, encrypt the key information in the contract corresponding to the participants in the combination to obtain an encrypted contract;
对所述加密合同进行哈希计算,得到合同哈希值;Hash calculation is performed on the encrypted contract to obtain a contract hash value;
将所述加密合同及所述合同哈希值上传至所述区块链。Upload the encrypted contract and the contract hash to the blockchain.
进一步的,所述将所述组合哈希值和对应的所述公私钥对的组合公钥进行映射并存储至所述区块链的步骤包括:Further, the step of mapping the combined hash value and the corresponding combined public key of the public-private key pair to the blockchain includes:
将所述组合哈希值作为键名,所述组合公钥作为键值;Using the combined hash value as a key name and the combined public key as a key value;
以键值对形式将所述组合哈希值和对应的所述组合公钥存储到所述区块链。The combined hash value and the corresponding combined public key are stored in the blockchain in the form of a key-value pair.
为了解决上述技术问题,本申请实施例提供一种基于区块链和组合密钥的合同管理方法,应用于合同校验端,采用了如下所述的技术方案:In order to solve the above technical problems, the embodiments of the present application provide a contract management method based on a blockchain and a combined key, which is applied to the contract verification terminal and adopts the following technical solutions:
将合同获取请求发送至目标参与方对应的客户端;Send the contract acquisition request to the client corresponding to the target participant;
接收所述客户端发送的部分解密合同以及对应的目标组合哈希值,其中,部分解密合同为所述客户端将基于所述合同获取请求获得的目标加密合同进行解密得到的;receiving the partially decrypted contract and the corresponding target combined hash value sent by the client, wherein the partially decrypted contract is obtained by the client by decrypting the target encrypted contract obtained based on the contract acquisition request;
根据所述目标组合哈希值得到对应的目标组合公钥,使用所述目标组合公钥对部分解密合同重新加密,得到待校验合同;Obtain the corresponding target combination public key according to the target combination hash value, and use the target combination public key to re-encrypt part of the decrypted contract to obtain the contract to be verified;
对所述待校验合同进行哈希计算,得到待校验哈希值;Hash calculation is performed on the contract to be verified to obtain a hash value to be verified;
对所述待校验哈希值进行校验,得到校验结果。The hash value to be verified is verified to obtain a verification result.
进一步的,所述对所述待校验哈希值进行校验,得到校验结果的步骤包括:Further, the step of verifying the hash value to be verified to obtain a verification result includes:
从区块链上获取目标加密合同对应的目标合同哈希值;Obtain the target contract hash value corresponding to the target encrypted contract from the blockchain;
将所述待校验哈希值和所述目标合同哈希值进行比对,得到比对结果;Compare the hash value to be verified with the target contract hash value to obtain a comparison result;
若比对结果一致,则合同校验通过,否则,合同校验不通过。If the comparison results are consistent, the contract verification passes, otherwise, the contract verification fails.
为了解决上述技术问题,本申请实施例提供一种基于区块链和组合密钥的合同管理方法,应用于客户端,采用了如下所述的技术方案:In order to solve the above technical problems, the embodiments of the present application provide a contract management method based on a blockchain and a combined key, which is applied to the client and adopts the following technical solutions:
接收合同校验端发送的合同获取请求,根据所述合同获取请求从区块链上得到对应的目标加密合同;Receive the contract acquisition request sent by the contract verification terminal, and obtain the corresponding target encrypted contract from the blockchain according to the contract acquisition request;
调用目标参与方的组合私钥解密所述目标加密合同,得到部分解密合同;Decrypt the target encrypted contract by calling the combined private key of the target participant to obtain a partially decrypted contract;
根据所述部分解密合同中参与方的标识信息,得到目标组合哈希值;Obtain the target combination hash value according to the identification information of the participants in the partial decryption contract;
将所述部分解密合同和所述目标哈希值发送给所述合同校验端。Sending the partially decrypted contract and the target hash value to the contract verification terminal.
为了解决上述技术问题,本申请实施例还提供一种基于区块链和组合密钥的合同管理装置,应用于合约端,采用了如下所述的技术方案:In order to solve the above technical problems, the embodiments of the present application also provide a contract management device based on a blockchain and a combined key, which is applied to the contract side and adopts the following technical solutions:
组合模块,用于获取区块链上所有参与方,将所述参与方进行两两组合,得到组合结果,根据所述组合结果生成各组合对应的公私钥对,其中,所述公私钥对包括组合公钥和组合私钥;The combination module is used to obtain all the participants on the blockchain, combine the participants in pairs to obtain a combination result, and generate a public-private key pair corresponding to each combination according to the combination result, wherein the public-private key pair includes Combined public key and combined private key;
发送模块,用于将所述组合私钥发送至各所述组合中对应的参与方;a sending module, configured to send the combination private key to the corresponding participants in each combination;
第一计算模块,用于获取所述组合中参与方的标识信息,对所述标识信息进行哈希计算,得到组合哈希值;a first calculation module, configured to obtain the identification information of the participants in the combination, perform hash calculation on the identification information, and obtain a combined hash value;
映射模块,用于将所述组合哈希值和对应的所述公私钥对的组合公钥进行映射并存储至所述区块链;a mapping module, configured to map and store the combined hash value and the combined public key of the corresponding public-private key pair to the blockchain;
加密模块,用于使用所述组合公钥,将所述组合中参与方对应的合同中的关键信息进行加密,得到加密合同;an encryption module, configured to encrypt key information in the contract corresponding to the participants in the combination by using the combination public key to obtain an encrypted contract;
第二计算模块,用于对所述加密合同进行哈希计算,得到合同哈希值;a second computing module, configured to perform hash calculation on the encrypted contract to obtain a contract hash value;
上传模块,用于将所述加密合同及所述合同哈希值上传至所述区块链。An uploading module, configured to upload the encrypted contract and the contract hash value to the blockchain.
为了解决上述技术问题,本申请实施例还提供一种基于区块链和组合密钥的合同管理装置,应用于合同校验端,采用了如下所述的技术方案:In order to solve the above technical problems, the embodiments of the present application also provide a contract management device based on a blockchain and a combined key, which is applied to the contract verification terminal, and adopts the following technical solutions:
发送模块,用于将合同获取请求发送至目标参与方对应的客户端;The sending module is used to send the contract acquisition request to the client corresponding to the target participant;
接收模块,用于接收所述客户端发送的部分解密合同以及对应的目标组合哈希值,其中,部分解密合同为所述客户端将基于所述合同获取请求获得的目标加密合同进行解密得到的;A receiving module, configured to receive the partially decrypted contract and the corresponding target combined hash value sent by the client, wherein the partially decrypted contract is obtained by the client by decrypting the target encrypted contract obtained based on the contract acquisition request ;
加密模块,用于根据所述目标组合哈希值得到对应的目标组合公钥,使用所述目标组合公钥对部分解密合同重新加密,得到待校验合同;an encryption module, configured to obtain the corresponding target combination public key according to the target combination hash value, and use the target combination public key to re-encrypt part of the decrypted contract to obtain the contract to be verified;
第三计算模块,用于对所述待校验合同进行哈希计算,得到待校验哈希值;a third calculation module, configured to perform hash calculation on the contract to be verified to obtain a hash value to be verified;
校验模块,用于对所述待校验哈希值进行校验,得到校验结果。A verification module, configured to verify the hash value to be verified to obtain a verification result.
为了解决上述技术问题,本申请实施例还提供一种基于区块链和组合密钥的合同管理装置,应用于客户端,采用了如下所述的技术方案:In order to solve the above technical problems, the embodiments of the present application also provide a contract management device based on a blockchain and a combined key, which is applied to the client and adopts the following technical solutions:
获取模块,用于接收合同校验端发送的合同获取请求,根据所述合同获取请求从区块链上得到对应的目标加密合同;an acquisition module, configured to receive the contract acquisition request sent by the contract verification terminal, and obtain the corresponding target encrypted contract from the blockchain according to the contract acquisition request;
解密模块,用于使用目标参与方的组合私钥解密所述目标加密合同,得到部分解密合同;a decryption module for decrypting the target encrypted contract using the combined private key of the target participant to obtain a partial decryption contract;
第四计算模块,用于根据所述部分解密合同中参与方的标识信息,得到目标组合哈希值;a fourth calculation module, used for obtaining the target combination hash value according to the identification information of the participants in the partial decryption contract;
发送模块,用于将所述部分解密合同和所述目标哈希值发送给所述合同校验端。A sending module, configured to send the partially decrypted contract and the target hash value to the contract verification terminal.
为了解决上述技术问题,本申请实施例还提供一种计算机设备,采用了如下所述的技术方案:In order to solve the above-mentioned technical problems, the embodiment of the present application also provides a computer device, which adopts the following technical solutions:
该计算机设备包括包括合约端、合同校验端和客户端,所述合约端包括第一存储器和第一处理器,所述第一存储器中存储有计算机可读指令,所述第一处理器执行所述计算机可读指令时实现如上所述的基于区块链和组合密钥的合同管理方法的步骤;所述合同校验端包括第二存储器和第二处理器,所述第二存储器中存储有计算机可读指令,所述第二处理器执行所述计算机可读指令时实现如上所述的基于区块链和组合密钥的合同管理方法的步骤;所述客户端包括第三存储器和第三处理器,所述第三存储器中存储有计算机可读指令,所述第三处理器执行所述计算机可读指令时实现如上所述的基于区块链和组合密钥的合同管理方法的步骤。The computer equipment includes a contract terminal, a contract verification terminal and a client terminal, the contract terminal includes a first memory and a first processor, the first memory stores computer-readable instructions, and the first processor executes The computer-readable instructions implement the steps of the above-mentioned contract management method based on block chain and combined key; the contract verification terminal includes a second memory and a second processor, and the second memory stores There are computer-readable instructions, and when the second processor executes the computer-readable instructions, the steps of the above-mentioned contract management method based on block chain and combined key are realized; the client includes a third memory and a third memory; Three processors, the third memory stores computer-readable instructions, and when the third processor executes the computer-readable instructions, implements the steps of the above-mentioned contract management method based on blockchain and combined keys .
为了解决上述技术问题,本申请实施例还提供一种计算机可读存储介质,采用了如下所述的技术方案:In order to solve the above technical problems, the embodiments of the present application also provide a computer-readable storage medium, which adopts the following technical solutions:
所述计算机可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如上所述的基于区块链和组合密钥的合同管理方法的步骤。The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, implements the steps of the above-mentioned blockchain and combined key-based contract management method.
与现有技术相比,本申请实施例主要有以下有益效果:Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects:
本申请通过获取区块链上所有参与方,将参与方进行两两组合,得到组合结果,根据组合结果生成各组合对应的公私钥对,其中,公私钥对包括组合公钥和组合私钥,将组合私钥发送至各组合中对应的参与方,通过将区块链上的所有参与方进行两两组合,并生成组合对应的公私钥,参与方至储存与自己相关的私钥,用于解密与自己相关的信息,可以保护另一方的隐私;获取组合中参与方的标识信息,对标识信息进行哈希计算,得到组合哈希值,将组合哈希值和对应的公私钥对的组合公钥进行映射并存储至区块链,可以通过组合哈希值获得组合公钥,避免暴露过多的参与方信息,保证信息安全;使用组合公钥,将组合中参与方对应的合同中的关键信息进行加密,得到加密合同,将关键信息进行加密,可以提高数据的安全性,避免暴露商业机密;对加密合同进行哈希计算,得到合同哈希值,将加密合同及合同哈希值上传至区块链,通过合同哈希值进行合同校验,保证合同内容真实可信无篡改。This application obtains all the participants on the blockchain, combines the participants in pairs to obtain a combination result, and generates a public-private key pair corresponding to each combination according to the combination result, wherein the public-private key pair includes a combined public key and a combined private key, Send the combined private key to the corresponding participants in each combination. By combining all the participants on the blockchain in pairs, and generating the public and private keys corresponding to the combination, the participants store their own private keys for use. Decrypting the information related to oneself can protect the privacy of the other party; obtain the identification information of the participants in the combination, perform hash calculation on the identification information, obtain the combined hash value, and combine the combined hash value and the corresponding public-private key pair. The public key is mapped and stored in the blockchain, and the combined public key can be obtained by combining the hash value, so as to avoid exposing too much information of the participants and ensure information security; using the combined public key, the combined public key in the contract corresponding to the participants in the combination can be saved. Encrypting key information to obtain an encrypted contract, and encrypting key information can improve data security and avoid exposing commercial secrets; perform hash calculation on the encrypted contract to obtain the contract hash value, and upload the encrypted contract and contract hash value. To the blockchain, the contract is verified by the contract hash value to ensure that the contract content is authentic and credible without tampering.
附图说明Description of drawings
为了更清楚地说明本申请中的方案,下面将对本申请实施例描述中所需要使用的附图作一个简单介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the solutions in the present application more clearly, the following will briefly introduce the accompanying drawings used in the description of the embodiments of the present application. For those of ordinary skill, other drawings can also be obtained from these drawings without any creative effort.
图1是本申请可以应用于其中的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram to which the present application can be applied;
图2是根据本申请的基于区块链和组合密钥的合同管理方法的一个实施例的流程图;FIG. 2 is a flowchart of one embodiment of a contract management method based on blockchain and combined keys according to the present application;
图3是根据本申请的基于区块链和组合密钥的合同管理装置的一个实施例的结构示意图;3 is a schematic structural diagram of an embodiment of a contract management device based on a blockchain and a combined key according to the present application;
图4是根据本申请的基于区块链和组合密钥的合同管理装置的第二个实施例的结构示意图;4 is a schematic structural diagram of a second embodiment of a contract management device based on a blockchain and a combined key according to the present application;
图5是根据本申请的基于区块链和组合密钥的合同管理装置的第三个实施例的结构示意图;5 is a schematic structural diagram of a third embodiment of a contract management device based on a blockchain and a combined key according to the present application;
图6是根据本申请的计算机设备的一个实施例的结构示意图。FIG. 6 is a schematic structural diagram of an embodiment of a computer device according to the present application.
具体实施方式Detailed ways
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同;本文中在申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请;本申请的说明书和权利要求书及上述附图说明中的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。本申请的说明书和权利要求书或上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field of this application; the terms used herein in the specification of the application are for the purpose of describing specific embodiments only It is not intended to limit the application; the terms "comprising" and "having" and any variations thereof in the description and claims of this application and the above description of the drawings are intended to cover non-exclusive inclusion. The terms "first", "second" and the like in the description and claims of the present application or the above drawings are used to distinguish different objects, rather than to describe a specific order.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor a separate or alternative embodiment that is mutually exclusive of other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
为了使本技术领域的人员更好地理解本申请方案,下面将结合附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to make those skilled in the art better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings.
本申请提供了一种基于区块链和组合密钥的合同管理方法,可以应用于如图1所示的系统架构100中,系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。This application provides a contract management method based on blockchain and combined keys, which can be applied to the
用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种通讯客户端应用,例如网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。The user can use the
终端设备101、102、103可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、电子书阅读器、MP3播放器(Moving Picture ExpertsGroup Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving PictureExperts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、膝上型便携计算机和台式计算机等等。The
服务器105可以是提供各种服务的服务器,例如对终端设备101、102、103上显示的页面提供支持的后台服务器。The
需要说明的是,本申请实施例所提供的基于区块链和组合密钥的合同管理方法一般由服务器/终端设备执行,相应地,基于区块链和组合密钥的合同管理装置一般设置于服务器/终端设备中。It should be noted that the contract management method based on the blockchain and the combined key provided by the embodiments of the present application is generally executed by the server/terminal device. Correspondingly, the contract management device based on the blockchain and the combined key is generally set in the server/terminal device.
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in FIG. 1 are merely illustrative. There can be any number of terminal devices, networks and servers according to implementation needs.
继续参考图2,示出了根据本申请的基于区块链和组合密钥的合同管理方法的一个实施例的流程图,包括以下步骤:Continuing to refer to FIG. 2 , there is shown a flow chart of an embodiment of a contract management method based on blockchain and combined keys according to the present application, including the following steps:
步骤S201,获取区块链上所有参与方,将参与方进行两两组合,得到组合结果,根据组合结果生成各组合对应的公私钥对,其中,公私钥对包括组合公钥和组合私钥。Step S201: Obtain all participants on the blockchain, combine the participants in pairs to obtain a combination result, and generate a public-private key pair corresponding to each combination according to the combination result, wherein the public-private key pair includes a combined public key and a combined private key.
在本实施例中,各参与方加入区块链网络,合约端根据上链的参与方信息,调用智能合约根据两两组合的可能性生成与组合数量对应的公私钥对,其中,参与方可以为各个企业,则参与方信息包括企业名称、企业地址、企业类型、企业经营方式和经营范围等;公私钥对可以为非对称加密的公私钥对。In this embodiment, each participant joins the blockchain network, and the contract terminal invokes the smart contract to generate a public-private key pair corresponding to the number of combinations according to the possibility of a pairwise combination according to the participant information on the chain. For each enterprise, the participant information includes enterprise name, enterprise address, enterprise type, enterprise operation mode and business scope, etc. The public-private key pair can be asymmetrically encrypted public-private key pair.
其中,智能合约是写在区块链上的代码,是一种无需中介、自我验证、自动执行合约条款的计算机交易协议,当触发合约中的条款,可以由程序自动执行。区块链上的智能合约具有去中心化、去信任、可编程、不可篡改等特性,可以灵活嵌入各种数据和资产,帮助实现安全高效地信息交换、价值转移和资产管理。Among them, a smart contract is a code written on the blockchain. It is a computer transaction agreement that does not require intermediaries, self-verifies, and automatically executes contract terms. When the terms in the contract are triggered, the program can automatically execute them. Smart contracts on the blockchain have the characteristics of decentralization, trustlessness, programmability, and immutability, and can flexibly embed various data and assets to help achieve safe and efficient information exchange, value transfer, and asset management.
举例说明,假设区块链上有三个参与方A、B和C,可能的两两组合情况为AB、AC和BC,调用智能合约生成三对公私钥对,分别与组合AB、AC和BC相对应,其中,公私钥对包括组合公钥和组合私钥,私钥在参与方对应的客户端本地进行存储,公钥保存在区块链上。For example, suppose there are three parties A, B, and C on the blockchain, and the possible pairwise combinations are AB, AC, and BC. Call the smart contract to generate three pairs of public and private keys, which are respectively related to the combinations AB, AC, and BC. Correspondingly, the public-private key pair includes a combined public key and a combined private key, the private key is stored locally on the client corresponding to the participant, and the public key is stored on the blockchain.
步骤S202,将组合私钥发送至各组合中对应的参与方。Step S202, sending the combined private key to the corresponding participants in each combination.
每个组合都有与其对应的公私钥对,将某一组合对应的公私钥对的组合私钥分别发送至组合中参与方双方对应的客户端,在本地存储,这样,每个参与方只存储与其相关的组合私钥。Each combination has its corresponding public-private key pair, and the combined private key of the public-private key pair corresponding to a certain combination is sent to the clients corresponding to both parties in the combination and stored locally. In this way, each participant only stores The combined private key associated with it.
举例说明,组合AB的公私钥对为第一公钥和第一私钥,组合AC的公私钥对为第二公钥和第二私钥,组合BC的公私钥对为第三公钥和第三私钥,将第一私钥分别发送至参与方A和参与方B,将第二私钥分别发送至参与方A和参与方C,将第三私钥分别发送至参与方B和参与方C。这样,参与方A只存储与参与方A相关的私钥,即AB(第一私钥在参与方A的存储方式)、AC(第二私钥在参与方A的存储方式),无法获取BC的私钥;同理,参与方B只存储与参与方B相关的私钥,即存储BA(第一私钥在参与方B的存储方式)、BC(第三私钥在参与方B的存储方式),无法获取AC的私钥;参与方C只存储与参与方C相关的私钥,即CA(第二私钥在参与方C的存储方式)、CB(第三私钥在参与方C的存储方式),无法获取AB的私钥。这种方式可以保障组合中另一方的隐私。For example, the public-private key pair of the combination AB is the first public key and the first private key, the public-private key pair of the combination AC is the second public key and the second private key, and the public-private key pair of the combination BC is the third public key and the first private key. Three private keys, send the first private key to Participant A and Participant B respectively, send the second private key to Participant A and Participant C respectively, send the third private key to Participant B and Participant respectively C. In this way, Participant A only stores the private key related to Participant A, namely AB (the storage method of the first private key in Participant A), AC (the storage method of the second private key in Participant A), and cannot obtain BC Similarly, Participant B only stores the private key related to Participant B, that is, BA (the storage method of the first private key in Participant B), BC (the storage of the third private key in Participant B) method), the private key of AC cannot be obtained; Participant C only stores the private key related to Participant C, namely CA (the storage method of the second private key in Participant C), CB (the third private key in Participant C) storage method), the private key of AB cannot be obtained. This approach preserves the privacy of the other party in the portfolio.
步骤S203,获取组合中参与方的标识信息,对标识信息进行哈希计算,得到组合哈希值。Step S203: Obtain the identification information of the participants in the combination, perform hash calculation on the identification information, and obtain a combined hash value.
在本实施例中,获取参与方双方的标识信息,将双方的标识信息进行组合,采用哈希算法对组合标识信息进行哈希计算,得到组合哈希值。其中,标识信息可以作为参与方的唯一识别标识,可以是名称,也可以是组织机构代码,在此不做限定。In this embodiment, the identification information of both parties is acquired, the identification information of both parties is combined, and a hash algorithm is used to perform a hash calculation on the combined identification information to obtain a combined hash value. The identification information can be used as the unique identification of the participant, which can be a name or an organization code, which is not limited here.
哈希算法(Hash Algorithms)也称为散列算法、杂凑算法或数字指纹,是可以将任意长度的消息压缩为一个固定长度的消息的算法,常用的哈希算法包括MD系列算法和SHA系列算法。Hash algorithm (Hash Algorithms), also known as hash algorithm, hash algorithm or digital fingerprint, is an algorithm that can compress messages of any length into a fixed-length message. Commonly used hash algorithms include MD series algorithms and SHA series algorithms. .
哈希算法的数学表达式如下:The mathematical expression of the hash algorithm is as follows:
h=Hash(m)h=Hash(m)
式中,h为固定长度的输出值;m为任意长度的输入值。任意输入值(Message)的二进制编码经过哈希算法计算后,可以得出n比特的一个0、1字符串的哈希值,在不同哈希算法中n的取值可能不同,例如128、160、192、256、384或512等。In the formula, h is the output value of fixed length; m is the input value of arbitrary length. After the binary code of any input value (Message) is calculated by the hash algorithm, the hash value of a 0, 1 string of n bits can be obtained. The value of n may be different in different hash algorithms, such as 128, 160 , 192, 256, 384 or 512 etc.
如果输入的初始值为文本,需要将文本转化为字符串之后,再进行哈希计算。具体的,标识信息为参与方名称,使用正则匹配算法将参与方名称生成字母数组,将字母数组重新组成一个字符串作为哈希算法的输入值;例如,假设参与方A的名称为A,参与方B的名称为B,将双方名称组合变成字符串“AB”,再对“AB”进行哈希计算,得到组合哈希值。If the initial value of the input is text, you need to convert the text into a string before performing the hash calculation. Specifically, the identification information is the name of the participant, a regular matching algorithm is used to generate an alphabetic array of the participant's name, and the alphabetic array is reconstituted into a string as the input value of the hashing algorithm; The name of party B is B, and the names of both parties are combined into the string "AB", and then "AB" is hashed to obtain the combined hash value.
步骤S204,将组合哈希值和对应的公私钥对的组合公钥进行映射并存储至区块链。Step S204, the combined hash value and the combined public key of the corresponding public-private key pair are mapped and stored in the blockchain.
在本实施例中,将组合哈希值和组合对应的公私钥对的组合公钥通过键值对形式进行映射,具体的,将组合哈希值作为键名key,组合公钥作为键值value,以键值对形式(key:value)将组合哈希值和组合公钥存储到区块链上,即区块链上组合哈希值和和组合公钥是一一对应的。在区块链上的保存状态为Hash(a+b),即参与方A和参与方B的组合公钥。In this embodiment, the combined hash value and the combined public key of the public-private key pair corresponding to the combination are mapped in the form of key-value pairs. Specifically, the combined hash value is used as the key name key, and the combined public key is used as the key value value , store the combined hash value and combined public key on the blockchain in the form of a key-value pair (key:value), that is, the combined hash value and combined public key on the blockchain are in one-to-one correspondence. The saved state on the blockchain is Hash(a+b), which is the combined public key of participant A and participant B.
通过映射存储,可以根据组合哈希值更快地获得对应的组合公钥。By mapping storage, the corresponding combined public key can be obtained faster according to the combined hash value.
步骤S205,使用组合公钥,将组合中参与方对应的合同中的关键信息进行加密,得到加密合同。Step S205, using the combination public key, encrypt the key information in the contract corresponding to the participants in the combination to obtain an encrypted contract.
在本实施例中,将合同中涉及组合参与方双方的关键信息,使用组合公钥加密变成密文,然后替换掉原合同中对应的明文,使得合同成为正常文字+密文组合形式的加密合同。In this embodiment, the key information in the contract involving both parties involved in the combination is encrypted with the combined public key and turned into ciphertext, and then the corresponding plaintext in the original contract is replaced, so that the contract is encrypted in the form of a combination of normal text and ciphertext contract.
其中,关键信息包括但不限于参与方名称、合约内容等,将这些信息进行加密,避免泄露参与方隐私,提高信息安全性。Among them, the key information includes but is not limited to the names of the participants, contract content, etc. These information are encrypted to avoid leaking the privacy of the participants and improve information security.
步骤S206,对加密合同进行哈希计算,得到合同哈希值。Step S206, perform hash calculation on the encrypted contract to obtain a contract hash value.
在本实施例中,采用哈希算法对加密合同进行哈希计算,哈希算法同步骤S203所述。In this embodiment, a hash algorithm is used to perform hash calculation on the encrypted contract, and the hash algorithm is the same as that described in step S203.
合同哈希值用于校验合同,可以保证合同内容真实可信无篡改。The contract hash value is used to verify the contract, which can ensure the authenticity of the contract content without tampering.
步骤S207,将加密合同及合同哈希值上传至区块链。Step S207, upload the encrypted contract and the contract hash value to the blockchain.
在本实施例中,将加密后的合同上传至区块链,且解密密钥只有合同涉及双方才持有,可以保证双方之外的第三方无法解密合同,保障信息的安全性。In this embodiment, the encrypted contract is uploaded to the blockchain, and the decryption key is only held by both parties involved in the contract, which can ensure that a third party other than the two parties cannot decrypt the contract and ensure the security of information.
需要强调的是,为进一步保证加密合同及合同哈希值的私密和安全性,上述加密合同及合同哈希值还可以存储于一区块链的节点中。It should be emphasized that, in order to further ensure the privacy and security of the encrypted contract and contract hash value, the above encrypted contract and contract hash value can also be stored in a node of a blockchain.
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
在本实施例中,合同校验端需要校验合同,则将合同获取请求发送至目标参与方对应的客户端,合同校验端可以为金融机构,目标参与方通过客户端接收到合同获取请求,其中,合同获取请求包括合同涉及的参与方信息、合同标识等,根据合同获取请求中的合同标识从区块链上拉取对应的目标加密合同,调用目标参与方存在本地的组合私钥对目标加密合同进行解密,应当理解,只解密与目标参与方相关的信息,得到的是部分解密合同,获取部分解密合同中的参与方标识信息,对参与方标识信息进行哈希计算,得到目标组合哈希值。In this embodiment, if the contract verification terminal needs to verify the contract, it sends the contract acquisition request to the client corresponding to the target participant. The contract verification terminal may be a financial institution, and the target participant receives the contract acquisition request through the client terminal. , where the contract acquisition request includes the information of the parties involved in the contract, the contract identifier, etc., and the corresponding target encrypted contract is pulled from the blockchain according to the contract identifier in the contract acquisition request, and the target participant is called to have a local combined private key pair When decrypting the target encrypted contract, it should be understood that only the information related to the target participant is decrypted, and the partially decrypted contract is obtained. hash value.
在本实施例中,在客户端进行解密,进一步保障信息的安全性。In this embodiment, decryption is performed at the client to further ensure the security of information.
客户端将部分解密合同和目标组合哈希值发送至合同校验端,合同校验端接收到部分解密合同,可以查看到合同内容。The client sends the partially decrypted contract and the target combined hash value to the contract verification terminal, and the contract verification terminal receives the partially decrypted contract and can view the contract content.
在本实施例中,组合哈希值和组合公钥是对应存储的,合同校验端根据目标组合哈希值从区块链中可以得到对应的目标组合公钥,使用目标组合公钥对部分解密合同重新加密,得到待校验合同,并对待校验合同进行哈希计算,得到待校验哈希值,对待校验哈希值进行校验,得到校验结果,校验结果包括合同校验通过和合同校验未通过。In this embodiment, the combined hash value and the combined public key are stored correspondingly, and the contract verification end can obtain the corresponding target combined public key from the blockchain according to the target combined hash value, and use the target combined public key to pair part of the Decrypt the contract and re-encrypt it to obtain the contract to be verified, perform hash calculation on the contract to be verified, obtain the hash value to be verified, verify the hash value to be verified, and obtain the verification result, which includes the contract verification result. The verification passed and the contract verification failed.
本实施例通过解密的合同重新加密并进行哈希计算,根据得到的哈希值进行校验,可以提高校验效率以及校验准确度。In this embodiment, the decrypted contract is re-encrypted and hash calculation is performed, and verification is performed according to the obtained hash value, which can improve verification efficiency and verification accuracy.
在本实施例中,上述对待校验哈希值进行校验,得到校验结果的步骤包括:In this embodiment, the above-mentioned steps of verifying the hash value to be verified and obtaining the verification result include:
从区块链上获取目标加密合同对应的目标合同哈希值;Obtain the target contract hash value corresponding to the target encrypted contract from the blockchain;
将待校验哈希值和所述目标合同哈希值进行比对,得到比对结果;Compare the hash value to be verified with the hash value of the target contract to obtain a comparison result;
若比对结果一致,则合同校验通过,否则,合同校验不通过。If the comparison results are consistent, the contract verification passes, otherwise, the contract verification fails.
在本实施例中,比对结果一致,合同校验通过,说明合同为真,未经过篡改,如果不一致则说明合同是伪造的,存在篡改,该合同不能作为证明。In this embodiment, if the comparison results are consistent and the contract verification is passed, it means that the contract is true and has not been tampered with.
本申请通过将区块链上的所有参与方进行两两组合,并生成组合对应的公私钥,参与方至储存与自己相关的私钥,用于解密与自己相关的信息,可以保护另一方的隐私;将组合哈希值和对应的公私钥对的组合公钥进行映射并存储至区块链,可以通过组合哈希值获得组合公钥,避免暴露过多的参与方信息,保证信息安全;将关键信息进行加密,可以提高数据的安全性,避免暴露商业机密;此外,通过合同哈希值进行合同校验,保证合同内容真实可信无篡改。In this application, all participants on the blockchain are combined in pairs, and the public and private keys corresponding to the combination are generated, and the participants can store their own private keys for decrypting their own information. Privacy; map the combined hash value and the combined public key of the corresponding public-private key pair to the blockchain, and obtain the combined public key by combining the hash value, avoiding exposing too much participant information and ensuring information security; Encrypting key information can improve data security and avoid exposing commercial secrets; in addition, contract verification is performed through the contract hash value to ensure that the contract content is authentic and credible without tampering.
本申请可用于众多通用或专用的计算机系统环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The present application may be used in numerous general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, including A distributed computing environment for any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,该计算机可读指令可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. , when the program is executed, it may include the processes of the foregoing method embodiments. The aforementioned storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowchart of the accompanying drawings are sequentially shown in the order indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order and may be performed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, and the execution sequence is also It does not have to be performed sequentially, but may be performed alternately or alternately with other steps or at least a portion of sub-steps or stages of other steps.
进一步参考图3,作为对上述图2所示方法的实现,本申请提供了一种应用于合约端的基于区块链和组合密钥的合同管理装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。With further reference to FIG. 3 , as an implementation of the method shown in FIG. 2 above, the present application provides an embodiment of a contract management device based on blockchain and combined keys applied to a contract end. The embodiment of the device is the same as that shown in FIG. 2 . Corresponding to the method embodiments shown, the apparatus can be specifically applied to various electronic devices.
如图3所示,本实施例所述的基于区块链和组合密钥的合同管理装置300包括:组合模块301、发送模块302、第一计算模块303、映射模块304、加密模块305、第二计算模块306和上传模块307。其中:As shown in FIG. 3 , the
组合模块301用于获取区块链上所有参与方,将所述参与方进行两两组合,得到组合结果,根据所述组合结果生成各组合对应的公私钥对,其中,所述公私钥对包括组合公钥和组合私钥;The
发送模块302用于将所述组合私钥发送至各所述组合中对应的参与方;The sending
第一计算模块303用于获取所述组合中参与方的标识信息,对所述标识信息进行哈希计算,得到组合哈希值;The
映射模块304用于将所述组合哈希值和对应的所述公私钥对的组合公钥进行映射并存储至所述区块链;The
加密模块305用于使用所述组合公钥,将所述组合中参与方对应的合同中的关键信息进行加密,得到加密合同;The
第二计算模块306用于对所述加密合同进行哈希计算,得到合同哈希值;The
上传模块307用于将所述加密合同及所述合同哈希值上传至所述区块链。The
基于上述基于区块链和组合密钥的合同管理装置,通过将区块链上的所有参与方进行两两组合,并生成组合对应的公私钥,参与方至储存与自己相关的私钥,用于解密与自己相关的信息,可以保护另一方的隐私;将组合哈希值和对应的公私钥对的组合公钥进行映射并存储至区块链,可以通过组合哈希值获得组合公钥,避免暴露过多的参与方信息,保证信息安全;将关键信息进行加密,可以提高数据的安全性,避免暴露商业机密;此外,通过合同哈希值进行合同校验,保证合同内容真实可信无篡改。Based on the above-mentioned contract management device based on blockchain and combined key, by combining all participants on the blockchain in pairs, and generating the public and private keys corresponding to the combination, the participants store their own private keys and use To decrypt the information related to oneself, it can protect the privacy of the other party; the combined hash value and the combined public key of the corresponding public-private key pair are mapped and stored in the blockchain, and the combined public key can be obtained by combining the hash value, Avoid exposing too much participant information to ensure information security; encrypting key information can improve data security and avoid exposing commercial secrets; in addition, contract verification is performed through the contract hash value to ensure the authenticity of the contract content. tamper.
在本实施例的一些可选的实现方式中,映射模块304进一步用于:将所述组合哈希值作为键名,所述组合公钥作为键值;以键值对形式将所述组合哈希值和对应的所述组合公钥存储到所述区块链。In some optional implementations of this embodiment, the
参阅图4,本申请提供了一种应用于合同校验端的基于区块链和组合密钥的合同管理装置的另一个实施例,本实施例所述的基于区块链和组合密钥的合同管理装置400包括:发送模块401、接收模块402、加密模块403、第三计算模块404和校验模块405。其中:Referring to FIG. 4 , the present application provides another embodiment of a contract management device based on blockchain and combined key applied to a contract verification end. The contract based on blockchain and combined key described in this embodiment The
发送模块401用于将合同获取请求发送至目标参与方对应的客户端;The sending
接收模块402用于接收所述客户端发送的部分解密合同以及对应的目标组合哈希值,其中,部分解密合同为所述客户端将基于所述合同获取请求获得的目标加密合同进行解密得到的;The receiving
加密模块403用于根据所述目标组合哈希值得到对应的目标组合公钥,使用所述目标组合公钥对部分解密合同重新加密,得到待校验合同;The
第三计算模块404用于对所述待校验合同进行哈希计算,得到待校验哈希值;The
校验模块405用于对所述待校验哈希值进行校验,得到校验结果。The
在本实施例中,校验模块405进一步用于:In this embodiment, the
从区块链上获取目标加密合同对应的目标合同哈希值;Obtain the target contract hash value corresponding to the target encrypted contract from the blockchain;
将所述待校验哈希值和所述目标合同哈希值进行比对,得到比对结果;Compare the hash value to be verified with the target contract hash value to obtain a comparison result;
若比对结果一致,则合同校验通过,否则,合同校验不通过。If the comparison results are consistent, the contract verification passes, otherwise, the contract verification fails.
本实施例通过解密的合同重新加密并进行哈希计算,根据得到的哈希值进行校验,可以提高校验效率以及校验准确度。In this embodiment, the decrypted contract is re-encrypted and hash calculation is performed, and verification is performed according to the obtained hash value, which can improve verification efficiency and verification accuracy.
如图5所示,本实施例所述的基于区块链和组合密钥的合同管理装置500应用于客户端,包括:获取模块501、解密模块502、第四计算模块503和发送模块504。其中:As shown in FIG. 5 , the
获取模块,用于接收合同校验端发送的合同获取请求,根据所述合同获取请求从区块链上得到对应的目标加密合同;an acquisition module, configured to receive the contract acquisition request sent by the contract verification terminal, and obtain the corresponding target encrypted contract from the blockchain according to the contract acquisition request;
解密模块,用于使用目标参与方的组合私钥解密所述目标加密合同,得到部分解密合同;a decryption module for decrypting the target encrypted contract using the combined private key of the target participant to obtain a partial decryption contract;
第四计算模块,用于根据所述部分解密合同中参与方的标识信息,得到目标组合哈希值;a fourth calculation module, used for obtaining the target combination hash value according to the identification information of the participants in the partial decryption contract;
发送模块,用于将所述部分解密合同和所述目标哈希值发送给所述合同校验端。A sending module, configured to send the partially decrypted contract and the target hash value to the contract verification terminal.
在本实施例中,在客户端进行解密,进一步保障信息的安全性。In this embodiment, decryption is performed at the client to further ensure the security of information.
为解决上述技术问题,本申请实施例还提供计算机设备。具体请参阅图6,图6为本实施例计算机设备基本结构框图。To solve the above technical problems, the embodiments of the present application also provide computer equipment. Please refer to FIG. 6 for details. FIG. 6 is a block diagram of the basic structure of a computer device according to this embodiment.
所述计算机设备6包括合约端61、合同校验端62和客户端63,合约端61包括第一存储器611和第一处理器612,合同校验端62包括第二存储器621和第二处理器622,客户端63包括第三存储器631和第三处理器632,通过系统总线相互通信连接第一存储器611、第一处理器612、第一网络接口613,通过系统总线相互通信连接第二存储器621、第二处理器622、第二网络接口623,通过系统总线相互通信连接第三存储器631、第二处理器632、第三网络接口633。需要指出的是,图中仅示出了具有组件61-63的计算机设备6,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。其中,本技术领域技术人员可以理解,这里的计算机设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(ApplicationSpecific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable GateArray,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。The computer device 6 includes a
所述计算机设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述计算机设备可以与用户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互。The computer equipment may be a desktop computer, a notebook computer, a palmtop computer, a cloud server and other computing equipment. The computer device can perform human-computer interaction with the user through a keyboard, a mouse, a remote control, a touch pad or a voice control device.
所述第一存储器611、所述第二存储器621和所述第三存储器631都至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述第一存储器611、所述第二存储器621和所述第三存储器631可以是所述计算机设备6的内部存储单元,例如该计算机设备6的硬盘或内存。在另一些实施例中,所述第一存储器611、所述第二存储器621和所述第三存储器631也可以是所述计算机设备6的外部存储设备,例如该计算机设备6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述第一存储器611、所述第二存储器621和所述第三存储器631还可以既包括所述计算机设备6的内部存储单元也包括其外部存储设备。本实施例中,所述第一存储器611、所述第二存储器621和所述第三存储器631通常用于存储安装于所述计算机设备6的操作系统和各类应用软件,例如基于区块链和组合密钥的合同管理方法的计算机可读指令等。此外,所述第一存储器611、所述第二存储器621和所述第三存储器631还可以用于暂时地存储已经输出或者将要输出的各类数据。The
所述第一处理器612、第二处理器622和第三处理器632在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。第一处理器612、第二处理器622和第三处理器632通常用于控制所述计算机设备6的总体操作。本实施例中,所述第一处理器612、第二处理器622和第三处理器632用于运行对应的所述第一存储器611、所述第二存储器621和所述第三存储器631中存储的计算机可读指令或者处理数据,例如运行所述基于区块链和组合密钥的合同管理方法的计算机可读指令。The
所述第一网络接口613、所述第二网络接口623和所述第三网络接口633可包括无线网络接口或有线网络接口,第一网络接口613、所述第二网络接口623和所述第三网络接口633通常用于在所述计算机设备6与其他电子设备之间建立通信连接。The
本实施例通过处理器执行存储在存储器的计算机可读指令时实现如上述实施例基于区块链和组合密钥的合同管理方法的步骤,通过将区块链上的所有参与方进行两两组合,并生成组合对应的公私钥,参与方至储存与自己相关的私钥,用于解密与自己相关的信息,可以保护另一方的隐私;将组合哈希值和对应的公私钥对的组合公钥进行映射并存储至区块链,可以通过组合哈希值获得组合公钥,避免暴露过多的参与方信息,保证信息安全;将关键信息进行加密,可以提高数据的安全性,避免暴露商业机密;此外,通过合同哈希值进行合同校验,保证合同内容真实可信无篡改。In this embodiment, when the processor executes the computer-readable instructions stored in the memory, the steps of the contract management method based on the blockchain and the combined key are implemented as in the above-mentioned embodiment, by combining all the participants on the blockchain in pairs , and generate the public and private keys corresponding to the combination, and the participants store the private key related to themselves, which is used to decrypt the information related to themselves, which can protect the privacy of the other party; The key is mapped and stored in the blockchain, and the combined public key can be obtained by combining the hash value, so as to avoid exposing too much participant information and ensure information security; encrypting key information can improve data security and avoid exposing commercial Confidentiality; in addition, contract verification is performed through the contract hash value to ensure that the contract content is authentic and credible without tampering.
本申请还提供了另一种实施方式,即提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令可被至少一个处理器执行,以使所述至少一个处理器执行如上述的基于区块链和组合密钥的合同管理方法的步骤,通过将区块链上的所有参与方进行两两组合,并生成组合对应的公私钥,参与方至储存与自己相关的私钥,用于解密与自己相关的信息,可以保护另一方的隐私;将组合哈希值和对应的公私钥对的组合公钥进行映射并存储至区块链,可以通过组合哈希值获得组合公钥,避免暴露过多的参与方信息,保证信息安全;将关键信息进行加密,可以提高数据的安全性,避免暴露商业机密;此外,通过合同哈希值进行合同校验,保证合同内容真实可信无篡改。The present application also provides another embodiment, that is, to provide a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to Make the at least one processor execute the steps of the above-mentioned contract management method based on the blockchain and the combined key, by combining all the participants on the blockchain, and generating the public and private keys corresponding to the combination, participating in the process. The party stores the private key related to itself, which is used to decrypt the information related to itself, which can protect the privacy of the other party; the combined hash value and the combined public key of the corresponding public-private key pair are mapped and stored in the blockchain, The combined public key can be obtained by combining the hash value to avoid exposing too much participant information and ensure information security; encrypting key information can improve data security and avoid exposing commercial secrets; Contract verification to ensure that the content of the contract is authentic and credible without tampering.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of this application.
显然,以上所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例,附图中给出了本申请的较佳实施例,但并不限制本申请的专利范围。本申请可以以许多不同的形式来实现,相反地,提供这些实施例的目的是使对本申请的公开内容的理解更加透彻全面。尽管参照前述实施例对本申请进行了详细的说明,对于本领域的技术人员来而言,其依然可以对前述各具体实施方式所记载的技术方案进行修改,或者对其中部分技术特征进行等效替换。凡是利用本申请说明书及附图内容所做的等效结构,直接或间接运用在其他相关的技术领域,均同理在本申请专利保护范围之内。Obviously, the above-described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The accompanying drawings show the preferred embodiments of the present application, but do not limit the scope of the patent of the present application. This application may be embodied in many different forms, rather these embodiments are provided so that a thorough and complete understanding of the disclosure of this application is provided. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or perform equivalent replacements for some of the technical features. . Any equivalent structure made by using the contents of the description and drawings of the present application, which is directly or indirectly used in other related technical fields, is also within the scope of protection of the patent of the present application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210668866.4A CN115085934B (en) | 2022-06-14 | 2022-06-14 | Contract management method and related equipment based on blockchain and combined key |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210668866.4A CN115085934B (en) | 2022-06-14 | 2022-06-14 | Contract management method and related equipment based on blockchain and combined key |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115085934A true CN115085934A (en) | 2022-09-20 |
CN115085934B CN115085934B (en) | 2025-05-13 |
Family
ID=83252176
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210668866.4A Active CN115085934B (en) | 2022-06-14 | 2022-06-14 | Contract management method and related equipment based on blockchain and combined key |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115085934B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115632890A (en) * | 2022-12-23 | 2023-01-20 | 北京锘崴信息科技有限公司 | Secure decryption method and device for private data and financial private data |
CN118171304A (en) * | 2024-05-09 | 2024-06-11 | 江西怡杉科技有限公司 | Intelligent hydraulic engineering management method and system based on ecological monitoring data |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20190349199A1 (en) * | 2018-05-10 | 2019-11-14 | Alibaba Group Holding Limited | Blockchain data processing methods, apparatuses, processing devices, and systems |
CN114266681A (en) * | 2021-12-23 | 2022-04-01 | 杭州时戳信息科技有限公司 | Electronic contract signing method, system, storage medium and computing equipment |
US20220141020A1 (en) * | 2020-11-04 | 2022-05-05 | Gwangju Institute Of Science And Technology | Blockchain e-voting system and operating method thereof |
CN114500069A (en) * | 2022-02-10 | 2022-05-13 | 福建福链科技有限公司 | Method and system for storing and sharing electronic contract |
-
2022
- 2022-06-14 CN CN202210668866.4A patent/CN115085934B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20190349199A1 (en) * | 2018-05-10 | 2019-11-14 | Alibaba Group Holding Limited | Blockchain data processing methods, apparatuses, processing devices, and systems |
US20220141020A1 (en) * | 2020-11-04 | 2022-05-05 | Gwangju Institute Of Science And Technology | Blockchain e-voting system and operating method thereof |
CN114266681A (en) * | 2021-12-23 | 2022-04-01 | 杭州时戳信息科技有限公司 | Electronic contract signing method, system, storage medium and computing equipment |
CN114500069A (en) * | 2022-02-10 | 2022-05-13 | 福建福链科技有限公司 | Method and system for storing and sharing electronic contract |
Non-Patent Citations (2)
Title |
---|
WANG H J 等: "Query optimization model for blockchain applications", COMPUTER ENGINEERING AND APPLICATIONS, 31 December 2019 (2019-12-31) * |
张亮 等: "区块链技术综述", 计算机工程, no. 05, 18 March 2019 (2019-03-18) * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115632890A (en) * | 2022-12-23 | 2023-01-20 | 北京锘崴信息科技有限公司 | Secure decryption method and device for private data and financial private data |
CN115632890B (en) * | 2022-12-23 | 2023-04-07 | 北京锘崴信息科技有限公司 | Secure decryption method and device for private data and financial private data |
CN118171304A (en) * | 2024-05-09 | 2024-06-11 | 江西怡杉科技有限公司 | Intelligent hydraulic engineering management method and system based on ecological monitoring data |
Also Published As
Publication number | Publication date |
---|---|
CN115085934B (en) | 2025-05-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10839070B1 (en) | Securely executing smart contract operations in a trusted execution environment | |
CN110915164B (en) | Processing blockchain data based on smart contract operations performed in trusted execution environments | |
WO2022252632A1 (en) | Data encryption processing method and apparatus, computer device, and storage medium | |
US20210306164A1 (en) | Distributed key management for trusted execution environments | |
JP6892513B2 (en) | Off-chain smart contract service based on a reliable execution environment | |
CN110945550B (en) | Processing and storing blockchain data in a trusted execution environment | |
CN111080295B (en) | Electronic contract processing method and device based on blockchain | |
WO2021012574A1 (en) | Multisignature method, signature center, medium and electronic device | |
CN110417750B (en) | Block chain technology-based file reading and storing method, terminal device and storage medium | |
US20190278944A1 (en) | Verifying integrity of data stored in a consortium blockchain using a public sidechain | |
CN111835511A (en) | Data security transmission method and device, computer equipment and storage medium | |
CN111066019A (en) | Processing data elements stored in a blockchain network | |
CN114417374B (en) | Smart contract business card method, device, equipment and storage medium based on blockchain | |
CN113434906B (en) | Data query method, device, computer equipment and storage medium | |
CN115017107A (en) | Data retrieval method, device, computer equipment and medium based on protection of privacy | |
CN108881230A (en) | A kind of safe transmission method and device of government affairs big data | |
CN115085934B (en) | Contract management method and related equipment based on blockchain and combined key | |
CN111950032A (en) | Block chain-based data storage method, terminal device and storage medium | |
CN113434882A (en) | Communication protection method and device of application program, computer equipment and storage medium | |
CN117932685A (en) | Privacy data processing method and related equipment based on longitudinal federal learning | |
CN114615031A (en) | File storage method and device, electronic equipment and storage medium | |
CN113597608B (en) | Trusted platform based on blockchain | |
CN116226289A (en) | Electronic certificate management method, device, equipment and storage medium based on blockchain | |
CN115659378A (en) | Evidence storage method and related equipment for case record information | |
CN113783689B (en) | Sign information processing method and device |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Country or region after: China Address after: Room 801, building 2, Shenzhen new generation industrial park, 136 Zhongkang Road, Meidu community, Meilin street, Futian District, Shenzhen, Guangdong 518000 Applicant after: China Resources Digital Technology Co.,Ltd. Address before: Room 801, building 2, Shenzhen new generation industrial park, 136 Zhongkang Road, Meidu community, Meilin street, Futian District, Shenzhen, Guangdong 518000 Applicant before: Runlian software system (Shenzhen) Co.,Ltd. Country or region before: China |
|
GR01 | Patent grant | ||
GR01 | Patent grant |