uli
03/22/2022, 12:33 PMoldKey
exists, read it
a. Open Room DB with oldKey
b. Create and store newKey
c. Rekey database with newKey
d. Delete oldKey
2. If oldKey does not exist, read or create newKey
a. Open or create Room DB with newKey
If failure happens between (1.b) and (1.c) the DB is still encrypted with the oldKey
.
If things fail between (1.c) and (1.d) it is already rekeyed with newKey
.
Both cases are indistinguishable without ‘trying the keys’.
How can I recover from that state back to a ‘known’ state?