| Crates.io | quantumcryptlib |
| lib.rs | quantumcryptlib |
| version | 1.0.0 |
| created_at | 2025-12-13 15:41:11.935176+00 |
| updated_at | 2025-12-13 15:41:11.935176+00 |
| description | Post-quantum secure communication primitives using Kyber KEM and AEAD |
| homepage | |
| repository | https://github.com/0rlych1kk4/quantumcryptlib |
| max_upload_size | |
| id | 1983088 |
| size | 22,641 |
QuantumCryptLib is a Rust library for building post-quantum secure communication channels using Kyber512 (a NIST-selected post-quantum Key Encapsulation Mechanism) combined with modern AEAD encryption.
Rather than encrypting data directly with Kyber, this library follows industry-correct cryptographic design:
Kyber KEM → Shared Secret → AEAD (ChaCha20-Poly1305)
This approach protects today’s communications and stored data against future quantum attacks (“harvest now, decrypt later”).
️ Warning
This crate provides cryptographic building blocks only.
It does NOT implement:
- Authentication or identity verification
- Replay protection
- Key lifecycle management
- A full network or transport protocol (e.g., TLS)
Users are responsible for integrating these primitives into a secure, authenticated protocol design.
Kyber512 is a Key Encapsulation Mechanism (KEM) — it is not used to encrypt application data directly.
QuantumCryptLib implements the recommended construction:
This model is used in:
️⃣ Clone the repository:
git clone https://github.com/0rlych1kk4/quantumcryptlib.git
cd quantumcryptlib
cargo build
cargo run --bin quantumcryptlib_bin
Generating Kyber Key Pair
use quantumcryptlib::key_exchange::generate_key_pair;
let (public_key, secret_key) = generate_key_pair();
Establish a Post-Quantum Shared Secret (KEM)
use quantumcryptlib::key_exchange::{encapsulate, decapsulate};
// Initiator
let (shared_secret_a, kem_ciphertext) = encapsulate(&public_key)?;
// Responder
let shared_secret_b = decapsulate(&secret_key, &kem_ciphertext)?;
assert_eq!(shared_secret_a, shared_secret_b);
**Encrypt and Decrypt Data Using AEAD**
use quantumcryptlib::secure_channel::{aead_encrypt, aead_decrypt};
let message = b"hello post-quantum world";
// Encrypt
let (nonce, ciphertext) = aead_encrypt(&shared_secret_a, message)?;
// Decrypt
let plaintext = aead_decrypt(&shared_secret_b, &nonce, &ciphertext)?;
assert_eq!(message.to_vec(), plaintext);
Integration tests validate the following:
cargo test
no_std supportgit checkout -b feature-branch
git commit -m "Add feature"