Skip to main content

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?

  • X25519 gives 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 to requests.Session.
  • @kalyx_safe: function-level return-value encryption for sensitive outputs.
  • HTTPHandshakeTransport: async httpx transport 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kalyxpq-0.1.0b0.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kalyxpq-0.1.0b0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

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

Hashes for kalyxpq-0.1.0b0.tar.gz
Algorithm Hash digest
SHA256 f42a0f130140b3e31f6bb201e01b246040e7ed62509a132b21e6d31e101cbbe1
MD5 84b7d555e28df55dd77d17cd71ded910
BLAKE2b-256 ed59f4d6661d17486aba6e821c3b0bbd09cce974ebcb1b0a9e1992da77972ea2

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalyxpq-0.1.0b0.tar.gz:

Publisher: publish.yml on 9Elliot/Kalyx-PQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for kalyxpq-0.1.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4fa44f0b4c0e4135f48b508838214bf238851122f1ffe8562cf33e6cce6b217
MD5 7bf68ec5e886c080985acf8cb7ff1aac
BLAKE2b-256 92bb7015a8894d9a394ba63516ea872cd25de2cad38d9e2f6485c41049a7fe26

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalyxpq-0.1.0b0-py3-none-any.whl:

Publisher: publish.yml on 9Elliot/Kalyx-PQ

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page