Using cryptography in Java

To use cryptography in Java, you will need to download the Java Cryptography
Extension (JCE) API and the reference implementation by Sun (only available for
US and Canada due to export restrictions) or another implementation by a
so-called cryptography service provider.

Steps in installing/configuring the JCE1.2:

  1. For US/CAN users: download JCE 1.2 from java.sun.com
  2. Unzip the file (eg. to c:java) and add jce1_2-do.jar to your classpath:
    set classpath=%classpath%;c:javajce1.2libjce1_2-do.jar
  3. Register the SunJCE provider:
    Statically: edit the security properties file, located in libsecurityjava.security
    and add the following line to it:
    security.provider.n=com.sun.crypto.provider.SunJCE
    where n is the preference order (you could have other providers!)
    Dynamically: you can also add the provider at runtime:
     
            Security.addProvider(new com.sun.crypto.provider.SunJCE());
         

    Make sure jce1_2-do.jar is added to your classpath, in order for this to compile.

Steps in installing/configuring another service provider, eg. Cryptix:

  1. Cryptix is available from servers located around the world: download Cryptix_bin_3-1-1.zip (or a newer version) from www.cryptix.org
  2. Unzip the file (eg. to c:javacryptix) and add the installed jar files (in C:javacryptixclasses) to your classpath: set classpath=%classpath%;c:javacryptixclassesSPT_0-1-1.jar; …
  3. Register the Cryptix provider:
    Statically: edit the security properties file, located in libsecurityjava.security
    and add the following line to it:
    security.provider.n=cryptix.provider.Cryptix
    where n is the preference order (you could have other providers!)
    Cryptix provides a program that does this for you. Assuming you have changed your classpath, you can invoke
    the following installation script:
     
            java cryptix.provider.Install
         

    Dynamically: you can also add the provider at runtime:

     
            Security.addProvider(new cryptix.provider.Cryptix());