Skip to main content

Universal Exchange Security Protocol — Hybrid Post-Quantum Secure Messaging

Project description

UXSP — Universal Exchange Security Protocol

Security: Hybrid PQC Python: 3.11+

UXSP is a high-security, domain-agnostic messaging protocol designed for the Post-Quantum (PQ) era. It ensures that your data remains private even if an attacker captures it today and attempts to decrypt it later with a powerful quantum computer (Store-Now-Decrypt-Later attack).


📋 Prerequisites (System Level)

UXSP relies on the Open Quantum Safe (liboqs) C library for its quantum-resistant primitives. You must install this on your system before the Python package can work.

OS Installation Command
Ubuntu/Debian sudo apt install liboqs
Fedora sudo dnf install liboqs
macOS (Homebrew) brew install liboqs
Windows Build from source via liboqs GitHub

📦 Installation

UXSP is designed to be lightweight. You only install what you need.

# 1. Base Installation (includes Memory Storage)
pip install uxsp

# 2. Optional: Add Redis support for distributed replay protection
pip install "uxsp[redis]"

# 3. Optional: Add Postgres support for durable audit logging
pip install "uxsp[postgres]"

🚀 Crystal Clear Quick Start

This guide demonstrates a complete secure exchange between two peers (Alice and Bob).

1. Identity Setup (Private & Public Keys)

Every participant needs an Identity. This generates both classical (X25519/Ed25519) and PQ (ML-KEM/ML-DSA) keypairs.

from uxsp.core.identity import Identity

# Create Alice's identity
# "NODE-A" is a 'Role' string—you can define any role that fits your project.
alice = Identity.create("Alice", "NODE-A")

# Securely save the identity to a file. 
# The private keys are encrypted with AES-256-GCM using your password.
alice.save("alice.uxsp", password="my_secret_password")

# Export the PublicCard. This is what you share with Bob.
# It contains ONLY public keys and is safe to send over the network.
alice_card = alice.public_card()

2. Establishing the Secure Session (The Handshake)

Alice and Bob must perform a 3-step handshake to verify each other's identity and agree on a shared encryption key.

from uxsp.core.handshake import Handshake

# --- STEP 1: Alice Initiates ---
# Alice uses her private Identity and Bob's PublicCard to start.
hs_init = Handshake.initiate(alice, bob_card)
hello_msg = hs_init.hello_message  # Send this dictionary to Bob

# --- STEP 2: Bob Responds ---
# Bob receives the 'hello_msg' and Alice's 'alice_card'.
# He verifies Alice's signature and establishes his side of the session.
hs_resp = Handshake.respond(bob, hello_msg, alice_card)
ack_msg = hs_resp.ack_message  # Send this back to Alice
bob_session = hs_resp.session   # Bob's session is now ACTIVE

# --- STEP 3: Alice Completes ---
# Alice receives the 'ack_msg' and verifies Bob's signature.
# If verification passes, her session becomes ACTIVE.
alice_session = hs_init.complete(ack_msg, bob_card)

3. Secure Communication

Once the session is active, you can send encrypted data. UXSP manages Sequence Numbers automatically to prevent attackers from reordering or replaying your messages.

# --- Alice Sends ---
message = b"Secret data: 42"
payload = alice_session.encrypt(message) # Returns a dict with ciphertext

# --- Bob Receives ---
# Bob decrypts the payload. If the message was replayed or arrived 
# out of order, UXSP will raise a 'SessionReorderError'.
plaintext = bob_session.decrypt(payload)
print(plaintext.decode()) # Output: Secret data: 42

🛠️ Core Components

  • uxsp.core.identity: Identity management and encrypted local storage.
  • uxsp.core.handshake: The 3-step hybrid mutual authentication engine.
  • uxsp.core.session: Stateful encryption with sequence enforcement.
  • uxsp.storage: High-performance backends for Replay Protection.

🧪 Testing

Run the full suite to verify your system's liboqs compatibility:

pytest tests/

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

uxsp-0.1.0.tar.gz (42.8 kB view details)

Uploaded Source

Built Distribution

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

uxsp-0.1.0-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

Details for the file uxsp-0.1.0.tar.gz.

File metadata

  • Download URL: uxsp-0.1.0.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for uxsp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18e4dcb108665cfe3a0cf2f48a35152b868532a6259e9cc268eaff7fddb7cb3f
MD5 6c9471e2d7c603ab3c2ee63e86591fa8
BLAKE2b-256 0b34c992eba0d56869bbc7199b47af7e4616bb849c7bd308322cab7cb7b23ecf

See more details on using hashes here.

File details

Details for the file uxsp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: uxsp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for uxsp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db994b2df022387fa7510e47de22caef81de6659611d7edce10f3b549afb5630
MD5 c4694617f38763821237a61d0f981965
BLAKE2b-256 8cd35d1569d801482fc2ced45e37ee38ffc8c86f9bd237dbef8e450a80105474

See more details on using hashes here.

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