Using a Hardware Security Module (HSM) — Hyperledger Fabric Docs main documentation (2024)

The cryptographic operations performed by Fabric nodes can be delegated toa Hardware Security Module (HSM). An HSM protects your private keys andhandles cryptographic operations, allowing your peers and orderer nodes tosign and endorse transactions without exposing their private keys. If yourequire compliance with government standards such as FIPS 140-2, there aremultiple certified HSMs from which to choose.

Fabric currently leverages the PKCS11 standard to communicate with an HSM.

Configuring an HSM

To use an HSM with your Fabric node, you need to update the bccsp (Crypto ServiceProvider) section of the node configuration file such as core.yaml ororderer.yaml. In the bccsp section, you need to select PKCS11 as the provider andenter the path to the PKCS11 library that you would like to use. You also needto provide the Label and PIN of the token that you created for your cryptographicoperations. You can use one token to generate and store multiple keys.

The prebuilt Hyperledger Fabric Docker images are not enabled to use PKCS11. Ifyou are deploying Fabric using docker, you need to build your own images andenable PKCS11 using the following command:

make docker GO_TAGS=pkcs11

You also need to ensure that the PKCS11 library is available to be used by thenode by installing it or mounting it inside the container.

Example

The following example demonstrates how to configure a Fabric node to use an HSM.

First, you will need to install an implementation of the PKCS11 interface. Thisexample uses the softhsm open sourceimplementation. After downloading and configuring softhsm, you will need to setthe SOFTHSM2_CONF environment variable to point to the softhsm2 configurationfile.

You can then use softhsm to create the token that will handle the cryptographicoperations of your Fabric node inside an HSM slot. In this example, we create atoken labelled “fabric” and set the pin to “71811222”. After you have createdthe token, update the configuration file to use PKCS11 and your token as thecrypto service provider. You can find an example bccsp section below:

############################################################################## BCCSP (BlockChain Crypto Service Provider) section is used to select which# crypto library implementation to use#############################################################################bccsp: default: PKCS11 pkcs11: Library: /etc/hyperledger/fabric/libsofthsm2.so Pin: "71811222" Label: fabric hash: SHA2 security: 256 Immutable: false

By default, when private keys are generated using the HSM, the private key is mutable, meaning PKCS11 private key attributes can be changed after the key is generated. Setting Immutable to true means that the private key attributes cannot be altered after key generation. Before you configure immutability by setting Immutable: true, ensure that PKCS11 object copy is supported by the HSM.

If you are using AWS HSM there is an additional step required:

  • Add the parameter, AltID to the pkcs11 section of the bccsp block. When AWS HSM is being used, this parameter is used to assign a unique value for the Subject Key Identifier (SKI). Create a long secure string outside of Fabric and assign it to the AltID parameter. For example:

    ############################################################################## BCCSP (BlockChain Crypto Service Provider) section is used to select which# crypto library implementation to use#############################################################################bccsp: default: PKCS11 pkcs11: Library: /etc/hyperledger/fabric/libsofthsm2.so Pin: 71811222 Label: fabric hash: SHA2 security: 256 Immutable: false AltID: 4AMfmFMtLY6B6vN3q4SQtCkCQ6UY5f6gUF3rDRE4wqD4YDUrunuZbmZpVk8zszkt86yenPBUGE2aCQCZmQFcmnj3UaxyLzfTMjCnapAe3

You can also use environment variables to override the relevant fields of the configuration file. If you are connecting to softhsm2 using the Fabric CA server, you could set the following environment variables or directly set the corresponding values in the CA server config file:

FABRIC_CA_SERVER_BCCSP_DEFAULT=PKCS11FABRIC_CA_SERVER_BCCSP_PKCS11_LIBRARY=/etc/hyperledger/fabric/libsofthsm2.soFABRIC_CA_SERVER_BCCSP_PKCS11_PIN=71811222FABRIC_CA_SERVER_BCCSP_PKCS11_LABEL=fabric

If you are connecting to softhsm2 using the Fabric peer, you could set the following environment variables or directly set the corresponding values in the peer config file:

CORE_PEER_BCCSP_DEFAULT=PKCS11CORE_PEER_BCCSP_PKCS11_LIBRARY=/etc/hyperledger/fabric/libsofthsm2.soCORE_PEER_BCCSP_PKCS11_PIN=71811222CORE_PEER_BCCSP_PKCS11_LABEL=fabric

If you are connecting to softhsm2 using the Fabric orderer, you could set the following environment variables or directly set the corresponding values in the orderer config file:

ORDERER_GENERAL_BCCSP_DEFAULT=PKCS11ORDERER_GENERAL_BCCSP_PKCS11_LIBRARY=/etc/hyperledger/fabric/libsofthsm2.soORDERER_GENERAL_BCCSP_PKCS11_PIN=71811222ORDERER_GENERAL_BCCSP_PKCS11_LABEL=fabric

If you are deploying your nodes using docker compose, after building your ownimages, you can update your docker compose files to mount the softhsm libraryand configuration file inside the container using volumes. As an example, youwould add the following environment and volumes variables to your docker composefile:

 environment: - SOFTHSM2_CONF=/etc/hyperledger/fabric/config.file volumes: - /home/softhsm/config.file:/etc/hyperledger/fabric/config.file - /usr/local/Cellar/softhsm/2.1.0/lib/softhsm/libsofthsm2.so:/etc/hyperledger/fabric/libsofthsm2.so

Setting up a network using HSM

If you are deploying Fabric nodes using an HSM, your private keys need to begenerated and stored inside the HSM rather than inside the keystore folder of the node’slocal MSP folder. The keystore folder of the MSP will remain empty. Instead,the Fabric node will use the subject key identifier of the signing certificatein the signcerts folder to retrieve the private key from inside the HSM.The process for creating the node MSP folder differs depending on whether youare using a Fabric Certificate Authority (CA) your own CA.

Before you begin

Before configuring a Fabric node to use an HSM, you should have completed the following steps:

  1. Created a partition on your HSM Server and recorded the Label and PIN of the partition.

  2. Followed instructions in the documentation from your HSM provider to configure an HSM Client that communicates with your HSM server.

Using an HSM with a Fabric CA

You can set up a Fabric CA to use an HSM by making the same edits to the CA server configuration file as you would make to a peer or ordering node. Because you can use the Fabric CA to generate keys inside an HSM, the process of creating the local MSP folders is straightforward. Use the following steps:

  1. Modify the bccsp section of the Fabric CA server configuration file and point to the Label and PIN that you created for your HSM. When the Fabric CA server starts, the private key is generated and stored in the HSM. If you are not concerned about exposing your CA signing certificate, you can skip this step and only configure an HSM for your peer or ordering nodes, described in the next steps.

  2. Use the Fabric CA client to register the peer or ordering node identities with your CA.

  3. Before you deploy a peer or ordering node with HSM support, you need to enroll the node identity by storing its private key in the HSM. Edit the bccsp section of the Fabric CA client config file or use the associated environment variables to point to the HSM configuration for your peer or ordering node. In the Fabric CA Client configuration file, replace the default SW configuration with the PKCS11 configuration and provide the values for your own HSM:

bccsp: default: PKCS11 pkcs11: Library: /etc/hyperledger/fabric/libsofthsm2.so Pin: "71811222" Label: fabric hash: SHA2 security: 256 Immutable: false

Then for each node, use the Fabric CA client to generate the peer or ordering node’s MSP folder by enrolling against the node identity that you registered in step 2. Instead of storing the private key in the keystore folder of the associated MSP, the enroll command uses the node’s HSM to generate and store the private key for the peer or ordering node. The keystore folder remains empty.

  1. To configure a peer or ordering node to use the HSM, similarly update the bccsp section of the peer or orderer configuration file to use PKCS11 and provide the Label and PIN. Also, edit the value of the mspConfigPath (for a peer node) or the LocalMSPDir (for an ordering node) to point to the MSP folder that was generated in the previous step using the Fabric CA client. Now that the peer or ordering node is configured to use HSM, when you start the node it will be able sign and endorse transactions with the private key protected by the HSM.

Using an HSM with your own CA

If you are using your own Certificate Authority to deploy Fabric components, youcan use an HSM using the following steps:

  1. Configure your CA to communicate with an HSM using PKCS11 and create a Label and PIN.Then use your CA to generate the private key and signing certificate for eachnode, with the private key generated inside the HSM.

  2. Use your CA to build the peer or ordering node MSP folder. Place the signing certificate that you generated in step 1 inside the signcerts folder. You can leave the keystore folder empty.

  3. To configure a peer or ordering node to use the HSM, similarly update the bccsp section of the peer or orderer configuration file to use PKCS11 andand provide the Label and PIN. Edit the value of the mspConfigPath (for a peer node) or the LocalMSPDir (for an ordering node) to point to the MSP folder that was generated in the previous step using the Fabric CA client. Now that the peer or ordering node is configured to use HSM, when you start the node it will be able sign and endorse transactions with the private key protected by the HSM.

Using a Hardware Security Module (HSM) — Hyperledger Fabric Docs main documentation (2024)

FAQs

What is a hardware security module HSM used for? ›

A hardware security module (HSM) is a physical computing device that safeguards and manages secrets (most importantly digital keys), performs encryption and decryption functions for digital signatures, strong authentication and other cryptographic functions.

What are the hardware requirements for Hyperledger fabric? ›

To run Hyperledger Composer and Hyperledger Fabric, we recommend you have at least 4Gb of memory. The following are prerequisites for installing the required development tools: Operating Systems: Ubuntu Linux 14.04 / 16.04 LTS (both 64-bit), or Mac OS 10.12. Docker Engine: Version 17.03 or higher.

Which of the following is a hardware security module responsible for? ›

The hardware security module protects cryptographic keys and handles the encryption and decryption processes. HSMs manage the entire lifecycle of cryptographic keys. HSMs also can create and verify digital signatures.

What is HSM details? ›

Hardware security modules (HSMs) are hardened, tamper-resistant hardware devices that secure cryptographic processes by generating, protecting, and managing keys used for encrypting and decrypting data and creating digital signatures and certificates.

When should you use a HSM Why? ›

When you use an HSM to protect cryptographic keys, you add a robust layer of security, preventing attackers from finding them. nShield HSMs are specially designed to establish a root of trust, safeguarding and managing cryptographic keys and processes within a certified hardware environment.

What are the two types of HSM? ›

Types of Hardware Security Modules (HSMs)

There are two primary types of HSMs: general purpose and payment hardware security modules.

What is the main service of Hyperledger Fabric? ›

Hyperledger Fabric serves as the foundation for developing applications or solutions with a modular architecture. It allows interchangeable components, including consensus and membership services, enabling a plug-and-play environment.

What are the two parts of Hyperledger Fabric? ›

Hyperledger Fabric has a ledger subsystem comprising two components: the world state and the transaction log. Each participant has a copy of the ledger to every Hyperledger Fabric network they belong to.

What are the three key features of a Hyperledger blockchain? ›

At a high-level, blockchain technology consists of three components: a distributed ledger, consensus algorithm, and smart contracts. A ledger is a transactional log that keeps a complete record of the entire history of data changes.

What are the three main hardware security measures? ›

First, ensure all hardware is kept in a secure location when not in use. It could be a locked cabinet or room. Second, physically secure all devices with locks or other tamper-proof devices. Third, limit access to hardware to authorized personnel only.

What are the benefits of hardware security module? ›

The main benefits of hardware security modules are: physical access protection, secure management of key material, secure generation of keys, and secure execution environment. There is no way to completely protect conventional IT systems from external attack.

What are the disadvantages of HSM? ›

2 Disadvantages of HSMs

One of the main disadvantages is that they are expensive and complex to deploy and maintain. HSMs require specialized hardware, software, and personnel to operate and manage them. They also need to be compatible with your hardware design and the standards and protocols that you use.

What is HSM and how does it work? ›

Hardware Security Modules (HSMs) are hardened, tamper-resistant hardware devices that strengthen encryption practices by generating keys, encrypting and decrypting data, and creating and verifying digital signatures.

How to connect HSM? ›

You can initialize the HSM and create the security domain before you license the system and create a traffic management configuration.
  1. Log in to the command line of the system using an account with root access.
  2. Open the TMOS Shell ( ...
  3. Initialize the HSM and set a security officer (SO) password.

What is HSM architecture? ›

Cloud HSM is Google Cloud's hardware key management service. It offers a number of distinct advantages to users looking to protect their data at rest with HSM keys. The service was designed with the principles of locked-down API access to the HSMs, effortless scale, and tight regionalization of the keys.

Is HSM a network device? ›

Available in network attached and PCIe form factors, ProtectServer Hardware Security Modules (HSMs) are designed to protect cryptographic keys against compromise while providing encryption, signing and authentication services to secure Java and sensitive web applications.

What is the difference between software and HSM? ›

Hardware-based solutions like HSMs perform better than software-only solutions. They contain dedicated cryptographic processors that can execute complex encryption operations without draining your CPU's resources.

What is the difference between hardware security module HSM and key management service KMS? ›

Cryptographic operations can be moved to secure areas using HSM devices. Instead, KMS can separate the key management and allow the applications to carry out their crypto functions on their own by moving the key governance to secure locations.

Top Articles
Sweet honey in the rocks
What Happens On A Debt Management Plan (DMP)? StepChange
Creepshotorg
Ross Dress For Less Hiring Near Me
Santa Clara College Confidential
The Best Classes in WoW War Within - Best Class in 11.0.2 | Dving Guides
Cosentyx® 75 mg Injektionslösung in einer Fertigspritze - PatientenInfo-Service
Produzione mondiale di vino
Helloid Worthington Login
What Is Njvpdi
Hmr Properties
Buying risk?
Gfs Rivergate
Med First James City
UEQ - User Experience Questionnaire: UX Testing schnell und einfach
Https E24 Ultipro Com
Cooking Fever Wiki
Transfer Credits Uncc
Busted Barren County Ky
Halo Worth Animal Jam
Panic! At The Disco - Spotify Top Songs
Buying Cars from Craigslist: Tips for a Safe and Smart Purchase
Living Shard Calamity
Pixel Combat Unblocked
Barbie Showtimes Near Lucas Cinemas Albertville
Craigslist/Phx
Kacey King Ranch
Laveen Modern Dentistry And Orthodontics Laveen Village Az
Rogold Extension
First Light Tomorrow Morning
The Pretty Kitty Tanglewood
Kelsey Mcewen Photos
Craigslist Greencastle
What Are Digital Kitchens & How Can They Work for Foodservice
Arcadia Lesson Plan | Day 4: Crossword Puzzle | GradeSaver
The Boogeyman Showtimes Near Surf Cinemas
Blackstone Launchpad Ucf
Gateway Bible Passage Lookup
10 Rarest and Most Valuable Milk Glass Pieces: Value Guide
Valls family wants to build a hotel near Versailles Restaurant
Borat: An Iconic Character Who Became More than Just a Film
Dontrell Nelson - 2016 - Football - University of Memphis Athletics
Fluffy Jacket Walmart
Dobratz Hantge Funeral Chapel Obituaries
Lightfoot 247
Blog Pch
Cryptoquote Solver For Today
Edict Of Force Poe
Land of Samurai: One Piece’s Wano Kuni Arc Explained
All Obituaries | Roberts Funeral Home | Logan OH funeral home and cremation
Latest Posts
Article information

Author: Errol Quitzon

Last Updated:

Views: 5756

Rating: 4.9 / 5 (79 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Errol Quitzon

Birthday: 1993-04-02

Address: 70604 Haley Lane, Port Weldonside, TN 99233-0942

Phone: +9665282866296

Job: Product Retail Agent

Hobby: Computer programming, Horseback riding, Hooping, Dance, Ice skating, Backpacking, Rafting

Introduction: My name is Errol Quitzon, I am a fair, cute, fancy, clean, attractive, sparkling, kind person who loves writing and wants to share my knowledge and understanding with you.