Skip to content

Commit

Permalink
[FAB-7798] Update pkcs11 tests to use internal scripts
Browse files Browse the repository at this point in the history
Change-Id: If5a1140b252749e38aa14ba0467f8ecf90062b2e
Signed-off-by: Troy Ronda <[email protected]>
  • Loading branch information
troyronda committed Jan 17, 2018
1 parent 371ea0e commit 28e9a8b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ build-softhsm2-image:
@$(DOCKER_CMD) build --no-cache -q -t "softhsm2-image" \
--build-arg FABRIC_BASE_IMAGE=$(FABRIC_BASE_IMAGE) \
--build-arg FABRIC_BASE_TAG=$(FABRIC_BASE_TAG) \
$(FIXTURE_SOFTHSM2_PATH)
-f $(FIXTURE_SOFTHSM2_PATH)/Dockerfile .

.PHONY: unit-test
unit-test: checks depend populate
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/softhsm2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ FROM ${FABRIC_BASE_IMAGE}:${FABRIC_BASE_TAG}
ENV GOPATH=/opt/gopath \
GOROOT=/opt/go \
GO_VERSION=1.9.2 \
PATH=$PATH:/opt/go/bin:/opt/gopath/bin \
PKCS11_TOOL_URL=github.com/gbolo/go-util/p11tool
PATH=$PATH:/opt/go/bin:/opt/gopath/bin

COPY install-softhsm2.sh /tmp
COPY test/fixtures/softhsm2/install-softhsm2.sh /tmp
COPY scripts/_go/src/pkcs11helper /opt/gopath/src/pkcs11helper
RUN bash /tmp/install-softhsm2.sh
CMD ["/bin/bash"]

5 changes: 4 additions & 1 deletion test/fixtures/softhsm2/install-softhsm2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ apt-get update && \
apt-get install -y --no-install-recommends softhsm2 curl git gcc g++ libtool libltdl-dev && \
mkdir -p /var/lib/softhsm/tokens/ && \
softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 98765432 && \
go get ${PKCS11_TOOL_URL}
go get -u github.com/golang/dep/cmd/dep
cd /opt/gopath/src/pkcs11helper/
dep ensure -vendor-only
go install pkcs11helper/cmd/pkcs11helper
4 changes: 2 additions & 2 deletions test/scripts/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ GO_TAGS="$GO_TAGS $FABRIC_SDKGO_CODELEVEL_TAG"
if [ "$FABRIC_SDK_CLIENT_BCCSP_SECURITY_DEFAULT_PROVIDER" == "PKCS11" ]; then
PKGS="$REPO/test/integration/pkcs11"

cd $GOPATH/src/github.com/gbolo/go-util/p11tool
#cd $GOPATH/src/github.com/gbolo/go-util/p11tool
for i in "${PRIVATE_KEYS[@]}"
do
echo "Importing key : ${GO_SRC}/${i}"
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in ${GO_SRC}/${i} -out private.p8
go run main.go -action import -keyFile private.p8
pkcs11helper -action import -keyFile private.p8
rm -rf private.p8
done

Expand Down

0 comments on commit 28e9a8b

Please sign in to comment.