java.lang.RuntimeException:无法使用FingerPrint初始化密码

java.lang.RuntimeException:无法使用FingerPrint初始化密码,第1张

概述我正在使用指纹sdk,它总是崩溃.java.lang.RuntimeException:FailedtoinitCipheratcom.example.ammar.fingerbyitself.MainActivity.initCipher(MainActivity.java:160)a

我正在使用指纹sdk,它总是崩溃.

java.lang.RuntimeException: Failed to init Cipher                                                                                               at com.example.ammar.fingerbyitself.MainActivity.initCipher(MainActivity.java:160)at com.example.ammar.fingerbyitself.MainActivity.accessprivate boolean initCipher() {        try {//            KeyStore mKeyStore = KeyStore.getInstance("AndroIDKeyStore");            mKeyStore.load(null);            SecretKey key = (SecretKey) mKeyStore.getKey(KEY_name, null);            mCipher.init(Cipher.ENCRYPT_MODE, key);            return true;        } catch (KeyPermanentlyInvalIDatedException e) {            return false;        } catch (KeyStoreException | CertificateException | UnrecoverableKeyException | IOException                | NoSuchAlgorithmException | InvalIDKeyException e) {            throw new RuntimeException("Failed to init Cipher", e);        }    }0(MainActivity.java:55)at com.example.ammar.fingerbyitself.MainActivity.onClick(MainActivity.java:109)at androID.vIEw.VIEw.performClick(VIEw.java:5697)at androID.Widget.TextVIEw.performClick(TextVIEw.java:10814)at androID.vIEw.VIEw$PerformClick.run(VIEw.java:22526)at androID.os.Handler.handleCallback(Handler.java:739)at androID.os.Handler.dispatchMessage(Handler.java:95)at androID.os.Looper.loop(Looper.java:158)at androID.app.ActivityThread.main(ActivityThread.java:7229)at java.lang.reflect.Method.invoke(Native Method)at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:1120)Caused by: java.security.InvalIDKeyException: Only SecretKey is supportedat com.androID.org.conscrypt.OpenSSLCipher.checkAndSetEncodedKey(OpenSSLCipher.java:435)at com.androID.org.conscrypt.OpenSSLCipher.engineInit(OpenSSLCipher.java:260)at javax.crypto.Cipher.trytransformWithProvIDer(Cipher.java:612)at javax.crypto.Cipher.tryCombinations(Cipher.java:532)at javax.crypto.Cipher.getSpi(Cipher.java:437)at javax.crypto.Cipher.init(Cipher.java:815)at javax.crypto.Cipher.init(Cipher.java:774)at com.example.ammar.fingerbyitself.MainActivity.initCipher(MainActivity.java:153)at com.example.ammar.fingerbyitself.MainActivity.access0(MainActivity.java:55) at com.example.ammar.fingerbyitself.MainActivity.onClick(MainActivity.java:109) at androID.vIEw.VIEw.performClick(VIEw.java:5697) at androID.Widget.TextVIEw.performClick(TextVIEw.java:10814) at androID.vIEw.VIEw$PerformClick.run(VIEw.java:22526) at androID.os.Handler.handleCallback(Handler.java:739) at androID.os.Handler.dispatchMessage(Handler.java:95) at androID.os.Looper.loop(Looper.java:158) at androID.app.ActivityThread.main(ActivityThread.java:7229) at java.lang.reflect.Method.invoke(Native Method) 

当我打电话给CIPHERinit()

它崩溃的原因尚不清楚,即使是从GitHub下载的相同代码也是如此.

解决方法:

在FingerPrintDialog示例中,有一个生成密钥的createKey方法.调用createKey后,只能调用initCipher

总结

以上是内存溢出为你收集整理的java.lang.RuntimeException:无法使用FingerPrint初始化密码全部内容,希望文章能够帮你解决java.lang.RuntimeException:无法使用FingerPrint初始化密码所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1118354.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存