Fix readable MIFARE Classic Key B handling - #978
Conversation
Update on the write-path validationA follow-up test uncovered an important edge case in the earlier write-path conclusion. The previous validation correctly established that a readable Key B value is not treated as write authorization and that readable-only B data remains separate from recovered authentication keys. However, additional testing against a Proxmark3-emulated sector using trailer condition In the reproduced case:
This exposed a false-success path rather than a readable-Key-B authorization issue. Commit The verification now confirms:
Gen3 inherits the same verification through the Gen2 write implementation. Regression coverage now includes:
The complete Flutter test suite currently passes |
Summary
Fix MIFARE Classic recovery handling for sector trailers where Key B is readable as data instead of necessarily being usable as an authentication key.
The recovery flow now:
The write flow now also:
This also addresses the write-readiness behavior reported in #976, where readable Key B sectors could leave the Write action unavailable.
Validation
Validated with automated tests, synthetic fixtures, and physical/emulated hardware cases:
flutter analyzefor the modified/relevant recovery, write, UI, and Gen2 regression-test files: no issuesA5x16 before the write01x16FF 07 80 697F 0F 08 69This distinguishes readable trailer data from real authentication capability while still supporting compatible cards that accept the same readable bytes as Key B, and prevents the newly reachable write path from reporting complete success after a partial target modification.