opensc/src/tests/p11test
Frank Morgner fa35be5859 fixed 347857 Resource leak 2019-11-05 21:49:30 +01:00
..
Makefile.am added fuzzing with libFuzzer and OSS-Fuzz 2019-07-26 15:23:02 +02:00
Makefile.mak PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
README.md Adjust the p11test readme after merge 2018-07-04 09:46:43 +02:00
cert.cfg PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test.c Fix build on ARM, PPC 2019-11-01 15:51:06 +01:00
p11test.supp PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_common.c fixed 347857 Resource leak 2019-11-05 21:49:30 +01:00
p11test_case_common.h p11test: Avoid possible issues reported by coverity 2019-08-20 13:28:54 +02:00
p11test_case_ec_derive.c p11test: Implement simple derive tests 2019-06-17 12:49:11 +02:00
p11test_case_ec_derive.h p11test: Implement simple derive tests 2019-06-17 12:49:11 +02:00
p11test_case_ec_sign.c PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_ec_sign.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_mechs.c p11test: Implement simple derive tests 2019-06-17 12:49:11 +02:00
p11test_case_mechs.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_multipart.c p11test: Do not report and try pairs without private key 2018-12-18 14:50:08 +01:00
p11test_case_multipart.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_pss_oaep.c p11test: Do not report incomplete key pairs 2018-11-05 09:15:20 +01:00
p11test_case_pss_oaep.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_readonly.c p11test: Avoid possible issues reported by coverity 2019-08-20 13:28:54 +02:00
p11test_case_readonly.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_usage.c p11test: Do not report usage on incomplete keys 2018-12-18 14:50:08 +01:00
p11test_case_usage.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_wait.c PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_wait.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_common.h p11test: Implement simple derive tests 2019-06-17 12:49:11 +02:00
p11test_helpers.c p11test: Avoid possible issues reported by coverity 2019-08-20 13:28:54 +02:00
p11test_helpers.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_loader.c PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_loader.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
runtest.sh PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00

README.md

Non-destructive PKCS#11 test suite (not only for readonly cards)

What are the dependencies?

In addition to the dependencies needed by OpenSC, the test suite is using cmocka unit testing framework (libcmocka-devel package in Fedora/EPEL).

How to use?

Build OpenSC from source:

git clone git@github.com:OpenSC/OpenSC.git
cd OpenSC
./bootstrap
./configure
make -j4

Plug in the card/reader, change to test directory and run the test:

cd src/tests/p11test
./p11test -p 123456

It will run all tests on the first card found in PKCS#11 API with pin 123456 and using just built OpenSC shared library from master.

I have more slots with different cards.

Slot can be selected using -s switch on command-line.

./p11test -s 4

Slot numbers can be obtained using from pkcs11-tool -L (note that different libraries might have different numbers for the slots).

I want to test different pkcs11 library

You can specify different library or build from different branch on command-line:

./p11test -m /usr/lib64/pkcs11/libcoolkeypk11.so

or to debug PKCS#11 calls using /usr/lib64/pkcs11-spy.so:

export PKCS11SPY="../pkcs11/.libs/opensc-pkcs11.so"
./p11test -m ../pkcs11/.libs/pkcs11-spy.so

You can run the test suite also on the soft tokens. The testbench for softhsm and opencryptoki is available in the script runtest.sh.

TODO:

  • Test CKM_ECDSA_DERIVE mechanism(s)
  • Read pin from environment variable?
  • Keygen write tests (optional)
  • Reflect cmocka dependency in the configure