com.maverick.ssh.cipher
Class CbcBlockCipher

java.lang.Object
  extended bycom.maverick.ssh.cipher.SshCipher
      extended bycom.maverick.ssh.cipher.CbcBlockCipher
Direct Known Subclasses:
AES128Cbc, AES192Cbc, AES256Cbc, BlowfishCbc, CAST128Cbc, TripleDesCbc, Twofish128Cbc, Twofish192Cbc, Twofish256Cbc

public class CbcBlockCipher
extends SshCipher

Base class for all CBC block ciphers.

Author:
Lee David Painter

Field Summary
 
Fields inherited from class com.maverick.ssh.cipher.SshCipher
DECRYPT_MODE, ENCRYPT_MODE
 
Constructor Summary
CbcBlockCipher(int keybits, com.maverick.crypto.engines.CipherEngine engine, java.lang.String algorithm)
          Contruct a CBC block cipher using the engine supplied.
 
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 len)
          Transform the data
 
Methods inherited from class com.maverick.ssh.cipher.SshCipher
getAlgorithm, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CbcBlockCipher

public CbcBlockCipher(int keybits,
                      com.maverick.crypto.engines.CipherEngine engine,
                      java.lang.String algorithm)
Contruct a CBC block cipher using the engine supplied.

Parameters:
keybits - the number of key bits to use.
engine - the cipher engine.
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 len)
               throws java.io.IOException
Transform the data

Specified by:
transform in class SshCipher
Parameters:
in -
offset -
len -
Returns:
the transformed data.
Throws:
java.io.IOException


Copyright © 2003 3SP LTD. All Rights Reserved.