From 47d931c7421e2423bda4cbf5b6f51faf0d9cfe69 Mon Sep 17 00:00:00 2001 From: Baohua Yang Date: Mon, 3 May 2021 14:23:54 -0700 Subject: [PATCH] Add getCerts.sh --- hyperledger_fabric/test/auto.sh | 2 ++ hyperledger_fabric/test/getCerts.sh | 33 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 hyperledger_fabric/test/auto.sh create mode 100644 hyperledger_fabric/test/getCerts.sh diff --git a/hyperledger_fabric/test/auto.sh b/hyperledger_fabric/test/auto.sh new file mode 100644 index 00000000..559a4d4e --- /dev/null +++ b/hyperledger_fabric/test/auto.sh @@ -0,0 +1,2 @@ +bash fetch-config-block.sh dhanNodeOUf1 testchainid dhannodeouf1-bcsnativetest-iad.blockchain.test.ocp.oc-test.com:20003 +bash fetch-config-block.sh dhanNodeOUf1 nodeouchannel01 dhannodeouf1-bcsnativetest-iad.blockchain.test.ocp.oc-test.com:20003 diff --git a/hyperledger_fabric/test/getCerts.sh b/hyperledger_fabric/test/getCerts.sh new file mode 100644 index 00000000..912a53d0 --- /dev/null +++ b/hyperledger_fabric/test/getCerts.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Generate certs from org json file +# It will overwrite any local cert files + +# Usage: ./script jsonFile + +if [ $# -lt 1 ]; then + echo "Please use the json file as the argument" && exit 1 +fi + +file=$1 + +echo "Output admin cert" +jq -r ".certs.admincert" $file > admin.cert + +echo "Output ca cert" +jq -r ".certs.cacert" $file > ca.cert + +echo "Output intermediate certs" +jq -r ".certs.intermediatecerts" $file > intermediate.cert + +echo "Output adminou cert" +jq -r ".certs.nodeouidentifiercert.adminouidentifiercert" $file > adminou.cert + +echo "Output clientou cert" +jq -r ".certs.nodeouidentifiercert.clientouidentifiercert" $file > clientou.cert + +echo "Output peerou cert" +jq -r ".certs.nodeouidentifiercert.peerouidentifiercert" $file > peerou.cert + +echo "Output ordererou cert" +jq -r ".certs.nodeouidentifiercert.ordererouidentifiercert" $file > ordererou.cert +