Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JCE zip file for JDK 9

I want to try JDK 9 and I need JCE patched. Where can I get JCE zip file for JDK 9? Or can I use the one for JDK 8 ? I searched for JCE zip for JDK 9 but am not able to locate it. Thanks in advance.

like image 315
Anjana Avatar asked Aug 23 '16 09:08

Anjana


People also ask

Is JCE included in JDK?

Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files Download. The Java Cryptography Extension enables applications to use stronger versions of standard algorithms. Current versions of the JDK do not require these policy files. They are provided here for use with older version of the JDK.

What version of Java is JDK 9?

Java™ SE Development Kit 9.0. 1 (JDK 9.0. 1) The full version string for this update release is 9.0.


1 Answers

Update: Strong cryptography is now enabled out of the box for all current releases of Java 6 - 9. For details see: https://stackoverflow.com/a/39889731/3392724


I assume with 'JCE zip file' you mean the "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files".

Apparently in Java 9 you no longer need a zip, see: http://mail.openjdk.java.net/pipermail/security-dev/2016-October/014943.html

Adding, 'Security.setProperty(“crypto.policy”, “unlimited”);' or editing the java.security configuration file will enable unlimited strength.

Additional details:

  • https://bugs.openjdk.java.net/browse/JDK-8061842
  • http://hg.openjdk.java.net/jdk9/dev/jdk/file/f82971b324f6/src/java.base/share/conf/security/policy/README.txt

Example using code to set the property:

import javax.crypto.Cipher;
import java.security.Security;

class Test {
  public static void main(String[] args) {
    Security.setProperty("crypto.policy", "unlimited");
    try {
      System.out.println("Hello World!");
      int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES/CBC/PKCS5Padding");
      System.out.println(maxKeyLen);
    } catch (Exception e){
      System.out.println("Sad world :(");
    }
  }
}

Result:

Hello World!
2147483647
Press any key to continue . . .

java -version:

Java(TM) SE Runtime Environment (build 9-ea+138)
Java HotSpot(TM) Server VM (build 9-ea+138, mixed mode)


Alternatively, edit the java.security configuration file in the JRE installation folder:

  • Open <jre9-home>/conf/security/java.security in your preferred text editor
  • Search for the line "crypto.policy=limited"
  • Change it to "crypto.policy=unlimited"
like image 135
bluemind Avatar answered Oct 01 '22 19:10

bluemind