IllegalBlockSizeException: last block incomplete in decryption
799835Dec 17 2010 — edited Feb 15 2011Hi All,
Currently we are working on application migration. As part of migration we
are not using ThirdParty security provider jar for encryption and decryption.
We have decided to achieve the same without using the
Thirdparty jar.
As of now, we are able to achieve partial encryption and decryption using the same
shared Key, Algorithm[DES] as used by the third party jar. However there is
a discrepancy in the results.
Encrypted String using our sample program.
String To Encrypt: 0.00
Encrypted String: ME1/HMAWM+4=
When encrypted using Third party jar.
String To Encrypt: 0.00
Encrypted String:rO0ABXVyAAJbQqzzF/gGCFTgAgAAeHAAAAAIME1/HMAWM+4=
As we can infer from the above details that, third part encryption mechanism is
padding some extra characters, however last twelve digits of both decrypted results
are same.
When tried decrypting the string encrypted by thirdparty jar we are gettting below
exception.
Encrypted String: rO0ABXVyAAJbQqzzF/gGCFTgAgAAeHAAAAAQE/8TdGsSl+Qjw/x4Pwhd9Q==
decoded text length: [B@281d4b
javax.crypto.IllegalBlockSizeException: last block incomplete in decryption
at org.bouncycastle.jce.provider.JCEBlockCipher.engineDoFinal(Unknown Source)
at javax.crypto.Cipher.doFinal(DashoA13*..)
Please let me know if any additional information is needed.
Waiting in anticipation for your reply.
Thanks & Regards
Avinash
Edited by: Avinash K P on Dec 17, 2010 1:29 PM
Edited by: Avinash K P on Dec 17, 2010 5:34 PM