โ† Projects
02 / 09 - Python ยท Cryptography ยท Security

Post-Quantum
Crypto Toolkit

A modular Python toolkit for quantum-safe cryptography - post-quantum key exchange, digital signatures and authenticated encryption behind a clean, validated API.

PythonCryptography liboqsKEM AEADHKDF
View on GitHub โ†—

What it does

Quantum computers threaten classical public-key cryptography. qrpt wraps post-quantum primitives from liboqs behind a small, safety-first API so applications can adopt quantum-resistant key exchange and signatures today.

The design favours correctness and maintainability: strict input and nonce-length validation, slotted dataclasses to cut object overhead, and a repeatable benchmark runner to catch performance regressions.

What it provides

01
KEM key exchange
Post-quantum Key Encapsulation Mechanism to establish a shared secret over an untrusted channel.
02
Digital signatures
Post-quantum sign and verify for message authenticity and integrity.
03
AEAD encryption
Authenticated encryption with associated data, with a fast path that avoids unnecessary byte copies.
04
HKDF derivation
Derives AEAD keys from a shared secret at roughly 0.007 ms per derivation.
05
High-level seal / open
One-call helpers that combine KEM, derivation and AEAD into a simple seal and open interface.

Installation

Requires Python 3.11+. AEAD works out of the box; post-quantum features pull in the optional oqs binding.

bash
# AEAD only
pip install .

# with post-quantum primitives (liboqs / oqs)
pip install .[pqc]

Encrypt with a shared secret

python
from qrpt import encrypt_with_shared_secret, decrypt_with_shared_secret

# shared_secret comes from the post-quantum KEM exchange
nonce, ciphertext = encrypt_with_shared_secret(plaintext, shared_secret, aad=context)

# aad must match on both sides or decryption fails
recovered = decrypt_with_shared_secret(nonce, ciphertext, shared_secret, aad=context)