public class SshConfiguration
extends java.lang.Object
SshClient and some attributes /
callbacks that are common to all providers. Also contains a property sheet
that may be used to pass configuration to the provider.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CFG_KNOWN_HOSTS_PATH
Location of the known_hosts file.
|
static java.lang.String |
CFG_KNOWN_HOSTS_REVERSE_DNS
Do reverse DNS lookups for hosts in the known_hosts (
JschHostKeyManager). |
static java.lang.String |
CIPHER_3DES
SSH1 Cipher
|
static java.lang.String |
CIPHER_AES128_CBC
The AES CBC Cipher
|
static java.lang.String |
CIPHER_BLOWFISH_CBC
The Blowfish CBC cipher
|
static java.lang.String |
CIPHER_DES
SSH1 Cipher
|
static java.lang.String |
CIPHER_TRIPLEDES_CBC
The 3DES CBC cipher
|
static java.lang.String |
COMPRESSION_NONE
Compression off
|
static java.lang.String |
COMPRESSION_ZLIB
Optional zlib compression
|
static java.lang.String |
HMAC_MD5
MD5 message authentication
|
static java.lang.String |
HMAC_MD5_96
MD5 96 bit message authentication
|
static java.lang.String |
HMAC_SHA1
SHA1 message authentication
|
static java.lang.String |
HMAC_SHA1_96
SHA1 96 bit message authentication
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA1
Optional key exchange mechanism in which the server maintains a list of
acceptable generators and primes
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP1_SHA1
DH group 1 exchange method
|
static java.lang.String |
KEX_DIFFIE_HELLMAN_GROUP14_SHA1
DH group 14 exchange method
|
static java.lang.String |
PUBLIC_KEY_SSHDSA
SSH2 DSA Public Key
|
static java.lang.String |
PUBLIC_KEY_SSHRSA
SSH2 RSA Public Key
|
static java.lang.String |
PUBLIC_KEY_SSHRSA1
SSH1 RSA Public Key
|
static int |
SSH1_ONLY
Request only use of the SSH1 protocol.
|
static int |
SSH1_OR_SSH2
Request use of either SSH1 or SSH2 protocols.
|
static int |
SSH2_ONLY
Request only use of the SSH2 protocol.
|
| Constructor and Description |
|---|
SshConfiguration()
Constructor
|
SshConfiguration(java.util.Properties properties)
Constructor
|
SshConfiguration(java.util.Properties properties,
SshHostKeyValidator hostKeyValidator)
Constructor
|
SshConfiguration(SshHostKeyValidator hostKeyValidator)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRequiredCapability(Capability capability)
Add a capability we REQUIRE for this configuration
|
SshClient |
createClient()
Utility to create a client that may be used with this configuration.
|
SshBannerHandler |
getBannerHandler()
Get the banner handler (called to display the login banner).
|
SshHostKeyValidator |
getHostKeyValidator()
Get the object that is used to validate host keys.
|
static Logger |
getLogger()
Get the logger
|
java.lang.String |
getPreferredClientToServerCipher()
Get the preferred client to server cipher.
|
java.lang.String |
getPreferredClientToServerCompression()
Get the preferred client to server compression.
|
java.lang.String |
getPreferredClientToServerMAC()
Get the preferred client to server MAC.
|
java.lang.String |
getPreferredKeyExchange()
Get the preferred server to client key exchange.
|
java.lang.String |
getPreferredPublicKey()
Get the preferred public key algorithm.
|
java.lang.String |
getPreferredServerToClientCipher()
Get the preferred server to client cipher.
|
java.lang.String |
getPreferredServerToClientCompression()
Get the preferred server to client compression.
|
java.lang.String |
getPreferredServerToClientMAC()
Get the preferred server to client MAC.
|
java.lang.String |
getPreferredSSH1CipherType()
Get the preferred SSH1 cipher.
|
java.util.Properties |
getProperties()
Get the properties for this configuration.
|
int |
getProtocolVersion()
Get the protocol version to accept.
|
SshProxyServerDetails |
getProxyServer()
Get the proxy server details.
|
java.lang.String |
getSftpSSH1Path()
Get the path of the SFTP server executable (SSH1 only).
|
javax.net.SocketFactory |
getSocketFactory()
Get the socket factory to use to make outgoing connections to SSH
servers.
|
byte[] |
getX11Cookie()
Get the cookie to use for X11 forwarding.
|
java.lang.String |
getX11Host()
Get the host to use for X11 forwarding.
|
int |
getX11Port()
Get the port to use for X11 forwarding.
|
void |
providerHasCapabilities(SshProvider provider)
Test if a provider has all the capbilities required by this
configuration.
|
void |
setBannerHandler(SshBannerHandler bannerHandler)
Set the banner handler (called to display the login banner).
|
void |
setHostKeyValidator(SshHostKeyValidator hostKeyValidator)
Set the object that is used to validate host keys.
|
static void |
setLogger(Logger logger)
Set the logger to use
|
void |
setPreferredClientToServerCipher(java.lang.String preferredClientToServerCipher)
Set the preferred client to server cipher.
|
void |
setPreferredClientToServerCompression(java.lang.String preferredClientToServerCompression)
Set the preferred client to server compression.
|
void |
setPreferredClientToServerMAC(java.lang.String preferredClientToServerMAC)
Set the preferred client to server MAC.
|
void |
setPreferredKeyExchange(java.lang.String preferredKeyExchange)
Set the preferred key exchange.
|
void |
setPreferredPublicKey(java.lang.String preferredPublicKey)
Set the preferred public key algorithm.
|
void |
setPreferredServerToClientCipher(java.lang.String preferredServerToClientCipher)
Set the preferred server to client cipher.
|
void |
setPreferredServerToClientCompression(java.lang.String preferredServerToClientCompression)
Set the preferred server to client compression.
|
void |
setPreferredServerToClientMAC(java.lang.String preferredServerToClientMAC)
Set the preferred server to client MAC.
|
void |
setPreferredSSH1CipherType(java.lang.String preferredSSH1Cipher)
Set the preferred SSH1 cipher.
|
void |
setProtocolVersion(int protocolVersion)
Set the preferred protocol version.
|
void |
setProxyServer(SshProxyServerDetails proxyServer)
Set the proxy server details.
|
void |
setSftpSSH1Path(java.lang.String sftpSSH1Path)
Set the path of the SFTP server executable (SSH1 only).
|
void |
setSocketFactory(javax.net.SocketFactory socketFactory)
Set the socket factory to use to make outgoing connections to SSH
servers.
|
void |
setX11Cookie(byte[] x11Cookie)
Set the cookie to use for X11 forwarding.
|
void |
setX11Host(java.lang.String x11Host)
Set the host to use for X11 forwarding.
|
void |
setX11Port(int x11Port)
Set the port to use for X11 forwarding.
|
public static final java.lang.String CIPHER_TRIPLEDES_CBC
public static final java.lang.String CIPHER_BLOWFISH_CBC
public static final java.lang.String CIPHER_AES128_CBC
public static final java.lang.String HMAC_SHA1
public static final java.lang.String HMAC_SHA1_96
public static final java.lang.String HMAC_MD5
public static final java.lang.String HMAC_MD5_96
public static final java.lang.String COMPRESSION_NONE
public static final java.lang.String COMPRESSION_ZLIB
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP1_SHA1
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP14_SHA1
public static final java.lang.String KEX_DIFFIE_HELLMAN_GROUP_EXCHANGE_SHA1
public static final java.lang.String PUBLIC_KEY_SSHDSA
public static final java.lang.String PUBLIC_KEY_SSHRSA
public static final java.lang.String PUBLIC_KEY_SSHRSA1
public static final java.lang.String CIPHER_DES
public static final java.lang.String CIPHER_3DES
public static final int SSH1_ONLY
getProtocolVersion(),
Constant Field Valuespublic static final int SSH2_ONLY
getProtocolVersion(),
Constant Field Valuespublic static final int SSH1_OR_SSH2
getProtocolVersion(),
Constant Field Valuespublic static final java.lang.String CFG_KNOWN_HOSTS_REVERSE_DNS
JschHostKeyManager).public static final java.lang.String CFG_KNOWN_HOSTS_PATH
public SshConfiguration()
public SshConfiguration(SshHostKeyValidator hostKeyValidator)
hostKeyValidator - host key validatorpublic SshConfiguration(java.util.Properties properties)
properties - propertiespublic SshConfiguration(java.util.Properties properties,
SshHostKeyValidator hostKeyValidator)
properties - propertieshostKeyValidator - host key validatorpublic static void setLogger(Logger logger)
logger - loggerpublic static Logger getLogger()
public void addRequiredCapability(Capability capability)
capability - public SshHostKeyValidator getHostKeyValidator()
public void setHostKeyValidator(SshHostKeyValidator hostKeyValidator)
hostKeyValidator - host key validatorpublic int getProtocolVersion()
public java.util.Properties getProperties()
public java.lang.String getX11Host()
public void setX11Host(java.lang.String x11Host)
x11Host - X11 hostpublic int getX11Port()
public void setX11Port(int x11Port)
x11Port - port to use for X11 forwardingpublic byte[] getX11Cookie()
XDetails helper instead of setting this directly.public void setX11Cookie(byte[] x11Cookie)
XDetails helper instead of setting this directly.x11Cookie - X11 cookiepublic SshBannerHandler getBannerHandler()
public void setBannerHandler(SshBannerHandler bannerHandler)
bannerHandler - banner handlerpublic java.lang.String getPreferredServerToClientCipher()
SshProvider.getSupportedCiphers(int)public void setPreferredServerToClientCipher(java.lang.String preferredServerToClientCipher)
preferredServerToClientCipher - preferred server to client cipher.SshProvider.getSupportedCiphers(int)public java.lang.String getPreferredClientToServerCipher()
SshProvider.getSupportedCiphers(int)public void setPreferredClientToServerCipher(java.lang.String preferredClientToServerCipher)
preferredClientToServerCipher - preferred client to server cipher.SshProvider.getSupportedCiphers(int)public java.lang.String getPreferredServerToClientMAC()
SshProvider.getSupportedMAC()public void setPreferredServerToClientMAC(java.lang.String preferredServerToClientMAC)
preferredServerToClientMAC - preferred server to client MAC.SshProvider.getSupportedMAC()public java.lang.String getPreferredClientToServerMAC()
SshProvider.getSupportedMAC()public void setPreferredClientToServerMAC(java.lang.String preferredClientToServerMAC)
preferredClientToServerMAC - preferred client to server MAC.SshProvider.getSupportedMAC()public java.lang.String getPreferredServerToClientCompression()
SshProvider.getSupportedCompression()public void setPreferredServerToClientCompression(java.lang.String preferredServerToClientCompression)
preferredServerToClientCompression - preferred server to client
compression.SshProvider.getSupportedCompression()public java.lang.String getPreferredClientToServerCompression()
SshProvider.getSupportedCompression()public void setPreferredClientToServerCompression(java.lang.String preferredClientToServerCompression)
preferredClientToServerCompression - preferred client to server
compression.SshProvider.getSupportedCompression()public void setProtocolVersion(int protocolVersion)
protocolVersion - protocol versionpublic java.lang.String getPreferredKeyExchange()
SshProvider.getSupportedKeyExchange()public void setPreferredKeyExchange(java.lang.String preferredKeyExchange)
preferredKeyExchange - preferred key exchange.SshProvider.getSupportedKeyExchange()public java.lang.String getPreferredPublicKey()
SshProvider.getSupportedPublicKey()public void setPreferredPublicKey(java.lang.String preferredPublicKey)
preferredPublicKey - public key algorithm.SshProvider.getSupportedPublicKey()public SshProxyServerDetails getProxyServer()
public void setProxyServer(SshProxyServerDetails proxyServer)
proxyServer - proxy server detailspublic void setPreferredSSH1CipherType(java.lang.String preferredSSH1Cipher)
SshConfiguration.CIPHER_3DES or
CIPHER_DES as these are the only two supported
by SSH1.preferredSSH1Cipher - preferred SSH1 cipgerpublic java.lang.String getPreferredSSH1CipherType()
SshConfiguration.CIPHER_3DES or
CIPHER_DES as these are the only two supported
by SSH1.public void setSftpSSH1Path(java.lang.String sftpSSH1Path)
sftpSSH1Path - SSH1 SFTP server executable pathpublic java.lang.String getSftpSSH1Path()
public void providerHasCapabilities(SshProvider provider) throws java.lang.UnsupportedOperationException
provider - providerjava.lang.UnsupportedOperationException - if a provider does not have all the
required capabilitiespublic javax.net.SocketFactory getSocketFactory()
null when the default Java socket
factory is to be used.public void setSocketFactory(javax.net.SocketFactory socketFactory)
null to use the default Java socket factory.socketFactory - socket factorypublic SshClient createClient()
Copyright © 2018. All rights reserved.