hyperledger fabric:无法找到SKI的匹配私钥

问题描述 投票:2回答:3

这是我在stackoverflow上的第一篇文章,normaly我每次来stackoverflow时都找到了解决方案,但不是这次:(

我正在尝试为供应链实施超级边缘织物解决方案。我可以执行通道,链代码,添加...我也可以通过终端实例化和调用链代码。

我想用节点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 log:

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

FABRIC_CA_SERVER_CA_KEYFILE与我在同级上的本地ca相同。

让我知道我在这里失踪了什么。

hyperledger-fabric
3个回答
2
投票

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

我发现的唯一修复是在生成私有密钥后编辑FABRIC_CA_SERVER_KEYFILE环境变量以匹配私有名称。

编辑:在搜索结构样本中的配置后,我看到他们在docker-compose-e2e.yaml的ca配置中将其命名为CA2_PRIVATE_KEY。

它在https://github.com/hyperledger/fabric-samples/blob/master/first-network/byfn.sh第271-281行生成后自动重命名。


1
投票

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

从路径粘贴文件名 - > crypto-config / peerOrganizations / org1.example.com / ca /​​ _____- sk

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

环境

- FABRIC_CA_SERVER_CA_KEYFILE = / etc / hyperledger / fabric-ca-server-config / ___- sk


0
投票

我刚才有同样的问题。我不知道你在使用什么操作系统,但我在Windows上遇到了这个问题。 Fabric文档指定:If you are using Docker Toolbox on Windows 7 or macOS, you will need to use a location under C:\Users (Windows 7) or /Users (macOS) when installing and running the samples.

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


0
投票

我按照建议“编辑FABRIC_CA_SERVER_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

我在我的应用程序的路径中更改脚本generate.sh的结果:

basic-network\crypto-config\peerOrganizations\org1.example.com\ca\e389cdd4b312bf2c8873577ed7afdbd65f061e5546ed25e41f3935324c7a159e_sk

而且它正在工作!我的节点结构 - 它了!

© www.soinside.com 2019 - 2024. All rights reserved.