-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-6932] Unstage key variation test
When Change 16085 - Merged [FAB-6932] Unmarshal key request object correctly the keys test should have been re-enabled Change-Id: Ied91ff56be1bc2f520c6adee5908b875f16f4247 Signed-off-by: Allen Bailey <[email protected]>
- Loading branch information
Showing
8 changed files
with
42 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright IBM Corp. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
FABRIC_CA="$GOPATH/src/github.com/hyperledger/fabric-ca" | ||
FABRIC_CAEXEC="$FABRIC_CA/bin/fabric-ca" | ||
TESTDATA="$FABRIC_CA/testdata" | ||
SCRIPTDIR="$FABRIC_CA/scripts/fvt" | ||
. $SCRIPTDIR/fabric-ca_utils | ||
HOST="http://localhost:$PROXY_PORT" | ||
RC=0 | ||
$($FABRIC_TLS) && HOST="https://localhost:$PROXY_PORT" | ||
|
||
while getopts "du:p:t:l:x:" option; do | ||
case "$option" in | ||
d) FABRIC_CA_DEBUG="true" ;; | ||
x) CA_CFG_PATH="$OPTARG" ;; | ||
u) USERNAME="$OPTARG" ;; | ||
p) USERPSWD="$OPTARG" | ||
test -z "$USERPSWD" && AUTH=false | ||
;; | ||
p) USERPSWD="$OPTARG" ;; | ||
t) KEYTYPE="$OPTARG" ;; | ||
l) KEYLEN="$OPTARG" ;; | ||
esac | ||
done | ||
test -z "$CA_CFG_PATH" && CA_CFG_PATH="$HOME/fabric-ca" | ||
test -z "$CLIENTCERT" && CLIENTCERT="$CA_CFG_PATH/cert.pem" | ||
test -z "$CLIENTKEY" && CLIENTKEY="$CA_CFG_PATH/key.pem" | ||
test -f "$CA_CFG_PATH" || mkdir -p $CA_CFG_PATH | ||
|
||
: ${FABRIC_CA_DEBUG="false"} | ||
: ${AUTH="true"} | ||
: ${USERNAME="admin"} | ||
: ${USERPSWD="adminpw"} | ||
$($AUTH) || unset USERPSWD | ||
: ${KEYTYPE="ecdsa"} | ||
: ${KEYLEN="256"} | ||
|
||
test "$KEYTYPE" = "ecdsa" && sslcmd="ec" | ||
|
||
genClientConfig "$CA_CFG_PATH/client-config.json" | ||
$FABRIC_CAEXEC client enroll "$USERNAME" "$USERPSWD" "$HOST" <(echo "{ | ||
\"hosts\": [ | ||
\"[email protected]\", | ||
\"fab-client.raleigh.ibm.com\", | ||
\"127.0.0.2\" | ||
], | ||
\"CN\": \"$USERNAME\", | ||
\"key\": { | ||
\"algo\": \"$KEYTYPE\", | ||
\"size\": $KEYLEN | ||
}, | ||
\"names\": [ | ||
{ | ||
\"SerialNumber\": \"$USERNAME\", | ||
\"O\": \"Hyperledger\", | ||
\"O\": \"Fabric\", | ||
\"OU\": \"FABRIC_CA\", | ||
\"OU\": \"FVT\", | ||
\"STREET\": \"Miami Blvd.\", | ||
\"DC\": \"peer\", | ||
\"UID\": \"admin\", | ||
\"L\": \"Raleigh\", | ||
\"L\": \"RTP\", | ||
\"ST\": \"North Carolina\", | ||
\"C\": \"US\" | ||
} | ||
] | ||
}") | ||
test -d "$CA_CFG_PATH/$USERNAME" || mkdir -p $CA_CFG_PATH/$USERNAME | ||
cat > $CA_CFG_PATH/$USERNAME/fabric-ca-client-config.yaml <<EOF | ||
csr: | ||
cn: $USERNAME | ||
keyrequest: | ||
algo: $KEYTYPE | ||
size: $KEYLEN | ||
EOF | ||
|
||
$FABRIC_CA_CLIENTEXEC enroll -u "http://$USERNAME:$USERPSWD@$CA_HOST_ADDRESS:$PROXY_PORT" -H $CA_CFG_PATH/$USERNAME | ||
RC=$? | ||
$($FABRIC_CA_DEBUG) && printAuth $CLIENTCERT $CLIENTKEY | ||
CLIENTCERT="$CA_CFG_PATH/$USERNAME/msp/signcerts/cert.pem" | ||
lastkey=$(ls -crtd $CA_CFG_PATH/$USERNAME/msp/keystore/* | tail -n1) | ||
test -n "$lastkey" && CLIENTKEY="$lastkey" || CLIENTKEY="$CA_CFG_PATH/$USERNAME/msp/keystore/key.pem" | ||
$($FABRIC_CA_DEBUG) && printAuth "$CLIENTCERT" "$CLIENTKEY" | ||
exit $RC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters