# zrtp
A focused Rust implementation of the core pieces of [RFC 6189 ZRTP](https://www.rfc-editor.org/rfc/rfc6189.html).
## Status
This crate currently provides:
- ZRTP wire/message parsing and serialization
- algorithm negotiation helpers
- CRC32C
- Confirm encryption/MAC helpers
- finite-field DH and ECDH helpers
- retained secret cache primitives
- an embeddable handshake engine
- retransmission helpers
- retained-secret ID and matching helpers
- SRTP/ZRTP key derivation surfaces
It is intended to be a reusable ZRTP-focused crate rather than a full RTP stack.
For a section-by-section view of what is implemented, partial, or intentionally out of scope, see [`docs/rfc6189-coverage.md`](docs/rfc6189-coverage.md).
For the verification and coverage workflow, see [`docs/coverage.md`](docs/coverage.md).
Implementation note: this repository contains the complete Codex-visible implementation of the crate; the public release artifact is restricted to the Rust crate sources, docs, examples, tests, and release metadata.
## What is implemented
- Hello / Commit / DHPart1 / DHPart2 / Confirm1 / Confirm2 / Conf2ACK
- Error / ErrorACK
- GoClear / ClearACK
- SASrelay / RelayACK
- Ping / PingACK
- DH2k / DH3k / EC25 / EC38 / EC52 / Preshared / Multistream surfaces
## Quick example
```rust
use zrtp::*;
let hello = Hello {
version: VERSION_1_10,
client_id: *b"example-zrtp ",
hash_image_h3: [0; 32],
zid: [1; 12],
signature_capable: false,
mitm_capable: false,
passive_capable: false,
hashes: vec![algos::HASH_S256],
ciphers: vec![algos::CIPHER_AES1],
auth_tags: vec![algos::AUTH_HS32],
key_agreements: vec![algos::KEYAGREE_EC25],
sas_types: vec![algos::SAS_B32],
mac: [0; 8],
};
let mut engine = ZrtpEngine::new(Role::Initiator, hello, MemorySharedSecretStore::default());
let outbound = engine.start();
assert!(!outbound.is_empty());
```
For a more complete end-to-end example that frames messages into ZRTP packets, pumps them between two peers, verifies matching SAS output, and reaches the secure state, run:
```bash
cargo run --example engine
```
## Testing
```bash
cargo test
cargo test --no-default-features
cargo clippy --all-targets --all-features -- -D warnings
```
## Feature flags
- `crypto` (default): enables hash/KDF, Confirm encryption/MAC, DH/ECDH, SAS rendering, and the handshake paths that derive SRTP/ZRTP secrets.
- `--no-default-features`: keeps the RFC 6189 wire/message types, packet framing, CRC validation, retransmission helpers, negotiation structures, and cache primitives available without pulling in crypto dependencies.
## Notes
This crate is already useful as a protocol/crypto foundation, but it still needs deeper real-world interoperability validation, fuzzing, and signature-layer completeness for full production confidence.
## Release
See `RELEASE.md` for the release checklist.