com.maverick.ssh.components.standalone
Class Twofish256Cbc

java.lang.Object
  extended by com.maverick.ssh.components.SshCipher
      extended by com.maverick.ssh.components.standalone.Twofish256Cbc

public class Twofish256Cbc
extends SshCipher

This cipher can optionally be added to the J2SSH Maverick API. To add the ciphers from this package simply add them to the com.maverick.ssh2.Ssh2Context using the following code.

  import com.sshtools.cipher.*;

 SshConnector con = SshConnector.getInstance();
 Ssh2Context context = (Ssh2Context)con.getContext(SshConnector.SSH2);

 // Add AES
 context.supportedCiphers().add(AES128Cbc.AES128_CBC, AES128Cbc.class);
 context.supportedCiphers().add(AES192Cbc.AES192_CBC, AES192Cbc.class);
 context.supportedCiphers().add(AES256Cbc.AES256_CBC, AES256Cbc.class);

 // Add Twofish - note the 256 bit cipher has two different entries to maintain backwards compatibility
 context.supportedCiphers().add(Twofish128Cbc.TWOFISH128_CBC, Twofish128Cbc.class);
 context.supportedCiphers().add(Twofish192Cbc.TWOFISH192_CBC, Twofish192Cbc.class);
 context.supportedCiphers().add(Twofish256Cbc.TWOFISH256_CBC, Twofish256Cbc.class);
 context.supportedCiphers().add(Twofish256Cbc.TWOFISH_CBC, Twofish256Cbc.class);

 // Add CAST
  context.supportedCiphers().add(CAST128Cbc.CAST128_CBC, CAST128Cbc.class);

 


Field Summary
static java.lang.String TWOFISH_CBC
           
static java.lang.String TWOFISH256_CBC
           
 
Fields inherited from class com.maverick.ssh.components.SshCipher
DECRYPT_MODE, ENCRYPT_MODE
 
Constructor Summary
Twofish256Cbc()
           
 
Method Summary
 int getBlockSize()
          Get the block size of the cipher
 void init(int mode, byte[] iv, byte[] keydata)
          Initialize the CBC block cipher.
 void transform(byte[] in, int start, byte[] output, int offset, int length)
          Transform the data
 
Methods inherited from class com.maverick.ssh.components.SshCipher
getAlgorithm, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TWOFISH256_CBC

public static final java.lang.String TWOFISH256_CBC
See Also:
Constant Field Values

TWOFISH_CBC

public static final java.lang.String TWOFISH_CBC
See Also:
Constant Field Values
Constructor Detail

Twofish256Cbc

public Twofish256Cbc()
Method Detail

init

public void init(int mode,
                 byte[] iv,
                 byte[] keydata)
Initialize the CBC block cipher.

Specified by:
init in class SshCipher
Parameters:
mode - the mode to operate in
iv - the initialization vector
keydata - the key
Throws:
java.io.IOException

getBlockSize

public int getBlockSize()
Get the block size of the cipher

Specified by:
getBlockSize in class SshCipher
Returns:
the block size in bytes

transform

public void transform(byte[] in,
                      int start,
                      byte[] output,
                      int offset,
                      int length)
               throws java.io.IOException
Transform the data

Specified by:
transform in class SshCipher
Parameters:
in - input byte[]
start -
output - byte[]
offset -
length -
Throws:
java.io.IOException


Copyright © 2003-2004 3SP LTD. All Rights Reserved.