I'm getting this error when I try to fetch the previously chosen private key when I recreate the activity after rotating the screen.
I've seen this question here, which suggests that choosePrivateKeyAlias()
needs to be called "at least once after the application is installed". In this case it has been called numerous times, including when the app is started up before the screen rotation happens - so why is it considered to be a new app? Is the uid changing somehow?
Here's the call:
PrivateKey privateKey = KeyChain.getPrivateKey(getBaseContext(), alias);
I've just noticed that the other question was using getCertificateChain
rather than getPrivateKey
- is that the difference?
alias
you are using is actually the string returned by the alias callback? Could you post more of your code around that call? – Estes