zkEnc

Witness encryption made practical: encrypt with statements, decrypt with proofs—using Circom.

zkEnc

Created At

ETHOnline 2025

Project Description

Witness Encryption enables a new paradigm: encrypt data that can only be decrypted when specific real-world conditions are proven—without requiring a secret key holder.

Our implementation makes this powerful primitive accessible to developers. Encrypt messages with programmable conditions like "unlock when this payment is verified" or "decrypt when this computation result is proven." Built on Circom compatibility, developers can use existing zero-knowledge circuits without learning new languages.

Use cases: trustless escrows, conditional access control, time-locked disclosures, and automated secret reveals based on verifiable events.

How it's Made

zkenc is built for production deployment with a focus on developer experience and cross-platform compatibility.

Core Implementation:

  • Rust core (zkenc-core): Custom R1CS/QAP transformer + WKEM implementation using arkworks (BN254 curve)
  • WASM compilation: Universal JavaScript support (browser + Node.js)
  • Cross-platform tools: zkenc-js (TypeScript, type-safe) + zkenc-cli (Rust, standalone binary)
  • Unified format: Single binary ciphertext works across all tools Direct Circom integration: Uses .r1cs and .wasm files directly, built-in witness calculator

Security Stack:

  • WKEM (Witness Key Encapsulation) for cryptographic binding
  • AES-256-GCM authenticated encryption
  • Blake3 KDF for key derivation

Engineering Highlights:

  • Multi-layer architecture: Rust core → CLI tool + WASM bridge → JavaScript library
  • Cross-platform consistency: Identical cryptographic operations across Rust CLI and JavaScript
  • Smart ciphertext format: Optional public input embedding with flag byte for flexible workflows
  • Developer tooling: Interactive web playground, comprehensive documentation, example circuits
  • Testing: End-to-end tests validating CLI-to-JS and JS-to-CLI encryption/decryption interoperability

Cryptographic Innovation:

The scheme is based on original research adapting Groth16 protocols for witness encryption, currently under peer review at a cryptography conference. Academic reviewers have validated the core construction. Unlike theoretical approaches requiring impractical primitives (iO, trusted parties), our implementation is deployable today.

Impact:

First practical witness encryption tool. Developers can implement programmable conditional encryption using familiar Circom—no specialized cryptographic expertise required. Enables trustless escrows, conditional access, time-locked disclosures, and automated secret reveals.

background image mobile

Join the mailing list

Get the latest news and updates