• 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

Problem in encryption using AES with 256bit key

 
Ranch Hand
Posts: 180
Netbeans IDE Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to encrypt some text using AES with 256bit key but unable to achieve, at runtime it raises an Exception
Exception in thread "main" java.security.InvalidKeyException: Illegal key size or default parameters

When I change to 128 bit key size it works .I have JDK 7 and UnlimitedJCEPolicy is in JDK and JRE as part of JDK 7

my class



Please help

Thanks Ashok
 
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
Your code works for me under Ubuntu with JDK1.7.0_21 so I suspect that you do not actually have the 'unlimited strength' files installed in the jdk/jre that is actually being used. Make sure that you are picking up the jdk/jre that you think you are and if you are make sure you have installed the 'unlimited strength' files correctly.

P.S. Turning cipher text into a String using

is in general a sure way to corrupt it. OK you might get away with it for a particular ciphertext but in general you won't.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic