AES 256 algorithm in Java encounters illegal key size or default parameters wrong solution

Source: Internet
Author: User

Error message:

Caused by: java.security.InvalidKeyException: Illegal key size or default parameters

Cause of the problem:

Java almost every common encryption algorithm can find the corresponding implementation. Due to export restrictions in the United States, Sun has imposed restrictions on access files (Local_policy.jar, Us_export_policy.jar). So there are some problems:
The key length does not meet the requirements (for example: Java.security.InvalidKeyException:Illegal key size or default parameters);
Some algorithms do not support, such as MD4, SHA-224 and other algorithms;
API is not very convenient to use, some of the commonly used conversion aids are not available, such as Base64 encoding conversion, hex encoding conversion tools.
Oracle provides policy-free file access on its official website (Unlimited Strength Jurisdiction policy files), and we can address the limitations by simply deploying it in the JRE environment.

Workaround:

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

JDK8 Jar Package:

Http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

JDK7 Jar Package:

Http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

JDK6 Jar Package:

Http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html

Replace the two jar packages: Local_policy.jar and Us_export_policy.jar with the original JDK installation directory C:\Program files\java\jre6\lib\security two jar package.

 

AES 256 algorithm in Java encounters illegal key size or default parameters wrong solution

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.