Unable decrypt more than 63 charactes

I'm using Base64 encryption & decryption. I am storing encrypted DB URL in database. After reading from database I'm decypting the URL.

In decryption, It's throwing following exception.

Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher

at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)

at com.sun.crypto.provider.SunJCE_h.b(DashoA12275)

at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA12275)

at javax.crypto.Cipher.doFinal(DashoA12275)

This happening only when I use more than 63 character in DB URL.

[638 byte] By [praveen80a] at [2007-11-27 8:18:16]
# 1

Without any code to go on, there's no way we can really tell. But several things bother me:

Base64 isn't a cipher, it's an encoding.

The error your getting says you're using AES.

The error you're getting suggests that you're decrypting and have specified a padding option.

The error you're getting suggests that the data you're trying to decrypt using AES isn't an integral number of blocks long.

All of this suggests to me that when/if you give us the code you're using to attempt the decryption, we're going to tell you something like "if you know it's Base64-encoded, you need to Base64-DEcode it BEFORE you attempt to decrypt."

But I'm just guessing...

Grant

ggaineya at 2007-7-12 20:03:46 > top of Java-index,Security,Cryptography...
# 2

Thanks for the response. I found the problem.

Database column length is causing the exception. I'm using MySQL database to store encrypted data. It's truncating while inserting the encrypted data(When it exceeds column length specified). This is the reason for decryption exception.

Message was edited by:

praveen80

praveen80a at 2007-7-12 20:03:46 > top of Java-index,Security,Cryptography...