com.maverick.sshd.components
Class ServerComponentManager

java.lang.Object
  extended by com.maverick.sshd.components.ServerComponentManager
Direct Known Subclasses:
JCEServerComponentManager, StandaloneServerComponentManager

public abstract class ServerComponentManager
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 StandaloneServerComponentManager which uses internal algorithm implementations and the JCEServerComponentManager 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:


Constructor Summary
ServerComponentManager()
           
 
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 a DSA private key from DSA parameters.
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 an 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 a RSA co-efficient key from RSA parameters.
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 RSA co-efficient key from RSA parameters.
abstract  SshRsaPrivateKey createRsaPrivateKey(java.math.BigInteger modulus, java.math.BigInteger privateExponent)
          Create an RSA private key from RSA parameters
abstract  SshRsaPublicKey createRsaPublicKey(java.math.BigInteger modulus, java.math.BigInteger publicExponent, int version)
          Create an instance of an RSA public key from RSA parameters.
abstract  SshRsaPublicKey createSsh2RsaPublicKey()
          Create an uninitialized instance of an RSA public key
abstract  SshKeyPair generateDsaKeyPair(int bits)
          Generate a DSA key pair.
abstract  SshKeyPair generateRsaKeyPair(int bits)
          Generate an RSA key pair.
static ServerComponentManager getInstance()
          Get the installed component manager.
static boolean getPerContextAlgorithmPreferences()
           
abstract  SshSecureRandomGenerator getRND()
          Get the secure number generator implementation.
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 key exchange factory.
protected abstract  void initializePublicKeyFactory(ComponentFactory publickeys)
          Initialize the public key factory.
protected abstract  void initializeSsh2CipherFactory(ComponentFactory ciphers)
          Initialize the SSH2 cipher factory.
abstract  void loadKeystore(java.io.File keystoreFile, java.lang.String alias, java.lang.String storePassphrase, java.lang.String keyPassphrase, SshContext context)
          Load a host key from a keystore file.
static void setInstance(ServerComponentManager instance)
          Override the installed component manager with an alternative implementation.
static void setPerContextAlgorithmPreferences(boolean enable)
           
 ComponentFactory supportedDigests()
          Return the supported digest factory.
 ComponentFactory supportedHMacsCS()
          Return the supported SSH2 HMac factory.
 ComponentFactory supportedHMacsSC()
           
 ComponentFactory supportedKeyExchanges()
          Return the supported SSH2 key exchanges.
 ComponentFactory supportedPublicKeys()
          Return the supported public key factory.
 ComponentFactory supportedSsh2CiphersCS()
          Return the supported SSH2 cipher factory.
 ComponentFactory supportedSsh2CiphersSC()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerComponentManager

public ServerComponentManager()
Method Detail

setPerContextAlgorithmPreferences

public static void setPerContextAlgorithmPreferences(boolean enable)

getPerContextAlgorithmPreferences

public static boolean getPerContextAlgorithmPreferences()

getInstance

public static ServerComponentManager getInstance()
Get the installed component manager.

Returns:
ServerComponentManager

setInstance

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

Parameters:
instance -

init

protected void init()

initializeSsh2CipherFactory

protected abstract void initializeSsh2CipherFactory(ComponentFactory ciphers)
Initialize the SSH2 cipher factory.

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 key exchange factory.

Parameters:
keyexchange -

initializeDigestFactory

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

Parameters:
digests -

supportedSsh2CiphersCS

public ComponentFactory supportedSsh2CiphersCS()
Return the supported SSH2 cipher factory.

Returns:
AbstractComponentFactory

supportedSsh2CiphersSC

public ComponentFactory supportedSsh2CiphersSC()

supportedHMacsCS

public ComponentFactory supportedHMacsCS()
Return the supported SSH2 HMac factory.

Returns:
AbstractComponentFactory

supportedHMacsSC

public ComponentFactory supportedHMacsSC()

supportedKeyExchanges

public ComponentFactory supportedKeyExchanges()
Return the supported SSH2 key exchanges.

Returns:
AbstractComponentFactory

supportedPublicKeys

public ComponentFactory supportedPublicKeys()
Return the supported public key factory.

Returns:
AbstractComponentFactory

supportedDigests

public ComponentFactory supportedDigests()
Return the supported digest factory.

Returns:
AbstractComponentFactory

generateRsaKeyPair

public abstract SshKeyPair generateRsaKeyPair(int bits)
                                       throws SshException
Generate an RSA key 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 from RSA parameters.

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

createSsh2RsaPublicKey

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

Returns:
SshRsaPublicKey
Throws:
SshException

createRsaPrivateKey

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

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 a RSA co-efficient key from RSA parameters.

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 RSA co-efficient key from RSA parameters.

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

generateDsaKeyPair

public abstract SshKeyPair generateDsaKeyPair(int bits)
                                       throws SshException
Generate a DSA 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 an 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 a DSA private key from DSA parameters.

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

getRND

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

Returns:
SshSecureRandomGenerator
Throws:
SshException

loadKeystore

public abstract void loadKeystore(java.io.File keystoreFile,
                                  java.lang.String alias,
                                  java.lang.String storePassphrase,
                                  java.lang.String keyPassphrase,
                                  SshContext context)
                           throws java.io.IOException
Load a host key from a keystore file.

Parameters:
keystoreFile -
alias -
storePassphrase -
keyPassphrase -
Throws:
java.io.IOException


Copyright © 2003-2004 3SP LTD. All Rights Reserved.