Add initialization test script with pkcs11

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2023-09-24 10:30:59 +02:00
parent 08e7d74a81
commit d906df2809
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3
4 changed files with 18 additions and 10 deletions

@ -1 +1 @@
Subproject commit 910b2fb75a2ce2c6660fe70334c24c9407910a1a
Subproject commit 30a2707dd89ec6c677415171f7e46521689b5b76

View file

@ -15,12 +15,21 @@ RUN apt install -y libccid \
gcc \
make \
build-essential \
opensc \
python3 \
python3-pip \
swig \
libssl-dev \
cmake \
vsmartcard-vpcd \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install pytest pycvc cryptography pyscard base58
WORKDIR /
RUN git clone https://github.com/OpenSC/OpenSC
WORKDIR /OpenSC
#RUN git checkout tags/0.23.0
RUN ./bootstrap
RUN ./configure --enable-openssl
RUN make -j `nproc`
RUN make install
RUN ldconfig
WORKDIR /

View file

@ -1,4 +1,4 @@
#!/bin/bash -eu
#!/bin/bash
python3 tools/pico-hsm-tool.py --pin 648219 initialize --so-pin 57621880 --silent
test $? -eq 0 || exit $?
@ -40,5 +40,5 @@ grep -q CKR_PIN_LOCKED <<< $e || exit $?
pkcs11-tool --login --login-type so --so-pin 3537363231383830 --init-pin --new-pin 648219
test $? -eq 0 || exit $?
pkcs11-tool --login --pin 648219 -I > /dev/null
pkcs11-tool --login --pin 648219 -I
test $? -eq 0 || exit $?

View file

@ -1,4 +1,4 @@
#!/bin/bash -eu
#!/bin/bash
rm -rf pypicohsm
git clone https://github.com/polhenarejos/pypicohsm.git
@ -7,12 +7,11 @@ pip3 install -e pypicohsm
sleep 2
rm -f memory.flash
tar -xf tests/memory.tar.gz
./build_in_docker/pico_hsm > /dev/null &
#pytest tests -W ignore::DeprecationWarning
./build_in_docker/pico_hsm > /dev/null 2>&1 &
pytest tests -W ignore::DeprecationWarning
chmod a+x tests/scripts/*.sh
echo -n "Test initialization... "
./tests/scripts/initialize.sh
echo "\tok"
./tests/scripts/initialize.sh > /dev/null 2>&1
test $? -eq 0 && echo -e '\tok' || (echo -e '\tfail' && exit 1)