Fabric系列 - SoftHSM 软件模拟HSM

在 fabric-ca-server 上使用软件模拟的 HSM(密码卡) 功能

安装 SoftHSMv2

教程 SoftHSMv2

  • 默认的配置文件 /etc/softhsm2.conf
  • 默认的token目录 /var/lib/softhsm/tokens/

初始化和启动fabric-ca-server,需要设置一个管理员用户的名称和密码

初始化令牌

bash 复制代码
# 初始化一个即可
softhsm2-util --init-token --slot 0 --label "fabric"
	
	=== SO PIN (4-255 characters) ===
	Please enter SO PIN: 71811222
	Please reenter SO PIN: 71811222
	=== User PIN (4-255 characters) ===
	Please enter user PIN: 71811222
	Please reenter user PIN: 71811222
	The token has been initialized and is reassigned to slot 423405613

softhsm2-util --init-token --slot 1 --label "fabric"
	=== SO PIN (4-255 characters) ===
	Please enter SO PIN: 111111
	Please reenter SO PIN: 111111
	=== User PIN (4-255 characters) ===
	Please enter user PIN: 222222
	Please reenter user PIN: 222222
	The token has been initialized and is reassigned to slot 121977387


	#查看
	softhsm2-util --show-slots

配置fabric-ca-server的配置文件fabric-ca-server-config.yaml

yaml 复制代码
bccsp:
    default: PKCS11
    sw:
        hash: SHA2
        security: 256
        filekeystore:
            keystore: msp/keystore
    pkcs11:
        Library: /usr/local/lib/softhsm/libsofthsm2.so
        Pin: "222222"
        Label: fabric
        hash: SHA2
        security: 256
        Immutable: false

启动 fabric-ca-server

bash 复制代码
#模式一: 新创建证书, 再启动  (私钥会保管在HSM中)
rm ./config-hsm/ca-cert.pem
fabric-ca-server init -b admin:adminpw -H config-hsm

fabric-ca-server start -b admin:adminpw -H config-hsm

#模式二: 指定已事先生成好的证书目录
fabric-ca-server start -b admin:adminpw -H /etc/hyperledger/fabric-ca-server-config

查看 fabric-ca-server.db

bash 复制代码
sudo apt-get install sqlite3
sqlite3 config-hsm\fabric-ca-server.db
sqlite> .tables
# 查用户表 (用户admin已经在数据库里。这是Fabric CA启动时生成的)
sqlite> select * from users;
# 使用 enroll 命令登记admin后,才会生成证书
sqlite> select * from certificates;

: 区块链知识系列
: 密码学系列
: 零知识证明系列
: 共识系列
: 公链调研系列
: BTC系列
: 以太坊系列
: EOS系列
: Filecoin系列
: 联盟链系列
: Fabric系列
: 智能合约系列
: Token系列

相关推荐
添加shujuqudong1如果未回复12 小时前
基于S-S或LCC-S结构的WPT无线电能传输电路模型,采用输出电压闭环PI控制。 另附带电路...
fabric
友莘居士1 天前
Hyperledger Fabric与 FISCO BCOS深度对比
区块链·fabric·fisco
kaozhengpro2 天前
Microsoft DP-700 考試戰報|Fabric 資料工程師一次通過心得
运维·microsoft·fabric
TFATS2 天前
Nvidia H100 算力服务器 Cuda Fabric Manager 升级
服务器·postgresql·fabric
56347179414 天前
分布式驱动电动汽车路面附着系数估计:无迹卡尔曼与容积卡尔曼滤波大比拼
fabric
二狗哈5 天前
Cesium快速入门22:fabric自定义着色器
运维·开发语言·前端·webgl·fabric·cesium·着色器
阿达_优阅达5 天前
集成方案 | 通过 Xtract Universal,将 SAP 数据无缝接入 Power BI 与微软 Fabric
运维·microsoft·sap·fabric·theobald
CinzWS14 天前
Cortex-M3 安全启动完整流程与机制详解
安全·cortex-m3·hsm·安全启动
ZFJ_张福杰20 天前
【技术深度】【安全】Remote Password Protection:一套密码永不上传的登录协议方案(含盲签 + Pairing + Crypto 模块)
安全·密码学·零信任·hsm·双线性映射·远程密码保护
NGINX开源社区1 个月前
将部署从 NGINX Ingress Controller 迁移至 NGINX Gateway Fabric
nginx·gateway·fabric