Only 49 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher  RSS feed

 
sriramamurthy sunkara
Greenhorn
Posts: 6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am facing error "javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher" while calling decode/encode the string . After some time decode function not working.if i restart the application then same function is working fine. I am strange this kind of issues. Any body help me to resolve this issue.
Recently i have upgraded my jdk1.6.0_30 to jdk1.6.0_75. I don't know this issue was exist before migration. I have identified recently. Please find the code snippet.


decode:-
str = URLDecoder.decode(str,UTF8);

byte[] dec = new BASE64Decoder().decodeBuffer(str);
// Decrypt
byte[] utf8 = dCipher.doFinal(dec);
str = URLDecoder.decode(str,UTF8);


Encode:-
str=URLEncoder.encode(encrypt(str), UTF8);
byte[] utf8 = str.getBytes(UTF8);
// Encrypt
byte[] enc = eCipher.doFinal(utf8);
String encode=new BASE64Encoder().encode(enc);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!