javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT

android ---- security 专栏收录该内容
21 篇文章 0 订阅

在做AES、DES 等加密的时候会出现该类问题:

12-10 05:34:21.721  4043   724 W System.err: javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
12-10 05:34:21.721  4043   724 W System.err: 	at com.android.org.conscrypt.NativeCrypto.EVP_CipherFinal_ex(Native Method)
12-10 05:34:21.721  4043   724 W System.err: 	at com.android.org.conscrypt.OpenSSLCipher$EVP_CIPHER.doFinalInternal(OpenSSLCipher.java:570)
12-10 05:34:21.721  4043   724 W System.err: 	at com.android.org.conscrypt.OpenSSLCipher.engineDoFinal(OpenSSLCipher.java:351)
12-10 05:34:21.721  4043   724 W System.err: 	at javax.crypto.Cipher.doFinal(Cipher.java:1741)
12-10 05:34:21.721  4043   724 W System.err: 	at com.shift.encrytion.core.BlockEncryptionHelper.encrypt(BlockEncryptionHelper.java:126)
12-10 05:34:21.721  4043   724 W System.err: 	at com.shift.encrytion.aes.AESHelper.encrypt(AESHelper.java:17)
12-10 05:34:21.721  4043   724 W System.err: 	at com.shift.encrytion.aes.AESEncryption.encrypt(AESEncryption.java:23)
12-10 05:34:21.721  4043   724 W System.err: 	at com.shift.encrytion.core.BlockEncryption.decryptFile(BlockEncryption.java:103)
12-10 05:34:21.721  4043   724 W System.err: 	at com.shift.encrytion.FileEncryption.decryptFiles(FileEncryption.java:171)
12-10 05:34:21.721  4043   724 W System.err: 	at com.shift.encrytion.FileEncryption.operation(FileEncryption.java:210)
12-10 05:34:21.721  4043   724 W System.err: 	at com.shift.encrytion.FileEncryption.-wrap0(Unknown Source:0)
12-10 05:34:21.721  4043   724 W System.err: 	at com.shift.encrytion.FileEncryption$EncryptionTask.doInBackground(FileEncryption.java:223)
12-10 05:34:21.722  4043   724 W System.err: 	at com.shift.encrytion.FileEncryption$EncryptionTask.doInBackground(FileEncryption.java:221)
12-10 05:34:21.722  4043   724 W System.err: 	at android.os.AsyncTask$2.call(AsyncTask.java:333)
12-10 05:34:21.722  4043   724 W System.err: 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
12-10 05:34:21.722  4043   724 W System.err: 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
12-10 05:34:21.722  4043   724 W System.err: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
12-10 05:34:21.722  4043   724 W System.err: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
12-10 05:34:21.722  4043   724 W System.err: 	at java.lang.Thread.run(Thread.java:764)

主要确定下一下几点:

1、算法的名称与加密时是否相同

2、加密和解密时的模式、填充是否相同

3、加密和解密时的密钥是否相同

4、模式、填充是否是该算法支持的

 

根本原因就是code 书写不正确,详细确认!

 

详细看:

数据加密 ---- 总篇

 

 

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

相关推荐
©️2020 CSDN 皮肤主题: 酷酷鲨 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值