Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A Rust implementation of **MIKEY** (Multimedia Internet KEYing, [RFC 3830](https

```toml
[dependencies]
mykey = "0.2.1"
mykey = "1.0.0"
```

or to get whatever the latest in Crates.io is, just type:
Expand Down Expand Up @@ -111,13 +111,11 @@ peer.verify(received_msg.dh_public().unwrap())?;
| Crate | Purpose |
|---|---|
| [`x25519-dalek`](https://crates.io/crates/x25519-dalek) | X25519 DH key exchange |
| [`hmac`](https://crates.io/crates/hmac) + [`sha2`](https://crates.io/crates/sha2) | MIKEY PRF and MAC (HMAC-SHA-256) |
| [`aes`](https://crates.io/crates/aes) + [`ctr`](https://crates.io/crates/ctr) | AES-CM for KEMAC payload encryption |
| [`hkdf`](https://crates.io/crates/hkdf) | Key derivation |
| [`hmac`](https://crates.io/crates/hmac) + [`sha1`](https://crates.io/crates/sha1) | MIKEY-1 PRF and KEMAC MAC (HMAC-SHA-1, per RFC 3830) |
| [`base64`](https://crates.io/crates/base64) | SDP `a=key-mgmt:mikey` encoding |
| [`hex`](https://crates.io/crates/hex) | Identity key file encoding |
| [`rand`](https://crates.io/crates/rand) ≥ 0.9 + [`rand_core`](https://crates.io/crates/rand_core) | RAND nonce generation; `OsRng` (direct OS entropy) for X25519 keypairs. 0.9+ required to address [RUSTSEC-2026-0097](https://rustsec.org/advisories/RUSTSEC-2026-0097). |
| [`thiserror`](https://crates.io/crates/thiserror) | Error types |
[`thiserror`](https://crates.io/crates/thiserror) | Error types |

## License

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mykey is a cryptographic library. Security issues in this project include:
- Unsafe handling of private key files (permissions, exposure in logs or errors)
- Parsing bugs that could cause panics, memory corruption, or acceptance of invalid messages

Issues in downstream dependencies (x25519-dalek, hmac, sha2, aes, rand) should be reported to those projects directly. If you believe a dependency issue has a specific impact on mykey, include that context in your report.
Issues in upstream dependencies (x25519-dalek, hmac, sha1, rand) should be reported to those projects directly. If you believe a dependency issue has a specific impact on mykey, include that context in your report.

## Dependency Advisories

Expand Down
6 changes: 3 additions & 3 deletions book/src/concepts/mikey-srtp.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ MIKEY messages are compact binary structures designed for embedding in SDP sessi

1. **Negotiates a TGK** (TEK Generation Key) using one of several key exchange methods
2. **Carries a RAND** payload — a fresh random nonce per session
3. **Derives SRTP keys** from TGK + RAND using the MIKEY PRF (HMAC-SHA-256 based)
3. **Derives SRTP keys** from TGK + RAND using the MIKEY-1 PRF (HMAC-SHA-1 based)
4. **Carries security policy** — tells the peer which SRTP cipher and authentication algorithm to use

### What MIKEY does not do
Expand All @@ -32,10 +32,10 @@ MIKEY messages are compact binary structures designed for embedding in SDP sessi

## The MIKEY PRF

The key derivation in mykey follows RFC 3830 Section 4.1.2. Given a key and a label, it produces an output of arbitrary length using iterated HMAC-SHA-256:
The key derivation in mykey follows RFC 3830 Section 4.1.2. Given a key and a label, it produces an output of arbitrary length using iterated HMAC-SHA-1:

```text
PRF(key, label) = HMAC-SHA-256(key, label || 0x00 || i || output_len)
PRF(key, label) = HMAC-SHA-1(key, label || 0x00 || i || output_len)
for i = 0, 1, 2, ... until enough bytes are produced
```

Expand Down
4 changes: 2 additions & 2 deletions book/src/concepts/wire-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Every MIKEY message starts with a common header (RFC 3830 §6.1).
| `data type` | `4` = DH-Init, `5` = DH-Resp, `0` = PSK-Init |
| `next payload` | Type of the first payload that follows |
| `V` flag | Set when a verification payload is present |
| `PRF func` | `0` = MIKEY-PRF-HMAC-SHA-256 |
| `PRF func` | `0` = MIKEY-1 PRF (HMAC-SHA-1) — the only PRF defined in RFC 3830 |
| `CSB ID` | Crypto Session Bundle ID — identifies the session |

The CS ID map (when `#CS > 0` and `CS ID map type = 0`) adds 9 bytes per crypto session:
Expand Down Expand Up @@ -76,7 +76,7 @@ The DH-value length is **implied by the group** — there is no explicit length
! mac_alg (8) ! MAC (mac_alg_len bytes) ~
```

Used in PSK mode to carry the TGK. `enc_alg = 0` means null encryption (plaintext TGK). `mac_alg = 0` means HMAC-SHA-256 truncated to 160 bits.
Used in PSK mode to carry the TGK. `enc_alg = 0` means null encryption (plaintext TGK). `mac_alg = 0` means no MAC (NULL); `mac_alg = 1` means HMAC-SHA-1-160 — the mandatory MAC algorithm per RFC 3830 §6.2.

### Security Policy (type 10)

Expand Down
Loading