au.net.aba.crypto.provider
Class Twofish

java.lang.Object
  |
  +--javax.crypto.CipherSpi
        |
        +--au.net.aba.crypto.provider.BlockCipher
              |
              +--au.net.aba.crypto.provider.Twofish

public final class Twofish
extends BlockCipher


Field Summary
static java.lang.String ident
           
static int MAX_KEY_BITS
           
protected static int ROUNDS
           
protected static int TF_BLOCK_SIZE
           
 
Fields inherited from class au.net.aba.crypto.provider.BlockCipher
BLOCK_SIZE, buffer, bufferPos, CBC, cbcV, ECB, firstBlock, ident, ivec, ivEncrypted, ivInline, key, mode, paddedStream, random, streamMode
 
Fields inherited from class javax.crypto.CipherSpi
ident
 
Constructor Summary
Twofish()
           
 
Method Summary
protected  int decryptBlock(byte[] src, int srcIndex, int len, byte[] dst, int dstIndex)
          Decrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.
protected  int encryptBlock(byte[] src, int srcIndex, int len, byte[] dst, int dstIndex)
          Encrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.
protected  int engineGetBlockSize()
          Returns the block size (in bytes).
protected  void engineSetPadding(java.lang.String padding)
          Sets the padding mechanism of this cipher.
protected  void setKey(java.security.Key inKey)
          Re-key the cipher.
 
Methods inherited from class au.net.aba.crypto.provider.BlockCipher
engineDoFinal, engineDoFinal, engineGetIV, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineUpdate, engineUpdate, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ident

public static final java.lang.String ident

ROUNDS

protected static final int ROUNDS

TF_BLOCK_SIZE

protected static final int TF_BLOCK_SIZE

MAX_KEY_BITS

public static final int MAX_KEY_BITS
Constructor Detail

Twofish

public Twofish()
Method Detail

setKey

protected void setKey(java.security.Key inKey)
               throws java.security.InvalidKeyException
Re-key the cipher. If the provided Key is not compatible with this cipher the exception should throw an InvalidKeyException.
Parameters:
inKey - the key to be used.
Throws:
java.security.InvalidKeyException - if the key is of the wrong type.
Overrides:
setKey in class BlockCipher

engineSetPadding

protected void engineSetPadding(java.lang.String padding)
                         throws NoSuchPaddingException
Sets the padding mechanism of this cipher.
Parameters:
padding - the name of the type of padding to be applied, currently "PKCS7Padding", and "NoPadding" will be accepted.
Throws:
NoSuchPaddingException - if the padding type is unknown.
Overrides:
engineSetPadding in class BlockCipher

engineGetBlockSize

protected int engineGetBlockSize()
Returns the block size (in bytes).
Returns:
the block size (in bytes) of the cipher.
Overrides:
engineGetBlockSize in class BlockCipher

encryptBlock

protected int encryptBlock(byte[] src,
                           int srcIndex,
                           int len,
                           byte[] dst,
                           int dstIndex)
                    throws IllegalBlockSizeException
Encrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset. The input will be an exact multiple of our blocksize.
Overrides:
encryptBlock in class BlockCipher

decryptBlock

protected int decryptBlock(byte[] src,
                           int srcIndex,
                           int len,
                           byte[] dst,
                           int dstIndex)
                    throws BadPaddingException
Decrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset. The input will be an exact multiple of our blocksize.
Overrides:
decryptBlock in class BlockCipher