为什么Android Keystore不能加载公钥

时间:2017-12-14 09:21:52

标签: android-keystore

为什么AndroidKeystore无法加载公钥证书?

我正在尝试从Android Keystore加载公钥。但是在某些设备上,公共密钥无法加载以下异常。 有人可以解释一下为什么会出现这种情况吗?

该错误主要发生在操作系统版本为4 +,5 +,6 +和7 +的三星,联想,华为和LG设备上。

堆栈跟踪:

Caused by java.security.UnrecoverableKeyException: Failed to obtain X.509 form of public key
   at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePublicKeyFromKeystore(AndroidKeyStoreProvider.java:223)
   at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyPairFromKeystore(AndroidKeyStoreProvider.java:252)
   at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePrivateKeyFromKeystore(AndroidKeyStoreProvider.java:263)
   at android.security.keystore.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:93)
   at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:372)
   at java.security.KeyStore.getEntry(KeyStore.java:645)
   at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1037)
   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6322)
   at android.app.ActivityThread.access$1800(ActivityThread.java:222)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1862)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:158)
   at android.app.ActivityThread.main(ActivityThread.java:7230)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Caused by android.security.KeyStoreException: OK
   at android.security.KeyStore.getKeyStoreException(KeyStore.java:913)
   at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePublicKeyFromKeystore(AndroidKeyStoreProvider.java:223)
   at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyPairFromKeystore(AndroidKeyStoreProvider.java:252)
   at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStorePrivateKeyFromKeystore(AndroidKeyStoreProvider.java:263)
   at android.security.keystore.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:93)
   at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:372)
   at java.security.KeyStore.getEntry(KeyStore.java:645)
   at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1037)
   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6322)
   at android.app.ActivityThread.access$1800(ActivityThread.java:222)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1862)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:158)
   at android.app.ActivityThread.main(ActivityThread.java:7230)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

0 个答案:

没有答案