Skip to content

Commit bfc1510

Browse files
committed
quantum safe encryption
1 parent 26fc469 commit bfc1510

8 files changed

Lines changed: 1096 additions & 23 deletions

File tree

Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Fula Storage provides an Amazon S3-compatible API backed by a decentralized netw
1111

1212
- **🌐 Decentralization**: Data is stored across a network of individually owned IPFS nodes
1313
- **🔒 End-to-End Encryption**: Client-side HPKE encryption - storage nodes never see your data
14+
- **🛡️ Quantum-Safe Cryptography**: Hybrid X25519 + ML-KEM-768 (NIST FIPS 203) for post-quantum security
1415
- **✅ Verified Streaming**: BLAKE3/Bao ensures data integrity from untrusted nodes
1516
- **🔄 Conflict-Free Sync**: CRDT-based metadata for distributed updates
1617
- **📈 Efficient Indexing**: Prolly Trees for O(log n) bucket operations
@@ -44,9 +45,10 @@ Fula Storage provides an Amazon S3-compatible API backed by a decentralized netw
4445
│ │ IPFS │ IPFS Cluster │ Chunking │ │
4546
│ └─────────────┴──────────────┴──────────────────────┘ │
4647
├─────────────────────────────────────────────────────────────┤
47-
│ fula-crypto
48+
│ fula-crypto (Quantum-Safe)
4849
│ ┌─────────────┬──────────────┬──────────────────────┐ │
49-
│ │ HPKE │ BLAKE3 │ Bao │ │
50+
│ │ Hybrid KEM │ BLAKE3 │ Bao │ │
51+
│ │ X25519+MLKEM│ │ │ │
5052
│ └─────────────┴──────────────┴──────────────────────┘ │
5153
└─────────────────────────────────────────────────────────────┘
5254
```
@@ -210,7 +212,7 @@ let etag = upload_large_file(
210212

211213
| Crate | Description |
212214
|-------|-------------|
213-
| `fula-crypto` | Cryptographic primitives (HPKE, BLAKE3, Bao) |
215+
| `fula-crypto` | Quantum-safe cryptography (Hybrid X25519+ML-KEM, HPKE, BLAKE3, Bao) |
214216
| `fula-blockstore` | IPFS block storage and chunking |
215217
| `fula-core` | Storage engine (Prolly Trees, CRDTs) |
216218
| `fula-cli` | S3-compatible gateway server |
@@ -288,6 +290,36 @@ cargo run --example flat_namespace_demo
288290

289291
## Security
290292

293+
### 🛡️ Quantum-Safe Cryptography
294+
295+
Fula implements **post-quantum cryptographic protection** using a hybrid approach that provides defense-in-depth:
296+
297+
| Component | Algorithm | Security Level |
298+
|-----------|-----------|----------------|
299+
| Key Encapsulation | **X25519 + ML-KEM-768** | Hybrid classical + post-quantum |
300+
| Symmetric Encryption | AES-256-GCM / ChaCha20-Poly1305 | 256-bit (quantum-resistant) |
301+
| Hashing | BLAKE3 | 256-bit (quantum-resistant) |
302+
| Integrity | Bao (BLAKE3-based) | Verified streaming |
303+
304+
**Why Hybrid?**
305+
- If quantum computers break X25519 (Shor's algorithm), ML-KEM-768 still protects your data
306+
- If ML-KEM has unforeseen weaknesses, X25519 still provides classical security
307+
- ML-KEM-768 is NIST FIPS 203 standardized (formerly Kyber768)
308+
309+
```rust
310+
use fula_crypto::{HybridKeyPair, hybrid_encapsulate, hybrid_decapsulate};
311+
312+
// Generate quantum-safe keypair (X25519 + ML-KEM-768)
313+
let keypair = HybridKeyPair::generate();
314+
315+
// Sender encapsulates shared secret
316+
let (encapsulated_key, shared_secret) = hybrid_encapsulate(keypair.public_key())?;
317+
318+
// Recipient decapsulates
319+
let recovered = hybrid_decapsulate(&encapsulated_key, keypair.secret_key())?;
320+
assert_eq!(shared_secret, recovered);
321+
```
322+
291323
### Trust Model
292324

293325
- **Storage nodes are untrusted**: All sensitive data is encrypted client-side

crates/fula-crypto/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ md-5 = { workspace = true }
2222
x25519-dalek = { workspace = true }
2323
ed25519-dalek = { workspace = true }
2424

25+
# Post-Quantum Cryptography (NIST ML-KEM / Kyber)
26+
pqc_kyber = { version = "0.7", features = ["kyber768", "90s"] }
27+
hkdf = "0.12"
28+
2529
# Serialization
2630
serde = { workspace = true }
2731
serde_json = { workspace = true }

0 commit comments

Comments
 (0)