[go: up one dir, main page]

CN116094739A - Encryption method, encryption device and related equipment - Google Patents

Encryption method, encryption device and related equipment Download PDF

Info

Publication number
CN116094739A
CN116094739A CN202111315278.4A CN202111315278A CN116094739A CN 116094739 A CN116094739 A CN 116094739A CN 202111315278 A CN202111315278 A CN 202111315278A CN 116094739 A CN116094739 A CN 116094739A
Authority
CN
China
Prior art keywords
node
public key
key
user node
extended
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111315278.4A
Other languages
Chinese (zh)
Inventor
代文昊
薛腾飞
曲强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Cloud Computing Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Cloud Computing Technologies Co Ltd filed Critical Huawei Cloud Computing Technologies Co Ltd
Priority to CN202111315278.4A priority Critical patent/CN116094739A/en
Priority to PCT/CN2022/123259 priority patent/WO2023078013A1/en
Publication of CN116094739A publication Critical patent/CN116094739A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0407Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the identity of one or more communicating identities is hidden
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network 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/045Network 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 hybrid encryption, i.e. combination of symmetric and asymmetric encryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network 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/0464Network 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 using hop-by-hop encryption, i.e. wherein an intermediate entity decrypts the information and re-encrypts it before forwarding it
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network 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/0478Network 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 applying multiple layers of encryption, e.g. nested tunnels or encrypting the content with a first key and then with at least a second key
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

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)
  • Storage Device Security (AREA)

Abstract

The application provides an encryption method, an encryption device and related equipment, wherein the method is applied to a user node in a blockchain network and comprises the following steps: firstly, a first extended public key comprising encrypted blood-edge information, first supervision and authorization information and a public key of a user node is obtained, then the public key of the user node is used for encrypting first data to obtain a first ciphertext, and finally the first extended public key and the first ciphertext are uploaded to a blockchain, wherein the blood-edge information reflects the association relation between private keys of a plurality of nodes and the private key of the user node, the first supervision and authorization information is used for a first authorized node in the plurality of nodes to restore a first decryption key, and the first decryption key is used for decrypting the encrypted blood-edge information. Therefore, the requirement of user-defined supervision of the upper level can be met, and the problem that the attribution relation between the user and the upper level is additionally exposed in the prior art is solved.

Description

加密方法、装置及相关设备Encryption method, device and related equipment

技术领域technical field

本申请涉及计算机技术领域,尤其涉及一种加密方法、装置及相关设备。The present application relates to the field of computer technology, in particular to an encryption method, device and related equipment.

背景技术Background technique

区块链技术由于可以在无需第三方的情况下,实现所有数据的公开透明、不可篡改、不可伪造等特性,在诸如数字政务、数字货币、金融资产交易结算等诸多领域具有广阔的应用前景。Blockchain technology has broad application prospects in many fields such as digital government affairs, digital currency, and financial asset transaction settlement because it can realize the characteristics of openness, transparency, non-tampering, and non-forgery of all data without the need for a third party.

但是,区块链的公开透明性在实际应用中存在使得用户的敏感数据(如税务信息、工资信息、出行轨迹等)暴露于区块链上的问题。若是用户使用公钥对敏感数据进行加密后再上传至区块链,当用户上级(假设用户为需要缴税的用户,则用户上级可以包括县税务局、市税务局、省税务局和税务总局,假设用户为子公司员工,则用户上级可以为子公司所属的总公司)需要监管用户上传至区块链的敏感数据时,用户需要通过网络将私钥传输给用户上级,私钥在传输的过程中可能会被恶意窃取,导致用户的私钥泄露,从而导致用户的敏感数据泄露。However, the openness and transparency of the blockchain has the problem of exposing users' sensitive data (such as tax information, salary information, travel trajectories, etc.) to the blockchain in practical applications. If the user uses the public key to encrypt sensitive data and then uploads it to the blockchain, when the user's superior (assuming that the user is a user who needs to pay taxes, the user's superior can include the county tax bureau, the city tax bureau, the provincial tax bureau and the State Taxation Bureau , assuming that the user is an employee of a subsidiary, the user's superior can be the head office to which the subsidiary belongs) When it is necessary to supervise the sensitive data uploaded by the user to the blockchain, the user needs to transmit the private key to the user's superior through the network, and the private key is transmitted During the process, it may be maliciously stolen, resulting in the leakage of the user's private key, resulting in the leakage of the user's sensitive data.

目前,利用分层确定性加密算法既可以实现用户上级的监管,又可以避免用户的敏感数据的泄露。但是由于该算法引入了用户与用户上级之间的归属关系(也可以称为血缘关系),会导致用户与用户上级之间的归属关系的泄露。此外,上述算法实现的是所有用户上级均可监管用户上传至区块链的敏感数据,无法由用户自定义监管上级,灵活性低,用户体验不佳。At present, the use of hierarchical deterministic encryption algorithms can not only realize the supervision of users' superiors, but also avoid the leakage of users' sensitive data. However, because the algorithm introduces the affiliation relationship (also called blood relationship) between the user and the user's superior, it will lead to the leakage of the affiliation relationship between the user and the user's superior. In addition, the above algorithm realizes that all user superiors can supervise the sensitive data uploaded by users to the blockchain, and users cannot customize the supervisory superiors, which has low flexibility and poor user experience.

发明内容Contents of the invention

本申请提供一种加密方法、装置及相关设备,可以实现由用户自定义监管上级,优化用户体验,而且可以解决现有技术存在的额外暴露了用户和其上级之间的归属关系的问题。This application provides an encryption method, device and related equipment, which can realize user-defined supervisory superiors, optimize user experience, and can solve the problem of additionally exposing the affiliation relationship between users and their superiors existing in the prior art.

第一方面,提供一种加密方法,该方法应用于区块链网络中的用户节点,包括:首先,获取第一扩展公钥,然后,使用用户节点的公钥对第一数据进行加密,从而获得第一密文,最后,上传第一扩展公钥和第一密文至区块链,其中,第一扩展公钥包括加密后的血缘信息、第一监管授权信息以及用户节点的公钥,血缘信息反映多个节点的私钥与用户节点的私钥之间的关联关系,第一监管授权信息用于供多个节点中的第一被授权的节点还原第一解密密钥,第一解密密钥用于对加密后的血缘信息进行解密。In the first aspect, an encryption method is provided, which is applied to a user node in a blockchain network, including: first, obtaining a first extended public key, and then using the public key of the user node to encrypt the first data, thereby Obtain the first ciphertext, and finally, upload the first extended public key and the first ciphertext to the block chain, wherein the first extended public key includes the encrypted blood relationship information, the first supervisory authorization information and the public key of the user node, The blood relationship information reflects the relationship between the private keys of multiple nodes and the private key of the user node. The first supervisory authorization information is used for the first authorized node among the multiple nodes to restore the first decryption key, and the first decryption key The key is used to decrypt the encrypted blood relationship information.

通过上述方案可知,用户节点可以通过获取包括加密后的血缘信息、监管授权信息以及自己的公钥的扩展公钥,然后使用自己的公钥加密数据得到密文,最后将自己的扩展公钥以及密文上传至区块链,由于血缘信息反映多个节点的私钥与用户节点的私钥之间的关联关系,监管授权信息用于供多个节点中的被授权的节点还原得到用于对加密后的血缘信息进行解密的解密密钥,如此,可以使得多个上级节点在从区块链获取到用户节点的扩展公钥和密文后,多个节点中被授权的节点可以根据扩展公钥重新生成用户节点的私钥,而未被授权的节点无法根据扩展公钥重新生成用户节点的私钥,因此,只有被授权的节点可以对密文进行解密得到用户节点的数据,实现对用户节点的数据的监管,而未被授权的节点无法监管用户节点的数据。可以看出,本方案能够实现用户自定义监管上级,满足用户自定义监管上级的需求。Through the above scheme, it can be seen that the user node can obtain the extended public key including the encrypted blood relationship information, regulatory authorization information and its own public key, and then use its own public key to encrypt the data to obtain the ciphertext, and finally send its own extended public key and The ciphertext is uploaded to the blockchain. Since the blood relationship information reflects the relationship between the private key of multiple nodes and the private key of the user node, the supervisory authorization information is used to restore the authorized node among multiple nodes to obtain The decryption key for decrypting the encrypted blood relationship information. In this way, after multiple upper-level nodes obtain the extended public key and ciphertext of the user node from the blockchain, the authorized nodes among the multiple nodes can key to regenerate the private key of the user node, and the unauthorized node cannot regenerate the private key of the user node according to the extended public key. Therefore, only the authorized node can decrypt the ciphertext to obtain the data of the user node, realizing the user The data supervision of nodes, and unauthorized nodes cannot supervise the data of user nodes. It can be seen that this solution can realize user-defined supervisory superiors and meet the needs of user-defined supervisory superiors.

此外,通过上述方案还可知,用户节点上传至区块链中的扩展公钥包括的是加密后的血缘信息,即便未被授权的节点获取到扩展公钥,查看到的也仅仅是加密后的血缘信息,因此,可以解决现有技术存在的额外暴露了用户和其上级之间的归属关系的问题。In addition, through the above scheme, it can also be known that the extended public key uploaded by the user node to the blockchain includes encrypted blood relationship information. Even if an unauthorized node obtains the extended public key, only the encrypted Lineage information, therefore, can solve the problem of additional exposure of the affiliation relationship between users and their superiors existing in the prior art.

在一种可能的实现方式中,方法还包括:首先,根据第一扩展公钥获取第二扩展公钥,然后,使用用户节点的公钥对第二数据进行加密,从而获得第二密文,最后,上传第二扩展公钥和第二密文至区块链,其中,第二扩展公钥包括加密后的血缘信息、第二监管授权信息以及用户节点的公钥,第二监管授权信息用于供多个节点中的第二被授权的节点还原第一解密密钥,第二被授权的节点包括第一被授权的节点,第二被授权的节点数量大于第一被授权的节点数量。In a possible implementation manner, the method further includes: firstly, obtaining a second extended public key according to the first extended public key, and then using the public key of the user node to encrypt the second data, thereby obtaining the second ciphertext, Finally, upload the second extended public key and the second ciphertext to the blockchain, wherein the second extended public key includes the encrypted blood relationship information, the second supervisory authorization information and the public key of the user node, and the second supervisory authorization information uses In order for a second authorized node among the plurality of nodes to restore the first decryption key, the second authorized node includes the first authorized node, and the number of the second authorized node is greater than the number of the first authorized node.

通过上述方案可知,用户节点可以通过修改扩展公钥中的监管授权信息来动态增加被授权的节点的数量,使得有更多的节点可以监管用户节点上传至区块链的数据,不像现有技术实现的是所有用户上级均可监管,无法由用户自定义监管上级。因此,本方案灵活性强,能够优化用户的体验。Through the above scheme, it can be seen that the user node can dynamically increase the number of authorized nodes by modifying the supervisory authorization information in the extended public key, so that more nodes can supervise the data uploaded by the user node to the blockchain, unlike the existing What the technology achieves is that all user superiors can supervise, and users cannot customize the supervisory superiors. Therefore, this solution has strong flexibility and can optimize user experience.

在一种可能的实现方式中,方法还包括:首先,根据第一扩展公钥获取第三扩展公钥,然后,使用用户节点的公钥对第三数据进行加密,从而获得第三密文,最后,上传第三扩展公钥和第三密文至区块链,其中,第三扩展公钥包括重新加密后的血缘信息、第三监管授权信息以及用户节点的公钥,第三监管授权信息用于供多个节点中的第三被授权的节点还原第二解密密钥,第二解密密钥用于对重新加密后的血缘信息进行解密,第三被授权的节点属于第一被授权的节点,第三被授权的节点数量小于第一被授权的节点数量。In a possible implementation manner, the method further includes: firstly, obtaining a third extended public key according to the first extended public key, and then using the public key of the user node to encrypt the third data, thereby obtaining the third ciphertext, Finally, upload the third extended public key and the third ciphertext to the blockchain, where the third extended public key includes the re-encrypted blood relationship information, the third supervisory authorization information and the public key of the user node, and the third supervisory authorization information It is used for the third authorized node among multiple nodes to restore the second decryption key, the second decryption key is used to decrypt the re-encrypted blood relationship information, and the third authorized node belongs to the first authorized node nodes, the third authorized number of nodes is smaller than the first authorized number of nodes.

通过上述方案可知,用户节点可以通过修改扩展公钥中的监管授权信息来动态删除被授权的节点的数量,不像现有技术实现的是所有用户上级均可监管,无法由用户自定义监管上级。因此,本方案灵活性强,能够优化用户的体验。Through the above scheme, it can be seen that the user node can dynamically delete the number of authorized nodes by modifying the supervisory authorization information in the extended public key. Unlike the existing technology, all user superiors can be supervised, and users cannot customize supervisory superiors. . Therefore, this solution has strong flexibility and can optimize user experience.

在一种可能的实现方式中,具体可以通过如下方式获取第一扩展公钥:首先,获取扩展私钥,扩展私钥包括血缘信息以及用户节点的私钥,然后,使用第一解密密钥加密血缘信息,得到加密后的血缘信息,使用第一被授权的节点的公钥加密第一解密密钥,得到第一监管授权信息,并根据用户节点的私钥,计算得到用户节点的公钥,最后,根据用户节点的公钥、加密后的血缘信息以及第一监管授权信息,得到第一扩展公钥。如此,可以使得第一被授权的节点在获取到第一扩展公钥后,使用自己的私钥对第一扩展公钥中的第一监管授权信息进行解密得到第一解密密钥,然后使用第一解密密钥对加密后的血缘信息进行解密,得到血缘信息,而未被授权的节点无法根据第一监管授权信息得到第一解密密钥,因而无法得到血缘信息,可以解决现有技术存在的额外暴露了用户和其上级之间的归属关系的问题。In a possible implementation, the first extended public key can be obtained in the following manner: first, obtain the extended private key, which includes blood relationship information and the private key of the user node, and then encrypt the data with the first decryption key blood relationship information, get the encrypted blood relationship information, use the public key of the first authorized node to encrypt the first decryption key, obtain the first regulatory authorization information, and calculate the public key of the user node according to the private key of the user node, Finally, the first extended public key is obtained according to the public key of the user node, the encrypted blood relationship information and the first supervisory authorization information. In this way, after obtaining the first extended public key, the first authorized node can use its own private key to decrypt the first supervisory authorization information in the first extended public key to obtain the first decryption key, and then use the second A decryption key decrypts the encrypted blood relationship information to obtain the blood relationship information, and the unauthorized node cannot obtain the first decryption key according to the first regulatory authorization information, so it cannot obtain the blood relationship information, which can solve the problems existing in the existing technology This additionally exposes the problem of affiliation between users and their superiors.

在一种可能的实现方式中,加密后的血缘信息包括加密后的用户节点的编号以及加密后的多个节点的编号。In a possible implementation manner, the encrypted blood relationship information includes the encrypted number of the user node and the encrypted numbers of multiple nodes.

通过上述方案可知,用户节点上传至区块链中的扩展公钥包括的是加密后的血缘信息,即便未被授权的节点获取到扩展公钥,查看到的也仅仅是加密后的血缘信息,因此,可以解决现有技术存在的额外暴露了用户和其上级之间的归属关系的问题。Through the above scheme, it can be seen that the extended public key uploaded by the user node to the blockchain includes encrypted blood relationship information. Even if an unauthorized node obtains the extended public key, only the encrypted blood relationship information can be viewed. Therefore, the problem of additional exposure of the affiliation relationship between the user and its superior existing in the prior art can be solved.

第二方面,提供一种加密方法,该方法应用于区块链网络中的监管节点,包括:首先,获取扩展公钥和密文,然后,根据扩展公钥对密文进行解密,从而得到目标数据,其中,扩展公钥包括加密后的血缘信息、监管授权信息以及用户节点的公钥,血缘信息反映多个节点的私钥与用户节点的私钥之间的关联关系,监管授权信息用于供多个节点中的被授权的节点还原解密密钥,解密密钥用于对加密后的血缘信息进行解密,密文为用户节点使用用户节点的公钥对目标数据进行加密得到,监管节点属于被授权的节点。In the second aspect, an encryption method is provided, which is applied to supervisory nodes in the blockchain network, including: first, obtaining the extended public key and ciphertext, and then decrypting the ciphertext according to the extended public key to obtain the target Data, where the extended public key includes encrypted blood relationship information, regulatory authorization information, and the public key of the user node. The blood relationship information reflects the relationship between the private keys of multiple nodes and the private key of the user node. The regulatory authorization information is used for The authorized node among the multiple nodes restores the decryption key, which is used to decrypt the encrypted blood relationship information. The ciphertext is obtained by encrypting the target data with the public key of the user node. The supervisory node belongs to Authorized nodes.

通过上述方案可知,监管节点通过获取用户节点的扩展公钥(包括加密后的血缘信息、定制的监管授权信息以及用户节点的公钥)以及使用用户节点的公钥加密敏感数据得到的敏感数据密文,然后监管节点可以根据扩展公钥重新生成用户节点的私钥,最后使用生成的私钥解密敏感数据密文得到对应的敏感数据,从而实现对用户节点上传至区块链的敏感数据的监管。Through the above scheme, it can be seen that the supervisory node acquires the extended public key of the user node (including encrypted blood relationship information, customized supervisory authorization information, and the public key of the user node) and uses the public key of the user node to encrypt the sensitive data obtained by encrypting sensitive data. Then the supervision node can regenerate the private key of the user node according to the extended public key, and finally use the generated private key to decrypt the ciphertext of the sensitive data to obtain the corresponding sensitive data, so as to realize the supervision of the sensitive data uploaded by the user node to the blockchain .

在一种可能的实现方式中,具体可以通过如下方式根据扩展公钥对密文进行解密,从而得到目标数据:首先,根据监管授权信息还原解密密钥,然后,使用解密密钥对加密后的血缘信息进行解密,得到血缘信息,并根据血缘信息,生成用户节点的私钥,最后使用用户节点的私钥对密文进行解密,得到目标数据。In a possible implementation, the ciphertext can be decrypted according to the extended public key in the following manner to obtain the target data: first, restore the decryption key according to the regulatory authorization information, and then use the decryption key to decrypt the encrypted The blood relationship information is decrypted to obtain the blood relationship information, and according to the blood relationship information, the private key of the user node is generated, and finally the ciphertext is decrypted with the private key of the user node to obtain the target data.

在一种可能的实现方式中,监管授权信息为用户节点根据被授权的节点的公钥对解密密钥进行加密得到。如此,可以使得监管节点根据自己的私钥对监管授权信息进行解密得到解密密钥,从而实现对加密后的血缘信息的解密得到血缘信息,而未被授权的节点无法根据监管授权信息还原解密密钥,因而无法得到血缘信息,可以解决现有技术存在的额外暴露了用户和其上级之间的归属关系的问题。In a possible implementation manner, the supervisory authorization information is obtained by the user node encrypting the decryption key according to the public key of the authorized node. In this way, the supervisory node can decrypt the supervisory authorization information according to its own private key to obtain the decryption key, thereby realizing the decryption of the encrypted blood relationship information to obtain the blood relationship information, and the unauthorized node cannot restore the decryption key according to the supervisory authorization information. Therefore, blood relationship information cannot be obtained, which can solve the problem of additional exposure of the affiliation relationship between the user and its superior in the existing technology.

在一种可能的实现方式中,加密后的血缘信息包括加密后的用户节点的编号以及加密后的多个节点的编号。In a possible implementation manner, the encrypted blood relationship information includes the encrypted number of the user node and the encrypted numbers of multiple nodes.

第三方面,提供一种加密装置,该装置应用于区块链网络中的用户节点,该装置包括用于执行第一方面或第一方面任一种可能实现方式中的加密方法的各个模块。In a third aspect, an encryption device is provided, the device is applied to a user node in a blockchain network, and the device includes various modules for executing the encryption method in the first aspect or any possible implementation manner of the first aspect.

第四方面,提供一种加密装置,该装置应用于区块链网络中的监管节点,该装置包括用于执行第一方面或第二方面任一种可能实现方式中的加密方法的各个模块。In a fourth aspect, an encryption device is provided, which is applied to a supervisory node in a blockchain network, and the device includes various modules for executing the encryption method in any possible implementation manner of the first aspect or the second aspect.

第五方面,提供一种计算机可读存储介质,所述计算机可读介质存储有指令,所述指令用于实现如上述第一方面至第二方面的任意可能的实现方式提供的方法。In a fifth aspect, a computer-readable storage medium is provided, the computer-readable medium stores instructions, and the instructions are used to implement the method provided in any possible implementation manners of the first aspect to the second aspect above.

第六方面,提供一种计算设备,所述计算机设备包括处理器和存储器;所述处理器用于执行所述存储器存储的指令,使得所述计算设备实现如上述第一方面至第二方面的任意可能的实现方式提供的方法。According to a sixth aspect, a computing device is provided, and the computer device includes a processor and a memory; the processor is configured to execute instructions stored in the memory, so that the computing device implements any of the above-mentioned first to second aspects. A method provided by a possible implementation.

第七方面,提供一种计算机程序产品,包括计算机程序,当所述计算机程序被计算设备读取并执行时,使得所述计算设备执行上述第一方面至第二方面的任意可能的实现方式提供的方法。In a seventh aspect, a computer program product is provided, including a computer program. When the computer program is read and executed by a computing device, the computing device executes any possible implementation manners of the above-mentioned first aspect to the second aspect to provide Methods.

附图说明Description of drawings

图1是本申请涉及的一种系统架构示意图;FIG. 1 is a schematic diagram of a system architecture involved in the present application;

图2是本申请涉及的基于BIP32进行分层加密的示意图;Fig. 2 is a schematic diagram of layered encryption based on BIP32 involved in the present application;

图3是本申请涉及的上级节点监管用户节点的敏感数据的示意图;Fig. 3 is a schematic diagram of the sensitive data of the superior node supervising the user node involved in this application;

图4是本申请提供的一种应用于用户节点的加密方法的流程示意图;FIG. 4 is a schematic flow diagram of an encryption method applied to a user node provided by the present application;

图5是本申请提供的根据扩展私钥获取扩展公钥的流程示意图;Fig. 5 is a schematic flow diagram of obtaining the extended public key according to the extended private key provided by this application;

图6是本申请提供的一种应用于监管节点的加密方法的流程示意图;FIG. 6 is a schematic flowchart of an encryption method applied to a supervisory node provided by the present application;

图7是本申请提供的一种增加监管节点的流程示意图;FIG. 7 is a schematic flow diagram of adding a supervisory node provided by the present application;

图8是本申请提供的一种删除监管节点的流程示意图;Fig. 8 is a schematic flow diagram of deleting a supervisory node provided by the present application;

图9是本申请提供的一种加密装置的结构示意图;FIG. 9 is a schematic structural diagram of an encryption device provided by the present application;

图10是本申请提供的另一种加密装置的结构示意图;FIG. 10 is a schematic structural diagram of another encryption device provided by the present application;

图11是本申请提供的一种计算设备的结构示意图。FIG. 11 is a schematic structural diagram of a computing device provided by the present application.

具体实施方式Detailed ways

下面将结合附图,对本申请提供的技术方案进行描述。The technical solution provided by this application will be described below with reference to the accompanying drawings.

本申请实施例中的术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。The terms "first" and "second" in the embodiments of the present application are used for description purposes only, and cannot be interpreted as indicating or implying relative importance or implicitly indicating the quantity of indicated technical features. Thus, a feature defined as "first" and "second" may explicitly or implicitly include one or more of these features.

本申请实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下中的至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a、b、c、a-b、a-c、b-c或a-b-c,其中a、b、c可以是单个,也可以是多个。In the embodiments of the present application, "at least one" means one or more, and "multiple" means two or more. "And/or" describes the association relationship of associated objects, indicating that there may be three types of relationships, for example, A and/or B, which can mean: A exists alone, A and B exist at the same time, and B exists alone, where A, B can be singular or plural. The character "/" generally indicates that the contextual objects are an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one item (unit) of a, b or c can represent: a, b, c, a-b, a-c, b-c or a-b-c, wherein a, b, c can be single or multiple.

为了使本申请提供的技术方案更清晰,在具体描述本申请提供的技术方案之前,首先进行相关术语以及相关技术的解释。In order to make the technical solution provided by this application clearer, before describing the technical solution provided by this application in detail, explanations of relevant terms and related technologies are given first.

区块链(block chain):狭义上,区块链是一种以区块为基本单位的链式数据结构,区块中利用数字摘要对之前获取的交易历史进行校验,适合分布式记账场景下防篡改和可扩展性的需求;广义上,区块链还指代区块链结构实现的分布式记账技术,包括分布式共识、隐私与安全保护、点对点通信技术、网络协议、智能合约等。Block chain: In a narrow sense, block chain is a chained data structure with block as the basic unit. The digital summary is used in the block to verify the transaction history obtained before, which is suitable for distributed bookkeeping. Anti-tampering and scalability requirements in scenarios; in a broad sense, blockchain also refers to the distributed accounting technology implemented by the blockchain structure, including distributed consensus, privacy and security protection, point-to-point communication technology, network protocols, smart contract etc.

区块链的目标是实现一个分布的数据记录账本,此账本只允许添加,不允许删除。账本底层的基本结构是一个线性的链表。链表由一个个“区块”串联组成,后继区块中记录前继区块的哈希(hash)值,每个区块(以及区块中的交易)是否合法,可通过计算哈希值的方式进行快速检验。若网络中的节点提议添加一个新的区块,必须经过共识机制对区块达成共识确认。The goal of the blockchain is to implement a distributed data record ledger, which only allows addition and does not allow deletion. The underlying structure of the ledger is a linear linked list. The linked list is composed of "blocks" in series. The hash (hash) value of the previous block is recorded in the subsequent block. Whether each block (and the transaction in the block) is legal can be calculated by calculating the hash value. way for a quick check. If a node in the network proposes to add a new block, it must go through a consensus mechanism to reach a consensus on the block.

对称密钥:也可以称为专用密钥或共享密钥,即数据加密方和数据解密方必须使用相同的密钥对数据进行加密和解密。Symmetric key: It can also be called a private key or a shared key, that is, the data encryption party and the data decryption party must use the same key to encrypt and decrypt data.

非对称密钥:包括公钥(public key)和私钥(private key),公钥用来给数据加密,私钥用来给数据解密,用公钥加密的数据只能使用私钥解密。公钥可以通过公式“公钥=私钥·G”计算得到,G为椭圆曲线基点。需要说明的是,根据上述公式计算得到公钥的过程是不可逆的,即根据私钥可以计算得到公钥,但无法根据公钥反推出私钥。Asymmetric key: including public key (public key) and private key (private key). The public key is used to encrypt data, and the private key is used to decrypt data. Data encrypted with the public key can only be decrypted with the private key. The public key can be calculated by the formula "public key = private key·G", where G is the base point of the elliptic curve. It should be noted that the process of calculating the public key according to the above formula is irreversible, that is, the public key can be calculated based on the private key, but the private key cannot be deduced from the public key.

第32个比特币改进建议(bitcoin improvement proposals,BIP):简称为BIP32,该建议的具体内容为:根据一个随机数种子通过分层确定性推导的方式得到n个私钥,这样数字钱包在保存的时候,只需要保存一个种子就可以,当需要使用任意一个私钥进行解密时,该私钥可以根据种子重新推导出来。其中,数字钱包是一个管理私钥(生成、存储、签名)的工具。The 32nd bitcoin improvement proposal (bitcoin improvement proposals, BIP): referred to as BIP32, the specific content of this proposal is: according to a random number seed, obtain n private keys through hierarchical deterministic derivation, so that the digital wallet is stored , you only need to save a seed, and when you need to use any private key for decryption, the private key can be re-derived based on the seed. Among them, the digital wallet is a tool for managing private keys (generation, storage, signature).

BIP32常用于区块链网络中需要进行分层加密的场景,下面结合图1所示的区块链网络详细介绍基于BIP32进行分层加密的过程。BIP32 is often used in scenarios where layered encryption is required in blockchain networks. The following describes the process of layered encryption based on BIP32 in detail in conjunction with the blockchain network shown in Figure 1.

如图1所示,区块链网络包括节点100、节点110、节点120、节点1101、节点1102、节点1201和节点1202,其中,节点100、节点110、节点120、节点1101、节点1102、节点1201和节点1202可以包括手机、平板电脑、笔记本电脑、掌上电脑、智能音响、移动互联网设备(mobile internet device,MID)、销售点(point of sales,POS)机、可穿戴设备(例如智能手表、智能手环等)等,任意两个节点之间可以通过网络连接,网络可以是无线网络,也可以为有线网络,此处不作具体限定。As shown in Figure 1, the block chain network includes node 100, node 110, node 120, node 1101, node 1102, node 1201 and node 1202, wherein, node 100, node 110, node 120, node 1101, node 1102, node 1201 and node 1202 may include mobile phones, tablet computers, notebook computers, palmtop computers, smart speakers, mobile internet devices (mobile internet device, MID), point of sales (point of sales, POS) machines, wearable devices (such as smart watches, Smart bracelets, etc.), etc., any two nodes can be connected through a network, and the network can be a wireless network or a wired network, which is not specifically limited here.

图1所示的区块链网络可以理解为一个具有层级关系的系统,其中,节点100为最高级别机构,作为该组织的第一层,节点110和节点120为节点100下的两个部门,归属于节点100,作为该组织的第二层,节点1101和节点1102是节点110下的两个成员,归属于节点110,节点1201和节点1202是节点120下的两个成员,归属于节点120,作为该组织的第三层。例如,节点100为省税务局,节点110和节点120为省税务局所管辖的两个市税务局,节点1101、节点1102、节点1201和节点1202对应为两个市税务局所管辖的用户;又例如,节点100为最高法院、节点110和节点120为最高法院所管辖的两个省级法院,节点1101、节点1102、节点1201和节点1202对应为两个省级法院所管辖的市级法院等。可以看出,节点100是节点110和节点120的直接上级节点,节点110是节点1101和节点1102的直接上级节点,节点120是节点1201节点1202的直接上级节点,节点100也是节点1101、节点1102、节点1201和节点1202的间接上级节点。The blockchain network shown in Figure 1 can be understood as a system with a hierarchical relationship, in which node 100 is the highest-level organization as the first layer of the organization, and node 110 and node 120 are two departments under node 100, Belonging to node 100, as the second layer of the organization, node 1101 and node 1102 are two members under node 110, belonging to node 110, node 1201 and node 1202 are two members under node 120, belonging to node 120 , as the third layer of the organization. For example, node 100 is the provincial taxation bureau, node 110 and node 120 are two city taxation bureaus under the jurisdiction of the provincial taxation bureau, node 1101, node 1102, node 1201 and node 1202 correspond to users under the jurisdiction of the two city taxation bureaus; another example , node 100 is the Supreme Court, node 110 and node 120 are two provincial courts under the jurisdiction of the Supreme Court, node 1101, node 1102, node 1201 and node 1202 correspond to the municipal courts under the jurisdiction of the two provincial courts, etc. It can be seen that node 100 is the direct superior node of node 110 and node 120, node 110 is the direct superior node of node 1101 and node 1102, node 120 is the direct superior node of node 1201 and node 1202, node 100 is also node 1101, node 1102 , the indirect superior node of node 1201 and node 1202.

以节点100为例,节点100基于BIP32进行分层加密的过程如图2所示:Taking node 100 as an example, the process of node 100 performing layered encryption based on BIP32 is shown in Figure 2:

节点100随机选择一个种子,然后使用SHA512对该种子进行哈希,得到一个512位的哈希值,然后,节点100将得到的哈希值的左256位确定为自己的私钥,右256位确定为自己的链码。Node 100 randomly selects a seed, and then uses SHA512 to hash the seed to obtain a 512-bit hash value. Then, node 100 determines the left 256 bits of the obtained hash value as its own private key, and the right 256 bits Determined as your own chain code.

节点100在确定自己的私钥和链码后,若节点100确定自己需要为节点110或者节点120生成私钥,以为节点110生成私钥为例,其首先为节点110确定一个编号,例如1,然后使用SHA512对自己的密钥(私钥或者公钥,在图2中以私钥为例)、链码以及节点110的编号组成的字符进行哈希,得到一个512位的哈希值,然后,节点100将得到的哈希值的左256位确定为节点110的私钥,右256位确定为节点110的链码,从而确定节点110的扩展私钥(包括节点110的私钥和节点110的链码),最后将扩展私钥发送给节点110。其中,编号的作用是区分一个节点以及该节点的父节点所管辖的其他与该节点属于同一级的节点,例如,节点110的编号是为了区分节点110和节点120,节点1101的编号是为了区分节点1101和节点1102。After node 100 determines its own private key and chain code, if node 100 determines that it needs to generate a private key for node 110 or node 120, take node 110 as an example to generate a private key, it first determines a number for node 110, such as 1, Then use SHA512 to hash your own key (private key or public key, take the private key as an example in Figure 2), chain code and the characters formed by the number of node 110 to obtain a 512-bit hash value, and then , the node 100 determines the left 256 bits of the obtained hash value as the private key of the node 110, and the right 256 bits determine the chain code of the node 110, thereby determining the extended private key of the node 110 (including the private key of the node 110 and the node 110 chain code), and finally send the extended private key to the node 110. Among them, the function of numbering is to distinguish a node and other nodes belonging to the same level as the node under the jurisdiction of the parent node of the node. For example, the numbering of node 110 is to distinguish node 110 from node 120, and the numbering of node 1101 is to distinguish Node 1101 and Node 1102.

若节点100确定自己需要为节点1101、节点1102、节点1201或者节点1202生成私钥,其先参照上述过程为节点110或者节点120生成私钥,然后由节点110或者节点120参照上述节点100为节点110生成私钥的过程对应为节点1101、节点1102、节点1201或者节点1202生成私钥,节点110或者节点120在为对应的节点生成私钥后,将生成的私钥以扩展私钥的形式发送给对应节点。If node 100 determines that it needs to generate a private key for node 1101, node 1102, node 1201 or node 1202, it first generates a private key for node 110 or node 120 by referring to the above process, and then node 110 or node 120 refers to the above node 100 as a node 110 The process of generating a private key corresponds to generating a private key for node 1101, node 1102, node 1201 or node 1202, after node 110 or node 120 generates a private key for the corresponding node, the generated private key is sent in the form of an extended private key to the corresponding node.

需要说明的是,在BIP32中,上级节点根据自己的私钥为下级节点生成私钥的过程均是不可逆的,即下级节点无法根据自己的私钥反推出上级节点的私钥。It should be noted that in BIP32, the process of the upper-level node generating a private key for the lower-level node based on its own private key is irreversible, that is, the lower-level node cannot deduce the private key of the upper-level node based on its own private key.

图1所示的各节点在得到自己的扩展私钥后,若有加密上传敏感数据至区块链的需求,其可以根据扩展私钥中的私钥计算得到公钥,然后使用公钥对敏感数据进行加密,然后将扩展公钥(包括节点的链码和节点的公钥等)和敏感数据密文一起上传至区块链,如图3所示。After each node shown in Figure 1 obtains its own extended private key, if it needs to encrypt and upload sensitive data to the blockchain, it can calculate the public key according to the private key in the extended private key, and then use the public key to pair the sensitive The data is encrypted, and then the extended public key (including the chain code of the node and the public key of the node, etc.) and the ciphertext of the sensitive data are uploaded to the blockchain, as shown in Figure 3.

在有节点将自己的扩展公钥和敏感数据密文上传至区块链(以下将上传了敏感数据密文至区块链的节点统称为用户节点)之后,区块链网络中的其他节点均可获知用户节点上传了数据,以及可从区块链上获取到用户节点上传的扩展公钥和敏感数据密文,但只有用户节点的上级节点(包括直接上级节点和间接上级节点)能够重新生成该节点的私钥,并使用私钥解密敏感数据密文得到敏感数据,非上级节点无法生成该节点的私钥,故不能解密敏感数据密文得到敏感数据。After a node uploads its own extended public key and sensitive data ciphertext to the blockchain (hereinafter, the nodes that upload sensitive data ciphertext to the blockchain are collectively referred to as user nodes), other nodes in the blockchain network will It can be known that the user node has uploaded data, and the extended public key and sensitive data ciphertext uploaded by the user node can be obtained from the blockchain, but only the upper-level nodes of the user node (including direct upper-level nodes and indirect upper-level nodes) can regenerate The private key of the node, and use the private key to decrypt the ciphertext of sensitive data to obtain sensitive data. Non-superior nodes cannot generate the private key of the node, so they cannot decrypt the ciphertext of sensitive data to obtain sensitive data.

下面介绍用户节点的上级节点对敏感数据密文进行解密的过程,如图3所示,在图3中,以节点100解密节点1101上传至区块链的敏感数据密文为例。The following describes the process of decrypting the sensitive data ciphertext by the superior node of the user node, as shown in FIG. 3 . In FIG. 3 , node 100 decrypts the sensitive data ciphertext uploaded to the blockchain by node 1101 as an example.

节点100在从区块链上获取到节点1101的扩展公钥和敏感数据密文后,可以生成其管辖的所有下级节点(包括直接下级和间接下级)的私钥,并根据各下级节点的私钥生成各下级节点的公钥,然后将生成的公钥与获取到的扩展公钥中包括的公钥比较,从而确定对应的私钥,然后使用私钥对敏感数据密文进行解密,得到敏感数据。After node 100 obtains the extended public key and sensitive data ciphertext of node 1101 from the blockchain, it can generate the private keys of all subordinate nodes (including direct subordinates and indirect subordinates) under its jurisdiction, and according to the private key of each subordinate node key to generate the public key of each lower-level node, and then compare the generated public key with the public key included in the obtained extended public key to determine the corresponding private key, and then use the private key to decrypt the ciphertext of the sensitive data to obtain the sensitive data.

综上可知,BIP32可以实现用户上级对用户上传到区块链的数据的监管,而且具有避免用户的敏感数据暴露给除上级之外的其他用户的优点。In summary, BIP32 can realize the supervision of the user's superiors on the data uploaded to the blockchain by the user, and has the advantage of preventing the user's sensitive data from being exposed to other users except the superior.

在具体实现中,还存在BIP39或者BIP44等其他BIP建议,这些BIP建议进行分层加密的过程与BIP32进行分层加密的过程相类似,此处不再展开赘述。In specific implementation, there are other BIP recommendations such as BIP39 or BIP44. The process of layered encryption in these BIP recommendations is similar to the layered encryption process of BIP32, and will not be repeated here.

需要说明的是,图1仅仅是作为一种示例,在具体实现中,区块链网络可以包括更多或者更少的节点,每个节点可以包括更多或者更少的下级节点,图1不应视为具体限定。It should be noted that Figure 1 is only an example. In a specific implementation, the blockchain network may include more or fewer nodes, and each node may include more or fewer subordinate nodes. Figure 1 does not should be considered specifically defined.

被授权的节点:指用户节点的上级节点中被用户节点授予了监管权限的节点,这些节点可以监管用户节点上传至区块链的敏感数据,即,这些节点在从区块链获取到用户节点使用自己的公钥加密上传的敏感数据密文后,可以重新生成用户节点的私钥,然后使用生成的私钥对敏感数据密文进行解密,得到敏感数据。Authorized nodes: Refers to the nodes that have been granted supervisory authority by the user node among the superior nodes of the user node. These nodes can supervise the sensitive data uploaded by the user node to the blockchain, that is, these nodes are obtained from the blockchain. After encrypting the uploaded sensitive data ciphertext with your own public key, you can regenerate the private key of the user node, and then use the generated private key to decrypt the sensitive data ciphertext to obtain sensitive data.

未被授权的节点:指用户节点的上级节点中未被用户节点授予监管权限的节点,这些节点不可以监管用户节点上传至区块链的敏感数据。Unauthorized nodes: Refers to nodes among the upper-level nodes of the user node that have not been granted supervisory authority by the user node. These nodes cannot supervise the sensitive data uploaded by the user node to the blockchain.

下面介绍本申请涉及的应用场景。The application scenarios involved in this application are introduced below.

本申请涉及用户需要加密上传敏感数据至区块链且用户的上级需要对用户上传的敏感数据进行监管的场景,如图1所示的区块链网络。This application involves a scenario where a user needs to encrypt and upload sensitive data to the blockchain and the user's superior needs to supervise the sensitive data uploaded by the user, as shown in the blockchain network shown in Figure 1.

目前,图1所示的区块链网络中的用户节点在需要加密上传敏感数据至区块链时,其通常采用基于BIP32进行分层加密的方法,从上文对基于BIP32进行分层加密的方法的介绍可知,若上级节点需要监管用户节点上传至区块链的敏感数据,上级节点需要生成其管辖的所有下级节点的私钥,然后根据各下级节点的私钥生成各下级节点的公钥,最后将生成的公钥与获取到的扩展公钥中包括的用户节点的公钥进行比较,才能确定对应的私钥,从而解密得到敏感数据,该过程比较繁琐,需要耗费较多时间,监管效率较低。At present, when user nodes in the blockchain network shown in Figure 1 need to encrypt and upload sensitive data to the blockchain, they usually use the method of layered encryption based on BIP32. From the above, the method of layered encryption based on BIP32 The introduction of the method shows that if the upper-level node needs to supervise the sensitive data uploaded by the user node to the blockchain, the upper-level node needs to generate the private key of all the lower-level nodes under its jurisdiction, and then generate the public key of each lower-level node according to the private key of each lower-level node , and finally compare the generated public key with the public key of the user node included in the obtained extended public key to determine the corresponding private key and decrypt the sensitive data. This process is cumbersome and takes a lot of time. less efficient.

针对基于BIP32进行分层加密的方法存在的问题,现有技术提供了分层确定性加密算法:In view of the problems existing in the method of layered encryption based on BIP32, the prior art provides a layered deterministic encryption algorithm:

该算法在基于BIP32进行分层加密的方法的基础上做了改进,具体改进为上级节点在为下级节点生成扩展私钥时,在扩展私钥中增加了自己与下级节点之间的血缘信息,该血缘信息用于反映上级节点自己的私钥与下级节点的私钥之间的关联关系,即反映下级节点的私钥由上级节点根据自己的私钥生成,具体地,血缘信息包括上级节点自己的编号以及下级节点的编号,其所反映的关联关系具体为下级节点的私钥由上级节点根据自己的私钥、自己的链码和下级节点的编号生成。This algorithm has been improved on the basis of the BIP32-based layered encryption method. The specific improvement is that when the upper-level node generates an extended private key for the lower-level node, the blood relationship information between itself and the lower-level node is added to the extended private key. The lineage information is used to reflect the relationship between the private key of the upper-level node and the private key of the lower-level node, that is, to reflect that the private key of the lower-level node is generated by the upper-level node according to its own private key. The number of the node and the number of the lower-level node, the association relationship reflected is specifically that the private key of the lower-level node is generated by the upper-level node according to its own private key, its own chain code and the number of the lower-level node.

例如,假设下级节点为图1所示的节点1101,节点1101的上级节点为节点110和节点100,节点1101的编号为1,节点110的编号为10,节点100的编号为0,则节点110的扩展私钥中的血缘信息为(0;1),该血缘信息反映节点110的私钥由节点100根据自己的私钥、自己的链码和节点110的编号1生成,节点1101的扩展私钥中的血缘信息为(0;1;10),该血缘信息反映节点1101的私钥由节点110根据自己的私钥、自己的链码和节点1101的编号10生成,以及反映节点110的私钥由节点100根据自己的私钥、自己的链码和节点110的编号1生成。For example, assuming that the lower-level node is node 1101 shown in Figure 1, the upper-level nodes of node 1101 are node 110 and node 100, the number of node 1101 is 1, the number of node 110 is 10, and the number of node 100 is 0, then node 110 The kinship information in the extended private key of is (0; 1), which reflects that the private key of node 110 is generated by node 100 according to its own private key, its own chain code and the number 1 of node 110, and the extended private key of node 1101 The blood relationship information in the key is (0; 1; 10), which reflects that the private key of node 1101 is generated by node 110 according to its own private key, its own chain code and the number 10 of node 1101, and reflects the private key of node 1101. The key is generated by the node 100 according to its own private key, its own chain code and the number 1 of the node 110 .

需要说明的是,上述血缘信息为(0;1)/(0;1;10)仅仅是作为一种示例,例如,血缘信息还可以为(10)/(1;10),不包括最高级节点100的编号。It should be noted that the blood relationship information above is (0; 1)/(0; 1; 10) as an example only, for example, the blood relationship information can also be (10)/(1; 10), excluding the highest level The number of node 100.

分层确定性加密算法基于上述改进,可以使得用户节点根据扩展私钥获取到的扩展公钥也包括血缘信息,那么当用户节点的上级节点从区块链获取到用户节点上传的扩展公钥和敏感数据密文后,上级节点可以根据扩展公钥中包括的血缘信息直接重新生成用户节点的私钥,无需生成其管辖的所有下级节点的私钥,再从中确定用户节点的私钥,因而,可以减少上级节点获取用户节点的私钥所耗费的时间,从而提高监管效率。Based on the above improvements, the hierarchical deterministic encryption algorithm can make the extended public key obtained by the user node according to the extended private key also include blood relationship information, then when the upper node of the user node obtains the extended public key uploaded by the user node from the blockchain and After the sensitive data is ciphered, the upper-level node can directly regenerate the private key of the user node according to the blood relationship information included in the extended public key, without generating the private key of all the lower-level nodes under its jurisdiction, and then determine the private key of the user node from it. Therefore, It can reduce the time spent by the upper-level node to obtain the private key of the user node, thereby improving the supervision efficiency.

但是,可以看出,在分层确定性加密算法中,用户节点上传到区块链的扩展公钥中包括血缘信息,用户节点的非上级节点也可以从区块链获取到用户节点的扩展公钥,从而获取到血缘信息,这额外暴露了用户节点的私钥和其上级节点的私钥之间的关联关系,即暴露了用户和其上级之间的归属关系。此外,分层确定性加密算法实现的是用户的所有上级均可监管用户上传的敏感数据,但是在实际应用中,用户通常并不希望所有的上级均可监管自己上传的敏感数据,而是由用户自定义哪些上级可以监管,哪些上级不可以监管,明显可见,分层确定性加密算法无法满足用户的上述需求。However, it can be seen that in the hierarchical deterministic encryption algorithm, the extended public key uploaded by the user node to the blockchain includes blood relationship information, and the non-superior nodes of the user node can also obtain the extended public key of the user node from the blockchain. Key, so as to obtain blood relationship information, which additionally exposes the association between the private key of the user node and the private key of its superior node, that is, the affiliation relationship between the user and its superior. In addition, the hierarchical deterministic encryption algorithm realizes that all the superiors of the user can supervise the sensitive data uploaded by the user, but in practical applications, users usually do not want all the superiors to supervise the sensitive data uploaded by themselves, but by Users define which superiors can supervise and which superiors cannot supervise. It is obvious that the hierarchical deterministic encryption algorithm cannot meet the above needs of users.

本申请提供了加密方法、装置及相关设备,可以应用于图1所示的区块链网络,解决上述分层确定性加密算法存在的额外暴露了用户和其上级之间的归属关系的问题,以及满足用户自定义监管上级的需求。This application provides an encryption method, device and related equipment, which can be applied to the blockchain network shown in Figure 1 to solve the problem of additional exposure of the affiliation relationship between users and their superiors in the above-mentioned layered deterministic encryption algorithm. And meet the needs of user-defined supervisory superiors.

请参见图4,图4是本申请提供的一种加密方法的流程示意图,该加密方法具体应用于图1所示的区块链网络中需要上传敏感数据至区块链的用户节点。Please refer to FIG. 4, which is a schematic flowchart of an encryption method provided by the present application. The encryption method is specifically applied to user nodes in the blockchain network shown in FIG. 1 that need to upload sensitive data to the blockchain.

如图4所示,该方法包括:As shown in Figure 4, the method includes:

S401、获取包括血缘信息以及用户节点的私钥的扩展私钥。S401. Obtain an extended private key including blood relationship information and a private key of a user node.

其中,血缘信息反映多个节点(指用户节点的上级节点)的私钥与用户节点的私钥之间的关联关系,用户节点的私钥用于用户节点计算得到自己的公钥,该公钥用于用户节点后续对待上传至区块链的敏感数据(如下文所述第一数据、第二数据、第三数据)进行加密,得到敏感数据密文(如下文所述第一密文、第二密文、第三密文)。Among them, the blood relationship information reflects the relationship between the private keys of multiple nodes (referring to the superior node of the user node) and the private key of the user node. The private key of the user node is used for the calculation of the user node to obtain its own public key. The public key It is used for the user node to encrypt the sensitive data to be uploaded to the block chain (the first data, the second data, the third data described below) to obtain the sensitive data ciphertext (the first ciphertext described below, the second data Second ciphertext, third ciphertext).

可选地,扩展私钥中还可以包括用户节点的链码、用户节点所在的层级等其他信息,本申请对此不作具体限定。其中,用户节点的链码用于在用户节点包括下级节点,且需要为下级节点生成私钥时,为下级节点生成私钥。Optionally, the extended private key may also include other information such as the chain code of the user node and the level of the user node, which is not specifically limited in this application. Wherein, the chain code of the user node is used to generate a private key for the subordinate node when the user node includes the subordinate node and needs to generate a private key for the subordinate node.

为了简便陈述,本实施例没有对用户节点获取扩展私钥的过程进行详细描述,该过程与上述分层确定性加密算法中用户节点获取扩展私钥的过程相同,具体可以参考上文相关描述,此处不再展开赘述。For the sake of brevity, this embodiment does not describe in detail the process of obtaining the extended private key by the user node. This process is the same as the process of obtaining the extended private key by the user node in the above-mentioned layered deterministic encryption algorithm. For details, please refer to the relevant description above. No more details here.

S402、根据扩展私钥获取包括加密后的血缘信息、第一监管授权信息以及用户节点的公钥的第一扩展公钥,其中,第一监管授权信息用于供多个节点中的第一被授权的节点还原第一解密密钥,第一解密密钥用于对加密后的血缘信息进行解密。S402. According to the extended private key, obtain the first extended public key including the encrypted blood relationship information, the first supervisory authorization information and the public key of the user node, wherein the first supervisory authorization information is used for the first slave among the multiple nodes The authorized node restores the first decryption key, and the first decryption key is used to decrypt the encrypted blood relationship information.

由上文对分层确定性加密算法的介绍可知,血缘信息能够用于用户节点的上级节点重新生成用户节点的私钥,可以理解,在血缘信息被加密的情况下,用户节点的上级节点若想根据血缘信息重新生成用户节点的私钥,则需要获取对加密后的血缘信息进行解密的密钥,即第一解密密钥,以对加密后的血缘信息进行解密。From the above introduction to the hierarchical deterministic encryption algorithm, it can be seen that blood relationship information can be used by the upper-level node of the user node to regenerate the private key of the user node. It can be understood that when the blood relationship information is encrypted, if the upper-level node of the user node If you want to regenerate the private key of the user node according to the blood relationship information, you need to obtain the key for decrypting the encrypted blood relationship information, that is, the first decryption key, so as to decrypt the encrypted blood relationship information.

在本实施例中,由于用户节点通过第一监管授权信息对多个上级节点进行了授权,只有多个上级节点中被授权的节点才能够根据第一监管授权信息还原第一解密密钥,并使用第一解密密钥对加密后的血缘信息进行解密,然后根据血缘信息重新生成用户节点的私钥,而多个上级节点中未被授权的节点无法根据第一监管授权信息还原第一解密密钥,因而无法解密得到血缘信息,进而无法根据血缘信息重新生成用户节点的私钥。In this embodiment, since the user node authorizes multiple upper-level nodes through the first supervision authorization information, only authorized nodes among the multiple upper-level nodes can restore the first decryption key according to the first supervision authorization information, and Use the first decryption key to decrypt the encrypted blood relationship information, and then regenerate the private key of the user node according to the blood relationship information, and the unauthorized nodes among the multiple upper-level nodes cannot restore the first decryption key according to the first supervisory authorization information. key, so the blood relationship information cannot be decrypted, and the private key of the user node cannot be regenerated based on the blood relationship information.

下面结合图5详细介绍用户节点根据扩展私钥获取第一扩展公钥的过程,如图5所示,该过程可以包括如下步骤:The following describes in detail the process of the user node obtaining the first extended public key according to the extended private key in conjunction with FIG. 5. As shown in FIG. 5, the process may include the following steps:

S4021、随机生成第一解密密钥,使用第一解密密钥对血缘信息进行加密,得到加密后的血缘信息。S4021. Randomly generate a first decryption key, and use the first decryption key to encrypt blood relationship information to obtain encrypted blood relationship information.

其中,第一解密密钥可以为对称密钥,在第一解密密钥为对称密钥的情况下,使用第一解密密钥对血缘信息进行加密,得到加密后的血缘信息,那么后续用户节点或者其他节点若想对加密后的血缘信息进行解密得到血缘信息,所使用的解密密钥需要为第一解密密钥。Wherein, the first decryption key may be a symmetric key. In the case where the first decryption key is a symmetric key, the blood relationship information is encrypted using the first decryption key to obtain the encrypted blood relationship information, then the subsequent user node Or if other nodes want to decrypt the encrypted blood relationship information to obtain the blood relationship information, the decryption key used needs to be the first decryption key.

在具体实现中,用户节点可以使用随机算法随机生成第一解密密钥,该密钥可以是256位或者512位的字符,此处不作具体限定;用户节点使用第一解密密钥对血缘信息进行加密所使用的算法可以为高级加密标准(advanced encryption standard,AES)算法或三重数据加密算法(triple data encryption algorithm,简称为3DES)等,本申请对此不作具体限定。In a specific implementation, the user node can use a random algorithm to randomly generate the first decryption key, which can be a 256-bit or 512-bit character, which is not specifically limited here; the user node uses the first decryption key to process blood relationship information The algorithm used for encryption may be advanced encryption standard (AES) algorithm or triple data encryption algorithm (triple data encryption algorithm, referred to as 3DES), etc., which is not specifically limited in this application.

S4022、使用多个节点中第一被授权的节点的公钥对第一解密密钥进行加密,得到第一监管授权信息。S4022. Use the public key of the first authorized node among the multiple nodes to encrypt the first decryption key to obtain the first supervisory authorization information.

可以理解,由于第一被授权的节点的公钥和私钥是成对的,使用第一被授权的节点的公钥对第一解密密钥进行加密,得到第一监管授权信息,那么后续用户节点或者其他节点若想对第一监管授权信息进行解密得到第一解密密钥,所使用的解密密钥需要为第一被授权的节点的私钥。It can be understood that since the public key and private key of the first authorized node are paired, use the public key of the first authorized node to encrypt the first decryption key to obtain the first supervisory authorization information, then subsequent users If a node or other nodes want to decrypt the first supervisory authorization information to obtain the first decryption key, the decryption key used must be the private key of the first authorized node.

下面继续以用户节点为节点1101、用户节点的上级节点为节点110和节点100为例,介绍用户节点得到第一监管授权信息以及第一被授权的节点根据第一监管授权信息还原第一解密密钥的详细过程:The following continues to take the user node as node 1101, and the upper-level nodes of the user node as nodes 110 and 100 as an example, to introduce the user node to obtain the first supervision authorization information and the first authorized node to restore the first decryption encryption according to the first supervision authorization information. The detailed process of the key:

首先假设节点100为第一被授权的节点,节点110为未被授权的节点,节点1101可以参考如下公式(1)得到第一监管授权信息:First, assuming that node 100 is the first authorized node, and node 110 is an unauthorized node, node 1101 can obtain the first supervisory authorization information by referring to the following formula (1):

第一监管授权信息={R·G,Skey+R·PK100} (1)First supervisory authorization information = {R G, Skey+R PK 100 } (1)

其中,Skey为第一解密密钥,PK100为节点100的公钥,G为椭圆曲线基点,R为节点1101选取的随机数。Among them, Skey is the first decryption key, PK 100 is the public key of node 100, G is the base point of the elliptic curve, and R is the random number selected by node 1101.

当节点100获取到上述第一监管授权信息时,节点100可以参考如下公式(2)还原第一解密密钥:When the node 100 obtains the above-mentioned first supervisory authorization information, the node 100 can refer to the following formula (2) to restore the first decryption key:

Skey'=(Skey+R·PK100)-SK100·(R·G) (2)Skey'=(Skey+R·PK 100 )-SK 100 ·(R·G) (2)

其中,Skey'为节点100还原出的第一解密密钥,SK100为节点100的私钥。Wherein, Skey' is the first decryption key restored by the node 100, and SK 100 is the private key of the node 100.

再假设节点100和节点110均为第一被授权的节点为例,节点1101可以参考如下公式(3)得到第一监管授权信息:Assuming that both node 100 and node 110 are the first authorized nodes as an example, node 1101 can obtain the first supervisory authorization information by referring to the following formula (3):

第一监管授权信息={R·G,Skey+R·PK100,Skey+R·PK110} (3)The first regulatory authorization information = {R G, Skey+R PK 100 , Skey+R PK 110 } (3)

其中,PK110为节点110的公钥。Wherein, PK 110 is the public key of node 110 .

当节点100获取到上述第一监管授权信息时,节点100可以继续参考上述公式(2)还原第一解密密钥。When the node 100 obtains the above first supervisory authorization information, the node 100 may continue to refer to the above formula (2) to restore the first decryption key.

当节点110获取到上述第一监管授权信息时,节点110可以参考如下公式(4)还原第一解密密钥。When the node 110 obtains the above-mentioned first supervisory authorization information, the node 110 may refer to the following formula (4) to restore the first decryption key.

Skey"=(Skey+R·PK110)-SK110·(R·G) (4)Skey"=(Skey+R·PK 110 )-SK 110 ·(R·G) (4)

其中,Skey"为节点110还原出的第一解密密钥,SK110为节点110的私钥。Wherein, Skey" is the first decryption key restored by the node 110, and SK 110 is the private key of the node 110.

需要说明的是,上述用户节点得到第一监管授权信息的公式(1)、(2)仅仅是作为一种示例,在具体实现中,用户节点还可以参考其他方式得到第一监管授权信息,例如,当第一被授权的节点包括节点100和节点110时,第一监管授权信息={R·G,Skey+R·PK100,Skey+R·PK110,H(Skey)},其中,H(Skey)用于第一被授权的节点校验还原的第一解密密钥的完整性。It should be noted that the above-mentioned formulas (1) and (2) for the user node to obtain the first supervision authorization information are only used as an example. In a specific implementation, the user node can also refer to other methods to obtain the first supervision authorization information, for example , when the first authorized node includes node 100 and node 110, the first supervisory authorization information={R·G, Skey+R·PK 100 , Skey+R·PK 110 , H(Skey)}, where, H (Skey) is used by the first authorized node to verify the integrity of the restored first decryption key.

S4023、根据用户节点的私钥,计算得到用户节点的公钥。S4023. Calculate and obtain the public key of the user node according to the private key of the user node.

具体地,用户节点的公钥=用户节点的私钥·G。Specifically, the public key of the user node = the private key G of the user node.

S4024、根据加密后的血缘信息、第一监管授权信息以及用户节点的公钥,得到第一扩展公钥。S4024. Obtain a first extended public key according to the encrypted blood relationship information, the first supervisory authorization information, and the public key of the user node.

可选地,第一扩展公钥中还可以包括用户节点的链码、用户节点所在的层级等其他信息,本申请对此不作具体限定。Optionally, the first extended public key may also include other information such as the chain code of the user node and the level of the user node, which is not specifically limited in this application.

S403、使用用户节点的公钥对第一数据进行加密,得到第一密文。S403. Encrypt the first data by using the public key of the user node to obtain the first ciphertext.

其中,第一数据为用户节点待上传至区块链的第一敏感数据。Wherein, the first data is the first sensitive data to be uploaded to the block chain by the user node.

可以理解,由于用户节点的公钥和用户节点的私钥是成对的,使用用户节点的公钥对第一数据进行加密,得到第一密文,那么后续用户节点或者其他节点若想对第一密文进行解密得到第一数据,所使用的解密密钥需要为用户节点的私钥。It can be understood that since the public key of the user node and the private key of the user node are paired, and the first data is encrypted using the public key of the user node to obtain the first ciphertext, then if the subsequent user node or other nodes want to encrypt the first data A ciphertext is decrypted to obtain the first data, and the decryption key used needs to be the private key of the user node.

S404、上传第一扩展公钥和第一密文至区块链。S404. Upload the first extended public key and the first ciphertext to the blockchain.

在用户节点将第一扩展公钥和第一密文上传至区块链之后,区块链网络中的各节点均可以获取到第一扩展公钥和第一密文,由S403可知,区块链网络中的各节点若想对第一密文进行解密,所使用的解密密钥需要为用户节点的私钥。After the user node uploads the first extended public key and the first ciphertext to the blockchain, each node in the blockchain network can obtain the first extended public key and the first ciphertext. It can be seen from S403 that the block If each node in the chain network wants to decrypt the first ciphertext, the decryption key used needs to be the private key of the user node.

由S402中相关描述可知,区块链网络包括的用户节点的多个上级节点中的第一被授权的节点能够根据血缘信息重新生成用户节点的私钥,而多个上级节点中未被授权的节点无法根据血缘信息重新生成用户节点的私钥,以及用户节点的非上级节点无法根据血缘信息重新生成用户节点的私钥,因此,只有第一被授权的节点可以对第一密文进行解密得到第一数据,实现对第一数据的监管,而未被授权的节点无法监管第一数据。此外,还可知,用户节点上传至区块链中的第一扩展公钥包括的是加密后的血缘信息,即便未被授权的上级节点以及用户节点的非上级节点获取到第一扩展公钥,查看到的也仅仅是加密后的血缘信息,因此,可以解决现有技术存在的额外暴露了用户和其上级之间的归属关系的问题。It can be seen from the relevant description in S402 that the first authorized node among the multiple upper-level nodes of the user node included in the blockchain network can regenerate the private key of the user node according to blood relationship information, while the unauthorized one among the multiple upper-level nodes The node cannot regenerate the private key of the user node according to the blood relationship information, and the non-superior node of the user node cannot regenerate the private key of the user node according to the blood relationship information. Therefore, only the first authorized node can decrypt the first ciphertext to obtain The first data realizes the supervision of the first data, and unauthorized nodes cannot supervise the first data. In addition, it can also be known that the first extended public key uploaded by the user node to the blockchain includes encrypted blood relationship information, even if unauthorized upper-level nodes and non-superior nodes of the user node obtain the first extended public key, What is viewed is only the encrypted blood relationship information. Therefore, the problem of additionally exposing the affiliation relationship between the user and its superior can be solved in the prior art.

综上可知,根据图4及图5所示的本申请提供的加密方法,能够满足用户自定义监管上级的需求,以及解决现有技术存在的额外暴露了用户和其上级之间的归属关系的问题。In summary, according to the encryption method provided by this application shown in Figure 4 and Figure 5, it can meet the needs of users to customize their supervisory superiors, and solve the problem of additional exposure of the affiliation relationship between users and their superiors existing in the existing technology. question.

接下来,请参见图6,图6是本申请提供的另一种加密方法的流程示意图,该加密方法具体应用于图1所示的区块链网络中被用户节点授予了监管权限的上级节点,以下将被用户节点授予了监管权限的上级节点简称为监管节点。Next, please refer to Figure 6. Figure 6 is a schematic flow diagram of another encryption method provided by this application. This encryption method is specifically applied to the upper-level node in the blockchain network shown in Figure 1 that is granted supervisory authority by the user node , hereinafter, the upper-level node granted supervisory authority by the user node will be referred to as supervisory node for short.

如图6所示,该方法包括:As shown in Figure 6, the method includes:

S601、获取第一扩展公钥和第一密文,其中,第一扩展公钥包括加密后的血缘信息、第一监管授权信息以及用户节点的公钥,第一密文为用户节点使用自己的公钥对第一数据进行加密得到。S601. Obtain a first extended public key and a first ciphertext, wherein the first extended public key includes encrypted blood relationship information, first supervisory authorization information, and the public key of the user node, and the first ciphertext is the user node using its own The public key is obtained by encrypting the first data.

具体地,监管节点可以从区块链中获取第一扩展公钥和第一密文。Specifically, the supervisory node can obtain the first extended public key and the first ciphertext from the blockchain.

S602、根据第一监管授权信息还原得到第一解密密钥。S602. Restore and obtain the first decryption key according to the first supervisory authorization information.

S603、使用第一解密密钥对加密后的血缘信息进行解密,得到血缘信息。S603. Use the first decryption key to decrypt the encrypted blood relationship information to obtain the blood relationship information.

S604、根据血缘信息生成用户节点的私钥。S604. Generate a private key of the user node according to the blood relationship information.

S605、使用用户节点的私钥对第一密文进行解密,得到第一数据。S605. Decrypt the first ciphertext by using the private key of the user node to obtain the first data.

为了简便陈述,本实施例并没有对第一扩展公钥、第一密文、第一监管授权信息、第一解密密钥、血缘信息、用户节点的私钥、第一数据等概念进行详细的介绍,也没有对监管节点根据第一监管授权信息还原得到第一解密密钥、使用第一解密密钥对加密后的血缘信息进行解密得到血缘信息、根据血缘信息生成用户节点的私钥的过程等进行详细的介绍,具体请参见图4及图5实施例中相关描述。For the sake of brevity, this embodiment does not elaborate on concepts such as the first extended public key, the first ciphertext, the first supervisory authorization information, the first decryption key, blood relationship information, the private key of the user node, and the first data. Introduced, there is no process for the supervisory node to restore the first decryption key according to the first supervisory authorization information, use the first decryption key to decrypt the encrypted blood relationship information to obtain the blood relationship information, and generate the private key of the user node according to the blood relationship information etc. for detailed introduction, please refer to the relevant descriptions in the embodiment in FIG. 4 and FIG. 5 for details.

综上可知,根据图6所示的本申请提供的加密方法,监管节点通过获取用户节点的扩展公钥(包括加密后的血缘信息、定制的监管授权信息以及用户节点的公钥)以及使用用户节点的公钥加密敏感数据得到的敏感数据密文,然后监管节点可以根据扩展公钥重新生成用户节点的私钥,最后使用生成的私钥解密敏感数据密文得到对应的敏感数据,从而实现对用户节点上传至区块链的敏感数据的监管。In summary, according to the encryption method provided by this application shown in Figure 6, the supervisory node obtains the extended public key of the user node (including encrypted blood relationship information, customized regulatory authorization information, and the public key of the user node) and uses the user node The public key of the node encrypts the sensitive data ciphertext obtained by encrypting the sensitive data, and then the supervisory node can regenerate the private key of the user node according to the extended public key, and finally use the generated private key to decrypt the sensitive data ciphertext to obtain the corresponding sensitive data, so as to realize the Supervision of sensitive data uploaded by user nodes to the blockchain.

在图4及图5所示的本申请提供的加密方法中,用户节点还可以通过修改第一扩展公钥中的监管授权信息来动态增加或者删除监管节点,下面分别介绍这两个过程。In the encryption method provided by this application shown in Figure 4 and Figure 5, the user node can also dynamically add or delete supervisory nodes by modifying the supervisory authorization information in the first extended public key. The two processes are introduced below.

(一)增加监管节点(1) Adding supervision nodes

如图7所示,该过程可以包括如下步骤:As shown in Figure 7, the process may include the following steps:

S701、根据第一扩展公钥获取包括加密后的血缘信息、第二监管授权信息以及用户节点的公钥的第二扩展公钥。S701. Obtain, according to the first extended public key, a second extended public key including encrypted blood relationship information, second supervisory authorization information, and a public key of a user node.

其中,第二监管授权信息由用户节点对第一监管授权信息进行修改得到,第二监管授权信息用于供多个节点中的第二被授权的节点还原第一解密密钥,第二被授权的节点包括第一被授权的节点,第二被授权的节点数量大于第一被授权的节点数量,也就是说,第二监管授权信息不仅可以供多个节点中的第一被授权的节点还原第一解密密钥,还可以供第二被授权的节点中除第一被授权的节点之外的节点还原第一解密密钥,即增加了监管节点的数量。Wherein, the second supervisory authorization information is obtained by modifying the first supervisory authorization information by the user node, and the second supervisory authorization information is used for the second authorized node among the plurality of nodes to restore the first decryption key, and the second authorized The number of nodes includes the first authorized node, and the number of the second authorized node is greater than the number of the first authorized node, that is to say, the second supervisory authorization information can not only be restored by the first authorized node among the multiple nodes The first decryption key can also be used by nodes other than the first authorized node in the second authorized nodes to restore the first decryption key, that is, the number of supervisory nodes is increased.

继续以用户节点为节点1101、上级节点为节点110和节点100、第一被授权的节点为节点100、第一监管授权信息={R·G,Skey+R·PK100}为例,假设需要增加的监管节点为节点110,节点1101可以参考如下公式(5)得到第二监管授权信息:Continuing to take the user node as node 1101, the superior node as node 110 and node 100, the first authorized node as node 100, and the first regulatory authorization information = {R G, Skey+R PK 100 } as an example, assuming that The added supervision node is node 110, and node 1101 can refer to the following formula (5) to obtain the second supervision authorization information:

第二监管授权信息={R·G,Skey+R·PK100,Skey+R·PK110} (5)Second supervisory authorization information = {R G, Skey+R PK 100 , Skey+R PK 110 } (5)

当节点100获取到上述第二监管授权信息时,节点100可以继续参考上述S4022中的公式(2)还原第一解密密钥。When the node 100 obtains the above-mentioned second supervisory authorization information, the node 100 may continue to refer to the formula (2) in the above-mentioned S4022 to restore the first decryption key.

当节点110获取到上述第二监管授权信息时,节点110可以参考上述S4022中的公式(4)还原第一解密密钥。When the node 110 obtains the above-mentioned second supervisory authorization information, the node 110 may refer to the formula (4) in the above-mentioned S4022 to restore the first decryption key.

S702、使用用户节点的公钥对第二数据进行加密,获得第二密文。S702. Encrypt the second data by using the public key of the user node to obtain a second ciphertext.

S703、上传第二扩展公钥和第二密文至区块链。S703. Upload the second extended public key and the second ciphertext to the blockchain.

可以理解,在用户节点将第二扩展公钥和第二密文上传至区块链之后,除了之前已经被授权的上级节点(即第一被授权的节点)可以根据第二扩展公钥重新生成用户节点的私钥,使用用户节点的私钥解密第二密文得到第二数据,实现第二数据的监管之外,新增的监管节点也可以根据第二扩展公钥重新生成用户节点的私钥,使用用户节点的私钥解密第二密文得到第二数据,实现第二数据的监管。It can be understood that after the user node uploads the second extended public key and the second ciphertext to the blockchain, except for the previously authorized upper-level nodes (that is, the first authorized node) can regenerate the second extended public key according to the second extended public key The private key of the user node, using the private key of the user node to decrypt the second ciphertext to obtain the second data, in addition to realizing the supervision of the second data, the newly added supervisory node can also regenerate the private key of the user node according to the second extended public key. key, use the private key of the user node to decrypt the second ciphertext to obtain the second data, and realize the supervision of the second data.

可以理解,在用户节点将第二扩展公钥和第二密文上传至区块链之后,区块链网络中的各节点均可以获取到第二扩展公钥和第二密文,但是由于第二密文为用户节点使用自己的公钥加密得到,用户节点的私钥仅由第二被授权的节点可以根据血缘信息重新生成,而未被授权的节点无法生成,因此,未被授权的节点不可以解密第二密文得到第二数据。It can be understood that after the user node uploads the second extended public key and the second ciphertext to the blockchain, each node in the blockchain network can obtain the second extended public key and the second ciphertext, but due to the The second ciphertext is encrypted by the user node using its own public key. The private key of the user node can only be regenerated by the second authorized node based on the blood relationship information, but the unauthorized node cannot generate it. Therefore, the unauthorized node It is not possible to decrypt the second ciphertext to obtain the second data.

需要说明的是,图7所示的增加监管节点的过程仅仅是作为一种示例,例如,在具体实现中,用户节点根据第一扩展公钥获取的可以是包括使用第三解密密钥加密后的血缘信息、第四监管授权信息以及用户节点的公钥的第四扩展公钥,其中,第四监管授权信息由用户节点对第一监管授权信息进行修改得到,第四监管授权信息用于供多个节点中的第二被授权的节点还原第三解密密钥。It should be noted that the process of adding a supervisory node shown in Figure 7 is only an example. For example, in a specific implementation, the user node may obtain the encrypted data using the third decryption key according to the first extended public key. The blood relationship information, the fourth regulatory authorization information and the fourth extended public key of the public key of the user node, wherein the fourth regulatory authorization information is obtained by modifying the first regulatory authorization information by the user node, and the fourth regulatory authorization information is used for the A second authorized node of the plurality of nodes restores the third decryption key.

(二)删除监管节点(2) Delete the supervision node

如图8所示,该过程可以包括如下步骤:As shown in Figure 8, the process may include the following steps:

S801、根据第一扩展公钥获取包括重新加密后的血缘信息、第三监管授权信息以及用户节点的公钥的第三扩展公钥。S801. Obtain, according to the first extended public key, a third extended public key including re-encrypted blood relationship information, third supervisory authorization information, and a public key of a user node.

其中,第三监管授权信息由用户节点对第一监管授权信息进行修改得到,第三监管授权信息用于供多个节点中的第三被授权的节点还原第二解密密钥,第二解密密钥用于对重新加密后的血缘信息进行解密,第三被授权的节点属于第一被授权的节点,第三被授权的节点数量小于第一被授权的节点数量,也就是说,第三监管授权信息仅可以供第一被授权的节点中的第三被授权的节点还原第二解密密钥,除第三被授权的节点之外的节点不能还原第二解密密钥,即减少了监管节点的数量。Wherein, the third supervisory authorization information is obtained by modifying the first supervisory authorization information by the user node, and the third supervisory authorization information is used for the third authorized node among the plurality of nodes to recover the second decryption key, and the second decryption key The key is used to decrypt the re-encrypted blood relationship information, the third authorized node belongs to the first authorized node, and the number of third authorized nodes is less than the number of first authorized nodes, that is to say, the third supervisory Authorization information can only be used by the third authorized node in the first authorized node to restore the second decryption key, and nodes other than the third authorized node cannot restore the second decryption key, which reduces the number of supervisory nodes quantity.

继续以用户节点为节点1101、上级节点为节点110和节点100、第一被授权的节点为节点100和节点1101、第一监管授权信息={R·G,Skey+R·PK100,Skey+R·PK110}为例,假设需要删除的监管节点为节点110,节点1101可以参考如下公式(6)得到第三监管授权信息:Continue to use the user node as node 1101, the superior node as node 110 and node 100, the first authorized node as node 100 and node 1101, the first supervisory authorization information = {R·G, Skey+R·PK 100 , Skey+ R·PK 110 } as an example, assuming that the supervisory node to be deleted is node 110, node 1101 can refer to the following formula (6) to obtain the third supervisory authorization information:

第三监管授权信息={R·G,Skey+R·PK100} (6)Third supervisory authorization information = {R G, Skey+R PK 100 } (6)

当节点100获取到上述第三监管授权信息时,节点100可以继续参考上述S4022中的公式(2)还原第一解密密钥。When the node 100 obtains the above-mentioned third supervisory authorization information, the node 100 may continue to refer to the formula (2) in the above-mentioned S4022 to restore the first decryption key.

当节点110获取到上述第三监管授权信息时,由于节点110的监管权限被删除,所以节点110无法根据第三监管授权信息还原第二解密密钥。When the node 110 acquires the above-mentioned third supervision authorization information, since the supervision authority of the node 110 is deleted, the node 110 cannot recover the second decryption key according to the third supervision authorization information.

S802、使用用户节点的公钥对第三数据进行加密,获得第三密文。S802. Encrypt the third data by using the public key of the user node to obtain a third ciphertext.

S803、上传第三扩展公钥和第三密文至区块链。S803. Upload the third extended public key and the third ciphertext to the blockchain.

可以理解,在用户节点将第三扩展公钥和第三密文上传至区块链之后,区块链网络中的各节点均可以获取到第三扩展公钥和第三密文,但是由于第三密文为用户节点使用自己的公钥加密得到,用户节点的私钥仅由第三被授权的节点可以根据血缘信息重新生成,而未被授权的节点无法生成,因此,第三被授权的节点可以解密第三密文得到第三数据,实现第三数据的监管,而未被授权的节点不可以解密第三密文得到第三数据。It can be understood that after the user node uploads the third extended public key and the third ciphertext to the blockchain, each node in the blockchain network can obtain the third extended public key and the third ciphertext, but due to the The three ciphertexts are obtained by encrypting the user node with its own public key. The private key of the user node can only be regenerated by the third authorized node based on the blood relationship information, but cannot be generated by the unauthorized node. Therefore, the third authorized node Nodes can decrypt the third ciphertext to obtain the third data, and realize the supervision of the third data, while unauthorized nodes cannot decrypt the third ciphertext to obtain the third data.

为了简便陈述,图7以及图8所示的实施例均未对被授权的节点根据第二扩展公钥/第三扩展公钥重新生成用户节点的私钥,解密第二密文/第三密文的过程进行详细介绍,该过程与图6所示实施例所述的监管节点根据第一扩展公钥重新生成用户节点的私钥,解密第一密文的过程相类似,具体可以参考图6所示实施例相关描述,此处不再展开赘述。For simplicity, the embodiments shown in Fig. 7 and Fig. 8 do not regenerate the private key of the user node according to the second extended public key/third extended public key to the authorized node, and decrypt the second ciphertext/third ciphertext. The process described in the text is described in detail. This process is similar to the process in which the supervisory node regenerates the private key of the user node according to the first extended public key and decrypts the first ciphertext described in the embodiment shown in FIG. 6. For details, please refer to FIG. 6 Relevant descriptions of the illustrated embodiments will not be repeated here.

综上可知,通过本申请提供的加密方法,用户节点还可以通过修改扩展公钥中的监管授权信息来动态增加或者删除监管节点,灵活性强,能够优化用户的体验。In summary, through the encryption method provided by this application, user nodes can also dynamically add or delete supervisory nodes by modifying the supervisory authorization information in the extended public key, which is highly flexible and can optimize user experience.

上文详细阐述了本申请实施例的方法,为了便于更好的实施本申请实施例上述方案,相应地,下面还提供用于配合实施上述方案的相关设备。The method of the embodiment of the present application has been described in detail above. In order to facilitate better implementation of the above-mentioned solution of the embodiment of the present application, correspondingly, the following also provides related equipment for cooperating with the implementation of the above-mentioned solution.

参见图9,图9是本申请提供的一种加密装置900的结构示意图,装置900可以应用于图1所示的区块链网络中需要上传敏感数据至区块链的用户节点,用户节点可以是个人计算机、终端设备等,此处不作具体限定。Referring to Fig. 9, Fig. 9 is a schematic structural diagram of an encryption device 900 provided by the present application. The device 900 can be applied to a user node in the blockchain network shown in Fig. 1 that needs to upload sensitive data to the blockchain. The user node can It is a personal computer, a terminal device, etc., and is not specifically limited here.

如图9所示,本申请提供的装置900包括:获取模块910、加密模块920和上链模块930,其中,As shown in Figure 9, the device 900 provided by this application includes: an acquisition module 910, an encryption module 920, and an uplink module 930, wherein,

获取模块910,用于获取第一扩展公钥,其中,第一扩展公钥包括加密后的血缘信息、第一监管授权信息以及用户节点的公钥,血缘信息反映多个节点(指用户节点的上级节点,包括直接上级节点和间接上级节点)的私钥与用户节点的私钥之间的关联关系,第一监管授权信息用于供多个节点中的第一被授权的节点还原第一解密密钥,第一解密密钥用于对加密后的血缘信息进行解密。Obtaining module 910, configured to obtain a first extended public key, wherein the first extended public key includes encrypted blood relationship information, first supervisory authorization information, and a public key of a user node, and the blood relationship information reflects multiple nodes (referring to the user node's The relationship between the private key of the upper-level node (including the direct upper-level node and the indirect upper-level node) and the private key of the user node, the first supervisory authorization information is used for the first authorized node among the multiple nodes to restore the first decryption Key, the first decryption key is used to decrypt the encrypted blood relationship information.

加密模块920,用于使用用户节点的公钥对第一数据进行加密,从而获得第一密文。An encryption module 920, configured to use the public key of the user node to encrypt the first data, so as to obtain the first ciphertext.

上链模块930,用于上传第一扩展公钥和第一密文至区块链。An uploading module 930, configured to upload the first extended public key and the first ciphertext to the blockchain.

在一种可能的实现方式中,获取模块910,还用于根据第一扩展公钥获取第二扩展公钥,加密模块920,还用于使用用户节点的公钥对第二数据进行加密,从而获得第二密文,上链模块930,还用于上传第二扩展公钥和第二密文至区块链。其中,第二扩展公钥包括加密后的血缘信息、第二监管授权信息以及用户节点的公钥,第二监管授权信息用于供多个节点中的第二被授权的节点还原第一解密密钥,第二被授权的节点包括第一被授权的节点,第二被授权的节点数量大于第一被授权的节点数量。In a possible implementation manner, the obtaining module 910 is further configured to obtain the second extended public key according to the first extended public key, and the encryption module 920 is further configured to use the public key of the user node to encrypt the second data, thereby To obtain the second ciphertext, the uploading module 930 is also used to upload the second extended public key and the second ciphertext to the blockchain. Wherein, the second extended public key includes encrypted blood relationship information, second supervisory authorization information and the public key of the user node, and the second supervisory authorization information is used for the second authorized node among the plurality of nodes to restore the first decryption key. key, the second authorized nodes include the first authorized nodes, and the number of the second authorized nodes is greater than the number of the first authorized nodes.

在一种可能的实现方式中,获取模块910,还用于根据第一扩展公钥获取第三扩展公钥,加密模块920,还用于使用用户节点的公钥对第三数据进行加密,从而获得第三密文,上链模块930,还用于上传第三扩展公钥和第三密文至区块链。其中,第三扩展公钥包括重新加密后的血缘信息、第三监管授权信息以及用户节点的公钥,第三监管授权信息用于供多个节点中的第三被授权的节点还原第二解密密钥,第二解密密钥用于对重新加密后的血缘信息进行解密,第三被授权的节点属于第一被授权的节点,第三被授权的节点数量小于第一被授权的节点数量。In a possible implementation manner, the obtaining module 910 is further configured to obtain the third extended public key according to the first extended public key, and the encryption module 920 is further configured to use the public key of the user node to encrypt the third data, thereby To obtain the third ciphertext, the uploading module 930 is also used to upload the third extended public key and the third ciphertext to the blockchain. Wherein, the third extended public key includes the re-encrypted blood relationship information, the third supervisory authorization information and the public key of the user node, and the third supervisory authorization information is used for the third authorized node among the plurality of nodes to restore the second decryption key, the second decryption key is used to decrypt the re-encrypted blood relationship information, the third authorized node belongs to the first authorized node, and the number of the third authorized nodes is less than the number of the first authorized nodes.

在一种可能的实现方式中,获取模块910,具体用于:首先,获取扩展私钥,扩展私钥包括血缘信息以及用户节点的私钥,然后使用第一解密密钥加密血缘信息,得到加密后的血缘信息,使用第一被授权的节点的公钥加密第一解密密钥,得到第一监管授权信息,并根据用户节点的私钥,计算得到用户节点的公钥,最后根据用户节点的公钥、加密后的血缘信息以及第一监管授权信息,得到第一扩展公钥。In a possible implementation, the acquiring module 910 is specifically configured to: firstly, acquire the extended private key, which includes the blood relationship information and the private key of the user node, and then use the first decryption key to encrypt the blood relationship information to obtain the encrypted After the consanguinity information, use the public key of the first authorized node to encrypt the first decryption key to obtain the first supervisory authorization information, and calculate the public key of the user node according to the private key of the user node, and finally according to the user node’s The public key, the encrypted blood relationship information and the first regulatory authorization information are used to obtain the first extended public key.

在一种可能的实现方式中,加密后的血缘信息包括加密后的用户节点的编号以及加密后的多个节点的编号。In a possible implementation manner, the encrypted blood relationship information includes the encrypted number of the user node and the encrypted numbers of multiple nodes.

参见图10,图10是本申请提供的另一种加密装置1000的结构示意图,装置1000可以应用于图1所示的区块链网络中被用户节点授予了监管权限的监管节点,监管节点可以是个人计算机、终端设备等,此处不作具体限定。Referring to Fig. 10, Fig. 10 is a schematic structural diagram of another encryption device 1000 provided by the present application. The device 1000 can be applied to a supervisory node granted supervisory authority by a user node in the blockchain network shown in Fig. 1. The supervisory node can It is a personal computer, a terminal device, etc., and is not specifically limited here.

如图10所示,本申请提供的装置1000包括:获取模块1010和解密模块1020,其中,As shown in Figure 10, the device 1000 provided by this application includes: an acquisition module 1010 and a decryption module 1020, wherein,

获取模块1010,用于获取扩展公钥(如上文第一扩展公钥、第二扩展公钥、第三公钥)和密文(如上文第一密文、第二密文、第三密文),其中,扩展公钥包括加密后的血缘信息、监管授权信息(如上文第一监管授权信息、第二监管授权信息、第三监管授权信息)以及用户节点的公钥,血缘信息反映多个节点的私钥与用户节点的私钥之间的关联关系,监管授权信息用于供多个节点中的被授权的节点还原解密密钥,解密密钥用于对加密后的血缘信息进行解密,密文为用户节点使用用户节点的公钥对目标数据(如上文第一数据、第二数据、第三数据)进行加密得到,监管节点属于被授权的节点。Obtaining module 1010, used to acquire extended public key (such as above first extended public key, second extended public key, third public key) and ciphertext (such as above first ciphertext, second ciphertext, third ciphertext ), where the extended public key includes encrypted blood relationship information, regulatory authorization information (such as the first regulatory authorization information, second regulatory authorization information, and third regulatory authorization information above) and the public key of the user node. The blood relationship information reflects multiple The relationship between the private key of the node and the private key of the user node, the supervisory authorization information is used to restore the decryption key for the authorized node among multiple nodes, and the decryption key is used to decrypt the encrypted blood relationship information, The ciphertext is obtained by encrypting the target data (such as the first data, second data, and third data above) with the public key of the user node, and the supervision node belongs to the authorized node.

解密模块1020,用于根据扩展公钥对密文进行解密,从而得到目标数据。Decryption module 1020, configured to decrypt the ciphertext according to the extended public key, so as to obtain the target data.

在一种可能的实现方式中,解密模块1020,具体用于:首先,根据监管授权信息还原解密密钥,然后使用解密密钥对加密后的血缘信息进行解密,得到血缘信息,并根据血缘信息,生成用户节点的私钥,最后使用用户节点的私钥对密文进行解密,得到目标数据。In a possible implementation manner, the decryption module 1020 is specifically configured to: firstly, restore the decryption key according to the regulatory authorization information, and then use the decryption key to decrypt the encrypted blood relationship information to obtain the blood relationship information, and according to the blood relationship information , generate the private key of the user node, and finally use the private key of the user node to decrypt the ciphertext to obtain the target data.

在一种可能的实现方式中,监管授权信息为用户节点根据被授权的节点的公钥对解密密钥进行加密得到。In a possible implementation manner, the supervisory authorization information is obtained by the user node encrypting the decryption key according to the public key of the authorized node.

在一种可能的实现方式中,加密后的血缘信息包括加密后的用户节点的编号以及加密后的多个节点的编号。In a possible implementation manner, the encrypted blood relationship information includes the encrypted number of the user node and the encrypted numbers of multiple nodes.

具体地,图9所示装置900以及图10所示装置1000执行各种操作的具体实现,可参照上述加密方法实施例中相关内容中的描述,为了说明书的简洁,这里不再赘述。Specifically, for the implementation of various operations performed by the device 900 shown in FIG. 9 and the device 1000 shown in FIG. 10 , refer to the description in the relevant content in the above-mentioned encryption method embodiment. For the sake of brevity, details are not repeated here.

应当理解,图9所示装置900以及图10所示装置1000仅为本申请实施例提供的一个例子,并且,图9所示装置900可具有比图9示出的部件更多或更少的部件,可以组合两个或更多个部件,或者可具有部件的不同配置实现,图10所示装置1000可具有比图10示出的部件更多或更少的部件,可以组合两个或更多个部件,或者可具有部件的不同配置实现。It should be understood that the device 900 shown in FIG. 9 and the device 1000 shown in FIG. 10 are only an example provided by the embodiment of the present application, and the device 900 shown in FIG. 9 may have more or fewer components than those shown in FIG. 9 Components, two or more components can be combined, or can be implemented with different configurations of components, the device 1000 shown in Figure 10 can have more or fewer components than those shown in Figure 10, and two or more components can be combined multiple components, or may have different configurations of components.

参见图11,图11是本申请提供的一种计算设备1100的结构示意图,计算设备1100包括:处理器1110、存储器1120和通信接口1130,其中,处理器1110、存储器1120、通信接口1130之间可以通过总线1140相互连接。其中,Referring to FIG. 11 , FIG. 11 is a schematic structural diagram of a computing device 1100 provided in the present application. The computing device 1100 includes: a processor 1110 , a memory 1120 and a communication interface 1130 . Can be connected to each other through the bus 1140 . in,

处理器1110可以读取存储器1120中存储的程序代码(包括指令),执行存储器1120中存储的程序代码,使得计算设备1100执行上述方法实施例提供的加密方法中的步骤,或者使得计算设备1100部署加密装置900和/或加密装置1000。The processor 1110 may read the program code (including instructions) stored in the memory 1120, and execute the program code stored in the memory 1120, so that the computing device 1100 executes the steps in the encryption method provided by the above method embodiments, or makes the computing device 1100 deploy The encryption device 900 and/or the encryption device 1000 .

处理器1110可以有多种具体实现形式,例如中央处理单元(central processingunit,CPU),或者CPU和硬件芯片的组合。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,ASIC)、可编程逻辑器件(programmable logic device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex programmable logicdevice,CPLD)、现场可编程逻辑门阵列(field-programmable gate array,FPGA)、通用阵列逻辑(generic array logic,GAL)或其任意组合。处理器1110执行各种类型的数字存储指令,例如存储在存储器1120中的软件或者固件程序,它能使计算设备1100提供多种服务。The processor 1110 may have multiple specific implementation forms, such as a central processing unit (central processing unit, CPU), or a combination of a CPU and a hardware chip. The aforementioned hardware chip may be an application-specific integrated circuit (application-specific integrated circuit, ASIC), a programmable logic device (programmable logic device, PLD) or a combination thereof. The aforementioned PLD may be a complex programmable logic device (complex programmable logic device, CPLD), a field-programmable gate array (field-programmable gate array, FPGA), a general array logic (generic array logic, GAL) or any combination thereof. Processor 1110 executes various types of digitally stored instructions, such as software or firmware programs stored in memory 1120, which enable computing device 1100 to provide various services.

存储器1120用于存储程序代码,并由处理器1110来控制执行,以执行上述图4-图8中任一实施例中用户节点或者监管节点的处理步骤。程序代码中可以包括一个或多个软件模块,这一个或多个软件模块可以为图9实施例中提供的软件模块,如获取模块910、加密模块920和上链模块930,具体可用于执行图4实施例中的步骤S401~步骤S404、图5实施例中的步骤S4021~步骤S4024、图7实施例中的步骤S701~步骤S703和图8实施例中的步骤S801~步骤S803,这里不再进行赘述。或者,这一个或多个软件模块可以为图10实施例中提供的软件模块,如获取模块1010和解密模块1020,具体可用于执行图6实施例中的步骤S601~步骤S605,这里不再进行赘述。The memory 1120 is used to store program codes, which are controlled and executed by the processor 1110, so as to execute the processing steps of the user node or supervisory node in any of the above-mentioned embodiments in FIG. 4-FIG. 8 . The program code may include one or more software modules, and the one or more software modules may be the software modules provided in the embodiment of FIG. Steps S401 to S404 in the embodiment, steps S4021 to S4024 in the embodiment in FIG. 5, steps S701 to S703 in the embodiment in FIG. 7, and steps S801 to S803 in the embodiment in FIG. to repeat. Alternatively, the one or more software modules may be the software modules provided in the embodiment of FIG. 10, such as the acquisition module 1010 and the decryption module 1020, which may be specifically used to execute steps S601 to S605 in the embodiment of FIG. 6, which will not be repeated here. repeat.

存储器1120可以包括易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM);存储器1120也可以包括非易失性存储器(non-volatilememory),例如只读存储器(read-only memory,ROM)、快闪存储器(flash memory)、硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD);存储器1120还可以包括上述种类的组合。The memory 1120 may include a volatile memory (volatile memory), such as a random access memory (random access memory, RAM); the memory 1120 may also include a non-volatile memory (non-volatile memory), such as a read-only memory (read-only memory, ROM), flash memory (flash memory), hard disk (hard disk drive, HDD) or solid-state drive (solid-state drive, SSD); the memory 1120 may also include a combination of the above types.

通信接口1130可以为有线接口(例如以太网接口、光纤接口、其他类型接口(例如,infiniBand接口))或无线接口(例如蜂窝网络接口或使用无线局域网接口),用于与其他计算设备或装置进行通信。通信接口1130可以采用传输控制协议/网际协议(transmissioncontrol protocol/internet protocol,TCP/IP)之上的协议族,例如,远程函数调用(remote function call,RFC)协议、简单对象访问协议(simple object accessprotocol,SOAP)协议、简单网络管理协议(simple network management protocol,SNMP)协议、公共对象请求代理体系结构(common object request broker architecture,CORBA)协议以及分布式协议等等。The communication interface 1130 can be a wired interface (such as an Ethernet interface, a fiber optic interface, other types of interfaces (such as an infiniBand interface)) or a wireless interface (such as a cellular network interface or using a wireless local area network interface) for communicating with other computing devices or devices. communication. The communication interface 1130 can adopt a protocol family above the transmission control protocol/internet protocol (transmission control protocol/internet protocol, TCP/IP), for example, a remote function call (remote function call, RFC) protocol, a simple object access protocol (simple object access protocol) , SOAP) protocol, simple network management protocol (simple network management protocol, SNMP) protocol, common object request broker architecture (common object request broker architecture, CORBA) protocol and distributed protocols, etc.

总线1140可以是快捷外围部件互连标准(peripheral component interconnectexpress,PCIe)总线,或扩展工业标准结构(extended industry standard architecture,EISA)总线、统一总线(unified bus,Ubus或UB)、计算机快速链接(compute express link,CXL)、缓存一致互联协议(cache coherent interconnect for accelerators,CCIX)等。总线1140可以分为地址总线、数据总线、控制总线等。总线1140除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线1140。为便于表示,图11中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 1140 can be a peripheral component interconnect express (PCIe) bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a computer fast link (compute express link, CXL), cache coherent interconnect for accelerators (CCIX), etc. The bus 1140 can be divided into an address bus, a data bus, a control bus, and the like. In addition to the data bus, the bus 1140 may also include a power bus, a control bus, a status signal bus, and the like. However, for clarity of illustration, the various buses are labeled as bus 1140 in the figure. For ease of representation, only one thick line is used in FIG. 11 , but it does not mean that there is only one bus or one type of bus.

上述计算设备1100用于执行上述加密方法实施例中执行的方法,与上述方法实施例属于同一构思,其具体实现过程详见上述方法实施例,这里不再赘述。The above-mentioned computing device 1100 is used to execute the method executed in the above-mentioned encryption method embodiment, which belongs to the same concept as the above-mentioned method embodiment, and its specific implementation process is detailed in the above-mentioned method embodiment, and will not be repeated here.

应当理解,计算设备1100仅为本申请实施例提供的一个例子,并且,计算设备1100可具有比图11示出的部件更多或更少的部件,可以组合两个或更多个部件,或者可具有部件的不同配置实现。It should be understood that the computing device 1100 is only an example provided by the embodiment of the present application, and the computing device 1100 may have more or fewer components than those shown in FIG. 11 , and two or more components may be combined, or It can be realized with different configurations of components.

本申请还提供一种计算机可读存储介质,计算机可读存储介质中存储有指令,该指令被运行时可以实现上述实施例中记载的加密方法的部分或者全部步骤。The present application also provides a computer-readable storage medium, in which instructions are stored, and when the instructions are executed, some or all steps of the encryption method described in the above-mentioned embodiments can be implemented.

本申请还提供一种计算机程序产品,当计算机程序产品被计算机读取并执行时,可以实现上述方法实施例中记载的密方法的部分或者全部步骤。The present application also provides a computer program product. When the computer program product is read and executed by a computer, some or all steps of the encryption method described in the above method embodiments can be realized.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.

在上述实施例中,可以全部或部分地通过软件、硬件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如软盘、硬盘、磁带)、光介质、或者半导体介质等。In the above-mentioned embodiments, all or part may be implemented by software, hardware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (eg, coaxial cable, optical fiber, DSL) or wireless (eg, infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium, or a semiconductor medium.

以上所述,仅为本申请的具体实施方式。熟悉本技术领域的技术人员根据本申请提供的具体实施方式,可想到变化或替换,都应涵盖在本申请的保护范围之内。The foregoing is only a specific implementation manner of the present application. Those skilled in the art may conceive changes or substitutions based on the specific implementation methods provided in this application, and all of them shall fall within the protection scope of this application.

Claims (17)

1.一种加密方法,其特征在于,所述方法应用于区块链网络中的用户节点,包括:1. An encryption method, characterized in that, the method is applied to a user node in a block chain network, comprising: 获取第一扩展公钥,其中,所述第一扩展公钥包括加密后的血缘信息、第一监管授权信息以及所述用户节点的公钥,所述血缘信息反映多个节点的私钥与所述用户节点的私钥之间的关联关系,所述第一监管授权信息用于供所述多个节点中的第一被授权的节点还原第一解密密钥,所述第一解密密钥用于对所述加密后的血缘信息进行解密;Obtaining a first extended public key, wherein the first extended public key includes encrypted blood relationship information, first supervisory authorization information, and the public key of the user node, and the blood relationship information reflects the relationship between the private keys of multiple nodes and the The association relationship between the private keys of the user nodes, the first supervisory authorization information is used for the first authorized node among the plurality of nodes to restore the first decryption key, and the first decryption key is used Decrypting the encrypted blood relationship information; 使用所述用户节点的公钥对第一数据进行加密,从而获得第一密文;encrypting the first data by using the public key of the user node, so as to obtain the first ciphertext; 上传所述第一扩展公钥和所述第一密文至区块链。uploading the first extended public key and the first ciphertext to a block chain. 2.根据权利要求1所述的方法,其特征在于,所述方法还包括:2. The method according to claim 1, characterized in that the method further comprises: 根据所述第一扩展公钥获取第二扩展公钥,其中,所述第二扩展公钥包括加密后的血缘信息、第二监管授权信息以及所述用户节点的公钥,所述第二监管授权信息用于供所述多个节点中的第二被授权的节点还原所述第一解密密钥,所述第二被授权的节点包括所述第一被授权的节点,所述第二被授权的节点数量大于所述第一被授权的节点数量;Obtain a second extended public key according to the first extended public key, where the second extended public key includes encrypted blood relationship information, second supervision authorization information, and the public key of the user node, and the second supervision The authorization information is used for restoring the first decryption key by a second authorized node among the plurality of nodes, the second authorized node includes the first authorized node, and the second authorized node The authorized number of nodes is greater than the first authorized number of nodes; 使用所述用户节点的公钥对第二数据进行加密,从而获得第二密文;encrypting the second data by using the public key of the user node, so as to obtain the second ciphertext; 上传所述第二扩展公钥和所述第二密文至所述区块链。uploading the second extended public key and the second ciphertext to the block chain. 3.根据权利要求1所述的方法,其特征在于,所述方法还包括:3. The method according to claim 1, wherein the method further comprises: 根据所述第一扩展公钥获取第三扩展公钥,其中,所述第三扩展公钥包括重新加密后的血缘信息、第三监管授权信息以及所述用户节点的公钥,所述第三监管授权信息用于供所述多个节点中的第三被授权的节点还原第二解密密钥,所述第二解密密钥用于对所述重新加密后的血缘信息进行解密,所述第三被授权的节点属于所述第一被授权的节点,所述第三被授权的节点数量小于所述第一被授权的节点数量;Obtain a third extended public key according to the first extended public key, wherein the third extended public key includes re-encrypted blood relationship information, third supervisory authorization information, and the public key of the user node, the third extended public key The supervisory authorization information is used for the third authorized node among the plurality of nodes to restore the second decryption key, and the second decryption key is used for decrypting the re-encrypted blood relationship information, and the first Three authorized nodes belong to the first authorized node, and the third authorized node number is smaller than the first authorized node number; 使用所述用户节点的公钥对第三数据进行加密,从而获得第三密文;encrypting the third data by using the public key of the user node, so as to obtain the third ciphertext; 上传所述第三扩展公钥和所述第三密文至所述区块链。uploading the third extended public key and the third ciphertext to the block chain. 4.根据权利要求1至3任一项所述的方法,其特征在于,所述获取第一扩展公钥,包括:4. The method according to any one of claims 1 to 3, wherein said acquiring the first extended public key comprises: 获取扩展私钥,所述扩展私钥包括所述血缘信息以及所述用户节点的私钥;Obtain an extended private key, where the extended private key includes the blood relationship information and the private key of the user node; 使用第一解密密钥加密所述血缘信息,得到所述加密后的血缘信息;Encrypting the blood relationship information using a first decryption key to obtain the encrypted blood relationship information; 使用所述第一被授权的节点的公钥加密所述第一解密密钥,得到所述第一监管授权信息;Encrypting the first decryption key using the public key of the first authorized node to obtain the first supervisory authorization information; 根据所述用户节点的私钥,计算得到所述用户节点的公钥;According to the private key of the user node, calculate the public key of the user node; 根据所述用户节点的公钥、所述加密后的血缘信息以及所述第一监管授权信息,得到第一扩展公钥。A first extended public key is obtained according to the public key of the user node, the encrypted blood relationship information, and the first supervisory authorization information. 5.根据权利要求1至4任一项所述的方法,其特征在于,所述加密后的血缘信息包括加密后的用户节点的编号以及加密后的多个节点的编号。5. The method according to any one of claims 1 to 4, wherein the encrypted blood relationship information includes the encrypted user node number and the encrypted multiple node numbers. 6.一种加密方法,其特征在于,所述方法应用于区块链网络中的监管节点,包括:6. An encryption method, characterized in that the method is applied to a supervisory node in a block chain network, comprising: 获取扩展公钥和密文,其中,所述扩展公钥包括加密后的血缘信息、监管授权信息以及用户节点的公钥,所述血缘信息反映多个节点的私钥与所述用户节点的私钥之间的关联关系,所述监管授权信息用于供所述多个节点中的被授权的节点还原解密密钥,所述解密密钥用于对所述加密后的血缘信息进行解密,所述密文为所述用户节点使用所述用户节点的公钥对目标数据进行加密得到,所述监管节点属于所述被授权的节点;Obtain the extended public key and ciphertext, wherein the extended public key includes encrypted lineage information, supervisory authorization information, and the public key of the user node, and the lineage information reflects the private keys of multiple nodes and the private key of the user node. The association relationship between keys, the supervisory authorization information is used for the authorized nodes among the multiple nodes to restore the decryption key, and the decryption key is used to decrypt the encrypted blood relationship information, so The ciphertext is obtained by encrypting the target data by the user node using the public key of the user node, and the supervisory node belongs to the authorized node; 根据所述扩展公钥对所述密文进行解密,从而得到所述目标数据。Decrypt the ciphertext according to the extended public key to obtain the target data. 7.根据权利要求6所述的方法,其特征在于,所述根据所述扩展公钥对所述密文进行解密,从而得到所述目标数据,包括:7. The method according to claim 6, wherein the decrypting the ciphertext according to the extended public key to obtain the target data comprises: 根据所述监管授权信息还原所述解密密钥;recovering the decryption key based on the supervisory authorization information; 使用所述解密密钥对所述加密后的血缘信息进行解密,得到所述血缘信息;Decrypting the encrypted blood relationship information using the decryption key to obtain the blood relationship information; 根据所述血缘信息,生成所述用户节点的私钥;generating a private key of the user node according to the blood relationship information; 使用所述用户节点的私钥对所述密文进行解密,得到所述目标数据。Decrypt the ciphertext by using the private key of the user node to obtain the target data. 8.根据权利要求6或7所述的方法,其特征在于,所述监管授权信息为所述用户节点根据所述被授权的节点的公钥对所述解密密钥进行加密得到。8. The method according to claim 6 or 7, wherein the supervisory authorization information is obtained by the user node encrypting the decryption key according to the public key of the authorized node. 9.根据权利要求6至8任一项所述的方法,其特征在于,所述加密后的血缘信息包括加密后的用户节点的编号以及加密后的多个节点的编号。9. The method according to any one of claims 6 to 8, wherein the encrypted blood relationship information includes the encrypted user node number and the encrypted multiple node numbers. 10.一种加密装置,其特征在于,所述装置应用于区块链网络中的用户节点,包括:10. An encryption device, characterized in that the device is applied to a user node in a block chain network, comprising: 获取模块,用于获取第一扩展公钥,其中,所述第一扩展公钥包括加密后的血缘信息、第一监管授权信息以及所述用户节点的公钥,所述血缘信息反映多个节点的私钥与所述用户节点的私钥之间的关联关系,所述第一监管授权信息用于供所述多个节点中的第一被授权的节点还原第一解密密钥,所述第一解密密钥用于对所述加密后的血缘信息进行解密;An acquisition module, configured to acquire a first extended public key, wherein the first extended public key includes encrypted blood relationship information, first supervisory authorization information, and the public key of the user node, and the blood relationship information reflects multiple nodes The association relationship between the private key of the user node and the private key of the user node, the first supervisory authorization information is used for the first authorized node among the plurality of nodes to recover the first decryption key, and the first A decryption key is used to decrypt the encrypted blood relationship information; 加密模块,用于使用所述用户节点的公钥对第一数据进行加密,从而获得第一密文;An encryption module, configured to use the public key of the user node to encrypt the first data, so as to obtain the first ciphertext; 上链模块,用于上传所述第一扩展公钥和所述第一密文至区块链。An uploading module, configured to upload the first extended public key and the first ciphertext to the block chain. 11.根据权利要求10所述的装置,其特征在于,11. The apparatus of claim 10, wherein: 所述获取模块,还用于根据所述第一扩展公钥获取第二扩展公钥,其中,所述第二扩展公钥包括加密后的血缘信息、第二监管授权信息以及所述用户节点的公钥,所述第二监管授权信息用于供所述多个节点中的第二被授权的节点还原所述第一解密密钥,所述第二被授权的节点包括所述第一被授权的节点,所述第二被授权的节点数量大于所述第一被授权的节点数量;The obtaining module is further configured to obtain a second extended public key according to the first extended public key, wherein the second extended public key includes encrypted blood relationship information, second supervisory authorization information, and the user node's a public key, the second supervisory authorization information is used to recover the first decryption key by a second authorized node of the plurality of nodes, the second authorized node includes the first authorized nodes, the second number of authorized nodes is greater than the first number of authorized nodes; 所述加密模块,还用于使用所述用户节点的公钥对第二数据进行加密,从而获得第二密文;The encryption module is further configured to use the public key of the user node to encrypt the second data, so as to obtain the second ciphertext; 所述上链模块,还用于上传所述第二扩展公钥和所述第二密文至所述区块链。The on-chain module is further configured to upload the second extended public key and the second ciphertext to the block chain. 12.根据权利要求10所述的装置,其特征在于,12. The apparatus of claim 10, wherein: 所述获取模块,还用于根据所述第一扩展公钥获取第三扩展公钥,其中,所述第三扩展公钥包括重新加密后的血缘信息、第三监管授权信息以及所述用户节点的公钥,所述第三监管授权信息用于供所述多个节点中的第三被授权的节点还原第二解密密钥,所述第二解密密钥用于对所述重新加密后的血缘信息进行解密,所述第三被授权的节点属于所述第一被授权的节点,所述第三被授权的节点数量小于所述第一被授权的节点数量;The obtaining module is further configured to obtain a third extended public key according to the first extended public key, wherein the third extended public key includes re-encrypted blood relationship information, third supervisory authorization information, and the user node public key, the third supervisory authorization information is used for the third authorized node among the plurality of nodes to restore the second decryption key, and the second decryption key is used for the re-encrypted The blood relationship information is decrypted, the third authorized node belongs to the first authorized node, and the number of the third authorized nodes is smaller than the number of the first authorized nodes; 所述加密模块,还用于使用所述用户节点的公钥对第三数据进行加密,从而获得第三密文;The encryption module is further configured to use the public key of the user node to encrypt the third data, so as to obtain the third ciphertext; 所述上链模块,还用于上传所述第三扩展公钥和所述第三密文至所述区块链。The on-chain module is further configured to upload the third extended public key and the third ciphertext to the block chain. 13.根据权利要求10至12任一项所述的装置,其特征在于,所述获取模块,具体用于:13. The device according to any one of claims 10 to 12, wherein the acquisition module is specifically used for: 获取扩展私钥,所述扩展私钥包括所述血缘信息以及所述用户节点的私钥;Obtain an extended private key, where the extended private key includes the blood relationship information and the private key of the user node; 使用第一解密密钥加密所述血缘信息,得到所述加密后的血缘信息;Encrypting the blood relationship information using a first decryption key to obtain the encrypted blood relationship information; 使用所述第一被授权的节点的公钥加密所述第一解密密钥,得到所述第一监管授权信息;Encrypting the first decryption key using the public key of the first authorized node to obtain the first supervisory authorization information; 根据所述用户节点的私钥,计算得到所述用户节点的公钥;According to the private key of the user node, calculate the public key of the user node; 根据所述用户节点的公钥、所述加密后的血缘信息以及所述第一监管授权信息,得到第一扩展公钥。A first extended public key is obtained according to the public key of the user node, the encrypted blood relationship information, and the first supervisory authorization information. 14.根据权利要求10至13任一项所述的装置,其特征在于,所述加密后的血缘信息包括加密后的用户节点的编号以及加密后的多个节点的编号。14. The device according to any one of claims 10 to 13, wherein the encrypted blood relationship information includes the encrypted user node number and the encrypted multiple node numbers. 15.一种加密装置,其特征在于,所述装置应用于区块链网络中的监管节点,包括:15. An encryption device, characterized in that the device is applied to a supervisory node in a blockchain network, comprising: 获取模块,用于获取扩展公钥和密文,其中,所述扩展公钥包括加密后的血缘信息、监管授权信息以及用户节点的公钥,所述血缘信息反映多个节点的私钥与所述用户节点的私钥之间的关联关系,所述监管授权信息用于供所述多个节点中的被授权的节点还原解密密钥,所述解密密钥用于对所述加密后的血缘信息进行解密,所述密文为所述用户节点使用所述用户节点的公钥对目标数据进行加密得到,所述监管节点属于所述被授权的节点;An acquisition module, configured to acquire an extended public key and ciphertext, wherein the extended public key includes encrypted lineage information, supervisory authorization information, and public keys of user nodes, and the lineage information reflects the relationship between the private keys of multiple nodes and all The association relationship between the private keys of the user nodes, the supervision and authorization information is used for the authorized node among the multiple nodes to restore the decryption key, and the decryption key is used for the encryption of the blood relationship The information is decrypted, and the ciphertext is obtained by encrypting the target data by the user node using the public key of the user node, and the supervisory node belongs to the authorized node; 解密模块,用于根据所述扩展公钥对所述密文进行解密,从而得到所述目标数据。A decryption module, configured to decrypt the ciphertext according to the extended public key, so as to obtain the target data. 16.一种计算设备,其特征在于,所述计算设备包括处理器和存储器;所述处理器用于执行所述存储器存储的指令,使得所述计算设备实现权利要求1至9任一项所述的方法。16. A computing device, characterized in that, the computing device comprises a processor and a memory; the processor is configured to execute instructions stored in the memory, so that the computing device implements any one of claims 1 to 9. Methods. 17.一种计算机可读存储介质,其特征在于,所述计算机可读介质存储有指令,所述指令用于实现权利要求1至9任一项所述的方法。17. A computer-readable storage medium, wherein the computer-readable medium stores instructions, and the instructions are used to implement the method according to any one of claims 1-9.
CN202111315278.4A 2021-11-08 2021-11-08 Encryption method, encryption device and related equipment Pending CN116094739A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111315278.4A CN116094739A (en) 2021-11-08 2021-11-08 Encryption method, encryption device and related equipment
PCT/CN2022/123259 WO2023078013A1 (en) 2021-11-08 2022-09-30 Encryption method and apparatus, and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111315278.4A CN116094739A (en) 2021-11-08 2021-11-08 Encryption method, encryption device and related equipment

Publications (1)

Publication Number Publication Date
CN116094739A true CN116094739A (en) 2023-05-09

Family

ID=86205056

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111315278.4A Pending CN116094739A (en) 2021-11-08 2021-11-08 Encryption method, encryption device and related equipment

Country Status (2)

Country Link
CN (1) CN116094739A (en)
WO (1) WO2023078013A1 (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111130757B (en) * 2019-12-31 2020-12-25 华中科技大学 Multi-cloud CP-ABE access control method based on block chain
CN113037753B (en) * 2021-03-09 2022-02-01 电子科技大学 Encrypted data sharing method with privacy protection based on block chain
CN112907247B (en) * 2021-03-18 2024-01-26 上海零数众合信息科技有限公司 Block chain authorization calculation control method
CN113553574B (en) * 2021-07-28 2025-01-24 浙江大学 A trusted data management method for the Internet of Things based on blockchain technology

Also Published As

Publication number Publication date
WO2023078013A1 (en) 2023-05-11

Similar Documents

Publication Publication Date Title
US12309127B2 (en) End-to-end secure operations using a query vector
US10903976B2 (en) End-to-end secure operations using a query matrix
Dilawar et al. Blockchain: securing internet of medical things (IoMT)
WO2020259635A1 (en) Method and apparatus for sharing blockchain data
CN104521178B (en) The method and system of the multi-party cloud computing of safety
WO2016136024A1 (en) Key replacement direction control system, and key replacement direction control method
CN110089071B (en) Secure distributed data processing
CN110881063A (en) Storage method, device, equipment and medium of private data
US9209971B2 (en) Method and system for shielding data in untrusted environments
KR101220160B1 (en) Secure data management method based on proxy re-encryption in mobile cloud environment
Huang et al. Efficient quantum private comparison based on entanglement swapping of bell states
US12200099B2 (en) Multi-party cryptographic systems and methods
CN115495768A (en) Secret-related information processing method and system based on block chain and multi-party security calculation
CN102710661B (en) Cloud storage and aggregation architecture and data storage and aggregation method by using same
Ma et al. Integrating blockchain and ZK-ROLLUP for efficient healthcare data privacy protection system via IPFS
WO2021098152A1 (en) Blockchain-based data processing method, device, and computer apparatus
Fujiwara et al. Secure secondary utilization system of genomic data using quantum secure cloud
US11290277B2 (en) Data processing system
Yang Encryption chain based on measurement result and its applications on semi-quantum key distribution protocol
JP2020099010A (en) Information processing method, information processing device, program, and information processing system
CN111953480B (en) Key generation device and method, operation key generation device and method
WO2023078013A1 (en) Encryption method and apparatus, and related device
US12333045B2 (en) Distributed communication network
CN117874787A (en) Data protection method, device, electronic device and computer-readable storage medium
Chavan et al. Secure CRM cloud service using RC5 algorithm

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