Post-Quantum Cryptography Migration Research for js-libp2p #3430
Replies: 3 comments 1 reply
-
Research Update: Deep Dive Findings & Concrete Implementation PlanFollowing the initial discussion post, I've completed an extensive literature review and codebase analysis. Here are the key findings and a concrete path forward. 🔬 Research CompletedI've surveyed 22 academic papers and NIST standards, analyzed the full 1. The Exact Attack Surface in js-libp2p-noiseAfter reading the full source of protected writeEE(): void {
this.ss.mixKey(this.crypto.dh(this.e, this.re)) // ← Shor's can break this
}
protected writeES(): void {
this.ss.mixKey(this.crypto.dh(this.e, this.rs)) // ← Shor's can break this
}
protected writeSE(): void {
this.ss.mixKey(this.crypto.dh(this.s, this.re)) // ← Shor's can break this
}The 2. Algorithm Decision: ML-KEM-768 via X-Wing HybridSelected approach: X-Wing (draft-connolly-cfrg-xwing-kem) X-Wing is a composite KEM that fuses X25519 and ML-KEM-768: Why X-Wing:
Key sizes:
3. Why Hybrid Over Pure PQNoisePure PQNoise (pqXX pattern from the ACM CCS 2022 paper) requires 4 message round trips instead of XX's 3, because KEMs are asymmetric (no equivalent of the symmetric The Noise HFS extension (noise_hfs_spec) adds KEM tokens to the existing XX pattern without changing the message count: Security: both classical DH AND quantum-safe KEM feed the chaining key. An adversary must break both to break the session. 4. JS Library: @noble/post-quantumnpm install @noble/post-quantum
Performance on Apple M4:
The 10× handshake overhead in CPU time is well within acceptable bounds, network RTT (>10ms) dominates connection establishment. Message overhead: +2,436 bytes across the 3 messages (all within TCP segment limits; no fragmentation needed). 5. Reference Implementations FoundThe most directly relevant references:
6. Proposed Implementation PlanI've written a detailed Phase 0 (Week 1): Environment setup, baseline benchmarks The new protocol identifier would be 7. Answers to the Key QuestionsQ1: Priority? Noise key exchange is definitely Priority 1 (SNDL risk; entire connection confidentiality). Peer identity (Ed25519 → ML-DSA) is Priority 2 but harder and out of scope for this phase. Q2: Hybrid vs Pure PQC? Hybrid mode ( Q3: Algorithm choice? ML-KEM-768 via X-Wing hybrid. NIST FIPS 203 standard, Cat. 3 security, industry consensus, already in Q4: Cross-implementation coordination? Katzenpost Go (pqXX) is already in production. For the js implementation, I'd propose coordinating via this discussion + a matching PR to libp2p/specs for Q5: Timeline? Opt-in PQC support (the Next StepsI'm starting implementation this week. I'll post updates here as each phase completes. Looking for feedback on:
|
Beta Was this translation helpful? Give feedback.
-
|
Also been thinking a bit about this - will need some spec changes, protobuf changes etc... Got a PR for ML-DSA support which might give you a starting point. Hybrid is probably the way forward similar to TLS - IIRC there is some push back on pure PQ systems In terms of JS - node has experimental support for ML-DSA & ML-KEM, @noble/post-quantum isn't audited, also there is no support in webcrypto. |
Beta Was this translation helpful? Give feedback.
-
Implementation Update: PR is upAfter completing all the phases I outlined in the previous update, the PR is now open at ChainSafe/js-libp2p-noise#665. Here is a quick summary of what got built: Core implementation (Phases 1-3)
Both Tests (Phase 5) 99 new tests across 4 spec files:
The test vectors in Benchmarks (Phase 4) Measured on Node.js v22.17.1, Windows 11 x64, pure JS:
The numbers are slower than the Apple M4 figures from the research phase since this is running on Windows x64 pure JS. A WASM-accelerated ML-KEM backend would close that gap significantly. On the @dozyio PR #3432 findings I incorporated the ML-DSA wire size analysis from our earlier exchange into On the I created On the spec location question Given this is a new handshake pattern with a new protocol ID, I think a Would love any feedback from @dozyio @achingbrain @tabcat @Faolain on the implementation or the spec, especially on whether the protocol ID naming and the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Post-Quantum Cryptography Migration Research for js-libp2p
Summary
With NIST's finalization of post-quantum cryptography standards in August 2024 (ML-KEM, ML-DSA, SLH-DSA) and the deprecation timeline targeting 2035, it's time to begin researching PQC migration paths for js-libp2p. This discussion initiates a structured research effort to assess quantum vulnerability, evaluate migration strategies, and develop a roadmap for PQC adoption.
Background
The Quantum Threat to libp2p
libp2p relies on cryptographic primitives that are vulnerable to quantum attacks:
Why Act Now?
Store-Now-Decrypt-Later (SNDL): Adversaries can capture encrypted P2P traffic today and decrypt it when quantum computers become available. Data requiring long-term confidentiality is already at risk.
NIST Timeline: NIST IR 8547 establishes deprecation of quantum-vulnerable algorithms by 2035, with high-risk systems transitioning much earlier.
Migration Complexity: Based on historical migrations (SHA-1 → SHA-256), cryptographic transitions take 5+ years. Starting research now ensures readiness.
Ecosystem Dependencies: Ethereum, IPFS, Filecoin, and other major projects depend on libp2p. Their PQC requirements will flow through to us.
Research Scope
This research will follow an adapted version of the TNO PQC Migration Handbook methodology:
Phase 1: Cryptographic Inventory
ICryptoInterfacein libp2p-noise)Phase 2: Quantum Risk Assessment
Phase 3: Technical Feasibility
Phase 4: Migration Strategies
Phase 5: Proof of Concept
Key Questions for the Community
Priority: Which components should we prioritize? (Noise key exchange seems highest due to SNDL risk)
Hybrid vs Pure PQC: Should we target hybrid mode (classical + PQC) for backward compatibility, or plan for pure PQC?
Algorithm Choice: ML-KEM-768 is the NIST standard for key exchange. Are there concerns about using it in js-libp2p?
Cross-Implementation Coordination: How do we coordinate with go-libp2p and rust-libp2p teams?
Timeline: What's a reasonable timeline for opt-in PQC support?
Relevant Resources
Prior Art
I welcome feedback, questions, and collaboration from the community. Let's work together to make js-libp2p quantum-safe!
Beta Was this translation helpful? Give feedback.
All reactions