Class BFishMod

java.lang.Object
  |
  +--BFishMod
All Implemented Interfaces:
CryptInterface, ModInterface

public final class BFishMod
extends java.lang.Object
implements CryptInterface

This is the module for the Blowfish encryption algorithm.


Field Summary
static int BLOCK_SIZE
          Size of encryption blocks (in bytes).
 int MAX_KEY_LENGTH
          The maximum length for keys (in bytes).
 int MIN_KEY_LENGTH
          Minimum size for the key length (in bytes).
 
Constructor Summary
BFishMod()
          The default constructor simply initializes the array values to the initial values required for the algorithm.
 
Method Summary
 byte[] decrypt(java.io.File file)
          This method is implemented from the CryptInterface.
 java.io.File encrypt(java.io.File file)
          This method is implemented from the CryptInterface class.
 boolean handles(java.lang.Object key)
          This method is implemented from the ModInterface class.
 void setKey(byte[] key)
          This method is used to set the key for the algorithm and initialize it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_KEY_LENGTH

public final int MAX_KEY_LENGTH
The maximum length for keys (in bytes).

See Also:
Constant Field Values

BLOCK_SIZE

public static final int BLOCK_SIZE
Size of encryption blocks (in bytes). This is 64 bits.

See Also:
Constant Field Values

MIN_KEY_LENGTH

public final int MIN_KEY_LENGTH
Minimum size for the key length (in bytes).

See Also:
Constant Field Values
Constructor Detail

BFishMod

public BFishMod()
The default constructor simply initializes the array values to the initial values required for the algorithm. This will hopefully save time when this module is loaded.

Method Detail

encrypt

public java.io.File encrypt(java.io.File file)
This method is implemented from the CryptInterface class. It simply encrypts the file (java class) and overwrites the existing version. So if you plan on using this class make sure you make a copy of your originals, if you do not wish to recompile.

Specified by:
encrypt in interface CryptInterface
Returns:
returns the file after it has been encrypted.

decrypt

public byte[] decrypt(java.io.File file)
This method is implemented from the CryptInterface. It decrypts the specified file, and returns it in byte[] format.

Specified by:
decrypt in interface CryptInterface
Returns:
returns the byte[] containing the decrypted data.

setKey

public void setKey(byte[] key)
            throws java.lang.Exception
This method is used to set the key for the algorithm and initialize it. This method must be called BEFORE you make any calls to encrypt or decrypt.

Specified by:
setKey in interface CryptInterface
Throws:
java.lang.Exception - This is just in case your implementation throws junk

handles

public boolean handles(java.lang.Object key)
This method is implemented from the ModInterface class. It should return true if the key is equal to "Blowfish" (the variable stored in the module.key entry of the module.mf file).

Specified by:
handles in interface ModInterface
Returns:
returns true if key is equal to "Blowfish".