skavinvarnan / Cross-Platform-AES

Simple cross-platform encryption and decryption using AES
MIT License
142 stars 69 forks source link

BadPaddingException #34

Closed enriquebautista closed 4 years ago

enriquebautista commented 5 years ago

Hi! The problem arises when I try to decrypt a string from the server (using the same library) with a custom iv and key.

Android [Kotlin]

`val cryptLib = CryptLib() val iv = "iv" val key = "key" val cipherText = "7ESDDdYDbnUh2hqGhAKGbEZKpwa14mEiT553b3etgjc="

val resultText = cryptLib.decryptCipherText(cipherText, key, iv)`

The app crash and return this: javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT

Caused by: javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT at com.android.org.conscrypt.NativeCrypto.EVP_CipherFinal_ex(Native Method) at com.android.org.conscrypt.OpenSSLCipher$EVP_CIPHER.doFinalInternal(OpenSSLCipher.java:602) at com.android.org.conscrypt.OpenSSLCipher.engineDoFinal(OpenSSLCipher.java:365) at javax.crypto.Cipher.doFinal(Cipher.java:2055)

Thanks for the help.

skavinvarnan commented 4 years ago

This issue has been fixed