IoT-oriented access control method based on smart contract and CP-ABE

Through the combination of smart contracts and CP-ABE, the alliance chain and IPFS are used to realize decentralized access control of IoT devices, solving the difficulty of traditional centralized access control to cope with the scale and security of IoT devices, and achieving flexibility access control and efficient resource management.

CN119030739APending Publication Date: 2024-11-26HENAN AGRICULTURAL UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410958049.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

Traditional centralized access control is difficult to meet the complexity and scale needs of IoT devices, especially in an environment where devices are skyrocketing, resulting in security and privacy threats, and lack of unified device authentication and authorization standards.

Method used

Adopt access control methods based on smart contracts and CP-ABE, and realize decentralized access control through alliance chains and IPFS. Use smart contracts and CP-ABE encryption technology to authorize 1 pair of N, and combine them with interstellar file system for distributed storage. Ensure token updates and permission evaluations.

Benefits of technology

It realizes more flexible and fine-grained access control, reduces user communication costs, improves storage efficiency and processing capabilities, and ensures the security and privacy of IoT devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030739A_ABST
    Figure CN119030739A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of Internet of Things, and provides an IoT-oriented access control method based on a smart contract and CP-ABE. According to the access control method, an alliance chain is used as an underlying network, CP-ABE encryption is performed on a plaintext token, a ciphertext acquisition address is disclosed for any access object through an intelligent contract, and 1-to-N authorization is realized; more flexible and fine-grained access control is realized by setting an access strategy and formulating a constraint in a plaintext token; meanwhile, the token ciphertext is stored by using the interstellar file system, the token update and the ciphertext acquisition address are ensured to be unchanged while the distributed storage is realized, and the contract is further designed and deployed to the block chain to realize the decentralized authority evaluation of the token request and maintain the operation allowed by the subject on the specific resource object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of Internet of Things, and in particular to an access control method based on smart contracts and CP-ABE for IoT. Background Art

[0002] IoT devices cover various production fields, from sensors to smart homes, smart travel, agriculture, industry, etc. The scale of IoT devices connected to the Internet is unprecedented, and IoT data is growing exponentially. However, IoT devices are vulnerable to unauthorized security attacks, especially some sensors and actuators with limited computing power, which usually lack strong security protection mechanisms. When devices involve personal information processing, unauthorized access can lead to serious consequences such as information leakage and system failure, threatening people's safety and privacy. In addition, the lack of unified equipment authentication and authorization standards in actual production has led to equipment manufacturers using their own methods to provide these functions, triggering a large number of attacks against resource-constrained devices.

[0003] In traditional access control models, centralized authorization and access permission information are usually used for ease of management. However, IoT devices may belong to different organizations and have mobility and limited performance, which makes it difficult for centralized access control to meet the access control requirements in the IoT environment. Traditional access control mechanisms are unable to cope with the complexity and scale of the IoT.

[0004] With the rapid increase in the number of Internet of Things (IoT) devices, traditional centralized access control is difficult to support access control in the current large-scale IoT environment. Therefore, there is an urgent need to provide a technical solution to address the shortcomings of the above-mentioned existing technologies. Summary of the invention

[0005] The purpose of this application is to provide an access control method based on smart contracts and CP-ABE for IoT to solve or alleviate the problems existing in the above-mentioned prior art.

[0006] In order to achieve the above objectives, this application provides the following technical solutions:

[0007] The present application provides an access control method based on smart contracts and CP-ABE for IoT, including: step S101, the data requester locally registers its own attribute set S DU After asymmetric encryption, the attribute set ciphertext CS is obtained DURegister to the CA certificate extension domain of the alliance chain to obtain a registration attribute certificate; step S102, the data owner writes the symmetric encrypted ciphertext CT of the generated plaintext token and the ciphertext SKC obtained by encrypting the random symmetric key SKR into the ciphertext file CTP, and uploads the ciphertext file CTP to the IPNS under the distributed storage IPFS service, and publicly saves the returned hash of the ciphertext file CTP to the state library of the alliance chain; wherein the random symmetric key SKR is used to symmetrically encrypt the plaintext token to obtain the symmetric encrypted ciphertext CT; step S103, the data requester calls the smart contract AC to obtain the hash of the ciphertext file CTP, so as to download the ciphertext file CTP from the IPNS through the hash of the ciphertext file CTP, and performs CP-ABE decryption through the pre-generated attribute key to obtain the plaintext token; step S104, the intelligent gateway receives the resource request and the plaintext token sent by the data requester, connects to the alliance chain, and calls the smart contract VC to perform a decentralized evaluation on the data requester.

[0008] Preferably, in step S101, the data requester locally registers its own registration attribute set S DU After ECC elliptic curve encryption, the attribute set ciphertext CS is obtained DU ; Connect to the CA server of the alliance chain through the software development kit of the alliance chain, and convert the attribute set ciphertext CS DU The CA certificate extension domain registered to the alliance chain.

[0009] Preferably, in step S102, the data owner calls the smart contract AC to generate a plaintext token, and performs symmetric encryption on the plaintext token through a randomly generated random symmetric key SKR to obtain the symmetric encrypted ciphertext CT; and performs CP-ABE encryption on the random symmetric key SKR to obtain the ciphertext SKC.

[0010] Preferably, the data owner calls the smart contract AC to generate a plaintext token, and performs symmetric encryption on the plaintext token through a randomly generated random symmetric key SKR, including: obtaining a system public key MPK based on a pre-constructed bilinear mapping e; wherein the bilinear mapping is:

[0011] e:(G1×G2)→G T

[0012] In the formula, G1, G2, G T are all cyclic multiplicative groups of large prime order p; for G T The random element GT in is derived and a SHA-256 hash operation is performed to obtain the random symmetric key SKR;

[0013] The data owner calls the smart contract AC to generate a plaintext token, and uses the randomly generated random symmetric key SKR to perform the symmetric encryption on the plaintext token.

[0014] Preferably, the performing CP-ABE encryption on the random symmetric key SKR to obtain the ciphertext SKC includes: the attribute authorization center (AA) initializes the public parameter GP of the CP-ABE encryption; the data owner formulates an access control policy P, generates an access control tree ACT, and uploads the access control policy P to the alliance chain in the form of a byte array; according to the public parameter GP and the system public key SKR, the performing CP-ABE encryption on the random symmetric key SKR to obtain the ciphertext SKC.

[0015] Preferably, in step S102, the returned hash of the ciphertext file CTP is publicly saved in the state library of the alliance chain, specifically: the data owner appends the obtained hash of the ciphertext file CTP to the directory of the IPNS, and saves the created acquisition address IPNS_key corresponding to the hash of the ciphertext file CTP to the state library of the alliance chain through the smart contract AC, and discloses the acquisition permission of the acquisition address IPNS_key.

[0016] Preferably, in step S103, the data requester connects to the peer node of the alliance chain based on the registered attribute certificate to call the smart contract AC to obtain the attribute set ciphertext CS stored in the CA certificate extension field. DU , and the attribute set ciphertext CS DU Decrypt and obtain the registered attribute set S DU ; and the registration attribute set S DU The attribute key is sent to the attribute authority AA, which generates the attribute key and returns it to the data requester.

[0017] Preferably, the attribute set ciphertext CS DU Decrypt and obtain the registered attribute set S DU Specifically, the data requester uses the locally generated asymmetric private key SK to encrypt the attribute set ciphertext CS DU Decrypt and obtain the registered attribute set S DU .

[0018] Preferably, in step S103, the attribute authorization center AA generates an attribute key and returns it to the data requester, including: the attribute authorization center AA generates an attribute key according to:

[0019]

[0020] Generate attribute private key structure D and attribute private key structure D0; where g is a large prime number generator, t, α, β are all integer finite fields Z p Random numbers in ;

[0021] According to the registered attribute set S DU Generate attribute list S attList , and the attribute list S attList Each attribute i in is hashed and then exponentially calculated to obtain the set The collection Recombined with part of the attribute private key structure D and part of the attribute private key structure D0 to generate the attribute secret key of the data requester

[0022] Preferably, in step S104, the intelligent gateway performs JWS signature verification on the plaintext token; in response to the JWS signature verification being passed, a cyclic judgment is performed on the resource request and the access control policy P formulated by the data owner; in response to the resource request being in compliance with the access control policy P, the data requester is allowed to access the resources specified by the access control policy P.

[0023] Beneficial effects:

[0024] In the IoT-oriented access control method based on smart contracts and CP-ABE provided in the embodiment of the present application, the data requester locally registers its own attribute set S DU After asymmetric encryption, the attribute ciphertext CS DU Register to the CA certificate extension domain of the alliance chain to obtain a registered attribute certificate; the data owner writes the symmetric encrypted ciphertext CT of the generated plaintext token and the ciphertext SKC encrypted by the random symmetric key SKR that symmetrically encrypts the plaintext token into the ciphertext file CTP, and uploads the ciphertext file CTP to IPNS under the distributed storage IPFS service, and publicly saves the hash of the returned ciphertext file CTP to the state library of the alliance chain; then, the data requester calls the smart contract AC to obtain the hash of the ciphertext file CTP, downloads the ciphertext file CTP from IPNS through the hash of the ciphertext file CTP, and performs CP-ABE decryption through the pre-generated attribute key to obtain the plaintext token; finally, after receiving the resource request and plaintext token sent by the data requester, the smart gateway connects to the alliance chain and calls the smart contract VC to perform a decentralized evaluation on the data requester.

[0025] Therefore, on the one hand, with the alliance chain as the underlying network, CP-ABE encryption is performed on the plaintext token, and the ciphertext acquisition address is made public to any access object through smart contracts to achieve 1 to N authorization; at the same time, more flexible and fine-grained access control is achieved through access policy settings and constraints in the plaintext token; on the other hand, the interplanetary file system (IPFS) is used to save the token ciphertext, and distributed storage is achieved while ensuring token updates. The ciphertext acquisition address remains unchanged, and further contracts are designed and deployed to the blockchain to realize decentralized permission evaluation of token requests and maintain the operations allowed by the subject on specific resource objects. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. Among them:

[0027] Figure 1 A flowchart of an IoT-oriented access control method based on smart contracts and CP-ABE provided according to some embodiments of the present application;

[0028] Figure 2 Schematic diagram of the architecture of the access control method based on smart contract and CP-ABE for IoT provided according to some embodiments of the present application

[0029] Figure 3 A logic diagram of an IoT-oriented access control method based on smart contracts and CP-ABE provided according to some embodiments of the present application;

[0030] Figure 4 A logical diagram of authority evaluation for a data requester provided according to some embodiments of the present application. DETAILED DESCRIPTION

[0031] The present application will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. Each example is provided by way of explanation of the present application and does not limit the present application. In fact, it will be clear to those skilled in the art that modifications and variations may be made in the present application without departing from the scope or spirit of the present application. For example, a feature shown or described as a part of an embodiment may be used in another embodiment to produce yet another embodiment. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the embodiments of the present invention should belong to the scope of protection of the embodiments of the present invention.

[0032] With the rapid increase in the number of IoT devices, traditional centralized access control is difficult to support the access control of the current large-scale IoT environment. The development of blockchain technology provides a new way to build secure, transparent and decentralized IoT access control. Blockchain, with its P2P, immutable and smart contract features, has become an ideal choice for improving IoT access control. Existing blockchain-based access control methods are mainly divided into two categories: one is to achieve decentralized storage based on distributed ledgers, and the other is distributed storage based on smart contracts. In these two methods, when using the symmetric encryption algorithm (Advanced Encryption Standard, referred to as AES) to encrypt data, it is necessary to establish a one-to-one key sharing channel between the data owner and the data requester. Especially in the IoT environment, it inevitably increases the communication cost of users, that is, distributed access control has high monetary costs, low storage efficiency, and low throughput for processing access requests.

[0033] First, in this application, smart contracts AC and VC are designed, wherein smart contract AC is called by the data requester and the data owner, and the data owner completes the encryption access control strategy and the chain of the acquisition address of the plaintext token through the smart contract AC; the data requester obtains the CAD certificate attributes through the smart contract AC and completes the CP-ABE key generation; the smart contract VC is called by the IoT smart gateway and parses the plaintext token to realize decentralized authority verification.

[0034] Based on this, this application proposes an access control method based on smart contracts and CP-ABE for IoT, such as Figures 1 to 4 As shown, the access control method includes:

[0035] Step S101: The data requester locally registers its own attribute set S DU After asymmetric encryption, the attribute set ciphertext CS is obtained DU Register to the CA certificate extension domain of the alliance chain and obtain the registration attribute certificate.

[0036] In this application, the data requester is defined as obtaining an IoT resource token (plaintext token) and sending a resource request. When registering attributes, the data requester first locally registers its own registered attribute set S DU After ECC elliptic curve encryption, the attribute set ciphertext CS is obtained DU ; Then, connect to the CA server of the alliance chain through the alliance chain software development kit and pass the attribute set ciphertext CS DU Register the CA certificate extension domain of the alliance chain.

[0037] Here, we take the alliance chain Hyperledger Fabric as an example. The CA server of the alliance chain Hyperledger Fabric is a trusted entity, responsible for managing the chain user digital certificates, and registering the attribute information of the data requester in the CA certificate extension domain, such as role, name, age, unit, department, etc. The data requester (DU) connects to the Fabric-CA server through Fabric-sdk and enters the user attribute set Attrs (key1: "attr1", key2: "attr2", key3: "attr3") to perform identity registration. Due to the openness and transparency of the PKI certificate system, in order to ensure the privacy and security of user data, the local attribute set S registered by the data requester is DU Asymmetric encryption is performed so that the CA certificate extension field presents ciphertext data.

[0038] Step S102: The data owner writes the generated symmetric encrypted ciphertext CT of the plaintext token and the ciphertext SKC obtained by encrypting the random symmetric key SKR into the ciphertext file CTP, uploads the ciphertext file CTP to the IPNS under the distributed storage IPFS service, and publicly saves the hash of the returned ciphertext file CTP to the state library of the alliance chain.

[0039] In this application, the data owner (DO) is defined as being responsible for formulating data access control policies, calling smart contracts to generate tokens, encrypting them and uploading them to the IPFS (interplanetary file system, IPFS for short) server, publicly saving the acquisition address of the plaintext token in the state library of the alliance chain, and issuing plaintext tokens.

[0040] First, the data owner calls the smart contract AC to generate a plaintext token, and performs symmetric encryption on the plaintext token through the randomly generated random symmetric key SKR to obtain the symmetric encrypted ciphertext CT; CP-ABE encryption is performed on the random symmetric key SKR to obtain the ciphertext SKC.

[0041] Among them, the attribute authority (AA) constructs a bilinear map e:

[0042] e:(G1×G2)→G T

[0043] Get the system public key MPK. In the formula, G1, G2, G T are all cyclic multiplicative groups of large prime order p. Specifically, generate random numbers α, β∈Z p (Z p is a finite field of integers), and calculate Y=e(g,g) α and β, get the system public key MPK = {Y,g β}. T The random GT element in is derived and the value obtained by performing SHA-256 hash operation is set as the random symmetric key SKR. Then, the data owner calls the smart contract AC to generate a plaintext token, and uses the random symmetric key SKR to symmetrically encrypt the generated plaintext token to obtain the symmetric encrypted ciphertext CT.

[0044] At the same time, the attribute authorization center (AA) initializes the CP-ABE encrypted public parameter file GP, the data owner formulates the access control policy P, builds the access control tree ACT according to the access control structure, and uploads the access control policy P = "(AANDB)ORC" to the alliance chain in the form of a byte array. The random symmetric key SKR is encrypted by CP-ABE through the public parameter file GP and the system public key MPK to obtain the ciphertext SKC.

[0045] Subsequently, the symmetric encrypted ciphertext CT and ciphertext SKC are written into the ciphertext file CTP, and the ciphertext file CTP is uploaded to the IPNS (Inter-Planetary Naming System) under the distributed storage IPFS service. The hash of the returned ciphertext file CTP is publicly saved in the Fabric chain to record its status.

[0046] Among them, the random symmetric key SKR is encrypted by CP-ABE, and the generated random number s∈Z p , calculate the ciphertext component C = e(g,g) α(alpha s) , C0=g s , split s as a secret along the access control tree ACT, so that the secret shard corresponding to the attribute i of the leaf node is γ i , perform a hash operation on the attribute i of each leaf node to obtain H(i) to map the attribute to the multiplication cycle group G1. Generate a random number p i ∈Z p ,calculate:

[0047]

[0048] Get the encrypted ciphertext of the random symmetric key SKR Among them, leafNodes is the combination of access control tree leaf node attributes.

[0049] After the data owner uploads the ciphertext file CTP, the hash of the ciphertext file CTP is returned to the data owner. The data owner appends the hash of the ciphertext file CTP to the IPNS directory, and saves the created acquisition address IPNS_key corresponding to the hash of the ciphertext file CTP to the state library of the alliance chain through the smart contract AC, and publicly discloses the acquisition rights of the acquisition address IPNS_key to achieve 1 to N authorization.

[0050] Here, it should be noted that the attribute authorization center (AA) is defined as a completely trustworthy data owner and data requester that interacts with it in the system, initializes the generation and distribution of complex CP-ABE algorithm parameters, generates secret keys and related parameters, and returns them to the participants of the scheme. IPFS service is defined as providing distributed storage services and storing token ciphertext encrypted by CP-ABE.

[0051] Step S103: The data requester calls the smart contract AC to obtain the hash of the ciphertext file CTP, downloads the ciphertext file CTP from IPNS through the hash of the ciphertext file CTP, and performs CP-ABE decryption through the pre-generated attribute key to obtain a plaintext token.

[0052] In this application, the data requester has registered the attribute certificate through Fabric-CA, and connected to the peer node of the alliance chain based on the registered attribute certificate to call the smart contract AC to obtain the attribute set ciphertext CS stored in the CA certificate extension field DU , and the attribute set ciphertext CS DU Decrypt and get the registered attribute set S DU , and register the attribute set S DU It is sent to the attribute authorization center AA, which generates the attribute key and returns it to the data requester.

[0053] Specifically, the data requester connects to the chain network with the identity certificate and calls the smart contract AC to obtain the attribute set ciphertext CS stored in the certificate extension domain. DU , use the locally generated asymmetric private key SK to cipher the attribute set CS DU Execute decryption to obtain the user registration attribute set S DU ; and register the attribute set S DU Sent to the attribute authorization center to generate the attribute key.

[0054] The attribute authorization center performs attribute key generation according to:

[0055]

[0056] Generate attribute private key structure D and attribute private key structure D0; where g is a large prime number generator, t, α, β are all integer finite fields Z pRandom numbers in ;

[0057] According to the registered attribute set S DU Generate attribute list S attList , and for the attribute list S attList Each attribute i in D is hashed and then exponentially calculated. i =H(i) t , get the set Will gather Recombined with partial attribute private key structure D and partial attribute private key structure D0 to generate the attribute secret key of the data requester And return it to the data requester.

[0058] In this application, the data owner appends the hash of the obtained ciphertext file CTP to the directory of IPNS, and saves the created acquisition address IPNS_key corresponding to the hash of the ciphertext file CTP to the state library of the alliance chain through the smart contract AC, and publicly obtains the access rights of the address IPNS_key. Then, the data requester calls the smart contract AC to obtain the hash of the ciphertext file CTP to download the ciphertext file CTP from IPNS through the hash of the ciphertext file CTP. In other words, the data requester downloads the ciphertext file CTP from IPNS through the acquisition address IPNS_key publicly disclosed in the alliance chain state library, and then, according to the attribute secret key fed back by the attribute authorization center, performs CP-ABE decryption on the ciphertext file CTP through the attribute secret key to obtain a plaintext token.

[0059] Specifically, the acquisition address IPNS_key of the ciphertext file CTP is public, and the data requester calls the smart contract AC to obtain the acquisition address IPNS_key on the chain, and downloads the ciphertext file CTP from IPNS with the acquisition address IPNS_key. Then, the ciphertext is decrypted, and the attribute secret key ABESK and the ciphertext file CTP are input to register the attribute set S DU The attribute i that overlaps with the attribute set of the leaf node of the access control tree ACT is calculated:

[0060]

[0061] All the overlapping P i (Access control policy corresponding to attribute i) is used as the secret shard to perform Lagrangian difference factor exponential operation. Recover the root node secret value formally and calculate e(C0,D)=e(g,g) αs e(g,g) βts , we get e(g,g) αs Finally, the plaintext token M=C / e(g,g) is calculated. αs .

[0062] Step S104: The intelligent gateway receives the resource request and plaintext token sent by the data requester, connects to the alliance chain, and calls the smart contract VC to perform a decentralized evaluation on the data requester.

[0063] In this application, the smart gateway is defined to be responsible for connecting IoT devices to the cloud, accessing and analyzing sensor data to make decisions, receiving verification requests sent by data requesters, and calling smart contracts VC to complete permission evaluation. After verification, the corresponding data will be returned according to the request of the data requester.

[0064] That is, the data requester sends the resource request and the decrypted plaintext token to the smart gateway, which connects to the consortium chain network, calls the smart contract VC, and performs decentralized permission evaluation on the data requester's request. Specifically, the smart gateway performs JWS signature verification on the plaintext token. When the JWS signature verification passes (that is, the plaintext token has not been tampered with), the resource request of the data requester and the access control policy P formulated by the data owner are cyclically judged, including the equipment, resources, permissions and constraints that meet the policies set by the data owner. When the resource request of the data requester complies with the access control policy P, the data requester is allowed to access the specified device resources, that is, the resources defined by the access control policy P.

[0065] Here, the smart contract VC is called to parse the plaintext token (token JSON) sent by the data requester, and the chain user public key (ECDSA) of the data owner is input to verify the JWS signature to ensure that the plaintext token sent by the data requester is not tampered with and valid, completing the identity authentication of the data requester. In order to avoid inconsistency between the resource request and the plaintext token content, it is necessary to obtain the request policy (req_policy) of the resource request, and determine whether the request policy (req_policy) is consistent with the access control policy P (policy) recorded on the smart contract AC. If and only if the request policy (req_policy) is consistent with the access control policy, it indicates that the data requester can access the corresponding device resources. If an error occurs in any process of identity authentication and permission request, the resource request of the data requester is rejected.

[0066] Through the smart contract VC, the data owner is defined by dynamic condition constraints, such as time, location, IP, etc. to perform permission evaluation. After the smart contract loop determines that the fields of the plaintext token sent by the data requester, such as equipment, resources, permissions, condition constraints, etc., meet the policies set by the data owner, the data requester is authorized to access the specified device resources.

[0067] When the data owner executes the access control policy update, the smart contract AC is called to update the access control policy saved on the alliance chain, and the plaintext token is generated again. The access control tree is rebuilt according to the updated access control policy, and a random symmetric key SKR is randomly generated. The plaintext token and the random symmetric key are re-encrypted to obtain the updated ciphertext file CTP, which is re-uploaded to IPNS according to the unchanged name address (the acquisition address IPNS_key of the ciphertext file CTP). The returned hash of the updated ciphertext file CTP is appended to the IPNS directory. Since the old plaintext token no longer has the latest access rights when it is updated, when retrieving access rights from IPNS, the data owner always refers to the last record in the IPNS file directory. Finally, the smart contract AC is called to update the policy status saved in the alliance chain state library.

[0068] Therefore, the plaintext token is parsed on the chain through smart contracts, and the resource requests sent by the data requester are verified for permissions, realizing decentralized attribute-based access control and achieving the effect of fine-grained access control.

[0069] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0070] In the present invention, the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" mean that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0071] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. An access control method based on smart contracts and CP-ABE for IoT. It is characterized in that include: Step S101: The data requester locally registers its own attribute set S DU After asymmetric encryption, the attribute set ciphertext CS is obtained DU Register to the CA certificate extension domain of the alliance chain to obtain a registration attribute certificate; Step S102: The data owner writes the generated plaintext token's symmetric encrypted ciphertext CT and the ciphertext SKC obtained by encrypting the random symmetric key SKR into the ciphertext file CTP, uploads the ciphertext file CTP to the IPNS under the distributed storage IPFS service, and publicly saves the returned hash of the ciphertext file CTP into the state library of the alliance chain; wherein the random symmetric key SKR is used to symmetrically encrypt the plaintext token to obtain the symmetric encrypted ciphertext CT; Step S103: The data requester calls the smart contract AC to obtain the hash of the ciphertext file CTP, downloads the ciphertext file CTP from the IPNS through the hash of the ciphertext file CTP, and performs CP-ABE decryption through the pre-generated attribute key to obtain the plaintext token; Step S104: The intelligent gateway receives the resource request and the plaintext token sent by the data requester, connects to the alliance chain, and calls the smart contract VC to perform a decentralized evaluation on the data requester.

2. According to the IoT-oriented access control method based on smart contracts and CP-ABE according to claim 1, It is characterized in that In step S101, The data requester locally registers its own registration attribute set S DU After ECC elliptic curve encryption, the attribute set ciphertext CS is obtained DU ; Connect the CA server of the alliance chain through the software development kit of the alliance chain, and send the attribute set ciphertext CS DU The CA certificate extension domain registered to the alliance chain.

3. According to the IoT-oriented access control method based on smart contracts and CP-ABE according to claim 1, It is characterized in that In step S102, The data owner calls the smart contract AC to generate a plaintext token, and performs symmetric encryption on the plaintext token using a randomly generated random symmetric key SKR to obtain the symmetric encrypted ciphertext CT; And, CP-ABE encryption is performed on the random symmetric key SKR to obtain the ciphertext SKC.

4. According to claim 3, the IoT-oriented access control method based on smart contracts and CP-ABE, It is characterized in that The data owner calls the smart contract AC to generate a plaintext token, and performs symmetric encryption on the plaintext token using a randomly generated random symmetric key SKR, including: Based on the pre-constructed bilinear mapping e, the system public key MPK is obtained; wherein the bilinear mapping is: e:(G 1 ×G 2 )→G T In the formula, G 1 , G 2 , G T They are all cyclic multiplicative groups of large prime order p; For G T The random element GT in is derived and a SHA-256 hash operation is performed to obtain the random symmetric key SKR; The data owner calls the smart contract AC to generate a plaintext token, and uses the randomly generated random symmetric key SKR to perform the symmetric encryption on the plaintext token.

5. According to claim 4, the IoT-oriented access control method based on smart contracts and CP-ABE, It is characterized in that The performing CP-ABE encryption on the random symmetric key SKR to obtain the ciphertext SKC includes: The attribute authority (AA) initializes the public parameter GP encrypted by the CP-ABE; The data owner formulates an access control policy P, generates an access control tree ACT, and uploads the access control policy P to the consortium chain in the form of a byte array; According to the public parameter GP and the system public key SKR, CP-ABE encryption is performed on the random symmetric key SKR to obtain the ciphertext SKC.

6. According to claim 1, the IoT-oriented access control method based on smart contracts and CP-ABE, It is characterized in that In step S102, the returned hash of the ciphertext file CTP is publicly saved in the state library of the alliance chain, specifically: The data owner appends the hash of the ciphertext file CTP to the directory of the IPNS. The created acquisition address IPNS_key corresponding to the hash of the ciphertext file CTP is saved in the state library of the alliance chain through the smart contract AC, and the acquisition authority of the acquisition address IPNS_key is made public.

7. According to claim 1, the IoT-oriented access control method based on smart contracts and CP-ABE, It is characterized in that In step S103, The data requester connects to the peer node of the alliance chain based on the registered attribute certificate to call the smart contract AC to obtain the attribute set ciphertext CS stored in the CA certificate extension field. DU , and the attribute set ciphertext CS DU Decrypt and obtain the registered attribute set S DU ; And the registration attribute set S DU The attribute key is sent to the attribute authority AA, which generates the attribute key and returns it to the data requester.

8. The IoT-oriented access control method based on smart contracts and CP-ABE according to claim 7, wherein the attribute set ciphertext CS DU Decrypt and obtain the registered attribute set S DU , specifically: The data requester uses the locally generated asymmetric private key SK to encrypt the attribute set ciphertext CS. DU Decrypt and obtain the registered attribute set S DU .

9. The IoT-oriented access control method based on smart contracts and CP-ABE according to claim 1, It is characterized in that In step S103, the attribute authority AA generates an attribute key and returns it to the data requester, including: The attribute authority AA follows: Generate attribute private key structure D and attribute private key structure D 0 ; In the formula, g is a large prime number generator, t, α, β are all integer finite fields Z p Random numbers in ; According to the registered attribute set S DU Generate attribute list S attList , and the attribute list S attList Each attribute i in is hashed and then exponentially calculated to obtain the set The collection and the attribute private key structure D of part of the attribute, the attribute private key structure D of part of the attribute 0 Reorganize to generate the attribute key of the data requester 10. The IoT-oriented access control method based on smart contracts and CP-ABE according to claim 1, It is characterized in that In step S104, The intelligent gateway performs JWS signature verification on the plaintext token; In response to the JWS signature verification being passed, a cyclic judgment is performed on the resource request and the access control policy P formulated by the data owner; In response to the resource request being in compliance with the access control policy P, the data requester is allowed to access the resources defined by the access control policy P.

Citation Information

Cited By

  • Internet of Things data access control method and system

    CN119922025A