A cloud-edge trusted collaborative method and system based on blockchain and container inference models
Patent Information
- Application Number
- CN202211664951.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2042-12-23
AI Technical Summary
[0005]2、推理模型被劫持带来数据隐私泄露或恶意利用等问题
1)提出一种基于数字签名的容器镜像完整性验证方法,解决容器镜像中的推理模型被篡改而导致推理服务不可用等问题,实现边缘端推理模型的完整性可信验证;
Smart Images

Figure CN116127484B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a cloud-edge trusted collaboration method and system based on blockchain and container inference models, belonging to the field of cloud-edge collaboration. Background Technology
[0002] With the rapid development of artificial intelligence and edge computing, various complex inference business scenarios have emerged at the edge, making inference more real-time, efficient, and user-friendly. However, due to limited edge computing resources and insufficient computing power, cloud-edge collaboration for artificial intelligence has attracted widespread attention from researchers.
[0003] Cloud-edge collaboration for artificial intelligence tightly integrates cloud computing and edge computing. Through integrated cloud-edge orchestration and management, with the cloud side responsible for training and the edge side responsible for inference, cloud and edge complement each other and resources are integrated. Inference business models are then deployed to the edge, enabling the decentralization of cloud computing power and the extension of inference services, such as intelligent monitoring in smart transportation and data inference decision-making in the Internet of Things. Furthermore, containers, as a widely used lightweight technology with excellent characteristics such as portability and rapid startup, are considered a common carrier for deploying inference models from the cloud and an important tool for deploying inference services on the edge. Container technology provides an optimal solution to the complexities of edge service management, accelerating the development of cloud-edge collaboration.
[0004] With the access of untrusted edge devices, the diversification of cloud-edge communication protocols, and weak network environments, various security issues pose significant challenges to cloud-edge collaboration. For example, inference models may be hijacked or tampered with due to insecure communication between the cloud and the edge, leading to malicious actors implanting model viruses or using attack methods to deduce original private data. To address these risks, current technologies mostly employ controllable oversight systems based on third-party supervision, but these cannot guarantee the complete trustworthiness of third parties in the production environment. With the rapid development of blockchain, some technologies have also utilized decentralized oversight systems based on blockchain, but these still cannot achieve high-level security protection for the integrity and confidentiality of inference models under cloud-edge collaboration, thus failing to create a trusted cloud-edge collaborative environment. Therefore, under the current technological background, inference models under cloud-edge collaboration still face many security issues, such as... Figure 1 The illustrated scenario describes a situation where the inference model in a cloud-edge collaborative environment is tampered with and hijacked. The specific details are as follows: 1. Tampering with the inference model can render the model unusable or cause peripheral service poisoning. Untrusted cloud environments and insecure cloud-edge network communication protocols can both lead to the tampering of inference models. Cloud intrusions or "man-in-the-middle" attacks on the HTTPS transport protocol can result in malicious actions such as infected model replacement, Trojan virus implantation, and modification of the network layer. However, when the inference model is used at the edge without a secure and reliable integrity verification mechanism, it can lead to erroneous output of edge inference results and unforeseen risks such as unforeseen events affecting the edge inference service. Therefore, integrity verification of the inference model at the edge is crucial in a cloud-edge collaborative system.
[0005] 2. Hijacking of inference models can lead to data privacy leaks or malicious exploitation. Insecure cloud-edge network communication protocols can lead to the hijacking of inference models. When inference models are distributed from the cloud, malicious third parties or malicious edge devices can hijack them and use techniques such as member inference attacks to deduce the original private data, resulting in serious privacy leaks. They can also maliciously use the inference model for illegal business scenarios. Therefore, protecting the confidentiality of inference models is crucial in cloud-edge collaboration.
[0006] In summary, how to simultaneously address the issues of malicious tampering and privacy leakage of inference models in cloud-edge scenarios, achieve integrity verification and confidentiality protection of inference models under cloud-edge collaboration, and build a trustworthy cloud-edge collaborative inference environment has become an urgent technical problem to be solved. Summary of the Invention
[0007] This invention addresses the issues of inference model tampering and privacy leakage in cloud-edge collaborative scenarios by proposing a cloud-edge trusted collaborative method and system for inference models based on blockchain and containers. The invention loads the inference model into a container image and leverages the immutability, strong consensus, and decentralized trusted mechanism of blockchain. It designs a container image integrity verification method based on digital signatures, a container image confidentiality protection method based on encryption algorithms, and a fine-grained key management mechanism based on smart contracts. This provides integrity verification and end-to-end confidentiality protection capabilities, enabling trusted cloud-edge collaboration of inference models.
[0008] The technical solution of this invention is as follows: A cloud-edge trusted collaborative method based on blockchain and container inference models includes the following steps: 1) Cloud-edge blockchain construction: The edge and cloud terminals jointly form a blockchain through registration, authentication and authorization using blockchain technology, building a trusted cloud-edge collaborative environment; 2) Image User Group Generation: After the cloud-edge blockchain is built, the cloud prepares a trained inference model for the edge based on the business needs of the edge and the cloud's business allocation to the edge, and deploys the model in a container, packages it into a container image, and generates an image user group. 3) Encryption key group generation: The cloud generates a symmetric encryption key group based on the number of mirror user groups; 4) Container image key encryption: After the cloud generates a symmetric encryption key set, the cloud uses container image encryption technology to encrypt the container image corresponding to the symmetric encryption key set, generating an encrypted image, realizing confidential transmission between the cloud and the edge and encrypted startup at the edge. 5) Unique Feature Value Extraction: After the encrypted image is generated in the cloud, the cloud uses a hash algorithm based on digital signature technology to extract the unique feature value from the encrypted image; 6) Off-chain transmission of encrypted images: After the cloud extracts the unique feature value of the encrypted image, it transmits the encrypted image to the corresponding edge device through off-chain transmission according to the image user group. 7) Unique feature value on-chain: The cloud uses a feature value smart contract to store the unique feature value on the blockchain; 8) Encryption key set on-chain: The cloud stores the encryption key set on the blockchain by calling the key smart contract; 9) Feature value integrity comparison: After receiving the encrypted image, the edge device extracts the feature value of the encrypted image using the same hash algorithm in step 5), calls the feature value smart contract to read the corresponding unique feature value from the chain, and performs feature value integrity comparison to determine whether the encrypted image has been tampered with. If the two feature values are consistent, it means that the encrypted image has not been tampered with; otherwise, it means that it has been tampered with. 10) Edge users obtain keys: After the user compares the feature values, the edge terminal calls the key smart contract to read the user's corresponding encryption key from the chain; 11) User starts encrypted image: After obtaining the encryption key, the user uses the key to start the encrypted image directly and complete the deployment of edge services.
[0009] Preferably, in step 1), the cloud and the edge constitute a consortium blockchain based on Hyperledger Fabric.
[0010] Preferably, in step 3), the symmetric encryption algorithm AES is used to generate a symmetric encryption key group.
[0011] Preferably, in step 4), each layer of the container image is encrypted using a key, and the key's metadata is added to the image configuration of each layer, ultimately forming a complete encrypted image.
[0012] Preferably, the hash algorithm for the digital signature technology in step 5) is MD5, SHA-1, or SHA-256.
[0013] Preferably, in step 6), the cloud establishes an HTTPS secure transmission channel with the edge terminal based on the correspondence between the mirror and the edge terminal in the mirror user group, and then sends the encrypted mirror to the corresponding edge terminal through the HTTPS secure transmission channel.
[0014] Preferably, in step 7), the cloud initiates a data upload request to the blockchain by calling the feature value smart contract. The blockchain achieves consensus among all blockchain nodes through endorsement strategies and consensus mechanisms, generates a block and uploads it to the chain, and then stores the unique feature value on the chain.
[0015] Preferably, in step 8), the cloud initiates a data upload request to the blockchain by calling the key smart contract. The blockchain achieves consensus among all blockchain nodes through endorsement strategies and consensus mechanisms, generates blocks and uploads them to the chain, and then stores the encrypted key group on the chain. In this case, an access control function is added to the key smart contract to control the read permissions of the data on the chain.
[0016] Preferably, in step 10), when the edge terminal calls the key smart contract, the smart contract first uses the access permission function to determine whether the edge terminal that reads the key meets the access permission requirements based on the correspondence between the edge terminal, the mirror, and the key. If it meets the requirements, the key can be read; otherwise, access is denied.
[0017] A cloud-edge trusted collaborative system based on blockchain and container inference models includes a cloud, an edge, and a blockchain. The cloud includes edge user management components, key generation components, image encryption components, unique feature extraction components, and on-chain data management components. The edge includes smart contract invocation components, integrity verification components, and image encryption startup components. The blockchain includes a consensus mechanism and smart contracts. The edge user management component is used to obtain service requirements and metadata from the edge, allocate inference models to the edge based on service requirements and metadata information, deploy the models in containers and package them into images, and generate image user groups. A key generation component is used to generate symmetric encryption keys; The image encryption component is used to encrypt container images using keys provided by the key generation component. A unique feature extraction component is used to extract unique feature values from encrypted images using a hash algorithm; The on-chain data management component is used to manage encryption keys and unique feature values on the blockchain by calling smart contracts. The smart contract invocation component is used to invoke smart contracts on the blockchain to read on-chain data; The integrity verification component is used to compare the feature value of the encrypted image on the chain with the feature value of the locally generated encrypted image to verify whether the received encrypted image has been tampered with. The image encryption boot component is used to encrypt and boot the received encrypted image using the key obtained on the blockchain.
[0018] Compared with the prior art, the positive effects of the present invention are as follows: 1) A container image integrity verification method based on digital signature is proposed to solve the problem that the inference model in the container image is tampered with, resulting in the unavailability of the inference service, and to realize the integrity and trustworthy verification of the inference model at the edge. 2) A method for protecting the confidentiality of container images based on encryption algorithms is proposed to solve the problem of privacy leakage caused by the hijacking of inference models in container images, and to achieve confidentiality protection of inference models under cloud-edge collaboration. 3) A fine-grained key management mechanism based on smart contracts is proposed, which provides anti-tampering and secure transmission functions for encryption keys, solves the problem of malicious launch of other encrypted images at the edge, realizes fine-grained secure key management, and further improves the edge confidentiality protection capability of the inference model; 4) Design a cloud-edge trusted collaborative system for inference models based on blockchain and containers. This system realizes the integrity verification and confidentiality protection of inference models under cloud-edge collaboration, and builds a secure and trusted cloud-edge collaborative environment. Attached Figure Description
[0019] Figure 1 This is an example diagram illustrating scenarios where traditional cloud-edge collaborative inference models are hijacked and tampered with.
[0020] Figure 2 This is a flowchart of a cloud-edge trusted collaborative method based on a blockchain and container inference model, according to an embodiment of the present invention.
[0021] Figure 3 This is a structural diagram of a cloud-edge trusted collaborative system based on a blockchain and container inference model, according to an embodiment of the present invention. Detailed Implementation
[0022] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0023] This invention discloses a cloud-edge trusted collaborative method based on a blockchain and container inference model. Figure 2 The workflow for a cloud-edge trusted collaboration method based on blockchain and container inference models includes the following steps: Step 1: Cloud-Edge Blockchain Construction: The edge device and the cloud jointly form a blockchain through registration, authentication and authorization using blockchain technology, building a trusted cloud-edge collaborative environment; Step 2: Mirror User Group Generation: After the blockchain is built, the cloud will prepare a trained inference model for the edge based on the business needs of the edge and the cloud's business allocation to the edge, and deploy the model in a container, package it into a container image, and finally generate a mirror user group. Step 3: Encryption Key Group Generation: The cloud generates a symmetric encryption key group based on the number of mirror user groups; Step 4: Container Image Key Encryption: After the cloud generates a symmetric encryption key set, the cloud uses container image encryption technology to encrypt the container image corresponding to the symmetric encryption key set, generating an encrypted image to achieve confidential transmission between the cloud and the edge and encrypted startup at the edge. Step 5: Unique Feature Extraction: After the encrypted image is generated in the cloud, the cloud uses digital signature technology, such as hash algorithms like MD5, SHA-1, and SHA-256, to extract the unique feature value from the encrypted image. Step 6: Off-chain transmission of encrypted image: After the cloud extracts the unique feature value of the encrypted image, it transmits the encrypted image to the corresponding edge device through off-chain transmission according to the image user group. Step 7: On-chain storage of unique feature values: The cloud uses a feature value smart contract to store the unique feature values on the blockchain; Step 8: Uploading the encryption key set to the blockchain: The cloud uses a key smart contract to upload and store the encryption key set to the blockchain; Step 9: Feature Value Integrity Comparison: After receiving the encrypted image, the edge device extracts the feature value of the encrypted image using the same hash algorithm as in Step 5, calls the feature value smart contract to read the corresponding unique feature value from the chain, and performs a feature value integrity comparison to determine whether the encrypted image has been tampered with. Step 10: Edge users obtain keys: After the user compares the feature values, the edge device calls the key smart contract to read the user's corresponding encryption key from the chain; Step 11: User starts the encrypted image: After obtaining the encryption key, the user uses the key to start the encrypted image directly and complete the edge service deployment.
[0024] As a preferred implementation, to build a trusted cloud-edge collaborative environment, the cloud and edge devices form a consortium blockchain based on Hyperledger Fabric. The consortium blockchain enables access control for both the cloud and edge, as well as newly added edge nodes. This is achieved by verifying identity information, issuing CA certificates, loading communication permissions, and granting them the authority to join the consortium blockchain. As a preferred implementation, after the "cloud-edge" blockchain is formed, the cloud determines the required inference model for each edge based on the demand information transmitted from each edge or the tasks that the cloud needs to assign to the edge. The inference model is then deployed in a container and packaged into a container image. Furthermore, the cloud groups edge devices with the same image into a group, generating an image user group (Repo_A). (1~i) Repo_B (p~m) ,…,Repo_N (q~n) ), where Repo_A (1~i)This means that the cloud groupes edge users with indexes 1 to i who own image Repo_A into one group, and so on. The cloud generates container image groups to determine the correspondence between different images and different edge devices, and synchronizes the relevant information to the smart contract, enabling fine-grained management of the distributed images by the cloud.
[0025] As a preferred implementation, after generating a mirror user group in the cloud, a symmetric encryption key group (Key) is generated based on the mirror user group. Repo_A Key Repo_B ,…,Key Repo_N To improve encryption and decryption speeds at both the cloud and edge, this technology employs a symmetric encryption algorithm to generate encryption and decryption keys. Considering the security and efficiency of encrypted container images, this technology selects the most popular symmetric encryption algorithm, AES, as the primary encryption method. The cloud-generated key user group is used to determine the correspondence between the image and the key, and to synchronize relevant information to the smart contract. Together with the image user group, the relationship between edge users, the image, and the key is established, enabling fine-grained management of key acquisition by edge users from the cloud.
[0026] As a preferred implementation, after generating the symmetric encryption key set in the cloud, the symmetric encryption key set (Key) is used... Repo_A Key Repo_B ,…,Key Repo_N The corresponding container image is encrypted to generate an encrypted image. Since a container image consists of multiple image layers, and each layer contains sensitive application information, the cloud uses the container image confidentiality protection method based on encryption algorithms proposed in this invention to encrypt each layer of the container image using a key (Key). Meta-information of the key (Key) is added to the image configuration of each layer, ultimately forming a complete encrypted image. Furthermore, to ensure the privacy of the container image at the edge, this method allows the encrypted image to be started directly without decrypting it into plaintext. Formula 1 is the formal expression of container image encryption, where the left side of "←" represents the encrypted image KEY[Repo_A]. (i,j,…) The right-hand subscript (i, j, ...) indicates that the owner of the encrypted image is the edge device i, j, etc.; the right side of "←" represents the container image and its corresponding encryption key. The cloud uses a container image confidentiality protection method based on encryption algorithms to encrypt container images. This is to alleviate the pressure of on-chain image transmission, solve the risks of malicious hijacking and privacy leaks during off-chain image transmission, provide the ability for secure off-chain image transmission, and enable encrypted image startup at the edge device.
[0027] Formula 1 As a preferred implementation, after generating an encrypted image in the cloud, digital signature technology is used to extract the digest information of the encrypted image, which serves as the unique characteristic value of the encrypted image. A longer digest string is more secure, but it also increases the generation time and consistency comparison time. This invention considers three dimensions: string length, generation time, and security. Through experiments, it compares three common hash algorithms: MD5, SHA-1, and SHA-256. Table 1 shows the comparison results of the three techniques. As shown in Table 1, each algorithm has its own advantages, but considering all factors, SHA-1 performs best. Therefore, the container image integrity verification method based on digital signatures proposed in this embodiment preferentially uses the SHA-1 algorithm to calculate and generate a 40-character string for the encrypted image. Of course, this invention is not limited to this.
[0028] Table 1 Comparison results of the three technical methods As a preferred implementation, after generating a unique characteristic value for the encrypted image in the cloud, a secure HTTPS transmission channel is established with the edge device based on the correspondence between the images in the image user group and the edge device. The encrypted image is then distributed to the corresponding edge user. Because the container image is encrypted, its confidentiality is securely protected during off-chain transmission.
[0029] As a preferred implementation, after the encrypted image transmission is completed in the cloud, the unique feature value needs to be stored on the blockchain. The cloud initiates a data upload request to the blockchain by calling the feature value smart contract. The blockchain uses an endorsement strategy and consensus mechanism to achieve unanimous agreement among all blockchain nodes, generating a block and adding it to the chain. The data structure of the block body storing the feature value is shown below: { Model_name Model Name Repo_name Image name Repo_id Mirror ID Hash{KEY[Repo_name]} unique characteristic value of the mirror image Timestamp User (marginal user) } As a preferred implementation, the cloud also needs to store the encryption key on the blockchain. The cloud initiates a data upload request to the blockchain by calling the key smart contract. The blockchain uses endorsement strategies and consensus mechanisms to achieve consensus among all blockchain nodes, generating a block and uploading it to the chain. Malicious edge devices can easily intercept encrypted images transmitted off-chain. Furthermore, since the key is publicly available to all nodes after being uploaded to the blockchain, malicious edge devices can exploit container images maliciously by intercepting encrypted images and obtaining encryption keys. To address these issues, this step, based on the edge relationship between "edge users, images, and keys" determined in step 3, adds access control functionality to the smart contract. This comprehensively controls the "read" permissions for on-chain data, achieving fine-grained key management and further enhancing the confidentiality protection capabilities of cloud-edge container images. The data structure of the block body storing the key is shown below: { Repo_name Image name Key Repo_name Key Repo_id Mirror ID Timestamp User (marginal user) } In a preferred implementation, after the cloud completes the uploading of unique feature values and encryption keys to the blockchain, and the edge device receives its respective encrypted image, the edge device invokes the feature value smart contract to read the unique feature value corresponding to the encrypted image from the blockchain. Simultaneously, the edge device uses the SHA-1 algorithm to locally calculate a unique feature value for the encrypted image, and then compares the two feature values. If they match, it indicates that the encrypted image has not been tampered with and can be started normally; if they do not match, it indicates that the encrypted image has been tampered with and cannot be used. The edge device completes the integrity comparison of the encrypted image using the container image integrity verification method based on digital signatures proposed in this invention, thereby achieving integrity protection of cloud-edge container images.
[0030] As a preferred implementation, after the edge device completes the integrity comparison of the encrypted image, it needs to obtain the key corresponding to the image from the blockchain before it can start the encrypted image. The edge device calls the key smart contract. The smart contract first uses the access permission function to determine whether the edge user who wants to read the key has the required access permission based on the correspondence between "edge user, image, and key". If the user has the required access permission, the key can be read; otherwise, access is denied.
[0031] As a preferred implementation, after the edge device obtains the encrypted image and key, it configures the key in the image startup file, so that the image can be started directly without decrypting it.
[0032] This embodiment also discloses a cloud-edge trusted collaborative system based on blockchain and containers for inference models. This system is designed based on the cloud-edge trusted collaborative method for inference models using blockchain and containers. By deploying the inference model in a container and generating a container image, it provides a container image integrity verification method based on digital signatures, supporting integrity verification of cloud-edge container images. It also provides a container image confidentiality protection method based on encryption algorithms, achieving confidentiality protection of cloud-edge container images. Furthermore, it provides a fine-grained key management mechanism based on smart contracts, achieving fine-grained secure key management. This provides integrity verification and confidentiality protection for inference models under cloud-edge collaboration, constructing a trusted and highly secure cloud-edge collaborative environment. The system framework is as follows: Figure 3 As shown, the system consists of a cloud, an edge, and a blockchain. The cloud includes a mirror encryption component, an edge user management component, a key generation component, a unique feature extraction component, and an on-chain data management component. The edge includes a smart contract invocation component, an integrity verification component, and a mirror encryption startup component. The blockchain mainly includes a consensus mechanism and smart contracts. The specific functions of these components include: The edge user management component is a component used in the cloud to obtain service requirements and metadata from the edge, allocate inference models to the edge based on this information, deploy the models in containers and package them into images, generate image user groups, and realize the management of inference models, images and users. The key generation component is a cloud-based component used to generate symmetric encryption keys, providing key support for the mirror encryption component; The image encryption component is a component that uses keys provided by the key generation component in the cloud to encrypt the container image layer by layer, thereby protecting the confidentiality of the container image. The unique feature value extraction component is a component that uses the SHA-1 algorithm in the cloud to extract unique feature values from encrypted images, providing data support for the integrity verification component at the edge. The on-chain data management component is a component in the cloud that manages encryption keys and unique feature values on the blockchain by calling smart contracts; The smart contract invocation component is a component used at the edge to invoke smart contracts on the blockchain to read on-chain data; The integrity verification component is a component at the edge that compares the feature value of the encrypted image on the chain with the feature value of the locally generated encrypted image to verify whether the received encrypted image has been tampered with. The image encryption boot component is a component at the edge that uses a key obtained from the blockchain to encrypt and boot the received encrypted image.
[0033] The cloud-edge trusted collaboration method based on a blockchain and container-based inference model disclosed in this embodiment can be based on... Figure 3 The system framework shown is used to implement this, and the specific implementation steps are as follows: Step 1: Blockchain Setup and Edge User Management. The cloud and edge devices establish a consortium blockchain based on Hyperledger Fabric node authentication, authorization, and permissioned communication. The edge device sends its service requirements and related metadata to the edge user management component in the cloud. The edge user management component then allocates inference models to the edge device based on this information, deploys them in containers, packages them into images, and generates image user groups. Step 2: Key Generation and Image Encryption. The cloud-based key generation component generates a corresponding encryption key set based on the image user group, and then sends it to the image encryption component. This component uses the encryption key to encrypt the container image, resulting in an encrypted image. Step 3: Unique Feature Extraction. The cloud sends the encrypted image from the image encryption component to the unique feature extraction component. This component uses the SHA-1 algorithm to calculate the unique feature value of the encrypted image. Step 4: Establish an off-chain channel and transmit the encrypted image. Based on the mapping relationship between "edge user and image", the cloud negotiates with the edge to establish an off-chain channel based on the HTTPS protocol, and then the cloud transmits the encrypted image to the corresponding edge user; Step 5: Store the unique feature value and encryption key on the blockchain. The cloud uses the on-chain data management component to call the feature value smart contract and the key smart contract respectively to store the unique feature value and encryption key on the blockchain; Step 6: Feature Value Integrity Comparison. After receiving the encrypted image, the edge device uses the smart contract to call the feature value smart contract interface in the component, reads the unique feature value on the chain, and then uses the SHA-1 algorithm locally to calculate the received model and compares whether the strings of the two are consistent, thus completing the integrity verification of the encrypted image. Step 7: Obtain the encryption key. The edge device uses the smart contract to call the key smart contract call interface in the component. The component will also add the edge device's name, image name, and image ID to the call request and send it to the key smart contract to read the encryption key corresponding to the encrypted image. Step 8: Start the encrypted image. The edge device adds the obtained key to the image's startup configuration file, and then starts the encrypted image directly without decrypting the plaintext.
[0034] The specific process of this embodiment is described below with examples: Assume there are n edge devices forming a cloud-edge trusted collaborative environment based on a consortium blockchain. Edge devices 1 and 2 require Model_A to deploy edge services, while edge devices 3, ..., n require Model_B to deploy edge services. The specific implementation process is as follows: The specific steps for blockchain setup and edge user management in Step 1 are as follows: Step 1.1: The cloud and edge nodes 1, 2, ..., n use the open-source Fabric Docker image to build a consortium blockchain based on Hyperledger Fabric. The cloud and all edge nodes have passed Fabric's CA authentication, authorization management, and communication permissions, and unanimously selected the Raft consensus mechanism. The cloud and all edge nodes negotiate and write feature value smart contracts and key smart contracts and upload them to Fabric. All participants in the consortium blockchain download both smart contracts to their local machines.
[0035] Step 1.2: After the cloud and edge devices have built the cloud-edge collaborative environment based on the consortium blockchain, the edge devices send their respective task requirements and related metadata (including addresses, IPs, etc.) to the cloud. Upon receiving this information, the edge user management component in the cloud, based on the cloud's service requirements for the edge devices, assigns model Model_A to edge devices 1 and 2, then deploys the model in a container and generates image Repo_A. Model Model_B is assigned to edge devices 3, 4, ..., n, using image Repo_B as the model carrier. Finally, an image user group (Repo_A) is generated. (1~2) Repo_B (3~n) The cloud uploads the information of the mirror user group to the access control function in the key smart contract.
[0036] The specific steps for key generation and image encryption in step 2 are as follows: Step 2.1: The edge user management component in the cloud generates a mirrored user group (Repo_A). (1~2) Repo_B (3~n) This information is sent to the key generation group. The key generation component then uses the symmetric encryption algorithm ASE to generate corresponding keys for images Repo_A and Repo_B based on the image user group information. Repo_A Key Repo_B And form a symmetric encryption key group (Key Repo_A Key Repo_B The cloud uploads the information of the mirror user group to the access control function of the key smart contract. Based on the information of the mirror user group and the symmetric encryption key group, the key smart contract determines the relationship between "edge user-mirror-key" and updates the access control permissions. Table 2 shows the relationship between "edge user-mirror-key".
[0037] Table 2. Relationship between “Edge User-Mirror-Key” Step 2.2: After the symmetric encryption key set is generated in the cloud (Key)Repo_A Key Repo_B The key generation component will (Key) Repo_A Key Repo_B The key is sent to the image encryption component. The image encryption component uses the key... Repo_A The image Repo_A is encrypted layer by layer to obtain the encrypted image KEY[Repo_A]. (1,2) The encryption operation for the mirror Repo_B is the same as described above. The formal expressions for the mirror encryption operations of both are shown in Formulas 2 and 3.
[0038] Formula 2 Formula 3 The specific steps for extracting unique features in step 3 are as follows: Step 3.1: Generate an encrypted image key [Repo_A] from the image encryption component in the cloud. (1,2) , Then, the encrypted image is sent to the unique feature extraction component. The unique feature component uses the SHA-1 algorithm to calculate and generate a 40-character string for all encrypted images, which serves as the unique feature value of the encrypted image: Hash{KEY[Repo_A]}. (1,2)}、Hash{ The image encryption component sends the unique characteristic values of all encrypted images to the on-chain data management component according to the corresponding relationship.
[0039] The steps for building the off-chain channel and transmitting the encrypted image in step 4 are as follows: Step 4.1: The cloud and all edge devices negotiate to build an off-chain transmission channel based on HTTPS. According to the relationship between "Edge User - Mirror" in Table 2, KEY[Repo_A] is used. (1,2) Send it to edge terminals 1 and 2, Send the information to edge terminals 3, 4, ..., n.
[0040] The specific steps for storing the unique feature value and encryption key on the blockchain in step 5 are as follows: Step 5.1: After the encrypted image is distributed from the cloud, the unique feature value is sent to the on-chain data management component. Upon receiving the data, the on-chain data management component calls the feature value smart contract interface, invokes the "write" function within the feature value smart contract, and then achieves consensus among all participants in the consortium blockchain through the blockchain's consensus mechanism. The data is then stored on the blockchain according to the aforementioned feature value block structure. Step 5.2: After the unique feature value is stored on the blockchain in the cloud, the on-chain data management component calls the key smart contract interface, calls the "write" function in the key smart contract, and updates the permission control information in the smart contract. Then, the consensus of all participants in the consortium blockchain is achieved through the consensus mechanism in the blockchain, and the key block structure described above is stored on the blockchain. The steps for feature value integrity comparison in step 6 are as follows: Step 6.1: After receiving the encrypted image, the edge device calls the feature value smart contract call interface in the component through the smart contract, and calls the "read" function of the feature value smart contract to read the unique feature value Hash{ KEY[Repo_A] on the chain. (1,2)} 链上 Then, the edge processor locally uses the SHA-1 algorithm to calculate the feature value Hash{ KEY[Repo_A]}. (1,2)} 本地 And compare whether the two strings are consistent. If Hash{ KEY[Repo_A]} (1,2)} 链上 =Hash{ KEY[Repo_A] (1,2)} 本地 If the image has not been tampered with, The operation is consistent with the above; The specific steps for obtaining the encryption key in step 7 are as follows: Step 7.1: The edge device uses the key smart contract call interface in the smart contract call component to call the key smart contract. The smart contract call component adds the edge device's name, the image name, and the image ID to the call request and sends it to the key smart contract.
[0041] Step 7.2: After the key smart contract receives the call request, the access control function will determine whether the request from the edge terminal matches the correspondence in Table 2 based on the name of the edge terminal, the name of the image, and the ID of the image. If it matches, the encryption key will be read; otherwise, the reading will be refused. Step 8: After all edge devices obtain the corresponding keys from the chain, they do not need to decrypt the encrypted image into plaintext before starting it. Instead, they add the key's metadata to the image's startup configuration file and start the encrypted image directly, further ensuring the confidentiality of the cloud-edge container image.
[0042] This invention provides a cloud-edge trusted collaborative method and system based on blockchain and container inference models. The technical solution is not limited to the examples described in the specific embodiments. Other embodiments derived by those skilled in the art through some modifications or refinements of the technical solution of this invention are also within the protection scope of the claims of this invention.
Claims
1. A cloud-edge trusted collaborative method based on blockchain and container inference models, characterized in that, Includes the following steps: 1) Cloud-edge blockchain construction: The edge and cloud terminals jointly form a blockchain through registration, authentication and authorization using blockchain technology, building a trusted cloud-edge collaborative environment; 2) Image User Group Generation: After the cloud-edge blockchain is built, the cloud prepares a trained inference model for the edge based on the business needs of the edge and the cloud's business allocation to the edge, and deploys the model in a container, packages it into a container image, and generates an image user group. 3) Encryption key group generation: The cloud generates a symmetric encryption key group based on the number of mirror user groups; 4) Container image key encryption: After the cloud generates a symmetric encryption key set, the cloud uses container image encryption technology to encrypt the container image corresponding to the symmetric encryption key set, generating an encrypted image, realizing confidential transmission between the cloud and the edge and encrypted startup at the edge; wherein, the encrypted startup means that after the edge obtains the key, it can directly start the encrypted image without decrypting the encrypted image into plaintext; 5) Unique Feature Value Extraction: After the encrypted image is generated in the cloud, the cloud uses a hash algorithm based on digital signature technology to extract the unique feature value from the encrypted image; 6) Off-chain transmission of encrypted images: After the cloud extracts the unique feature value of the encrypted image, it transmits the encrypted image to the corresponding edge device through off-chain transmission according to the image user group. 7) Unique feature value on-chain: The cloud uses a feature value smart contract to store the unique feature value on the blockchain; 8) Encryption key set on-chain: The cloud stores the encryption key set on the blockchain by calling the key smart contract; 9) Feature value integrity comparison: After receiving the encrypted image, the edge device extracts the feature value of the encrypted image using the same hash algorithm in step 5), calls the feature value smart contract to read the corresponding unique feature value from the chain, and performs feature value integrity comparison to determine whether the encrypted image has been tampered with. If the two feature values are consistent, it means that the encrypted image has not been tampered with; otherwise, it means that it has been tampered with. 10) Edge users obtain keys: After the user compares the feature values, the edge terminal calls the key smart contract to read the user's corresponding encryption key from the chain; 11) User starts encrypted image: After obtaining the encryption key, the user can use the key to start the encrypted image directly and complete the edge service deployment.
2. The method as described in claim 1, characterized in that, In step 1), the cloud and the edge together form a consortium blockchain based on Hyperledger Fabric.
3. The method as described in claim 1, characterized in that, Step 3) uses the symmetric encryption algorithm AES to generate a symmetric encryption key set.
4. The method as described in claim 1, characterized in that, In step 4), the key is used to encrypt each layer of the container image, and the key's meta-information is added to the image configuration of each layer, ultimately forming a complete encrypted image.
5. The method as described in claim 1, characterized in that, In step 5), the hash algorithm for the digital signature technology is MD5, SHA-1, or SHA-256.
6. The method as described in claim 1, characterized in that, In step 6), the cloud establishes an HTTPS secure transmission channel with the edge based on the correspondence between the images in the image user group and the edge end, and then sends the encrypted image to the corresponding edge end through the HTTPS secure transmission channel.
7. The method as described in claim 1, characterized in that, In step 7), the cloud initiates a data upload request to the blockchain by calling the feature value smart contract. The blockchain achieves consensus among all blockchain nodes through endorsement strategies and consensus mechanisms, generates a block and uploads it to the chain, and then stores the unique feature value on the chain.
8. The method as described in claim 1, characterized in that, In step 8), the cloud initiates a data upload request to the blockchain by calling the key smart contract. The blockchain achieves consensus among all blockchain nodes through endorsement strategies and consensus mechanisms, generates blocks and uploads them to the chain, and then stores the encrypted key group on the chain. Access control functions are added to the key smart contract to control the read permissions of the data on the chain.
9. The method as described in claim 1, characterized in that, In step 10), when the edge device calls the key smart contract, the smart contract first uses the access permission function to determine whether the edge device that reads the key meets the access permission requirements based on the correspondence between the edge device, the mirror, and the key. If it does, the key can be read; otherwise, access is denied.
10. A cloud-edge trusted collaborative system based on blockchain and container inference models, used to implement the method of claim 1, characterized in that, This includes cloud, edge, and blockchain. The cloud component includes edge user management components, key generation components, image encryption components, unique feature extraction components, and on-chain data management components. The edge component includes smart contract invocation components, integrity verification components, and image encryption startup components. The blockchain includes consensus mechanisms and smart contracts. The edge user management component is used to obtain service requirements and metadata from the edge, allocate inference models to the edge based on service requirements and metadata information, deploy the models in containers and package them into images, and generate image user groups. A key generation component is used to generate symmetric encryption keys; The image encryption component is used to encrypt container images using keys provided by the key generation component. A unique feature extraction component is used to extract unique feature values from encrypted images using a hash algorithm; The on-chain data management component is used to manage encryption keys and unique feature values on the blockchain by calling smart contracts. The smart contract invocation component is used to invoke smart contracts on the blockchain to read on-chain data. The integrity verification component is used to compare the feature value of the encrypted image on the chain with the feature value of the locally generated encrypted image to verify whether the received encrypted image has been tampered with. The image encryption boot component is used to encrypt and boot the received encrypted image using the key obtained on the blockchain.
Citation Information
Patent Citations
Method for issuing cloud reasoning model to side end based on cloud side end architecture
CN112732411A
Rapid deployment type cloud computing architecture based on container arrangement
CN115499442A