• 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

Unable to decrypt the encrypted message

 
Ranch Hand
Posts: 163
1
jQuery Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I have written encryption and decryption program using AES in ContactAction.java. I am encrypting the id (primary key) and emai id (string) & sending a mail to the user. the id and email are encrypted and a link is send to the mail id in with encrypted id and email. When the user clicks that link he should be able to see the message what he has typed. But during decryption i am getting "javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16"

Please help me understand where I am going wrong in my code:

ContactAction.java







thanks

swapna kori
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can see nothing obvious but somewhere in the chain of things your ciphertext is becoming corrupted.

Note - using

defaults the block mode and padding to


and ECB is generally considered insecure since it allows forgery of ciphertext by splicing parts of different ciphertext.

<edit> I have just seen one possibility - your split() on '=' may be picking up the '=' at the end of a Base64 encoding! The offending code is

so your ciphertext may be truncated!
 
reply
    Bookmark Topic Watch Topic
  • New Topic