com.maverick.sshd
Class SshContextFactory
java.lang.Object
com.maverick.sshd.SshContextFactory
- All Implemented Interfaces:
- ProtocolContextFactory<SshContext>
public abstract class SshContextFactory
- extends Object
- implements ProtocolContextFactory<SshContext>
|
Method Summary |
void |
configureAcceptorCodec(org.apache.mina.core.service.IoAcceptor acceptor,
DaemonContext<SshContext> daemonContext)
|
void |
configureAcceptorHandler(org.apache.mina.core.service.IoAcceptor acceptor,
DaemonContext<SshContext> daemonContext)
|
void |
configureAcceptorPreCodec(org.apache.mina.core.service.IoAcceptor acceptor,
DaemonContext<SshContext> daemonContext)
|
void |
configureAcceptorPreHandler(org.apache.mina.core.service.IoAcceptor acceptor,
DaemonContext<SshContext> daemonContext)
|
abstract SshContext |
createContext(SocketAddress remoteAddress,
SocketAddress localAddress)
|
protected SshContext |
createDefaultContext()
|
static com.maverick.ssh.components.SshKeyPair |
GenerateKeyFiles(File keyFilename,
String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat)
Generate a public and private key pair, save them to keyFilename and keyFilename.pub, return the key pair |
void |
loadHostKey(InputStream in,
String type,
int bitlength)
|
void |
loadHostKey(InputStream in,
String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat,
String passPhrase)
|
void |
loadHostKey(InputStream in,
String type,
int bitlength,
String passPhrase)
|
com.maverick.ssh.components.SshKeyPair |
loadKey(File key,
String passphrase)
|
com.maverick.ssh.components.SshKeyPair |
loadKey(InputStream in,
String passphrase)
|
void |
loadOrGenerateHostKey(File key,
String type,
int bitlength)
Load a host key from file, if the file does not exist then generate the
key. |
void |
loadOrGenerateHostKey(File key,
String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat,
String passPhrase)
Load a host key from file, if the file does not exist then generate the
key. |
void |
loadOrGenerateHostKey(File key,
String type,
int bitlength,
String passPhrase)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SshContextFactory
public SshContextFactory()
throws IOException,
com.maverick.ssh.common.SshException
- Throws:
IOException
com.maverick.ssh.common.SshException
SshContextFactory
public SshContextFactory(com.maverick.ssh.components.SshKeyPair... keys)
throws IOException,
com.maverick.ssh.common.SshException
- Throws:
IOException
com.maverick.ssh.common.SshException
SshContextFactory
public SshContextFactory(ServerComponentManager componentManager,
com.maverick.ssh.components.SshKeyPair... keys)
throws IOException,
com.maverick.ssh.common.SshException
- Throws:
IOException
com.maverick.ssh.common.SshException
configureAcceptorPreCodec
public void configureAcceptorPreCodec(org.apache.mina.core.service.IoAcceptor acceptor,
DaemonContext<SshContext> daemonContext)
- Specified by:
configureAcceptorPreCodec in interface ProtocolContextFactory<SshContext>
configureAcceptorCodec
public final void configureAcceptorCodec(org.apache.mina.core.service.IoAcceptor acceptor,
DaemonContext<SshContext> daemonContext)
- Specified by:
configureAcceptorCodec in interface ProtocolContextFactory<SshContext>
configureAcceptorPreHandler
public void configureAcceptorPreHandler(org.apache.mina.core.service.IoAcceptor acceptor,
DaemonContext<SshContext> daemonContext)
- Specified by:
configureAcceptorPreHandler in interface ProtocolContextFactory<SshContext>
configureAcceptorHandler
public final void configureAcceptorHandler(org.apache.mina.core.service.IoAcceptor acceptor,
DaemonContext<SshContext> daemonContext)
- Specified by:
configureAcceptorHandler in interface ProtocolContextFactory<SshContext>
createContext
public abstract SshContext createContext(SocketAddress remoteAddress,
SocketAddress localAddress)
throws IOException
- Specified by:
createContext in interface ProtocolContextFactory<SshContext>
- Throws:
IOException
createDefaultContext
protected SshContext createDefaultContext()
throws IOException
- Throws:
IOException
loadOrGenerateHostKey
public void loadOrGenerateHostKey(File key,
String type,
int bitlength)
throws IOException,
com.maverick.ssh.components.publickey.InvalidPassphraseException,
com.maverick.ssh.common.SshException
- Load a host key from file, if the file does not exist then generate the
key.
- Parameters:
key - the key filetype - the type of key; acceptable values are SshKeyPairGenerator.SSH2_RSA
or SshKeyPairGenerator.SSH2_DSAbitlength - the bit length of the key
- Throws:
IOException
com.maverick.ssh.common.SshException
com.maverick.ssh.components.publickey.InvalidPassphraseException
loadOrGenerateHostKey
public void loadOrGenerateHostKey(File key,
String type,
int bitlength,
String passPhrase)
throws IOException,
com.maverick.ssh.components.publickey.InvalidPassphraseException,
com.maverick.ssh.common.SshException
- Throws:
IOException
com.maverick.ssh.components.publickey.InvalidPassphraseException
com.maverick.ssh.common.SshException
loadHostKey
public void loadHostKey(InputStream in,
String type,
int bitlength)
throws IOException,
com.maverick.ssh.components.publickey.InvalidPassphraseException,
com.maverick.ssh.common.SshException
- Throws:
IOException
com.maverick.ssh.components.publickey.InvalidPassphraseException
com.maverick.ssh.common.SshException
loadHostKey
public void loadHostKey(InputStream in,
String type,
int bitlength,
String passPhrase)
throws IOException,
com.maverick.ssh.components.publickey.InvalidPassphraseException,
com.maverick.ssh.common.SshException
- Throws:
IOException
com.maverick.ssh.components.publickey.InvalidPassphraseException
com.maverick.ssh.common.SshException
loadOrGenerateHostKey
public void loadOrGenerateHostKey(File key,
String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat,
String passPhrase)
throws IOException,
com.maverick.ssh.components.publickey.InvalidPassphraseException,
com.maverick.ssh.common.SshException
- Load a host key from file, if the file does not exist then generate the
key.
- Parameters:
key - the key filetype - the type of key; acceptable values are SshKeyPairGenerator.SSH2_RSA
or SshKeyPairGenerator.SSH2_DSAbitlength - the bit length of the keyprivateKeyFormat - the format of the private key, com.sshtools.publickey.SshPrivateKeyFileFactorypublicKeyFormat - the format of the public key, {see com.sshtools.publickey.SshPublicKeyFileFactory}passPhrase - the passPhrase of an existing host key
- Throws:
IOException
com.maverick.ssh.common.SshException
com.maverick.ssh.components.publickey.InvalidPassphraseException
loadHostKey
public void loadHostKey(InputStream in,
String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat,
String passPhrase)
throws IOException,
com.maverick.ssh.components.publickey.InvalidPassphraseException,
com.maverick.ssh.common.SshException
- Throws:
IOException
com.maverick.ssh.components.publickey.InvalidPassphraseException
com.maverick.ssh.common.SshException
loadKey
public com.maverick.ssh.components.SshKeyPair loadKey(File key,
String passphrase)
throws IOException,
com.maverick.ssh.components.publickey.InvalidPassphraseException
- Throws:
IOException
com.maverick.ssh.components.publickey.InvalidPassphraseException
loadKey
public com.maverick.ssh.components.SshKeyPair loadKey(InputStream in,
String passphrase)
throws IOException,
com.maverick.ssh.components.publickey.InvalidPassphraseException
- Throws:
IOException
com.maverick.ssh.components.publickey.InvalidPassphraseException
GenerateKeyFiles
public static com.maverick.ssh.components.SshKeyPair GenerateKeyFiles(File keyFilename,
String type,
int bitlength,
int privateKeyFormat,
int publicKeyFormat)
throws IOException,
com.maverick.ssh.common.SshException
- Generate a public and private key pair, save them to keyFilename and keyFilename.pub, return the key pair
- Parameters:
keyFilename - type - bitlength - privateKeyFormat - publicKeyFormat -
- Returns:
- SshKeyPair generated.
- Throws:
IOException
com.maverick.ssh.common.SshException
Copyright © 2012. All Rights Reserved.