CN114826625A - SGX-based block chain key storage method, evaluation method and device - Google Patents

SGX-based block chain key storage method, evaluation method and device Download PDF

Info

Publication number
CN114826625A
CN114826625A CN202210765013.2A CN202210765013A CN114826625A CN 114826625 A CN114826625 A CN 114826625A CN 202210765013 A CN202210765013 A CN 202210765013A CN 114826625 A CN114826625 A CN 114826625A
Authority
CN
China
Prior art keywords
sgx
key
enclave
private key
trusted
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210765013.2A
Other languages
Chinese (zh)
Other versions
CN114826625B (en
Inventor
向德军
周睿
黄康乾
黄志生
田琳
王宣定
王宁
姚星安
董剑
谷博文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Electric Power Transaction Center Co ltd
Original Assignee
Guangdong Electric Power Transaction Center Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Electric Power Transaction Center Co ltd filed Critical Guangdong Electric Power Transaction Center Co ltd
Priority to CN202210765013.2A priority Critical patent/CN114826625B/en
Publication of CN114826625A publication Critical patent/CN114826625A/en
Application granted granted Critical
Publication of CN114826625B publication Critical patent/CN114826625B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0442Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply asymmetric encryption, i.e. different keys for encryption and decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0894Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage
    • H04L9/0897Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage involving additional devices, e.g. trusted platform module [TPM], smartcard or USB
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3066Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving algebraic varieties, e.g. elliptic or hyper-elliptic curves
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Algebra (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Storage Device Security (AREA)

Abstract

SGX-based block chain key storage method, evaluation method and device belong to the technical field of information security. The problem of security of network key storage is solved. The method comprises the steps of establishing a trusted operating environment of the SGX, generating a key pair by utilizing an SM2 algorithm, sealing a private key by utilizing a sealing mechanism of the SGX, deriving the key pair, unsealing the private key, calculating a public key according to a corresponding elliptic curve by utilizing an SM2 algorithm, deriving the public key, inputting the sealed private key, signature information and elliptic curve parameters into an Enclave, unsealing the private key, signing the information by utilizing an SM2 algorithm, inputting a random value and elliptic curve parameters of the sealed private key and the derived key pair into the Enclave, unsealing the private key, generating a new private key according to the random value, sealing the new private key, calculating a corresponding public key according to the elliptic curve type, and deriving the key pair. The method is safe and efficient.

Description

SGX-based block chain key storage method, evaluation method and device
Technical Field
The invention belongs to the technical field of information security, and particularly relates to a block chain key storage method, an evaluation method and an evaluation device based on SGX.
Background
The block chain technology is widely applied in various fields to realize information sharing and solve trust problems. However, security issues in terms of data, consensus mechanisms, privacy, and intelligent contracts in blockchains are still obstacles to be overcome in blockchain technology development. The privacy security of the block chain mainly comprises identity privacy and transaction information privacy, and the privacy of the identity is closely related to a private key held by a user. Once the private key of the user is stolen by an attacker through a system bug, an attacking means, and the like, the blockchain account of the user is at risk of being tampered. The blockchain authenticates the participants through asymmetric key pairs held by them and ensures secure communication in the network. Wherein, the private key in the key pair is used as an anchor for identity authentication, calculates the abstract of the message and generates an additional digital signature; the public key is used to verify the origin and integrity of the message by verifying that the digital signature appended to the message is valid. Whether the private key is secure determines the security of the identity of the nodes in the blockchain network and the security of messages transmitted between the nodes.
There are three key storage methods at present. The first is a digital currency transaction center hosting a key in the cloud, which is equivalent to traditional centralized asset hosting. The second one is a hot wallet, which implements lightweight blockchain nodes through software, specifically in the form of an executable program on a mobile terminal or a PC terminal. The third is a cold wallet, which is implemented as a dedicated hardware wallet or off-line device such as paper. However, the methods have certain defects, the key is hosted in the digital currency transaction center to carry out transaction on the assets more conveniently, and the security protection equipment and the security protection technology of the transaction center are stronger than those of individual users, but the transaction center stores the key too intensively, the hacker attack is easily attracted, the effect of protecting the assets of the users by the key is also separated, and the application range is smaller. The hot wallet has the advantages that the portability is strong, the functions are complete, a new holder cannot acquire a secret key easily when the physical device is lost, but information stored in the hot wallet is vulnerable to other software viruses in a network to cause information leakage, as shown in fig. 5, an attacker can attack the ECDSA module by running a malicious application program or software, such as modifying or injecting codes, and can acquire high-level rights through vulnerabilities of an operating system to access sensitive data or memory information generated in the running process of the ECDSA module. Although the hardware wallet cannot be attacked by malicious software in the network to reveal the key, the loss of the hardware wallet means that a new holder can easily obtain the key and the corresponding assets. Most of the existing block chain privacy data protection based on the SGX directly puts programs into an SGX trusted execution environment, although the data privacy protection effect is good, the program running speed is low due to the limited SGX space, a large number of requests cannot be processed, and the method for directly putting the programs into the SGX to run does not have practical feasibility.
Disclosure of Invention
The invention aims to solve the problems of safety and high efficiency, and provides a block chain key storage method, an evaluation method and an evaluation device based on SGX.
In order to achieve the purpose, the invention is realized by the following technical scheme:
a block chain key storage method based on SGX comprises the following steps:
s1, establishing a trusted operating environment Enclave of the SGX, defining an application program interface and a trusted function: the interface definition of the application program is to initialize the envelope configuration, create an envelope instance, call an envelope trusted function, and destroy the envelope instance after the trusted function is executed;
s2, generating a key pair: under the trusted operation environment of the SGX, generating a key pair by using an SM2 algorithm of the SGX SSL, and sealing a private key by using a sealing mechanism of the SGX to derive the key pair;
s3, private key derivation public key: inputting the private key and the elliptic curve parameters sealed in the step S2 into an envelope, unsealing the private key in the envelope, calculating a public key according to the corresponding elliptic curve type by using an SM2 algorithm, and deriving the public key;
s4, signature: inputting the private key, the signature information and the elliptic curve parameters which are sealed in the step S2 into an Enclave, unsealing the private key in the Enclave, and signing the information by using an SM2 algorithm;
s5, key pair derivation: and (4) inputting the random value of the private key and the derived key pair sealed in the step (S2) and the elliptic curve parameters into an Enclave, unsealing the private key in the Enclave, generating a new private key according to the random value and sealing the new private key, calculating a corresponding public key according to the elliptic curve type, and deriving the key pair.
Further, the construction of the trusted operating environment Enclave of the SGX in step S1 includes the following steps:
s1.1, an SGX application program is divided into a trusted operating environment part Enclave and an untrusted operating environment part App, wherein the trusted operating environment part Enclave mainly comprises specific implementation of an SM2 algorithm module, and the untrusted operating environment part App calls functions in the trusted operating environment by using ECALL and OCALL to realize interaction with the Enclave;
s1.2, setting basic attributes of used Enclave through an Enclave configuration file of a trusted operating environment, writing an EDL file to clearly define a function ECALL operated in the trusted operating environment, and reading the defined EDL file by using an Edger8r tool;
s1.3, calling a trusted function in an SGX application program through a dynamic link library, wherein the SGX application program is mainly realized through C/C + +, and Golang cannot directly call a function in Enclave;
s1.4, using Golang to realize an algorithm of an SM2 private key, and ensuring the safety of a Fabric node private key operation environment through an SGX hardware mechanism;
s1.5, finishing the modification of the BCCSP module in the HyperLegger Fabric; the SW mode is that encryption algorithm service is realized by calling an encryption library at the Golang bottom layer, and after the Fabric is used for expanding the method, the Source code of the Fabric needs to be recompiled to generate a new executable file and a Docker mirror image.
Further, the step of deriving the public key from the private key in step S3 includes the following steps:
s3.1, generating a random keyid;
s3.2, entering an SGX trusted environment;
s3.3, generating a temporary buffer area tmpaddr;
s3.4, calling an instruction to start the key;
s3.5, copying the data of the buffer area to a caller buffer area;
s3.6, destroying the temporary buffer area;
s3.7, releasing the temporary buffer area resources;
s3.8, generating a public key through token calculation;
and S3.9, returning the public key.
Further, before signing in step S4, the tile data value to be signed is first compared with the Enclave available space value, and the tile data value calculation formula is as follows:
Figure 854056DEST_PATH_IMAGE001
wherein, BlockSize is a signed block data value, preBlockHash is a hash value of a previous block, merkleRoot is a root of a merkle tree of the block, Transaction is a set of transactions, version is a version number, restMsg is other related information, n is a total number of transactions contained in the block, and i is the ith Transaction in the block.
Further, the signature of step S4 is implemented as:
s4.1, obtaining the size of an SGX available area;
s4.2, comparing the block size with the buffer area size;
s4.3, generating a temporary buffer area tmpaddr;
s4.4, calling an instruction to start the key;
s4.5, copying the data of the buffer area to a caller buffer area;
s4.6, destroying the temporary buffer area;
s4.7, releasing the temporary buffer area resource
S4.8, inputting the name of an encryption algorithm used by the signature;
s4.9, converting the block information into an utf-8 code;
and S4.10, signing and returning.
Further, the elliptic curve function equation is
Figure 848137DEST_PATH_IMAGE002
And a and b are equation parameters.
An evaluation method of a block chain key storage method based on SGX, a network communication complexity calculation method is shown as the following formula:
Figure 868046DEST_PATH_IMAGE003
where Commun _ compound is the network communication complexity,
Figure 11582DEST_PATH_IMAGE004
and for the comparison value of the network traffic switched between the current view and the last view, signTrans _ num is the number of signature transactions, Consensions (k) is the traffic of the kth polling, n is the number of the current round of consensus view, i is the ith round of polling, j is the jth polling, k is the kth polling, the traffic of the j-i polling is added, and the average value is obtained to calculate the final network communication complexity.
The device of the SGX-based blockchain key storage method comprises a memory, a storage unit and a storage unit, wherein the memory is used for storing program instructions; a processor for calling the program instructions stored in the memory to implement the SGX-based blockchain key storage method.
Further, the Intel SGX is a technology developed to meet the needs of the trusted computing industry, and provides security guarantee for the execution environment of the user space through a hardware mechanism. The Intel SGX adds a new set of instruction and access mechanism to the original architecture, allows an application program to implement an Enclave container, and opens up an isolated memory space epc (Enclave Page cache) for specific code at a hardware level, that is, on a CPU, to ensure the security and privacy of Enclave running code and data, and protect against the damage of privilege and malicious software, and the overall architecture of the SGX is as shown in fig. 6.
Further, as shown in fig. 7, the BIOS may ensure that the system software and the peripheral device have no access right by configuring a set of range register allocation prm (processor Reserved memory). Where the PRM includes the EPC and memory reserved for use by other hardware. Pages are allocated in the EPC for use by SGX data structures and Enclave. A memory encryption unit (MEE) in the processor encrypts data before the data is written into the memory, and codes, data, TCS and the like in the envelope are always encrypted and stored in the memory during the running process, so that external applications and privileged systems cannot access the contents in the EPC. And the code inside the Enclave can only access the memory belonging to the Enclave in the EPC range, but can not access the memories of other enclaves.
Further, as shown in fig. 8, when the application applies for creating an instance, it needs to perform page allocation (ECREATE), copy program code and data (EADD), and measure operation (EEXTEND), and then perform initialization (EINT). Untrusted code (outside the Enclave) executes trusted code (inside the Enclave) via the EENTER instruction. The SGX SDK provides the encapsulated codes ecall and ecall, and uses the EENTER instruction and the EEXIT instruction to perform context switching between trusted and untrusted codes. The SGX SDK hides the details of SGX hardware from developers, the developers can create codes loaded into Enclave by calling common functions and define ecall and ecall interfaces between Enclave and untrusted codes, and Intel provides an edge function creation tool of edge 8r for automatically generating security encapsulation codes of ecall and ecall.
The invention has the beneficial effects that:
the invention provides a block chain key storage method based on SGX, which is characterized in that an SM2 national cryptographic algorithm is used for replacing a native ECDSA encryption algorithm, a key pair generated by a program related to private key operation, a public key derived, a digital signature and key pair derived are put into an SGX trusted execution environment, other large amount of operation behaviors are kept in an original working area, and the two operations carry out data interaction through interface calling, so that safety and high efficiency are considered.
The invention discloses a block chain key storage method based on SGX, and provides a method for protecting a private key operation environment in a BCCSP module encryption algorithm in HyperLegger Fabric based on SGX. An attacker can arbitrarily modify data transmitted in the system and arbitrarily read a physical memory by controlling all software including an operating system, but cannot crack a CPU with an SGX function, so that the method can prevent data and codes related to the private key from being illegally accessed and tampered in the running process, provide a safe running environment and an isolation protection mechanism, replace a native open source ECDSA encryption algorithm with a SM2 algorithm, and provide a protection method for the running environment of the private key.
The block chain key storage method based on the SGX can optimize the performance of a block chain network when a failure node exists in the network.
Drawings
Fig. 1 is a flowchart illustrating an operation of a block chain key storage method based on SGX according to the present invention;
FIG. 2 is a diagram of the method architecture of the SGX trusted operating environment-based system of the present invention;
FIG. 3 is a graph comparing throughput for a method using the SGX-based trusted operating environment of the present invention;
FIG. 4 is a comparison graph of average transaction delays for a method using the SGX trusted operating environment based approach of the present invention;
FIG. 5 is a security threat model of a private key runtime environment;
FIG. 6 is a schematic diagram of the overall SGX architecture;
FIG. 7 is a schematic diagram of a PRM and EPC layout;
fig. 8 is a schematic diagram of the process of Edger8r generating the encapsulated code.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and the detailed description. It is to be understood that the embodiments described herein are illustrative only and are not limiting, i.e., that the embodiments described are only a few embodiments, rather than all, of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations, and the present invention may have other embodiments.
Thus, the following detailed description of specific embodiments of the present invention presented in the accompanying drawings is not intended to limit the scope of the invention as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the detailed description of the invention without inventive step, are within the scope of protection of the invention.
To further understand the contents, features and effects of the present invention, the following embodiments are illustrated in the accompanying drawings, and the following detailed description is made with reference to the accompanying drawings, as shown in fig. 1:
the first embodiment is as follows:
a block chain key storage method based on SGX comprises the following steps:
s1, establishing a trusted operating environment Enclave of the SGX, defining an application program interface and a trusted function: the interface definition of the application program is to initialize the envelope configuration, create an envelope instance, call an envelope trusted function, and destroy the envelope instance after the trusted function is executed;
as shown in fig. 2:
further, the construction of the trusted operating environment Enclave of the SGX in step S1 includes the following steps:
s1.1, an SGX application program is divided into a trusted operating environment part Enclave and an untrusted operating environment part App, wherein the trusted operating environment part Enclave mainly comprises specific implementation of an SM2 algorithm module, and the untrusted operating environment part App calls functions in the trusted operating environment by using ECALL and OCALL to realize interaction with the Enclave;
s1.2, setting basic attributes of used Enclave through an Enclave configuration file of a trusted operating environment, writing an EDL file to clearly define a function ECALL operated in the trusted operating environment, and reading the defined EDL file by using an Edger8r tool;
s1.3, calling a trusted function in an SGX application program through a dynamic link library, wherein the SGX application program is mainly realized through C/C + +, and Golang cannot directly call a function in Enclave;
s1.4, using Golang to realize an algorithm of an SM2 private key, and ensuring the safety of a Fabric node private key operation environment through an SGX hardware mechanism;
s1.5, finishing the modification of the BCCSP module in the HyperLegger Fabric; the SW mode is that encryption algorithm service is realized by calling an encryption library at the Golang bottom layer, and after the Fabric is used for expanding the method, the Source code of the Fabric needs to be recompiled to generate a new executable file and a Docker mirror image.
S2, generating a key pair: under the trusted operation environment of the SGX, generating a key pair by using an SM2 algorithm of the SGX SSL, and sealing a private key by using a sealing mechanism of the SGX to derive the key pair;
further, in the SM2 algorithm, the algorithm associated with the private key runs on the trusted memory area of the SGX application, including key pair generation, private key derivation of the public key, signature, and derivation of the key pair. The implementation of the encryption algorithm is done through the SGX SSL library. And a sealing mechanism in the SGX technology is utilized to realize safe storage of the private key, namely the private key is sealed when generated and is unsealed when used inside the envelope.
S3, private key derivation public key: inputting the private key and the elliptic curve parameters sealed in the step S2 into an envelope, unsealing the private key in the envelope, calculating a public key according to the corresponding elliptic curve type by using an SM2 algorithm, and deriving the public key;
further, the step of deriving the public key from the private key in step S3 includes the following steps:
s3.1, generating a random keyid;
s3.2, entering an SGX trusted environment;
s3.3, generating a temporary buffer area tmpaddr;
s3.4, calling an instruction to start the key;
s3.5, copying the data of the buffer area to a caller buffer area;
s3.6, destroying the temporary buffer area;
s3.7, releasing the temporary buffer area resources;
s3.8, generating a public key through token calculation;
and S3.9, returning the public key.
S4, signature: inputting the private key, the signature information and the elliptic curve parameters which are sealed in the step S2 into an Enclave, unsealing the private key in the Enclave, and signing the information by using an SM2 algorithm;
further, before signing in step S4, the tile data value to be signed is first compared with the Enclave available space value, and the tile data value calculation formula is as follows:
Figure 66126DEST_PATH_IMAGE005
wherein, BlockSize is a signed block data value, preBlockHash is a hash value of a previous block, merkleRoot is a root of a merkle tree of the block, Transaction is a set of transactions, version is a version number, restMsg is other related information, n is a total number of transactions contained in the block, and i is the ith Transaction in the block.
Since the Enclave has a limited internal space, the size of the block data to be signed and the size of the available Enclave space need to be compared before signing the block data, so as to prevent data overflow.
Further, the signature of step S4 is implemented as:
s4.1, obtaining the size of an SGX available area;
s4.2, comparing the block size with the buffer area size;
s4.3, generating a temporary buffer area tmpaddr;
s4.4, calling an instruction to start the key;
s4.5, copying the data of the buffer area to a caller buffer area;
s4.6, destroying the temporary buffer area;
s4.7, releasing the temporary buffer area resource
S4.8, inputting the name of an encryption algorithm used by the signature;
s4.9, converting the block information into an utf-8 code;
and S4.10, signing and returning.
S5, key pair derivation: inputting the random value and the elliptic curve parameter of the private key and the derived key pair sealed in the step S2 into an envelope, unsealing the private key in the envelope, generating a new private key according to the random value and sealing the new private key, calculating the corresponding public key according to the elliptic curve type, and deriving the key pair.
Further, the elliptic curve function equation is
Figure 902495DEST_PATH_IMAGE006
And a and b are equation parameters.
The second embodiment is as follows:
according to a method for evaluating a block chain key storage method based on SGX in the first embodiment, a method for calculating network communication complexity is shown as the following formula:
Figure 409699DEST_PATH_IMAGE007
where Commun _ compound is the network communication complexity,
Figure 91348DEST_PATH_IMAGE008
switching the maximum of the compared values of network traffic for the current view and the last viewAnd the sign Trans _ num is the number of signature transactions, Consenssus (k) is the communication traffic of the kth round of voting, n is the number of the current round of consensus views, i is the ith round of voting, j is the jth round of voting, k is the kth round of voting, the communication traffic of the j-i rounds of voting is added, and the average value is obtained to calculate the final network communication complexity.
Further, fig. 3 is a throughput comparison graph evaluated by the method based on the SGX trusted operating environment according to the present embodiment; fig. 4 is a comparison graph of average transaction delays evaluated by the method based on the SGX trusted operating environment according to the present embodiment. When there is no abnormal node in the network, the communication complexity of the block chain network is not changed. However, when nodes invaded by Trojan viruses exist in the network, the traditional block chain nodes can be completely controlled, so that a large amount of signed malicious information appears in the network, the network traffic is increased, and network congestion is easily caused; by adopting the key storage mode provided by the embodiment, even if the node is invaded by the Trojan horse virus to become a failure node, an attacker cannot generate signed false information due to lack of a corresponding password used by a private key, and the communication traffic in the network is not increased. The algorithm provided by the embodiment can optimize the performance of the blockchain network when the network has failure nodes. The total number of network nodes is 10, and the experimental results are as follows, wherein the throughput ratio is shown in fig. 3, and the delay ratio is shown in fig. 4.
The third concrete implementation mode:
an apparatus of an SGX-based blockchain key storage method according to an embodiment of the present invention includes a memory for storing program instructions; a processor for calling the program instructions stored in the memory to implement an SGX-based blockchain key storage method according to the first embodiment.
It is noted that relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
While the application has been described above with reference to specific embodiments, various modifications may be made and equivalents may be substituted for elements thereof without departing from the scope of the application. In particular, the various features of the embodiments disclosed herein may be used in any combination that is not inconsistent with the structure, and the failure to exhaustively describe such combinations in this specification is merely for brevity and resource conservation. Therefore, it is intended that the application not be limited to the particular embodiments disclosed, but that the application will include all embodiments falling within the scope of the appended claims.

Claims (8)

1. A block chain key storage method based on SGX is characterized in that: the method comprises the following steps:
s1, establishing an SGX trusted operating environment (Enclave), defining an application program interface and a trusted function, defining the interface of the application program as initializing an Enclave configuration, creating an Enclave instance, calling the Enclave trusted function, and destroying the Enclave instance after the execution of the trusted function is finished;
s2, generating a key pair: under the trusted operation environment of the SGX, generating a key pair by using an SM2 algorithm of the SGX SSL, and sealing a private key by using a sealing mechanism of the SGX to derive the key pair;
s3, private key derivation public key: inputting the private key and the elliptic curve parameters sealed in the step S2 into an envelope, unsealing the private key in the envelope, calculating a public key according to the corresponding elliptic curve type by using an SM2 algorithm, and deriving the public key;
s4, signature: inputting the private key, the signature information and the elliptic curve parameters which are sealed in the step S2 into an Enclave, unsealing the private key in the Enclave, and signing the information by using an SM2 algorithm;
s5, key pair derivation: inputting the random value and the elliptic curve parameter of the private key and the derived key pair sealed in the step S2 into an envelope, unsealing the private key in the envelope, generating a new private key according to the random value and sealing the new private key, calculating the corresponding public key according to the elliptic curve type, and deriving the key pair.
2. The SGX-based blockchain key storage method according to claim 1, wherein: the construction of the trusted operating environment Enclave of the SGX in step S1 includes the following steps:
s1.1, an SGX application program is divided into a trusted operating environment part Enclave and an untrusted operating environment part App, wherein the trusted operating environment part Enclave mainly comprises specific implementation of an SM2 algorithm module, and the untrusted operating environment part App calls functions in the trusted operating environment by using ECALL and OCALL to realize interaction with the Enclave;
s1.2, setting basic attributes of used Enclave through an Enclave configuration file of a trusted operating environment, writing an EDL file to clearly define a function ECALL operated in the trusted operating environment, and reading the defined EDL file by using an Edger8r tool;
s1.3, calling a trusted function in an SGX application program through a dynamic link library, wherein the SGX application program is mainly realized through C/C + +;
s1.4, using Golang to realize an algorithm of an SM2 private key, and ensuring the safety of a Fabric node private key operation environment through an SGX hardware mechanism;
s1.5, finishing the modification of the BCCSP module in the HyperLegger Fabric; the SW mode is that encryption algorithm service is realized by calling an encryption library at the Golang bottom layer, and after the Fabric is used for expanding the method, the Source code of the Fabric needs to be recompiled to generate a new executable file and a Docker mirror image.
3. The SGX-based blockchain key storage method according to claim 2, wherein: the deriving of the public key from the private key in step S3 includes the following steps:
s3.1, generating a random keyid;
s3.2, entering an SGX trusted environment;
s3.3, generating a temporary buffer area tmpaddr;
s3.4, calling an instruction to start the key;
s3.5, copying the data of the buffer area to a caller buffer area;
s3.6, destroying the temporary buffer area;
s3.7, releasing the temporary buffer area resources;
s3.8, generating a public key through token calculation;
and S3.9, returning the public key.
4. The SGX-based blockchain key storage method according to claim 3, wherein: before signing in step S4, the block data value to be signed is first compared with the Enclave available space value, and the block data value calculation formula is as follows:
Figure 737474DEST_PATH_IMAGE001
wherein, BlockSize is a signed block data value, preBlockHash is a hash value of a previous block, merkleRoot is a root of a merkle tree of the block, Transaction is a set of transactions, version is a version number, restMsg is other related information, n is a total number of transactions contained in the block, and i is the ith Transaction in the block.
5. The SGX-based blockchain key storage method according to claim 4, wherein: the specific implementation of the signature of step S4 is as follows:
s4.1, obtaining the size of an SGX available area;
s4.2, comparing the block size with the buffer area size;
s4.3, generating a temporary buffer area tmpaddr;
s4.4, calling an instruction to start the key;
s4.5, copying the data in the buffer area to a caller buffer area;
s4.6, destroying the temporary buffer area;
s4.7, releasing the temporary buffer area resource
S4.8, inputting the name of an encryption algorithm used by the signature;
s4.9, converting the block information into an utf-8 code;
and S4.10, signing and returning.
6. The SGX-based blockchain key storage method according to claim 5, wherein: elliptic curve function equation of
Figure 479165DEST_PATH_IMAGE002
And a and b are equation parameters.
7. An evaluation method of an SGX-based blockchain key storage method according to any one of claims 1 to 6, wherein: the network communication complexity calculation method is shown as the following formula:
Figure 739245DEST_PATH_IMAGE003
where Commun _ compound is the network communication complexity,
Figure 723119DEST_PATH_IMAGE004
and for the comparison value of the network traffic switched between the current view and the last view, signTrans _ num is the number of signature transactions, Consensions (k) is the traffic of the kth polling, n is the number of the current round of consensus view, i is the ith round of polling, j is the jth polling, k is the kth polling, the traffic of the j-i polling is added, and the average value is obtained to calculate the final network communication complexity.
8. An apparatus of an SGX-based blockchain key storage method according to one of claims 1 to 6, wherein: comprising a memory for storing program instructions; a processor for invoking the program instructions stored in the memory to implement an SGX-based blockchain key storage method according to any one of claims 1-6.
CN202210765013.2A 2022-07-01 2022-07-01 SGX-based block chain key storage method, evaluation method and device Active CN114826625B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210765013.2A CN114826625B (en) 2022-07-01 2022-07-01 SGX-based block chain key storage method, evaluation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210765013.2A CN114826625B (en) 2022-07-01 2022-07-01 SGX-based block chain key storage method, evaluation method and device

Publications (2)

Publication Number Publication Date
CN114826625A true CN114826625A (en) 2022-07-29
CN114826625B CN114826625B (en) 2022-09-02

Family

ID=82522676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210765013.2A Active CN114826625B (en) 2022-07-01 2022-07-01 SGX-based block chain key storage method, evaluation method and device

Country Status (1)

Country Link
CN (1) CN114826625B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140211938A1 (en) * 2013-01-29 2014-07-31 Certicom Corp. Modified elliptic curve signature algorithm for message recovery
CN108989053A (en) * 2018-08-29 2018-12-11 武汉珈港科技有限公司 It is a kind of based on elliptic curve without CertPubKey cipher system implementation method
CN110138799A (en) * 2019-05-30 2019-08-16 东北大学 A kind of secure cloud storage method based on SGX
CN114006741A (en) * 2021-10-27 2022-02-01 杭州弦冰科技有限公司 Method and system for realizing cluster security deployment of Intel SGX trusted service
CN114338043A (en) * 2022-01-05 2022-04-12 上海卓鹏信息科技有限公司 Encryption storage of cross-dike chain credit investigation data and credit score privacy calculation scheme

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140211938A1 (en) * 2013-01-29 2014-07-31 Certicom Corp. Modified elliptic curve signature algorithm for message recovery
CN108989053A (en) * 2018-08-29 2018-12-11 武汉珈港科技有限公司 It is a kind of based on elliptic curve without CertPubKey cipher system implementation method
CN110138799A (en) * 2019-05-30 2019-08-16 东北大学 A kind of secure cloud storage method based on SGX
CN114006741A (en) * 2021-10-27 2022-02-01 杭州弦冰科技有限公司 Method and system for realizing cluster security deployment of Intel SGX trusted service
CN114338043A (en) * 2022-01-05 2022-04-12 上海卓鹏信息科技有限公司 Encryption storage of cross-dike chain credit investigation data and credit score privacy calculation scheme

Also Published As

Publication number Publication date
CN114826625B (en) 2022-09-02

Similar Documents

Publication Publication Date Title
Mofrad et al. A comparison study of Intel SGX and AMD memory encryption technology
US10169574B2 (en) Using trusted execution environments for security of code and data
US11947688B2 (en) Secure computing system
JP4689946B2 (en) A system that executes information processing using secure data
KR100996784B1 (en) Saving and retrieving data based on public key encryption
US10162975B2 (en) Secure computing system
CN108055133B (en) Key security signature method based on block chain technology
Strackx et al. Efficient isolation of trusted subsystems in embedded systems
Wang et al. Hybridchain: A novel architecture for confidentiality-preserving and performant permissioned blockchain using trusted execution environment
Yu et al. A trusted architecture for virtual machines on cloud servers with trusted platform module and certificate authority
Coppola et al. Automation for industry 4.0 by using secure lorawan edge gateways
Bhudia et al. RansomClave: ransomware key management using SGX
Jiang et al. An effective authentication for client application using ARM trustzone
CN114826625B (en) SGX-based block chain key storage method, evaluation method and device
WU et al. A survey on cloud security
Wang et al. Malicious code detection for trusted execution environment based on paillier homomorphic encryption
Sun et al. Application policy security mechanisms of Android system
Zhang Detection and mitigation of security threats in cloud computing
Mishra et al. Threats and vulnerabilities to IoT end devices architecture and suggested remedies
Aggarwal et al. Security approaches for mobile multi-agent system
Yu An SGX-Based and Quantum-Resitant Secure Cloud Storage System
Siby et al. GuaranTEE: Towards Attestable and Private ML with CCA
Francis et al. TPM: A More Trustworthy Solution to Computer Security
Malipatlolla SUSTAINABLE TRUSTED COMPUTING
Malipatlolla Sustainable Trusted Computing: A Novel Approach for a Flexible and Secure Update of Cryptographic Engines on a Trusted Platform Module

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant