From 9e720f9f293fee9642d851b09cf5cb8b736f894d Mon Sep 17 00:00:00 2001 From: Ben Bryan Date: Mon, 13 Apr 2026 23:38:16 -0500 Subject: [PATCH 1/2] Update docs and Cargo.lock for the rand bump --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e18965..32a9f46 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ peer.verify(received_msg.dh_public().unwrap())?; | [`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 From d3976341d3eb7d02b84bd03801964fa473ea6214 Mon Sep 17 00:00:00 2001 From: Ben Bryan Date: Fri, 1 May 2026 20:33:00 -0500 Subject: [PATCH 2/2] Update docs to reflect HMAC-SHA-1 PRF and MAC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Following #16, #19, and #20 (HMAC-SHA-1-160 MAC, constant-time verification, and MIKEY-1 PRF on HMAC-SHA-1): - README dependency table: replace sha2/HMAC-SHA-256 row with sha1/HMAC-SHA-1; remove phantom aes/ctr/hkdf rows that were never actual dependencies. - SECURITY.md: fix "downstream" → "upstream" when referring to our deps; update the report-issues list (sha2/aes → sha1). - book/concepts/wire-format.md: PRF func 0 is MIKEY-1 (HMAC-SHA-1); KEMAC mac_alg note now correctly says 1 = HMAC-SHA-1-160 (was incorrectly listed as 0 = SHA-256-truncated). - book/concepts/mikey-srtp.md: three PRF references switched from HMAC-SHA-256 to HMAC-SHA-1. --- README.md | 6 ++---- SECURITY.md | 2 +- book/src/concepts/mikey-srtp.md | 6 +++--- book/src/concepts/wire-format.md | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 32a9f46..8cc0522 100644 --- a/README.md +++ b/README.md @@ -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: @@ -111,9 +111,7 @@ 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). | diff --git a/SECURITY.md b/SECURITY.md index 7b0e1bd..6e50b1d 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -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 diff --git a/book/src/concepts/mikey-srtp.md b/book/src/concepts/mikey-srtp.md index 71f4f4b..670c7a8 100644 --- a/book/src/concepts/mikey-srtp.md +++ b/book/src/concepts/mikey-srtp.md @@ -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 @@ -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 ``` diff --git a/book/src/concepts/wire-format.md b/book/src/concepts/wire-format.md index 145f568..317089f 100644 --- a/book/src/concepts/wire-format.md +++ b/book/src/concepts/wire-format.md @@ -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: @@ -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)