Skip to content

About

Zero-Knowledge Sovereign Identity & Merkle Membership Cryptographic Engine (RFC 3526 MODP, Pedersen Commitments, CDS94 ZKP)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

⬡ ZK Merkle Credential Vault

ZK Cryptography CI Live Cryptography Studio License: MIT Python 3.10+ RFC 3526 Group 14

Zero-Knowledge Sovereign Identity & Merkle Membership Engine
Enables sovereign agents and human operators to prove valid organizational membership, authenticated keypair ownership, and attribute threshold clearance without revealing private keys or leaking confidential attribute values.


🔬 Core Cryptographic Architecture

                       +-----------------------------------+
                       |    Issuer Merkle State Root (R)   |
                       +-----------------+-----------------+
                                         ^
                        Hash Pair (L, R) |
                                         |
                       +-----------------+-----------------+
                       |    Authentication Path Siblings   |
                       |    (h_0, L) -> (h_1, R) -> ...    |
                       +-----------------+-----------------+
                                         ^
                                         | Leaf Hash = SHA256(LeafData)
                       +-----------------+-----------------+
                       |     Blinded Vault Credential      |
                       | CredID | PK_subject | Dept | C_attr|
                       +-----------------+-----------------+
                                         |
     +-----------------------------------+-----------------------------------+
     |                                                                       |
     v                                                                       v
[Schnorr NIZK Protocol]                                     [Pedersen & CDS94 1-of-K ZKP]
Prove: Know x s.t. PK = g^x (mod p)                         Prove: C = g^m * h^r (mod p)
T = g^v (mod p)                                             where m in {threshold, ..., 5}
c = Hash(g, PK, T, context)                                WITHOUT disclosing exact m!
s = (v - c * x) (mod q)                                     Simulate false branches
Verify: g^s * PK^c == T (mod p)                             Link challenge sum: sum(e_i) == c_total
Zero secret bits leaked!                                    Zero attribute bits leaked!

⚡ Key Capabilities

  1. RFC 3526 2048-bit MODP Safe Prime Group:
    • Strictly operating within the cyclic prime-order subgroup of order $q = \frac{p-1}{2}$.
    • Deterministic Nothing-Up-My-Sleeve secondary generator $h$ derived via SHA-256 square residue to guarantee unknown discrete logarithm $\log_g h$.
  2. Sparse Merkle Tree & Membership Proofs:
    • $O(\log N)$ logarithmic verification paths.
    • Deterministic canonical serialization ensuring leaf ordering and resistance against second-preimage attacks.
    • Live tamper detection with immediate avalanche rejection.
  3. Non-Interactive Schnorr Proofs of Knowledge (Fiat-Shamir):
    • Proves possession of the sovereign credential holder's private key $x$ without revealing it over untrusted transport.
  4. Pedersen Attribute Commitments:
    • Information-theoretically hiding (computationally impossible for the verifier to determine clearance even with infinite compute) and computationally binding under the Discrete Logarithm assumption.
  5. CDS94 1-of-K Disjunctive Range / Threshold Proofs:
    • Proves an operator's clearance meets a facility requirement ($m \ge 3$) by demonstrating $m \in {3, 4, 5}$ using simulated challenge distribution without revealing which specific tier they possess.
  6. Dual-Stack Runtime:
    • Python 3 cryptographic backend with comprehensive pytest suite.
    • Pure client-side WebCrypto / BigInt JavaScript implementation running live on GitHub Pages.

🛠 Project Structure

zk-merkle-credential-vault/
├── crypto/
│   ├── merkle.py            # Sparse Merkle Tree, leaf generation, inclusion proofs
│   ├── zkp.py               # RFC 3526 group, Schnorr NIZK, Pedersen, CDS94 1-of-K
│   └── vault.py             # Sovereign identity, blinded issuance, verification pipeline
├── tests/
│   └── test_crypto.py       # 15 comprehensive unit tests (Pytest)
├── web/
│   ├── index.html           # Cryptographic laboratory interface
│   ├── style.css            # Cyber-dark theme & glowing SVG visualizer styles
│   ├── crypto_runtime.js    # In-browser BigInt & WebCrypto cryptographic engine
│   └── app.js               # Interactive Merkle tree rendering & ZK verification
├── server.py                # Standalone HTTP server & JSON state API
├── requirements.txt         # Dependencies (pytest>=8.0.0)
├── .github/workflows/
│   ├── ci.yml               # Automated GitHub Actions test runner
│   └── deploy-pages.yml     # Automated GitHub Pages static deployment
├── LICENSE                  # MIT License
└── README.md

🚀 Quickstart & Verification

1. Run Automated Test Suite

Clone and execute the 15-test cryptographic verification suite:

git clone https://github.com/JayNabasu/zk-merkle-credential-vault.git
cd zk-merkle-credential-vault

# Install dependencies
pip install -r requirements.txt

# Run pytest
pytest tests/ -v

2. Launch Local Cryptographic Laboratory

Launch the built-in HTTP server to explore the visual Merkle Tree and live ZK Gateway:

python server.py
# Open http://localhost:8080 in your browser

🌐 Live Interactive Studio

Experience the production deployment directly in your browser without installing anything:
🔗 https://jaynabasu.github.io/zk-merkle-credential-vault/

  • Interactive Merkle Tree: Click any credential to watch its sibling authentication path illuminate in glowing gold and cyan up to the Merkle Root.
  • Tamper Simulator: Inject malicious bitflips into leaf payloads and observe the immediate cryptographic cascade that breaks proof verification.
  • ZK Access Gate: Test credential presentations against real clearance gates ($L \ge 2, 3, 4, 5$) with live verification auditing.

🔒 Mathematical Guarantees

Property Implementation Mathematical Guarantee
Completeness Schnorr & CDS94 Any honest prover possessing a valid key and credential will always be accepted ($P(\text{accept}) = 1$).
Special Soundness Fiat-Shamir Heuristic A cheating prover without knowledge of $x$ or $m$ can forge a valid proof with probability $\le 2^{-256}$.
Zero-Knowledge Perfect Blinding The verifier transcript is statistically indistinguishable from a simulation generated without the witness.
Tamper Resistance SHA-256 Merkle Root Modifying 1 bit of credential data invalidates the entire Merkle path with avalanche probability $1 - 2^{-256}$.

👤 Author

Jerry A. Nabasu
GitHub: @JayNabasu
Focus: Enterprise Architecture, Autonomous Systems, Applied Cryptography & Distributed Systems.

About

Zero-Knowledge Sovereign Identity & Merkle Membership Cryptographic Engine (RFC 3526 MODP, Pedersen Commitments, CDS94 ZKP)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages