opensc/src/tests/p11test
Jakub Jelen ffd6e2a576 p11test: Expect DERIVE to be set on both private and public key
Basically reverts part of 485b6cf, which turned out to be wrong.

Alternative to #2292
2021-05-31 15:36:29 +02:00
..
Makefile.am p11test: Basic test for C_GetInterface API from PKCS#11 3.0 2021-01-11 14:49:22 +01: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 p11test: Basic test for C_GetInterface API from PKCS#11 3.0 2021-01-11 14:49:22 +01:00
p11test.supp PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_common.c p11test: Fix one-off comparison 2021-03-01 15:43:28 +01:00
p11test_case_common.h p11test: Add support for EdDSA keys 2021-03-01 15:42:29 +01:00
p11test_case_ec_derive.c p11test: Add support for EdDSA keys 2021-03-01 15:42:29 +01:00
p11test_case_ec_derive.h p11test: Implement simple derive tests 2019-06-17 12:49:11 +02:00
p11test_case_ec_sign.c p11test: Properly finalize the ec_sign test 2020-01-21 22:35:21 +01:00
p11test_case_ec_sign.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_interface.c p11test: Basic test for C_GetInterface API from PKCS#11 3.0 2021-01-11 14:49:22 +01:00
p11test_case_interface.h p11test: Basic test for C_GetInterface API from PKCS#11 3.0 2021-01-11 14:49:22 +01:00
p11test_case_mechs.c p11test: Add support for EdDSA keys 2021-03-01 15:42:29 +01:00
p11test_case_mechs.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_multipart.c p11test: Add support for EdDSA keys 2021-03-01 15:42:29 +01:00
p11test_case_multipart.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_pss_oaep.c spelling fixes 2020-08-30 10:35:14 +02:00
p11test_case_pss_oaep.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_readonly.c p11test: Add support for EdDSA keys 2021-03-01 15:42:29 +01:00
p11test_case_readonly.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
p11test_case_usage.c p11test: Expect DERIVE to be set on both private and public key 2021-05-31 15:36:29 +02: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: Add support for EdDSA keys 2021-03-01 15:42:29 +01: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 p11test: Basic test for C_GetInterface API from PKCS#11 3.0 2021-01-11 14:49:22 +01:00
p11test_loader.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
runtest.sh p11test: Reformat the script and allow running against softhsm ed25519 keys (with few tweaks) 2021-03-01 15:43:28 +01: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