com.maverick.sshd.components
Class ServerComponentManager

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

public abstract class ServerComponentManager
extends 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 com.maverick.sshd.components.standalone.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 JCE version will be selected. Jar files have been provided that contain both:


Constructor Summary
protected ServerComponentManager()
           
 
Method Summary
abstract  com.maverick.ssh.components.SshDsaPrivateKey createDsaPrivateKey(BigInteger p, BigInteger q, BigInteger g, BigInteger x, BigInteger y)
          Create a DSA private key from DSA parameters.
abstract  com.maverick.ssh.components.SshDsaPublicKey createDsaPublicKey()
          Create an uninitialized instance of a DSA public key.
abstract  com.maverick.ssh.components.SshDsaPublicKey createDsaPublicKey(BigInteger p, BigInteger q, BigInteger g, BigInteger y)
          Create an instance of an DSA public key.
abstract  com.maverick.ssh.components.SshRsaPrivateCrtKey createRsaPrivateCrtKey(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger crtCoefficient)
          Create a RSA co-efficient key from RSA parameters.
abstract  com.maverick.ssh.components.SshRsaPrivateCrtKey createRsaPrivateCrtKey(BigInteger modulus, BigInteger publicExponent, BigInteger privateExponent, BigInteger primeP, BigInteger primeQ, BigInteger primeExponentP, BigInteger primeExponentQ, BigInteger crtCoefficient)
          Create an RSA co-efficient key from RSA parameters.
abstract  com.maverick.ssh.components.SshRsaPrivateKey createRsaPrivateKey(BigInteger modulus, BigInteger privateExponent)
          Create an RSA private key from RSA parameters
abstract  com.maverick.ssh.components.SshRsaPublicKey createRsaPublicKey(BigInteger modulus, BigInteger publicExponent, int version)
          Create an instance of an RSA public key from RSA parameters.
abstract  com.maverick.ssh.components.SshRsaPublicKey createSsh2RsaPublicKey()
          Create an uninitialized instance of an RSA public key
abstract  com.maverick.ssh.components.SshKeyPair generateDsaKeyPair(int bits)
          Generate a DSA key pair.
abstract  com.maverick.ssh.components.SshKeyPair generateRsaKeyPair(int bits)
          Generate an RSA key pair.
abstract  com.maverick.ssh.components.SshSecureRandomGenerator getRND()
          Get the secure number generator implementation.
protected abstract  void initializeDigestFactory(com.maverick.ssh.components.ComponentFactory digests)
          Initialize the digest factory.
protected abstract  void initializeHmacFactory(com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> hmacs)
          Initialize the SSH2 HMac factory.
protected abstract  void initializeKeyExchangeFactory(com.maverick.ssh.components.ComponentFactory<SshKeyExchangeServer> keyexchange)
          Initialize the key exchange factory.
protected abstract  void initializePublicKeyFactory(com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshPublicKey> publickeys)
          Initialize the public key factory.
protected abstract  void initializeSsh2CipherFactory(com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> ciphers)
          Initialize the SSH2 cipher factory.
 boolean isEnableNoneCipher()
           
abstract  void loadKeystore(File keystoreFile, String alias, String storePassphrase, String keyPassphrase, SshContext context)
          Load a host key from a keystore file.
abstract  void loadKeystore(File keystoreFile, String alias, String storePassphrase, String keyPassphrase, String storeType, SshContext context)
           
abstract  void loadKeystore(InputStream in, String alias, String storePassphrase, String keyPassphrase, SshContext context)
          Load a host key from a keystore InputStream.
abstract  void loadKeystore(InputStream in, String alias, String storePassphrase, String keyPassphrase, String storeType, SshContext context)
           
 void setEnableNoneCipher(boolean enableNoneCipher)
           
 com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCompression> supportedCompressionsCS()
           
 com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCompression> supportedCompressionsSC()
           
 com.maverick.ssh.components.ComponentFactory supportedDigests()
          Return the supported digest factory.
 com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> supportedHMacsCS()
          Return the supported SSH2 HMac factory.
 com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> supportedHMacsSC()
           
 com.maverick.ssh.components.ComponentFactory<SshKeyExchangeServer> supportedKeyExchanges()
          Return the supported SSH2 key exchanges.
 com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshPublicKey> supportedPublicKeys()
          Return the supported public key factory.
 com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> supportedSsh2CiphersCS()
          Return the supported SSH2 cipher factory.
 com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> supportedSsh2CiphersSC()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerComponentManager

protected ServerComponentManager()
                          throws com.maverick.ssh.common.SshException
Throws:
com.maverick.ssh.common.SshException
Method Detail

isEnableNoneCipher

public boolean isEnableNoneCipher()

setEnableNoneCipher

public void setEnableNoneCipher(boolean enableNoneCipher)

initializeSsh2CipherFactory

protected abstract void initializeSsh2CipherFactory(com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> ciphers)
Initialize the SSH2 cipher factory.

Parameters:
ciphers -

initializeHmacFactory

protected abstract void initializeHmacFactory(com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> hmacs)
Initialize the SSH2 HMac factory.

Parameters:
hmacs -

initializePublicKeyFactory

protected abstract void initializePublicKeyFactory(com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshPublicKey> publickeys)
Initialize the public key factory.

Parameters:
publickeys -

initializeKeyExchangeFactory

protected abstract void initializeKeyExchangeFactory(com.maverick.ssh.components.ComponentFactory<SshKeyExchangeServer> keyexchange)
Initialize the key exchange factory.

Parameters:
keyexchange -

initializeDigestFactory

protected abstract void initializeDigestFactory(com.maverick.ssh.components.ComponentFactory digests)
Initialize the digest factory.

Parameters:
digests -

supportedSsh2CiphersCS

public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> supportedSsh2CiphersCS()
Return the supported SSH2 cipher factory.

Returns:
AbstractComponentFactory

supportedSsh2CiphersSC

public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCipher> supportedSsh2CiphersSC()

supportedHMacsCS

public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> supportedHMacsCS()
Return the supported SSH2 HMac factory.

Returns:
AbstractComponentFactory

supportedHMacsSC

public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshHmac> supportedHMacsSC()

supportedKeyExchanges

public com.maverick.ssh.components.ComponentFactory<SshKeyExchangeServer> supportedKeyExchanges()
Return the supported SSH2 key exchanges.

Returns:
AbstractComponentFactory

supportedPublicKeys

public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshPublicKey> supportedPublicKeys()
Return the supported public key factory.

Returns:
AbstractComponentFactory

supportedDigests

public com.maverick.ssh.components.ComponentFactory supportedDigests()
Return the supported digest factory.

Returns:
AbstractComponentFactory

generateRsaKeyPair

public abstract com.maverick.ssh.components.SshKeyPair generateRsaKeyPair(int bits)
                                                                   throws com.maverick.ssh.common.SshException
Generate an RSA key pair.

Parameters:
bits -
version -
Returns:
SshKeyPair
Throws:
com.maverick.ssh.common.SshException

createRsaPublicKey

public abstract com.maverick.ssh.components.SshRsaPublicKey createRsaPublicKey(BigInteger modulus,
                                                                               BigInteger publicExponent,
                                                                               int version)
                                                                        throws com.maverick.ssh.common.SshException
Create an instance of an RSA public key from RSA parameters.

Parameters:
modulus -
publicExponent -
version -
Returns:
SshRsaPublicKey
Throws:
com.maverick.ssh.common.SshException

createSsh2RsaPublicKey

public abstract com.maverick.ssh.components.SshRsaPublicKey createSsh2RsaPublicKey()
                                                                            throws com.maverick.ssh.common.SshException
Create an uninitialized instance of an RSA public key

Returns:
SshRsaPublicKey
Throws:
com.maverick.ssh.common.SshException

createRsaPrivateKey

public abstract com.maverick.ssh.components.SshRsaPrivateKey createRsaPrivateKey(BigInteger modulus,
                                                                                 BigInteger privateExponent)
                                                                          throws com.maverick.ssh.common.SshException
Create an RSA private key from RSA parameters

Parameters:
modulus -
privateExponent -
Returns:
SshRsaPrivateKey
Throws:
com.maverick.ssh.common.SshException

createRsaPrivateCrtKey

public abstract com.maverick.ssh.components.SshRsaPrivateCrtKey createRsaPrivateCrtKey(BigInteger modulus,
                                                                                       BigInteger publicExponent,
                                                                                       BigInteger privateExponent,
                                                                                       BigInteger primeP,
                                                                                       BigInteger primeQ,
                                                                                       BigInteger crtCoefficient)
                                                                                throws com.maverick.ssh.common.SshException
Create a RSA co-efficient key from RSA parameters.

Parameters:
modulus -
publicExponent -
privateExponent -
primeP -
primeQ -
crtCoefficient -
Returns:
SshRsaPrivateCrtKey
Throws:
com.maverick.ssh.common.SshException

createRsaPrivateCrtKey

public abstract com.maverick.ssh.components.SshRsaPrivateCrtKey createRsaPrivateCrtKey(BigInteger modulus,
                                                                                       BigInteger publicExponent,
                                                                                       BigInteger privateExponent,
                                                                                       BigInteger primeP,
                                                                                       BigInteger primeQ,
                                                                                       BigInteger primeExponentP,
                                                                                       BigInteger primeExponentQ,
                                                                                       BigInteger crtCoefficient)
                                                                                throws com.maverick.ssh.common.SshException
Create an RSA co-efficient key from RSA parameters.

Parameters:
modulus -
publicExponent -
privateExponent -
primeP -
primeQ -
primeExponentP -
primeExponentQ -
crtCoefficient -
Returns:
SshRsaPrivateCrtKey
Throws:
com.maverick.ssh.common.SshException

generateDsaKeyPair

public abstract com.maverick.ssh.components.SshKeyPair generateDsaKeyPair(int bits)
                                                                   throws com.maverick.ssh.common.SshException
Generate a DSA key pair.

Parameters:
bits -
Returns:
SshKeyPair
Throws:
com.maverick.ssh.common.SshException

createDsaPublicKey

public abstract com.maverick.ssh.components.SshDsaPublicKey createDsaPublicKey(BigInteger p,
                                                                               BigInteger q,
                                                                               BigInteger g,
                                                                               BigInteger y)
                                                                        throws com.maverick.ssh.common.SshException
Create an instance of an DSA public key.

Parameters:
p -
q -
g -
y -
Returns:
SshDsaPublicKey
Throws:
com.maverick.ssh.common.SshException

createDsaPublicKey

public abstract com.maverick.ssh.components.SshDsaPublicKey createDsaPublicKey()
Create an uninitialized instance of a DSA public key.

Returns:
SshDsaPublicKey

createDsaPrivateKey

public abstract com.maverick.ssh.components.SshDsaPrivateKey createDsaPrivateKey(BigInteger p,
                                                                                 BigInteger q,
                                                                                 BigInteger g,
                                                                                 BigInteger x,
                                                                                 BigInteger y)
                                                                          throws com.maverick.ssh.common.SshException
Create a DSA private key from DSA parameters.

Parameters:
p -
q -
g -
x -
y -
Returns:
SshDsaPrivateKey
Throws:
com.maverick.ssh.common.SshException

getRND

public abstract com.maverick.ssh.components.SshSecureRandomGenerator getRND()
                                                                     throws com.maverick.ssh.common.SshException
Get the secure number generator implementation.

Returns:
SshSecureRandomGenerator
Throws:
com.maverick.ssh.common.SshException

loadKeystore

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

Parameters:
keystoreFile -
alias -
storePassphrase -
keyPassphrase -
Throws:
IOException

loadKeystore

public abstract void loadKeystore(InputStream in,
                                  String alias,
                                  String storePassphrase,
                                  String keyPassphrase,
                                  SshContext context)
                           throws IOException
Load a host key from a keystore InputStream.

Parameters:
in -
alias -
storePassphrase -
keyPassphrase -
Throws:
IOException

loadKeystore

public abstract void loadKeystore(File keystoreFile,
                                  String alias,
                                  String storePassphrase,
                                  String keyPassphrase,
                                  String storeType,
                                  SshContext context)
                           throws IOException
Throws:
IOException

loadKeystore

public abstract void loadKeystore(InputStream in,
                                  String alias,
                                  String storePassphrase,
                                  String keyPassphrase,
                                  String storeType,
                                  SshContext context)
                           throws IOException
Throws:
IOException

supportedCompressionsCS

public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCompression> supportedCompressionsCS()

supportedCompressionsSC

public com.maverick.ssh.components.ComponentFactory<com.maverick.ssh.components.SshCompression> supportedCompressionsSC()


Copyright © 2012. All Rights Reserved.