Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindbright.ssh2
Class SSH2Preferences

    java.lang.Object
      com.mindbright.ssh2.SSH2Preferences

public class SSH2Preferences
extends java.lang.Object

This class is a container for all protocol preferences and the packet version used in the class `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 trasport 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.

See Also:
  `SSH2Transport`, `SSH2Connection`

Field Summary
`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_PKT_SZ` Misc internal preferences
`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` | `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` | `TX_MAX_PKT_SZ`
`static java.lang.String` | `X11_DISPLAY`

Constructor Summary
`SSH2Preferences()`
`SSH2Preferences(java.util.Properties props)`

Method Summary
`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)`
`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)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PKG_VERSION

    public static final java.lang.String PKG_VERSION

See Also:
  Constant Field Values

### KEX_ALGORITHMS

    public static final java.lang.String KEX_ALGORITHMS

  Transport layer preferences

  See Also:
    Constant Field Values

### HOST_KEY_ALG

    public static final java.lang.String HOST_KEY_ALG

See Also:
  Constant Field Values

### CIPHERS_C2S

    public static final java.lang.String CIPHERS_C2S

See Also:
  Constant Field Values

### CIPHERS_S2C

    public static final java.lang.String CIPHERS_S2C

See Also:
  Constant Field Values

### MACS_C2S

    public static final java.lang.String MACS_C2S

See Also:
  Constant Field Values

### MACS_S2C

    public static final java.lang.String MACS_S2C

See Also:
  Constant Field Values

### COMP_C2S

    public static final java.lang.String COMP_C2S

See Also:
  Constant Field Values

### COMP_S2C

    public static final java.lang.String COMP_S2C

See Also:
  Constant Field Values

### LANG_C2S

    public static final java.lang.String LANG_C2S

See Also:
  Constant Field Values

### LANG_S2C

    public static final java.lang.String LANG_S2C

See Also:
  Constant Field Values

### COMP_LEVEL

    public static final java.lang.String COMP_LEVEL

See Also:
  Constant Field Values

### ALIVE

    public static final java.lang.String ALIVE

See Also:
  Constant Field Values

### RX_INIT_WIN_SZ

    public static final java.lang.String RX_INIT_WIN_SZ

  Connection layer preferences

  See Also:
    Constant Field Values

### RX_MAX_PKT_SZ

    public static final java.lang.String RX_MAX_PKT_SZ

See Also:
  Constant Field Values

### TX_MAX_PKT_SZ

    public static final java.lang.String TX_MAX_PKT_SZ

See Also:
  Constant Field Values

### X11_DISPLAY

    public static final java.lang.String X11_DISPLAY

See Also:
  Constant Field Values

### QUEUED_RX_CHAN

    public static final java.lang.String QUEUED_RX_CHAN

See Also:
  Constant Field Values

### DEFAULT_PKT_SZ

    public static final java.lang.String DEFAULT_PKT_SZ

  Misc internal preferences

  See Also:
    Constant Field Values

### PKT_POOL_SZ

    public static final java.lang.String PKT_POOL_SZ

See Also:
  Constant Field Values

### TERM_MIN_LAT

    public static final java.lang.String TERM_MIN_LAT

See Also:
  Constant Field Values

### INT_IO_BUF_SZ

    public static final java.lang.String INT_IO_BUF_SZ

See Also:
  Constant Field Values

### QUEUE_DEPTH

    public static final java.lang.String QUEUE_DEPTH

See Also:
  Constant Field Values

### QUEUE_HIWATER

    public static final java.lang.String QUEUE_HIWATER

See Also:
  Constant Field Values

### LOG_LEVEL

    public static final java.lang.String LOG_LEVEL

See Also:
  Constant Field Values

### LOG_FILE

    public static final java.lang.String LOG_FILE

See Also:
  Constant Field Values

### LOG_APPEND

    public static final java.lang.String LOG_APPEND

See Also:
  Constant Field Values

### CONNECT_TIMEOUT

    public static final java.lang.String CONNECT_TIMEOUT

See Also:
  Constant Field Values

### HELLO_TIMEOUT

    public static final java.lang.String HELLO_TIMEOUT

See Also:
  Constant Field Values

### PROXY_TIMEOUT

    public static final java.lang.String PROXY_TIMEOUT

See Also:
  Constant Field Values

### KEX_TIMEOUT

    public static final java.lang.String KEX_TIMEOUT

See Also:
  Constant Field Values

### SOCK_OPT

    public static final 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

  See Also:
    Constant Field Values

### SOCK_OPT_TRANSPORT

    public static final java.lang.String SOCK_OPT_TRANSPORT

See Also:
  Constant Field Values

### SOCK_OPT_LOCAL

    public static final java.lang.String SOCK_OPT_LOCAL

See Also:
  Constant Field Values

### SOCK_OPT_REMOTE

    public static final java.lang.String SOCK_OPT_REMOTE

See Also:
  Constant Field Values

### SO_TCP_NODELAY

    public static final java.lang.String SO_TCP_NODELAY

See Also:
  Constant Field Values

Constructor Detail

### SSH2Preferences

    public SSH2Preferences()

### SSH2Preferences

    public SSH2Preferences(java.util.Properties props)

Method Detail

### getDefaultProperties

    public static java.util.Properties getDefaultProperties()

### readFrom

    public void readFrom(SSH2TransportPDU pdu)

### writeTo

    public void writeTo(SSH2TransportPDU pdu)

### getPreference

    public java.lang.String getPreference(java.lang.String type)

### getIntPreference

    public int getIntPreference(java.lang.String type)

### getBooleanPreference

    public boolean getBooleanPreference(java.lang.String type)

### setPreference

    public void setPreference(java.lang.String type,
                              java.lang.String value)

### getAgreedKEXAlgorithm

    public java.lang.String getAgreedKEXAlgorithm()

### getAgreedHostKeyAlgorithm

    public java.lang.String getAgreedHostKeyAlgorithm()

### getAgreedCipher

    public java.lang.String getAgreedCipher(boolean transmitter,
                                            boolean weAreAServer)

### getAgreedMac

    public java.lang.String getAgreedMac(boolean transmitter,
                                         boolean weAreAServer)

### getAgreedCompression

    public java.lang.String getAgreedCompression(boolean transmitter,
                                                 boolean weAreAServer)

### isSupported

    public boolean isSupported(java.lang.String type,
                               java.lang.String item)

### selectKEXAlgorithm

    public SSH2KeyExchanger selectKEXAlgorithm(SSH2Preferences peerPrefs,
                                               boolean weAreAServer)
                                        throws SSH2KEXFailedException

  Throws:
    `SSH2KEXFailedException`

### sameKEXGuess

    public boolean sameKEXGuess()

### canAgree

    public boolean canAgree(SSH2Preferences peerPrefs,
                            boolean weAreAServer)

### getDisagreeType

    public java.lang.String getDisagreeType()

### ssh2ToJCECipher

    public static java.lang.String ssh2ToJCECipher(java.lang.String prefCipher)

### ssh2ToJCEMac

    public static java.lang.String ssh2ToJCEMac(java.lang.String prefMac)

### getCipherKeyLen

    public static int getCipherKeyLen(java.lang.String cipherName)

### getMacKeyLen

    public static int getMacKeyLen(java.lang.String macName)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD