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

在做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 书写不正确,详细确认!

 

详细看:

数据加密 ---- 总篇

 

 

你可能感兴趣的:(android,----,security)