Skip to content

Hybrid PQ-CP-ABE Library — Version 6.0.1

Overview

Version 6.0.1 adds a WebAssembly SDK built on Linux for browser and Node.js applications. It exposes the public C API through an Emscripten module and supports AC17, TKN20, and CoverCrypt, including CoverCrypt with ML-KEM-768, AES-GCM encryption, and optional ML-DSA-87 signing and verification. It also introduces installable Python bindings with platform-specific wheels, a full 33-export native self-test, and an opt-in PyPI publishing workflow.

New Feature: WebAssembly SDK

  • File and buffer APIs support setup, key generation, encryption, and decryption for all three ABE schemes. File APIs use an in-memory filesystem.
  • Import lib/wasm/loader.mjs to initialize the library and the Go runtime for TKN20. Keep the five JavaScript and WebAssembly runtime files together.
  • The SDK includes public headers and libhybrid-pq-cp-abe.a for Emscripten C and C++ applications. The CLI entry point is available through callMain.

Build System & Release Artifacts

Build and test from source on Linux with Emscripten 7.0+, Rust nightly with rust-src, and Go. See the WASM build guide for toolchain setup and integration examples.

make wasm -j8
make wasm-test -j8
  • The release includes libhybrid-pq-cp-abe_wasm_v6.0.1.zip alongside the four native SDK archives and the Linux Vault plugin archive.
  • The WASM ZIP contains the runtime files, static archive, public headers, documentation, and dependency notices. Its checksum is listed in SHA256SUMS.txt.
  • Release CI runs the Node.js smoke suite against the extracted ZIP. It covers all three schemes, file and buffer round trips, policy denial, ML-DSA-87 signing and verification, and rejection of modified ciphertext.

Usage

Extract the ZIP and import the loader from the package directory:

import createHybridCPABE from './lib/wasm/loader.mjs';

const abe = await createHybridCPABE();
console.log(abe.ccall('getVersion', 'string', [], []));

In a browser, serve the runtime files over HTTP(S) from a secure context such as HTTPS or localhost. Use abe.FS.writeFile and abe.FS.readFile to transfer data through the file API.

New Feature: Python SDK and PyPI Wheels

Version 6.0.1 also adds the distributable Python bindings under bindings/python/. The PyPI distribution is pq-cp-abe and the import name is pq_cp_abe (Python 3.10+). It wraps the public native C ABI with ctypes and exposes all 33 exported symbols from the v6.0.1 native library, along with higher-level Python helpers.

Install and Download

After the Python wheels are published to PyPI, install the appropriate platform wheel automatically with:

python -m pip install pq-cp-abe==6.0.1

The package page is pq-cp-abe on PyPI. PyPI installation is available only after the separate Python publishing workflow succeeds. The native v6.0.1 GitHub Release ZIPs are not themselves Python wheels.

Before PyPI publishing, run the GitHub Actions Build Python Wheels workflow with publish=false. Download the python-wheel-<platform>-<arch> artifact for your operating system after that job succeeds, extract its .whl file, and install it with:

python -m pip install ./pq_cp_abe-6.0.1-py3-none-win_amd64.whl

The filename above is the Windows x64 example; substitute the actual downloaded wheel filename for Linux or macOS. Select a wheel compatible with your operating system and CPU architecture. The Python CI matrix builds four separate wheels:

Operating system Architecture Bundled native runtime
Windows x86_64 (AMD64) libhybrid-pq-cp-abe.dll + libcpabe_tkn20.dll
Linux x86_64 libhybrid-pq-cp-abe.so
macOS (Intel) x86_64 libhybrid-pq-cp-abe.dylib
macOS (Apple Silicon) arm64 libhybrid-pq-cp-abe.dylib

These wheels carry the native libraries; users do not need to compile C++, Rust, or Go to install a compatible wheel. Linux wheels undergo auditwheel repair, and macOS wheels undergo delocate dependency processing. Each platform's wheel must pass isolated installation/runtime checks before it can be published.

Python API Examples

Import the package and confirm the installed library version:

import pq_cp_abe as abe

print(abe.__version__)
print(abe.get_version())

Use the native ABE schemes through the existing Python wrappers:

import pq_cp_abe as abe

# Choose AC17, TKN20, or CoverCrypt.
scheme = abe.CPABE_SCHEME_AC17
public_key, master_key = abe.setup_buffer(scheme)
user_key = abe.genkey_buffer(master_key, "admin it", scheme)
ciphertext = abe.call_hybrid_cpabe_encryptBuffer_with_scheme(
    public_key, b"Hello from Python", "admin and it", scheme
)
plaintext = abe.call_hybrid_cpabe_decryptBuffer(user_key, ciphertext)
assert plaintext == b"Hello from Python"

For CoverCrypt, select abe.CPABE_SCHEME_COVERCRYPT and provide a dimensions configuration through HCPABE_COVERCRYPT_CONFIG where required. HCPABE_COVERCRYPT_MODE accepts classic, post_quantum, or hybridized (the default). The CoverCrypt hybridized configuration uses Curve25519 with ML-KEM-768 for the ABE/KEM confidentiality path; AC17/TKN20 remain classical schemes.

The SDK also exposes aes_gcm_encrypt / aes_gcm_decrypt, ml_dsa_87_generate_keypair / ml_dsa_87_sign / ml_dsa_87_verify, and CoverCrypt authority-growth APIs to add attributes or dimensions using either files or memory buffers. Advanced consumers can access the fully typed, low-level C functions through abe.native; buffers allocated by the C library must be released using freeBuffer.

Python Self-Test

Test the installed wheel without a separate native build:

python -m pq_cp_abe --test

When working directly from a repository checkout, the compatible entrypoint is also available:

python bindings/python/hybrid_pq_cp_abe.py --test

The self-test runs in a temporary directory, exercises all 33 native exports and checks AC17/TKN20/CoverCrypt file and buffer operations, AES-GCM, ML-DSA-87, signed ciphertext and CoverCrypt authority updates. A successful run reports 33/33 C symbols actually invoked and exits with code 0; failures return a non-zero exit code.

Wheel Build and Publishing

The separate publish-pypi.yml workflow uses the repository-root VERSION file to select the exact GitHub Release tag. It downloads the native archives, verifies each release ZIP against SHA256SUMS.txt, stages the platform libraries, builds a Python wheel and tests it independently of the source tree. Version metadata is derived from VERSION, not hard-coded in the Python package.

  • publish=false builds and tests wheel artifacts only.
  • publish=true publishes the verified wheels to PyPI after all four platform jobs succeed, using PyPI Trusted Publishing (GitHub OIDC). The pypi GitHub environment and PyPI Trusted Publisher must be configured beforehand; no PyPI API token is stored in the workflow.

This Python distribution workflow is independent from the existing native library release process. See the Python SDK README for further details.