Skip to main content

aloecrypt-py

A post-quantum secure messaging library for Python

GitHub CI PyPI version PyPI downloads Python versions License

Aloecrypt provides mutual authentication and encrypted sessions using ML-KEM-768 (Kyber) for key encapsulation and ML-DSA-65 (Dilithium) for signatures, with ChaCha20-Poly1305 for symmetric encryption. The cryptographic core is compiled to WebAssembly, so there are no native extension dependencies.

Installation

pip install aloecrypt

Requires Python 3.11 or later.

Quick example

from aloecrypt import DilithiumSigner, SessionBuilder, perform_handshake
from aloecrypt.consts import EMPTY_TIMESTAMP

# Each party creates a root identity (done once, then persisted)
root_a = DilithiumSigner.new()
root_b = DilithiumSigner.new()

# Derive short-lived delegates for active use
delegate_a = root_a.create_delegate(EMPTY_TIMESTAMP, EMPTY_TIMESTAMP, 0, 0)
delegate_b = root_b.create_delegate(EMPTY_TIMESTAMP, EMPTY_TIMESTAMP, 0, 0)

# Build sessions targeting each other's address
session_a = SessionBuilder.create(root_b.address, delegate_a)
session_b = SessionBuilder.create(root_a.address, delegate_b)

# Run the handshake
built_a, built_b = perform_handshake(session_a, session_b)

# Encrypt and decrypt
ciphertext = built_a.encrypt(b"hello")
assert built_b.decrypt(ciphertext) == b"hello"

What it provides

  • Identities -- ML-DSA-65 root keypairs with derived short-lived delegates. The root key can be kept offline; delegates are used for active sessions.
  • Key encapsulation -- ML-KEM-768 keypairs signed by a delegate. Direct encapsulate/decapsulate is available for custom protocols.
  • Handshake -- a five-message mutual proof-of-decryption protocol. Transport-agnostic; works over TCP, WebRTC, HTTP, message queues, or anything else.
  • Sessions -- ChaCha20-Poly1305 authenticated encryption with deterministic nonce derivation. Supports arbitrary byte payloads including empty and large messages.
  • Custom sessions -- construct a session directly from pre-shared secrets without running the handshake, for integration with your own key agreement protocol.
  • PEM serialisation -- encrypted PEM for private keys, unencrypted PEM for public keys and verifiers.

Algorithms

Role Algorithm
Signing ML-DSA-65 (Dilithium)
Key encapsulation ML-KEM-768 (Kyber)
Symmetric encryption ChaCha20-Poly1305
Key derivation HKDF-SHA256
Key stretching PBKDF2

Documentation

Full API reference and usage guides at aloecrypt-py.aloecraft.org.

License

Apache-2.0 -- see LICENSE for details.

Copyright Michael Godfrey 2026 | aloecraft.org

Metadata

Release files for aloecrypt 0.1.0

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

Source distribution (sdist)

Source distribution for aloecrypt 0.1.0
File Size Uploaded
aloecrypt-0.1.0.tar.gz 226.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aloecrypt 0.1.0
File Interpreter ABI Platform
aloecrypt-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 457.5 kB

Release files / aloecrypt-0.1.0.tar.gz

Download URL aloecrypt-0.1.0.tar.gz
Size 226.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4646980b2db48c739b8f623d39f2d0c2db2ed2444a4a7fef2f0a1e778dd1cef6
BLAKE2b-256 checksum
How to use checksums
3408158fee131afecb50bf25843392885ac6a730a0f830a77b79b70175bbc93e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 11, 2026.

Transparency log

Release files / aloecrypt-0.1.0-py3-none-any.whl

Download URL aloecrypt-0.1.0-py3-none-any.whl
Size 231.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6856a7538e6ae814fdad455090da75a65feddcf077465bc0110aabe59fd4c8e6
BLAKE2b-256 checksum
How to use checksums
5f7b8f822b34ee47e179ac3f4302b306dbd06d683ef3c6dc2ee1160d741c16c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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