com.mindbright.ssh
Class SSH

java.lang.Object
  extended bycom.mindbright.ssh.SSH
Direct Known Subclasses:
SSHChannelController, SSHClient, SSHServer

public abstract class SSH
extends java.lang.Object


Field Summary
static int AUTH_CRYPTOCARD
           
static int AUTH_DEFAULT
           
static int AUTH_KBDINTERACT
           
static int AUTH_KERBEROS
           
static int AUTH_NOTSUPPORTED
           
static int AUTH_PASSWORD
           
static int AUTH_PUBLICKEY
           
static int AUTH_RHOSTS
           
static int AUTH_RHOSTS_RSA
           
static int AUTH_SDI
           
static int AUTH_TIS
           
static java.lang.String[] authTypeDesc
           
static int CIPHER_3DES
           
static int CIPHER_BLOWFISH
           
static int CIPHER_DEFAULT
           
static int CIPHER_DES
           
static int CIPHER_IDEA
           
static int CIPHER_NONE
           
static int CIPHER_NOTSUPPORTED
           
static int CIPHER_RC4
           
static int CIPHER_RESERVED
           
static int CIPHER_TSS
           
static java.lang.String[][] cipherClasses
           
protected  int cipherType
           
static int CMSG_ACM_ACCESS_DENIED
           
static int CMSG_ACM_NEW_PIN
           
static int CMSG_ACM_NEW_PIN_ACCEPTED
           
static int CMSG_ACM_NEW_PIN_REJECTED
           
static int CMSG_ACM_NEW_PIN_REQUIRED
           
static int CMSG_ACM_NEXT_CODE
           
static int CMSG_ACM_NEXT_CODE_REQUIRED
           
static int CMSG_ACM_OK
           
static int CMSG_AGENT_REQUEST_FORWARDING
           
static int CMSG_AUTH_PASSWORD
           
static int CMSG_AUTH_RHOSTS
           
static int CMSG_AUTH_RHOSTS_RSA
           
static int CMSG_AUTH_RSA
           
static int CMSG_AUTH_RSA_RESPONSE
           
static int CMSG_AUTH_SDI
           
static int CMSG_AUTH_TIS
           
static int CMSG_AUTH_TIS_RESPONSE
           
static int CMSG_EOF
           
static int CMSG_EXEC_CMD
           
static int CMSG_EXEC_SHELL
           
static int CMSG_EXIT_CONFIRMATION
           
static int CMSG_MAX_PACKET_SIZE
           
static int CMSG_PORT_FORWARD_REQUEST
           
static int CMSG_REQUEST_COMPRESSION
           
static int CMSG_REQUEST_PTY
           
static int CMSG_SESSION_KEY
           
static int CMSG_STDIN_DATA
           
static int CMSG_USER
           
static int CMSG_WINDOW_SIZE
           
static int CMSG_X11_REQUEST_FORWARDING
           
static int CONNECT_CHAN_NUM
           
static java.lang.String CVS_DATE
           
static java.lang.String CVS_NAME
           
static boolean DEBUG
           
static boolean DEBUGMORE
           
static int DEFAULTPORT
           
static int HOST_KEY_LENGTH
           
static int IDX_CIPHER_CLASS
           
static int IDX_CIPHER_NAME
           
protected  boolean isAnSSHClient
           
static java.lang.String KNOWN_HOSTS_FILE
           
static int LISTEN_CHAN_NUM
           
static int MAIN_CHAN_NUM
           
static int MSG_ANY
           
static int MSG_CHANNEL_CLOSE
           
static int MSG_CHANNEL_CLOSE_CONFIRMATION
           
static int MSG_CHANNEL_DATA
           
static int MSG_CHANNEL_INPUT_EOF
           
static int MSG_CHANNEL_OPEN_CONFIRMATION
           
static int MSG_CHANNEL_OPEN_FAILURE
           
static int MSG_CHANNEL_OUTPUT_CLOSED
           
static int MSG_DEBUG
           
static int MSG_DISCONNECT
           
static int MSG_IGNORE
           
static int MSG_NONE
           
static int MSG_PORT_OPEN
           
static int PASS_KERBEROS_TGT
           
protected  int protocolFlags
           
static int PROTOFLAG_HOST_IN_FWD_OPEN
           
static int PROTOFLAG_SCREEN_NUMBER
           
static int PROXY_HTTP
           
static int PROXY_NONE
           
static int PROXY_NOTSUPPORTED
           
static int PROXY_SOCKS4
           
static int PROXY_SOCKS5_DNS
           
static int PROXY_SOCKS5_IP
           
static RandomSeed randomSeed
           
protected  SSHCipher rcvCipher
           
protected  SSHCompressor rcvComp
           
static SecureRandomAndPad secureRandom
           
static int SERVER_KEY_LENGTH
           
static int SESSION_KEY_LENGTH
           
protected  byte[] sessionId
           
protected  byte[] sessionKey
           
static int SMSG_AGENT_OPEN
           
static int SMSG_AUTH_RSA_CHALLENGE
           
static int SMSG_AUTH_TIS_CHALLENGE
           
static int SMSG_EXITSTATUS
           
static int SMSG_FAILURE
           
static int SMSG_PUBLIC_KEY
           
static int SMSG_STDERR_DATA
           
static int SMSG_STDOUT_DATA
           
static int SMSG_SUCCESS
           
static int SMSG_X11_OPEN
           
protected  SSHCipher sndCipher
           
protected  SSHCompressor sndComp
           
static int SRV_HOSTKEY_CHANGED
           
static int SRV_HOSTKEY_KNOWN
           
static int SRV_HOSTKEY_NEW
           
protected  byte[] srvCookie
           
protected  RSAPublicKey srvHostKey
           
protected  RSAPublicKey srvServerKey
           
static int SSH_VER_MAJOR
           
static int SSH_VER_MINOR
           
protected  int supportedAuthTypes
           
protected  int supportedCiphers
           
static int TTY_OP_END
           
static int TTY_OP_ISPEED
           
static int TTY_OP_OSPEED
           
static int UNKNOWN_CHAN_NUM
           
static java.lang.String VER_MINDTERM
           
static java.lang.String VER_MINDTUNL
           
 
Constructor Summary
SSH()
           
 
Method Summary
static java.lang.String generateKeyFiles(RSAPrivateCrtKey key, java.lang.String fileName, java.lang.String passwd, java.lang.String comment)
           
static java.lang.String getAltAuthName(int authType)
           
static java.lang.String getAuthName(int authType)
           
static int getAuthType(java.lang.String authName)
           
static int[] getAuthTypes(java.lang.String authList)
           
static java.lang.String getCipherName(int cipherType)
           
static int getCipherType(java.lang.String cipherName)
           
static int getProxyType(java.lang.String typeName)
           
static java.lang.String[] getProxyTypes()
           
 java.lang.String getVersionId(boolean client)
           
static boolean haveSecureRandom()
           
protected  void initCipher(boolean server)
           
protected  void initClientCipher()
           
static void initSeedGenerator()
           
protected  void initServerCipher()
           
protected  boolean isAuthTypeSupported(int authType)
           
protected  boolean isCipherSupported(int cipherType)
           
protected  boolean isProtocolFlagSet(int protFlag)
           
static void log(java.lang.String msg)
           
static void logDebug(java.lang.String msg)
           
static void logExtra(java.lang.String msg)
           
static void logIgnore(SSHPduInputStream pdu)
           
static RandomSeed randomSeed()
           
static SecureRandomAndPad secureRandom()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG

DEBUGMORE

public static boolean DEBUGMORE

SSH_VER_MAJOR

public static final int SSH_VER_MAJOR
See Also:
Constant Field Values

SSH_VER_MINOR

public static final int SSH_VER_MINOR
See Also:
Constant Field Values

VER_MINDTERM

public static final java.lang.String VER_MINDTERM

VER_MINDTUNL

public static final java.lang.String VER_MINDTUNL

CVS_NAME

public static final java.lang.String CVS_NAME
See Also:
Constant Field Values

CVS_DATE

public static final java.lang.String CVS_DATE
See Also:
Constant Field Values

DEFAULTPORT

public static final int DEFAULTPORT
See Also:
Constant Field Values

SESSION_KEY_LENGTH

public static final int SESSION_KEY_LENGTH
See Also:
Constant Field Values

SERVER_KEY_LENGTH

public static final int SERVER_KEY_LENGTH
See Also:
Constant Field Values

HOST_KEY_LENGTH

public static final int HOST_KEY_LENGTH
See Also:
Constant Field Values

PROTOFLAG_SCREEN_NUMBER

public static final int PROTOFLAG_SCREEN_NUMBER
See Also:
Constant Field Values

PROTOFLAG_HOST_IN_FWD_OPEN

public static final int PROTOFLAG_HOST_IN_FWD_OPEN
See Also:
Constant Field Values

MSG_ANY

public static final int MSG_ANY
See Also:
Constant Field Values

MSG_NONE

public static final int MSG_NONE
See Also:
Constant Field Values

MSG_DISCONNECT

public static final int MSG_DISCONNECT
See Also:
Constant Field Values

SMSG_PUBLIC_KEY

public static final int SMSG_PUBLIC_KEY
See Also:
Constant Field Values

CMSG_SESSION_KEY

public static final int CMSG_SESSION_KEY
See Also:
Constant Field Values

CMSG_USER

public static final int CMSG_USER
See Also:
Constant Field Values

CMSG_AUTH_RHOSTS

public static final int CMSG_AUTH_RHOSTS
See Also:
Constant Field Values

CMSG_AUTH_RSA

public static final int CMSG_AUTH_RSA
See Also:
Constant Field Values

SMSG_AUTH_RSA_CHALLENGE

public static final int SMSG_AUTH_RSA_CHALLENGE
See Also:
Constant Field Values

CMSG_AUTH_RSA_RESPONSE

public static final int CMSG_AUTH_RSA_RESPONSE
See Also:
Constant Field Values

CMSG_AUTH_PASSWORD

public static final int CMSG_AUTH_PASSWORD
See Also:
Constant Field Values

CMSG_REQUEST_PTY

public static final int CMSG_REQUEST_PTY
See Also:
Constant Field Values

CMSG_WINDOW_SIZE

public static final int CMSG_WINDOW_SIZE
See Also:
Constant Field Values

CMSG_EXEC_SHELL

public static final int CMSG_EXEC_SHELL
See Also:
Constant Field Values

CMSG_EXEC_CMD

public static final int CMSG_EXEC_CMD
See Also:
Constant Field Values

SMSG_SUCCESS

public static final int SMSG_SUCCESS
See Also:
Constant Field Values

SMSG_FAILURE

public static final int SMSG_FAILURE
See Also:
Constant Field Values

CMSG_STDIN_DATA

public static final int CMSG_STDIN_DATA
See Also:
Constant Field Values

SMSG_STDOUT_DATA

public static final int SMSG_STDOUT_DATA
See Also:
Constant Field Values

SMSG_STDERR_DATA

public static final int SMSG_STDERR_DATA
See Also:
Constant Field Values

CMSG_EOF

public static final int CMSG_EOF
See Also:
Constant Field Values

SMSG_EXITSTATUS

public static final int SMSG_EXITSTATUS
See Also:
Constant Field Values

MSG_CHANNEL_OPEN_CONFIRMATION

public static final int MSG_CHANNEL_OPEN_CONFIRMATION
See Also:
Constant Field Values

MSG_CHANNEL_OPEN_FAILURE

public static final int MSG_CHANNEL_OPEN_FAILURE
See Also:
Constant Field Values

MSG_CHANNEL_DATA

public static final int MSG_CHANNEL_DATA
See Also:
Constant Field Values

MSG_CHANNEL_CLOSE

public static final int MSG_CHANNEL_CLOSE
See Also:
Constant Field Values

MSG_CHANNEL_CLOSE_CONFIRMATION

public static final int MSG_CHANNEL_CLOSE_CONFIRMATION
See Also:
Constant Field Values

MSG_CHANNEL_INPUT_EOF

public static final int MSG_CHANNEL_INPUT_EOF
See Also:
Constant Field Values

MSG_CHANNEL_OUTPUT_CLOSED

public static final int MSG_CHANNEL_OUTPUT_CLOSED
See Also:
Constant Field Values

SMSG_X11_OPEN

public static final int SMSG_X11_OPEN
See Also:
Constant Field Values

CMSG_PORT_FORWARD_REQUEST

public static final int CMSG_PORT_FORWARD_REQUEST
See Also:
Constant Field Values

MSG_PORT_OPEN

public static final int MSG_PORT_OPEN
See Also:
Constant Field Values

CMSG_AGENT_REQUEST_FORWARDING

public static final int CMSG_AGENT_REQUEST_FORWARDING
See Also:
Constant Field Values

SMSG_AGENT_OPEN

public static final int SMSG_AGENT_OPEN
See Also:
Constant Field Values

MSG_IGNORE

public static final int MSG_IGNORE
See Also:
Constant Field Values

CMSG_EXIT_CONFIRMATION

public static final int CMSG_EXIT_CONFIRMATION
See Also:
Constant Field Values

CMSG_X11_REQUEST_FORWARDING

public static final int CMSG_X11_REQUEST_FORWARDING
See Also:
Constant Field Values

CMSG_AUTH_RHOSTS_RSA

public static final int CMSG_AUTH_RHOSTS_RSA
See Also:
Constant Field Values

MSG_DEBUG

public static final int MSG_DEBUG
See Also:
Constant Field Values

CMSG_REQUEST_COMPRESSION

public static final int CMSG_REQUEST_COMPRESSION
See Also:
Constant Field Values

CMSG_MAX_PACKET_SIZE

public static final int CMSG_MAX_PACKET_SIZE
See Also:
Constant Field Values

CMSG_AUTH_TIS

public static final int CMSG_AUTH_TIS
See Also:
Constant Field Values

SMSG_AUTH_TIS_CHALLENGE

public static final int SMSG_AUTH_TIS_CHALLENGE
See Also:
Constant Field Values

CMSG_AUTH_TIS_RESPONSE

public static final int CMSG_AUTH_TIS_RESPONSE
See Also:
Constant Field Values

CMSG_AUTH_SDI

public static final int CMSG_AUTH_SDI
See Also:
Constant Field Values

CMSG_ACM_OK

public static final int CMSG_ACM_OK
See Also:
Constant Field Values

CMSG_ACM_ACCESS_DENIED

public static final int CMSG_ACM_ACCESS_DENIED
See Also:
Constant Field Values

CMSG_ACM_NEXT_CODE_REQUIRED

public static final int CMSG_ACM_NEXT_CODE_REQUIRED
See Also:
Constant Field Values

CMSG_ACM_NEXT_CODE

public static final int CMSG_ACM_NEXT_CODE
See Also:
Constant Field Values

CMSG_ACM_NEW_PIN_REQUIRED

public static final int CMSG_ACM_NEW_PIN_REQUIRED
See Also:
Constant Field Values

CMSG_ACM_NEW_PIN_ACCEPTED

public static final int CMSG_ACM_NEW_PIN_ACCEPTED
See Also:
Constant Field Values

CMSG_ACM_NEW_PIN_REJECTED

public static final int CMSG_ACM_NEW_PIN_REJECTED
See Also:
Constant Field Values

CMSG_ACM_NEW_PIN

public static final int CMSG_ACM_NEW_PIN
See Also:
Constant Field Values

IDX_CIPHER_CLASS

public static final int IDX_CIPHER_CLASS
See Also:
Constant Field Values

IDX_CIPHER_NAME

public static final int IDX_CIPHER_NAME
See Also:
Constant Field Values

cipherClasses

public static final java.lang.String[][] cipherClasses

CIPHER_NONE

public static final int CIPHER_NONE
See Also:
Constant Field Values

CIPHER_IDEA

public static final int CIPHER_IDEA
See Also:
Constant Field Values

CIPHER_DES

public static final int CIPHER_DES
See Also:
Constant Field Values

CIPHER_3DES

public static final int CIPHER_3DES
See Also:
Constant Field Values

CIPHER_TSS

public static final int CIPHER_TSS
See Also:
Constant Field Values

CIPHER_RC4

public static final int CIPHER_RC4
See Also:
Constant Field Values

CIPHER_BLOWFISH

public static final int CIPHER_BLOWFISH
See Also:
Constant Field Values

CIPHER_RESERVED

public static final int CIPHER_RESERVED
See Also:
Constant Field Values

CIPHER_NOTSUPPORTED

public static final int CIPHER_NOTSUPPORTED
See Also:
Constant Field Values

CIPHER_DEFAULT

public static final int CIPHER_DEFAULT
See Also:
Constant Field Values

authTypeDesc

public static final java.lang.String[] authTypeDesc

AUTH_RHOSTS

public static final int AUTH_RHOSTS
See Also:
Constant Field Values

AUTH_PUBLICKEY

public static final int AUTH_PUBLICKEY
See Also:
Constant Field Values

AUTH_PASSWORD

public static final int AUTH_PASSWORD
See Also:
Constant Field Values

AUTH_RHOSTS_RSA

public static final int AUTH_RHOSTS_RSA
See Also:
Constant Field Values

AUTH_TIS

public static final int AUTH_TIS
See Also:
Constant Field Values

AUTH_KERBEROS

public static final int AUTH_KERBEROS
See Also:
Constant Field Values

PASS_KERBEROS_TGT

public static final int PASS_KERBEROS_TGT
See Also:
Constant Field Values

AUTH_SDI

public static final int AUTH_SDI
See Also:
Constant Field Values

AUTH_CRYPTOCARD

public static final int AUTH_CRYPTOCARD
See Also:
Constant Field Values

AUTH_KBDINTERACT

public static final int AUTH_KBDINTERACT
See Also:
Constant Field Values

AUTH_NOTSUPPORTED

public static final int AUTH_NOTSUPPORTED

AUTH_DEFAULT

public static final int AUTH_DEFAULT
See Also:
Constant Field Values

PROXY_NONE

public static final int PROXY_NONE
See Also:
Constant Field Values

PROXY_HTTP

public static final int PROXY_HTTP
See Also:
Constant Field Values

PROXY_SOCKS4

public static final int PROXY_SOCKS4
See Also:
Constant Field Values

PROXY_SOCKS5_DNS

public static final int PROXY_SOCKS5_DNS
See Also:
Constant Field Values

PROXY_SOCKS5_IP

public static final int PROXY_SOCKS5_IP
See Also:
Constant Field Values

PROXY_NOTSUPPORTED

public static final int PROXY_NOTSUPPORTED

TTY_OP_END

public static final int TTY_OP_END
See Also:
Constant Field Values

TTY_OP_ISPEED

public static final int TTY_OP_ISPEED
See Also:
Constant Field Values

TTY_OP_OSPEED

public static final int TTY_OP_OSPEED
See Also:
Constant Field Values

MAIN_CHAN_NUM

public static final int MAIN_CHAN_NUM
See Also:
Constant Field Values

CONNECT_CHAN_NUM

public static final int CONNECT_CHAN_NUM
See Also:
Constant Field Values

LISTEN_CHAN_NUM

public static final int LISTEN_CHAN_NUM
See Also:
Constant Field Values

UNKNOWN_CHAN_NUM

public static final int UNKNOWN_CHAN_NUM
See Also:
Constant Field Values

KNOWN_HOSTS_FILE

public static final java.lang.String KNOWN_HOSTS_FILE
See Also:
Constant Field Values

SRV_HOSTKEY_KNOWN

public static final int SRV_HOSTKEY_KNOWN
See Also:
Constant Field Values

SRV_HOSTKEY_NEW

public static final int SRV_HOSTKEY_NEW
See Also:
Constant Field Values

SRV_HOSTKEY_CHANGED

public static final int SRV_HOSTKEY_CHANGED
See Also:
Constant Field Values

secureRandom

public static SecureRandomAndPad secureRandom

randomSeed

public static RandomSeed randomSeed

sessionKey

protected byte[] sessionKey

sessionId

protected byte[] sessionId

sndCipher

protected SSHCipher sndCipher

rcvCipher

protected SSHCipher rcvCipher

sndComp

protected SSHCompressor sndComp

rcvComp

protected SSHCompressor rcvComp

cipherType

protected int cipherType

srvCookie

protected byte[] srvCookie

srvServerKey

protected RSAPublicKey srvServerKey

srvHostKey

protected RSAPublicKey srvHostKey

protocolFlags

protected int protocolFlags

supportedCiphers

protected int supportedCiphers

supportedAuthTypes

protected int supportedAuthTypes

isAnSSHClient

protected boolean isAnSSHClient
Constructor Detail

SSH

public SSH()
Method Detail

getVersionId

public java.lang.String getVersionId(boolean client)

getProxyTypes

public static java.lang.String[] getProxyTypes()

getProxyType

public static int getProxyType(java.lang.String typeName)
                        throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getCipherName

public static java.lang.String getCipherName(int cipherType)

getCipherType

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

getAuthName

public static java.lang.String getAuthName(int authType)

getAltAuthName

public static java.lang.String getAltAuthName(int authType)

getAuthType

public static int getAuthType(java.lang.String authName)
                       throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getAuthTypes

public static int[] getAuthTypes(java.lang.String authList)
                          throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

isCipherSupported

protected boolean isCipherSupported(int cipherType)

isAuthTypeSupported

protected boolean isAuthTypeSupported(int authType)

isProtocolFlagSet

protected boolean isProtocolFlagSet(int protFlag)

haveSecureRandom

public static boolean haveSecureRandom()

randomSeed

public static RandomSeed randomSeed()

initSeedGenerator

public static void initSeedGenerator()

secureRandom

public static SecureRandomAndPad secureRandom()

log

public static void log(java.lang.String msg)

logExtra

public static void logExtra(java.lang.String msg)

logDebug

public static void logDebug(java.lang.String msg)

logIgnore

public static void logIgnore(SSHPduInputStream pdu)

initClientCipher

protected void initClientCipher()
                         throws java.io.IOException
Throws:
java.io.IOException

initServerCipher

protected void initServerCipher()
                         throws java.io.IOException
Throws:
java.io.IOException

initCipher

protected void initCipher(boolean server)
                   throws java.io.IOException
Throws:
java.io.IOException

generateKeyFiles

public static java.lang.String generateKeyFiles(RSAPrivateCrtKey key,
                                                java.lang.String fileName,
                                                java.lang.String passwd,
                                                java.lang.String comment)
                                         throws java.io.IOException
Throws:
java.io.IOException