Access control method based on ciphertext policy attribute-based encryption on block chain

By using ciphertext policy attribute-based encryption technology on blockchain networks, the security problem of cross-domain data exchange is solved, and secure data exchange and access control between different management domains is realized, ensuring data privacy and security sex.

CN119094219AInactive Publication Date: 2024-12-06HUBEI UNIV

Patent Information

Application Number
CN202411290837.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art is difficult to achieve secure cross-domain data exchange and access control between different management domains, making it difficult to ensure the security of cross-domain data.

Method used

Using the blockchain-based ciphertext policy attribute-based encryption method, the access control policy and AES symmetric key are used to initialize the Hyperledger Fabric blockchain network, and the interstellar file system IPFS and attribute-based encryption (CP-ABE) technology are used to integrate access control policies and AES symmetric keys. Encryption is performed to ensure that only authorized users can access data stored in the cloud.

Benefits of technology

Improves flexibility and security in data encryption, ensuring that only authorized users can access data stored in the cloud, effectively protecting data privacy and access control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094219A_ABST
    Figure CN119094219A_ABST
Patent Text Reader

Abstract

The invention discloses an access control method based on ciphertext policy attribute-based encryption on a block chain, and the method comprises the following steps: S1, initializing a Hyperledger Fabric block chain network, creating a certificate for each node in the network, generating a public key PK and a main secret key MK by a trusted authority center, and deploying an information contract and a management contract chain code into the block chain network; s2, attribute encryption CP-ABE is carried out on a file hash value, and a hash value ciphertext is embedded into an access control strategy; s3, performing AES symmetric encryption on the access control policy, performing CP-ABE on an obtained symmetric key, and uploading an obtained ciphertext to a block chain network; and S4, querying a corresponding attribute in the block chain network according to a data access request sent by a data user. According to the access control method based on ciphertext policy attribute-based encryption on the block chain, privacy encryption and rapid and fine-grained access control are provided for cross-domain data, so that the access efficiency and security of the data are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cross-domain access control of cyberspace security blockchain, and in particular to an access control method based on ciphertext policy attribute-based encryption on blockchain. Background Art

[0002] With the development of cloud computing technology, data has become the most important resource in the Internet era. Data exchange and sharing between various security domains has become indispensable. The access control mechanism aims to maintain the three major security attributes of resources. By formulating access policies, access control limits the subject's access rights to resources to ensure the security of data resources. The goal of the access control mechanism is to ensure that legitimate users can access information reasonably.

[0003] In the existing technology, the access control mechanism effectively meets the needs of access control within a single domain. However, with the sharp increase in data sharing needs and the frequent business exchanges between enterprises and organizations, the secure exchange of cross-domain data has become crucial. This requires us to achieve secure data interaction between different management domains to ensure the security of cross-domain data. At present, each organization has established its own access control system. On this basis, achieving secure data exchange between different access control systems has become a key issue. Compared with the traditional single-domain access control method, the cross-domain access control mechanism is more efficient and practical. In order to protect cross-domain sensitive data resources and ensure data security, an effective and secure cross-domain access control method needs to be adopted.

[0004] InterPlanetary File System (IPFS) is a decentralized distributed file storage system that aims to create a global, more efficient and reliable data storage and sharing platform. It provides a decentralized network for storing and sharing data. The system uses content addressing to identify files. Each file data in IPFS has a unique hash value, which is the unique fingerprint of the file data content. Users access files through the hash value.

[0005] Blockchain can provide a decentralized authentication mechanism to ensure the authenticity of user identities and permissions, and verify user access rights through smart contracts without the need for centralized identity authentication services. The tamper-proof nature of blockchain ensures the transparency and integrity of access logs and permission change records, increases the auditing capabilities of the system, and users can own and manage their own digital identities and control who can access their information. This model provides higher privacy protection, and smart contracts can automatically execute permission allocation and access control rules, improving management efficiency and security.

[0006] Attribute-based encryption (CP-ABE) is a public key encryption scheme in which the encryption policy is defined by the data owner and the decryption permission is based on the attributes of the data requester. In CP-ABE, the encryptor defines an encryption policy that specifies which attribute combinations can decrypt the ciphertext. The decryptor can only decrypt the ciphertext if its attributes meet the encryption policy. Summary of the invention

[0007] The purpose of the present invention is to provide an access control method based on ciphertext policy attribute-based encryption on blockchain, so that the encryption policy can be specified when data is encrypted, which improves flexibility and security, can effectively protect data privacy and access control, and ensure that only authorized users can access data stored in the cloud.

[0008] To achieve the above object, the present invention provides an access control method based on ciphertext policy attribute-based encryption on blockchain, comprising the following steps:

[0009] S1. Initialize the Hyperledger Fabric blockchain network, create certificates for each node in the network, generate the public key PK and the master key MK by the trusted authority, and deploy the information contract and management contract chain code to the blockchain network;

[0010] S2. After uploading the data to the Interplanetary File System (IPFS), the file hash value obtained is encrypted with attribute-based encryption (CP-ABE), and the hash value ciphertext is embedded into the access control policy formulated by the data owner.

[0011] S3. Perform AES symmetric encryption on the access control policy, perform attribute-based encryption (CP-ABE) on the obtained symmetric key, and finally upload the obtained access control policy ciphertext and AES symmetric key ciphertext to the blockchain network;

[0012] S4. According to the data access request issued by the data user, the corresponding attribute is queried in the blockchain network, and the queried attribute is used as the key to decrypt the symmetric key ciphertext. The obtained symmetric key is used to obtain the access control policy, in which the file hash value contained in the policy plaintext can access the IPFS file data.

[0013] Preferably, in step S2, the hash value obtained after uploading the file is subjected to attribute-based encryption CP-ABE, and the steps include:

[0014] S21. Develop an access control policy and use a trusted authority to generate the public key PK and master key MK required for initializing the encryption algorithm. The access control policy P contains the following elements:

[0015] Access control policy Policy = {(P1 AND P2) OR (P3 AND P4)};

[0016] Among them, P i is the attribute value, i∈1,2,3,4;

[0017] S22, using the public key PK and the attributes in the access control policy, encrypting the file hash value using the CP-ABE algorithm to obtain a hash value ciphertext;

[0018] Assume that the file hash value is M, convert the access control policy into the access control tree T, and use the encryption algorithm to generate the hash value ciphertext CT.

[0019] Preferably, in step S2, CP-ABE attribute encryption includes an initialization algorithm, a private key algorithm, an encryption algorithm and a decryption algorithm.

[0020] Preferably, in step S2, the CP-ABE attribute encryption initialization algorithm;

[0021] Setup()→(PK,MK)

[0022] Assume G0 is a bilinear group of prime order p, g is the generator of group G0, and the bilinear map e: G0×G0→G1 is generated by the trusted authority according to the private parameters α, β∈Z p , where Z p is an integer additive group modulo p, and the public key PK = (h = g β , y=e(g,g) α ), master key MK=(β, g α ), h is the value calculated using β as the exponent, e(g, g) α Where e is a bilinear map.

[0023] Preferably, in step S2, a private key algorithm of CP-ABE attribute encryption;

[0024] KeyGen(MK, S) → SK

[0025] Input attribute set S, select random input r∈Z p , for each attribute i∈S, select r i ∈Z p , both have and Where H(i) is a function that maps attribute i to elements of group G0, then SK is {D i , D' i}, g is a generator of group G0, g r is the generator g raised to the power r, g ri is the r of the generator g i Power.

[0026] Preferably, in step S2, the encryption algorithm of CP-ABE attribute encryption;

[0027] Encrypt(PK,M,T)→CT

[0028] Where T is the access control tree transformed from the access control policy. For each node x in T, a polynomial q is selected. x ;

[0029] Select polynomial: For each node x in T, including leaf nodes, a polynomial q is selected in top-down order starting from the root node R of the tree. x ; For each node x, its polynomial q x The number of times d x is set to the node threshold k x Subtract 1, which is d x =k x -1;

[0030] Root node processing: Starting from the root node R, select a random number s∈Z p , and set it to the polynomial q R At point 0, which is the value of the root node, q R (0) = s, randomly select d R points to completely determine the polynomial q R ;

[0031] Other node processing: For other nodes x in the tree, the polynomial q x The value at point 0 is set to its parent node q parent(x) The value at the current node index position, i.e. q x (0) = q parent(x) (index(x)), randomly select d x points to completely determine the polynomial q x ;

[0032] The ciphertext CT consists of the following parts:

[0033]

[0034] Among them, M is the encrypted plaintext;

[0035] C=h S

[0036] C is the power term of the common parameter h;

[0037] For each leaf node y∈Y:

[0038]

[0039] Among them, C y is the power term of the generator g of group G0, where qy (0) The polynomial q corresponding to the leaf node y The value at 0;

[0040]

[0041] Among them, C' y It is the result of a hash function H, and the input att(y) is the attribute of the leaf node.

[0042] Preferably, in step S2, a decryption algorithm of CP-ABE attribute encryption;

[0043] Decrypt(CT,SK)→M

[0044] When node x is a leaf node of the access control tree T, the following operations are performed:

[0045] Let i = att(x), that is, the attribute corresponding to the leaf node x, check whether the attribute i is in the attribute set S of the private key SK. If i is in S, use the following formula to decrypt:

[0046]

[0047] If attribute i is in S, the final result is If i is not in S, return "undecryptable";

[0048] When node x is a non-leaf node, the algorithm DecryptNode(CT, SK, x) continues as follows: for all child nodes z of x, recursively call DecryptNode(CT, SK, z) and store the decrypted results as F z Set, S x is the set of all child nodes of node x, F x For S x F of each child node z in z The value obtained by weighted cumulative calculation is that if there exists a child node set S such that for each child node z in the set, the decryption result F z =⊥, that is, decryption fails, indicating that the node x does not meet the decryption conditions. Otherwise, if the node x meets the decryption conditions, the following formula will be executed:

[0049]

[0050] Final Represents the original plaintext data, using r and polynomial q x The calculation of (0) recovers the plaintext M.

[0051] Preferably, step S3 specifically includes the following steps:

[0052] S31. Use the AES symmetric algorithm to encrypt the access control policy. Assuming that the policy plaintext P is 128 bits, i.e. 16 bytes, and the key MK is 128 bits, first convert the plaintext block and the key MK into a 4×4 byte matrix. The specific process is as follows:

[0053] S311, round key addition;

[0054]

[0055] in, represents a bitwise XOR operation. For each corresponding element in the matrix, the plaintext P and the element corresponding to the key K are subjected to a bitwise XOR operation. S (0) is the initial state matrix, and is the matrix after the round key addition operation;

[0056] S312, main wheel operation;

[0057] For AES-128 there are 10 rounds in total;

[0058] S (r) =SubBytes(S (r-1) )

[0059] Among them, SubBytes means using S-box to replace each byte. S-box is a 16×16 lookup table. Each byte is replaced by the corresponding value in the S-box. r means the main round from 1 to 9 bits.

[0060] S (r) =ShiftRows(S (r) )

[0061] Among them, ShiftRows means to circularly shift the rows of the state matrix, the first row remains unchanged, the second row is shifted left by one byte, the third row is shifted left by two bytes, and the fourth row is shifted left by three bytes;

[0062] S (r) =MixColumns(S (r) )

[0063] Among them, MixColumn means linear transformation of each column;

[0064]

[0065] Among them, K (r) is the round key of the current round, which is a subkey generated by the master key and is used for encryption operations of the current round;

[0066] S313, final round;

[0067] In the final round, K (10)is the round key of the final round, and C is the policy ciphertext;

[0068] S (10) =SubBytes(S 99) )

[0069] S (10) =ShiftRows(S (10) )

[0070]

[0071] Finally, the policy ciphertext C is obtained and uploaded to the blockchain network;

[0072] S32. Use the CP-ABE algorithm to encrypt the AES symmetric key. The specific process is as follows:

[0073] S321. Generate a key SK through KeyGen (MK, S), where S is all attributes of the access control policy P;

[0074] S322, using the encryption algorithm to obtain the AES symmetric key ciphertext C, and at the same time establishing a corresponding index according to the attribute, and marking the ciphertext C;

[0075] C=Encrypt(PK,MK,T)

[0076] S323. Upload the marked ciphertext C and the access control policy to the blockchain network.

[0077] Preferably, the specific steps of step S4 include:

[0078] S41. Query the corresponding attributes according to the data access request issued by the data user and manage the contract chain code, including the following steps:

[0079] S411. In the blockchain network, the data user issues an original access request and calls the information contract to query the relevant attribute information in the AA attribute database to construct an attribute-based access request AAR, which includes the requesting user, environment, operation, and resource attributes;

[0080] ARR=<sAtt,rAtt,aAtt,eAtt>

[0081] Among them, sAtt represents the subject attribute, rAtt represents the resource attribute, aAtt represents the set of operation attribute name-value pairs, and eAtt represents the environment attribute. The meaning of ARR is that the subject with the attribute sAtt performs the operation request aAtt on the resource rAtt under the condition of the environment attribute eAtt.

[0082] S412, extracting the required attribute set sAtt from the attribute request ARR, and performing attribute matching on the symmetric key ciphertext C index in each block in the blockchain network;

[0083] S413, the symmetric key ciphertext obtained by the successful matching is decrypted according to sAtt using the CP-ABE algorithm to obtain the symmetric key key;

[0084] key = Decrypt(C, sAtt)

[0085] S42, using the AES symmetric key key to decrypt the access control policy ciphertext, and finally obtain the access control policy plaintext;

[0086] S43, obtain the hash value ciphertext CT from the access control policy plaintext, and decrypt it using the CP-ABE decryption algorithm to obtain the hash value plaintext M;

[0087] M = Decrypt (CT, rAtt)

[0088] The hash value can be used to access the IPFS network to obtain the target data.

[0089] Therefore, the present invention adopts the above-mentioned access control method based on ciphertext policy attribute-based encryption on blockchain, and the beneficial effects are as follows:

[0090] (1) The present invention can formulate encryption strategies when encrypting data, and has high flexibility and security.

[0091] (2) The present invention ensures that only authorized users can access data stored in the cloud, which can effectively protect data privacy and access control. BRIEF DESCRIPTION OF THE DRAWINGS

[0092] Figure 1 This is a flow chart of data owner uploading data hash value encryption and access control policy encryption in an access control method based on ciphertext policy attribute-based encryption on blockchain of the present invention;

[0093] Figure 2 This is a flow chart of data user's data request access control verification on blockchain based on an access control method of ciphertext policy attribute-based encryption on blockchain in the present invention. DETAILED DESCRIPTION

[0094] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.

[0095] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.

[0096] Embodiment 1

[0097] like Figure 1-Figure 2 As shown, an access control method based on ciphertext policy attribute-based encryption on blockchain includes the following steps:

[0098] S1. The system administrator initializes the Hyperledger Fabric blockchain network, creates certificates for each node in the network, generates the public key PK and the master key MK by the trusted authority, and deploys the information contract and management contract chain code to the blockchain network.

[0099] S2. After the data owner uploads the file data to the Interplanetary File System IPFS, the file hash value obtained is encrypted with attribute-based encryption CP-ABE, and the hash value ciphertext is embedded into the access control policy formulated by the data owner. The specific steps are as follows:

[0100] The data owner formulates an access control policy and uses a trusted authority to generate the public key PK and master key MK required for initializing the encryption algorithm. The access control policy P contains the following elements:

[0101] Access control policy Policy = {(P1ANDP2)OR(P3ANDP4)}; where P i is the attribute value, i∈1,2,3,4.

[0102] Using the public key PK and the attributes in the access control policy, the file hash value is encrypted using the CP-ABE algorithm to obtain the hash value ciphertext. The encryption must go through the initialization algorithm, private key algorithm, encryption algorithm and decryption algorithm. The steps are as follows:

[0103] Initialization algorithm;

[0104] Setup()→(PK,MK)

[0105] Assume G0 is a bilinear group of prime order p, g is the generator of group G0, and the bilinear map e: G0×G0→G1 is generated by the trusted authority according to the private parameters α, β∈Z p , where Z p is an integer additive group modulo p, and the public key PK = (h = g β , y=e(g,g) α ), master key MK=(β, g α ), h is the value calculated using β as the exponent, e(g, g) α Where e is a bilinear map.

[0106] Private key algorithm;

[0107] KeyGen(MK, S) → SK

[0108] Input attribute set S, select random input r∈Zp , for each attribute i∈S, select r i ∈Z p , both have and Where H(i) is a function that maps attribute i to elements of group G0, then SK is {D i , D' i}, g is a generator of group G0, g r is the generator g raised to the power r, g ri is the r of the generator g i Power.

[0109] Encryption algorithm;

[0110] Encrypt(PK,M,T)→CT

[0111] Where T is the access control tree transformed from the access control policy. For each node x in T, a polynomial q is selected. x .

[0112] Select polynomial: For each node x in T, including leaf nodes, a polynomial q is selected in top-down order starting from the root node R of the tree. x For each node x, its polynomial q x The number of times d x is set to the node threshold k x Subtract 1, which is d x =k x -1.

[0113] Root node processing: Starting from the root node R, select a random number s∈Z p , and set it to the polynomial q R At point 0, which is the value of the root node, q R (0) = s, randomly select d R points to completely determine the polynomial q R .

[0114] Other node processing: For other nodes x in the tree, the polynomial q x The value at point 0 is set to its parent node q parent(x) The value at the current node index position, i.e. q x (0) = q parent(x) (index(x)), randomly select d x points to completely determine the polynomial q x .

[0115] The ciphertext CT consists of the following parts:

[0116]

[0117] Among them, M is the encrypted plaintext;

[0118] C=h S

[0119] C is the power term of the common parameter h;

[0120] For each leaf node y∈Y:

[0121]

[0122] Among them, C y is the power term of the generator g of group G0, where q y (0) The polynomial q corresponding to the leaf node y The value at 0;

[0123]

[0124] Among them, C' y It is the result of a hash function H, and the input att(y) is the attribute of the leaf node.

[0125] Decryption algorithm;

[0126] Decrypt(CT,SK)→M

[0127] When node x is a leaf node of the access control tree T, the following operations are performed:

[0128] Let i = att(x), that is, the attribute corresponding to the leaf node x, check whether the attribute i is in the attribute set S of the private key SK. If i is in S, use the following formula to decrypt:

[0129]

[0130] If attribute i is in S, the final result is If i is not in S, return "undecryptable".

[0131] When node x is a non-leaf node, the algorithm DecryptNode(CT, SK, x) continues as follows: for all child nodes z of x, recursively call DecryptNode(CT, SK, z) and store the decrypted results as F z Set, S x is the set of all child nodes of node x, F x For S x F of each child node z in z The value obtained by weighted cumulative calculation is that if there exists a set of child nodes S such that for each child node z in the set, the decryption result F z=⊥, that is, decryption fails, indicating that the node x does not meet the decryption conditions. Otherwise, if the node x meets the decryption conditions, the following formula will be executed:

[0132]

[0133] Final Represents the original plaintext data, using r and polynomial q x The calculation of (0) recovers the plaintext M.

[0134] S3, perform AES symmetric encryption on the access control policy, perform attribute-based encryption CP-ABE on the obtained symmetric key, and finally obtain the access control policy ciphertext and the AES symmetric key ciphertext and upload them to the blockchain network together, including the following steps:

[0135] The access control policy is encrypted using the AES symmetric algorithm. Assuming that the policy plaintext P is 128 bits, i.e. 16 bytes, and the key MK is 128 bits, both the plaintext block and the key MK are first converted into a 4×4 byte matrix. The specific process is as follows:

[0136] Round key plus;

[0137]

[0138] in, represents a bitwise XOR operation. For each corresponding element in the matrix, the plaintext P and the element corresponding to the key K are subjected to a bitwise XOR operation. S (0) is the initial state matrix, and is the matrix after the round key addition operation.

[0139] Main wheel operation;

[0140] For AES-128 there are 10 rounds in total;

[0141] S (r) =SubBytes(S (r-1) )

[0142] Among them, SubBytes means using S-box to replace each byte. S-box is a 16×16 lookup table. Each byte is replaced by the corresponding value in the S-box. r means the main round from 1 to 9 bits.

[0143] S (r) =ShiftRows(S (r) )

[0144] Among them, ShiftRows means to circularly shift the rows of the state matrix, the first row remains unchanged, the second row is shifted left by one byte, the third row is shifted left by two bytes, and the fourth row is shifted left by three bytes;

[0145] S(r) =MixColumns(S (r) )

[0146] Among them, MixColumn means linear transformation of each column;

[0147]

[0148] Among them, K (r) It is the round key of the current round, which is the subkey generated by the master key and is used for encryption operations in the current round.

[0149] Final round;

[0150] In the final round, K (10) is the round key of the final round, and C is the policy ciphertext;

[0151] S (10) =SubBytes(S (9) )

[0152] S (10) =ShiftRows(S (10) )

[0153]

[0154] Finally, the policy ciphertext C is obtained and uploaded to the blockchain network.

[0155] The CP-ABE algorithm is used to encrypt the AES symmetric key. The specific process is as follows:

[0156] Generate the key SK through KeyGen(MK, S), where S is all the attributes of the access control policy P.

[0157] Use the encryption algorithm to obtain the AES symmetric key ciphertext C, establish the corresponding index according to the attribute, and mark the ciphertext C;

[0158] C=Encrypt(PK,MK,T)

[0159] Upload the marked ciphertext C and the access control policy to the blockchain network.

[0160] S4. According to the data access request issued by the data user, the corresponding attribute is queried in the blockchain network, and the queried attribute is used as the key to decrypt the symmetric key ciphertext. The obtained symmetric key is used to obtain the access control policy, where the file hash value contained in the policy plaintext can access the IPFS file data. The steps include:

[0161] Query the corresponding attributes according to the data access request issued by the data user and manage the contract chain code, including the following steps:

[0162] In the blockchain network, the data user issues an original access request and calls the information contract to query the relevant attribute information in the AA attribute database to construct an attribute-based access request AAR, which includes the requesting user, environment, operation, and resource attributes;

[0163] ARR=<sAtt,rAtt,aAtt,eAtt>

[0164] Among them, sAtt represents the subject attribute, rAtt represents the resource attribute, aAtt represents the set of operation attribute name-value pairs, and eAtt represents the environment attribute. The meaning of ARR is that the subject with the attribute sAtt performs the operation request aAtt on the resource rAtt under the condition of the environment attribute eAtt.

[0165] Extract the required attribute set sAtt from the attribute request ARR, and perform attribute matching on the symmetric key ciphertext C index in each block in the blockchain network;

[0166] The symmetric key ciphertext obtained by matching successfully is decrypted using the CP-ABE algorithm according to sAtt to obtain the symmetric key key;

[0167] key = Decrypt(C, sAtt)

[0168] Use the AES symmetric key key to decrypt the access control policy ciphertext and finally obtain the access control policy plaintext.

[0169] Obtain the hash value ciphertext CT from the access control policy plaintext, and decrypt it using the CP-ABE decryption algorithm to obtain the hash value plaintext M;

[0170] M = Decrypt (CT, rAtt)

[0171] The hash value can be used to access the IPFS network to obtain the target data.

[0172] Therefore, the present invention adopts the above-mentioned access control method based on ciphertext policy attribute-based encryption on blockchain, so that the encryption policy can be specified when encrypting data, which improves flexibility and security, can effectively protect data privacy and access control, and ensure that only authorized users can access data stored in the cloud.

[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. An access control method based on ciphertext policy attribute-based encryption on blockchain, It is characterized in that The following steps are involved: S1. Initialize the Hyperledger Fabric blockchain network, create certificates for each node in the blockchain network, use the trusted authority to generate the public key PK and the master key MK, and deploy the information contract and management contract chain code to the blockchain network; S2. After uploading the data to the Interplanetary File System (IPFS), the file hash value is obtained, and the file hash value is encrypted using attribute-based encryption (CP-ABE), and the hash value ciphertext is embedded into the access control policy. S3, perform AES symmetric encryption on the access control policy, perform attribute-based encryption CP-ABE on the obtained symmetric key, and finally upload the obtained access control policy ciphertext and AES symmetric key ciphertext to the blockchain network; S4. According to the data access request, the attribute corresponding to the request is queried in the blockchain network, and the queried attribute is used as the key to decrypt the symmetric key ciphertext. The obtained symmetric key is used to obtain the access control policy, where the file hash value contained in the access control policy is used to access the IPFS file data.

2. According to claim 1, an access control method based on ciphertext policy attribute-based encryption on blockchain, Features: In step S2, the hash value obtained after uploading the file is encrypted with attribute-based encryption (CP-ABE), which includes: S21. The data owner formulates an access control policy and uses a trusted authority to generate the public key PK and master key MK required for initializing the encryption algorithm. The access control policy P contains the following elements: Access control policy Policy = {(P 1 AND P 2 )OR(P 3 AND P 4 )}; Among them, P i is the attribute value, i∈1,2,3,4; S22, using the public key PK and the attributes in the access control policy, encrypting the file hash value using the CP-ABE algorithm to obtain a hash value ciphertext; Assume that the file hash value is M, convert the access control policy into the access control tree T, and use the encryption algorithm to generate the hash value ciphertext CT.

3. According to claim 2, an access control method based on ciphertext policy attribute-based encryption on blockchain, Features: In step S2, the attribute-based encryption CP-ABE includes an initialization algorithm, a private key algorithm, an encryption algorithm and a decryption algorithm.

4. According to claim 3, an access control method based on ciphertext policy attribute-based encryption on blockchain, Features: In step S2, the CP-ABE attribute-based encryption algorithm is initialized; Setup()→(PK,MK) Assume G 0 is a bilinear group of prime order p, and g is the group G 0 Generator, bilinear map e: G 0 ×G 0 →G 1 , the trusted authority generates private parameters α, β∈Z p , where Z p is an integer additive group modulo p, and the public key PK = (h = g β , y=e(g,g) α ), master key MK=(β, g α ), h is the value calculated using β as the exponent, e(g, g) α Where e is a bilinear map.

5. According to claim 3, an access control method based on ciphertext policy attribute-based encryption on blockchain, Features: In step S2, the private key algorithm of attribute-based encryption CP-ABE is used; KeyGen(MK, S) → SK Input attribute set S, select random input r∈Z p , for each attribute i∈S, select r i ∈Z p , both and Where H(i) is the mapping of attribute i to group G 0 function of elements, then SK is {D i , D' i }, g is the group G 0 Generator, g r is the generator g raised to the power r, g ri is the generator g raised to the power ri.

6. According to claim 3, an access control method based on ciphertext policy attribute-based encryption on blockchain, Features: In step S2, the encryption algorithm of CP-ABE attribute-based encryption; Encrypt(PK,M,T)→CT Where T is the access control tree transformed from the access control policy. For each node x in T, a polynomial q is selected. x ; Select polynomial: For each node x in T, including leaf nodes, a polynomial q is selected in top-down order starting from the root node R of the tree. x ; For each node x, its polynomial q x The number of times d x is set to the node threshold k x Subtract 1, which is d x =k x -1; Root node processing: Starting from the root node R, select a random number s∈Z p , and set it to the polynomial q R At point 0, which is the value of the root node, q R (0) = s, randomly select d R points to completely determine the polynomial q R ; Other node processing: For other nodes x in the tree, the polynomial q x The value at point 0 is set to its parent node q parent(x) The value at the current node index position, i.e. q x (0) = q parent(x) (index(x)), randomly select d x points to completely determine the polynomial q x ; The ciphertext CT consists of the following parts: Among them, M is the encrypted plaintext; C=h s C is the power term of the common parameter h; For each leaf node y∈Y: Among them, Cy is group G 0 The power term of the generator g, where qy (0) It is the value of the polynomial qy corresponding to the leaf node at point 0; Among them, C' y It is the result of a hash function H, and the input att(y) is the attribute of the leaf node.

7. According to claim 3, an access control method based on ciphertext policy attribute-based encryption on blockchain, Features: In step S2, the decryption algorithm of CP-ABE attribute encryption; Decrypt(CT,SK)→M When node x is a leaf node of the access control tree T, the following operations are performed: Let i = att(x), that is, the attribute corresponding to the leaf node x, check whether the attribute i is in the attribute set S of the private key SK. If i is in S, use the following algorithm formula for decryption: If attribute i is in S, the final result is If i is not in S, return "undecryptable"; When node x is a non-leaf node, the algorithm DecryptNode(CT, SK, x) continues as follows: for all child nodes z of x, recursively call DecryptNode(CT, SK, z) and store the decrypted results as F z Set, S x is the set of all child nodes of node x, F x For S x F of each child node z in z The value obtained by weighted cumulative calculation is that if there exists a child node set S such that for each child node z in the set, the decryption result F z =⊥, that is, decryption fails, indicating that the node x does not meet the decryption conditions. Otherwise, if the node x meets the decryption conditions, the following formula will be executed: Final Represents the original plaintext data, using r and polynomial q x The calculation of (0) is used to recover the plaintext M.

8. According to claim 3, an access control method based on ciphertext policy attribute-based encryption on blockchain, Features: Step S3 specifically includes the following steps: S31. Use the AES symmetric algorithm to encrypt the access control policy. Assuming that the policy plaintext P is 128 bits, i.e. 16 bytes, and the key MK is 128 bits, first convert the plaintext block and the key MK into a 4×4 byte matrix. The specific process is as follows: S311, round key addition; in, represents a bitwise XOR operation. For each corresponding element in the matrix, the plaintext P and the element corresponding to the key K are subjected to a bitwise XOR operation. S (0) is the initial state matrix, and is the matrix after the round key addition operation; S312, main wheel operation; For AES-128 there are 10 rounds in total; S (r) =SubBytes(S (r-1) ) Among them, SubBytes means using S-box to replace each byte. S-box is a 16×16 lookup table. Each byte is replaced by the corresponding value in the S-box. r means the main round from 1 to 9 bits. S (r) =ShiftRows(S (r) ) Among them, ShiftRows means to circularly shift the rows of the state matrix, the first row remains unchanged, the second row is shifted left by one byte, the third row is shifted left by two bytes, and the fourth row is shifted left by three bytes; S (r) =MixColumns(S (r) ) Among them, MixColumn means linear transformation of each column; Among them, K (r) is the round key of the current round, which is a subkey generated by the master key and is used for encryption operations of the current round; S313, final round; In the final round, K (10) is the round key of the final round, and C is the policy ciphertext; S (10) =SubBytes(S (9) ) S (10) =ShiftRows(S (10) ) Finally, the policy ciphertext C is obtained and uploaded to the blockchain network; S32. Use the CP-ABE algorithm to encrypt the AES symmetric key. The specific process is as follows: S321. Generate a key SK through KeyGen (MK, S), where S is all attributes of the access control policy P; S322, using the encryption algorithm to obtain the AES symmetric key ciphertext C, and at the same time establishing a corresponding index according to the attribute, and marking the ciphertext C; C=Encrypt(PK,MK,T) S323. Upload the marked ciphertext C and the access control policy to the blockchain network.

9. According to claim 8, an access control method based on ciphertext policy attribute-based encryption on blockchain, Features: The specific steps of step S4 include: S41. Query the corresponding attributes according to the data access request issued by the data user and manage the contract chain code, including the following steps: S411. In the blockchain network, the data user issues an original access request and calls the information contract to query the relevant attribute information in the AA attribute database to construct an attribute-based access request AAR, which includes the requesting user, environment, operation, and resource attributes; ARR=<sAtt,rAtt,aAtt,eAtt> Among them, sAtt represents the subject attribute, rAtt represents the resource attribute, aAtt represents the set of operation attribute name-value pairs, and eAtt represents the environment attribute. The meaning of ARR is that the subject with the attribute sAtt performs the operation request aAtt on the resource rAtt under the condition of the environment attribute eAtt. S412, extracting the required attribute set sAtt from the attribute request ARR, and performing attribute matching on the symmetric key ciphertext C index in each block in the blockchain network; S413, the symmetric key ciphertext obtained by the successful matching is decrypted according to sAtt using the CP-ABE algorithm to obtain the symmetric key key; key = Decrypt(C, sAtt) S42, decrypt the access control policy ciphertext using the AES symmetric key key to obtain the access control policy plaintext; S43, obtain the hash value ciphertext CT from the access control policy plaintext, and decrypt it using the CP-ABE decryption algorithm to obtain the hash value plaintext M; M = Decrypt (CT, rAtt) The hash value can be used to access the IPFS network to obtain the target data.

Citation Information

Patent Citations

  • Multi-cloud CP-ABE access control method based on block chain

    CN111130757A

  • Encryption method for onion network system consensus file

    CN112242898A

  • Cross-domain access control method and system based on block chain

    CN115426136A

  • Access control method based on block chain and attribute-based encryption

    CN116112244A

  • Electronic medical data sharing method based on strategy hiding and attribute updating

    CN116668149A

Cited By

  • Trusted digital object packaging method for data circulation

    CN119743266A

  • Intelligent traffic vehicle collaborative management method and system based on block chain

    CN120034857A

  • Data security sharing method based on block chain

    CN120223283A

  • Trusted data encapsulation, decryption and transmission method and system based on attribute password

    CN120528599A

  • Data interaction method and system for attribute set deduplication and key abuse

    CN120692101A