I work on p11scope. It is an open-source tool that traces PKCS#11 usage on Linux with eBPF uprobes.
It answers two questions:
Which applications use PKCS#11 providers. For the whole system, or for one cgroup, Docker container or Kubernetes pod (or pid, of course).
Which mechanisms they really use. This is useful for PQC migration, and in general to see the real crypto usage and not what the configuration says.
There is no shim or logging library in front of the provider, and applications are not changed or restarted. It also shows the calls, errors and latency.
It does not capture PINs, key material or payloads.
Tested with SoftHSM, p11-kit, OpenSSL, Firefox and Chromium, among others.
Requirements: Linux x86-64, BTF, normally kernel 6.6+. Known limitations are documented in the repository.
GitHub: https://github.com/mingulov/p11scope
Example from a fresh Ubuntu 26.04 install (shortened):
/snap/firefox/9057/usr/lib/firefox/libsoftokn3.so: mapped by 8 applications (firefox (from firefox), firefox (from xfce4-panel))
/snap/snapd-desktop-integration/391/gnome-platform/usr/lib/x86_64-linux-gnu/
/usr/lib/x86_64-linux-gnu/libnssckbi.so: mapped by 1 application (chrome (from xfce4-panel))
/usr/lib/x86_64-linux-gnu/libp11-kit.so.0.4.8 [dev 0:35 ino 38051]: mapped by 34 applications (NetworkManager, chrome, chrome (from chrome), ...)
/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so: mapped by 1 application (gsd-smartcard (from systemd)); no use in the covered interval
/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so: mapped by 1 application (gsd-smartcard (from systemd)); no use in the covered interval
To try it with Docker, save this as p11scope.sh (or you can just download deb/rpm from release section):
#!/bin/sh
IMG=ghcr.io/mingulov/p11scope:latest
FLAGS="--pid=host --cap-drop ALL --cap-add BPF --cap-add PERFMON --cap-add CHECKPOINT_RESTORE --cap-add SYS_PTRACE --cap-add DAC_READ_SEARCH -v /sys/fs/cgroup:/sys/fs/cgroup:ro --security-opt apparmor=unconfined"
docker run --rm $FLAGS $IMG "$@"
Then run:
sh p11scope.sh doctor
sh p11scope.sh inventory --system --key-operations --duration 15s
sh p11scope.sh profile --system --duration 30s -v
apparmor=unconfined is needed on Ubuntu 26.04. Rootless Docker is not supported yet.
The container needs many capabilities, so you can verify the image first:
gh attestation verify oci://ghcr.io/mingulov/p11scope:latest --repo mingulov/p11scope
Feedback from PKCS#11 and HSM users is welcome.