edu.vt.middleware.crypt.symmetric.Twofish Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vt-crypt Show documentation
Show all versions of vt-crypt Show documentation
Library for performing common cryptographic operations
/*
$Id$
Copyright (C) 2007-2011 Virginia Tech.
All rights reserved.
SEE LICENSE FOR MORE INFORMATION
Author: Middleware Services
Email: [email protected]
Version: $Revision$
Updated: $Date$
*/
package edu.vt.middleware.crypt.symmetric;
/**
* Provider of symmetric encryption/decryption operations using Twofish cipher.
*
* @author Middleware Services
* @version $Revision: 3 $
*/
public class Twofish extends SymmetricAlgorithm
{
/** Algorithm name. */
public static final String ALGORITHM = "Twofish";
/** Default key size for this algorithm in bits. */
public static final int DEFAULT_KEY_LENGTH = 256;
/** Available key lengths in bits. */
public static final int[] KEY_LENGTHS = new int[] {
256,
192,
128,
};
/**
* Creates a default Twofish symmetric encryption algorithm using CBC mode and
* PKCS5 padding.
*/
public Twofish()
{
this(DEFAULT_MODE, DEFAULT_PADDING);
}
/**
* Creates a default Twofish symmetric encryption algorithm using the given
* mode and padding style.
*
* @param mode Cipher mode name.
* @param padding Cipher padding style name.
*/
public Twofish(final String mode, final String padding)
{
super(ALGORITHM, mode, padding);
}
/** {@inheritDoc} */
public int getDefaultKeyLength()
{
return DEFAULT_KEY_LENGTH;
}
/** {@inheritDoc} */
public int[] getAllowedKeyLengths()
{
return KEY_LENGTHS;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy