【问题标题】:peer node start throwing Could not find default pkcs11 BCCSP error对等节点开始抛出找不到默认的pkcs11 BCCSP错误
【发布时间】:2018-12-28 09:29:47
【问题描述】:

我正在尝试在启用了 SoftHSM 的情况下运行 Hyperledger Fabric peer。 Fabric-ca-server 已经在启用 SoftHSM 的情况下运行,并且所有证书都是在启用 HSM 的情况下生成的。

最初,当我尝试运行 fabric-ca-server 时,它抛出了同样的错误Could not find defaultPKCS11BCCSP

然后我发现有人建议从源代码构建并修复了该错误。

现在,当我运行 peer node start 命令引导对等方时,我面临同样的错误。

core.yaml 上的BCCSP 内容如下:

# BCCSP (Blockchain crypto provider): Select which crypto implementation or
    # library to use
    BCCSP:
        Default: PKCS11
        # Settings for the SW crypto provider (i.e. when DEFAULT: SW)
        SW:
            # TODO: The default Hash and Security level needs refactoring to be
            # fully configurable. Changing these defaults requires coordination
            # SHA2 is hardcoded in several places, not only BCCSP
            Hash: SHA2
            Security: 256
            # Location of Key Store
            FileKeyStore:
                # If "", defaults to 'mspConfigPath'/keystore
                KeyStore:
        # Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11)
        PKCS11:
            # Location of the PKCS11 module library
            Library: /usr/local/lib/softhsm/libsofthsm2.so
            # Token Label
            Label: ForFabric
            # User PIN
            Pin: 98765432
            Hash: SHA2
            Security: 256
            FileKeyStore:
                KeyStore: /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp/keystore

我运行peer node start时的错误:

$ peer node start
2018-12-28 14:48:50.508 IST [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/akshay/dev/fabric-ca/fabric-ca-client/peerOrg/msp: could not initialize BCCSP Factories: Failed initializing BCCSP.: Could not initialize BCCSP SW [Failed to initialize software key store: An invalid KeyStore path provided. Path cannot be an empty string.]
Could not find default `PKCS11` BCCSP

我正在使用以下同级版本:

$ peer version
peer:
 Version: 1.4.0
 Commit SHA: 9cd9fce
 Go version: go1.11.2
 OS/Arch: linux/amd64
 Chaincode:
  Base Image Version: 0.4.14
  Base Docker Namespace: hyperledger
  Base Docker Label: org.hyperledger.fabric
  Docker Namespace: hyperledger

【问题讨论】:

  • 您自己构建了对等二进制文件吗?
  • 您还应该从 core.yaml 中删除 SW: 部分
  • 是的,删除SW:(愚蠢的代码),并检查是否没有设置环境变量来覆盖您的默认 BCCSP
  • @GariSingh 我首先尝试了 fabric-samples 附带的二进制文件。然后我构建了对等二进制文件,结果是相同的错误。然后我删除了 SW:相同的错误
  • 还需要设置pkcs11构建标签:GO_TAGS=pkcs11 make peer

标签: hyperledger-fabric hyperledger hsm softhsm


【解决方案1】:

有两个问题:

1) 确保删除core.yamlBCCSP 下的SW: 部分 2) 默认情况下,peer 二进制文件和 Docker 镜像都是在不支持 PCKS11 的情况下构建的。您可以使用 GO_TAGS=pkcs11 make peer 自己构建对等二进制文件

【讨论】:

  • 我对fabric-ca 服务器有一个疑问,假设如果我在本地运行fabric-ca 服务器(没有docker),那么我仍然需要设置GO_TAGS=pkcs11 并再次创建fabric-ca 二进制文件。
  • make fabric-ca-servermake fabric-ca-client 都已经包含-tags "pkcs11"github.com/hyperledger/fabric-ca/blob/release-1.4/Makefile#L116
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-25
  • 1970-01-01
  • 1970-01-01
  • 2015-03-26
相关资源
最近更新 更多