com.maverick.ssh.components
Class ComponentManager

java.lang.Object
  extended by com.maverick.ssh.components.ComponentManager
Direct Known Subclasses:
JCEComponentManager, StandaloneComponentManager

public abstract class ComponentManager
extends java.lang.Object

An abstract class that manages the components used by the SSH API. All algorithm implementations are obtained through a single provider. Two implementations are provided, the StandaloneComponentManager which uses internal algorithm implementations and the JCEComponentManager that uses the Java runtime JCE provider(s) algorithm implementations.

If both component managers are available on the classpath then the standalone version will be selected. Jar files have been provided that contain both maverick-all.jar , the standalone only maverick-standalone-only.jar and the JCE only maverick-jce-only.jar.

Author:
Lee David Painter

Constructor Summary
ComponentManager()
           
 
Method Summary
abstract  SshDsaPrivateKey createDsaPrivateKey(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g, java.math.BigInteger x, java.math.BigInteger y)
          Create an instance of a DSA private key.
abstract  SshDsaPublicKey createDsaPublicKey()
          Create an uninitialized instance of a DSA public key
abstract  SshDsaPublicKey createDsaPublicKey(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g, java.math.BigInteger y)
          Create an instance of a DSA public key.
abstract  SshRsaPrivateCrtKey createRsaPrivateCrtKey(java.math.BigInteger modulus, java.math.BigInteger publicExponent, java.math.BigInteger privateExponent, java.math.BigInteger primeP, java.math.BigInteger primeQ, java.math.BigInteger crtCoefficient)
          Create an instance of an RSA co-effecient private key.
abstract  SshRsaPrivateCrtKey createRsaPrivateCrtKey(java.math.BigInteger modulus, java.math.BigInteger publicExponent, java.math.BigInteger privateExponent, java.math.BigInteger primeP, java.math.BigInteger primeQ, java.math.BigInteger primeExponentP, java.math.BigInteger primeExponentQ, java.math.BigInteger crtCoefficient)
          Create an instance of an RSA co-efficent private key.
abstract  SshRsaPrivateKey createRsaPrivateKey(java.math.BigInteger modulus, java.math.BigInteger privateExponent)
          Create an instance of an RSA private key.
abstract  SshRsaPublicKey createRsaPublicKey(java.math.BigInteger modulus, java.math.BigInteger publicExponent, int version)
          Create an instance of an RSA public key.
abstract  SshRsaPublicKey createSsh2RsaPublicKey()
          Create an instance of an SSH2 RSA public key.
abstract  SshKeyPair generateDsaKeyPair(int bits)
          Generate a new DSA public/private key pair.
abstract  SshKeyPair generateRsaKeyPair(int bits, int version)
          Generate an RSA public/private pair.
static ComponentManager getInstance()
          Get the installed component manager.
static boolean getPerContextAlgorithmPreferences()
           
abstract  SshSecureRandomGenerator getRND()
          Get the secure random number generator.
protected  void init()
           
protected abstract  void initializeDigestFactory(ComponentFactory digests)
          Initialize the digest factory.
protected abstract  void initializeHmacFactory(ComponentFactory hmacs)
          Initialize the SSH2 HMAC factory.
protected abstract  void initializeKeyExchangeFactory(ComponentFactory keyexchange)
          Initialize the SSH2 key exchange factory.
protected abstract  void initializePublicKeyFactory(ComponentFactory publickeys)
          Initialize the public key factory.
protected abstract  void initializeSsh1CipherFactory(ComponentFactory ciphers)
          Initialize the SSH1 cipher factory.
protected abstract  void initializeSsh2CipherFactory(ComponentFactory ciphers)
          Initialize the SSH2 cipher factory.
static boolean isEnableNoneCipher()
           
static void setEnableNoneCipher(boolean enableNoneCipher)
           
static void setInstance(ComponentManager instance)
          Overide the installed component manager with an alternative implementation.
static void setPerContextAlgorithmPreferences(boolean enable)
           
 ComponentFactory supportedDigests()
          The supported digests
 ComponentFactory supportedHMacsCS()
          The supported SSH2 Hmacs.
 ComponentFactory supportedHMacsSC()
          The supported SSH2 Hmacs.
 ComponentFactory supportedKeyExchanges()
          The supported SSH2 key exchanges.
 ComponentFactory supportedPublicKeys()
          The supported public keys
 ComponentFactory supportedSsh1CiphersCS()
          The supported SSH1 ciphers.
 ComponentFactory supportedSsh1CiphersSC()
          The supported SSH1 ciphers.
 ComponentFactory supportedSsh2CiphersCS()
          The supported SSH2 ciphers.
 ComponentFactory supportedSsh2CiphersSC()
          The supported SSH2 ciphers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentManager

public ComponentManager()
Method Detail

isEnableNoneCipher

public static boolean isEnableNoneCipher()

setEnableNoneCipher

public static void setEnableNoneCipher(boolean enableNoneCipher)

setPerContextAlgorithmPreferences

public static void setPerContextAlgorithmPreferences(boolean enable)

getPerContextAlgorithmPreferences

public static boolean getPerContextAlgorithmPreferences()

getInstance

public static ComponentManager getInstance()
Get the installed component manager. Don't want to initialize this at class load time, so use a singleton instead. Initialized on the first call to getInstance.

Returns:
ComponentManager

init

protected void init()
             throws SshException
Throws:
SshException

initializeSsh1CipherFactory

protected abstract void initializeSsh1CipherFactory(ComponentFactory ciphers)
Initialize the SSH1 cipher factory. These ciphers are exclusively used by the SSH1 implementation.

Parameters:
ciphers -

initializeSsh2CipherFactory

protected abstract void initializeSsh2CipherFactory(ComponentFactory ciphers)
Initialize the SSH2 cipher factory. These ciphers are exclusively used by the SSH2 implementation.

Parameters:
ciphers -

initializeHmacFactory

protected abstract void initializeHmacFactory(ComponentFactory hmacs)
Initialize the SSH2 HMAC factory.

Parameters:
hmacs -

initializePublicKeyFactory

protected abstract void initializePublicKeyFactory(ComponentFactory publickeys)
Initialize the public key factory.

Parameters:
publickeys -

initializeKeyExchangeFactory

protected abstract void initializeKeyExchangeFactory(ComponentFactory keyexchange)
Initialize the SSH2 key exchange factory.

Parameters:
keyexchange -

initializeDigestFactory

protected abstract void initializeDigestFactory(ComponentFactory digests)
Initialize the digest factory.

Parameters:
digests -

setInstance

public static void setInstance(ComponentManager instance)
Overide the installed component manager with an alternative implementation.

Parameters:
instance -

supportedSsh1CiphersSC

public ComponentFactory supportedSsh1CiphersSC()
The supported SSH1 ciphers.

Returns:
AbstractComponentFactory

supportedSsh1CiphersCS

public ComponentFactory supportedSsh1CiphersCS()
The supported SSH1 ciphers.

Returns:
AbstractComponentFactory

supportedSsh2CiphersSC

public ComponentFactory supportedSsh2CiphersSC()
The supported SSH2 ciphers.

Returns:
AbstractComponentFactory

supportedSsh2CiphersCS

public ComponentFactory supportedSsh2CiphersCS()
The supported SSH2 ciphers.

Returns:
AbstractComponentFactory

supportedHMacsSC

public ComponentFactory supportedHMacsSC()
The supported SSH2 Hmacs.

Returns:
AbstractComponentFactory

supportedHMacsCS

public ComponentFactory supportedHMacsCS()
The supported SSH2 Hmacs.

Returns:
AbstractComponentFactory

supportedKeyExchanges

public ComponentFactory supportedKeyExchanges()
The supported SSH2 key exchanges.

Returns:
AbstractComponentFactory

supportedPublicKeys

public ComponentFactory supportedPublicKeys()
The supported public keys

Returns:
AbstractComponentFactory

supportedDigests

public ComponentFactory supportedDigests()
The supported digests

Returns:
AbstractComponentFactory

generateRsaKeyPair

public abstract SshKeyPair generateRsaKeyPair(int bits,
                                              int version)
                                       throws SshException
Generate an RSA public/private pair.

Parameters:
bits -
version -
Returns:
SshKeyPair
Throws:
SshException

createRsaPublicKey

public abstract SshRsaPublicKey createRsaPublicKey(java.math.BigInteger modulus,
                                                   java.math.BigInteger publicExponent,
                                                   int version)
                                            throws SshException
Create an instance of an RSA public key.

Parameters:
modulus -
publicExponent -
version -
Returns:
SshRsaPublicKey
Throws:
SshException

createSsh2RsaPublicKey

public abstract SshRsaPublicKey createSsh2RsaPublicKey()
                                                throws SshException
Create an instance of an SSH2 RSA public key.

Returns:
SshRsaPublicKey
Throws:
SshException

createRsaPrivateKey

public abstract SshRsaPrivateKey createRsaPrivateKey(java.math.BigInteger modulus,
                                                     java.math.BigInteger privateExponent)
                                              throws SshException
Create an instance of an RSA private key.

Parameters:
modulus -
privateExponent -
Returns:
SshRsaPrivateKey
Throws:
SshException

createRsaPrivateCrtKey

public abstract SshRsaPrivateCrtKey createRsaPrivateCrtKey(java.math.BigInteger modulus,
                                                           java.math.BigInteger publicExponent,
                                                           java.math.BigInteger privateExponent,
                                                           java.math.BigInteger primeP,
                                                           java.math.BigInteger primeQ,
                                                           java.math.BigInteger crtCoefficient)
                                                    throws SshException
Create an instance of an RSA co-effecient private key.

Parameters:
modulus -
publicExponent -
privateExponent -
primeP -
primeQ -
crtCoefficient -
Returns:
SshRsaPrivateCrtKey
Throws:
SshException

createRsaPrivateCrtKey

public abstract SshRsaPrivateCrtKey createRsaPrivateCrtKey(java.math.BigInteger modulus,
                                                           java.math.BigInteger publicExponent,
                                                           java.math.BigInteger privateExponent,
                                                           java.math.BigInteger primeP,
                                                           java.math.BigInteger primeQ,
                                                           java.math.BigInteger primeExponentP,
                                                           java.math.BigInteger primeExponentQ,
                                                           java.math.BigInteger crtCoefficient)
                                                    throws SshException
Create an instance of an RSA co-efficent private key.

Parameters:
modulus -
publicExponent -
privateExponent -
primeP -
primeQ -
primeExponentP -
primeExponentQ -
crtCoefficient -
Returns:
SshRsaPrivateCrtKey
Throws:
SshException

generateDsaKeyPair

public abstract SshKeyPair generateDsaKeyPair(int bits)
                                       throws SshException
Generate a new DSA public/private key pair.

Parameters:
bits -
Returns:
SshKeyPair
Throws:
SshException

createDsaPublicKey

public abstract SshDsaPublicKey createDsaPublicKey(java.math.BigInteger p,
                                                   java.math.BigInteger q,
                                                   java.math.BigInteger g,
                                                   java.math.BigInteger y)
                                            throws SshException
Create an instance of a DSA public key.

Parameters:
p -
q -
g -
y -
Returns:
SshDsaPublicKey
Throws:
SshException

createDsaPublicKey

public abstract SshDsaPublicKey createDsaPublicKey()
Create an uninitialized instance of a DSA public key

Returns:
SshDsaPublicKey

createDsaPrivateKey

public abstract SshDsaPrivateKey createDsaPrivateKey(java.math.BigInteger p,
                                                     java.math.BigInteger q,
                                                     java.math.BigInteger g,
                                                     java.math.BigInteger x,
                                                     java.math.BigInteger y)
                                              throws SshException
Create an instance of a DSA private key.

Parameters:
p -
q -
g -
x -
y -
Returns:
SshDsaPrivateKey
Throws:
SshException

getRND

public abstract SshSecureRandomGenerator getRND()
                                         throws SshException
Get the secure random number generator.

Returns:
SshSecureRandomGenerator
Throws:
SshException


Copyright © 2003-2008 SSHTools LTD. All Rights Reserved.