An access control method based on blockchain and attribute-based encryption
By using attribute-based encryption and a fully homomorphic cryptography system on the blockchain, combined with IPFS, the problem of insufficient storage capacity of the blockchain and lack of privacy protection in access control is solved, and efficient access control and data security are achieved.
Patent Information
- Application Number
- CN202310063621.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-13
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2043-01-13
AI Technical Summary
The problems of insufficient blockchain storage capacity and lack of privacy protection in access control.
Adopt an access control method based on blockchain and attribute-based encryption, initialize the blockchain network, install attribute verification chain code and information management chain code, use CP-ABE encryption algorithm and fully homomorphic cryptography system, and combine IPFS for data storage and access control to achieve fine-grained and efficient access control and protect user privacy through a homomorphic encryption system.
It achieves fine-grained privacy protection and access control for blockchain storage, reduces the storage burden of the blockchain, and ensures data security and controllability.
Smart Images

Figure CN116112244B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of access control based on blockchain, and specifically relates to an access control method based on blockchain and attribute-based encryption. Background Art
[0002] In the era of big data, cloud storage systems have been widely used, bringing great convenience to people. At the same time, cloud storage also brings many problems. When users outsource data to the cloud, the data owner loses control of the data. Cloud storage systems are semi-trusted and cannot be relied upon to control user data and ensure data security.
[0003] The concept of blockchain was first proposed by Satoshi Nakamoto in his article Bitcoin: A Peer-to-Peer Electronic Cash System published in the Cryptography Component in 2008. Each block contains a block header and a block body. The block body stores transactions in the blockchain and forms a Merkle tree. The block header contains the Merkle tree root hash value when the block was generated. The block header of each block also contains a hash value calculated from the previous block, thus forming a blockchain. The decentralized, high-trust, unalterable, and traceable characteristics of blockchain can meet the security needs of data very well. Blockchain technology achieves supervision and control of data by tracking the usage of data.
[0004] Attribute Based Encryption (ABE) was first proposed by Sahai to provide support for data protection. Later, Goyal divided ABE into Ciphertext Policy Attribute Based Encryption (CP-ABE) and Key-Policy Attribute Based Encryption (KP-ABE) based on Sahai. Among them, CP-ABE embeds access policies into ciphertexts and user attributes into keys, so that information owners can specify ciphertext access policies, which is suitable for message distribution scenarios. Through attribute-based encryption, users can decide whether other users have the right to access data, which strengthens control over data and ensures data security.
[0005] Inter Planetary File System (IPFS) is a peer-to-peer distributed file system designed to connect all computer devices with the same file system. In terms of addressing, it innovatively adopts content addressing rather than location addressing. IPFS adopts a decentralized design, storing uploaded files in different IPFS nodes, and calculating file fingerprints based on file content and storing them in a distributed hash table. IPFS can greatly alleviate the storage pressure of blockchain and solve the problem of low blockchain storage capacity. Summary of the invention
[0006] In order to solve the problem of low storage capacity of blockchain and lack of privacy protection in access control, the present invention provides an access control method based on blockchain and attribute-based encryption, which specifically includes the following steps:
[0007] S1: The administrator initializes the blockchain network and creates certificates for nodes in the network;
[0008] S2: Install the attribute verification chaincode and information management chaincode into the blockchain network and initialize them;
[0009] S3: The data owner obtains the hash value H of the data plaintext through hash function calculation, calls the AES key generation algorithm to generate the key key, encrypts the key key and the plaintext M through the AES algorithm to obtain the ciphertext CT, and uploads the ciphertext CT to the IPFS network to obtain the storage address Address;
[0010] S4: The data owner calls the CP-ABE initialization algorithm to generate the data owner's public key PK and master key MK, and uses the CP-ABE encryption algorithm to encrypt the key key, public key PK, ciphertext CT and access policy P to obtain the ciphertext Enc; calculates the ciphertext E(P) of the access policy vector encrypted by the fully homomorphic cryptosystem;
[0011] S5: The data owner calls the information management chain code in the blockchain and uploads the input hash value H, storage address Address, access policy ciphertext E(P) and ciphertext Enc to the blockchain for storage;
[0012] S6: The data requester calculates the ciphertext E(A) of the attribute vector encrypted by the fully homomorphic cryptographic system through the attribute authentication center, and calls the policy verification chain code to verify whether it meets the access requirements; if the verification passes, the attribute authentication center generates a private key SK for decrypting the ciphertext Enc to obtain the key key, obtains the ciphertext CT through the storage address Address, and then obtains the plaintext M through the key key.
[0013] Furthermore, the attribute verification chaincode accepts E(A) input by the access requester, and then calls the information management chaincode to obtain the access policy ciphertext E(P) encrypted by the fully homomorphic encryption system and stored in the blockchain. E(A) and E(P) are then multiplied to obtain E(z'), and E(z') is decrypted to obtain z'. If z' is equal to z, the user attributes meet the requirements of the access policy. z represents the number of elements in the access policy that are equal to 1, z'=A×P, and A represents the user's attribute set.
[0014] Furthermore, the user's attribute set A is represented by A = {A1, A2...A n}, when A i =1 indicates that the user includes the i-th attribute A i , Dangdang A i = 0 means the user does not include the i-th attribute A i ; Access policy P is expressed as P = {P1, P2...P n}, P i Represents the i-th element of the access policy. If there are z elements in the access policy P with a value of 1 and the values of the other elements are 0, then A×P=A1P1+A2P2+……+A n P n When the value of is z, the access policy is satisfied.
[0015] Furthermore, the information management chain code receives the hash value H of the data plaintext, the storage address Address, the ciphertext E(P) of the access policy vector encrypted by the fully homomorphic cryptographic system, and the ciphertext Enc from the user and stores them on the blockchain waiting for invocation.
[0016] Furthermore, the data owner encrypts the data using the CP-ABE algorithm in the following steps:
[0017] S41: By inputting a security parameter k and running the group generation algorithm to obtain a set of parameters, the obtained parameters are (N=pr,G,G T ,e), G and G T is a multiplicative cyclic group of order N=pr, p and r are two different prime numbers, e is a bilinear map; randomly select The public key and master key are calculated. The public key is expressed as:
[0018]
[0019] The master key is represented as:
[0020]
[0021] S42: The data owner formulates his own access policy P = {b1, b2, ..., b n}, when b i=1, the corresponding r i Choose a random number to assign, and Calculate C0 = B r 、C=key·Y r and {C i,1 ,C i,2}, output ciphertext Enc=(C0,C,{C i,1 ,C i,2}); i,1 ,C i,2 The calculation of} is expressed as:
[0022]
[0023] S43: The data owner encrypts the access policy P through the fully homomorphic cryptographic system to obtain the ciphertext E(P), where E(p) = (E(b1), E(b2), ..., E(b n ));
[0024] Where G = G p ×G r , G p and G r The generator is g p and g r The bilinear group of ; represents the set of positive natural numbers; e(g p ,g r ) represents the generator g p and g r Perform bilinear mapping; α i For A random number; n represents the number of attributes in the access policy; T i ,T i ′∈G r .
[0025] Furthermore, the decryption process of the data requester includes:
[0026] S61: The data requester encrypts the attribute vector A through the fully homomorphic cryptographic system to obtain the ciphertext E(A), and verifies whether it meets the access requirements by calling the policy verification chain code;
[0027] S62: The data requester selects a random number Calculate private key parameters The data requester selects a random number And for each attribute i∈{1,...,n}, calculate Get the private key SK=(D0,{D i,1 ,D i,2});
[0028] S63: The data requester decrypts the ciphertext Enc using the private key SK and the decryption algorithm to obtain the symmetric key key.
[0029] The present invention uses the chain code deployed in the blockchain to supervise the user's access request behavior, realizes attribute hiding in access control through the homomorphic encryption system to protect the user's privacy, realizes fine-grained and efficient access control through the CP-ABE and AES encryption algorithms, and reduces the storage burden of the blockchain through the IPFS system. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a flow chart of an access control method based on blockchain and attribute-based encryption in the present invention. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] The present invention provides an access control method based on blockchain and attribute-based encryption, which specifically includes the following steps:
[0033] S1: The administrator initializes the blockchain network and creates certificates for nodes in the network;
[0034] S2: Install the attribute verification chaincode and information management chaincode into the blockchain network and initialize them;
[0035] S3: The data owner obtains the hash value H of the data plaintext through hash function calculation, calls the AES key generation algorithm to generate the key key, encrypts the key key and the plaintext M through the AES algorithm to obtain the ciphertext CT, and uploads the ciphertext CT to the IPFS network to obtain the storage address Address;
[0036] S4: The data owner calls the CP-ABE initialization algorithm to generate the data owner's public key PK and master key MK, and uses the CP-ABE encryption algorithm to encrypt the key key, public key PK, ciphertext CT and access policy P to obtain the ciphertext Enc; calculates the ciphertext E(P) of the access policy vector encrypted by the fully homomorphic cryptosystem;
[0037] S5: The data owner calls the information management chain code in the blockchain and uploads the input hash value H, storage address Address, access policy ciphertext E(P) and ciphertext Enc to the blockchain for storage;
[0038] S6: The data requester calculates the ciphertext E(A) of the attribute vector encrypted by the fully homomorphic cryptographic system through the attribute authentication center, and calls the policy verification chain code to verify whether it meets the access requirements; if the verification passes, the attribute authentication center generates a private key SK for decrypting the ciphertext Enc to obtain the key key, obtains the ciphertext CT through the storage address Address, and then obtains the plaintext M through the key key.
[0039] In this embodiment, golang is used to write chain codes on the Hyperledger Fabric platform. The chain codes used in this embodiment include attribute verification chain codes and information management chain codes, specifically including:
[0040] 1. Attribute Verification Chaincode
[0041] In this embodiment, the attribute set is set to A = {A1, A2...A n}, that is, the attribute set of user A, A i It represents the attribute value of the i-th attribute, n represents the number of attributes. When the user has the attribute, the attribute value is 1, otherwise the attribute value is 0. It can be expressed as:
[0042]
[0043] For example, when the number of attributes is 5, that is, n=5, the attribute set of a user is expressed as A={A1,A2,A3,A4,A5}={1,1,0,0,1}, which means that the user has three attributes A1, A2, and A5. The user attributes can also be directly represented in the form of a string, expressed as A1A2A3A4A5=11001.
[0044] In this embodiment, the definition of access policy is the same as the definition of attribute. The access policy is expressed as P = {P1, P2...P n}, P i Represents the i-th element of the access policy. If there are z elements in the access policy P with a value of 1 and the values of the other elements are 0, then A×P=A1P1+A2P2+……+A n P n When the value of is z, the user satisfies the access policy.
[0045] The attribute verification chaincode first accepts E(A) input by the access requester, then calls the information management chaincode to obtain the access policy ciphertext E(P) encrypted by the fully homomorphic encryption system and stored in the blockchain, and then multiplies E(A) and E(P) to get E(z'), decrypts E(z') to get z', and if z' is equal to z, the user attributes meet the requirements of the access policy.
[0046] E() represents the encryption operation of a fully homomorphic cryptographic system. The concept of fully homomorphic cryptography was proposed by Rivest et al. in the 1970s. It has become an important technology for solving security problems in cloud services. The method of constructing such a scheme has always been a difficult problem for cryptographers. The first fully homomorphic cryptographic system was based on an ideal lattice. This scheme can perform any calculation on encrypted data without decryption and does not affect the confidentiality of the data. A fully homomorphic cryptographic system means that it satisfies both additive homomorphism and multiplicative homomorphism, as shown in the following formula:
[0047] f(A+B)=f(A)+f(B)
[0048] f(A)×f(B)=f(A×B)
[0049] This embodiment uses an algorithm that satisfies the encryption operation of the fully homomorphic cryptographic system to encrypt the user's attribute set and access policy. The specific encryption method of the encryption operation of the fully homomorphic cryptographic system can be selected from the existing encryption operations of the fully homomorphic cryptographic system by technicians in this field, and this invention does not limit this.
[0050] (II) Information Management Chain Code
[0051] The information management chain code receives the hash value H of the data plaintext, the storage address Address, the ciphertext E(P) of the access policy vector encrypted by the fully homomorphic cryptographic system, and the ciphertext Enc from the user and stores them on the blockchain waiting for invocation.
[0052] The data owner encrypts the hash value H, storage address Address, access policy ciphertext E(P) and ciphertext Enc through the CP-ABE algorithm and uploads them to the blockchain for storage. The specific steps include:
[0053] S41: Run the group generation algorithm by inputting a security parameter k to obtain (N=p,r,G,R T ,e), where G = G p ×G r ,G p and G r The generator is g p and g r The bilinear group of Calculated
[0054] S42: The data owner formulates his own access policy P = {b1, b2, ..., b n}, when b i =1, the corresponding Choose a random number to assign, C0=B r、C=key·Y r and {C i,1 ,C i,2}, output ciphertext Enc=(C0,C,{C i,1 ,C i,2}); i,1 ,C i,2 The calculation of} is expressed as:
[0055]
[0056] The final output ciphertext Enc=(C0,C,{C i,1 ,C i,2}).
[0057] S43: The data owner encrypts the access policy P through the fully homomorphic cryptographic system to obtain the ciphertext E(P), where E(p) = (E(b1), E(b2), ..., E(b n ));
[0058] Among them, the group generation algorithm adopted in this embodiment is a prior art. Those skilled in the art can implement it specifically according to the document J. Bethencourt, A. Sahai and B. Waters, "Ciphertext-Policy Attribute-Based Encryption," 2007 IEEE Symposium on Security and Privacy (SP'07), 2007, pp. 321-334, doi: 10.1109 / SP.2007.11., and the present invention will not elaborate on it.
[0059] When a data requester wants to request data on the blockchain, the data requester needs to undergo identity authentication before obtaining the data. After decrypting the obtained data or the plaintext data, the following steps are specifically included:
[0060] S61: The data requester encrypts the attribute vector A through a fully homomorphic cryptographic system to obtain the ciphertext E(A), and verifies whether it meets the access requirements by calling the policy verification chain code.
[0061] S62: First, the data requester selects a random number and For each i∈{1,...,n}, the data requester selects a number And calculate Get the private key SK=(D0,{D i,1 ,D i,2}).
[0062] S63: The data requester decrypts the ciphertext Enc using the private key SK and the decryption algorithm to obtain the symmetric key key. The specific formula is as follows:
[0063]
[0064] Then the ciphertext CT is obtained through the data storage address Address, and finally the plaintext M is decrypted through the key key.
[0065] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An access control method based on blockchain and attribute-based encryption, characterized in that: The specific steps include: S1: The administrator initializes the blockchain network and creates certificates for nodes in the network; S2: Install the attribute verification chaincode and information management chaincode into the blockchain network and initialize them; S3: The data owner obtains the hash value H of the data plaintext through hash function calculation, calls the AES key generation algorithm to generate the key key, encrypts the key key and the plaintext M through the AES algorithm to obtain the ciphertext CT, and uploads the ciphertext CT to the IPFS network to obtain the storage address Address; S4: The data owner calls the CP-ABE initialization algorithm to generate the data owner's public key PK and master key MK, and uses the CP-ABE encryption algorithm to encrypt the key key, public key PK, ciphertext CT and access policy P to obtain the ciphertext Enc; Calculate the ciphertext E(P) of the access policy vector encrypted by the fully homomorphic cryptosystem; The data owner uses the CP-ABE algorithm to encrypt the following steps: S41: By inputting a security parameter k and running the group generation algorithm to obtain a set of parameters, the obtained parameters are (N=pr,G,G T ,e), G and G T is a multiplicative cyclic group of order N = pr, p and r are two different prime numbers, e is a bilinear map; randomly select ω, β, The public key and master key are calculated. The public key is expressed as: The master key is represented as: S42: The data owner formulates his own access policy P = {b1, b2, ..., b n }, when b i =1, the corresponding Choose a random number to assign, C0=B r 、C=key·Y r and {C i,1 ,C i,2 }, output ciphertext Enc=(C0,C,{C i,1 ,C i,2 }); i,1 ,C i,2 The calculation of} is expressed as: S43: The data owner encrypts the access policy P through the fully homomorphic cryptographic system to obtain the ciphertext E(P), where E(p) = (E(b1), E(b2), ..., E(b n )); Where G = G p ×G r , G p and G r The generator is g p and g r The bilinear group of ; represents the set of positive natural numbers; e(g p ,g r ) represents the generator g p and g r Perform bilinear mapping; α i For A random number; n represents the number of attributes in the access policy; T i ,T i ′∈G r ; The decryption process for the data requester includes: S61: The data requester encrypts the attribute vector A through the fully homomorphic cryptographic system to obtain the ciphertext E(A), and verifies whether it meets the access requirements by calling the policy verification chain code; S62: The data requester selects a random number Calculate private key parameters The data requester selects a random number And for each attribute i∈{1,...,n}, calculate Get the private key SK=(D0,{D i,1 ,D i,2 }); S63: The data requester decrypts the ciphertext Enc using the private key SK and the decryption algorithm to obtain the symmetric key key; S5: The data owner calls the information management chain code in the blockchain and uploads the input hash value H, storage address Address, access policy ciphertext E(P) and ciphertext Enc to the blockchain for storage; S6: The data requester calculates the ciphertext E(A) of the attribute vector encrypted by the fully homomorphic cryptographic system through the attribute authentication center, and calls the policy verification chain code to verify whether it meets the access requirements; if the verification passes, the attribute authentication center generates a private key SK for decrypting the ciphertext Enc to obtain the key key, obtains the ciphertext CT through the storage address Address, and then obtains the plaintext M through the key key.
2. According to claim 1, an access control method based on blockchain and attribute-based encryption is characterized in that: The attribute verification chaincode receives E(A) input by the access requester, and then calls the information management chaincode to obtain the access policy ciphertext E(P) encrypted by the fully homomorphic encryption system and stored in the blockchain. E(A) and E(P) are then multiplied to obtain E(z'), and E(z') is decrypted to obtain z'. If z' is equal to z, the user attributes meet the requirements of the access policy. z represents the number of elements in the access policy that are equal to 1, z'=A×P, and A represents the user's attribute set.
3. According to claim 2, an access control method based on blockchain and attribute-based encryption is characterized in that: The user's attribute set A is represented by A = {A1, A2...A n }, when A i =1 indicates that the user includes the i-th attribute A i , when A i = 0 means the user does not include the i-th attribute A i ; Access policy P is expressed as P = {P1, P2...P n }, P i Represents the i-th element of the access policy. If there are z elements in the access policy P with a value of 1 and the values of the other elements are 0, then A×P=A1P1+A2P2+……+A n P n When the value of is z, the access policy is satisfied.
Citation Information
Patent Citations
Multi-cloud CP-ABE access control method based on block chain
CN111130757A
Alliance block chain data access control method based on CP-ABE algorithm
CN111371561A
