Java security:illegal key size or default parameters?

Source: Internet
Author: User

From: Http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters

I had asked a question about this earlier, but it didn ' t get answered right and led nowhere. So I ' ve clarified few details on the problem and I would really like to hear your ideas on how could I fix this or what SH Ould I try.

I ' ve Java 1.6.0.12 installed on my Linux server and the code bellow runs just perfectly.

String key = "av45k1pfb024xa3bl359vsb4esortvks74sksr5oy4s5serondry84jsrryuhsr5ys49y5seri5shrdliheuirdygliurguiy5ru";try {    Cipher c = Cipher.getInstance("ARCFOUR");    SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "ARCFOUR");    c.init(Cipher.DECRYPT_MODE, secretKeySpec);    return new String(c.doFinal(Hex.decodeHex(data.toCharArray())), "UTF-8");} catch (InvalidKeyException e) {    throw new CryptoException(e);}

Today i installed Java 1.6.0.26 on my server user and if I try to run my application, I get the following excep tion. My guess would is that it had something to does with the Java installation configuration because it works in the first one, But doesn ' t work in the later version.

Caused by: java.security.InvalidKeyException: Illegal key size or default parameters    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]    at javax.crypto.Cipher.a(DashoA13*..) ~[na:1.6]    at javax.crypto.Cipher.init(DashoA13*..) ~[na:1.6]    at javax.crypto.Cipher.init(DashoA13*..) ~[na:1.6]    at my.package.Something.decode(RC4Decoder.java:25) ~[my.package.jar:na]    ... 5 common frames omitted

Line is:c.init(Cipher.DECRYPT_MODE, secretKeySpec);

Most likely you don't have the unlimited strength file installed now.

Need to download the This file:

Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6

Java Cryptography Extension (JCE) Unlimited Strength jurisdiction Policy Files 7 Download

Java Cryptography Extension (JCE) Unlimited Strength jurisdiction Policy Files 8 Download

Install the file in ${java.home}/jre/lib/security/ .

Java security:illegal key size or default parameters?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.