Cluster key negotiation method based on consensus mechanism and trusted execution environment
By adopting the consensus mechanism and trusted execution environment in the cluster environment, the problem of high complexity of key negotiation between traditional TEE nodes is solved, efficient key negotiation and dynamic key management are achieved, node maintenance costs are reduced, and enhanced security.
Patent Information
- Application Number
- CN202410768070.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-09-10
AI Technical Summary
In a cluster environment, the key negotiation process between traditional TEE nodes is highly complex, reaching O(n^2) complexity, and node maintenance costs are high, making it difficult to ensure communication security and efficient key negotiation.
Adopt a cluster key negotiation method based on consensus mechanism and trusted execution environment, create an initial TEE cluster through Kubernetes, deploy a blockchain network, divide TEE-Server, TEE-Sentinel, and TEE-Worker roles, and utilize the blockchain consensus mechanism Perform key negotiation with TEE technology to reduce complexity and achieve dynamic key management.
Reduces the complexity of key negotiation from O(n^2) to O(n), enhances cluster key negotiation performance, provides new security guarantees, reduces dependence on external trust, and implements dynamic keys Administration and system stability.
Smart Images

Figure CN118631435A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of privacy computing and hardware security technology in network security, and in particular relates to a cluster key negotiation method based on a consensus mechanism and a trusted execution environment. Background Art
[0002] With the rapid development of cloud computing and Internet of Things (IoT) technologies, distributed systems are becoming increasingly important in processing massive data and providing computing services. However, this also brings new challenges in data security and privacy protection. Especially in cluster environments, how to ensure secure communication between nodes and efficient key negotiation has become an urgent problem to be solved.
[0003] In a traditional TEE cluster, TEE nodes need to verify each other's remote attestation and negotiate keys. However, when the system is initialized, the interaction complexity is high, reaching O(n^2). At the same time, each TEE node needs to maintain information about other nodes, including remote attestation keys and code measurements of trusted programs, so the node maintenance cost is relatively high. Summary of the invention
[0004] In order to solve the above problems, the purpose of the present invention is to provide a cluster key negotiation method based on a consensus mechanism and a trusted execution environment.
[0005] In order to achieve the above object, the cluster key agreement method based on the consensus mechanism and the trusted execution environment provided by the present invention includes the following steps performed in sequence:
[0006] Step 1: Create the initial TEE cluster through Kubernetes and deploy a blockchain network based on the consensus mechanism. Then divide the initial TEE cluster into three roles: TEE-Server, TEE-Sentinel, and TEE-Worker, and configure the corresponding permissions.
[0007] Step 2: Generate a root certificate and key in the trusted execution environment of TEE-Server, seal and save them, and upload the root certificate to the blockchain network through the trusted bridge function to call the smart contract;
[0008] Step 3: TEE-Sentinel actively initiates a key negotiation request to TEE-Server for remote attestation to ensure that TEE-Sentinel is trustworthy. Then TEE-Server securely sends the key to TEE-Sentinel.
[0009] Step 4: The blockchain network node verifies the remote proof process and uploads the remote proof result to the blockchain network through the consensus mechanism;
[0010] Step 5: TEE-Worker actively initiates a key negotiation request to TEE-Sentinel, performs local proof to ensure that TEE-Worker is trustworthy, and then TEE-Sentinel securely sends the key to TEE-Worker;
[0011] Step 6: The blockchain network node verifies the local proof process and uploads the local proof result to the blockchain network through the consensus mechanism;
[0012] Step 7: Perform secure data transmission and communication.
[0013] In step 1, the specific method of creating an initial TEE cluster through Kubernetes and deploying a blockchain network based on a consensus mechanism, and then dividing the initial TEE cluster into three roles: TEE-Server, TEE-Sentinel, and TEE-Worker and configuring corresponding permissions is as follows:
[0014] Step 1.1. Use the Kubernetes API to call kubectl apply, pass in the cluster configuration file, and create the initial TEE cluster.
[0015] Step 1.2: Deploy a blockchain network based on a consensus mechanism that supports Byzantine fault tolerance, deploy four alliance chain nodes in the blockchain network, and use PBFT for consensus;
[0016] Step 1.3: Define three different roles, TEE-Server, TEE-Sentinel, and TEE-Worker, in the initial TEE cluster and configure corresponding permissions;
[0017] The TEE-Server is a centralized authentication service based on TEE, which centrally manages keys and authorizations and is responsible for issuing and managing keys related to TEE-Sentinel and TEE-Worker.
[0018] TEE-Sentinel is a sentinel service based on TEE. It performs remote attestation with TEE-Server to obtain keys and distributes the keys to TEE-Worker.
[0019] TEE-Worker is the collaborative computing node that actually communicates and executes business logic. It obtains the key through local proof with TEE-Sentinel and uses the key to communicate and execute business logic.
[0020] In step 2, the root certificate and key are generated in the trusted execution environment of TEE-Server, and are sealed and stored, and the root certificate is uploaded to the blockchain network through the trusted bridge function calling smart contract. The specific method is as follows:
[0021] Step 2.1: Configure the trusted execution environment in TEE-Server and enable the root certificate Cert Root Generate a program;
[0022] Step 2.2: Create a custom root of trust and use the RSA encryption algorithm to generate a pair of keys (SK Root , PK Root ), where SK Root is the root's private key, PK Root is the corresponding public key, and then the root uses its private key SK Root PK for its own public key Root Sign and generate the root certificate Cert Root To ensure its credibility and unpredictability, generate a root certificate Cert Root The function uses CA sign The process is expressed as:
[0023] Cert Root ←CA sign (PK Root ,SK Root )
[0024] Step 2.3: In the initial TEE cluster, use the RSA encryption algorithm to generate a TEE key pair (SK TEE , PK TEE ), the SGX_tsgxSSL library used is based on the SGX hardware inherent key, ensuring the credibility of key generation in the initial TEE cluster; the process of generating a TEE key pair is expressed as:
[0025] (SK TEE ,PK TEE ) = SGX_tagxSSL.RSA()
[0026] Step 2.4: The trusted program obtains a report by calling the SGXEREPORT instruction, which contains the code metrics and other information of the currently running software. Enclave , and then the trusted program uses the private key SK TEE Encrypt the report to obtain the ciphertext E report , the process is expressed as:
[0027] E report←Encrypt(report={metrics,info Enclave …},SK TeE )
[0028] Step 2.5: The trusted program calls the Enclave's trusted bridge function Ocall to pass the public key PK TEE and ciphertext E report Passed into the custom root of trust, the custom root of trust is passed through the public key PK TEE The ciphertext E report Decrypt to the original report, obtain the code metrics of the current Enclave and other information of the Enclave, if the decryption is successful, it proves the public key PK TEE is the trusted public key generated for the current Enclave, report is the trusted code measurement of the current Enclave, and the result Res is generated. The verification process of the result Res is expressed as:
[0029] Res←Verify(PK TEE ,E report )
[0030] Step 2.6, if the root certificate Cert Root If the verification is successful, a trusted certificate Cert will be issued to the Encalve Enclave , trusted certificate Cert Enclave Contains two parts, signature and plain text message msg, plain text message msg includes the root certificate Cert Root , the validity period of the trusted certificate Time, the report of the trusted execution environment, the public key PK of the trusted execution environment TEE ; The plain text message msg is represented as:
[0031] msg = {Cert Root ,Time,report,PK TEE}
[0032] Step 2.7, Root Certificate Cert Root Use the SHA256 algorithm to perform a hash operation on the above plaintext message msg to obtain the hash value hash msg , and then hash the hash value msg Use the root certificate Root The private key SK Root Encrypt and get the signature msg , expressed as:
[0033] sign msg ←Encrypt(hash msg =sha256(msg),SKRoot )
[0034] Trusted Certificate Enclave It is expressed as:
[0035] Cert Enclave ={msg,sign msg}
[0036] Step 2.8: Generate the root certificate Root The key is sealed to protect its security from being accessed by the outside environment;
[0037] Step 2.9: Call the smart contract through the trusted bridge function to securely send the root certificate Cert Root Upload to the blockchain network.
[0038] In step 3, the TEE-Sentinel actively initiates a key negotiation request to the TEE-Server for remote attestation to ensure that the TEE-Sentinel is trustworthy. Then the TEE-Server securely sends the key to the TEE-Sentinel in the following specific way:
[0039] Step 3.1, TEE-Sentinel initiates a handshake request to TEE-Server, and the request parameter contains the random string RandomStr1;
[0040] Step 3.2. After receiving the above handshake request, TEE-Server responds to TEE-Sentinel. The response resp contains the signature sig2 of the hash value of the random string RandomStr2, the certificate certTEE-Server, and the private key pair (RandomStr1+RandomStr2) of the certificate certTEE-Server. The response resp is defined as:
[0041] Resp={Randommtr2,certKeyServer,sig2}
[0042] Then use the private key of the certificate certTEE-Server to sign the hash value of (RandomStr1+RandomStr2) to generate the signature sig2. The process is as follows:
[0043] sig2=sign(hash(RandomStr1+RandomStr2),SK)
[0044] Step 3.3. After receiving the response, TEE-Sentinel first verifies that the certificate certTEE-Server has the root certificate CertRoot The legitimate signature of the certificate certTEE-Server is obtained, and the metric information Metrics is parsed from the certificate certTEE-Server to ensure that the metric information Metrics is strictly equal to the metric information at startup. At the same time, the public key of the certificate certTEE-Server is used to verify whether the signature sig2 is a legitimate signature of the hash value of (RandomStr1+RandomStr2), and the verification result res is generated, which is expressed as:
[0045] res=VerifySign(certKeyServer,sig2,PK)
[0046] Step 3.4, TEE-Sentinel initiates a session key request to TEE-Server, and the request parameter Reqparms is determined by the root certificate Cert Root The signature sig3 of the hash value of the certificate certTEE-Sentinel and the private key pair (RandomStr1+RandomStr2) of the certificate certTEE-Sentinel issued after verifying the legality of the TEE-Sentinel environment is defined as:
[0047]
[0048] Step 3.5. After receiving the session key request from TEE-Sentinel, TEE-Server verifies that the certificate certTEE-Sentinel has the root certificate Cert Root The legitimate signature of sig3 is verified, and the data encryption public key PK is parsed from the extended field of certTEE-Sentinel to generate the verification result Res, which is expressed as:
[0049] Res=VerifySign(certKeyGuard,sig3,PK)
[0050] Step 3.6, TEE-Server sends a session key response to TEE-Sentinel. The response content Resp includes the certificate certRemote that TEE-Sentinel should use later, the code measurement Metric of TEE-Sentinel, and the session key SK encrypted by the data encryption public key PK; compared with certTEE-Sentinel, the certificate of certRemote is composed of the root certificate Cert Root Become TEE-Server, the response content Resp is defined as:
[0051] Resp = {cerRemote, Metric, SK}
[0052] Step 3.7: After receiving the response from TEE-Server, TEE-Sentinel uses its own private key to decrypt the session key SK. If the decryption is successful, the remote attestation is successful.
[0053] In step 4, the blockchain network node verifies the remote proof process and uploads the remote proof result to the blockchain network through the consensus mechanism. The specific method is:
[0054] Step 4.1: The blockchain network node receives the remote proof request from the TEE-Server and starts the verification process;
[0055] Step 4.2: The blockchain network nodes verify the validity and integrity of the remote proof through a consensus mechanism;
[0056] Step 4.3: After verification, upload the remote proof result to the blockchain network.
[0057] In step 5, the TEE-Worker actively initiates a key negotiation request to the TEE-Sentinel, performs local certification, and ensures that the TEE-Worker is trustworthy. Then the specific method of TEE-Sentinel securely sending the key to the TEE-Worker is as follows:
[0058] Step 5.1, TEE-Worker initiates an authentication request to TEE-Sentinel. After receiving the authentication request from TEE-Worker, TEE-Sentinel responds to TEE-Worker. The response resp1 contains the public key PK randomly generated by RSA and the code metric Metric of TEE-Sentinel itself. The response resp1 is defined as:
[0059] resp1=GenResp1(PK=RSA(),Metric)
[0060] Step 5.2, after TEE-Worker receives the response, it builds request req2 based on response resp1. The process of building request req2 is: using RSA to randomly generate public key PK2, define SGX report reportW, unique identifier uuid; the process of building request req2 is expressed as:
[0061] req2=GenReq2(uuid,version,PK2,reportW)
[0062] Step 5.3: Use request req2 as the request parameter to request TEE-Sentinel to distribute keys and certificates.
[0063] Step 5.4: After TEE-Sentinel receives the request from TEE-Worker to distribute the key, it uses the public key PK and the public key PK2 to calculate the shared public key PK3, verifies the legitimacy of the request req2, and then sends the shared public key PK3 to TEE-Worker.
[0064] In step 6, the blockchain network node verifies the local proof process and uploads the local proof result to the blockchain network through the consensus mechanism. The specific method is:
[0065] Step 6.1: The blockchain network node receives the local proof verification request from TEE-Sentinel;
[0066] Step 6.2: Through the consensus mechanism, the blockchain network node verifies the authenticity of the TEE-Worker's local proof;
[0067] Step 6.3: If the verification is successful, upload the local proof result to the blockchain network.
[0068] The cluster key negotiation method based on consensus mechanism and trusted execution environment provided by the present invention has the following beneficial effects:
[0069] 1. Reduce communication complexity: The present invention reduces the complexity of traditional key negotiation from O(n^2) to O(n), thereby greatly enhancing the performance of cluster key negotiation.
[0070] 2. Combining consensus mechanism and TEE: The present invention combines the blockchain consensus mechanism with TEE technology for key negotiation in a cluster environment, thereby providing a new security assurance method.
[0071] 3. Dynamic key management: By utilizing the consensus mechanism, this method can realize dynamic management and update of keys, ensuring the security and stability of the system when nodes change dynamically.
[0072] 4. Reduce trust assumptions: Traditional key negotiation methods usually need to rely on a trusted third party or preset security assumptions. The present invention reduces the reliance on external trust through the hardware-level security provided by TEE and the decentralized nature of the consensus mechanism. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 A flow chart of a cluster key negotiation method based on a consensus mechanism and a trusted execution environment provided by the present invention;
[0074] Figure 2 It is a node architecture diagram of the present invention;
[0075] Figure 3 This is a schematic diagram of remote certification of the present invention;
[0076] Figure 4 It is a local proof schematic diagram of the present invention;
[0077] Figure 5 This is a performance test diagram of the present invention: DETAILED DESCRIPTION
[0078] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0079] like Figure 1-Figure 4 As shown, the cluster key negotiation method based on the consensus mechanism and the trusted execution environment provided by the present invention includes the following steps performed in sequence:
[0080] Step 1: Create the initial TEE cluster through Kubernetes and deploy a blockchain network based on the consensus mechanism. Then divide the initial TEE cluster into three roles: TEE-Server, TEE-Sentinel, and TEE-Worker, and configure the corresponding permissions.
[0081] The specific method is as follows:
[0082] Step 1.1. Use the Kubernetes API to call kubectl apply, pass in the cluster configuration file, and create the initial TEE cluster.
[0083] Step 1.2: Deploy a blockchain network based on a consensus mechanism that supports Byzantine fault tolerance, deploy four alliance chain nodes in the blockchain network, and use PBFT for consensus;
[0084] Step 1.3: Define three different roles, TEE-Server, TEE-Sentinel, and TEE-Worker, in the initial TEE cluster and configure corresponding permissions;
[0085] like Figure 2 As shown, the TEE-Server is a centralized authentication service based on TEE, which centrally manages keys and authorizations and is responsible for issuing and managing keys related to TEE-Sentinel and TEE-Worker;
[0086] TEE-Sentinel is a sentinel service based on TEE. It performs remote attestation with TEE-Server to obtain keys and distributes the keys to TEE-Worker.
[0087] TEE-Worker is the collaborative computing node that actually communicates and executes business logic. It obtains the key through local proof with TEE-Sentinel and uses the key to communicate and execute business logic.
[0088] Step 2: Generate a root certificate and key in the trusted execution environment of TEE-Server, seal and save them, and upload the root certificate to the blockchain network through the trusted bridge function to call the smart contract;
[0089] The specific method is as follows:
[0090] Step 2.1: Configure the trusted execution environment in TEE-Server and enable the root certificate Cert Root Generate a program;
[0091] Step 2.2: Create a custom root of trust and use the RSA encryption algorithm to generate a pair of keys (SK Root , PK Root ), where SK Root is the root's private key, PK Root is the corresponding public key, and then the root uses its private key SK Root PK for its own public key Root Sign and generate the root certificate Cert Root To ensure its credibility and unpredictability, generate a root certificate Cert Root The function uses CA sign The process is expressed as:
[0092] Cert Root ←CA sign (PK Root ,SK Root )
[0093] Step 2.3: In the initial TEE cluster, use the RSA encryption algorithm to generate a TEE key pair (SK TEE , PK TEE ), the SGX_tsgxSSL library used is based on the SGX hardware inherent key, ensuring the credibility of key generation in the initial TEE cluster; the process of generating a TEE key pair is expressed as:
[0094] (SK TEE ,PK TEE ) = SGX_tsgxSSL.RSA()
[0095] Step 2.4: The trusted program obtains a report by calling the SGX EREPORT instruction, which contains the code metrics MetiCs and other information of the currently running software. Enclave , and then the trusted program uses the private key SK TEE Encrypt the report to obtain the ciphertext E report , the process is expressed as:
[0096] E report ←Encrypt(report={metrics,info Enclave …},SK TEE )
[0097] Step 2.5: The trusted program calls the Enclave's trusted bridge function Ocall to pass the public key PK TEE and ciphertext E report Passed into the custom root of trust, the custom root of trust is passed through the public key PK TEE The ciphertext E report Decrypted to the original report, obtain the code metrics of the current Enclave and other information of the Enclave. TEE and ciphertext E report It is transmitted through the Enclave's trusted bridge function Ocall, so the security and trustworthiness of the transmission process can be ensured. If the decryption is successful, it proves that the public key PK TEE is the trusted public key generated for the current Enclave, report is the trusted code measurement of the current Enclave, and the result Res is generated. The verification process of the result Res is expressed as:
[0098] Res←Verify(PK TEE ,E report )
[0099] Step 2.6: If the root certificate Cert Root If the verification is successful, a trusted certificate Cert will be issued to the Encalve Enclave , Trusted Certificate Cert Enclave Contains two parts, signature and plain text message msg, plain text message msg includes the root certificate Cert Root , the validity period of the trusted certificate Time, the report of the trusted execution environment, the public key PK of the trusted execution environment TEE ; The plain text message msg is represented as:
[0100] msg = {Cert Root ,Time,report,PK TEE}
[0101] Step 2.7, Root Certificate Cert Root Use the SHA256 algorithm to perform a hash operation on the above plaintext message msg to obtain the hash value hash msg , and then hash the hash value msg Use the root certificate Root The private key SK Root Encrypt to get the signature signmsg , expressed as:
[0102] sign msg ←Encrypt(hash msg =sha256(msg),SK Root )
[0103] Trusted Certificate Enclave It is expressed as:
[0104] Cert Enclave ={msg,sign msg}
[0105] Step 2.8: Generate the root certificate Root The key is sealed to protect its security from being accessed by the outside environment;
[0106] Step 2.9: Call the smart contract through the trusted bridge function to securely send the root certificate Cert Root Upload to the blockchain network.
[0107] Step 3: Figure 3 As shown, TEE-Sentinel actively initiates a key negotiation request to TEE-Server for remote attestation to ensure that TEE-Sentinel is trustworthy, and then TEE-Server securely sends the key to TEE-Sentinel.
[0108] The specific method is:
[0109] Step 3.1, TEE-Sentinel initiates a handshake request to TEE-Server, and the request parameter contains the random string RandomStr1;
[0110] Step 3.2. After receiving the above handshake request, TEE-Server responds to TEE-Sentinel. The response resp contains the signature sig2 of the hash value of the random string RandomStr2, the certificate certTEE-Server, and the private key pair (RandomStr1+RandomStr2) of the certificate certTEE-Server. The response resp is defined as:
[0111] Resp={RandomStr2,certKeyServer,sig2}
[0112] Then use the private key of the certificate certTEE-Server to sign the hash value of (RandomStr1+RandomStr2) to generate the signature sig2. The process is as follows:
[0113] sig2=sign(hash(RandomStr1+RandomStr2),SK)
[0114] Step 3.3. After receiving the response, TEE-Sentinel first verifies that the certificate certTEE-Server has the root certificate Cert Root The legitimate signature of the certificate certTEE-Server is obtained, and the metric information Metrics is parsed from the certificate certTEE-Server to ensure that the metric information Metrics is strictly equal to the metric information at startup. At the same time, the public key of the certificate certTEE-Server is used to verify whether the signature sig2 is a legitimate signature of the hash value of (RandomStr1+RandomStr2), and the verification result res is generated, which is expressed as:
[0115] res=VerifySign(certKeyServer,sig2,PK)
[0116] Step 3.4, TEE-Sentinel initiates a session key request to TEE-Server, and the request parameter Reqparms is determined by the root certificate Cert Root The signature sig3 of the hash value of the certificate certTEE-Sentinel and the private key pair (RandomStr1+RandomStr2) of the certificate certTEE-Sentinel issued after verifying the legality of the TEE-Sentinel environment is defined as:
[0117]
[0118] Step 3.5. After receiving the session key request from TEE-Sentinel, TEE-Server verifies that the certificate certTEE-Sentinel has the root certificate Cert Root The legitimate signature of sig3 is verified, and the data encryption public key PK is parsed from the extended field of certTEE-Sentinel to generate the verification result Res, which is expressed as:
[0119] Res=VerifySign(certKeyGuard,sig3,PK)
[0120] Step 3.6, TEE-Server sends a session key response to TEE-Sentinel. The response content Resp includes the certificate certRemote that TEE-Sentinel should use later, the code measurement Metric of TEE-Sentinel, and the session key SK encrypted by the data encryption public key PK. Compared with certTEE-Sentinel, the certificate of certRemote is composed of the root certificate Cert Root Become TEE-Server, the response content Resp is defined as:
[0121] Rsep = {certRemote, Metric, SK}
[0122] Step 3.7: After receiving the response from TEE-Server, TEE-Sentinel uses its own private key to decrypt the session key SK. If the decryption is successful, the remote attestation is successful.
[0123] Step 4: The blockchain network node verifies the remote proof process and uploads the remote proof result to the blockchain network through the consensus mechanism;
[0124] The specific method is:
[0125] Step 4.1: The blockchain network node receives the remote proof request from the TEE-Server and starts the verification process;
[0126] Step 4.2: The blockchain network nodes verify the validity and integrity of the remote proof through a consensus mechanism;
[0127] Step 4.3: After verification, upload the remote proof result to the blockchain network.
[0128] Step 5: Figure 5 As shown, TEE-Worker actively initiates a key negotiation request to TEE-Sentinel, performs local proof to ensure that TEE-Worker is trustworthy, and then TEE-Sentinel securely sends the key to TEE-Worker;
[0129] The specific method is:
[0130] Step 5.1, TEE-Worker initiates an authentication request to TEE-Sentinel. After receiving the authentication request from TEE-Worker, TEE-Sentinel responds to TEE-Worker. The response resp1 contains the public key PK randomly generated by RSA and the code metric Metric of TEE-Sentinel itself. The response resp1 is defined as:
[0131] resp1=GenResp1(PK=RSA(),Metric)
[0132] Step 5.2, after TEE-Worker receives the response, it builds request req2 based on response resp1. The process of building request req2 is: using RSA to randomly generate public key PK2, define SGX report reportW, unique identifier uuid; the process of building request req2 is expressed as:
[0133] req2=GenReq2(uuid,version,PK2,reportW)
[0134] Step 5.3: Use request req2 as the request parameter to request TEE-Sentinel to distribute keys and certificates.
[0135] Step 5.4: After TEE-Sentinel receives the request from TEE-Worker to distribute the key, it uses the public key PK and the public key PK2 to calculate the shared public key PK3, verifies the legitimacy of the request req2, and then sends the shared public key PK3 to TEE-Worker.
[0136] Step 6: The blockchain network node verifies the local proof process and uploads the local proof result to the blockchain network through the consensus mechanism.
[0137] The specific method is:
[0138] Step 6.1: The blockchain network node receives the local proof verification request from TEE-Sentinel;
[0139] Step 6.2: Through the consensus mechanism, the blockchain network node verifies the authenticity of the TEE-Worker's local proof;
[0140] Step 6.3: If the verification is successful, upload the local proof result to the blockchain network.
[0141] Step 7: Perform secure data transmission and communication.
[0142] experiment:
[0143] JMeter was used to perform stress testing on the method of the present invention. By gradually increasing the concurrency pressure, the inflection point of the method performance was found, thereby obtaining the optimal processing capacity. When the number of concurrency gradually increased from 200 to 800, the stress test method was 5 minutes, and the average response time increased linearly. When the concurrency reached 800, the average number of successful transactions per second reached 187 transactions / s, and the average algorithm complexity was O(n). Figure 5 The average number of successful transactions per second and the average response time of the cluster key agreement method test results are shown in a bar chart.
Claims
1. A cluster key negotiation method based on a consensus mechanism and a trusted execution environment, characterized in that: The cluster key agreement method comprises the following steps performed in sequence: Step 1: Create the initial TEE cluster through Kubernetes and deploy a blockchain network based on the consensus mechanism. Then divide the initial TEE cluster into three roles: TEE-Server, TEE-Sentinel, and TEE-Worker, and configure the corresponding permissions. Step 2: Generate a root certificate and key in the trusted execution environment of TEE-Server, seal and save them, and upload the root certificate to the blockchain network through the trusted bridge function to call the smart contract; Step 3: TEE-Sentinel actively initiates a key negotiation request to TEE-Server for remote attestation to ensure that TEE-Sentinel is trustworthy. Then TEE-Server securely sends the key to TEE-Sentinel. Step 4: The blockchain network node verifies the remote proof process and uploads the remote proof result to the blockchain network through the consensus mechanism; Step 5: TEE-Worker actively initiates a key negotiation request to TEE-Sentinel, performs local proof to ensure that TEE-Worker is trustworthy, and then TEE-Sentinel securely sends the key to TEE-Worker; Step 6: The blockchain network node verifies the local proof process and uploads the local proof result to the blockchain network through the consensus mechanism; Step 7: Perform secure data transmission and communication.
2. The cluster key negotiation method based on consensus mechanism and trusted execution environment according to claim 1 is characterized in that: In step 1, the specific method of creating an initial TEE cluster through Kubernetes and deploying a blockchain network based on a consensus mechanism, and then dividing the initial TEE cluster into three roles: TEE-Server, TEE-Sentinel, and TEE-Worker and configuring corresponding permissions is as follows: Step 1.
1. Use the Kubernetes API to call kubectl apply, pass in the cluster configuration file, and create the initial TEE cluster. Step 1.2: Deploy a blockchain network based on a consensus mechanism that supports Byzantine fault tolerance, deploy four alliance chain nodes in the blockchain network, and use PBFT for consensus; Step 1.3: Define three different roles, TEE-Server, TEE-Sentinel, and TEE-Worker, in the initial TEE cluster and configure corresponding permissions; The TEE-Server is a centralized authentication service based on TEE, which centrally manages keys and authorizations and is responsible for issuing and managing keys related to TEE-Sentinel and TEE-Worker. TEE-Sentinel is a sentinel service based on TEE. It performs remote attestation with TEE-Server to obtain keys and distributes the keys to TEE-Worker. TEE-Worker is the collaborative computing node that actually communicates and executes business logic. It obtains the key through local proof with TEE-Sentinel and uses the key to communicate and execute business logic.
3. The cluster key negotiation method based on consensus mechanism and trusted execution environment according to claim 1, characterized in that: In step 2, the root certificate and key are generated in the trusted execution environment of TEE-Server, and are sealed and stored, and the root certificate is uploaded to the blockchain network through the trusted bridge function calling smart contract. The specific method is as follows: Step 2.1: Configure the trusted execution environment in TEE-Server and enable the root certificate Cert Root Generate a program; Step 2.2: Create a custom root of trust and use the RSA encryption algorithm to generate a pair of keys (SK Root , PK Root ), where SK Root is the root's private key, PK Root is the corresponding public key, and then the root uses its private key SK Root PK for its own public key Root Sign and generate the root certificate Cert Root To ensure its credibility and unpredictability, generate a root certificate Cert Root The function uses CA sign The process is expressed as: Certificate Root ←CA sign (PK Root ,SK Root ) Step 2.3: In the initial TEE cluster, use the RSA encryption algorithm to generate a TEE key pair (SK TEE , PK TEE ), the SGX_tsgxSSL library it uses is based on the SGX hardware intrinsic key, ensuring the credibility of key generation in the initial TEE cluster; The process of generating a TEE key pair is expressed as: (SK TEE ,PK TEE )=SGX_tsgxSSL.RSA() Step 2.4: The trusted program obtains a report by calling the SGX EREPORT instruction, which contains the code metrics and other information of the currently running software. Enclave , and then the trusted program uses the private key SK TEE Encrypt the report to obtain the ciphertext E report , the process is expressed as: E report ←Encrypt(report={metrics,info Enclave ...},SK TEE ) Step 2.5: The trusted program calls the Enclave's trusted bridge function Ocall to pass the public key PK TEE and ciphertext E report Passed into the custom root of trust, the custom root of trust is passed through the public key PK TEE The ciphertext E report Decrypt to the original report, obtain the code metrics of the current Enclave and other information of the Enclave, if the decryption is successful, it proves the public key PK TEE is the trusted public key generated for the current Enclave, report is the trusted code measurement of the current Enclave, and the result Res is generated. The verification process of the result Res is expressed as: Res←Verify(PK TEE ,E report ) Step 2.6: If the root certificate Cert Root If the verification is successful, a trusted certificate Cer will be issued to the Encalve Enclave , trusted certificate Cert Enclave Contains two parts, signature and plain text message msg, plain text message msg includes the root certificate Cert Root , the validity period of the trusted certificate Time, the report of the trusted execution environment, the public key PK of the trusted execution environment TEE ; The plain text message msg is represented as: msg={Cert Root ,Time,report,PK TEE } Step 2.7, Root Certificate Cert Root Use the SHA256 algorithm to perform a hash operation on the above plaintext message msg to obtain the hash value hash msg , and then hash the hash value msg Use the root certificate Root The private key SK Root Encrypt to get the signature sign msg , expressed as: sign msg ←Encrypt(hash msg =sha256(msg),SK Root ) Trusted Certificate Enclave It is expressed as: cert Enclave ={msg,sign msg } Step 2.8: Generate the root certificate Root The key is sealed to protect its security from being accessed by the outside environment; Step 2.9: Call the smart contract through the trusted bridge function to securely send the root certificate Cert Root Upload to the blockchain network.
4. The cluster key negotiation method based on consensus mechanism and trusted execution environment according to claim 1, characterized in that: In step 3, the TEE-Sentinel actively initiates a key negotiation request to the TEE-Server for remote attestation to ensure that the TEE-Sentinel is trustworthy. Then the TEE-Ser ver sends the key securely to the TEE-Sentinel in the following specific way: Step 3.1, TEE-Sentinel initiates a handshake request to TEE-Server, and the request parameter contains the random string RandomStr1; Step 3.
2. After receiving the above handshake request, TEE-Server responds to TEE-Sentinel. The response resp contains the signature sig2 of the hash value of the random string RandomStr2, the certificate certTEE-Server, and the private key pair (RandomStr1+RandomStr2) of the certificate certTEE-Server. The response resp is defined as: Resp={RandomStr2,certKeyServer,sig2} Then use the private key of the certificate certTEE-Server to sign the hash value of (RandomStr1+RandomStr2) to generate the signature sig2. The process is as follows: sig2=sign(hash(RandomStr1+RandomStr2),SK) Step 3.
3. After receiving the response, TEE-Sentinel first verifies that the certificate certTEE-Server has the root certificate Cert Root The legitimate signature of the certificate certTEE-Server is obtained, and the metric information Metrics is parsed from the certificate certTEE-Server to ensure that the metric information Metrics is strictly equal to the metric information at startup. At the same time, the public key of the certificate certTEE-Server is used to verify whether the signature sig2 is a legitimate signature of the hash value of (RandomStr1+RandomStr2), and the verification result res is generated, which is expressed as: res=VerifySign(certKeyServer,sig2,PK) Step 3.4, TEE-Sentinel initiates a session key request to TEE-Server, and the request parameter Reqparms is determined by the root certificate Cert Root The signature sig3 of the hash value of the certificate certTEE-Sentinel and the private key pair (RandomStr1+RandomStr2) of the certificate certTEE-Sentinel issued after verifying the legality of the TEE-Sentinel environment is defined as: Step 3.
5. After receiving the session key request from TEE-Sentinel, TEE-Server verifies that the certificate certTEE-Sentinel has the root certificate Cert Root The legitimate signature of sig3 is verified, and the data encryption public key PK is parsed from the extended field of certTEE-Sentinel to generate the verification result Res, which is expressed as: Res=VerifySign(certKeyGuard,sig3,PK) Step 3.6, TEE-Server sends a session key response to TEE-Sentinel. The response content Resp includes the certificate certRemote that TEE-Sentinel should use later, the code measurement Metric of TEE-Sentinel, and the session key SK encrypted by the data encryption public key PK; compared with certTEE-Sentinel, the certificate of certRemote is composed of the root certificate Cert Root It becomes TEE-Server, and the response content Resp is defined as: Resp={certRemote, Metric, SK} Step 3.7: After receiving the response from TEE-Server, TEE-Sentinel uses its own private key to decrypt the session key SK. If the decryption is successful, the remote attestation is successful.
5. The cluster key negotiation method based on consensus mechanism and trusted execution environment according to claim 1, characterized in that: In step 4, the blockchain network node verifies the remote proof process and uploads the remote proof result to the blockchain network through the consensus mechanism. The specific method is: Step 4.1: The blockchain network node receives the remote proof request from the TEE-Server and starts the verification process; Step 4.2: The blockchain network nodes verify the validity and integrity of the remote proof through a consensus mechanism; Step 4.3: After verification, upload the remote proof result to the blockchain network.
6. The cluster key negotiation method based on consensus mechanism and trusted execution environment according to claim 1, characterized in that: In step 5, the TEE-Worker actively initiates a key negotiation request to the TEE-Sentinel, performs local certification, and ensures that the TEE-Worker is trustworthy. Then the specific method of TEE-Sentinel securely sending the key to the TEE-Worker is as follows: Step 5.1, TEE-Worker initiates an authentication request to TEE-Sentinel. After receiving the authentication request from TEE-Worker, TEE-Sentinel responds to TEE-Worker. The response resp1 contains the public key PK randomly generated by RSA and the code metric Metric of TEE-Sentinel itself. The response resp1 is defined as: resp1=GenResp1(PK=RSA(),Metric) Step 5.2, after TEE-Worker receives the response, it builds request req2 based on response resp1. The process of building request req2 is: using RSA to randomly generate public key PK2, define SGX report reportW, unique identifier uuid; the process of building request req2 is expressed as: req2=GenReq2(uuid, version, PK2, reportW) Step 5.3: Use request req2 as a request parameter to request TEE-Sentinel to distribute keys and certificates. Step 5.4: After TEE-Sentinel receives the request from TEE-Worker to distribute the key, it uses the public key PK and the public key PK2 to calculate the shared public key PK3, verifies the legitimacy of the request req2, and then sends the shared public key PK3 to TEE-Worker.
7. The cluster key negotiation method based on consensus mechanism and trusted execution environment according to claim 1, characterized in that: In step 6, the blockchain network node verifies the local proof process and uploads the local proof result to the blockchain network through the consensus mechanism. The specific method is: Step 6.1: The blockchain network node receives the local proof verification request from TEE-Sentinel; Step 6.2: Through the consensus mechanism, the blockchain network node verifies the authenticity of the TEE-Worker's local proof; Step 6.3: If the verification is successful, upload the local proof result to the blockchain network.
Citation Information
Cited By
TEE cluster implementation method and system, terminal and storage medium
CN122268684A
Method and system for strong isolation and large-scale attestation for disaggregated resource architectures
WO2026118018A1
