1

我正在关注这个 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: 错误: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();
4

1 回答 1

1

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

于 2020-01-17T10:54:43.367 回答