adorsys/secure-storage-android

NullPointerException when calling setValue

ecramer opened this issue · 3 comments

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);
}

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

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.

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