i am using the AndroidKeyStore to generate a RSA key pair, which are used to encrypt/decrypt the internal data.
The code which does that is as follows - it tries to
Is it possible the user changed their screen lock type to an insecure method such as None or Swipe thus triggering all the keys in the AndroidKeyStore to be deleted? It is a known issue discussed in this blog article: https://doridori.github.io/android-security-the-forgetful-keystore/
Also mentioned here: https://code.google.com/p/android/issues/detail?id=61989
If you do not have strict security requirements and want your app to work even if the user has no screen lock then perhaps just use a keypair stored in a keystore file in your data area and skip the AndroidKeyStore
.