Command-line usage¶
Run a prebuilt CLI on Windows¶
An extracted Windows SDK already contains the compiled CLI in bin/. Running
it does not require MSVC, cl.exe or a Native Tools terminal. From the
extracted SDK root, choose your ordinary shell:
CMD
bin\pq-cp-abe.exe --help
PowerShell
.\bin\pq-cp-abe.exe --help
Git Bash
./bin/pq-cp-abe.exe --help
Keep the bundled runtime DLLs in bin/ beside the CLI and ensure the Microsoft
Visual C++ x64 runtime is available. Add bin/ to PATH if you want to invoke
pq-cp-abe outside that directory. The developer-shell requirement in the
source-build guide applies to building and linking software, not to
running these commands.
Command reference¶
Use ./bin/pq-cp-abe from an extracted Unix release or .\bin\pq-cp-abe.exe
on Windows. Add the release's bin directory to PATH to run pq-cp-abe
from any directory. Run pq-cp-abe --help for an overview or
pq-cp-abe encrypt --help for one command's arguments.
To install from source, run make install in the repository using the native
build toolchain.
- Linux and macOS install to
/usr/local/binby default. For a user-local install, runmake install PREFIX="$HOME/.local"and add$HOME/.local/bintoPATH. UseDESTDIRto stage a package without installing into the live system. - Windows installs to
%LOCALAPPDATA%\Programs\pq-cp-abeby default, with the CLI and runtime DLLs inbin/, public headers ininclude/, and native libraries inlib/. It addsbin/to User PATH. Runmake install PREFIX="C:/path/to/prefix"to choose another prefix, ormake install UPDATE_PATH=0to stage files without changing User PATH. Open a new terminal after updating User PATH.
On Windows, compiling your own application with MSVC requires an initialized x64 developer shell (for example, x64 Native Tools CMD). This is a separate step from running the prebuilt CLI. Use the installed SDK paths when linking:
cl /I"%LOCALAPPDATA%\Programs\pq-cp-abe\include" /c app.cpp
cl app.obj /link /LIBPATH:"%LOCALAPPDATA%\Programs\pq-cp-abe\lib" ^
libhybrid-pq-cp-abe.lib libcircl_ffi.lib bcrypt.lib advapi32.lib ntdll.lib userenv.lib ws2_32.lib
The static library includes the project and bundled native dependencies;
libcircl_ffi.lib links the CIRCL runtime DLL used by TKN20 and Ed448. The shared-library import library is
libhybrid-pq-cp-abe_dll.lib; its DLL is installed in bin/. libcpabe_tkn20.lib and
libcpabe_tkn20.dll are also installed as v6.1 compatibility aliases.
Usage: pq-cp-abe <command> [options] [arguments]
Usage: pq-cp-abe setup [--scheme <name>] <path_to_save_file>
Usage: pq-cp-abe genkey [--scheme <name>] <master_key_file> <attributes> <private_key_file>
Usage: pq-cp-abe encrypt [--scheme <name>] <public_key_file> [pqc_private_key] <plaintext_file> <policy> <ciphertext_file>
Usage: pq-cp-abe decrypt <private_key_file> [pqc_public_key] <ciphertext_file> <recovertext_file>
Example commands (Standard Mode):
mkdir -p test_case
printf '%s\n' 'Example plaintext' > test_case/plaintext.txt
pq-cp-abe setup --scheme tkn20 test_case
pq-cp-abe genkey --scheme tkn20 "test_case/cpabe_msk.key" "A B C" "test_case/cpabe_sk.key"
pq-cp-abe encrypt --scheme tkn20 "test_case/cpabe_pk.key" "test_case/plaintext.txt" "((A and C) or E)" "test_case/ciphertext.txt"
pq-cp-abe decrypt "test_case/cpabe_sk.key" "test_case/ciphertext.txt" "test_case/recovertext.txt"
CoverCrypt with ML-DSA signatures¶
CoverCrypt uses ML-KEM-768 for key encapsulation in its hybridized (default)
and post_quantum modes. The optional ML-DSA signature flow works with CoverCrypt,
AC17, and TKN20. Architecture and scheme guide
setup --with-signing-keyscreates an ML-DSA key pair alongside the ABE keys. The signing and verification files are namedml-dsa_sk.keyandml-dsa_pk.keyinside an output directory, ordemo_ml-dsa_sk.keyanddemo_ml-dsa_pk.keywith a prefix such asdemo.encrypt --signsigns the data before encrypting it. Pass the secret signing key with--signing-key.decrypt --verifyrequires a valid signature before returning plaintext. Pass the public verification key with--verification-key.
ML-DSA-87 is the default. To use set 44 or 65, pass the same --ml-dsa value to
setup and encryption. Decryption detects the set from the ciphertext. Existing
scripts can continue to use --pqc as an alias for the signature action of each
command. Setup with only the legacy flag keeps the pqc_sk.key and pqc_pk.key
names.
export HCPABE_COVERCRYPT_CONFIG="$PWD/scripts/covercrypt-demo.json"
printf '%s\n' 'Example plaintext' > data.txt
pq-cp-abe --setup --scheme covercrypt --with-signing-keys --ml-dsa 87 --file demo
pq-cp-abe --genkey --scheme covercrypt --master-key demo_msk.key \
--attributes "Department::IT && Level::ADMIN" --user-key user.key
pq-cp-abe --encrypt --scheme covercrypt --sign --public-key demo_pk.key \
--signing-key demo_ml-dsa_sk.key --file data.txt \
--policy "Department::IT && Level::ADMIN" --ciphertext data.enc
pq-cp-abe --decrypt --verify --user-key user.key \
--verification-key demo_ml-dsa_pk.key --ciphertext data.enc --output recovered.txt
Embedded document-signature commands¶
The native CLI, Python CLI and Node/WASM CLI use the same command names for the new embedded-signature workflows. PDF is the first supported document adapter; pass --format pdf explicitly when scripting for future format compatibility.
pq-cp-abe signature_keygen mldsa65-ed25519 signing.key signing.pub
pq-cp-abe signature_csr signing.key "CN=User" user.csr
pq-cp-abe signature_cert --valid-days 365 signing.key "CN=User" user.der
pq-cp-abe document_sign signing.key user.der input.pdf signed.pdf
pq-cp-abe document_verify user.der signed.pdf
pq-cp-abe document_encrypt --scheme ac17 cpabe_pk.key signing.key user.der input.pdf "admin and it" document.ct
pq-cp-abe document_decrypt user.key user.der document.ct recovered.pdf
pq-cp-abe ciphertext_sign --metadata request-123 signing.key document.ct document.env
pq-cp-abe ciphertext_verify --metadata request-123 mldsa65-ed25519 signing.pub document.env recovered.ct
Supported signature selectors are mldsa44, mldsa65, mldsa87, mldsa44-ed25519, mldsa65-ed25519, mldsa87-ed448 and mldsa87-ecdsa-p384. Advanced commands are document_countersign for the trusted-server decrypt/verify/countersign/re-encrypt flow and document_migrate for converting a verified legacy signed ciphertext into a newly embedded document signature.
Verification accepts --index N, --at UNIX_SECONDS and --allow-old-revision. The certificate supplied to document_verify is pinned explicitly; the CLI does not perform network revocation lookup. signature_cert is a self-signed convenience command, not a production CA/PKIX enrollment service. Signing-key exports are unencrypted SDK expanded-key data and must be protected as secrets. Applications using ciphertext_sign remain responsible for nonce/request-id storage and replay prevention.