Background
Post-quantum cryptography (PQC) refers to algorithms designed to resist attacks from quantum computers. Classical algorithms such as RSA and ECDSA rely on the hardness of integer factorization and discrete logarithms — problems that Shor’s algorithm can solve efficiently on a sufficiently large quantum computer. Dilithium (CRYSTALS-Dilithium) is a lattice-based digital signature scheme standardized by NIST as ML-DSA (FIPS 204). It is the target PQC algorithm for HSM Work’s signing pipeline.liboqs
liboqs is an open-source C library from the Open Quantum Safe project. It provides implementations of NIST-selected post-quantum algorithms including Dilithium, Kyber, and others.On Debian/Ubuntu you can install liboqs from source. The library is not currently available in standard package repositories. Follow the liboqs build instructions to compile and install it before building any PQC-dependent components.
liboqs_test
Theliboqs_test/ directory contains a minimal version check program that confirms liboqs is installed and accessible:
Build with CMake
ACMakeLists.txt is provided in liboqs_test/. Build and run:
PQC in pkcs11-daemon
Thepkcs11-daemon includes a stub for PQC key generation in pkcs11-daemon/crypto.h:
Vault entry
Despite the stub, the daemon still writes adefault-pq entry to vault.db at startup:
type = "dilithium" and an empty data field. Once pqc_generate() is implemented, it will write real Dilithium key material to this entry without requiring changes to the surrounding daemon code.
Roadmap
The planned integration path is:- Implement
Crypto::pqc_generate()usingOQS_SIG_new(OQS_SIG_alg_dilithium_3)from liboqs - Return the generated Dilithium key pair serialized to a string
- Store the key material in
vault.dbunderdefault-pq - Add a corresponding
Crypto::pqc_sign()/Crypto::pqc_verify()interface for signing operations
liboqs_test program confirms the library is available; passing it is a prerequisite before implementing step 1.