• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic