Closed AlibekJ closed 4 years ago
My guess is that the cipher that was stored in the keystore was not backed up and you would need to re-encrypt to regenerate a new cipher to be saved to the keystore.
What should I save? Would saving IV solve the problem you think?
Answering my own question: storing they key components outside of the keystore solves this particular problem. However, as I realized after reflecting on the solution a bit, this defeats the whole purpose of using the secure, hardware-assisted keystore.
So, I encrypt with certain username-password:
Decrypting works fine:
Then I uninstall the app, install again, all the app data gets restored from google drive by the OS, cordova reports the same UUID, everything works as if the app was never uninstalled, except decrypting does does not work and throws BAD_PADDING_EXCEPTION.
I am supplying the very same data into the .decrypt method, yet it fails. Any ideas?