# Cryptix - Cryptographic extensions for Java

Note: this file is not up-to-date with the changes that were made in version 2.2.2.

## Changes made in version 2.2.0a:

- A new package java.security.* has been added, which contains a clean-room re-implementation of JavaSoft's JCE (the part of java.security.* that is not exportable from the U.S.) The class cryptix.security.Cryptix acts as a JCA security provider.
- The JCE re-implementation is mostly done, but the only ciphers that have been tested are IDEA and SPEED in ECB and CFB modes. In theory DES and Blowfish should also work (except that DES seems to be failing its self-tests). Support for padding, and the classes java.security.CipherInputStream and CipherOutputStream, are not complete.
- The text file `cryptix.properties` maps from algorithm names to class names. It should be stored in the same location as the classfiles in the cryptix.security package.
- Most of the code for loading native libraries in the DES, IDEA, Blowfish and SPEED classes has been moved into a single class, cryptix.security.NativeLink. Similarly BigNum uses cryptix.math.NativeLink.
- cryptix.security.BlockCipher and StreamCipher now inherit from java.security.Cipher, via the new class cryptix.security.CryptixCipher.
- The implementation of the IDEA, DES, Blowfish, SPEED, and CFB classes has been changed to make them compatible with JCA.
- The library now requires Java 1.1 or higher (since JCE relies on the java.security.* classes distributed with 1.1, and because the Reflection API is used in some cases to call cipher constructors).
- The class cryptix.security.EnablePrivilegeHack will be needed to load libraries in Netscape 4.0. This class won't compile unless you set your CLASSPATH so that the "`nshack`" directory is before classes.zip. The `nshack` directory doesn't need to be distributed with the binary release; it's only needed to compile.
- Tabs have been converted to spaces in all the source files.
- A directory `util` has been added, containing two Java programs FixLineEndings and Replace. These programs were used to make global changes to the source.
- The Java program "util.FixLineEndings" can be used to change the line endings to the convention on your platform. E.g. if you have Unix-like `find` and `xargs` commands,

  > `find src -name *.java |xargs java util.FixLineEndings`

  You will get a bunch of backup files, which can be deleted (after you've checked that everything still compiles) using

  > `find src -name *.bak |xargs rm`

- The scripts `src/build.sh`, `src/build.bat` can be used to recompile everything. By default they will put the classfiles in the same directories as the source. To create classfiles in a separate `classes` directory, `cd` to the `src` directory, then use

  > `sh build.sh -d ../classes`

  or

  > `build -d ..\classes`

- There is a documentation directory, `doc`, with a subdirectory `images` containing .gifs for javadoc, and scripts `makedocs.sh`, `makedocs.bat` that re-build the documentation. The directory `guide` contains additional HTML files (at the moment just the JCA and JCE specs, the Cryptix FAQ, and this `changes.html` file).
- The Cryptix FAQ has been updated to take these changes into account (and some minor errors fixed, for example RSA was invented in the 1970s, not the 1960s).

## Specific packages

- package cryptix.math
  - added methods BigInteger#toJavaMathBigInteger and #fromJavaMathBigInteger
  - changed native linking scheme for BigNum
  - added copy of NativeLink.java (linking support)
- package cryptix.security
  - changed DES, IDEA, Blowfish, SPEED, and CFB to be compatible with JCE
  - made BlockCipher and StreamCipher inherit from the new class CryptixCipher, which inherits from java.security.Cipher
  - various implementation changes to BlockCipher and StreamCipher to support JCE
  - documentation changes to BlockCipher and StreamCipher
  - CipherFeedback functionality has been moved into CFB, and CipherFeedback deprecated
  - the private fields in class SPEED used "`_size`" as a suffix to indicate number of bits; changed this to "`_bits`"
  - changed native linking scheme for DES, IDEA, Blowfish, and SPEED
  - added copy of NativeLink.java (linking support)
- package cryptix.security.rsa
  - made SecretKey implement java.security.interfaces.RSAPrivateKey
  - made PublicKey implement java.security.interfaces.RSAPublicKey
  - methods added to SecretKey and PublicKey to support those interfaces
- new package cryptix.security.keys
  - for each algorithm, there is an AlgorithmNameKeyGenerator class
  - the DES key generator checks for weak and semi-weak keys
  - the class RawKeyGenerator is a superclass for the other key generators
  - the class RawSecretKey represents key objects using a byte array
- package cryptix.examples
  - added a TestJCE class, which is a command-line program that takes a cipher name, and optionally mode and padding names as arguments
- package cryptix.util
  - added class cryptix.util.Hex (utility methods for converting between byte arrays and hex strings)
  - added interface cryptix.util.LinkStatus (provides a way to get information about native library versions, why a library failed to link, etc.)
- package cryptix.pgp
  - renamed cryptix.pgp.CFB to "PGP_CFB", to reduce confusion with cryptix.security.CFB (this class needs re-testing, since the implementation of CFB has been changed).
  - renamed the protected field KeyRing#entrysById to "entriesById"