dCypher is an open-source, easy-to-deploy, production-ready Recryption (recryption) proxy that enables private, shareable, and revocable cloud storage.
The goal of dCypher is to fundamentally change how we interact with cloud storage. It flips the game board so you can store your data on any cloud provider, without that provider ever having access to the unencrypted data. At the same time, you can securely share that data with any other individual or group and revoke their access at any time.
This project solves a major missing component in decentralized systems, bringing them closer to par with their centralized equivalents by offering secure access control over encrypted data stored with untrusted intermediaries.
dCypher acts as a proxy that can take ciphertext encrypted for a specific private key and recrypt it for a different private key, without ever decrypting the data itself. This technique, known as Proxy Recryption (PRE), allows a storage provider to serve data to authorized users on behalf of the data owner, without having access to the plaintext or the owner's private keys.
We use the excellent OpenFHE library to implement lattice-based cryptography, making the system quantum-resistant.
- Untrusted Storage: Store your data on any S3-compatible cloud service, a local server, or even a Raspberry Pi, with the guarantee that the provider cannot read it.
- Secure, Revocable Sharing: Delegate and revoke read access to your encrypted files for any user/public key via a simple ACL API.
- Quantum-Resistant: Designed with post-quantum cryptography (PQC) to ensure long-term data security.
- Flexible Deployment: Architected to be deployed on cloud hardware, local servers, or scalable "serverless" platforms.
- Open Source: Free to use and build upon under a permissive license (MIT/Apache).
dCypher is a core component of the IdentiKey vision for a user-controlled internet where individuals maintain sovereignty over their digital identities and data.
Learn more about the technology and our vision at identikey.io/recryption.
dCypher includes an innovative identifier system called HDprint with Paiready that generates human-readable, error-resistant identifiers for cryptographic objects like public or private keys, certificates, cryptocurrency, and encrypted data references.
- Self-Correcting: Automatically fixes single-character typos in checksums using BCH error correction codes
- Case-Insensitive Input: Type everything in lowercase - the system restores proper mixed-case formatting
- Hierarchical Scaling: Multiple security levels from 17.6 bits (testing) to 158.2+ bits (production)
- Human-Friendly: Visual structure with underscores, Base58 encoding avoids confusing characters
- Cryptographically Strong: HMAC-SHA3-512 chain with BLAKE3 preprocessing for collision resistance
Pattern: {paiready}_{hdprint}
Example: myzgemb_5ubrZa_T9w1LJRx_hEGmdyaM
Components:
- Paiready checksum: 'myzgemb' (error-correcting, base58 lowercase)
- HDprint fingerprint: '5ubrZa_T9w1LJRx_hEGmdyaM' (hierarchical, base58 mixed-case)
Original identifier: 4pkabdr_6QqqSV_GjsEbLU5_c8AJmdYG
User types (all lowercase, 2 typos in checksum):
User input: 1pk2bdr_6qqqsv_gjseblu5_c8ajmdyg
System automatically corrects:
Final identifier: 4pkabdr_6QqqSV_GjsEbLU5_c8AJmdYG
Process:
- BCH error correction fixes typos in checksum
- Bit field unpacking restores original mixed case in HDprint
- User gets canonical identifier despite typing errors
TINY mwrjzs1_zF1tjX
Security: 17.6 bits, Checksum: mwrjzs1
SMALL k68q6ci_zF1tjX_hhdbg5W6
Security: 64.4 bits, Checksum: k68q6ci
MEDIUM ajqkgas_zF1tjX_hhdbg5W6_fJN8yZJV
Security: 111.3 bits, Checksum: ajqkgas
RACK 38qhkje_zF1tjX_hhdbg5W6_fJN8yZJV_D9UMe8J6
Security: 158.2 bits, Checksum: 38qhkje
- Public Key Fingerprints: Human-verifiable identifiers for cryptocurrency wallets and PKI certificates
- Database References: Error-resistant record IDs that users can manually verify
- API Keys & Tokens: Built-in error detection for authentication systems
- QR Code Content: Remains scannable even with minor visual damage
- CLI Tools: Forgiving input processing for manually-entered identifiers
This identifier system is particularly valuable in dCypher's proxy recryption context, where users need to reliably reference and share cryptographic keys and encrypted data objects.
This project uses Just for task automation as opposed to Make.
Run just
to see all available recipes, or use these common commands:
build-all
# Build both OpenFHE C++ and Python bindingsbuild-liboqs
# Clone and build liboqs C library locally (not system-wide)build-openfhe
# Build OpenFHE C++ library locally (not system-wide)build-openfhe-python
# Build OpenFHE Python bindings using local C++ libraryclean
# Clean all buildsclean-liboqs
# Clean liboqs buildsclean-openfhe
# Clean OpenFHE buildscli *args
# Run the CLI locally with uvdefault
# Show available tasksdev-cli *args
# Run CLI in development containerdev-down
# Stop development environmentdev-rebuild
# Rebuild and restart development environmentdev-shell
# Open an interactive bash shell in the development containerdev-test
# Run tests in development containerdev-up
# Start development environment with volume mountingdocker-bash
# Open an interactive bash shell in the Docker containerdocker-build-dev
# Build the development Docker imagedocker-built
# Build the Docker imagedocker-cli *args
# Run the CLI in Docker containerdocker-exec command
# Run a custom command in the Docker containerdocker-run
# Run the Docker containertest
# Quick local development
just cli
# Build and test with Docker
just docker-build
just docker-run
# Debug in container
just docker-bash
# Run tests in container
just docker-exec "python -m pytest"
## Documentation
The detailed message specification can be found in [docs/spec.md](docs/spec.md).
## Library
The core PRE logic is implemented in `src/lib/pre.py`.
## Tests
To run the tests, execute the following command:
```bash
just build-all
just test
Note: The Python implementation uses OpenFHE which requires Linux, so local development on macOS requires Docker.
# Build and run the Python proof of concept
just docker-build
just docker-run
# Build the Zig project
zig build
# Run tests
zig build test
# Build and run in one step
zig build run
# Run the Python CLI in Docker
just docker-cli --help
# Generate a key pair
./zig-out/bin/dcypher keygen --output alice_keys.json
# Generate another key pair
./zig-out/bin/dcypher keygen --output bob_keys.json
# Generate recryption key from Alice to Bob
./zig-out/bin/dcypher rekey --from alice_keys.json --to bob_keys.json --output alice_to_bob.json
# Encrypt data with Alice's key
./zig-out/bin/dcypher encrypt --key alice_keys.json --input message.txt --output encrypted.bin
# Recrypt data for Bob using the recryption key
./zig-out/bin/dcypher recrypt --rekey alice_to_bob.json --input encrypted.bin --output recrypted.bin
# Bob decrypts the data with his key
./zig-out/bin/dcypher decrypt --key bob_keys.json --input recrypted.bin --output message_decrypted.txt
# Start the HTTP server
./zig-out/bin/dcypher serve --port 8080
Start the server:
./zig-out/bin/dcypher serve --port 8080
Available endpoints:
GET /health
- Health checkPOST /api/keygen
- Generate key pairPOST /api/rekey
- Generate recryption keyPOST /api/encrypt
- Encrypt dataPOST /api/recrypt
- Recrypt dataPOST /api/decrypt
- Decrypt data
Example request:
curl -X POST http://localhost:8080/api/keygen
dcypher/
├── src/ # Python implementation
│ ├── cli.py # Python CLI
│ └── lib/ # Python libraries
├── tests/ # Python tests
├── Dockerfile # Docker build for Python
├── Justfile # Task automation for Python/Docker
├── pyproject.toml # Python dependencies
├── build.zig # Main Zig build configuration
├── build.zig.zon # Zig package dependencies
├── build_openfhe.zig # OpenFHE integration build
├── openfhe.zig # Zig OpenFHE bindings
├── openfhe_wrapper.cpp # C++ wrapper for OpenFHE
├── openfhe_wrapper.h # C++ header
└── src/ # Zig implementation (TODO: rename to avoid conflict)
├── main.zig # CLI application entry point
├── root.zig # Library exports
├── cli.zig # Command-line argument parsing
├── server.zig # HTTP server implementation
├── crypto.zig # Cryptographic operations (stubbed)
└── tests.zig # Integration tests
-
✅ OpenFHE integration working
-
✅ Docker containerization
-
✅ Basic CLI interface
-
✅ Proxy recryption example
-
✅ Project structure and build system
-
✅ CLI argument parsing
-
✅ HTTP server with REST endpoints
-
✅ File I/O operations
-
✅ JSON serialization/deserialization
-
❌ Actual proxy recryption cryptography implementation
-
❌ Integration with OpenFHE via C++ wrapper
-
❌ Production-ready error handling
When implementing the actual cryptography:
- Use constant-time operations to prevent timing attacks
- Properly handle key generation with secure randomness
- Implement proper key serialization with integrity checks
- Add input validation and sanitization
- Consider memory safety for sensitive data
[Add your license here]