feat: post-quantum dual-signature (Ed25519 + Dilithium3)#6
Closed
HaraldeRoessler wants to merge 1 commit into
Closed
feat: post-quantum dual-signature (Ed25519 + Dilithium3)#6HaraldeRoessler wants to merge 1 commit into
HaraldeRoessler wants to merge 1 commit into
Conversation
Add quantum-safe signing to all Verifiable Credentials using ML-DSA-65 (Dilithium3) from liboqs (Open Quantum Safe, MIT licensed). Architecture: - app/crypto/dilithium.py: Dilithium3 key management, sign, verify with KMS-encrypted key support and plaintext fallback for dev - app/crypto/hybrid.py: dual_sign() produces both Ed25519 and Dilithium proofs; verify_proof() validates single or dual proofs - Graceful degradation: if Dilithium keys are not configured, falls back to Ed25519-only (no breaking change on deploy) Changes: - credentials.py: issue_credential() now uses dual_sign(), verify uses verify_proof() supporting legacy single-proof and new dual-proof - endorsement.py: endorsement VCs use dual_sign() - main.py: DID document dynamically includes Dilithium verification key when configured, with legacy key-1 alias for backward compatibility - scripts/generate_dilithium_keys.py: utility to generate keypair Migration path (from earlier discussion): Phase 1 (this PR): dual-signature, Ed25519 + Dilithium Phase 2 (future): Dilithium-first, Ed25519 deprecated Phase 3 (future): Ed25519 sunset Dependency: liboqs-python (pip install liboqs-python) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Superseded by #7 which combines JCS + PQC to avoid merge conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add quantum-safe signing to all Verifiable Credentials using ML-DSA-65 (Dilithium3) via liboqs (MIT licensed).
Every credential is now signed with both Ed25519 and Dilithium3. Old verifiers check Ed25519 and ignore Dilithium. New verifiers check both. This is Phase 1 of the PQC migration.
New files
app/crypto/dilithium.pyapp/crypto/hybrid.pydual_sign()andverify_proof()for single or dual proofsscripts/generate_dilithium_keys.pyModified files
app/credentials.pyissue_credential()usesdual_sign(),verify_credential()supports both formatsapp/swarm/endorsement.pydual_sign()app/main.pyGraceful degradation
If
DILITHIUM_PRIVATE_KEY_HEX(or KMS equivalent) is not set, the system issues Ed25519-only credentials exactly as before. No breaking change on deploy. Enable PQC by:Credential format
Before (Ed25519 only):
{"proof": {"type": "Ed25519Signature2020", "proofValue": "64 bytes..."}}After (dual-signature):
{"proof": [ {"type": "Ed25519Signature2020", "verificationMethod": "...#key-ed25519", "proofValue": "64 bytes..."}, {"type": "DilithiumSignature2026", "verificationMethod": "...#key-dilithium", "proofValue": "~2420 bytes..."} ]}Migration path
Test plan
/credentials/verify/.well-known/did.jsonincludes Dilithium key when configuredGenerated with Claude Code