aspose file tools*
The moose likes Security and the fly likes Problem in encryption using AES with 256bit key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Problem in encryption using AES with 256bit key" Watch "Problem in encryption using AES with 256bit key" New topic
Author

Problem in encryption using AES with 256bit key

Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

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
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1110
    
  10

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in encryption using AES with 256bit key