Release v3.3: end-to-end encrypted audio, plus cue and reliability fixes

Headline: all audio is now encrypted (AES-256-GCM), keyed by a per-profile
password. Mandatory — v3.3 only interoperates with v3.3+.

Encryption
- RemSoundCrypto (Core): PBKDF2 key derivation, AES-GCM encrypt/decrypt
  (low-alloc, into-span), password fingerprint, light on-disk obfuscation.
- Wire: SenderLane encrypts the audio payload (PCM split across parts when the
  +28 overhead crosses MTU); AudioReceiver/StreamSession decrypt via a shared
  single-thread AudioDecryptor. Fingerprint piggybacks on the Format packet
  (offset 36, backward-compatible) so a peer can detect a password mismatch.
- Profile.Password (scrambled), carried through BuildCurrentProfile; MainForm
  derives + pushes the key/fingerprint to sender + receiver (RecomputeAudioCrypto).
- UX: ask-for-password on profile create; File -> Change this profile's password
  (ProfilePasswordDialog); Options -> Profile passwords (manager); a gate that
  prompts before streaming without a password; and a clear "passwords don't
  match" / "peer needs to update" message driven by the fingerprint.

Cue fixes
- CuePlayer (NAudio) replaces System.Media.SoundPlayer, which silently failed
  on the 96 kHz/24-bit cue WAVs (and any custom file) — cues now play reliably,
  resampled to 48 kHz/16-bit. Also fixes the Preferences preview button.
- Connect/disconnect cues now audio-gated with hysteresis: connected when audio
  flows OR heartbeat healthy; lost only when audio stops AND heartbeat
  unreachable. Kills false disconnects and the receive-only "no cues" case.
- Honest cue logging (played / muted / not loaded).

Smaller
- Endpoint stickiness: keep the audio target pinned to the heartbeat-proven
  address instead of chasing a multi-homed peer's other (unreachable) address.
- "Online/offline" label now audio+heartbeat aware, not discovery-only.
- "Show what's new after each update" preference (on by default).

Docs: About v3.3 block, RELEASE_NOTES, README (encryption as a headline),
manual section 12 "Passwords and encryption" (+ renumber), MANUAL.md regenerated.
Version 3.2.0 -> 3.3.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-06-02 23:57:32 +01:00
co-authored by Claude Opus 4.8
parent cdcac859c4
commit 959720f54d
20 changed files with 1330 additions and 115 deletions
+17
View File
@@ -92,6 +92,21 @@ public sealed class AudioSender : IDisposable
// mode (= 120 samples) can be expressed cleanly. Only meaningful when codec == Opus.
private volatile int opusFrameSamples = 480;
private volatile bool muted;
// Audio encryption (2026-05-31). The key is derived from the active profile's password by
// the app and pushed down here; the lanes read it on their capture threads (hence volatile)
// and rebuild their ciphers when the reference changes. The fingerprint is a short, non-
// reversible id of the same password, sent in the format packet so a peer can detect a
// password mismatch. Null until a password is set — with no key the lanes send nothing.
private volatile byte[]? audioKey;
private volatile byte[]? audioFingerprint;
/// <summary>The AES key derived from the active profile's password (or null = no password).
/// Set by the app; read by the sender lanes. Pushing a new array (not mutating in place)
/// is what signals the lanes to rebuild their ciphers.</summary>
public byte[]? AudioKey { get => audioKey; set => audioKey = value; }
/// <summary>Short non-reversible fingerprint of the active password, advertised in the format
/// packet for peer password-match detection. Null = none.</summary>
public byte[]? AudioFingerprint { get => audioFingerprint; set => audioFingerprint = value; }
private IPEndPoint[] receivers = [];
private long packetsSent;
private long bytesSent;
@@ -630,6 +645,8 @@ public sealed class AudioSender : IDisposable
Stop();
try { inboundCts?.Cancel(); } catch { /* ignore */ }
try { inboundThread?.Join(500); } catch { /* ignore */ }
try { defaultLane.DisposeCrypto(); } catch { /* ignore */ }
try { asioLane.DisposeCrypto(); } catch { /* ignore */ }
engine.Dispose();
// Dispose the persistent ASIO LAST, after the engine that was borrowing it. The
// composite's Dispose doesn't touch the persistent instance (it borrowed it); we