Android 10 android.security.keymaster.ExportResult.resultCode NullPointerException崩溃

时间:2019-12-19 06:26:37

标签: java android keystore android-keystore android-security

我的应用仅收到来自Android 10用户的单个崩溃报告。这是堆栈跟踪:

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'int android.security.keymaster.ExportResult.resultCode' on a null object reference

       at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePublicKeyFromKeystore(AndroidKeyStoreProvider.java:256)
       at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyPairFromKeystore(AndroidKeyStoreProvider.java:296)
       at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePrivateKeyFromKeystore(AndroidKeyStoreProvider.java:316)
       at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore(AndroidKeyStoreProvider.java:378)
       at android.security.keystore.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:105)
       at java.security.KeyStore.getKey(KeyStore.java:1062)
       at we.lmk.iqQ(we.lmk:19)
       at we.Vmk.apply(we.Vmk:51)
       at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:57)
       at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:56)
       at io.reactivex.Single.subscribe(Single.java:3603)
       at io.reactivex.internal.operators.single.SingleMap.subscribeActual(SingleMap.java:34)
       at io.reactivex.Single.subscribe(Single.java:3603)
       at io.reactivex.internal.operators.single.SingleZipArray.subscribeActual(SingleZipArray.java:63)
       at io.reactivex.Single.subscribe(Single.java:3603)
       at io.reactivex.internal.operators.maybe.MaybeFilterSingle.subscribeActual(MaybeFilterSingle.java:40)
       at io.reactivex.Maybe.subscribe(Maybe.java:4290)
       at io.reactivex.internal.operators.maybe.MaybeMap.subscribeActual(MaybeMap.java:40)
       at io.reactivex.Maybe.subscribe(Maybe.java:4290)
       at io.reactivex.internal.operators.maybe.MaybeMap.subscribeActual(MaybeMap.java:40)
       at io.reactivex.Maybe.subscribe(Maybe.java:4290)
       at io.reactivex.internal.operators.maybe.MaybeFlatMapSingle.subscribeActual(MaybeFlatMapSingle.java:47)
       at io.reactivex.Single.subscribe(Single.java:3603)
       at io.reactivex.internal.operators.single.SingleFlatMap.subscribeActual(SingleFlatMap.java:36)
       at io.reactivex.Single.subscribe(Single.java:3603)
       at io.reactivex.internal.operators.single.SingleFlatMap.subscribeActual(SingleFlatMap.java:36)
       at io.reactivex.Single.subscribe(Single.java:3603)
       at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
       at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
       at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
       at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:919)

这是我的代码:

    @NonNull
    private static KeyStore getKeyStoreInstance() throws SecureStorageException {
        try {
            // Get the AndroidKeyStore instance
            KeyStore keyStore = KeyStore.getInstance(KEY_KEYSTORE_NAME);

            // Relict of the JCA API - you have to call load even
            // if you do not have an input stream you want to load or it'll crash
            keyStore.load(null);

            return keyStore;
        } catch (Exception e) {
            throw new SecureStorageException(e.getMessage(), e, KEYSTORE_EXCEPTION);
        }
    }

此代码由以下库提供:https://github.com/adorsys/secure-storage-android

我尚未找到任何解决方案,这可能是内部Android 10错误吗?

0 个答案:

没有答案