π pqguard
Post-quantum file encryption CLI β ML-KEM-768 (FIPS 203) + AES-256-GCM.
Encrypt files using NIST-standardized post-quantum algorithms that resist both classical and quantum computer attacks.
Project status: production-quality Rust cryptography, NIST FIPS 203 compliant, fuzz-tested, published on crates.io.
π― What it doesβ
| Capability | Description |
|---|---|
| Post-quantum key exchange | ML-KEM-768 (Kyber768) β NIST Level 3, resists Shor's algorithm |
| Hybrid encryption | KEM + HKDF-SHA256 + AES-256-GCM β industry-standard symmetric layer |
| CLI interface | keygen, encrypt, decrypt, verify, info commands |
| Key management | Named keypairs with public/private separation |
| File verification | Integrity check without decryption |
| NIST compliance | FIPS 203 (ML-KEM), FIPS 204 (ML-DSA), FIPS 205 (SLH-DSA) |
βοΈ Architectureβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ENCRYPTION β
β β
β 1. Generate random salt + nonce β
β 2. ML-KEM-768 encapsulate β shared secret + ct β
β 3. HKDF-SHA256(shared_secret, salt) β aes_key β
β 4. AES-256-GCM(aes_key, nonce, plaintext) β ct β
β 5. Write: PQGR β version β kem_ct β nonce β β
β salt β aes_ct β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DECRYPTION β
β β
β 1. Parse PQGR envelope β
β 2. ML-KEM-768 decapsulate(ct, dk) β shared_secret β
β 3. HKDF-SHA256(shared_secret, salt) β aes_key β
β 4. AES-256-GCM decrypt(aes_key, nonce, aes_ct) β
β 5. Output plaintext β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Quick startβ
# Install
cargo install pqguard
# Generate keypair
pqguard keygen
# Encrypt a file
pqguard encrypt secret.txt --recipient public_key.pqg.pub
# Multi-recipient β any listed private key can decrypt
pqguard encrypt secret.txt -r alice.pqg.pub -r bob.pqg.pub
# Decrypt
pqguard decrypt secret.pqg --private-key private_key.pqg.key
π Commandsβ
| Command | Description |
|---|---|
pqguard keygen | Generate ML-KEM-768 keypair |
pqguard encrypt <file> -r <pubkey> | Encrypt file for one recipient |
pqguard encrypt <file> -r <a> -r <b> | Multi-recipient (v2 envelope) |
pqguard decrypt <file> -k <privkey> | Decrypt file with private key |
pqguard verify <file> | Verify pqguard file integrity |
pqguard info <keyfile> | Show key information |
π Algorithm Detailsβ
| Component | Algorithm | Standard |
|---|---|---|
| Key Exchange | ML-KEM-768 (Kyber768) | NIST FIPS 203 |
| Key Derivation | HKDF-SHA256 | RFC 5869 |
| Symmetric Encryption | AES-256-GCM | NIST SP 800-38D |
π Benchmarksβ
| Operation | Time |
|---|---|
| Keygen | ~150ΞΌs |
| Encapsulate | ~25ΞΌs |
| Decapsulate | ~30ΞΌs |
| AES-256-GCM (1MB) | ~0.5ms |
π§ͺ Why Post-Quantum?β
Classical cryptography (RSA, ECDH) will be broken by quantum computers running Shor's algorithm. NIST finalized post-quantum standards in 2024:
- ML-KEM (FIPS 203) β Key encapsulation
- ML-DSA (FIPS 204) β Digital signatures
- SLH-DSA (FIPS 205) β Hash-based signatures
The "harvest now, decrypt later" threat means data encrypted today with classical algorithms can be decrypted by future quantum computers. pqguard protects against this.