Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

PQ-CP-ABE for Python

Python SDK for native Ciphertext-Policy Attribute-Based Encryption (CP-ABE) with post-quantum cryptography support. It combines AC17, TKN20, or CoverCrypt with AES-GCM and optional ML-DSA digital signatures. CoverCrypt supports ML-KEM-768 for key encapsulation, while AC17 and TKN20 use classical ABE.

python -m pip install pq-cp-abe

Full documentation: Python SDK guide · API reference · CLI guide · Automatic API docs.

Object API

PqCpAbe defaults to CoverCrypt. Pass scheme to select another backend. This example encrypts a message for finance users and verifies an ML-DSA signature on decryption.

from pq_cp_abe import KemMode, MlDsaParameterSet, PqCpAbe

abe = PqCpAbe(
    config={"dimensions": [{"name": "department", "attributes": ["finance", "it"]}]},
    mode=KemMode.HYBRIDIZED,
)
parameter = MlDsaParameterSet.ML_DSA_65
keys = abe.setup_with_signing(ml_dsa_parameter_set=parameter)
user_key = abe.keygen(keys.master_secret_key, "department::finance")

ciphertext = abe.encrypt_and_sign(
    keys.public_key, keys.signing_key, b"Quarterly report", "department::finance",
    aes_key_bits=192, ml_dsa_parameter_set=parameter,
)
plaintext = abe.decrypt_and_verify(user_key, keys.verification_key, ciphertext)
assert plaintext == b"Quarterly report"

Use setup(), encrypt(), and decrypt() for unsigned data. Encryption accepts AES 128/192/256. Signed setup and encryption accept ML-DSA 44/65/87. Omitting both parameters uses AES-256 and, when signing, ML-DSA-87.

Class Use
AC17CPABE, TKN20CPABE Use a specific classical ABE scheme.
CoverCryptABE Configure dimensions and KemMode. Use add_dimension or add_attribute to grow an authority and save both updated keys.
AesGcm Generate a key and a fresh nonce, then encrypt or decrypt bytes.
MlDsa, MlKem Sign and verify with raw keys, or encapsulate and decapsulate a shared secret. get_sizes() reports sizes for the selected parameter set.

CoverCrypt supports KemMode.HYBRIDIZED, POST_QUANTUM, and CLASSIC. Its post-quantum component uses ML-KEM-768. Standalone MlKem supports 512/768/1024. When adding an attribute, the native runtime reads the mode from HCPABE_COVERCRYPT_MODE.

Functional API

Use package-level functions when passing the scheme per operation or working with files. Native failures raise AbeError and its subclasses.

from pq_cp_abe import Scheme, generate_secret_key, setup

keys = setup(scheme=Scheme.AC17)
user_key = generate_secret_key(keys.master_secret_key, "admin", scheme=Scheme.AC17)

File operations include setup_files, generate_secret_key_file, encrypt_file, and decrypt_file. For signed setup, use setup_files_with_signing(..., legacy_key_names=False) to generate the ml-dsa_sk.key and ml-dsa_pk.key filenames. call_* remains available for existing integrations.

Post-quantum ABE from the CLI

Use python -m pq_cp_abe to select the Python CLI if multiple installations provide pq-cp-abe. The --setup command accepts --config or the HCPABE_COVERCRYPT_CONFIG environment variable.

pq-cp-abe --help
pq-cp-abe --encrypt --help
python -m pq_cp_abe --test

The full CLI workflow covers setup, user key generation, signed encryption, and verification. CoverCrypt CLI example

Platform wheels bundle the native library. For staging, building, and verifying wheels, see the Python wheel workflow.

Metadata

Release files for pq-cp-abe 6.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Built distributions (wheels)

Table of built distributions (wheels) for pq-cp-abe 6.1.0
File Actions
pq_cp_abe-6.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for pq_cp_abe-6.1.0-py3-none-win_amd64.whl
pq_cp_abe-6.1.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details for pq_cp_abe-6.1.0-py3-none-manylinux_2_34_x86_64.whl
pq_cp_abe-6.1.0-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details for pq_cp_abe-6.1.0-py3-none-macosx_12_0_x86_64.whl
pq_cp_abe-6.1.0-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for pq_cp_abe-6.1.0-py3-none-macosx_12_0_arm64.whl

Total release size: 21.4 MB

Release files / pq_cp_abe-6.1.0-py3-none-win_amd64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL pq_cp_abe-6.1.0-py3-none-win_amd64.whl
Size 3.7 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d3368d43213d81622b654bde4aa1a4609cfbcafcb35b320f1a1c852528b21245
BLAKE2b-256 checksum
How to use checksums
76138d0a3735af11eca0b931f9ab91e0369f1745e2b4a83af84accf1f17e882c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / pq_cp_abe-6.1.0-py3-none-manylinux_2_34_x86_64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL pq_cp_abe-6.1.0-py3-none-manylinux_2_34_x86_64.whl
Size 8.5 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
cb1f6394bd34381a39064b2e1c91b34f68d1b3257b8a1ae9df30727ed4cd7586
BLAKE2b-256 checksum
How to use checksums
1bcfebcaa38c1396254c2726526279b9cad29070159fda7416e928a30697297a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / pq_cp_abe-6.1.0-py3-none-macosx_12_0_x86_64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL pq_cp_abe-6.1.0-py3-none-macosx_12_0_x86_64.whl
Size 4.8 MB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
b2ed3412adf0657ea1dc18731c381561148720ababe206fea217621ce357eecb
BLAKE2b-256 checksum
How to use checksums
13fc439d1c58b898ce6808edae1956452f18150cc693227dc5f61e46595a77d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / pq_cp_abe-6.1.0-py3-none-macosx_12_0_arm64.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL pq_cp_abe-6.1.0-py3-none-macosx_12_0_arm64.whl
Size 4.4 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
bc90ebf5a1d8e5060cd145ffe926cb31de9c73b01bc013be10d48d362dd16490
BLAKE2b-256 checksum
How to use checksums
3ed0390e549060327fae2e880c2f027c73b7cf34e68be190c78864c90321aa30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for pq-cp-abe 6.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Change of provenance

The repository and configuration that created this release differ from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Select from 4 files

Attestation for pq_cp_abe-6.1.0-py3-none-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page