latticearc
LatticeArc is a post-quantum cryptography library for Rust that implements all four NIST PQC standards (FIPS 203–206) with a FIPS 140-3 validated backend. It ships as one library crate with a use-case-driven API — you describe what you're protecting, the library selects the right algorithm, security level, and compliance mode automatically. Hybrid (PQ + classical) by default for defense-in-depth, with PQ-only mode available for CNSA 2.0.
Why LatticeArc?
| Without LatticeArc | With LatticeArc |
|---|---|
| ~50 lines for hybrid encryption | 3 lines |
| Research 4 NIST standards, 11 parameter sets | UseCase::HealthcareRecords auto-selects |
| Wire up ML-KEM + X25519 + HKDF + AES-GCM | EncryptKey::Hybrid(&pk) |
| Manual secret zeroization, constant-time comparisons | Automatic via Zeroize + subtle |
| Read CNSA 2.0 to know when hybrid vs PQ-only | CryptoMode::Hybrid / CryptoMode::PqOnly |
Quick Start
[]
= "0.6"
Hybrid Encryption (Recommended)
use ;
// ML-KEM-768 + X25519 + HKDF-SHA256 + AES-256-GCM — selected automatically
let = generate_hybrid_keypair?;
let encrypted = encrypt?;
let decrypted = decrypt?;
PQ-Only Encryption (CNSA 2.0)
use ;
// ML-KEM-768 + HKDF-SHA256 + AES-256-GCM — no classical component
let = generate_pq_keypair
.map_err?;
let config = new.crypto_mode;
let encrypted = encrypt?;
let decrypted = decrypt?;
Digital Signatures
use ;
// ML-DSA-65 + Ed25519 hybrid signature
let config = new;
let = generate_signing_keypair?;
let signed = sign_with_key?;
assert!;
Use Case Selection
use ;
// Library selects ML-KEM-1024 + X25519 for government classified data
let = generate_hybrid_keypair?;
let encrypted = encrypt?;
Configuration
Two orthogonal axes control algorithm selection:
new
.use_case // what you're protecting (22 use cases)
.crypto_mode // hybrid or PQ-only
.security_level // NIST level 1/3/5
.compliance // regulatory requirements
.session // optional zero-trust verification
Security Levels
| Level | NIST Level | Encryption (Hybrid) | Encryption (PQ-only) |
|---|---|---|---|
Maximum |
5 | ML-KEM-1024 + X25519 + AES-256-GCM | ML-KEM-1024 + AES-256-GCM |
High (default) |
3 | ML-KEM-768 + X25519 + AES-256-GCM | ML-KEM-768 + AES-256-GCM |
Standard |
1 | ML-KEM-512 + X25519 + AES-256-GCM | ML-KEM-512 + AES-256-GCM |
Compliance Modes
| Mode | FIPS Required | Hybrid Allowed | Use Case |
|---|---|---|---|
Default |
No | Yes | Development, general use |
Fips140_3 |
Yes | Yes | Healthcare, financial, government |
Cnsa2_0 |
Yes | No | NSA CNSA 2.0 — requires CryptoMode::PqOnly |
What's Included
| Category | Algorithms | Backend |
|---|---|---|
| PQ Key Encapsulation | ML-KEM-512/768/1024 (FIPS 203) | aws-lc-rs (FIPS 140-3 validated) |
| PQ Signatures | ML-DSA-44/65/87 (FIPS 204) | fips204 |
| PQ Hash Signatures | SLH-DSA (FIPS 205) | fips205 |
| PQ Lattice Signatures | FN-DSA-512/1024 (draft FIPS 206) | fn-dsa |
| Classical | Ed25519, X25519, AES-256-GCM | aws-lc-rs, ed25519-dalek |
| Hybrid Encryption | ML-KEM + X25519 + HKDF + AES-GCM | Composite |
| PQ-Only Encryption | ML-KEM + HKDF + AES-GCM | Composite |
CLI
A companion CLI tool is available for key generation, signing, encryption, and hashing — no code required:
# Use-case-driven signing
# PQ-only encryption
See latticearc-cli/README.md for the full command reference.
Key Format
Keys use the LatticeArc Portable Key (LPK) format — dual JSON + CBOR, identified by use case or security level:
let = generate_hybrid_keypair?;
let =
from_hybrid_kem_keypair?;
let json = portable_pk.to_json?; // human-readable
let cbor = portable_pk.to_cbor?; // compact binary
See docs/KEY_FORMAT.md for the full specification.
Security
- Zero
unsafecode - Constant-time comparisons via
subtle - Automatic secret zeroization via
Zeroize - CAVP test vector validation
- 27 Kani formal verification proofs
- Opaque AEAD error messages (SP 800-38D)
Feature Flags
| Feature | Description |
|---|---|
fips |
FIPS 140-3 validated backend via aws-lc-rs (requires CMake + Go) |
fips-self-test |
Power-up KAT self-tests for FIPS-boundary algorithms |
zkp-serde |
Serialization support for ZKP types |
Documentation
- API Reference
- CLI Reference
- Unified API Guide
- Key Format Specification
- Architecture
- Security Guide
- NIST Compliance
License
Apache-2.0