File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Security and the fly likes Getting  Illegal key size or default parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "Getting  Illegal key size or default parameters" Watch "Getting  Illegal key size or default parameters" New topic
Author

Getting Illegal key size or default parameters

Raghvendra Pratap Singh
Greenhorn

Joined: Jul 26, 2012
Posts: 22

Hi

I am getting java.security.InvalidKeyException: Illegal key size or default parameters , I have fallow all the required step ,Installed Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
Also I have Gone through these Threads

java.security.InvalidKeyException: Illegal key size or default parameters error
Java Security: Illegal key size or default parameters?

But I am still stuck and getting java.security.InvalidKeyException: Illegal key size or default parameters ,

Below is My Code :
AESKeyGenerator.java



My Erro Stack Trace is




I Check with the standard code which is also same as this. I think there is some issue with configuration or missing libirary.

Please Help me

Thanks,
Raghvendra Pratap Singh

Thanks and Regards, Raghvendra Pratap Singh
"Quality means doing it right when no one is looking"
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1083
    
  10

Since the exception is thrown from within a servlet and we can't see the parameters you are using and how you are using this code it is difficult to help. Your best bet is to create and post a stand alone test harness that illustrates the problem and that does not involve your servlet.

Having looked in more detail at your code it seems to be nonsense and cobbled from code used for a very different purpose. Presumably the String 'dhkey' was originally a Diffe-Hellman parameter but I have no idea how the names of the methods generate_r() and generate_k() relate to their current functionality. You also need to work on your exception handling since it is dreadful.

P.S. Are you sure you have installed the Unlimited Strength files in the JDK being used to run your application server?
Raghvendra Pratap Singh
Greenhorn

Joined: Jul 26, 2012
Posts: 22

Hi Rechard Thanks for the Reply,

But that was nothing nonsense, I just asked that am I doing any configuration error, I was dam sure that there was nothing wrong with the code, that why i placed the code.

anyway
Actually That all was due to wrong installation,

I did wrong first is that I installed the policy files into Program files/jdk_1.7.0_13/jre/lib/security, but the JRE which was used is located in Program files/jre7


Now its working fine .

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Illegal key size or default parameters