com.enterprisedt.net.ftp.ssh
Class SSHFTPAlgorithm

java.lang.Object
  extended by com.enterprisedt.net.ftp.ssh.SSHFTPAlgorithm

public class SSHFTPAlgorithm
extends java.lang.Object

Each instance of SSHFTPAlgorithm corresponds to one particular algorithm. Each algorithm is of one type. There are five types of algorithms:

Cipher (CIPHER)
Used for encrypting data.
Compression (COMPRESSION)
Used for compressing data.
Key-exchange (KEY_EXCHANGE)
Used for exchanding keys.
Key-pair (KEY_PAID)
Used for generating key-pairs.
MAC (MAC)
Used for generating/verifying Message Authentication Codes.
SSHFTPAlgorithm has a static integer for each algorithm-type. Instances of SSHFTPAlgorithm cannot be created, instead a static member variable for each supported algorithm is provided. Methods are also provided for obtaining a list of supported algorithms.

Version:
$Revision: 1.9 $
Author:
Hans Andersen

Field Summary
static int CIPHER
          Integer defining the algorithm-type, cipher.
static SSHFTPAlgorithm CIPHER_3DES_CBC
          Instance of SSHFTPAlgorithm corresponding to the 3DES cipher algorithm.
static SSHFTPAlgorithm CIPHER_AES128_CBC
          Instance of SSHFTPAlgorithm corresponding to the Rijndael-128 cipher algorithm.
static SSHFTPAlgorithm CIPHER_AES192_CBC
          Instance of SSHFTPAlgorithm corresponding to the Rijndael-192 cipher algorithm.
static SSHFTPAlgorithm CIPHER_AES256_CBC
          Instance of SSHFTPAlgorithm corresponding to the Rijndael-256 cipher algorithm.
static SSHFTPAlgorithm CIPHER_BLOWFISH_CBC
          Instance of SSHFTPAlgorithm corresponding to the Blowfish cipher algorithm.
static int COMPRESSION
          Integer defining the algorithm-type, compression.
static SSHFTPAlgorithm COMPRESSION_NONE
          Instance of SSHFTPAlgorithm corresponding to the null compression algorithm.
static SSHFTPAlgorithm COMPRESSION_ZLIB
          Instance of SSHFTPAlgorithm corresponding to the zlib compression algorithm.
static SSHFTPAlgorithm KEY_DSA
          Instance of SSHFTPAlgorithm corresponding to the DSA key algorithm.
static int KEY_EXCHANGE
          Integer defining the algorithm-type, key-exchange.
static SSHFTPAlgorithm KEY_EXCHANGE_DIFFIE_HELLMAN_GROUP1_SHA1
          Instance of SSHFTPAlgorithm corresponding to the DH group key exchange algorithm.
static int KEY_PAIR
          Integer defining the algorithm-type, key-pair.
static SSHFTPAlgorithm KEY_RSA
          Instance of SSHFTPAlgorithm corresponding to the RSA key algorithm.
static int MAC
          Integer defining the algorithm-type, MAC.
static SSHFTPAlgorithm MAC_MD5
          Instance of SSHFTPAlgorithm corresponding to the MD5 MAC algorithm.
static SSHFTPAlgorithm MAC_MD5_96
          Instance of SSHFTPAlgorithm corresponding to the MD5-96 MAC algorithm.
static SSHFTPAlgorithm MAC_SHA1
          Instance of SSHFTPAlgorithm corresponding to the SHA1 MAC algorithm.
static SSHFTPAlgorithm MAC_SHA1_96
          Instance of SSHFTPAlgorithm corresponding to the SHA1-96 MAC algorithm.
 
Method Summary
static void disableAllAlgorithms()
          Disables all algorithms.
static void disableAllAlgorithms(int algorithmType)
          Disables all algorithms of a particular type.
static SSHFTPAlgorithm getAlgorithm(java.lang.String code)
          Returns the algorithm with the given code.
static SSHFTPAlgorithm[] getAlgorithms()
          Returns an array of all supported algorithms.
static SSHFTPAlgorithm[] getAlgorithms(int algorithmType)
          Returns an array of all supported algorithms of the specified type.
 java.lang.String getCode()
          Returns the code of the algorithm.
static SSHFTPAlgorithm[] getEnabledAlgorithms()
          Returns an array containing all enabled algorithms (of all types).
static SSHFTPAlgorithm[] getEnabledAlgorithms(int algorithmType)
          Returns an array containing all enabled algorithms of a particular type.
 int getType()
          Returns the type of the algorithm.
static boolean isAlgorithmEnabled(SSHFTPAlgorithm algorithm)
          Returns true if the given algorithm is enabled.
static void setAlgorithmEnabled(SSHFTPAlgorithm algorithm, boolean enable)
          Enable/disable the given algorithm.
 java.lang.String toString()
          Returns a string representation of the algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CIPHER

public static final int CIPHER
Integer defining the algorithm-type, cipher.

See Also:
Constant Field Values

COMPRESSION

public static final int COMPRESSION
Integer defining the algorithm-type, compression.

See Also:
Constant Field Values

KEY_EXCHANGE

public static final int KEY_EXCHANGE
Integer defining the algorithm-type, key-exchange.

See Also:
Constant Field Values

KEY_PAIR

public static final int KEY_PAIR
Integer defining the algorithm-type, key-pair.

See Also:
Constant Field Values

MAC

public static final int MAC
Integer defining the algorithm-type, MAC.

See Also:
Constant Field Values

CIPHER_3DES_CBC

public static final SSHFTPAlgorithm CIPHER_3DES_CBC
Instance of SSHFTPAlgorithm corresponding to the 3DES cipher algorithm.


CIPHER_BLOWFISH_CBC

public static final SSHFTPAlgorithm CIPHER_BLOWFISH_CBC
Instance of SSHFTPAlgorithm corresponding to the Blowfish cipher algorithm.


CIPHER_AES128_CBC

public static final SSHFTPAlgorithm CIPHER_AES128_CBC
Instance of SSHFTPAlgorithm corresponding to the Rijndael-128 cipher algorithm.


CIPHER_AES192_CBC

public static final SSHFTPAlgorithm CIPHER_AES192_CBC
Instance of SSHFTPAlgorithm corresponding to the Rijndael-192 cipher algorithm.


CIPHER_AES256_CBC

public static final SSHFTPAlgorithm CIPHER_AES256_CBC
Instance of SSHFTPAlgorithm corresponding to the Rijndael-256 cipher algorithm.


COMPRESSION_NONE

public static final SSHFTPAlgorithm COMPRESSION_NONE
Instance of SSHFTPAlgorithm corresponding to the null compression algorithm.


COMPRESSION_ZLIB

public static final SSHFTPAlgorithm COMPRESSION_ZLIB
Instance of SSHFTPAlgorithm corresponding to the zlib compression algorithm.


KEY_EXCHANGE_DIFFIE_HELLMAN_GROUP1_SHA1

public static final SSHFTPAlgorithm KEY_EXCHANGE_DIFFIE_HELLMAN_GROUP1_SHA1
Instance of SSHFTPAlgorithm corresponding to the DH group key exchange algorithm.


KEY_RSA

public static final SSHFTPAlgorithm KEY_RSA
Instance of SSHFTPAlgorithm corresponding to the RSA key algorithm.


KEY_DSA

public static final SSHFTPAlgorithm KEY_DSA
Instance of SSHFTPAlgorithm corresponding to the DSA key algorithm.


MAC_MD5_96

public static final SSHFTPAlgorithm MAC_MD5_96
Instance of SSHFTPAlgorithm corresponding to the MD5-96 MAC algorithm.


MAC_MD5

public static final SSHFTPAlgorithm MAC_MD5
Instance of SSHFTPAlgorithm corresponding to the MD5 MAC algorithm.


MAC_SHA1_96

public static final SSHFTPAlgorithm MAC_SHA1_96
Instance of SSHFTPAlgorithm corresponding to the SHA1-96 MAC algorithm.


MAC_SHA1

public static final SSHFTPAlgorithm MAC_SHA1
Instance of SSHFTPAlgorithm corresponding to the SHA1 MAC algorithm.

Method Detail

getAlgorithms

public static SSHFTPAlgorithm[] getAlgorithms()
Returns an array of all supported algorithms.


getAlgorithms

public static SSHFTPAlgorithm[] getAlgorithms(int algorithmType)
                                       throws SSHFTPException
Returns an array of all supported algorithms of the specified type.

Throws:
SSHFTPException - Thrown if the given algorithm-type is invalid.

getAlgorithm

public static SSHFTPAlgorithm getAlgorithm(java.lang.String code)
Returns the algorithm with the given code.


getEnabledAlgorithms

public static SSHFTPAlgorithm[] getEnabledAlgorithms()
Returns an array containing all enabled algorithms (of all types).

Returns:
An array of all enabled algorithms.

getEnabledAlgorithms

public static SSHFTPAlgorithm[] getEnabledAlgorithms(int algorithmType)
                                              throws SSHFTPException
Returns an array containing all enabled algorithms of a particular type.

Parameters:
algorithmType - Type of algorithms to return (See SSHFTPAlgorithm).
Returns:
An array of all enabled algorithms of the given type.
Throws:
SSHFTPException - Thrown if the given algorithm-type is invalid.

disableAllAlgorithms

public static void disableAllAlgorithms(int algorithmType)
                                 throws SSHFTPException
Disables all algorithms of a particular type. Note that one algorithm of each type must be enabled before you can connect to a server.

Parameters:
algorithmType - Type of algorithms to return (See SSHFTPAlgorithm).
Throws:
SSHFTPException

disableAllAlgorithms

public static void disableAllAlgorithms()
Disables all algorithms. Note that one algorithm of each type must be enabled before you can connect to a server.


setAlgorithmEnabled

public static void setAlgorithmEnabled(SSHFTPAlgorithm algorithm,
                                       boolean enable)
Enable/disable the given algorithm.

Parameters:
algorithm - Algorithm to enable/disable.
enable - Flag indicating whether the algorithm should be enabled or disabled.

isAlgorithmEnabled

public static boolean isAlgorithmEnabled(SSHFTPAlgorithm algorithm)
Returns true if the given algorithm is enabled.

Parameters:
algorithm - Algorithm to return status of.

getCode

public java.lang.String getCode()
Returns the code of the algorithm.

Returns:
The code of the algorithm.

getType

public int getType()
Returns the type of the algorithm.

Returns:
The type of the algorithm.

toString

public java.lang.String toString()
Returns a string representation of the algorithm.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the algorithm.


Copyright © 2001-2006 Enterprise Distributed Technologies Ltd. All Rights Reserved.