android - 未能在 Diffie-Hellman 加密上解开密钥异常 android O
问题描述
我正在为我的应用程序用户名和密码使用 Diffie-Hellman 加密和解密算法。我正在使用我的密钥库来存储信息和检索它在 android O 下正常工作。最近我遇到了这个问题,请帮助我
java.security.InvalidKeyException: Failed to unwrap key
java.security.InvalidKeyException: Failed to unwrap key\n
Caused by: com.sample.example.sdk.manager.utils.CustomException: java.security.InvalidKeyException: Failed to unwrap key\n\tat
com.sample.example.sdk.manager.KeyPairHelper.getDevicePrivatekKey(KeyPairHelper.java:60)\n\tat
com.sample.example.sdk.manager.SampleTask.buildAesKey(SampleTask.java:100)\n\tat
com.sample.example.sdk.manager.SampleTask.call(SampleTask.java:186)\n\tat
com.sample.example.sdk.manager.SampleTask.call(SampleTask.java:66)\n\tat
io.reactivex.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:42)\n\tat
io.reactivex.Observable.subscribe(Observable.java:10842)\n\tat
io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)\n\tat
io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)\n\tat io.reactivex.internal.
schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)\n\tat
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)\n\tat
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)\n\tat
java.lang.Thread.run(Thread.java:764)\n
Caused by: java.security.InvalidKeyException: Failed to unwrap key\n\tat
android.security.keystore.AndroidKeyStoreCipherSpiBase.engineUnwrap(AndroidKeyStoreCipherSpiBase.java:682)\n\tat
javax.crypto.Cipher.unwrap(Cipher.java:2121)\n\tat
com.sample.example.sdk.manager.utils.Custom.getEncryptionKey(Custom.java:312)\n\tat
com.sample.example.sdk.manager.utils.Custom.\u003cinit\u003e(Custom.java:108)\n\t
... 15 more\nCaused by: javax.crypto.IllegalBlockSizeException\n\tat
android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)\n\tat
android.security.keystore.AndroidKeyStoreCipherSpiBase.engineUnwrap(AndroidKeyStoreCipherSpiBase.java:680)\n\t... 18 more\n
Caused by: android.security.KeyStoreException: Unknown error\n\tat
android.security.KeyStore.getKeyStoreException(KeyStore.java:1137)\n\tat android.security.keystore.KeyStoreCryptoOp
解决方案
推荐阅读
- css - React JS css 在其他组件中使用
- ios - 如何在 Swift 中确认订单后发送电子邮件
- javascript - 无法获得一个顶点来完成一个三角形
- javascript - 如何将 console.log 用于自定义功能?
- python - 在我的情况下如何正确编写 collate_fn?
- javascript - NestJS拦截器在控制器中具有异步方法
- javascript - 使用 Redux 和 Firebase 在 React Native App 中进行身份验证状态评估
- python - Yahoo Finance Api 可以检索索引数据(特别是 Nifty)吗?
- java - 在 IntelliJ 中并行运行同一个 gradle 任务
- java - Java中实际参数列表和形式参数列表的长度不同