Hyperledger Node SDK-握手失败,并出现致命错误SSL例程:tls_process_server_certificate:证书验证失败

时间:2019-12-19 14:29:09

标签: hyperledger-fabric hyperledger hyperledger-fabric-ca hyperledger-fabric-sdk-js

我正在遵循以下git存储库来为超分类账网络设置节点SDK:https://github.com/hyperledger/fabric-sdk-node。我能够通过CLI调用/查询事务。但是,当我使用Node SDK尝试相同操作时,无法将对等实例添加到通道实例,并且抛出此特定错误: E1219 19:56:36.154387360 20765 ssl_transport_security.cc:1237]握手失败,并出现致命错误SSL_ERROR_SSL:error:1416F086:SSL例程:tls_process_server_certificate:证书验证失败。

我可以在上一步中将订购者添加到同一频道,因此我无法理解其背后的逻辑。任何帮助将不胜感激。

const ordererCertPath = ORGS.orderer0.tls_cacerts;
const ordererCertData = fs.readFileSync(path.join(__dirname, ordererCertPath));
const ordererCert = Buffer.from(data).toString();

const peer0CertPath = ORGS.belrium.peers.peer1.tls_cacerts;
const peer0CertData = fs.readFileSync(path.join(__dirname, peer0CertPath));
const peer0Cert = Buffer.from(peer0CertData).toString();

let tlsInfo = null;

orgName = ORGS[userOrg].name;

let promise;
promise = Client.newDefaultKeyValueStore({
    path: testUtil.storePathForOrg(orgName)});

return e2eUtils.tlsEnroll(userOrg)
    .then((enrollment) => {
        console.log('Successfully retrieved TLS certificate');
        tlsInfo = enrollment;
        client.setTlsClientCertAndKey(tlsInfo.certificate, tlsInfo.key);
        return promise;
    }).then((store) => {
        if (store) {
            client.setStateStore(store);
        }
        return testUtil.getSubmitter(client, userOrg);
    }).then((admin) => {

        console.log('Successfully enrolled user \'admin\' (e2eUtil 3)');
        the_user = admin;

        channel.addOrderer(
            client.newOrderer(
                ORGS.orderer0.url,
                {
                    'pem': caroots,
                    'ssl-target-name-override': ORGS.orderer0['server-hostname']
                }
            )
        );


  //Error part starts here.....



            const peer = client.newPeer(
                ORGS.belrium.peers.peer1.requests,
                {
                    pem: peer0caroots,
                    'ssl-target-name-override': ORGS.#{userorg}.peers.peer1['server-hostname']
                }
            );
            channel.addPeer(peer);
            return channel.initialize();

1 个答案:

答案 0 :(得分:0)

验证组织定义及其证书,您可以将对等组织对等证书与CLI中使用的证书进行比较。