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

8

63

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?

Depside answered 10/6, 2016 at 6:17 Comment(0)
A
104

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.

Assyria answered 12/7, 2017 at 10:43 Comment(0)
V
84

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
Vernon answered 6/12, 2016 at 18:43 Comment(1)
please see answer from anothernode below. That is the correct solution for java 8 > 151 on/after Oct 2017.Culliton
H
13

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

Hermosillo answered 26/10, 2017 at 16:30 Comment(1)
The JDK JCE framework uses the unlimited policy files by default. sourced from jdk8_191Ringhals
L
12

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

Lysis answered 20/10, 2017 at 0:50 Comment(0)
S
8

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.

Skidproof answered 4/2, 2018 at 4:19 Comment(0)
V
6

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.

Void answered 10/6, 2016 at 6:58 Comment(1)
@Depside /Library/Java/JavaVirtualMachines/< jdk_version_of_your_pc >/Contents/Home/jre that is your <java-home>. And when you add /lib/security you have the path from prasshant.Void
M
5

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.

Morbihan answered 21/4, 2017 at 21:14 Comment(0)
H
4

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

Hepcat answered 18/10, 2017 at 20:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.