我正在使用余额转移示例。
我已在订购者容器中启用ORDERER_GENERAL_TLS_CLIENTAUTHREQUIRED=true
。
在创建新频道(mychannel)时,它抛出了Handshake failed with fatal error
的错误
出现错误后,我配置了客户端
client.setTlsClientCertAndKey(cert, key);
let adminClient = JSON.parse(
fs.readFileSync(path.join(__dirname, "../fabric-client-kv-org1/admin"))
);
logger.info(adminClient);
client.setTlsClientCertAndKey(
adminClient.enrollment.identity.certificate,
adminClient.enrollment.signingIdentity
);
我正在导入admin
,然后使用其signingIdentity和证书来设置tls客户端。
现在,它以Invalid private key
的形式抛出错误
E0619 17:15:44.135000000 139448 ssl_transport_security.cc:671] Invalid private key.
E0619 17:15:44.136000000 139448 security_connector.cc:1087] Handshaker factory creation failed with TSI_INVALID_ARGUMENT.
E0619 17:15:44.137000000 139448 secure_channel_create.cc:121] Failed to create secure subchannel for secure name 'localhost:7050'
E0619 17:15:44.137000000 139448 secure_channel_create.cc:154] Failed to create subchannel arguments during subchannel creation.
2019-06-19T11:45:47.132Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:7050
2019-06-19T11:45:47.133Z - error: [Orderer.js]: Orderer grpcs://localhost:7050 has an error Error: Failed to connect before the deadline URL:grpcs://localhost:7050
错误原因是什么?我是否使用正确的客户端证书和密钥?在文档中令人困惑
https://fabric-sdk-node.github.io/tutorial-network-config.html
答案 0 :(得分:0)
我找出了无效私钥的原因。签名身份不是私钥。
注册用户后,我正在注册它并在本地保存其私钥和证书。
let req = {
enrollmentID: "admin",
enrollmentSecret: "adminpw",
profile: "tls"
};
const enrollment = await caClient.enroll(req);
client.setTlsClientCertAndKey(
enrollment.certificate,
enrollment.key.toBytes()
);