com.monica.javacom.ssh
Class MJCSSH3DESCBC

java.lang.Object
  |
  +--com.monica.javacom.ssh.MJCSSH3DESCBC
All Implemented Interfaces:
MJCSSHCipherAlgorithm

public class MJCSSH3DESCBC
extends java.lang.Object
implements MJCSSHCipherAlgorithm

Implements a 3DES-CBC encoder/decoder as described in FIPS PUB 46-3. As the main functionality, the coder gets a String which contains the initial data, and returns the coded representation of this String.


Constructor Summary
MJCSSH3DESCBC()
          Constructs a new MJCSSH3DESCBC encoder/decoder object.
 
Method Summary
 java.lang.String decode(java.lang.String ciphertext)
          Decodes the specified String.
 java.lang.String encode(java.lang.String text)
          Encodes the specified String.
 java.lang.String getCipherAlgorithmName()
          Returns the name of the coder algorithm.
 java.lang.String getCipherAlgorithmVersion()
          Returns the version of the coder algorithm.
 int getCipherBlockSize()
          Returns the length of the block that can be coded on this coder/decoder.
 java.lang.Object getState()
          Returns the current state of the MJCSSH3DESCBC coder/decoder.
 void keySchedule(byte[] key)
          Makes the key schedule computation.
 void setKeys(java.lang.String in_key, java.lang.String iV)
          Sets the key and the IV for the MJCSSH3DESCBC coder/decoder object.
 void setState(java.lang.Object state)
          Sets the current state of the MJCSSH3DESCBC coder/decoder to the input value saved earlier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MJCSSH3DESCBC

public MJCSSH3DESCBC()
Constructs a new MJCSSH3DESCBC encoder/decoder object.
Method Detail

setKeys

public void setKeys(java.lang.String in_key,
                    java.lang.String iV)
Sets the key and the IV for the MJCSSH3DESCBC coder/decoder object.
Specified by:
setKeys in interface MJCSSHCipherAlgorithm
Parameters:
in_key - the String representation of the 3DES key-triple. Must be 24 bytes of length, containing the three byte-octets, for the three DES coders respectively. Parity is not checked.
iV - the String representation of the Initialisation Vector. Must be 8 bytes of length, containing the 64 bits of IV.

encode

public java.lang.String encode(java.lang.String text)
Encodes the specified String. The length of the input must be a multiple of 8.
Specified by:
encode in interface MJCSSHCipherAlgorithm
Parameters:
text - the input text which has to be encoded
Returns:
the encoded representation of the input text

decode

public java.lang.String decode(java.lang.String ciphertext)
Decodes the specified String. The length of the input must be a multiple of 8.
Specified by:
decode in interface MJCSSHCipherAlgorithm
Parameters:
ciphertext - the input ciphertext which has to be decoded
Returns:
the decoded representation of the input ciphertext

keySchedule

public void keySchedule(byte[] key)
Makes the key schedule computation.
Parameters:
key - the byte array holding the 24 bytes of the three DES keys.

getState

public java.lang.Object getState()
Returns the current state of the MJCSSH3DESCBC coder/decoder.
Specified by:
getState in interface MJCSSHCipherAlgorithm
Returns:
the current state of the MJCSSH3DESCBC coder/decoder

setState

public void setState(java.lang.Object state)
Sets the current state of the MJCSSH3DESCBC coder/decoder to the input value saved earlier.
Specified by:
setState in interface MJCSSHCipherAlgorithm
Parameters:
state - the state-to-load of the MJCSSH3DESCBC coder/decoder

getCipherAlgorithmName

public java.lang.String getCipherAlgorithmName()
Returns the name of the coder algorithm.
Specified by:
getCipherAlgorithmName in interface MJCSSHCipherAlgorithm
Returns:
the name of the coder algorithm

getCipherAlgorithmVersion

public java.lang.String getCipherAlgorithmVersion()
Returns the version of the coder algorithm.
Specified by:
getCipherAlgorithmVersion in interface MJCSSHCipherAlgorithm
Returns:
the version of the coder algorithm

getCipherBlockSize

public int getCipherBlockSize()
Returns the length of the block that can be coded on this coder/decoder.
Specified by:
getCipherBlockSize in interface MJCSSHCipherAlgorithm
Returns:
the length of the block that can be coded on this coder/decoder in bytes