|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectBlackbird.Twofish
public final class Twofish
Twofish is an AES candidate algorithm. It is a balanced 128-bit Feistel cipher, consisting of 16 rounds. In each round, a 64-bit S-box value is computed from 64 bits of the block, and this value is xored into the other half of the block. The two half-blocks are then exchanged, and the next round begins. Before the first round, all input bits are xored with key- dependent "whitening" subkeys, and after the final round the output bits are xored with other key-dependent whitening subkeys; these subkeys are not used anywhere else in the algorithm.
Twofish was submitted by Bruce Schneier, Doug Whiting, John Kelsey, Chris Hall and David Wagner.
Reference:
Copyright © 1998
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
See:
http://www.cryptix.org/LICENSE.TXT
Cryptix General License
Copyright (c) 1995-2005 The Cryptix Foundation Limited.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND
CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$Revision: $
| Field Summary | |
|---|---|
static int |
PW_SIZE
|
static java.lang.String |
strClassID
|
| Fields inherited from interface Blackbird.EncryptionEntity |
|---|
strBBCodeSelect, strFlatSelect, strHTMLSelect |
| Constructor Summary | |
|---|---|
Twofish(int i)
|
|
| Method Summary | |
|---|---|
static byte[] |
blockDecrypt(byte[] in,
int inOffset,
java.lang.Object sessionKey)
Decrypt exactly one block of ciphertext. |
static byte[] |
blockEncrypt(byte[] in,
int inOffset,
java.lang.Object sessionKey)
Encrypt exactly one block of plaintext. |
static int |
blockSize()
|
static void |
buildInitVector()
buildInitVector - builds the initialization vector internally from the password after it is set. |
static byte[] |
copyOf(byte[] original,
int newLength)
|
static byte[] |
copyOfRange(byte[] original,
int from,
int to)
|
java.lang.String |
decrypt(java.lang.String strArgList)
This is the upper level decrypt call for Twofish, called by the applet which is initiated by the anonymous JavaScript call from this class. |
static byte[] |
decryptCBCStream(byte[] in)
This is the public version of the stream decrypt, whereas the key is internal and private and this class is therefore called into when these parameters are set. |
static byte[] |
encryptCBCStream(byte[] in)
Public version for calling encryption in the private version, after one way setting for key creations are done. |
java.lang.String |
getClassID()
Return the class identification string. |
int |
getIndex()
|
java.lang.String |
getJavaScriptCode()
|
java.awt.MenuItem[] |
getMenuItems()
Return an array of menu items needed by the applet to build the right-click menu. |
int |
getOPCode(java.lang.String s)
Opcode is returned depending on the string used to query this class. |
void |
killPanel()
This is invoked by the panels themeselves to dispose when no longer needed. |
void |
killPWPanel()
Twofish has a seperate password entry panel that needs its own executioner. |
static void |
makeKey()
|
java.lang.String |
parseID(java.lang.String arglist)
parseID is used by those entities that need to single out an Identifier string needed by a using class to find out "who" created the encryption entry. |
static boolean |
self_test()
A basic symmetric encryption/decryption test. |
void |
setFrameTarget(int i)
setFrameTarget is used to set a variable that is concated in the Javascript generation function that is set pertaining to the "position" the applet resides in the DOM. |
void |
setID(java.lang.String sid)
Utility function for setting internal User Identifier. |
boolean |
setPasswordExternally(java.lang.String p)
Twofish can be used by other classes for encrypting and decrypting. |
void |
showEncryptionControlPanel(int i,
java.awt.Image iconImage,
java.lang.Object o)
This is called by menu actions in the Applet. |
boolean |
testRuntime()
|
boolean |
usesPWIVector()
Some Encryption entities use passwords or initialization vectors. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PW_SIZE
public static final java.lang.String strClassID
| Constructor Detail |
|---|
public Twofish(int i)
| Method Detail |
|---|
public static void buildInitVector()
public static void makeKey()
throws java.security.InvalidKeyException
java.security.InvalidKeyException
public static byte[] blockEncrypt(byte[] in,
int inOffset,
java.lang.Object sessionKey)
in - The plaintext.inOffset - Index of in from which to start considering data.sessionKey - The session key to use for encryption.
public static byte[] blockDecrypt(byte[] in,
int inOffset,
java.lang.Object sessionKey)
in - The ciphertext.inOffset - Index of in from which to start considering data.sessionKey - The session key to use for decryption.
public static byte[] encryptCBCStream(byte[] in)
in -
public static byte[] decryptCBCStream(byte[] in)
in -
public static byte[] copyOfRange(byte[] original,
int from,
int to)
original - from - to -
public static byte[] copyOf(byte[] original,
int newLength)
original - newLength -
public static boolean self_test()
public static int blockSize()
public java.lang.String getJavaScriptCode()
getJavaScriptCode in interface EncryptionEntitypublic void killPanel()
killPanel in interface EncryptionEntitypublic void killPWPanel()
public void showEncryptionControlPanel(int i,
java.awt.Image iconImage,
java.lang.Object o)
showEncryptionControlPanel in interface EncryptionEntityi - iconImage - o - public java.awt.MenuItem[] getMenuItems()
getMenuItems in interface EncryptionEntitypublic int getOPCode(java.lang.String s)
getOPCode in interface EncryptionEntitys -
public int getIndex()
getIndex in interface EncryptionEntitypublic boolean testRuntime()
testRuntime in interface EncryptionEntitypublic boolean setPasswordExternally(java.lang.String p)
setPasswordExternally in interface EncryptionEntityp -
public java.lang.String decrypt(java.lang.String strArgList)
decrypt in interface EncryptionEntitystrArgList -
public void setFrameTarget(int i)
setFrameTarget in interface EncryptionEntityi - public java.lang.String getClassID()
getClassID in interface EncryptionEntitypublic boolean usesPWIVector()
usesPWIVector in interface EncryptionEntitypublic java.lang.String parseID(java.lang.String arglist)
parseID in interface EncryptionEntityarglist -
public void setID(java.lang.String sid)
setID in interface EncryptionEntityStrID -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||