Skip to main content

Drop-in quantum-safe upgrade for Python cryptography - zero code changes required

Project description

quantumvault-cryptography

A Product of AllSecureX
Enterprise-Grade Post-Quantum Cryptography

License PyPI version


Drop-in quantum-safe upgrade for Python applications - zero code changes required.

This package transparently upgrades your Python application's cryptographic operations to quantum-safe alternatives. Simply install and configure at application startup - all existing crypto code continues to work while being protected against quantum computer attacks.

Features

  • Zero Code Changes: Works with existing cryptography library usage
  • Automatic Upgrades: RSA/ECDSA operations upgraded to ML-KEM/ML-DSA hybrids
  • Multiple Modes: Monitor, hybrid, or pure post-quantum
  • Analytics: Track all crypto operations via QuantumVault dashboard
  • Gradual Rollout: Start in monitor mode, then progressively upgrade
  • Fallback Safety: Automatic fallback to classical crypto on errors

Installation

pip install quantumvault-cryptography

Quick Start

Add this at the very top of your application entry point:

import os
import quantumvault_cryptography

# Must be called BEFORE importing cryptography
quantumvault_cryptography.install(
    api_key=os.environ['QUANTUMVAULT_API_KEY'],
    mode='hybrid'  # Start with 'monitor' to observe without changes
)

# Now all your existing code is quantum-safe!
from cryptography.hazmat.primitives.asymmetric import rsa

# This RSA key is automatically upgraded to RSA + ML-KEM-768 hybrid
private_key = rsa.generate_private_key(
    public_exponent=65537,
    key_size=2048
)

Configuration

import quantumvault_cryptography

quantumvault_cryptography.install(
    # Required: Your QuantumVault API key
    api_key='qvp_...',

    # Optional: Plugin ID for analytics (get from QuantumVault dashboard)
    plugin_id='plugin_abc123',

    # Optional: API endpoint (defaults to production)
    endpoint='https://api.quantumvault.io',

    # Mode: 'monitor' | 'hybrid' | 'pq_only' | 'intercept'
    # - monitor: Log only, no changes (safe to start with)
    # - hybrid: Use classical + quantum-safe combined (recommended)
    # - pq_only: Pure post-quantum (future-proof)
    # - intercept: Upgrade classical to PQ transparently
    mode='hybrid',

    # Fallback to classical crypto on errors
    fallback_on_error=True,

    # API timeout in milliseconds
    timeout_ms=5000,

    # Enable debug logging
    log_operations=True,
)

Algorithm Mappings

Classical Algorithm Quantum-Safe Upgrade Hybrid Option
RSA-2048 ML-KEM-768 RSA-2048 + ML-KEM-768
RSA-3072 ML-KEM-1024 RSA-3072 + ML-KEM-1024
RSA-4096 ML-KEM-1024 RSA-4096 + ML-KEM-1024
ECDSA-P256 ML-DSA-44 ECDSA-P256 + ML-DSA-44
ECDSA-P384 ML-DSA-65 ECDSA-P384 + ML-DSA-65
ECDH-P256 ML-KEM-768 ECDH-P256 + ML-KEM-768
Ed25519 ML-DSA-44 Ed25519 + ML-DSA-44
X25519 ML-KEM-768 X25519 + ML-KEM-768

API Reference

install(**config)

Install the QuantumVault crypto shim. Must be called before any cryptography imports.

uninstall()

Remove the shim and restore original functions.

is_active()

Returns True if the shim is currently installed.

status()

Get current shim status and statistics:

import quantumvault_cryptography

print(quantumvault_cryptography.status())
# {
#   'installed': True,
#   'mode': 'hybrid',
#   'stats': {
#     'total_operations': 150,
#     'upgraded_operations': 142,
#     'classical_operations': 8,
#     'failed_operations': 0,
#     'by_algorithm': {'rsa': {'upgraded': 100, 'classical': 0}, ...}
#   }
# }

get_mappings()

Get all algorithm mappings.

Migration Guide

Step 1: Monitor Mode (Week 1)

Start with monitor mode to understand your crypto usage:

quantumvault_cryptography.install(
    api_key=os.environ['QUANTUMVAULT_API_KEY'],
    mode='monitor',
    log_operations=True
)

Step 2: Review Analytics

Check your QuantumVault dashboard to see:

  • Which algorithms are being used
  • Operation frequency and latency
  • Potential compatibility issues

Step 3: Enable Hybrid Mode (Week 2+)

Once confident, switch to hybrid mode:

quantumvault_cryptography.install(
    api_key=os.environ['QUANTUMVAULT_API_KEY'],
    mode='hybrid'
)

Step 4: Pure Post-Quantum (Optional)

For maximum future-proofing:

quantumvault_cryptography.install(
    api_key=os.environ['QUANTUMVAULT_API_KEY'],
    mode='pq_only'
)

Supported Operations

Operation Supported Notes
rsa.generate_private_key() Yes Key generation upgraded
ec.generate_private_key() Yes Key generation upgraded
Ed25519PrivateKey.generate() Yes Key generation upgraded
private_key.sign() Coming soon Signature operations
public_key.verify() Coming soon Verification operations
AES operations N/A Already quantum-safe
SHA-256+ hashing N/A Already quantum-safe

Logging

Enable Python logging to see shim activity:

import logging

logging.basicConfig(level=logging.DEBUG)
logging.getLogger("quantumvault").setLevel(logging.DEBUG)

Requirements

  • Python 3.8+
  • cryptography >= 41.0.0
  • requests >= 2.28.0

License

MIT

Support

About AllSecureX

AllSecureX provides enterprise-grade post-quantum cryptography solutions. QuantumVault is our flagship product for NIST-standardized quantum-resistant algorithms (FIPS 203, 204, 205).

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

quantumvault_cryptography-1.0.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

quantumvault_cryptography-1.0.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file quantumvault_cryptography-1.0.1.tar.gz.

File metadata

File hashes

Hashes for quantumvault_cryptography-1.0.1.tar.gz
Algorithm Hash digest
SHA256 43421afea1868942c2c355a95a03e1d3445cd85fda991e0bd39cdd93c317963a
MD5 a035ff773849c6a9d5561cb518756066
BLAKE2b-256 ad64ada068b9d86000285747c26b42fac96d41d66fa2ad5715d34a4809bb5f57

See more details on using hashes here.

File details

Details for the file quantumvault_cryptography-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for quantumvault_cryptography-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e5c4722d62e85c3b1a8ebb5191f9f0805b6c321d5987e2063aac3148f4dff48
MD5 ef70420131d5f346ad17683fac6e45a1
BLAKE2b-256 81046e4075cf069450ce99c51b89370cd3ae909a76db2ceaf81cd70cc241633c

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