qux-pqc
A comprehensive Rust library implementing NIST-standardized post-quantum cryptographic algorithms for key encapsulation and digital signatures.
Features
- ML-KEM (CRYSTALS-Kyber) - NIST FIPS 203 Key Encapsulation Mechanism
- ML-DSA (CRYSTALS-Dilithium) - NIST FIPS 204 Digital Signature Algorithm
- AES-256-GCM - Symmetric encryption with PQC-derived keys
- SHA3-256/512 - Quantum-resistant hashing
- Secure Key Management - Encrypted key storage with zeroization
Security Levels
| Level | KEM Algorithm | DSA Algorithm | Classical Equivalent |
|---|---|---|---|
| 3 | ML-KEM-768 | ML-DSA-65 | ~AES-192 |
| 5 | ML-KEM-1024 | ML-DSA-87 | ~AES-256 |
Installation
Add to your Cargo.toml:
[]
= "1.0"
Quick Start
use ;
Modules
Key Encapsulation (KEM)
use ;
// Generate key pair
let keys = generate_keypair?;
// Encapsulate shared secret
let = encapsulate?;
// Decapsulate to recover shared secret
let recovered = decapsulate?;
assert_eq!;
Digital Signatures (DSA)
use ;
// Generate key pair
let keys = generate_keypair?;
// Sign message
let message = b"Important document";
let signature = sign?;
// Verify signature
let valid = verify?;
assert!;
Symmetric Encryption
use symmetric;
// Encrypt with KEM-derived shared secret
let encrypted = encrypt_with_secret?;
// Decrypt
let decrypted = decrypt_with_secret?;
Key Management
use keys;
// Serialize keys with encryption
let encrypted = serialize_encrypted?;
// Save to file
write?;
// Load and decrypt
let loaded = read?;
let key_set = deserialize_encrypted?;
Utilities
use utils;
// SHA3-256 hashing
let hash = sha3_256;
let hash_hex = sha3_256_hex;
// Random bytes
let random = random_bytes;
let random_hex = random_hex;
// Constant-time comparison
let equal = constant_time_eq;
Key Sizes
ML-KEM
| Level | Public Key | Secret Key | Ciphertext | Shared Secret |
|---|---|---|---|---|
| 3 | 1,184 bytes | 2,400 bytes | 1,088 bytes | 32 bytes |
| 5 | 1,568 bytes | 3,168 bytes | 1,568 bytes | 32 bytes |
ML-DSA
| Level | Public Key | Secret Key | Signature |
|---|---|---|---|
| 3 | 1,952 bytes | 4,032 bytes | 3,309 bytes |
| 5 | 2,592 bytes | 4,896 bytes | 4,627 bytes |
Security Features
- Zeroization: Secret keys are automatically zeroed on drop
- Constant-time operations: Where applicable to prevent timing attacks
- Encrypted storage: Keys can be serialized with passphrase protection
- HKDF key derivation: Secure key derivation from shared secrets
Standards Compliance
- NIST FIPS 203 - ML-KEM (Module-Lattice-Based Key-Encapsulation Mechanism)
- NIST FIPS 204 - ML-DSA (Module-Lattice-Based Digital Signature Algorithm)
- NIST FIPS 202 - SHA-3 (Secure Hash Algorithm 3)
Feature Flags
[]
= { = "1.0", = false } # no_std compatible
= { = "1.0", = ["std"] } # default, with std
Minimum Supported Rust Version
This crate requires Rust 1.70 or later.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
Contributions welcome! Please read our contributing guidelines before submitting a pull request.
Security
For security issues, please email security@quxtech.com instead of opening a public issue.