aspose file tools*
The moose likes Security and the fly likes javax.crypto.BadPaddingException: Given final block not properly padded Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "javax.crypto.BadPaddingException: Given final block not properly padded" Watch "javax.crypto.BadPaddingException: Given final block not properly padded" New topic
Author

javax.crypto.BadPaddingException: Given final block not properly padded

Muneeb Kiani
Greenhorn

Joined: Sep 08, 2011
Posts: 5
hi..!

i'm having this exception, when i tried to decrypt a msg coming frm server... "javax.crypto.BadPaddingException: Given final block not properly padded". here is my code.

Encryption code



Decryption Code:

greg stark
Ranch Hand

Joined: Aug 10, 2006
Posts: 220
You should read your own code. Your are clearly processing the key differently for encryption and decryption. Also, you are using defaults in the getInstance() method in the encryption code but you are fully specifying the mode and padding in that same method in the decryption code? How do you know they'll be the same?


Nice to meet you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.crypto.BadPaddingException: Given final block not properly padded