diff --git a/npa/Makefile.am b/npa/Makefile.am index 8870bc1..871599e 100644 --- a/npa/Makefile.am +++ b/npa/Makefile.am @@ -1,7 +1,7 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src m4 doc win32 -EXTRA_DIST = libnpa.pc.in apdus +EXTRA_DIST = libnpa.pc.in apdus test_vicc_with_npa.sh do_subst = $(SED) \ -e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g' \ diff --git a/npa/test_vicc_with_npa-tool.sh b/npa/test_vicc_with_npa-tool.sh new file mode 100755 index 0000000..4e71be6 --- /dev/null +++ b/npa/test_vicc_with_npa-tool.sh @@ -0,0 +1,89 @@ +#! /bin/sh + +ECDH_CAR=DECVCAAT00001 +DH_CAR=DETESTCVCA00003 + +CVCA=cvca.cvcert +DVCA=dvca.cvcert +TERMINAL=at.cvcert +TERM_KEY=at_key.pkcs8 + +ACCESS=ef_cardaccess +SECURITY=ef_cardsecurity +NPA_KEY=npa_key + +if test -z "$DATA" +then + DATA=../virtualsmartcard/npa-example-data +fi + +if test -z "$VICC" +then + if test -r ../virtualsmartcard/src/vpicc/vicc.in -a -n "`which python`" + then + VICC="python ../virtualsmartcard/src/vpicc/vicc.in" + elif test -x ../virtualsmartcard/src/vpicc/vicc + then + VICC=../virtualsmartcard/src/vpicc/vicc + elif test -n "`which vicc`" + then + VICC=VICC + else + echo "vicc not found" + exit 1 + fi +fi + +if test -z "$NPA_TOOL" +then + if test -x ../npa/src/npa-tool + then + NPA_TOOL=../npa/src/npa-tool + elif test -n "`which npa-tool`" + then + NPA_TOOL=npa-tool + else + echo "npa-tool not found" + exit 1 + fi +fi + +for KA in ecdh dh +do + CAR= + if test $KA = ecdh + then + CAR=$ECDH_CAR + elif test $KA = dh + then + CAR=$DH_CAR + else + echo "CAR not found" + exit 1 + fi + + $VICC --type nPA --ef-cardsecurity=$DATA/$KA/$SECURITY \ + --ef-cardaccess=$DATA/$KA/$ACCESS --ca-key=$DATA/$KA/$NPA_KEY \ + --car=$CAR --cvca=$DATA/$KA/$CVCA --disable-checks & + VICC_PID=$! + if test $? -ne 0 + then + echo "could not start vicc" + exit 1 + fi + + sleep 1 + + $NPA_TOOL --pin=111111 --private-key=$DATA/$KA/$TERM_KEY \ + --cv-certificate=$DATA/$KA/$DVCA,$DATA/$KA/$TERMINAL \ + --chat=7f4c12060904007f00070301020253050000000000 --disable-checks + NPA_RESULT=$? + + kill $VICC_PID 2>/dev/null + + if test $NPA_RESULT -ne 0 + then + echo "could not perform EAC" + exit 1 + fi +done diff --git a/virtualsmartcard/Makefile.am b/virtualsmartcard/Makefile.am index 19e3dbf..5054d9f 100644 --- a/virtualsmartcard/Makefile.am +++ b/virtualsmartcard/Makefile.am @@ -1,6 +1,8 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src doc +EXTRA_DIST = test_vicc_with_npa-tool.sh + distcheck-hook: test -d .svn && \ svn2cl --group-by-day --reparagraph --separate-daylogs --include-actions --include-rev || true diff --git a/virtualsmartcard/test_vicc_with_npa-tool.sh b/virtualsmartcard/test_vicc_with_npa-tool.sh new file mode 120000 index 0000000..8d11cfa --- /dev/null +++ b/virtualsmartcard/test_vicc_with_npa-tool.sh @@ -0,0 +1 @@ +../npa/test_vicc_with_npa-tool.sh \ No newline at end of file