The canonical MAC input: the capture's JSON with `mac` cleared. JSON with sorted field order (serde_json preserves struct order) is deterministic for this struct, so the MAC binds exactly these bytes.
(&self)
| 151 | /// JSON with sorted field order (serde_json preserves struct order) is |
| 152 | /// deterministic for this struct, so the MAC binds exactly these bytes. |
| 153 | fn mac_input(&self) -> Vec<u8> { |
| 154 | let mut unsigned = self.clone(); |
| 155 | unsigned.mac = String::new(); |
| 156 | serde_json::to_vec(&unsigned).expect("capture canonical JSON") |
| 157 | } |
| 158 | |
| 159 | /// Compute the MAC under `key_hex` (64 hex chars → 32 bytes). |
| 160 | fn mac(key_hex: &str, input: &[u8]) -> String { |