Hybrid PQ-CP-ABE Library — Version 6.0.0¶
Note
IMPORTANT NOTICE:
- From Version 4.0, this library natively supports and includes Post-Quantum Cryptography (PQC).
- If your project DOES NOT need PQC (to save space, avoid liboqs dependencies, or minimize performance overhead), please download and use Version 3.1 from the Releases page.
Overview¶
Version 6.0.0 introduces CoverCrypt as a third native ABE scheme alongside AC17 and TKN20. This is the main architectural reason for the major-version bump: the previous AC17 and TKN20 schemes remain based on classical pairing/discrete-log assumptions and are not designed to remain secure against a sufficiently large cryptographically relevant quantum computer.
Since Version 4.0, this project has already provided post-quantum authentication through ML-DSA-87 Sign-then-Encrypt. However, adding a post-quantum signature does not make the underlying AC17/TKN20 ABE encryption quantum-resistant. A future quantum adversary capable of breaking the classical ABE layer could still recover the protected symmetric key even if the ML-DSA signature itself remains secure.
CoverCrypt is added in Version 6.0.0 to address that missing confidentiality layer. In its default Hybridized mode, CoverCrypt combines a classical Curve25519 component with ML-KEM-768, bringing post-quantum protection into the ABE/KEM path itself rather than only protecting authenticity.
This gives the library two distinct PQC layers when CoverCrypt Hybridized mode
is used together with --pqc / the PQC APIs:
- ML-KEM-768 protects the key-establishment / ABE encapsulation path against quantum attacks.
- ML-DSA-87 protects ciphertext authenticity and sender authentication against quantum attacks.
AC17 and TKN20 are intentionally retained for compatibility, interoperability,
and deployments that still require the established classical schemes.
CoverCrypt is integrated through a project-owned Rust/C bridge and the existing
C++ scheme abstraction, so applications can opt into the new scheme through the
same public *_with_scheme interfaces instead of adopting a separate runtime
plugin or a second API surface.
Why CoverCrypt Was Added¶
The previous architecture had an important boundary:
- AC17/TKN20 + AES-256-GCM provided fine-grained access control and efficient payload encryption.
- ML-DSA-87 added post-quantum signatures.
- But the ABE key-protection layer itself remained classical.
That distinction matters for long-lived encrypted data and harvest-now-decrypt-later threat models. An attacker can store ciphertext today and attempt to decrypt it in the future once a sufficiently capable quantum computer becomes available. Post-quantum signatures alone do not stop that attack because signatures protect authenticity, not confidentiality.
CoverCrypt fills this gap by allowing the ABE encapsulation layer itself to use ML-KEM-768. The default Hybridized mode keeps a classical component alongside the post-quantum KEM component, providing a transition path that does not rely exclusively on either family of assumptions.
Important
PQC in this project now has two separate roles. ML-DSA-87 provides post-quantum authentication/signatures. CoverCrypt Hybridized/PostQuantum modes provide post-quantum protection for key encapsulation and therefore the confidentiality path. AC17/TKN20 remain classical even when used with ML-DSA-87.
New Feature: Native CoverCrypt Integration¶
Third ABE Scheme¶
- Added
CPABE_SCHEME_COVERCRYPTas the third native scheme alongsideCPABE_SCHEME_AC17andCPABE_SCHEME_TKN20. - Existing public function names and parameters are preserved. Applications
select CoverCrypt through the current
*_with_schemeAPIs. - Decryption continues to recover the scheme from the ciphertext header.
- Existing default functions continue to select AC17 for backward compatibility.
- Keys remain scheme-specific; selecting another scheme does not convert existing keys or ciphertexts.
CoverCrypt Cryptographic Modes¶
The standalone CLI and existing setup APIs accept configuration through:
HCPABE_COVERCRYPT_CONFIG— path to the JSON dimensions configuration.HCPABE_COVERCRYPT_MODE—hybridized(default),post_quantum, orclassic.
The native bridge is built with the Curve25519 provider + ML-KEM-768 and supports Classic, PostQuantum, and Hybridized rights.
Example configuration:
{"dimensions":[{"name":"Department","attributes":["FIN","HR"]},{"name":"Security","attributes":["LOW","TOP"],"hierarchical":true}]}
Native CoverCrypt policies use upstream syntax such as:
Department::FIN && Security::TOP
For compatibility with the existing library interface, bare attributes such as
admin AND it are mapped to the corresponding
<attribute>::present values when the configured dimensions provide them.
CoverCrypt does not translate the TKN20 NOT operator. Unsupported policy
syntax fails explicitly rather than being silently rewritten.
Server integrations can instead pass JSON and mode directly to the public core API. The Vault plugin uses this explicit API and requires no CoverCrypt configuration file or environment variables on the server.
CoverCrypt KEM/DEM Integration¶
The CoverCrypt adapter follows the same byte-oriented hybrid architecture used by the rest of the library:
- CoverCrypt encapsulates a shared KEM secret under the access policy.
- The adapter uses that secret with AES-GCM to protect the supplied random key buffer.
- The shared C++ core derives the payload key and performs AES-256-GCM payload encryption.
- When PQC signing is enabled, ML-DSA-87 remains the optional authentication layer around the existing Sign-then-Encrypt path.
The Rust bridge does not reimplement CoverCrypt cryptographic primitives.
Serialized keys and encapsulations remain opaque CoverCrypt v16 formats.
Rust panics are caught at the C boundary, and Rust-owned output buffers are
zeroized and released through cc_buffer_free.
CoverCrypt Authority Updates¶
Correct User-Key Permissions¶
- Fixed omitted dimensions granting unintended rights in the CoverCrypt
adapter. A key containing only
Department::ITcannot decrypt a ciphertext requiringDepartment::IT && Level::ADMIN. - AND requires all requested attributes across independent dimensions; OR accepts a satisfying alternative. Nested expressions are evaluated by the cryptographic scheme, without a separate plaintext permission filter.
- Hierarchical inheritance is retained. Conflicting values of one dimension in the same AND clause are rejected; use OR for alternatives.
- The bridge uses restricted user-key generation; the upstream native Rust policy API remains available with its original omitted-dimension semantics.
Previously issued keys retain the rights encoded in their key material. Rebuilding does not revoke excessive permissions already issued. Revoking those permissions requires a replacement authority and authorized user keys, with affected data re-encrypted under the replacement public key.
Add Attributes and Dimensions Without Replacing the Authority¶
- Added File and Buffer APIs for
add_attributeandadd_dimension, plus corresponding CLI commands. - Growth modifies the existing access structure and calls upstream
Covercrypt::update_msk, retaining existing secrets instead of running setup again or rotating all keys. - Both updated MSK and PK must be retained. Old user keys keep their existing rights on old ciphertexts and new ciphertexts using those rights; they gain no new attributes automatically.
- New rights require an authorized user key issued from the updated MSK. Existing signing keys can be reused, and existing data need not be re-encrypted merely to add a dimension.
- Hierarchical attribute insertion supports the optional
afterargument. - CLI/File growth writes a separate updated pair and refuses to overwrite existing output files or the input authority.
build/artifacts/linux/main add_dimension --scheme covercrypt keys/demo_msk.key path/to/dimension.json keys/demo-v2
build/artifacts/linux/main add_attribute --scheme covercrypt keys/demo-v2_msk.key Department SALES keys/demo-v3
add_dimension takes one JSON dimension object, whereas setup takes a
dimensions array:
{"name":"E","attributes":["present","absent"],"hierarchical":false}
Explicit JSON APIs and Buffer Performance¶
- Added
hybrid_cpabe_covercrypt_setupBuffer_from_jsonandhybrid_cpabe_covercrypt_add_dimensionBuffer_with_mode. These accept JSON text and mode directly and never read or modify process environment. - The native bridge exports
cc_add_attributeandcc_add_dimension. - Reduced intermediate cloning during access-structure expansion.
- Added
cc_genkey_ephemeralso the stateless Buffer path avoids serializing an updated MSK that its caller would discard. File key generation continues to persist upstream authority/user state. - CoverCrypt's multi-dimensional rights expansion still determines scaling; the optimizations do not change the cryptographic policy model.
The existing Buffer API remains stateless and does not retain the user registry for tracing. This library does not expose tracing operations.
Python Binding¶
- Added
CPABE_SCHEME_COVERCRYPT = 2to the Python binding. - Python tests now exercise AC17, TKN20, and CoverCrypt through the same binding surface.
- CoverCrypt test setup automatically creates the required dimensions
configuration and selects
hybridizedmode. - Python native-library loading uses the canonical project
lib/directory. Windows builds publishlibcpabe_tkn20.dllthere alongside the public native DLL, avoiding a hidden dependency on the build directory.
Build System & Dependency Layout¶
- CoverCrypt is now part of the native dependency build performed by
make deps. - The dependency build covers Crypto++, liboqs, librabe-ffi, CIRCL/TKN20, and CoverCrypt.
- CoverCrypt headers and libraries are normalized under
build/deps/<platform>/includeandbuild/deps/<platform>/lib. - Windows static linking includes the CoverCrypt FFI library in the combined native archive.
- Linux/macOS builds include the CoverCrypt static bridge in the native link path.
make deps -j8also produces a standalone CoverCrypt shared library on Windows, Linux and macOS, with the public FFI header and Windows import library. No dependency-specific Make target is needed.- Core binaries and objects are collected under
build/artifacts/<platform>/; dependency output stays underbuild/deps/<platform>/. Logs, reports, tools and temporary work have separate directories underbuild/. make cleanremoves core/object output;make clean-depsremoves dependency output for the current platform.clean-depsreplacesdeps-clean.- Moved the main public implementation to
src/hybrid-pq-cp-abe.cpp. - Library version metadata comes from the root
VERSIONfile through a generated public version header instead of a hard-coded string. - Added a cross-platform root
configure: the default checks the host toolchain;--installexplicitly installs missing tools. Windows invocation instructions are documented in the repository README. - The repository keeps third-party CoverCrypt source under
vendor/cover_crypt/and the project-owned native bridge underbindings/ffi/covercrypt/.
CoverCrypt and its dependencies retain their upstream licenses. The vendored CoverCrypt source remains under BUSL-1.1; the project-owned bridge remains under the project's Apache-2.0 licensing scope.
Vault Plugin: Linux Build and JSON Authority Management¶
- Removed copied C++ crypto implementations, the duplicate TKN20 Go bridge, private static-library copies and library-sync scripts from the plugin.
- The plugin now consumes the root public headers and current native shared library. Native changes invalidate its CGO build cache automatically.
- Added CoverCrypt to Vault setup, key generation and encryption. Decryption continues to detect the scheme from the ciphertext.
- Fixed Linux shared-library symbol visibility so the embedded TKN20 Go runtime does not collide with the Vault plugin's Go runtime. Dependency archive symbols remain private, and the shared library no longer requests an executable stack.
- Native output buffers are released through the library's
freeBufferAPI.
Run these targets inside Linux with the required dependencies; no distribution is hard-coded and no WSL distribution is selected automatically:
make vault -j8
make test-vault -j8
make clean-vault
Compilation runs on the Linux host. Docker only runs the Vault service for
HTTP integration tests. Plugin output and its shared runtime are collected
under build/artifacts/linux/vault/; clean-vault removes only that directory.
Setup With Client-Supplied JSON¶
vault write abe/setup scheme=covercrypt config_json=@scripts/covercrypt-demo.json mode=hybridized pqc=true
@file reads a file on the client and sends its contents in the request.
Vault stores JSON, mode, MSK/PK and signing keys per mount in a single
seal-wrapped record. No server-side CoverCrypt file, configuration volume mount
or process-wide CoverCrypt environment setting is required.
Add a Dimension Through Vault¶
vault write abe/add_dimension dimension_json='{"name":"E","attributes":["present","absent"],"hierarchical":false}'
vault write abe/genkey scheme=covercrypt attributes="Department::IT Level::ADMIN E::present"
add_dimensionuses the stored authority's mode and returns the updated public key, complete JSON configuration and revision.- Signing keys and existing user rights are retained. New E rights require a newly issued authorized user key.
- Invalid JSON, duplicate dimensions and failed storage commits leave the existing authority unchanged. Keys and configuration are committed together.
- Reloaded backends read the persisted state; separate mounts retain separate configurations and modes.
setupstill creates/replaces an authority; useadd_dimensionfor growth.
The older Vault storage layout remains readable for existing key-generation and signing operations. It did not retain JSON/mode metadata, so growth on a legacy authority is rejected explicitly rather than guessing settings or recreating its master keys. Upgrading does not automatically migrate or replace existing authorities.
Linux Vault Release Artifact¶
- Release CI builds and tests the plugin on its native Linux runner.
- Publishes a separate
vault-plugin-abe_linux_x86_64_v6.0.0.zipcontaining the executable, shared runtime, example JSON, documentation and dependency notices. - The
_linux_filename identifies the platform; the executable inside keeps its standardvault-plugin-abename. - Extracted packages are loaded into a Vault service and tested over HTTP before upload. Docker does not compile the plugin.
- Release publishing requires all four native SDK archives plus the Linux Vault archive, and includes their SHA-256 checksums.
Deploy the plugin and its shared runtime together on a compatible Linux CPU architecture and glibc environment. A Windows client can call the Linux Vault service over HTTP; this release does not package a Windows Vault plugin.
Maintainer Upstream Synchronization¶
- Vendor source remains included in ordinary clones; no submodule checkout is required for consumers.
- Added
vendor/upstreams.jsonandscripts/vendor.pyfor maintainer-side upstream synchronization, local snapshots and Git operations. - Private vendor Git databases live under
.git/vendors/rather than inside the vendored source directories. - Upstream pulls preserve local integration commits, stop for dirty worktrees or conflicts, and do not automatically push changes.
Native Testing¶
make test -j8and its aliasmake tests -j8include native CoverCrypt integration coverage; no scheme-specific Make targets are required.- Vendored upstream Rust unit tests can be run directly with
cargo test --locked --release --manifest-path vendor/cover_crypt/Cargo.toml --lib. - CoverCrypt tests cover Classic, PostQuantum, and Hybridized operation modes.
- The native test suite also covers authority updates through attribute/dimension growth, old/new key compatibility and invalid inputs.
- Added real cryptographic AND/OR regression matrices, including partial attribute sets and nested policies.
- Vault tests cover all three schemes with and without signing, JSON growth in all three CoverCrypt modes, rejected users, tampering, persistence, mount isolation, legacy reads and storage-commit failures.
- Vault package tests also exercise HTTP operations using the extracted release archive without a server-side CoverCrypt configuration file.
Benchmark Suite Consolidation¶
Version 6.0.0 consolidates benchmarking into a single canonical entrypoint:
benchmark/benchmark_full.py
The old duplicated benchmark frontends have been removed. The benchmark now covers:
- AC17, TKN20, and CoverCrypt Setup / KeyGen / Encrypt / Decrypt.
- File I/O versus Buffer API.
- ML-DSA-87 Sign-then-Encrypt overhead.
- Isolated ML-DSA-87 KeyGen / Sign / Verify.
- AES-256-GCM throughput.
- Policy-complexity scaling.
- Payload-size scaling.
- Optional Charm-Crypto AC17 reference measurements.
A focused public benchmark can be generated with:
python benchmark/benchmark_full.py --profile standard --showcase
--showcase keeps the Buffer/PQC/ML-DSA/Charm subset and automatically writes
a publishable snapshot under:
benchmark/published/<YYYY-MM-DD>_<CPU>_<profile>/
Each published snapshot contains:
README.mdreport.mdsummary.csvraw_samples.csvbenchmark_results.jsoncharts/
CPU naming is detected natively across Windows, macOS, and Linux so published benchmark directories use the actual processor model where available.
Compatibility Notes¶
- The existing AC17 and TKN20 public APIs remain unchanged.
- Existing default calls continue to use AC17.
- AC17 and TKN20 remain classical pairing/discrete-log based ABE schemes.
- CoverCrypt Hybridized mode adds ML-KEM-768 to its ABE KEM path.
- ML-DSA-87 remains an optional signature layer and is independent of whether CoverCrypt itself is running in Classic, PostQuantum, or Hybridized mode.
- CoverCrypt keys and ciphertexts are not interchangeable with AC17 or TKN20.
- TKN20
NOTpolicy syntax remains specific to TKN20.
Migration¶
Existing AC17/TKN20 applications do not need API changes.
To opt into CoverCrypt:
- Build dependencies with
make deps. - Provide
HCPABE_COVERCRYPT_CONFIG. - Optionally select
HCPABE_COVERCRYPT_MODE. - Select
CPABE_SCHEME_COVERCRYPTin the existing scheme-aware API.
No automatic migration of existing AC17/TKN20 keys or ciphertexts is performed.
For Vault, build with make vault on Linux and pass config_json and mode
through the setup endpoint instead of configuring a server environment file.
Do not call setup merely to extend an existing authority: use add_dimension
and retain the returned updated public key.