au.net.aba.crypto.spec
Class TwofishKeySpec

java.lang.Object
  |
  +--au.net.aba.crypto.spec.TwofishKeySpec

public class TwofishKeySpec
extends java.lang.Object
implements java.security.spec.KeySpec

A class that provides a specification for a Twofish key. Twofish keys may be 256, 192 or 128 bits long (shorter keys are padded with zeros to next larger size).


Field Summary
static java.lang.String ident
           
 
Constructor Summary
TwofishKeySpec(byte[] key)
          Uses the first 32 bytes (if available) as the key, starting at 0
TwofishKeySpec(byte[] key, int offset)
          Uses the first 32 bytes (if available) in key, beginning at offset, as the Twofish key
 
Method Summary
 byte[] getKey()
          Returns the Twofish key.
 
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
Constructor Detail

TwofishKeySpec

public TwofishKeySpec(byte[] key)
               throws java.security.InvalidKeyException
Uses the first 32 bytes (if available) as the key, starting at 0
Parameters:
key - the byte array to use as key material.
Throws:
java.security.InvalidKeyException - if the key material is too short.

TwofishKeySpec

public TwofishKeySpec(byte[] key,
                      int offset)
               throws java.security.InvalidKeyException
Uses the first 32 bytes (if available) in key, beginning at offset, as the Twofish key
Parameters:
key - the byte array to use as key material.
offset - the offset to start at.
Throws:
java.security.InvalidKeyException - if the key material is too short.
Method Detail

getKey

public byte[] getKey()
Returns the Twofish key.
Returns:
the bytes making up the key.