Developer-friendly hybrid post-quantum session security library.
Project description
Kalyx-PQ
Kalyx-PQ is a developer-friendly Python library that wraps hybrid post-quantum cryptography into a simple Session + Decorator model.
It is designed for the Harvest Now, Decrypt Later (HNDL) threat model: an attacker can steal encrypted traffic today and wait for future cryptanalytic or quantum advances to decrypt it later.
Kalyx-PQ mitigates this by combining classical X25519 and ML-KEM (Kyber family) in every handshake.
Quick Start
from kalyxpq import KalyxEngine
e = KalyxEngine()
artifacts, classical_priv, pq_secret = e.client_prepare()
Installation
pip install kalyxpq
For MessagePack payload serialization:
pip install "kalyxpq[msgpack]"
For production PQC with liboqs:
pip install "kalyxpq[oqs]"
For development:
pip install -e ".[dev,oqs]"
pytest
Why Hybrid?
X25519gives immediate interoperability and mature deployment confidence.ML-KEM(NIST FIPS 203 track) adds post-quantum resistance.- The derived session key combines both secrets, so confidentiality holds if either component remains secure.
Core Concepts
KalyxEngine: transport-agnostic hybrid handshake primitives.KalyxSession: simple encrypted payload flow similar torequests.Session.@kalyx_safe: function-level return-value encryption for sensitive outputs.HTTPHandshakeTransport: asynchttpxtransport adapter for remote handshake exchange.
Async HTTP Handshake Transport
from kalyxpq import HTTPHandshakeTransport, KalyxEngine
engine = KalyxEngine()
transport = HTTPHandshakeTransport(endpoint="https://api.example.com/kalyx/handshake")
artifacts, cpriv, cpq = engine.client_prepare()
response = await transport.send_client_artifacts(artifacts)
session_key = engine.client_finalize(response, cpriv, cpq)
AES-GCM with Optional MessagePack
KalyxSession.encrypt_payload(..., serializer="msgpack") allows compact binary encoding before encryption.
sealed = session.encrypt_payload({"token": "abc", "roles": ["admin"]}, serializer="msgpack")
plain = session.decrypt_payload(sealed)
Local Example
Run:
python examples/local_hybrid_simulation.py
This simulates a full client/server hybrid handshake without coupling to HTTP or any specific transport.
For async transport mock examples:
python examples/http_client_async.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kalyxpq-0.1.0b0.tar.gz.
File metadata
- Download URL: kalyxpq-0.1.0b0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f42a0f130140b3e31f6bb201e01b246040e7ed62509a132b21e6d31e101cbbe1
|
|
| MD5 |
84b7d555e28df55dd77d17cd71ded910
|
|
| BLAKE2b-256 |
ed59f4d6661d17486aba6e821c3b0bbd09cce974ebcb1b0a9e1992da77972ea2
|
Provenance
The following attestation bundles were made for kalyxpq-0.1.0b0.tar.gz:
Publisher:
publish.yml on 9Elliot/Kalyx-PQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kalyxpq-0.1.0b0.tar.gz -
Subject digest:
f42a0f130140b3e31f6bb201e01b246040e7ed62509a132b21e6d31e101cbbe1 - Sigstore transparency entry: 1203864905
- Sigstore integration time:
-
Permalink:
9Elliot/Kalyx-PQ@318a40ad306cb63d8044467846a8be92e016f3d8 -
Branch / Tag:
refs/tags/v0.1.0-beta - Owner: https://github.com/9Elliot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@318a40ad306cb63d8044467846a8be92e016f3d8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file kalyxpq-0.1.0b0-py3-none-any.whl.
File metadata
- Download URL: kalyxpq-0.1.0b0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4fa44f0b4c0e4135f48b508838214bf238851122f1ffe8562cf33e6cce6b217
|
|
| MD5 |
7bf68ec5e886c080985acf8cb7ff1aac
|
|
| BLAKE2b-256 |
92bb7015a8894d9a394ba63516ea872cd25de2cad38d9e2f6485c41049a7fe26
|
Provenance
The following attestation bundles were made for kalyxpq-0.1.0b0-py3-none-any.whl:
Publisher:
publish.yml on 9Elliot/Kalyx-PQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kalyxpq-0.1.0b0-py3-none-any.whl -
Subject digest:
c4fa44f0b4c0e4135f48b508838214bf238851122f1ffe8562cf33e6cce6b217 - Sigstore transparency entry: 1203864910
- Sigstore integration time:
-
Permalink:
9Elliot/Kalyx-PQ@318a40ad306cb63d8044467846a8be92e016f3d8 -
Branch / Tag:
refs/tags/v0.1.0-beta - Owner: https://github.com/9Elliot
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@318a40ad306cb63d8044467846a8be92e016f3d8 -
Trigger Event:
release
-
Statement type: