3 Commits
Author SHA1 Message Date
lucioandClaude Opus 5 9930412c6b polish P1: drop CipherScheme's unused Codable and CaseIterable
Nothing encodes a CipherScheme — Settings stores its rawValue through the
accessor — and nothing enumerates the cases; the picker lists both by
hand. String, Sendable and Hashable are the three that are actually load
bearing (settings, ChannelConfig, SwiftUI's .tag).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 21:12:47 -07:00
lucioandClaude Opus 5 c0031c00da polish P1: CipherScheme (.legacy/.modern) in the cipher stream
The legacy scheme is what every PowerToys up to v0.100.2 speaks: a fixed
PBKDF2 salt (UTF-16LE of "18446744073709551615", 40 bytes), 50 000
iterations, a fixed ASCII IV "1844674407370955" and no cleartext header —
citations to the pre-a9e1f0f20e Encryption.cs. The sacrificial block is
still the first ciphertext block under both schemes.

- CipherWriter/CipherReader take the scheme; the writer's header is 16
  bytes under .legacy and 48 under .modern, the reader consumes as many.
- MacCipherScheme setting, default legacy, Mac-only key in the same file.
- InvalidKeyReason.cipherSchemeMismatch and SocketStatus
  .cipherSchemeMismatch (raw value 100, outside the Windows range) with
  its menu text, for the diagnostic the network layer raises next.

Verified offline against Python cryptography in both directions: our
legacy writer's stream decrypts under
pbkdf2_hmac('sha512', key, '18446744073709551615'.encode('utf-16-le'),
50000, 32) + AES-CBC, and our reader recovers Python's.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 21:06:41 -07:00
lucio ee835508f4 wire-core: port DATA/PackageType, framing, magic hash and the CBC stream
Packet.swift, Framing.swift, MagicHash.swift, CipherStream.swift in
MWBCore, each constant cited to the Windows source.
2026-09-16 00:09:37 -07:00