Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install unlimited strength JCE for JRE 7 in MacOSX?

Tags:

java

macos

jce

I installed Oracle JRE 7 (not JDK) for MacOSX but I can't locate where the JCE jurisdiction files are placed.

I need to replace them with the unlimited strength version.

like image 734
Andrea Mariottini Avatar asked Sep 03 '12 09:09

Andrea Mariottini


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 is a JCE file?

The Java™ Cryptography Extension (JCE) is a set of Java packages from IBM® that provides a framework and implementations for encryption, key generation and key agreement, and Message Authentication Code (MAC) algorithms.


2 Answers

I've installed the Oracle JDK, and if it helps, the directory in my case was /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/jre/lib/security/. Your mileage may vary, in which case just run find . -name local_policy.jar and see what it turns up.

like image 167
Thom Avatar answered Sep 28 '22 18:09

Thom


This is for the JDK, not the JRE.


I'm on a Mac, OSx Lion and I used /usr/libexec/java_home to find my java home

/usr/libexec/java_home -V # Matching Java Virtual Machines (3): #     1.7.0_51, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home #     1.6.0_65-b14-462, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home #     1.6.0_65-b14-462, i386:   "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home #  # /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home  /usr/libexec/java_home # /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home  /usr/libexec/java_home -v 1.6 # /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home  /usr/libexec/java_home -v 1.7 # /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home 

From here you can use this executable and find to locate these files

find $(/usr/libexec/java_home -v 1.7) -name local_policy.jar # /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/local_policy.jar  find $(/usr/libexec/java_home -v 1.7) -name US_export_policy.jar # /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/US_export_policy.jar 

And combine that with @ngreen's answer to get the md5 of these files (if you want)

find ~/Downloads/UnlimitedJCEPolicy -name *.jar |xargs md5 # MD5 (/Users/nperry/Downloads/UnlimitedJCEPolicy/local_policy.jar) = 9dd69bcc7637d872121880c35437788d # MD5 (/Users/nperry/Downloads/UnlimitedJCEPolicy/US_export_policy.jar) = 3bb2e88a915b3cb003ca185357a92c16  find $(/usr/libexec/java_home -v 1.7) -name local_policy.jar | xargs md5 # MD5 (/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/local_policy.jar) = f41ab8f64b1fa13fec7276579c420951  find $(/usr/libexec/java_home -v 1.7) -name US_export_policy.jar | xargs md5 # MD5 (/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/US_export_policy.jar) = d5d126ae15abecb7d6e3a28b0d57543e 

And you can see I have not replaced these files yet.

Backup the original files if you want

mkdir ~/Downloads/JCEPolicy-originals-1.7/ cp $(find $(/usr/libexec/java_home -v 1.7) -name local_policy.jar)     ~/Downloads/JCEPolicy-originals-1.7/ cp $(find $(/usr/libexec/java_home -v 1.7) -name US_export_policy.jar) ~/Downloads/JCEPolicy-originals-1.7/ 

You can replace the files with this.

sudo cp ~/Downloads/UnlimitedJCEPolicy/local_policy.jar $(find $(/usr/libexec/java_home -v 1.7) -name local_policy.jar) sudo cp ~/Downloads/UnlimitedJCEPolicy/US_export_policy.jar $(find $(/usr/libexec/java_home -v 1.7) -name US_export_policy.jar) 

And getting the MD5s tells me if it worked

find $(/usr/libexec/java_home -v 1.7) -name local_policy.jar | xargs md5 # MD5 (/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/local_policy.jar) = 9dd69bcc7637d872121880c35437788d  find $(/usr/libexec/java_home -v 1.7) -name US_export_policy.jar | xargs md5 # MD5 (/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/security/US_export_policy.jar) = 3bb2e88a915b3cb003ca185357a92c16 
like image 33
Nate Avatar answered Sep 28 '22 16:09

Nate