nelenkov/android-keystore

keyStore.getEntry(“alias”, null) returns null sometimes

Closed this issue · 5 comments

Hello,
I am facing an issue where the keyStore.getEntry returns null. On some debugging I found out that the alias gets deleted somehow and thus the keystore.getEntry for that alias returns null. Your guidance on this will be great. Thanks.

Here is my query on Stackoverflow for your reference with code snippets.
http://stackoverflow.com/questions/37094464/android-keystore-issue-keystore-getentryalias-null-returns-null-sometimes

Thank you @nelenkov . I have had a look at this some time in the past and am aware of this.

But the issue I face seems to be tricky to me. This issue happens only on few devices that I could not replicate at the moment (but these are reported by the users).

On further debugging,

  1. I found that sometimes the recent (current) alias is getting deleted from the keystore when I query back. My debug log shows all the previous alias's but not the current one.

  2. This only happens with Release builds (I use Proguard with release build). Debug builds during my testing all looks fine and I never face this issue.

Do you have an idea of why and what could cause this?

Any luck on this @nelenkov please. Thanks.

Sorry, no ideas. Could be buggy devices, could be a threading issue in your code, could be overzealous optimisation in release builds (last one a bit unlkely though).

Thanks @nelenkov. Appreciate your response and guidance here.