ZTOP — Zero Trust Transfer Orchestration Protocol
ZTOP is a Python reference implementation of the Zero Trust Transfer Orchestration Protocol, an Application Layer (OSI Layer 7) protocol for cryptographically authenticated, continuously attested peer-to-peer file transfer in Zero Trust Architectures (ZTA).
Overview
Traditional file transfer protocols (SFTP, FTP) authenticate once and establish a trusted channel. ZTOP integrates every Zero Trust principle natively into the protocol itself:
| Feature | Description |
|---|---|
| Cryptographic Peer Identity | HKDF-SHA512 + Ed25519 derived from hardware device UUID |
| Continuous Attestation | 16-field Heartbeat with 8 validation checks every 10 seconds |
| 5-Layer Certificate Chain | Root CA, Org CA, Device, Session, Transfer Receipt — X.509 P384 |
| Trust Scoring | 100-point composite posture score with 7-factor evaluation |
| Policy Engine | 6 independent checks before any transfer is authorized |
| Merkle Tree Integrity | Per-chunk SHA-256 verification with proof ascent |
| Cryptographic Execution Manifest | 380-byte signed CEM prepended to every transferred file |
| Pre-Execution Static Analysis | Entropy, PE/ELF/Python behavioral analysis before delivery |
| 7-Level Signature Chain | All 7 Ed25519 signatures required for SYNC_COMPLETE |
| Trust-Preserving Reconnection | Resumes from last verified chunk after disconnect |
| Real ECDSA-P384 Audit Records | Gateway seals every transfer with real P384 signatures |
Installation
pip install ztop
Requires Python 3.11 or later.
Development installation
git clone https://github.com/sripad2020/ztop-research
cd ztop-research
pip install -e ".[dev]"
Quick Start
Start a gateway server
ztop server
# or with custom address
ztop server --host 0.0.0.0 --port 7890 --log-level DEBUG
Connect and upload a file
ztop client --file /path/to/document.pdf
# or specify target
ztop client --host 10.0.0.5 --port 7890 --file /path/to/file --device-id my-laptop --org-id acme-corp
Run the self-contained demo (no setup required)
ztop demo
Run the advanced X.509 certificate demo
ztop cert-demo
Check version
ztop version
Session Lifecycle
Client Gateway
| |
|-------- HELLO ----------------> | Phase 1: Discovery
|<------- DISCOVER --------------- |
|-------- REGISTER -------------> | Phase 2: Identity
|<------- IDENTITY_REQUEST ------- | Ed25519 challenge issued
|-------- IDENTITY_RESPONSE ----> | 64-byte sig + 32-byte pubkey
|-------- TRUST_REQUEST --------> | Phase 3: Device Posture
|<------- TRUST_RESPONSE --------- | Score assigned
|-------- POLICY_REQUEST -------> | Phase 4: Policy Evaluation
|<------- POLICY_RESPONSE -------- | 6-check authorization
|-------- CAPABILITY_NEGOTIATE -> | Phase 5: Negotiation
|<------- CAPABILITY_NEGOTIATE --- | chunk_size, window
|-------- SESSION_CREATE -------> | Phase 6: Session Active
|<------- SESSION_ACCEPT --------- |
|-------- TRANSFER_REQUEST -----> | Phase 7: File Transfer
|<------- TRANSFER_START --------- |
|-------- TRANSFER_CHUNK x N ---> | PAYLOAD_ENCRYPTED required
|<------- TRANSFER_ACK ----------- | per-chunk Merkle verification
|-------- TRANSFER_COMPLETE ----> | Phase 8: Audit
|<------- INTEGRITY_VERIFY ------- | SHA-3-512 file check
|<------- AUDIT_COMMIT ----------- | ECDSA-P384 sealed record
|-------- SESSION_CLOSE --------> | Phase 9: Graceful Close
|<------- SESSION_CLOSE ---------- |
Architecture
ztop/
protocol/ Binary wire format (packet.py, states.py, messages.py)
core/ Session state management (session.py)
engines/
trust_engine.py Device posture scoring (100-point scale)
policy_engine.py 6-check transfer authorization
heartbeat_engine.py Continuous 8-check attestation
merkle_engine.py Binary SHA-256 Merkle tree
cem_engine.py Cryptographic Execution Manifest
audit_engine.py ECDSA-P384 audit record sealing
cert_engine.py X.509 5-layer certificate hierarchy
signature_chain.py 7-level Ed25519 signature chain
peer_id_engine.py HKDF hardware-derived Peer ID
integrity_engine.py Per-chunk and file-level hash verification
tamper_engine.py Adaptive Tamper Resistance Score (TRS)
execution_analyzer.py Pre-execution static behavioral analysis
reconnect_engine.py Trust-preserving session resumption
metadata_engine.py 19-field dual-signed metadata exchange
network/
server.py asyncio TCP gateway server
client.py asyncio client agent
cli.py click-based command-line interface
Security Notes
- Transport: ZTOP is designed to run inside a TLS 1.3 tunnel. The reference implementation uses plain TCP for development convenience. For production use, place behind a TLS terminator or enable TLS in the network layer.
- HMAC Keys: The current implementation does not perform a key exchange during the handshake. Both sides use an unshared key by default, so HMAC validation is not enforced. A full ECDH-based key exchange is planned for v1.1.
- Post-Quantum: Ed25519 and ECDSA-P384 are not quantum-resistant. Future versions will incorporate NIST-standardized post-quantum algorithms.
See SECURITY.md for the full threat model and responsible disclosure policy.
Running Tests
pip install -e ".[dev]"
pytest tests/ -v --tb=short
Building for PyPI
python -m build
twine check dist/*
twine upload dist/*
IETF Reference
This implementation targets draft-ztop-secdispatch-protocol-00, submitted to the IETF SECDISPATCH working group.
Internet-Draft: https://datatracker.ietf.org/drafts/current/
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ztop-1.1.0.tar.gz.
File metadata
- Download URL: ztop-1.1.0.tar.gz
- Upload date:
- Size: 111.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
126206a01f62602bcc4aaa12dccd7c1bcf01043300928c5bffe80e3bec92fbf6
|
|
| MD5 |
1907c691b07989112d75b80f44740aac
|
|
| BLAKE2b-256 |
8b04fb4485de9b63fb3b2ffeb30deab5c192279512bb231cf0be70804aa1a0ae
|
File details
Details for the file ztop-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ztop-1.1.0-py3-none-any.whl
- Upload date:
- Size: 115.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65819bf24254e0df3482f373e064c77f0e10983ccf59973d18a12a509c923d14
|
|
| MD5 |
1c716394c6b010060cc8c0c7f1d06aa6
|
|
| BLAKE2b-256 |
d00faef4aa9840a7035b11f3250e5b0735298078dbeb3964d0d53550cd2cb43d
|