Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Attempt to invoke interface method 'int android.security.IKeystoreService.exist(java.lang.String, int)' on a null object reference" error #7

Open
skhugh opened this issue Dec 5, 2016 · 7 comments
Assignees
Labels

Comments

@skhugh
Copy link

skhugh commented Dec 5, 2016

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

@iamMehedi
Copy link
Owner

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.

@iamMehedi iamMehedi self-assigned this Dec 28, 2016
@texnedo
Copy link

texnedo commented Mar 28, 2017

Hello. I am facing the same stack trace from my apps. Did you get a clue how to make a workaround for it?

@iamMehedi
Copy link
Owner

@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?

@texnedo
Copy link

texnedo commented Apr 4, 2017

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?

@iamMehedi
Copy link
Owner

@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.

@iamMehedi
Copy link
Owner

@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

@iamMehedi iamMehedi added the bug label Nov 30, 2017
@waylon-edmodo
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants