com.monica.javacom.interfaces
Interface MJCSSHCipherAlgorithm

All Known Implementing Classes:
MJCSSH3DESCBC, MJCSSHNoneCiphering, MJCSSHArcfourCipher

public interface MJCSSHCipherAlgorithm

Cipher algorithm for the SSH layer. Provides functionality for encryption/decryption. Using the same instance of classes implementing this interface for both encyption and decyption is not supported.


Method Summary
 java.lang.String decode(java.lang.String coded_data)
          Method for decryption of a String.
 java.lang.String encode(java.lang.String data)
          Method for encryption of a String.
 java.lang.String getCipherAlgorithmName()
          Returns the MJC name of the of the MJCSSHCipherAlgorithm.
 java.lang.String getCipherAlgorithmVersion()
          Returns the MJC version of the MJCSSHCipherAlgorithm.
 int getCipherBlockSize()
          Returns the length of the minimal encryption length.
 java.lang.Object getState()
          Returns the state of the cipher mechanism.
 void setKeys(java.lang.String Key, java.lang.String IV)
          Method for setting the cryptographic key and the initialization vector.
 void setState(java.lang.Object state)
          Sets the state of the cipher mechanism.
 

Method Detail

getCipherAlgorithmName

public java.lang.String getCipherAlgorithmName()
Returns the MJC name of the of the MJCSSHCipherAlgorithm.
Returns:
String: the MJC name of the MJCSSHCipherAlgorithm

getCipherAlgorithmVersion

public java.lang.String getCipherAlgorithmVersion()
Returns the MJC version of the MJCSSHCipherAlgorithm.
Returns:
String: the MJC version of the MJCSSHCipherAlgorithm

setKeys

public void setKeys(java.lang.String Key,
                    java.lang.String IV)
Method for setting the cryptographic key and the initialization vector.
Parameters:
String - key: the key for the cryptography
string - IV: the initialization vector

getState

public java.lang.Object getState()
Returns the state of the cipher mechanism. This state can be restored with the setState method.
Returns:
Object: the state of the cipher mechanism

setState

public void setState(java.lang.Object state)
Sets the state of the cipher mechanism.
Parameters:
Object - o: the to be set state of the cipher mechanism

encode

public java.lang.String encode(java.lang.String data)
Method for encryption of a String. The to be encrypted String has to be of a length that is a multipy of getCipherBlockSize(). Encryption is done with the key set with setKeys(String, String).
Parameters:
String - s: the String to be encrypted
Returns:
String: the encrypted String

decode

public java.lang.String decode(java.lang.String coded_data)
Method for decryption of a String. The to be decrypted String has to be of a length that is a multiply of getCipherBlockSize(). Decryption is done with the key set with setKeys(String, String).
Parameters:
String - s: the String to be decrypted
Returns:
String: the decrypted String

getCipherBlockSize

public int getCipherBlockSize()
Returns the length of the minimal encryption length. Strings for encryption/decryption have to be of a length that is a multiply of this.
Returns:
int: the minimal encryption length