| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
android-ci / android (pull_request) Successful in 11m41s
`setUnlockedDeviceRequired(true)` is now set on the key that wraps the store
passphrase (API 28+; below that the pre-gate path is unchanged and logs which
branch ran). `setUserAuthenticationRequired(false)` is untouched: the gate only
refuses while the lock screen is up, it is not a biometric prompt, so an
unattended unlock on an unlocked device still works.
A Keystore key cannot be retrofitted, so the gate needs a second alias:
`onionwire.store.unlock-gated` is generated with the flag and is the only key a
fresh install creates; `onionwire.store` is the pre-gate key and exists only on
installs that stored a passphrase earlier. Migration runs the next time the
passphrase is in hand (save(), or a successful load() — never inside open(),
which must not generate keys):
1. seal under the unlock-gated key (created here if needed)
2. write the blob to `…bin.tmp`
3. read those bytes back, open them with the gated key alone, compare to the
passphrase in hand — failure drops the temp file, throws SecretUnavailable
with the reason, and leaves the previous blob and key untouched
4. rename the temp file over the blob
5. only now delete the pre-gate alias
A crash before 4 leaves the old blob and key intact; a crash between 4 and 5
leaves a working gated blob plus a stale alias the next save/unlock retires.
`open()` tries the gated key first and falls back to the pre-gate key, so that
window is harmless. `forget()` deletes both aliases.
Reporting is honest about a platform limit: `KeyInfo` exposes
`isUserAuthenticationRequired` but has no getter for the unlock requirement, so
nothing can ask the Keystore whether the flag stuck.
`KeystorePassphraseCipher.unlockGateReport()` reports our own bookkeeping (which
alias the live key was generated under) plus `platformReportsGate = false`, and
a device whose Keystore refuses the flag falls back to the ungated alias and
says so instead of claiming the gate. A locked device that makes the gated key
unusable is reported as "the device is locked", not as a GCM tag failure.
Instrumentation: migration happy path (gated key appears, pre-gate alias gone
only after the on-disk blob opens under the new key), a failed re-wrap (old key
and blob byte-identical, no temp file), the gated proof refusing a pre-gate
blob, and the crash window still unlocking. Logcat lines print
MANUFACTURER/MODEL/SDK_INT and the branch taken. Not run here: no device or
emulator on this host. JVM suite still 213 tests / 0 failures; androidTest
sources compile.
|
||
| .. | ||
| src | ||
| build.gradle.kts | ||