read

Oracle Java Development Kit (JDK) 8u151 & 8u152+ now allows you to set a “crypto.policy Security property in the java.security file” instead of separately downloading & installing the JCE extensions (which everyone seems to struggle with the first time, deployment issues, etc).

It’s much easier now. Here’s how you can do it per JVM (remember this is only on 8u151+)

# Name or location of file can be anything:
$ echo crypto.policy=unlimited > ~/.unlimited.security.properties
$ JAVA_OPTS=-Djava.security.properties=~/.unlimited.security.properties
$ groovysh
groovy:000> println(javax.crypto.Cipher.getMaxAllowedKeyLength("AES"))
2147483647

Or system wide:

edit $JAVA_HOME/jre/lib/security/java.security

Uncomment

-#crypto.policy=unlimited
+crypto.policy=unlimited

One downside of this approach though is that you will have to remember to do this each time you update your JDK.

JDK 8u152 release notes - http://www.oracle.com/technetwork/java/javase/8u152-relnotes-3850503.html#JDK-8157561

Blog Logo

Eric Helgeson


Published

Image

Agile Orbit

Agile Development and DevOps

Back to Overview