edu.vt.middleware.crypt.symmetric
Class Twofish
java.lang.Object
edu.vt.middleware.crypt.AbstractAlgorithm
edu.vt.middleware.crypt.AbstractEncryptionAlgorithm
edu.vt.middleware.crypt.symmetric.SymmetricAlgorithm
edu.vt.middleware.crypt.symmetric.Twofish
- All Implemented Interfaces:
- Algorithm, EncryptionAlgorithm
public class Twofish
- extends SymmetricAlgorithm
Provider of symmetric encryption/decryption operations using Twofish cipher.
- Version:
- $Revision: 3 $
- Author:
- Middleware Services
|
Constructor Summary |
Twofish()
Creates a default Twofish symmetric encryption algorithm using CBC mode and
PKCS5 padding. |
Twofish(String mode,
String padding)
Creates a default Twofish symmetric encryption algorithm using the given
mode and padding style. |
| Methods inherited from class edu.vt.middleware.crypt.symmetric.SymmetricAlgorithm |
generateKey, generateKey, generateKey, getAlgorithmParameterSpec, getChunkSize, getMaxKeyLength, getMinKeyLength, getRandomIV, hasIV, isValidKeyLength, newInstance, newInstance, newInstance, newInstance, setIV |
| Methods inherited from class edu.vt.middleware.crypt.AbstractEncryptionAlgorithm |
crypt, crypt, decrypt, decrypt, decrypt, encrypt, encrypt, encrypt, getBlockSize, getCipherMode, getMode, getPadding, init, initCipher, initDecrypt, initEncrypt, setKey, toString |
ALGORITHM
public static final String ALGORITHM
- Algorithm name.
- See Also:
- Constant Field Values
DEFAULT_KEY_LENGTH
public static final int DEFAULT_KEY_LENGTH
- Default key size for this algorithm in bits.
- See Also:
- Constant Field Values
KEY_LENGTHS
public static final int[] KEY_LENGTHS
- Available key lengths in bits.
Twofish
public Twofish()
- Creates a default Twofish symmetric encryption algorithm using CBC mode and
PKCS5 padding.
Twofish
public Twofish(String mode,
String padding)
- Creates a default Twofish symmetric encryption algorithm using the given
mode and padding style.
- Parameters:
mode - Cipher mode name.padding - Cipher padding style name.
getDefaultKeyLength
public int getDefaultKeyLength()
- Gets the default key length for this algorithm.
- Overrides:
getDefaultKeyLength in class SymmetricAlgorithm
- Returns:
- Default key length in bits.
getAllowedKeyLengths
public int[] getAllowedKeyLengths()
- Gets an array of key lengths that are acceptable for the cipher algorithm.
By convention the lengths are returned in descending sort order from
longest to shortest. There are some ciphers (e.g. Blowfish) that allow key
sizes to be any integral value in a range; in those cases only key sizes
that are multiple of the cipher block length are returned. Thus this method
always returns lengths that are acceptable, but not necessarily
all possible lengths.
- Overrides:
getAllowedKeyLengths in class SymmetricAlgorithm
- Returns:
- Array of key lengths in bits.
Copyright © 2003-2011 Virginia Tech. All Rights Reserved.