How to install Unlimited Strength Jurisdiction Policy Files?

前端 未结 6 1055
猫巷女王i
猫巷女王i 2020-12-19 02:15

Can someone explain to me how to install Unlimited Strength Jurisdiction Policy Files. I downloaded .jar files from Oracle website but I\'m having a problem with installing

6条回答
  •  忘掉有多难
    2020-12-19 02:59

    You need to determine your Java home path (either via System.getenv("JAVA_HOME") from Java or $ echo $JAVA_HOME on the command line). It should be a path like the following:

    • C:\Program Files\Java\jre8 on Windows
    • /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home on Mac OS X
    • /usr/java/jdk1.8.0_101/bin/java on *nix

    You then need to copy the US_export_policy.jar and local_policy.jar files you downloaded into the directory: /jre/lib/security and overwrite the existing files of the same name.

    Updated 05/17/17

    The following code (for demonstration purposes only) will instruct the JVM that it is allowed to use AES-256 bit encryption and corresponding TLS ciphers regardless of the policy files installed. It is not recommended to employ this method.

    if (Cipher.getMaxAllowedKeyLength("AES") < 256) {
      try {
        Field field = Class.forName("javax.crypto.JceSecurity").
        getDeclaredField("isRestricted");
        field.setAccessible(true);
        field.set(null, java.lang.Boolean.FALSE);
      } catch (Exception e) {
        fail("Could not override JCE cryptography strength policy setting");
        fail(e.getMessage());
      }
    }
    

提交回复
热议问题