adorsys / secure-storage-android

Store strings & credentials securely encrypted on your device
Apache License 2.0
367 stars 58 forks source link

NullPointerException when calling setValue #48

Closed ecramer closed 5 years ago

ecramer commented 5 years ago

Using version 1.1.1. Have seen this on Android 8 devices (so far)

Caused by java.lang.NullPointerException: invalid null input
       at java.security.KeyStore$PrivateKeyEntry.<init> + 559(KeyStore.java:559)
       at java.security.KeyStore$PrivateKeyEntry.<init> + 526(KeyStore.java:526)
       at java.security.KeyStoreSpi.engineGetEntry + 477(KeyStoreSpi.java:477)
       at java.security.KeyStore.getEntry + 1560(KeyStore.java:1560)
       at de.adorsys.android.securestoragelibrary.a.e + 28(:28)
       at de.adorsys.android.securestoragelibrary.a.b + 19(:19)
       at de.adorsys.android.securestoragelibrary.SecurePreferences.setValue + 13(:13)

The null input isn't being provided by us into the setValue function as we already have a null check before calling setValue.

if (value != null) {
    SecurePreferences.setValue(this.context, KEY_PREF_VAL, value);
}
drilonrecica commented 5 years ago

Hi @ecramer , Thank you for reporting this issue. We will look into this issue ASAP and inform you about the solution.

ecramer commented 5 years ago

Thanks. In case this wasn't clear, it does get thrown as a SecureStorageException in the end however the type is NullPointerException. The above stacktrace is from the root cause.

drilonrecica commented 5 years ago

Hi @ecramer , I have made some changes that hopefully should fix the issue. As I could not reproduce the bug I had to improvise a little bit. See https://github.com/adorsys/secure-storage-android/pull/54 for the list of changes. Please use version 1.2.1 I will close this issue right now, but if you find something useful or need help feel free to reopen this issue or open another one.