fabric-ca-server 无法使用 softhsm 配置启动

fabric-ca-server is not able to start with softhsm configuration

我已经在 fabric ca 中启用了 PKCS11,但是当本机启动 fabric-ca-server 时抛出以下错误。请注意它在默认 SW 选项下工作正常。

  1. 检查 fabric-ca v1.3.0
  2. 更新 BCCSP 属性 如下

密件抄送: 默认值:PKCS11 pkcs11: 图书馆:/usr/local/lib/softhsm/libsofthsm2.so 密码:daily123 标签:org1label 散列:SHA2 保安:256 文件密钥库: # 用于软件基于文件的密钥库的目录 密钥库:msp/keystore

  1. 运行 带有命令的服务器 ./fabric-ca-server start -b admin:adminpw -d

错误2018/10/12 07:27:01 [INFO] Configuration file location: /opt/gopath/bin/fabric-ca-server-config.yaml 2018/10/12 07:27:01 [INFO] Starting server in home directory: /opt/gopath/bin 2018/10/12 07:27:01 [INFO] Server Version: 1.3.0 2018/10/12 07:27:01 [INFO] Server Levels: &{Identity:1 Affiliation:1 Certificate:1 Credential:1 RAInfo:1 Nonce:1} 2018/10/12 07:27:01 [DEBUG] Making server filenames absolute 2018/10/12 07:27:01 [DEBUG] Initializing default CA in directory /opt/gopath/bin 2018/10/12 07:27:01 [DEBUG] Init CA with home /opt/gopath/bin and config {Version:1.3.0 Cfg:{Identities:{AllowRemove:false} Affiliations:{AllowRemove:false}} CA:{Name: Keyfile: Certfile:ca-cert.pem Chainfile:ca-chain.pem} Signing:0xc4204ce7d0 CSR:{CN:fabric-ca-server Names:[{C:US ST:North Carolina L: O:Hyperledger OU:Fabric SerialNumber:}] Hosts:[safenet localhost] KeyRequest:0xc4204b1ac0 CA:0xc4204b1b40 SerialNumber:} Registry:{MaxEnrollments:-1 Identities:[{ Name:**** Pass:**** Type:client Affiliation: MaxEnrollments:0 Attrs:map[hf.Registrar.Roles:* hf.Registrar.DelegateRoles:* hf.Revoker:1 hf.IntermediateCA:1 hf.GenCRL:1 hf.Registrar.Attributes:* hf.AffiliationMgr:1] }]} Affiliations:map[org2:[department1] org1:[department1 department2]] LDAP:{ Enabled:false URL:ldap://****:****@<host>:<port>/<base> UserFilter:(uid=%s) GroupFilter:(memberUid=%s) Attribute:{[uid member] [{ }] map[groups:[{ }]]} TLS:{false [] { }} } DB:{ Type:sqlite3 Datasource:fabric-ca-server.db TLS:{false [] { }} } CSP:0xc4204de060 Client:<nil> Intermediate:{ParentServer:{ URL: CAName: } TLS:{Enabled:false CertFiles:[] Client:{KeyFile: CertFile:}} Enrollment:{ Name: Secret:**** CAName: AttrReqs:[] Profile: Label: CSR:<nil> Type:x509 }} CRL:{Expiry:24h0m0s} Idemix:{IssuerPublicKeyfile: IssuerSecretKeyfile: RevocationPublicKeyfile: RevocationPrivateKeyfile: RHPoolSize:1000 NonceExpiration:15s NonceSweepInterval:15m}} 2018/10/12 07:27:01 [DEBUG] CA Home Directory: /opt/gopath/bin 2018/10/12 07:27:01 [DEBUG] Checking configuration file version '1.3.0' against server version: '1.3.0' 2018/10/12 07:27:01 [DEBUG] Initializing BCCSP: &{ProviderName:PKCS11 SwOpts:<nil> PluginOpts:<nil>} 2018/10/12 07:27:01 [DEBUG] Closing server DBs Error: Failed to initialize BCCSP Factories: %!s(<nil>) Could not find defaultPKCS11BCCSP

它适用于最新的 fabric-ca 图像(截至目前最新的 1.4.0-snapshot-cb7353f)。

如果您使用 fabric-ca 1.3 代码库,请按照以下步骤使其工作

GO_TAGS=pkcs11 make fabric-ca-server

使用令牌、标签、引脚、库等 softHSM 数据更新 fabric-ca-server-config.yaml(关注此处 https://hyperledger-fabric-ca.readthedocs.io/en/release-1.3/users-guide.html#configuring-fabric-ca-server-to-use-softhsm2

使用 fabric-ca-server start -b admin:adminpw

重启 fabric-ca 服务器

fabric-ca 服务器按预期重新启动。