Skip to main content

Post-quantum cryptography for Python: ML-KEM, ML-DSA, SLH-DSA, and hybrid encryption

Project description

QyberSafe

Build status Version License C++17 Python 3.8+ Platforms NIST FIPS PRs welcome

QyberSafe

QyberSafe is a modern C++ and Python library for integrating post-quantum cryptography into real applications. It provides modular, crypto-agile primitives for quantum-resistant key exchange, digital signatures, and hybrid encryption, built for fintech, cloud, and enterprise systems that need to stay secure against future quantum attacks.

Classical algorithms such as RSA and ECC are vulnerable to large-scale quantum computers. QyberSafe implements the NIST-standardized lattice and hash based schemes so you can defend against "harvest now, decrypt later" attacks today, with an API designed to swap algorithms as standards evolve.

Status: 0.1.0 alpha. The API is stabilizing and not yet recommended for production deployments.

Features

  • One small, misuse-resistant API: seal / open for encryption, sign / verify for signatures
  • First-class C++17 and Python, sharing a single audited core (liboqs)
  • NIST-standardized algorithms: ML-KEM (FIPS 203), ML-DSA (FIPS 204), and SPHINCS+ / SLH-DSA (FIPS 205 family)
  • Hybrid encryption by default: X25519 combined with ML-KEM-768, so confidentiality holds even if one half is broken
  • Self-describing, versioned key and ciphertext formats for crypto agility
  • Authenticated encryption (AES-256-GCM) with optional associated data
  • Security-focused: audited primitives, secure memory zeroing, no homemade cryptography
  • Continuous integration on Linux and macOS, including an AddressSanitizer/UBSan build

Algorithms

Algorithm (alias) Type NIST standard Parameter sets
ML-KEM (Kyber) Key encapsulation FIPS 203 ML-KEM-512 / 768 / 1024
ML-DSA (Dilithium) Signature FIPS 204 ML-DSA-44 / 65 / 87
SPHINCS+ (SLH-DSA) Hash-based signature FIPS 205 family SPHINCS+-SHA2-128s / 192s / 256s
Hybrid Classical + PQC - X25519 + ML-KEM-768 + AES-256-GCM

Parameter sets map to roughly 128, 192, and 256 bit security. The defaults (ML-KEM-768, ML-DSA-65) suit most workloads.

The hash-based signatures currently use liboqs' SPHINCS+-SHA2 "simple" parameter sets (the NIST round-3 submission that FIPS 205 SLH-DSA is based on). The FIPS-205 "pure" variant will be adopted once it verifies across all supported platforms in liboqs.

Installation

Requirements: a C++17 compiler (GCC 11+, Clang, or MSVC), CMake 3.16+, and OpenSSL. liboqs is fetched and built automatically. Python 3.8+ is needed for the Python package.

Python

From a clone (liboqs is statically bundled into the extension):

git clone https://github.com/Nathandona/QyberSafe.git
cd QyberSafe
pip install .

C++

git clone https://github.com/Nathandona/QyberSafe.git
cd QyberSafe
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
ctest --test-dir build --output-on-failure

The C++ headers and library install with cmake --install build.

Quick start

C++

#include <qybersafe/qybersafe.h>

using namespace qybersafe;

int main() {
    // Hybrid encryption (X25519 + ML-KEM-768)
    auto enc = generate_encryption_keypair();
    bytes message = {'h', 'e', 'l', 'l', 'o'};
    bytes envelope = seal(enc.public_key, message);
    bytes recovered = open(enc.private_key, envelope);

    // Signatures (ML-DSA-65 by default)
    auto signer = generate_signing_keypair();
    bytes signature = sign(signer.private_key, message);
    bool valid = verify(signer.public_key, message, signature);

    return (recovered == message && valid) ? 0 : 1;
}

Python

import qybersafe as qs

# Hybrid encryption, with optional associated data
enc = qs.generate_encryption_keypair()
envelope = qs.seal(enc.public_key, b"Hello, post-quantum world!", aad=b"context")
assert qs.open(enc.private_key, envelope, aad=b"context") == b"Hello, post-quantum world!"

# Signatures (ML-DSA-65 by default)
signer = qs.generate_signing_keypair()
signature = qs.sign(signer.private_key, b"message")
assert qs.verify(signer.public_key, b"message", signature)

Operations raise CryptoError on failure; verify returns a bool. Keys are opaque objects that serialize with to_bytes() / from_bytes().

Why post-quantum

A sufficiently powerful quantum computer running Shor's algorithm would break the public-key cryptography that secures most of the internet today. Attackers can already record encrypted traffic now and decrypt it later once such hardware exists, which is why long-lived secrets need quantum-resistant protection immediately. QyberSafe lets you adopt NIST PQC standards incrementally through hybrid modes, keeping classical guarantees while adding a post-quantum layer.

Roadmap

  • Additional language bindings (Go, Rust, JavaScript and WebAssembly)
  • TLS and SSH hybrid protocol modules
  • Hardware security module (HSM) integration
  • Hardware acceleration and SIMD optimizations
  • Benchmark suite and formal verification of critical components

See CHANGELOG.md for release history.

Documentation

The design and wire formats are documented in SPEC.md. The test suites are usable as examples: src/tests for C++ and python/tests for Python. API reference can be generated with Doxygen via cmake --build build --target docs.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md before opening a pull request, and file an issue for bugs, integration questions, or feature requests.

Security

QyberSafe is alpha software and has not undergone an independent security audit. Do not rely on it to protect production secrets yet. Report vulnerabilities privately through GitHub Security Advisories rather than through public issues.

License

Released under the MIT License.

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

qybersafe-0.1.0a3.tar.gz (193.9 kB view details)

Uploaded Source

Built Distributions

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

qybersafe-0.1.0a3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

qybersafe-0.1.0a3-cp313-cp313-macosx_11_0_arm64.whl (11.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

qybersafe-0.1.0a3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

qybersafe-0.1.0a3-cp312-cp312-macosx_11_0_arm64.whl (9.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qybersafe-0.1.0a3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (7.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

qybersafe-0.1.0a3-cp311-cp311-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qybersafe-0.1.0a3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

qybersafe-0.1.0a3-cp310-cp310-macosx_11_0_arm64.whl (5.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

qybersafe-0.1.0a3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

qybersafe-0.1.0a3-cp39-cp39-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file qybersafe-0.1.0a3.tar.gz.

File metadata

  • Download URL: qybersafe-0.1.0a3.tar.gz
  • Upload date:
  • Size: 193.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qybersafe-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 e7a9bb217b8132cb352c18f4c2c43b0c1cdff72a6dc62df4036f604aa5634fa4
MD5 f54ee8662aa8b98fad559efb46ce39d7
BLAKE2b-256 ce65c5ab7358cf505d3288d924546302153b00bb82bb1a0a75af45f556fd7429

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3.tar.gz:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 33ed8c4719c3a5fa781f83f0a1a976171d0965ed189a61fb6cefceb2a6c153a7
MD5 506cd0288b73cfaa6183bd8fbf0c0ea8
BLAKE2b-256 f40e1939d3325b8fba0a7fd3ae1011b4e0384dd264c435a740f3abdc237937b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 612d2b3c086dbe34931b7a9e610cf9fb01a88639f20c33affce4e61f31b482df
MD5 1ecf8a25115c765733eb44451acb6794
BLAKE2b-256 0cc5dcfd4fad762a618268c09998e03c2f3f4a218135a73b5580d2680fdd4a64

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e0215bb0074c603ce95d8e6adf9a22d34d179333a7457baad08b7058e8e0e79
MD5 b3647567a402789b0f615de5af9fed64
BLAKE2b-256 645a3e4b7c445dcc91b220b538b0541662dd572aba7b8015dfa43903fd405845

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 620ea24d9521685ea1ab4ce2eac6ee0ffc0e2309d767e3b89bdc33b3d9b9ca12
MD5 66163b25e6cc9d9199fe50def0e99f75
BLAKE2b-256 f67df5969065ac4d776f27f04d0d3b67b1dfea34b7c350639a2e0fcfadc91d0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8e1bcfd4204861519df5a564824dd102ebb4047d143c405b1df111f33956ee50
MD5 37cad1a137709250093355a5c4fd2fab
BLAKE2b-256 41ff525b53f7ede869e0c11a1fe94111d26202c074bd29fba8bdeb32356a031a

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09c5435821855aaac2bfe7044f721855332f4fb601fc159c117a2e01b6d876eb
MD5 0516400986c35b9f268bb69e26c79d07
BLAKE2b-256 51348c751d98902b9bf989a6ed809d16b9df5d5d03711ad87a1e8a69174211af

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7627c202566536444dae8e54f64ec861b64c2460c219d812545144638514475f
MD5 5f5e3113a85242d02562fd50060bb646
BLAKE2b-256 431ed2bee2037b700306d9df60529e94c2ec5e98eda04587315b0a80ef184a59

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e4d2aa425d55a2a33d4b8dc98dc3840945e599b5dc84cc7da1c0d47d8684babc
MD5 22911f634cd66d003edd727c86ed6ed0
BLAKE2b-256 a205892789bf50760a56738d0be06a6ec19b076580664f53e8a53a19553cd0ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b96128ea4355878ecc7f60d61967924dbefa1f4b32cc273511a6434ab60bd23c
MD5 357860469dfc81217b40d5e30a30aeeb
BLAKE2b-256 d0dde1dceb2a50a02a785b58eddc1a7f176491991cd9f7e1ad4d77b26959ac6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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

File details

Details for the file qybersafe-0.1.0a3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qybersafe-0.1.0a3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c4987a87c935eb52305152e5129f8ff361da29747af5b3c74c8e11326c4f7c4
MD5 38e27c4ab93ce24759fdac84fbb9a32a
BLAKE2b-256 1c6431bd83892e41f37664f228e7118f9504cd732012069749564d5b97cf3ce1

See more details on using hashes here.

Provenance

The following attestation bundles were made for qybersafe-0.1.0a3-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: wheels.yml on Nathandona/QyberSafe

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