Installing the JCE

Top  Previous  Next

The JCE (Java Cryptography Extension) is a set of optional packages for JDK 1.2.x and JDK 1.3.x that provides classes for encryption, key generation and key agreement.  The JCE is necessary only if you are using the Sftp class with a JDK prior to JDK 1.4.

 

Download the JCE

 

The first step in installing the JCE is to download the optional JCE package provided for JDK versions 1.2.x and 1.3.x. 

 

http://java.sun.com/products/jce/index-122.html

 

Install the JCE jar files

 

After downloading the JCE extract the contents of the package to a directory on your system.  In the lib directory of this package you will find the files jce1_2_2.jar, local_policy.jarsunjce_provider.jar and US_export_policy.jar files.  Copy these files to your <java-home>/lib/ext directory e.g. C:\jdk1.2.2\jre\lib\ext.

 

Register the SunJCE provider

 

In your <java-home>/lib/security/java.security file you should find a section that lists the security providers and their preference.

 

Example

 

#

# List of providers and their preference orders (see above):

#

security.provider.1=sun.security.provider.Sun

 

Update this section registering the com.sun.crypto.provider.SunJCE class as a provider.

 

Example

 

#

# List of providers and their preference orders (see above):

#

security.provider.1=sun.security.provider.Sun

security.provider.2=com.sun.crypto.provider.SunJCE

 

 

Update your policy file

 

In your <java-home>/lib/security/java.policy file add the following statement (this may already exist in some JDK installations) so that the installed extensions may be accessed by the JDK.

 

// Standard extensions get all permissions by default

 

grant codeBase "file:${java.home}/lib/ext/*" {

       permission java.security.AllPermission;

};