com.mindbright.ssh2
public class SSH2Preferences extends java.lang.Object
SSH2Transport
. It can
be created using a hard-coded list of preferences or it can be
created from a java.util.Properties
instance. All
preferences for algorithms are comma separated lists in order of
preference (as defined in the transport protocol spec.).
This class contains the negotiation logic to select preferences
from lists of client and server preferences. It also contains the
functionality to select a key exchange algorithm given the
available algorithms and host key types. These functions are used
from the SSH2Transport
class.
The preferences which can be set are listed in the
docs/Settings
file which should have been included in
your distribution of MindTerm.
SSH2Transport
,
SSH2Connection
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALIVE |
static java.lang.String |
CIPHERS_C2S |
static java.lang.String |
CIPHERS_S2C |
static java.lang.String |
COMP_C2S |
static java.lang.String |
COMP_LEVEL |
static java.lang.String |
COMP_S2C |
static java.lang.String |
CONNECT_TIMEOUT |
static java.lang.String |
DEFAULT_CIPHERS_LIMITED |
static java.lang.String |
DEFAULT_CIPHERS_UNLIMITED |
static java.lang.String |
DEFAULT_HMACS |
static java.lang.String |
DEFAULT_HMACS_NO_SHA2_512 |
static java.lang.String |
DEFAULT_HOST_KEY_ALGS |
static java.lang.String |
DEFAULT_HOST_KEY_ALGS_EC |
static java.lang.String |
DEFAULT_KEX_ECDH |
static java.lang.String |
DEFAULT_KEX_LIMITED |
static java.lang.String |
DEFAULT_KEX_UNLIMITED |
static java.lang.String |
DEFAULT_PKT_SZ
Misc internal preferences
|
static java.lang.String |
FIPS_CIPHERS |
static java.lang.String |
FIPS_CIPHERS_LIMITED |
static java.lang.String |
FIPS_HMACS |
static java.lang.String |
FIPS_HOST_KEY_ALG |
static java.lang.String |
FIPS_KEX_ALGORITHMS |
static java.lang.String |
HELLO_TIMEOUT |
static java.lang.String |
HOST_KEY_ALG |
static java.lang.String |
INT_IO_BUF_SZ |
static java.lang.String |
KEX_ALGORITHMS
Transport layer preferences
|
static java.lang.String |
KEX_TIMEOUT |
static java.lang.String |
LANG_C2S |
static java.lang.String |
LANG_S2C |
static java.lang.String |
LOG_APPEND |
static java.lang.String |
LOG_FILE |
static java.lang.String |
LOG_LEVEL |
static java.lang.String |
MACS_C2S |
static java.lang.String |
MACS_S2C |
static java.lang.String |
PKG_VERSION |
static java.lang.String |
PKT_POOL_SZ |
static java.lang.String |
PROXY_TIMEOUT |
static java.lang.String |
QUEUE_DEPTH |
static java.lang.String |
QUEUE_HIWATER |
static java.lang.String |
QUEUED_RX_CHAN |
static java.lang.String |
RX_INIT_WIN_SZ
Connection layer preferences
|
static java.lang.String |
RX_MAX_PKT_SZ |
static java.lang.String |
SFTP_TIMEOUT |
static java.lang.String |
SO_TCP_NODELAY |
static java.lang.String |
SOCK_OPT
Socket option preferences
Examples:
Enable TCP_NODELAY for the socket connected to the server:
socketoption.transport.tcp-nodelay = true
Enable TCP_NODELAY for all sockets to local forward '127.0.0.1:4711':
socketoption.local.127.0.0.1.4711.tcp-nodelay = true
|
static java.lang.String |
SOCK_OPT_LOCAL |
static java.lang.String |
SOCK_OPT_REMOTE |
static java.lang.String |
SOCK_OPT_TRANSPORT |
static java.lang.String |
TERM_MIN_LAT |
static java.lang.String |
TQUEUE_DEPTH |
static java.lang.String |
TQUEUE_HIWATER |
static java.lang.String |
TRANSPORT_CACHE_SIZE |
static java.lang.String |
TRANSPORT_CACHE_SIZE_TOTAL |
static java.lang.String |
TX_MAX_PKT_SZ |
static java.lang.String |
X11_DISPLAY |
static java.lang.String |
X11_DISPLAY_AUTO
Automatic display value
|
Constructor and Description |
---|
SSH2Preferences() |
SSH2Preferences(boolean fipsmode) |
SSH2Preferences(java.util.Properties props) |
Modifier and Type | Method and Description |
---|---|
boolean |
canAgree(SSH2Preferences peerPrefs,
boolean weAreAServer) |
java.lang.String |
getAgreedCipher(boolean transmitter,
boolean weAreAServer) |
java.lang.String |
getAgreedCompression(boolean transmitter,
boolean weAreAServer) |
java.lang.String |
getAgreedHostKeyAlgorithm() |
java.lang.String |
getAgreedKEXAlgorithm() |
java.lang.String |
getAgreedMac(boolean transmitter,
boolean weAreAServer) |
boolean |
getBooleanPreference(java.lang.String type) |
static int |
getCipherKeyLen(java.lang.String cipherName) |
static java.util.Properties |
getDefaultProperties() |
java.lang.String |
getDisagreeType() |
int |
getIntPreference(java.lang.String type) |
static int |
getMacKeyLen(java.lang.String macName) |
java.lang.String |
getPreference(java.lang.String type) |
long |
getUIntPreference(java.lang.String type) |
boolean |
isSupported(java.lang.String type,
java.lang.String item) |
void |
readFrom(SSH2TransportPDU pdu) |
boolean |
sameKEXGuess() |
SSH2KeyExchanger |
selectKEXAlgorithm(SSH2Preferences peerPrefs,
boolean weAreAServer) |
void |
setPreference(java.lang.String type,
java.lang.String value) |
static java.lang.String |
ssh2ToJCECipher(java.lang.String prefCipher) |
static java.lang.String |
ssh2ToJCEMac(java.lang.String prefMac) |
void |
writeTo(SSH2TransportPDU pdu) |
public static final java.lang.String PKG_VERSION
public static final java.lang.String KEX_ALGORITHMS
public static final java.lang.String HOST_KEY_ALG
public static final java.lang.String CIPHERS_C2S
public static final java.lang.String CIPHERS_S2C
public static final java.lang.String MACS_C2S
public static final java.lang.String MACS_S2C
public static final java.lang.String COMP_C2S
public static final java.lang.String COMP_S2C
public static final java.lang.String LANG_C2S
public static final java.lang.String LANG_S2C
public static final java.lang.String COMP_LEVEL
public static final java.lang.String ALIVE
public static final java.lang.String RX_INIT_WIN_SZ
public static final java.lang.String RX_MAX_PKT_SZ
public static final java.lang.String TX_MAX_PKT_SZ
public static final java.lang.String X11_DISPLAY
public static final java.lang.String QUEUED_RX_CHAN
public static final java.lang.String DEFAULT_PKT_SZ
public static final java.lang.String PKT_POOL_SZ
public static final java.lang.String TERM_MIN_LAT
public static final java.lang.String INT_IO_BUF_SZ
public static final java.lang.String QUEUE_DEPTH
public static final java.lang.String QUEUE_HIWATER
public static final java.lang.String TQUEUE_DEPTH
public static final java.lang.String TQUEUE_HIWATER
public static final java.lang.String LOG_LEVEL
public static final java.lang.String LOG_FILE
public static final java.lang.String LOG_APPEND
public static final java.lang.String TRANSPORT_CACHE_SIZE
public static final java.lang.String TRANSPORT_CACHE_SIZE_TOTAL
public static final java.lang.String SFTP_TIMEOUT
public static final java.lang.String CONNECT_TIMEOUT
public static final java.lang.String HELLO_TIMEOUT
public static final java.lang.String PROXY_TIMEOUT
public static final java.lang.String KEX_TIMEOUT
public static final java.lang.String SOCK_OPT
public static final java.lang.String SOCK_OPT_TRANSPORT
public static final java.lang.String SOCK_OPT_LOCAL
public static final java.lang.String SOCK_OPT_REMOTE
public static final java.lang.String SO_TCP_NODELAY
public static final java.lang.String X11_DISPLAY_AUTO
public static final java.lang.String FIPS_KEX_ALGORITHMS
public static final java.lang.String FIPS_HOST_KEY_ALG
public static final java.lang.String FIPS_CIPHERS
public static final java.lang.String FIPS_CIPHERS_LIMITED
public static final java.lang.String FIPS_HMACS
public static final java.lang.String DEFAULT_CIPHERS_UNLIMITED
public static final java.lang.String DEFAULT_CIPHERS_LIMITED
public static final java.lang.String DEFAULT_KEX_ECDH
public static final java.lang.String DEFAULT_KEX_UNLIMITED
public static final java.lang.String DEFAULT_KEX_LIMITED
public static final java.lang.String DEFAULT_HOST_KEY_ALGS
public static final java.lang.String DEFAULT_HOST_KEY_ALGS_EC
public static final java.lang.String DEFAULT_HMACS
public static final java.lang.String DEFAULT_HMACS_NO_SHA2_512
public SSH2Preferences()
public SSH2Preferences(boolean fipsmode)
public SSH2Preferences(java.util.Properties props)
public static java.util.Properties getDefaultProperties()
public void readFrom(SSH2TransportPDU pdu)
public void writeTo(SSH2TransportPDU pdu)
public java.lang.String getPreference(java.lang.String type)
public int getIntPreference(java.lang.String type)
public long getUIntPreference(java.lang.String type)
public boolean getBooleanPreference(java.lang.String type)
public void setPreference(java.lang.String type, java.lang.String value)
public java.lang.String getAgreedKEXAlgorithm()
public java.lang.String getAgreedHostKeyAlgorithm()
public java.lang.String getAgreedCipher(boolean transmitter, boolean weAreAServer)
public java.lang.String getAgreedMac(boolean transmitter, boolean weAreAServer)
public java.lang.String getAgreedCompression(boolean transmitter, boolean weAreAServer)
public boolean isSupported(java.lang.String type, java.lang.String item)
public SSH2KeyExchanger selectKEXAlgorithm(SSH2Preferences peerPrefs, boolean weAreAServer) throws SSH2KEXFailedException
SSH2KEXFailedException
public boolean sameKEXGuess()
public boolean canAgree(SSH2Preferences peerPrefs, boolean weAreAServer)
public java.lang.String getDisagreeType()
public static java.lang.String ssh2ToJCECipher(java.lang.String prefCipher)
public static java.lang.String ssh2ToJCEMac(java.lang.String prefMac)
public static int getCipherKeyLen(java.lang.String cipherName)
public static int getMacKeyLen(java.lang.String macName)