JCE Support
***********

GNU Crypto provides a full JCE (Java Cryptography Environment) provider for all its algorithms. This chapter breifly describes these classes and how to use them.

Installing the JCE Classes
==========================

Java runtimes such as those based around Classpath, Kaffe, and JREs from Sun and IBM up to version 1.4 do not include the JCE classes, encompassed by the javax.crypto package and its subpackages. Furthermore, many commercial Java 1.4 and later runtime environments do not allow providers to be installed if they are not digitally signed by an authority. The GNU Crypto developers do not agree with this practice and are not seeking to have GNU Crypto's provider signed.

To overcome this GNU Crypto includes a clean-room implementation of the javax.crypto packages, which is a modified version of the clean-room JCE distributed by the Legion of the Bouncy Castle http://bouncycastle.org/. If building these classes is enabled at compile-time, a Java archive file javax-crypto.jar will be built, along with the appropriate shared native libraries if you are using GCJ. Simply adding it to your system classpath should suffice, possibly replacing or superceding the jce.jar file that came with your virtual machine.

The JCE included mirrors most of the features of the reference JCE, except the ExemptionMechanism classes are omitted. U.S. export rules as of January 2000 no longer apply to open source software that is freely available on the Internet, so these classes have no practical use in GNU Crypto.

Installing the GNU Crypto Provider
==================================

The GNU Crypto provider is implemented in the class gnu.crypto.jce.GnuCrypto, and is available by the name ``GNU Crypto''. You can install this provider at run-time by including in your program a statement such as:

     java.security.Security.addProvider(new gnu.crypto.jce.GnuCrypto());

Or by putting the following in your security properties file, usually located at ${JRE_HOME}/lib/security/${VM_NAME}.security:

     security.provider.N=gnu.crypto.jce.GnuCrypto

Where `N' is the appropriate preference number. Doing this, and asserting that the gnu-crypto.jar file is in your classpath, will complete the installation of the provider.

List of Available Algorithms
============================

The algorithms available through the GNU Crypto provider are, grouped by type, with alternate names in parentheses:

  * Cipher: AES, ANUBIS, ARCFOUR (RC4), BLOWFISH, DES, KHAZAD, RIJNDAEL, SERPENT, SQUARE, TRIPLEDES, TWOFISH.

     Ciphers may, of course, be appended with any of the modes and paddings available in GNU Crypto, such as ``AES/CBC/TBC''.

  * KeyPairGenerator: DSS (DSA), RSA.

  * MAC: HMAC-MD2, HMAC-MD4, HMAC-MD5, HMAC-RIPEMD128 (HMAC-RIPEMD-128), HMAC-RIPEMD160 (HMAC-RIPEMD-160), HMAC-SHA160 (HMAC-SHA, HMAC-SHA1, HMAC-SHA-160, HMAC-SHS), HMAC-TIGER, HMAC-WHIRLPOOL, TMMH16, UHASH32, UMAC32.

  * MessageDigest: MD2, MD4, MD5, RIPEMD128 (RIPEMD-128), RIPEMD-160 (RIPEMD-160), SHA-160 (SHA, SHA1, SHA-1, SHS), TIGER, WHIRLPOOL.

  * SecureRandom: ARCFOUR (RC4), ICM, MD2PRNG, MD4PRNG, MD5PRNG, RIPEMD128PRNG, RIPEMD160PRNG, SHA-160PRNG (SHAPRNG, SHA-1PRNG, SHA1PRNG), TIGERPRNG, WHIRLPOOLPRNG, UMAC-KDF.

  * Signature: DSS/RAW (SHA/DSA, SHA1/DSA, SHA-1/DSA, SHA-160/DSA, DSAwithSHA, DSAwithSHA1, DSAwithSHA160), RSA-PSS/RAW (RSA-PSS, RSAPSS).