Hyperledger fabric hyperledger结构:找不到与SKI匹配的私钥

Hyperledger fabric hyperledger结构:找不到与SKI匹配的私钥,hyperledger-fabric,Hyperledger Fabric,这是我关于stackoverflow的第一篇文章,通常我每次来到stackoverflow都能找到解决方案,但这次不行:( 我正在尝试为供应链实施hyperledger结构解决方案。 我可以执行channel、chaincode、addpeers…我还可以通过终端实例化和调用chaincode 我想用node sdk创建一个与我的区块链交互的应用程序,所以我想使用fabric-ca。下面是我的docker-compose-base.yaml文件: ca_acheteur.example.com:

这是我关于stackoverflow的第一篇文章,通常我每次来到stackoverflow都能找到解决方案,但这次不行:(

我正在尝试为供应链实施hyperledger结构解决方案。 我可以执行channel、chaincode、addpeers…我还可以通过终端实例化和调用chaincode

我想用node sdk创建一个与我的区块链交互的应用程序,所以我想使用fabric-ca。下面是我的docker-compose-base.yaml文件:

ca_acheteur.example.com:
 image: hyperledger/fabric-ca
 environment:
   - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
   - FABRIC_CA_SERVER_CA_NAME=ca_acheteur.example.com                               
   - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.acheteur.example.com-cert.pem
   - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/abef4d982d505c588c15bf25af3270f403c94daff71301e37a9c84abe41e6c71_sk
 ports:
   - "7054:7054"
 command: sh -c 'fabric-ca-server start -b admin:adminpw'
 volumes:
   - ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
 container_name: ca_acheteur.example.com
 networks:
   - basic
ca_vendeur.example.com:
 image: hyperledger/fabric-ca
 environment:
   - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
   - FABRIC_CA_SERVER_CA_NAME=ca_vendeur.example.com
   - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.vendeur.example.com-cert.pem
   - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/42ecb9a24235f691c5392d7eecebc458827b00bf0bf150fd727298b321b6d51d_sk
 ports:
   - "8054:8054"
 command: sh -c 'fabric-ca-server start -b admin:adminpw'
 volumes:
   - ./crypto-config/peerOrganizations/vendeur.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
 container_name: ca_vendeur.example.com
 networks:
   - basic
当我启动容器时,我得到以下结果:

Creating ca_acheteur.example.com           ... done
Creating peer0.acheteur.example.com        ... done
Creating peer0.vendeur.example.com         ... done
Creating ca_vendeur.example.com            ... done
Creating orderer.example.com               ... done
Creating couchdb                           ... done
Creating cli                               ... done
CA容器失败,下面是docker日志:

2018/06/19 17:10:01 [INFO] Created default configuration file at /etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml
2018/06/19 17:10:01 [INFO] Starting server in home directory: /etc/hyperledger/fabric-ca-server
2018/06/19 17:10:01 [INFO] Server Version: 1.1.0
2018/06/19 17:10:01 [INFO] Server Levels: &{Identity:1 Affiliation:1 Certificate:1}
Error: Failed to find private key for certificate in '/etc/hyperledger/fabric-ca-server-config/ca.vendeur.example.com-cert.pem': Could not find matching private key for SKI: Failed getting key for SKI [[159 75 128 227 121 9 61 98 235 18 118 191 43 69 158 184 170 52 121 51 27 147 132 228 64 195 35 218 6 9 158 30]]: Key with SKI 9f4b80e379093d62eb1276bf2b459eb8aa3479331b9384e440c323da06099e1e not found in /etc/hyperledger/fabric-ca-server/msp/keystore
结构\u CA\u服务器\u CA\u密钥文件与对等方上的本地CA相同


让我知道我在这里遗漏了什么。

我与op有相同的错误,但只有一台ca服务器

我找到的唯一修复方法是编辑FABRIC\u CA\u SERVER\u KEYFILE环境变量,以便在生成私钥后与私钥的名称匹配

编辑:在搜索了它在fabric示例中的配置方式后,我看到他们在docker-compose-e2e.yaml中的ca配置中将其命名为CA2_PRIVATE_KEY


在第271-281行生成后,它会自动重命名。

这是ca的私钥问题。 执行generate.sh脚本后,将生成新的证书。因此,您必须更新docker-compose.yml文件

从路径-->crypto-config/PeerorOrganizations/org1.example.com/ca//uuuuuuuuuuuuuu-sk粘贴文件名

在docker-compose.yml文件中-->

环境


-FABRIC\u CA\u SERVER\u CA\u KEYFILE=/etc/hyperledger/FABRIC CA SERVER config/\uuuu\u-sk我也遇到了同样的问题。我不知道你在使用什么操作系统,但我在Windows上遇到了这个问题。FABRIC文档指定:
如果你在Windows 7或macOS上使用Docker Toolbox,你需要在C:\Users(Windows 7)下使用一个位置或/用户(macOS)安装和运行示例。

当我将项目移动到用户文件夹时,它开始工作。

我按照建议“在生成私钥后编辑FABRIC\u CA\u SERVER\u KEYFILE环境变量以匹配私钥的名称”。它正在工作

我的错误:

Error: Failed to find private key for certificate in '/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem': Could not find matching private key for SKI: Failed getting key for SKI [[......]: Key with SKI 300dbdb3ba348ba85045c40fa3f6985cc1c9f9e9fc5dcd21fd43b1faabbe052b not found in /etc/hyperledger/fabric-ca-server/msp/keystore
我将其更改为应用程序路径中的script generate.sh的结果:

basic-network\crypto-config\peerOrganizations\org1.example.com\ca\e389cdd4b312bf2c8873577ed7afdbd65f061e5546ed25e41f3935324c7a159e_sk
它开始工作了!!!我的节点结构ca启动了