Quantum-safe cryptography utilities built on top of liboqs-python
Project description
qcrypto
Version: 0.1.2
qcrypto is a lightweight Python library providing simple, Pythonic wrappers around post-quantum cryptography (PQC) algorithms using the official liboqs-python bindings from the Open Quantum Safe project.
The library currently includes:
- Kyber Key Encapsulation Mechanism (KEM)
- Dilithium digital signatures
- A hybrid PQC + AES-GCM encryption scheme
- Clean utility classes and exception handling
qcrypto is suitable for learning PQC, research, prototyping, and experiments involving quantum-safe primitives.
Features
Kyber KEM
- Public/secret key generation
- Encapsulation (ciphertext + shared secret)
- Decapsulation (recover shared secret)
- Supports Kyber512, Kyber768, Kyber1024
Dilithium Signatures
- Keypair generation
- Message signing
- Signature verification
- Supports Dilithium2, Dilithium3, Dilithium5
Hybrid PQC + AES Encryption
A simple hybrid model where:
- Kyber encapsulates a symmetric key
- AES-256-GCM encrypts the message
- Result is
(kem_ciphertext, aes_ciphertext)
Installation
Requires Python 3.8+.
pip install qcrypto
This installs liboqs-python automatically.
Usage
Usage examples are available in the examples/ directory
Implementation Notes
- Uses
liboqs-python, which bundles OQS C library implementations. - Hybrid encryption uses AES-256-GCM.
- Pure Python package, no compiled extensions.
- Modern PEP 621
src/layout.
Changelog
v0.2.0 — Hybrid API Rewrite, Key Serialization, Ciphertext Format
- Added
encrypt()anddecrypt()as the new high-level hybrid PQC API - Introduced a single-blob ciphertext format:
- version byte
- algorithm identifier
- Kyber ciphertext length
- Kyber ciphertext
- AES-GCM nonce
- AES-GCM ciphertext+tag
- Added key serialization helpers:
save_public_key(),save_private_key()KyberKEM.load_public_key(),KyberKEM.load_private_key()
decapsulate()now accepts a private key directly- Legacy API (
encrypt_for_recipient,decrypt_from_sender) retained for compatibility - Updated example usage and documentation
- Cleaned internal attribute naming (
private_keyrather thansecret_key)
Disclaimer
This library is for educational, experimental, and research use.
It is not a production security component and has not undergone cryptographic review.
License
MIT License.
Resources
- Open Quantum Safe Project: https://openquantumsafe.org
- liboqs-python: https://github.com/open-quantum-safe/liboqs-python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qcrypto-0.2.0.tar.gz.
File metadata
- Download URL: qcrypto-0.2.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8768ab80a183b0588b611d423fd7adc5010add9e2aae0cd919f23581da1b5c0
|
|
| MD5 |
41631c70f39a88e4fd01b9eef83f25cd
|
|
| BLAKE2b-256 |
5d249aa1686fe6e168311cc7864cf57bc9e27868383dde2b11bcc396d6fe059c
|
File details
Details for the file qcrypto-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qcrypto-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1557d5f62567867bc1dd050967468cdeaa08274116a1a641df31971a0d6c8437
|
|
| MD5 |
8d2e5492ecc3e5b59eb25ef6d2edede9
|
|
| BLAKE2b-256 |
c5cac08107e87576dc9dcdfc8bf4ccf23e99cd36704eac39fe96c0ab957b9e56
|