How to install unlimited strength JCE for Java 8 in OS X?

JavaMacosJce

Java Problem Overview


I need to install the Java Cryptography Extension for Java 8 in OS X / mac OS. It turns out the steps from the README file which came with the installer include instructions only for Unix and Windows, but not for OS X / mac OS. I tried to put the JAR files in $JAVA_HOME/lib/security, but it didn't work either. Do you know how can I install them?

Java Solutions


Solution 1 - Java

Java 8 Update 161

As pointed out in another answer and in Oracle's release notes for Java 8 Update 161, unlimited cryptography is enabled by default since Update 161 and you shouldn't have to do anything if using a fresh installation of this version or higher.

Java 8 Update 151

With Java 8 Update 151, Oracle included the same JCE mechanism into Java 8 that they already provided with Java 9. To enable JCE in Java 8 Update 151 or higher, just set the property

crypto.policy=unlimited

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

It's probably a good idea to remove the old policy JAR's if they were added earlier, as Oracle states in the release notes:

> Because the old JCE jurisdiction files are left in > /lib/security, they may not meet the latest security JAR > signing standards, which were refreshed in 6u131, 7u121, 8u111, and > later updates.

Older Versions

Answers suggesting to install the JCE files via Homebrew won't work anymore, as the casks were deleted from the Homebrew repository after release of the Java 8 Update 151. If using an older version of Java 8, you'll have to put the JCE-Policy-JAR manually as described in another answer.

Solution 2 - Java

Note: As of Java JDK version 8u161 unlimited cryptography is enabled by default

FOR MacOS user

If you are MacOS user, put the jars extracted from jce_policy-8.zip if your java version is 8.* use below path (to put jars under it)

/Library/Java/JavaVirtualMachines/**< jdk_version_of_your_pc >**/Contents/Home/jre/lib/security

Solution 3 - Java

As of Java 8u152, unlimited strength can be enabled simply by setting crypto.policy=unlimited in the java.security file in

/Library/Java/JavaVirtualMachines/<jdk_version>/Contents/Home/jre/lib/security 

It's already in that file but commented out.

enter image description here

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

Solution 4 - Java

For a Mac user (OS X) on Java 8:

> $ brew reinstall java8

As of JDK 1.8u151 it is not necessary to download the JCE libraries separately. Simply edit

> $JDK_HOME/jre/lib/security/java.security

and uncomment the line:

crypto.policy=unlimited

This will enable the unlimited strength JCE.

JDK 1.8u151 Release Notes

Solution 5 - Java

As of Java JDK version 8u161 unlimited cryptography is enabled by default and the other suggested methods should no longer be necessary (unless you want to disable it).

This change also appears to be included in other major JDK versions from JDK 6 to JDK 9.

Solution 6 - Java

As you did not explain what is your problem here some guesses.

  1. Using an internet search engine you probably would have found this page http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
  2. you might have downloaded this file jce_policy-8.zip
  3. maybe you would have unzipped it and had a look into directory UnlimitedJCEPolicyJDK8/
  4. maybe the file README.txt would have attracted your interest

If all of those steps would have been true, then you would have found

3)  Install the unlimited strength policy JAR files.

In case you later decide to revert to the original "strong" but
limited policy versions, first make a copy of the original JCE
policy files (US_export_policy.jar and local_policy.jar). Then
replace the strong policy files with the unlimited strength
versions extracted in the previous step.

The standard place for JCE jurisdiction policy JAR files is:

    <java-home>/lib/security           [Unix]
    <java-home>\lib\security           [Windows]

You can assume that the location on OSX is the same as for the listed systems.

Solution 7 - Java

For later versions of macOS (e.g., Sierra), Oracle Java is installed in two locations depending on if you install the JRE or JDK.

  • JRE: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/
  • JDK: /Library/Java/JavaVirtualMachines/jdk1.x.x_xxx.jdk/Contents/Home/
    • If you install the JDK, it will also install the JRE at the JRE location listed above.

The JRE allows you to double-click to open jars from the Finder and run Java in the browser. The JRE does not come with the java binary, so if you want to run any of the typical Java commands, you must install the JDK. More at https://java.com/en/download/faq/yosemite_java.xml.

All this to say, when installing then unlimited strength JCE files, install them in both directories listed above to get consistent behavior.

Solution 8 - Java

if you're a windows user:

download the most updated JCE on http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

extract zip file and copy the two jar files in the following directory

\Program Files\Java\jre1.8.0_131\lib\security

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJonDoe297View Question on Stackoverflow
Solution 1 - JavaanothernodeView Answer on Stackoverflow
Solution 2 - JavapraxnetView Answer on Stackoverflow
Solution 3 - JavaAlanystView Answer on Stackoverflow
Solution 4 - JavaFredric DoddridgeView Answer on Stackoverflow
Solution 5 - JavarobSE13View Answer on Stackoverflow
Solution 6 - JavaSubOptimalView Answer on Stackoverflow
Solution 7 - JavayanokwaView Answer on Stackoverflow
Solution 8 - JavaBoris_NdongView Answer on Stackoverflow