Skip to content

identikey/dcypher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

dCypher: Quantum-Resistant Proxy Recryption System

Status: πŸš€ Implementation Phase
Version: 2.0 (Rust)


Overview

dCypher is a production-ready proxy recryption system enabling secure, revocable file sharing with untrusted storage providers. Built on lattice-based cryptography (OpenFHE) with post-quantum signatures (liboqs), it provides end-to-end encryption where files can be shared without exposing private keys or plaintext.

Core Innovation

Proxy Recryption: Transform ciphertext encrypted for Alice into ciphertext for Bob without ever decrypting. The storage provider facilitates sharing without accessing plaintext.

Hybrid Encryption: KEM-DEM architecture with pluggable PRE backends (lattice for post-quantum, EC for classical). Symmetric encryption (XChaCha20 + Bao) handles bulk data.

Self-Correcting Identifiers: HDprint provides human-readable identifiers that automatically correct typos and restore proper case from lowercase input.


Current Status

βœ… Phase 0: Planning β€” COMPLETE

  • Implementation plan (docs/IMPLEMENTATION_PLAN.md)
  • All design decisions documented
  • Workspace structure defined

πŸ”² Implementation Phases

Phase Description Status
1 FFI Bindings (OpenFHE + liboqs) πŸ”²
2 Core Cryptography (PRE traits, hybrid encryption) πŸ”²
3 Protocol Layer (Protobuf, Bao) πŸ”²
4 Storage Client (S3-compatible) πŸ”²
4b Auth Service (identikey-storage-auth) πŸ”²
5 HDprint (parallelizable) πŸ”²
6 Recryption Proxy Server πŸ”²
7 CLI Application πŸ”²
8 Minimal TUI πŸ”²

Timeline: 10-12 weeks to production-ready


Repository Structure

dcypher/
β”œβ”€β”€ README.md
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ IMPLEMENTATION_PLAN.md    # πŸ“‹ Master plan - READ THIS FIRST
β”‚   β”œβ”€β”€ hybrid-encryption-architecture.md
β”‚   β”œβ”€β”€ pre-backend-traits.md
β”‚   β”œβ”€β”€ storage-design.md
β”‚   β”œβ”€β”€ wire-protocol.md
β”‚   └── ...                       # Other design docs
β”‚
β”œβ”€β”€ python-prototype/             # πŸ“¦ ARCHIVED: Reference implementation
β”‚   β”œβ”€β”€ src/dcypher/
β”‚   β”œβ”€β”€ tests/
β”‚   └── docs/
β”‚
β”œβ”€β”€ vendor/                       # Third-party dependencies
β”‚   β”œβ”€β”€ openfhe-development/
β”‚   β”œβ”€β”€ liboqs/
β”‚   └── ...
β”‚
└── [Rust workspace - Phase 1+]
    β”œβ”€β”€ crates/
    β”‚   β”œβ”€β”€ dcypher-ffi/
    β”‚   β”œβ”€β”€ dcypher-core/
    β”‚   β”œβ”€β”€ dcypher-proto/
    β”‚   β”œβ”€β”€ dcypher-storage/
    β”‚   └── dcypher-hdprint/
    β”œβ”€β”€ dcypher-cli/
    β”œβ”€β”€ dcypher-server/
    β”œβ”€β”€ dcypher-tui/
    └── identikey-storage-auth/

Quick Start (Coming Soon)

# Phase 1+: Build from source
cargo build --release

# Generate identity
dcypher identity new --output alice.json

# Encrypt file
dcypher encrypt myfile.txt --for <bob-pubkey> --output myfile.enc

# Share with Bob (generates recryption key)
dcypher share create <file-hash> --to <bob-pubkey>

# Bob downloads (server recrypts on-the-fly)
dcypher share download <share-id> --output myfile.txt

Key Features

πŸ” Cryptography

  • OpenFHE BFVrns for lattice-based proxy recryption
  • ED25519 for classical signatures
  • ML-DSA-87 (mandatory) + optional PQ algorithms
  • Multi-signature authorization (all keys must sign)

πŸ’Ύ Storage

  • S3-compatible storage layer (Minio for dev, any S3 for prod)
  • Authenticated access via file hash lookup
  • Chunked streaming for large files
  • Content-addressed storage

🎯 HDprint Identifiers

  • Error correction: Automatically fixes single-character typos
  • Case restoration: Type lowercase, get proper mixed-case
  • Hierarchical scaling: 17.6 to 158+ bits security
  • Human-friendly: Base58 encoding, visual separators

🌐 API & Interfaces

  • HTTP REST API (Axum framework)
  • CLI application with rich interactions
  • Minimal TUI for visual operations

Design Philosophy

Key Decisions

Area Decision
Encryption Hybrid KEM-DEM with pluggable PRE backends
Hashing Blake3 everywhere (HMAC-SHA3-512 for HDprint only)
Verification Blake3/Bao tree mode for streaming
Wire format Protobuf (primary), ASCII armor (export)
Storage Content-addressed S3 + auth service
Signatures ED25519 (classical) + ML-DSA-87 (post-quantum)

Changes from Python Prototype

Removed Added
ECDSA/SECP256k1 Pluggable PRE backends (lattice + EC)
Naive file storage S3-compatible + auth service
Custom Merkle trees Blake3/Bao streaming verification
Mixed hashing Blake3 standardized

Clean Slate: No compatibility with Python prototype (different serialization, no production deployments)


Documentation

Design Documents

Document Description
docs/hybrid-encryption-architecture.md KEM-DEM with pluggable PRE backends
docs/pre-backend-traits.md PreBackend trait hierarchy
docs/storage-design.md S3 + auth service architecture
docs/wire-protocol.md Protobuf + ASCII armor formats
docs/verification-architecture.md Blake3/Bao streaming verification
docs/hashing-standard.md Blake3 standardization
docs/non-determinism.md Crypto testing strategy
docs/hdprint-specification.md HDprint identifier system
docs/hmac-analysis.md HMAC usage (HDprint only)

Development

Prerequisites

  • Rust 1.75+ (stable)
  • OpenFHE C++ library
  • liboqs (post-quantum crypto)
  • Docker (for Minio development environment)

Python Prototype (Archived)

The original Python proof-of-concept is preserved in python-prototype/ for reference. It demonstrated the feasibility of proxy recryption with post-quantum signatures and includes a full TUI implementation.

To explore the prototype:

cd python-prototype
# See python-prototype/README.md for setup instructions

Note: The Python implementation is archived and not actively maintained. All new development is in Rust.


Terminology

  • Recryption: Transformation of ciphertext from one key to another (not "re-encryption")
  • Recryption Key: The key that enables recryption transformation (not "rekey" or "re-encryption key")
  • Recrypted: Data that has undergone recryption transformation

This terminology is standardized throughout the Rust implementation.


Architecture Highlights

Crates

Crate Purpose
dcypher-ffi OpenFHE + liboqs FFI bindings
dcypher-core PRE backends, hybrid encryption, signatures
dcypher-proto Wire protocol (Protobuf + Bao)
dcypher-storage S3-compatible storage client
dcypher-hdprint Self-correcting identifiers
identikey-storage-auth Auth service for storage access

Binaries

Binary Purpose
dcypher-server Recryption proxy (streams KEM ciphertext, holds recrypt keys)
dcypher-cli Command-line interface
dcypher-tui Minimal terminal UI

Security Model

Trust Assumptions

Component Trust Level Notes
Storage provider Untrusted Sees only ciphertext + wrapped keys
Recryption proxy Semi-trusted Has recrypt keys, not secret keys; self-hostable
Auth service Trusted Controls access; can be self-hosted
Client Trusted Holds secret keys

Cryptographic Guarantees

  • E2E Encryption: Only key holders decrypt (plaintext never leaves client)
  • Quantum Resistance: Lattice-based PRE + ML-DSA-87 signatures
  • Forward Secrecy: Per-file random symmetric keys
  • Streaming Integrity: Blake3/Bao verification during download

Contributing

See docs/IMPLEMENTATION_PLAN.md for current phase and open tasks.


License

[License TBD]


Links


β†’ docs/IMPLEMENTATION_PLAN.md for full implementation details

About

dCypher is a homomorphic recryption cryptosystem

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •