Open skhugh opened 7 years ago
Looks like the KeyStore
instance was null
when creating the EncryptionManager
instance. May be the device doesn't have a AndroidKeyStore
implementation. I'll try and see why is it throwing a NullPointerException
when the expected would be a KeyStoreException
or NoSuchProviderException
.
Hello. I am facing the same stack trace from my apps. Did you get a clue how to make a workaround for it?
@texnedo I could not actually reproduce it on any devices that I have. Are you using the latest version of the library with the recovery handler? And the recovery handler is not getting invoked?
I don't use this library, but work with AndroidKeyStore directly. I was just googling to find any solution for my issue. What does this recovery handler do? Could you navigate me in your repo the place where I can find it?
@texnedo In that case the recovery handler wouldn't be very useful for you I guess as it doesn't solve the issue; just provides the library a way to start over.
@skhugh were you trying to access the secured preferences from a remote service? This error seems to be related to this: https://android.googlesource.com/platform/external/sepolicy/+/0e30164b17af20f680635c7c6c522e670ecc3df3
Is there any better way to solve this problem. From firebase's crashlytics, we found a large number of crash logs of this type of problem.
When beta testing my app, one user out of around 1,000 users experienced "Attempt to invoke interface method 'int android.security.IKeystoreService.exist(java.lang.String, int)' on a null object reference" error and could not log in to my service with the following exception.
Caused by java.lang.NullPointerException: Attempt to invoke interface method 'int android.security.IKeystoreService.exist(java.lang.String, int)' on a null object reference android.security.KeyStore.contains (KeyStore.java:137) android.security.KeyStore.contains (KeyStore.java:145) android.security.AndroidKeyStore.engineContainsAlias (AndroidKeyStore.java:415) java.security.KeyStore.containsAlias (KeyStore.java:442) devliving.online.securedpreferencestore.EncryptionManager.generateRSAKeys (EncryptionManager.java:458) devliving.online.securedpreferencestore.EncryptionManager.generateKey (EncryptionManager.java:348) devliving.online.securedpreferencestore.EncryptionManager.<init> (EncryptionManager.java:95) devliving.online.securedpreferencestore.SecuredPreferenceStore.<init> (SecuredPreferenceStore.java:36) devliving.online.securedpreferencestore.SecuredPreferenceStore.getSharedInstance (SecuredPreferenceStore.java:42)
Is there any solutions to this problem?
I'm using minSdk 21 and target 25. The device info is:-
Manufacturer: LGE Model: LG-F460K Board: Apq8084 Android API: 21 Android OS: 5.0.1